@transcend-io/cli 6.16.1 → 6.18.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 +3 -0
- package/build/cli-chunk-csv.d.ts +14 -0
- package/build/cli-chunk-csv.d.ts.map +1 -0
- package/build/cli-chunk-csv.js +140 -0
- package/build/cli-chunk-csv.js.map +1 -0
- package/build/cli-upload-preferences.js +78 -18
- package/build/cli-upload-preferences.js.map +1 -1
- package/build/code-scanning/constants.d.ts.map +1 -1
- package/build/code-scanning/constants.js +2 -0
- package/build/code-scanning/constants.js.map +1 -1
- package/build/code-scanning/integrations/index.d.ts +1 -0
- package/build/code-scanning/integrations/index.d.ts.map +1 -1
- package/build/code-scanning/integrations/index.js +1 -0
- package/build/code-scanning/integrations/index.js.map +1 -1
- package/build/code-scanning/integrations/swift.d.ts +3 -0
- package/build/code-scanning/integrations/swift.d.ts.map +1 -0
- package/build/code-scanning/integrations/swift.js +62 -0
- package/build/code-scanning/integrations/swift.js.map +1 -0
- package/build/codecs.d.ts +2 -0
- package/build/codecs.d.ts.map +1 -1
- package/build/cron/writeCsv.d.ts +17 -1
- package/build/cron/writeCsv.d.ts.map +1 -1
- package/build/cron/writeCsv.js +51 -2
- package/build/cron/writeCsv.js.map +1 -1
- package/build/enums.d.ts +2 -2
- package/build/enums.d.ts.map +1 -1
- package/build/graphql/fetchAllRequestIdentifiers.d.ts +8 -0
- package/build/graphql/fetchAllRequestIdentifiers.d.ts.map +1 -1
- package/build/oneTrust/helpers/tests/flattenOneTrustQuestionResponses.test.js +1 -1
- package/build/oneTrust/helpers/tests/flattenOneTrustQuestionResponses.test.js.map +1 -1
- package/build/preference-management/getPreferencesForIdentifiers.d.ts.map +1 -1
- package/build/preference-management/getPreferencesForIdentifiers.js +6 -1
- package/build/preference-management/getPreferencesForIdentifiers.js.map +1 -1
- package/build/preference-management/parsePreferenceAndPurposeValuesFromCsv.d.ts.map +1 -1
- package/build/preference-management/parsePreferenceAndPurposeValuesFromCsv.js +75 -10
- package/build/preference-management/parsePreferenceAndPurposeValuesFromCsv.js.map +1 -1
- package/build/preference-management/parsePreferenceManagementCsv.d.ts +3 -1
- package/build/preference-management/parsePreferenceManagementCsv.d.ts.map +1 -1
- package/build/preference-management/parsePreferenceManagementCsv.js +7 -5
- package/build/preference-management/parsePreferenceManagementCsv.js.map +1 -1
- package/build/preference-management/uploadPreferenceManagementPreferencesInteractive.d.ts +3 -1
- package/build/preference-management/uploadPreferenceManagementPreferencesInteractive.d.ts.map +1 -1
- package/build/preference-management/uploadPreferenceManagementPreferencesInteractive.js +2 -1
- package/build/preference-management/uploadPreferenceManagementPreferencesInteractive.js.map +1 -1
- package/build/tests/findCodePackagesInFolder.test.js +16 -0
- package/build/tests/findCodePackagesInFolder.test.js.map +1 -1
- package/build/tsbuildinfo +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -844,6 +844,7 @@ Transcend can scan your codebase to inventory your code packages and dependencie
|
|
|
844
844
|
- package.json
|
|
845
845
|
- requirements.txt & setup.py
|
|
846
846
|
- Podfile
|
|
847
|
+
- Package.resolved
|
|
847
848
|
- build.gradle
|
|
848
849
|
- pubspec.yaml
|
|
849
850
|
- Gemfile & .gemspec
|
|
@@ -2485,6 +2486,8 @@ In order to use this cli, you will first need to follow [this guide](https://doc
|
|
|
2485
2486
|
|
|
2486
2487
|
#### Usage
|
|
2487
2488
|
|
|
2489
|
+
A sample CSV can be found [here](./examples/cli-upload-preferences-example.csv). In this example, `Sales` and `Marketing` are two custom Purposes, and `SalesCommunications` and `MarketingCommunications` are Preference Topics. During the interactive CLI prompt, you can map these columns to the slugs stored in Transcend!
|
|
2490
|
+
|
|
2488
2491
|
Upload consent preferences to partition key `4d1c5daa-90b7-4d18-aa40-f86a43d2c726`
|
|
2489
2492
|
|
|
2490
2493
|
```sh
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Chunks a large CSV file into smaller files of approximately 1.5GB each
|
|
4
|
+
* Note that you may need to increase the node memory limit for this script to run!!
|
|
5
|
+
*
|
|
6
|
+
* Dev Usage:
|
|
7
|
+
* yarn ts-node ./src/cli-chunk-csv.ts --inputFile=./working/full_export.csv
|
|
8
|
+
*
|
|
9
|
+
* Standard usage:
|
|
10
|
+
* yarn tr-chunk-csv --inputFile=/path/to/large.csv --outputDir=/path/to/output
|
|
11
|
+
*/
|
|
12
|
+
declare function main(): Promise<void>;
|
|
13
|
+
export { main };
|
|
14
|
+
//# sourceMappingURL=cli-chunk-csv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-chunk-csv.d.ts","sourceRoot":"","sources":["../src/cli-chunk-csv.ts"],"names":[],"mappings":";AA4BA;;;;;;;;;GASG;AACH,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CA2InC;AAUD,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
+
exports.main = void 0;
|
|
8
|
+
const csv_parse_1 = require("csv-parse");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const path_1 = require("path");
|
|
11
|
+
const promises_1 = require("stream/promises");
|
|
12
|
+
const stream_1 = require("stream");
|
|
13
|
+
const yargs_parser_1 = __importDefault(require("yargs-parser"));
|
|
14
|
+
const colors_1 = __importDefault(require("colors"));
|
|
15
|
+
const logger_1 = require("./logger");
|
|
16
|
+
const writeCsv_1 = require("./cron/writeCsv");
|
|
17
|
+
/** Size of each chunk in bytes (need to stay WELL under JS string size limit of 512MB) */
|
|
18
|
+
const CHUNK_SIZE = 10 * 1024 * 1024;
|
|
19
|
+
/**
|
|
20
|
+
* Format memory usage for logging
|
|
21
|
+
*
|
|
22
|
+
* @param memoryData - The NodeJS memory usage data to format
|
|
23
|
+
* @returns A formatted string showing memory usage in MB
|
|
24
|
+
*/
|
|
25
|
+
function formatMemoryUsage(memoryData) {
|
|
26
|
+
return Object.entries(memoryData)
|
|
27
|
+
.map(([key, value]) => `${key}: ${(value / 1024 / 1024).toFixed(2)} MB`)
|
|
28
|
+
.join(', ');
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Chunks a large CSV file into smaller files of approximately 1.5GB each
|
|
32
|
+
* Note that you may need to increase the node memory limit for this script to run!!
|
|
33
|
+
*
|
|
34
|
+
* Dev Usage:
|
|
35
|
+
* yarn ts-node ./src/cli-chunk-csv.ts --inputFile=./working/full_export.csv
|
|
36
|
+
*
|
|
37
|
+
* Standard usage:
|
|
38
|
+
* yarn tr-chunk-csv --inputFile=/path/to/large.csv --outputDir=/path/to/output
|
|
39
|
+
*/
|
|
40
|
+
async function main() {
|
|
41
|
+
// Parse command line arguments
|
|
42
|
+
const { inputFile, outputDir } = (0, yargs_parser_1.default)(process.argv.slice(2));
|
|
43
|
+
// Ensure inputFile is provided
|
|
44
|
+
if (!inputFile) {
|
|
45
|
+
logger_1.logger.error(colors_1.default.red('An input file must be provided. You can specify using --inputFile=/path/to/large.csv'));
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
const baseFileName = (0, path_1.basename)(inputFile, '.csv');
|
|
49
|
+
const outputDirectory = outputDir || (0, path_1.dirname)(inputFile);
|
|
50
|
+
let currentChunkSize = 0;
|
|
51
|
+
let currentChunkNumber = 1;
|
|
52
|
+
let headerRow = null;
|
|
53
|
+
let currentOutputFile = (0, path_1.join)(outputDirectory, `${baseFileName}_chunk1.csv`);
|
|
54
|
+
let expectedColumnCount = null;
|
|
55
|
+
let totalLinesProcessed = 0;
|
|
56
|
+
const parser = new csv_parse_1.Parser({
|
|
57
|
+
columns: false,
|
|
58
|
+
skip_empty_lines: true,
|
|
59
|
+
});
|
|
60
|
+
const chunker = new stream_1.Transform({
|
|
61
|
+
objectMode: true,
|
|
62
|
+
/**
|
|
63
|
+
* Transform function that processes each chunk of CSV data
|
|
64
|
+
*
|
|
65
|
+
* @param chunk - Array of strings representing a CSV row
|
|
66
|
+
* @param encoding - The encoding of the chunk
|
|
67
|
+
* @param callback - Callback function to signal completion
|
|
68
|
+
*/
|
|
69
|
+
transform(chunk, encoding, callback) {
|
|
70
|
+
if (!headerRow) {
|
|
71
|
+
headerRow = chunk;
|
|
72
|
+
expectedColumnCount = headerRow.length;
|
|
73
|
+
logger_1.logger.info(colors_1.default.blue(`Found header row with ${expectedColumnCount} columns: ${headerRow.join(', ')}`));
|
|
74
|
+
callback();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
// Validate row structure
|
|
78
|
+
if (expectedColumnCount !== null &&
|
|
79
|
+
chunk.length !== expectedColumnCount) {
|
|
80
|
+
logger_1.logger.warn(colors_1.default.yellow(`Warning: Row ${totalLinesProcessed + 1} has ${chunk.length} columns, expected ${expectedColumnCount}`));
|
|
81
|
+
}
|
|
82
|
+
totalLinesProcessed += 1;
|
|
83
|
+
if (totalLinesProcessed % 1000000 === 0) {
|
|
84
|
+
const memoryUsage = formatMemoryUsage(process.memoryUsage());
|
|
85
|
+
logger_1.logger.info(colors_1.default.blue(`Processed ${totalLinesProcessed.toLocaleString()} lines... ` +
|
|
86
|
+
`Memory usage: ${memoryUsage}`));
|
|
87
|
+
}
|
|
88
|
+
const rowSize = Buffer.byteLength(chunk.join(','), 'utf8');
|
|
89
|
+
// Write the current row immediately
|
|
90
|
+
const data = [
|
|
91
|
+
{
|
|
92
|
+
...Object.fromEntries(headerRow.map((header, index) => [header, chunk[index]])),
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
currentChunkSize += rowSize;
|
|
96
|
+
if (currentChunkSize === rowSize) {
|
|
97
|
+
logger_1.logger.info(colors_1.default.yellow(`Starting new chunk ${currentChunkNumber} at ${currentOutputFile}`));
|
|
98
|
+
(0, writeCsv_1.writeCsvSync)(currentOutputFile, data, headerRow);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
(0, writeCsv_1.appendCsvSync)(currentOutputFile, data);
|
|
102
|
+
}
|
|
103
|
+
// Determine if we need to start a new chunk
|
|
104
|
+
if (currentChunkSize + rowSize > CHUNK_SIZE) {
|
|
105
|
+
currentChunkNumber += 1;
|
|
106
|
+
currentChunkSize = 0;
|
|
107
|
+
currentOutputFile = (0, path_1.join)(outputDirectory, `${baseFileName}_chunk${currentChunkNumber}.csv`);
|
|
108
|
+
}
|
|
109
|
+
callback();
|
|
110
|
+
},
|
|
111
|
+
/**
|
|
112
|
+
* Flush function that writes the final chunk of data
|
|
113
|
+
*
|
|
114
|
+
* @param callback - Callback function to signal completion
|
|
115
|
+
*/
|
|
116
|
+
flush(callback) {
|
|
117
|
+
callback();
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
const readStream = (0, fs_1.createReadStream)(inputFile);
|
|
121
|
+
try {
|
|
122
|
+
logger_1.logger.info(colors_1.default.blue(`Starting to process ${inputFile}...`));
|
|
123
|
+
await (0, promises_1.pipeline)(readStream, parser, chunker);
|
|
124
|
+
logger_1.logger.info(colors_1.default.green(`Successfully chunked ${inputFile} into ${currentChunkNumber} files ` +
|
|
125
|
+
`(${totalLinesProcessed.toLocaleString()} total lines processed)`));
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
logger_1.logger.error(colors_1.default.red('Error chunking CSV file:'), error);
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.main = main;
|
|
133
|
+
// Run the main function if this file is being run directly
|
|
134
|
+
if (require.main === module) {
|
|
135
|
+
main().catch((error) => {
|
|
136
|
+
logger_1.logger.error(colors_1.default.red('Error:'), error);
|
|
137
|
+
process.exit(1);
|
|
138
|
+
});
|
|
139
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CAAC,IAAI,CAAC,uBAAuB,SAAS,KAAK,CAAC,CAAC,CAAC;QAChE,MAAM,IAAA,mBAAQ,EAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC5C,eAAM,CAAC,IAAI,CACT,gBAAM,CAAC,KAAK,CACV,wBAAwB,SAAS,SAAS,kBAAkB,SAAS;YACnE,IAAI,mBAAmB,CAAC,cAAc,EAAE,yBAAyB,CACpE,CACF,CAAC;KACH;IAAC,OAAO,KAAK,EAAE;QACd,eAAM,CAAC,KAAK,CAAC,gBAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,EAAE,KAAK,CAAC,CAAC;QAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC;AAUQ,oBAAI;AARb,2DAA2D;AAC3D,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;IAC3B,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,eAAM,CAAC,KAAK,CAAC,gBAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC;QAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;CACJ"}
|
|
@@ -10,6 +10,9 @@ const logger_1 = require("./logger");
|
|
|
10
10
|
const constants_1 = require("./constants");
|
|
11
11
|
const preference_management_1 = require("./preference-management");
|
|
12
12
|
const requests_1 = require("./requests");
|
|
13
|
+
const fs_1 = require("fs");
|
|
14
|
+
const bluebird_1 = require("bluebird");
|
|
15
|
+
const path_1 = require("path");
|
|
13
16
|
/**
|
|
14
17
|
* Upload consent preferences to the managed consent database
|
|
15
18
|
*
|
|
@@ -17,18 +20,20 @@ const requests_1 = require("./requests");
|
|
|
17
20
|
* https://docs.transcend.io/docs/consent/reference/managed-consent-database
|
|
18
21
|
*
|
|
19
22
|
* Dev Usage:
|
|
20
|
-
* yarn ts-node ./src/cli-upload-
|
|
23
|
+
* yarn ts-node ./src/cli-upload-preferences --base64EncryptionKey=$TRANSCEND_CONSENT_ENCRYPTION_KEY \
|
|
21
24
|
* --base64SigningKey=$TRANSCEND_CONSENT_SIGNING_KEY --partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726
|
|
22
25
|
*
|
|
23
26
|
* Standard usage:
|
|
24
|
-
* yarn tr-upload-
|
|
27
|
+
* yarn tr-upload-preferences --base64EncryptionKey=$TRANSCEND_CONSENT_ENCRYPTION_KEY \
|
|
25
28
|
* --base64SigningKey=$TRANSCEND_CONSENT_SIGNING_KEY --partition=4d1c5daa-90b7-4d18-aa40-f86a43d2c726
|
|
26
29
|
*/
|
|
27
30
|
async function main() {
|
|
28
31
|
// Parse command line arguments
|
|
29
32
|
const {
|
|
33
|
+
/** Directory to load preferences from */
|
|
34
|
+
directory,
|
|
30
35
|
/** File to load preferences from */
|
|
31
|
-
file
|
|
36
|
+
file,
|
|
32
37
|
/** Transcend URL */
|
|
33
38
|
transcendUrl = constants_1.DEFAULT_TRANSCEND_API,
|
|
34
39
|
/** API key */
|
|
@@ -43,12 +48,16 @@ async function main() {
|
|
|
43
48
|
skipWorkflowTriggers = 'false',
|
|
44
49
|
/** Whether to skip conflict updates */
|
|
45
50
|
skipConflictUpdates = 'false',
|
|
51
|
+
/** Whether to skip the check for existing records. SHOULD ONLY BE USED FOR INITIAL UPLOAD */
|
|
52
|
+
skipExistingRecordCheck = 'false',
|
|
46
53
|
/** Whether to skip sending emails */
|
|
47
54
|
isSilent = 'true',
|
|
48
55
|
/** Attributes to add to any DSR request if created */
|
|
49
56
|
attributes = 'Tags:transcend-cli,Source:transcend-cli',
|
|
50
57
|
/** Store resulting, continuing where left off */
|
|
51
|
-
|
|
58
|
+
receiptFileDir = './receipts',
|
|
59
|
+
/** Number of files to process concurrently (only relevant for directory processing) */
|
|
60
|
+
concurrency = '10', } = (0, yargs_parser_1.default)(process.argv.slice(2));
|
|
52
61
|
// Ensure auth is passed
|
|
53
62
|
if (!auth) {
|
|
54
63
|
logger_1.logger.error(colors_1.default.red('A Transcend API key must be provided. You can specify using --auth=$TRANSCEND_API_KEY'));
|
|
@@ -60,20 +69,71 @@ async function main() {
|
|
|
60
69
|
'You can specify using --partition=ee1a0845-694e-4820-9d51-50c7d0a23467'));
|
|
61
70
|
process.exit(1);
|
|
62
71
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
if (!!directory && !!file) {
|
|
73
|
+
logger_1.logger.error(colors_1.default.red('Cannot provide both a directory and a file. Please provide only one.'));
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
if (!file && !directory) {
|
|
77
|
+
logger_1.logger.error(colors_1.default.red(
|
|
78
|
+
// eslint-disable-next-line max-len
|
|
79
|
+
'A file or directory must be provided. Please provide one using --file=./preferences.csv or --directory=./preferences'));
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
const files = [];
|
|
83
|
+
if (directory) {
|
|
84
|
+
try {
|
|
85
|
+
const filesInDirectory = (0, fs_1.readdirSync)(directory);
|
|
86
|
+
const csvFiles = filesInDirectory.filter((file) => file.endsWith('.csv'));
|
|
87
|
+
if (csvFiles.length === 0) {
|
|
88
|
+
logger_1.logger.error(colors_1.default.red(`No CSV files found in directory: ${directory}`));
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
// Add full paths for each CSV file
|
|
92
|
+
files.push(...csvFiles.map((file) => (0, path_1.join)(directory, file)));
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
logger_1.logger.error(colors_1.default.red(`Failed to read directory: ${directory}`));
|
|
96
|
+
logger_1.logger.error(colors_1.default.red(err.message));
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
try {
|
|
102
|
+
// Verify file exists and is a CSV
|
|
103
|
+
if (!file.endsWith('.csv')) {
|
|
104
|
+
logger_1.logger.error(colors_1.default.red('File must be a CSV file'));
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
files.push(file);
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
logger_1.logger.error(colors_1.default.red(`Failed to access file: ${file}`));
|
|
111
|
+
logger_1.logger.error(colors_1.default.red(err.message));
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
logger_1.logger.info(colors_1.default.green(`Processing ${files.length} consent preferences files for partition: ${partition}`));
|
|
116
|
+
logger_1.logger.debug(`Files to process: ${files.join(', ')}`);
|
|
117
|
+
if (skipExistingRecordCheck !== 'false') {
|
|
118
|
+
logger_1.logger.info(colors_1.default.bgYellow(`Skipping existing record check: ${skipExistingRecordCheck}`));
|
|
119
|
+
}
|
|
120
|
+
await (0, bluebird_1.map)(files, async (filePath) => {
|
|
121
|
+
const fileName = (0, path_1.basename)(filePath).replace('.csv', '');
|
|
122
|
+
await (0, preference_management_1.uploadPreferenceManagementPreferencesInteractive)({
|
|
123
|
+
receiptFilepath: (0, path_1.join)(receiptFileDir, `${fileName}-receipts.json`),
|
|
124
|
+
auth,
|
|
125
|
+
sombraAuth,
|
|
126
|
+
file: filePath,
|
|
127
|
+
partition,
|
|
128
|
+
transcendUrl,
|
|
129
|
+
skipConflictUpdates: skipConflictUpdates !== 'false',
|
|
130
|
+
skipWorkflowTriggers: skipWorkflowTriggers !== 'false',
|
|
131
|
+
skipExistingRecordCheck: skipExistingRecordCheck !== 'false',
|
|
132
|
+
isSilent: isSilent !== 'false',
|
|
133
|
+
dryRun: dryRun !== 'false',
|
|
134
|
+
attributes: (0, requests_1.splitCsvToList)(attributes),
|
|
135
|
+
});
|
|
136
|
+
}, { concurrency: parseInt(concurrency, 10) });
|
|
77
137
|
}
|
|
78
138
|
main();
|
|
79
139
|
//# sourceMappingURL=cli-upload-preferences.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-upload-preferences.js","sourceRoot":"","sources":["../src/cli-upload-preferences.ts"],"names":[],"mappings":";;;;;;AAEA,gEAAiC;AACjC,oDAA4B;AAE5B,qCAAkC;AAClC,2CAAoD;AACpD,mEAA2F;AAC3F,yCAA4C;
|
|
1
|
+
{"version":3,"file":"cli-upload-preferences.js","sourceRoot":"","sources":["../src/cli-upload-preferences.ts"],"names":[],"mappings":";;;;;;AAEA,gEAAiC;AACjC,oDAA4B;AAE5B,qCAAkC;AAClC,2CAAoD;AACpD,mEAA2F;AAC3F,yCAA4C;AAC5C,2BAAiC;AACjC,uCAA+B;AAC/B,+BAAsC;AAEtC;;;;;;;;;;;;;GAaG;AACH,KAAK,UAAU,IAAI;IACjB,+BAA+B;IAC/B,MAAM;IACJ,yCAAyC;IACzC,SAAS;IACT,oCAAoC;IACpC,IAAI;IACJ,oBAAoB;IACpB,YAAY,GAAG,iCAAqB;IACpC,cAAc;IACd,IAAI;IACJ,qBAAqB;IACrB,UAAU;IACV,iCAAiC;IACjC,SAAS;IACT,8BAA8B;IAC9B,MAAM,GAAG,OAAO;IAChB,wCAAwC;IACxC,oBAAoB,GAAG,OAAO;IAC9B,uCAAuC;IACvC,mBAAmB,GAAG,OAAO;IAC7B,6FAA6F;IAC7F,uBAAuB,GAAG,OAAO;IACjC,qCAAqC;IACrC,QAAQ,GAAG,MAAM;IACjB,sDAAsD;IACtD,UAAU,GAAG,yCAAyC;IACtD,kDAAkD;IAClD,cAAc,GAAG,YAAY;IAC7B,uFAAuF;IACvF,WAAW,GAAG,IAAI,GACnB,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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7D,CACF,CAAC;KACH;IAED,MAAM,IAAA,cAAG,EACP,KAAK,EACL,KAAK,EAAE,QAAQ,EAAE,EAAE;QACjB,MAAM,QAAQ,GAAG,IAAA,eAAQ,EAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACxD,MAAM,IAAA,wEAAgD,EAAC;YACrD,eAAe,EAAE,IAAA,WAAI,EAAC,cAAc,EAAE,GAAG,QAAQ,gBAAgB,CAAC;YAClE,IAAI;YACJ,UAAU;YACV,IAAI,EAAE,QAAQ;YACd,SAAS;YACT,YAAY;YACZ,mBAAmB,EAAE,mBAAmB,KAAK,OAAO;YACpD,oBAAoB,EAAE,oBAAoB,KAAK,OAAO;YACtD,uBAAuB,EAAE,uBAAuB,KAAK,OAAO;YAC5D,QAAQ,EAAE,QAAQ,KAAK,OAAO;YAC9B,MAAM,EAAE,MAAM,KAAK,OAAO;YAC1B,UAAU,EAAE,IAAA,yBAAc,EAAC,UAAU,CAAC;SACvC,CAAC,CAAC;IACL,CAAC,EACD,EAAE,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,CAC3C,CAAC;AACJ,CAAC;AAED,IAAI,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/code-scanning/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/code-scanning/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAW7C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE;KAClC,CAAC,IAAI,MAAM,GAAG,kBAAkB;CASlC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE;KACjC,CAAC,IAAI,eAAe,GAAG,kBAAkB;CAU3C,CAAC"}
|
|
@@ -13,6 +13,7 @@ exports.SILO_DISCOVERY_CONFIGS = {
|
|
|
13
13
|
pythonRequirementsTxt: integrations_1.pythonRequirementsTxt,
|
|
14
14
|
gemfile: integrations_1.gemfile,
|
|
15
15
|
pubspec: integrations_1.pubspec,
|
|
16
|
+
swift: integrations_1.swift,
|
|
16
17
|
};
|
|
17
18
|
exports.CODE_SCANNING_CONFIGS = {
|
|
18
19
|
[privacy_types_1.CodePackageType.CocoaPods]: integrations_1.cocoaPods,
|
|
@@ -22,5 +23,6 @@ exports.CODE_SCANNING_CONFIGS = {
|
|
|
22
23
|
[privacy_types_1.CodePackageType.Gemfile]: integrations_1.gemfile,
|
|
23
24
|
[privacy_types_1.CodePackageType.Pubspec]: integrations_1.pubspec,
|
|
24
25
|
[privacy_types_1.CodePackageType.ComposerJson]: integrations_1.composerJson,
|
|
26
|
+
[privacy_types_1.CodePackageType.Swift]: integrations_1.swift,
|
|
25
27
|
};
|
|
26
28
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/code-scanning/constants.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/code-scanning/constants.ts"],"names":[],"mappings":";;;AACA,iDASwB;AACxB,+DAA8D;AAE9D;;GAEG;AACU,QAAA,sBAAsB,GAE/B;IACF,SAAS,EAAT,wBAAS;IACT,MAAM,EAAN,qBAAM;IACN,qBAAqB,EAArB,oCAAqB;IACrB,qBAAqB,EAArB,oCAAqB;IACrB,OAAO,EAAP,sBAAO;IACP,OAAO,EAAP,sBAAO;IACP,KAAK,EAAL,oBAAK;CACN,CAAC;AAEW,QAAA,qBAAqB,GAE9B;IACF,CAAC,+BAAe,CAAC,SAAS,CAAC,EAAE,wBAAS;IACtC,CAAC,+BAAe,CAAC,MAAM,CAAC,EAAE,qBAAM;IAChC,CAAC,+BAAe,CAAC,WAAW,CAAC,EAAE,oCAAqB;IACpD,CAAC,+BAAe,CAAC,eAAe,CAAC,EAAE,oCAAqB;IACxD,CAAC,+BAAe,CAAC,OAAO,CAAC,EAAE,sBAAO;IAClC,CAAC,+BAAe,CAAC,OAAO,CAAC,EAAE,sBAAO;IAClC,CAAC,+BAAe,CAAC,YAAY,CAAC,EAAE,2BAAY;IAC5C,CAAC,+BAAe,CAAC,KAAK,CAAC,EAAE,oBAAK;CAC/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code-scanning/integrations/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code-scanning/integrations/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC"}
|
|
@@ -21,4 +21,5 @@ __exportStar(require("./pythonRequirementsTxt"), exports);
|
|
|
21
21
|
__exportStar(require("./gemfile"), exports);
|
|
22
22
|
__exportStar(require("./pubspec"), exports);
|
|
23
23
|
__exportStar(require("./composerJson"), exports);
|
|
24
|
+
__exportStar(require("./swift"), exports);
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/code-scanning/integrations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB;AACzB,0DAAwC;AACxC,0DAAwC;AACxC,4CAA0B;AAC1B,4CAA0B;AAC1B,iDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/code-scanning/integrations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB;AACzB,0DAAwC;AACxC,0DAAwC;AACxC,4CAA0B;AAC1B,4CAA0B;AAC1B,iDAA+B;AAC/B,0CAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swift.d.ts","sourceRoot":"","sources":["../../../src/code-scanning/integrations/swift.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAqB9C,eAAO,MAAM,KAAK,EAAE,kBAmBnB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.swift = void 0;
|
|
27
|
+
const fs_1 = require("fs");
|
|
28
|
+
const privacy_types_1 = require("@transcend-io/privacy-types");
|
|
29
|
+
const type_utils_1 = require("@transcend-io/type-utils");
|
|
30
|
+
const t = __importStar(require("io-ts"));
|
|
31
|
+
const path_1 = require("path");
|
|
32
|
+
const SwiftPackage = t.type({
|
|
33
|
+
pins: t.array(t.type({
|
|
34
|
+
identity: t.string,
|
|
35
|
+
kind: t.string,
|
|
36
|
+
location: t.string,
|
|
37
|
+
state: t.type({
|
|
38
|
+
revision: t.string,
|
|
39
|
+
version: t.string,
|
|
40
|
+
}),
|
|
41
|
+
})),
|
|
42
|
+
version: t.number,
|
|
43
|
+
});
|
|
44
|
+
exports.swift = {
|
|
45
|
+
supportedFiles: ['Package.resolved'],
|
|
46
|
+
ignoreDirs: [],
|
|
47
|
+
scanFunction: (filePath) => {
|
|
48
|
+
const fileContents = (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
49
|
+
const parsed = (0, type_utils_1.decodeCodec)(SwiftPackage, fileContents);
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
name: (0, path_1.dirname)(filePath).split('/').pop() || '',
|
|
53
|
+
type: privacy_types_1.CodePackageType.CocoaPods,
|
|
54
|
+
softwareDevelopmentKits: parsed.pins.map((target) => ({
|
|
55
|
+
name: target.identity,
|
|
56
|
+
version: target.state.version,
|
|
57
|
+
})),
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=swift.js.map
|
|
@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CAAC,KAAK,CAAC,OAAO;iBAC9B,CAAC,CAAC;aACJ;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
package/build/codecs.d.ts
CHANGED
|
@@ -17418,6 +17418,7 @@ export declare const SoftwareDevelopmentKitInput: t.IntersectionC<[t.TypeC<{
|
|
|
17418
17418
|
REQUIREMENTS_TXT: unknown;
|
|
17419
17419
|
GRADLE: unknown;
|
|
17420
17420
|
COCOA_PODS: unknown;
|
|
17421
|
+
SWIFT: unknown;
|
|
17421
17422
|
PUBSPEC: unknown;
|
|
17422
17423
|
GEMFILE: unknown;
|
|
17423
17424
|
COMPOSER_JSON: unknown;
|
|
@@ -17466,6 +17467,7 @@ export declare const CodePackageInput: t.IntersectionC<[t.TypeC<{
|
|
|
17466
17467
|
REQUIREMENTS_TXT: unknown;
|
|
17467
17468
|
GRADLE: unknown;
|
|
17468
17469
|
COCOA_PODS: unknown;
|
|
17470
|
+
SWIFT: unknown;
|
|
17469
17471
|
PUBSPEC: unknown;
|
|
17470
17472
|
GEMFILE: unknown;
|
|
17471
17473
|
COMPOSER_JSON: unknown;
|