@transcend-io/cli 4.120.1 → 4.121.1
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 +104 -37
- package/build/cli-discover-silos.js +15 -4
- package/build/cli-discover-silos.js.map +1 -1
- package/build/cli-scan-packages.d.ts +3 -0
- package/build/cli-scan-packages.d.ts.map +1 -0
- package/build/cli-scan-packages.js +74 -0
- package/build/cli-scan-packages.js.map +1 -0
- package/build/code-scanning/constants.d.ts +12 -0
- package/build/code-scanning/constants.d.ts.map +1 -0
- package/build/code-scanning/constants.js +25 -0
- package/build/code-scanning/constants.js.map +1 -0
- package/build/code-scanning/findCodePackagesInFolder.d.ts +16 -0
- package/build/code-scanning/findCodePackagesInFolder.d.ts.map +1 -0
- package/build/code-scanning/findCodePackagesInFolder.js +51 -0
- package/build/code-scanning/findCodePackagesInFolder.js.map +1 -0
- package/build/code-scanning/findFilesToScan.d.ts +29 -0
- package/build/code-scanning/findFilesToScan.d.ts.map +1 -0
- package/build/{plugins → code-scanning}/findFilesToScan.js +12 -12
- package/build/code-scanning/findFilesToScan.js.map +1 -0
- package/build/code-scanning/index.d.ts +4 -0
- package/build/code-scanning/index.d.ts.map +1 -0
- package/build/{plugins → code-scanning}/index.js +1 -1
- package/build/code-scanning/index.js.map +1 -0
- package/build/code-scanning/integrations/cocoaPods.d.ts +3 -0
- package/build/code-scanning/integrations/cocoaPods.d.ts.map +1 -0
- package/build/code-scanning/integrations/cocoaPods.js +44 -0
- package/build/code-scanning/integrations/cocoaPods.js.map +1 -0
- package/build/code-scanning/integrations/gemfile.d.ts +3 -0
- package/build/code-scanning/integrations/gemfile.d.ts.map +1 -0
- package/build/code-scanning/integrations/gemfile.js +58 -0
- package/build/code-scanning/integrations/gemfile.js.map +1 -0
- package/build/code-scanning/integrations/gradle.d.ts +13 -0
- package/build/code-scanning/integrations/gradle.d.ts.map +1 -0
- package/build/code-scanning/integrations/gradle.js +81 -0
- package/build/code-scanning/integrations/gradle.js.map +1 -0
- package/build/{plugins → code-scanning}/integrations/index.d.ts +2 -0
- package/build/code-scanning/integrations/index.d.ts.map +1 -0
- package/build/{plugins → code-scanning}/integrations/index.js +2 -0
- package/build/code-scanning/integrations/index.js.map +1 -0
- package/build/code-scanning/integrations/javascriptPackageJson.d.ts +3 -0
- package/build/code-scanning/integrations/javascriptPackageJson.d.ts.map +1 -0
- package/build/code-scanning/integrations/javascriptPackageJson.js +38 -0
- package/build/code-scanning/integrations/javascriptPackageJson.js.map +1 -0
- package/build/code-scanning/integrations/pubspec.d.ts +3 -0
- package/build/code-scanning/integrations/pubspec.d.ts.map +1 -0
- package/build/code-scanning/integrations/pubspec.js +70 -0
- package/build/code-scanning/integrations/pubspec.js.map +1 -0
- package/build/code-scanning/integrations/pythonRequirementsTxt.d.ts +3 -0
- package/build/code-scanning/integrations/pythonRequirementsTxt.d.ts.map +1 -0
- package/build/code-scanning/integrations/pythonRequirementsTxt.js +47 -0
- package/build/code-scanning/integrations/pythonRequirementsTxt.js.map +1 -0
- package/build/code-scanning/types.d.ts +10 -0
- package/build/code-scanning/types.d.ts.map +1 -0
- package/build/{plugins → code-scanning}/types.js.map +1 -1
- package/build/codecs.d.ts +108 -0
- package/build/codecs.d.ts.map +1 -1
- package/build/codecs.js +91 -1
- package/build/codecs.js.map +1 -1
- package/build/graphql/fetchActiveSiloDiscoPlugin.d.ts +2 -3
- package/build/graphql/fetchActiveSiloDiscoPlugin.d.ts.map +1 -1
- package/build/graphql/fetchActiveSiloDiscoPlugin.js +1 -7
- package/build/graphql/fetchActiveSiloDiscoPlugin.js.map +1 -1
- package/build/graphql/fetchAllCodePackages.d.ts +52 -0
- package/build/graphql/fetchAllCodePackages.d.ts.map +1 -0
- package/build/graphql/fetchAllCodePackages.js +32 -0
- package/build/graphql/fetchAllCodePackages.js.map +1 -0
- package/build/graphql/fetchAllRepositories.d.ts +33 -0
- package/build/graphql/fetchAllRepositories.d.ts.map +1 -0
- package/build/graphql/fetchAllRepositories.js +32 -0
- package/build/graphql/fetchAllRepositories.js.map +1 -0
- package/build/graphql/fetchAllSoftwareDevelopmentKits.d.ts +38 -0
- package/build/graphql/fetchAllSoftwareDevelopmentKits.d.ts.map +1 -0
- package/build/graphql/fetchAllSoftwareDevelopmentKits.js +32 -0
- package/build/graphql/fetchAllSoftwareDevelopmentKits.js.map +1 -0
- package/build/graphql/gqls/codePackage.d.ts +4 -0
- package/build/graphql/gqls/codePackage.d.ts.map +1 -0
- package/build/graphql/gqls/codePackage.js +112 -0
- package/build/graphql/gqls/codePackage.js.map +1 -0
- package/build/graphql/gqls/index.d.ts +3 -0
- package/build/graphql/gqls/index.d.ts.map +1 -1
- package/build/graphql/gqls/index.js +3 -0
- package/build/graphql/gqls/index.js.map +1 -1
- package/build/graphql/gqls/repository.d.ts +4 -0
- package/build/graphql/gqls/repository.d.ts.map +1 -0
- package/build/graphql/gqls/repository.js +80 -0
- package/build/graphql/gqls/repository.js.map +1 -0
- package/build/graphql/gqls/softwareDevelopmentKit.d.ts +4 -0
- package/build/graphql/gqls/softwareDevelopmentKit.d.ts.map +1 -0
- package/build/graphql/gqls/softwareDevelopmentKit.js +92 -0
- package/build/graphql/gqls/softwareDevelopmentKit.js.map +1 -0
- package/build/graphql/index.d.ts +3 -0
- package/build/graphql/index.d.ts.map +1 -1
- package/build/graphql/index.js +3 -0
- package/build/graphql/index.js.map +1 -1
- package/build/graphql/syncAssessmentTemplates.js +2 -2
- package/build/graphql/syncAssessmentTemplates.js.map +1 -1
- package/build/graphql/syncAssessments.js +3 -3
- package/build/graphql/syncAssessments.js.map +1 -1
- package/build/graphql/syncCodePackages.d.ts +77 -0
- package/build/graphql/syncCodePackages.d.ts.map +1 -0
- package/build/graphql/syncCodePackages.js +153 -0
- package/build/graphql/syncCodePackages.js.map +1 -0
- package/build/graphql/syncDataSilos.js +2 -2
- package/build/graphql/syncDataSilos.js.map +1 -1
- package/build/graphql/syncRepositories.d.ts +65 -0
- package/build/graphql/syncRepositories.d.ts.map +1 -0
- package/build/graphql/syncRepositories.js +116 -0
- package/build/graphql/syncRepositories.js.map +1 -0
- package/build/graphql/syncSoftwareDevelopmentKits.d.ts +84 -0
- package/build/graphql/syncSoftwareDevelopmentKits.d.ts.map +1 -0
- package/build/graphql/syncSoftwareDevelopmentKits.js +119 -0
- package/build/graphql/syncSoftwareDevelopmentKits.js.map +1 -0
- package/build/graphql/uploadSiloDiscoveryResults.d.ts +1 -1
- package/build/graphql/uploadSiloDiscoveryResults.d.ts.map +1 -1
- package/build/graphql/uploadSiloDiscoveryResults.js +5 -2
- package/build/graphql/uploadSiloDiscoveryResults.js.map +1 -1
- package/build/tests/findCodePackagesInFolder.test.d.ts +2 -0
- package/build/tests/findCodePackagesInFolder.test.d.ts.map +1 -0
- package/build/tests/findCodePackagesInFolder.test.js +507 -0
- package/build/tests/findCodePackagesInFolder.test.js.map +1 -0
- package/build/tsbuildinfo +1 -1
- package/examples/code-scanning/test-gradle/test-nested-package-json/package.json +20 -0
- package/examples/code-scanning/test-package-json/package.json +20 -0
- package/package.json +5 -4
- package/LICENSE +0 -21
- package/build/plugins/constants.d.ts +0 -9
- package/build/plugins/constants.d.ts.map +0 -1
- package/build/plugins/constants.js +0 -11
- package/build/plugins/constants.js.map +0 -1
- package/build/plugins/findFilesToScan.d.ts +0 -12
- package/build/plugins/findFilesToScan.d.ts.map +0 -1
- package/build/plugins/findFilesToScan.js.map +0 -1
- package/build/plugins/index.d.ts +0 -4
- package/build/plugins/index.d.ts.map +0 -1
- package/build/plugins/index.js.map +0 -1
- package/build/plugins/integrations/cocoaPods.d.ts +0 -3
- package/build/plugins/integrations/cocoaPods.d.ts.map +0 -1
- package/build/plugins/integrations/cocoaPods.js +0 -30
- package/build/plugins/integrations/cocoaPods.js.map +0 -1
- package/build/plugins/integrations/gradle.d.ts +0 -3
- package/build/plugins/integrations/gradle.d.ts.map +0 -1
- package/build/plugins/integrations/gradle.js +0 -53
- package/build/plugins/integrations/gradle.js.map +0 -1
- package/build/plugins/integrations/index.d.ts.map +0 -1
- package/build/plugins/integrations/index.js.map +0 -1
- package/build/plugins/integrations/javascriptPackageJson.d.ts +0 -3
- package/build/plugins/integrations/javascriptPackageJson.d.ts.map +0 -1
- package/build/plugins/integrations/javascriptPackageJson.js +0 -32
- package/build/plugins/integrations/javascriptPackageJson.js.map +0 -1
- package/build/plugins/integrations/pythonRequirementsTxt.d.ts +0 -3
- package/build/plugins/integrations/pythonRequirementsTxt.d.ts.map +0 -1
- package/build/plugins/integrations/pythonRequirementsTxt.js +0 -33
- package/build/plugins/integrations/pythonRequirementsTxt.js.map +0 -1
- package/build/plugins/typeguards.d.ts +0 -9
- package/build/plugins/typeguards.d.ts.map +0 -1
- package/build/plugins/typeguards.js +0 -15
- package/build/plugins/typeguards.js.map +0 -1
- package/build/plugins/types.d.ts +0 -29
- package/build/plugins/types.d.ts.map +0 -1
- /package/build/{plugins → code-scanning}/types.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cocoaPods.d.ts","sourceRoot":"","sources":["../../../src/code-scanning/integrations/cocoaPods.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAQ9C,eAAO,MAAM,SAAS,EAAE,kBA8CvB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cocoaPods = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const type_utils_1 = require("@transcend-io/type-utils");
|
|
6
|
+
const privacy_types_1 = require("@transcend-io/privacy-types");
|
|
7
|
+
const POD_TARGET_REGEX = /target '(.*?)'/;
|
|
8
|
+
const POD_PACKAGE_REGEX = /pod ('|")(.*?)('|")(, ('|")~> (.+?)('|")|)/;
|
|
9
|
+
exports.cocoaPods = {
|
|
10
|
+
supportedFiles: ['Podfile'],
|
|
11
|
+
ignoreDirs: ['Pods'],
|
|
12
|
+
scanFunction: (filePath) => {
|
|
13
|
+
const fileContents = (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
14
|
+
const targets = (0, type_utils_1.findAllWithRegex)({
|
|
15
|
+
value: new RegExp(POD_TARGET_REGEX, 'g'),
|
|
16
|
+
matches: ['name'],
|
|
17
|
+
}, fileContents);
|
|
18
|
+
const packages = (0, type_utils_1.findAllWithRegex)({
|
|
19
|
+
value: new RegExp(POD_PACKAGE_REGEX, 'g'),
|
|
20
|
+
matches: [
|
|
21
|
+
'quote1',
|
|
22
|
+
'name',
|
|
23
|
+
'quote2',
|
|
24
|
+
'extra',
|
|
25
|
+
'quote3',
|
|
26
|
+
'version',
|
|
27
|
+
'quote4',
|
|
28
|
+
],
|
|
29
|
+
}, fileContents);
|
|
30
|
+
const deps = targets.map((target, ind) => ({
|
|
31
|
+
name: target.name,
|
|
32
|
+
type: privacy_types_1.CodePackageType.CocoaPods,
|
|
33
|
+
softwareDevelopmentKits: packages
|
|
34
|
+
.filter((pkg) => pkg.matchIndex > target.matchIndex &&
|
|
35
|
+
(!targets[ind + 1] || pkg.matchIndex < targets[ind + 1].matchIndex))
|
|
36
|
+
.map((pkg) => ({
|
|
37
|
+
name: pkg.name,
|
|
38
|
+
version: pkg.version,
|
|
39
|
+
})),
|
|
40
|
+
}));
|
|
41
|
+
return deps;
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=cocoaPods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cocoaPods.js","sourceRoot":"","sources":["../../../src/code-scanning/integrations/cocoaPods.ts"],"names":[],"mappings":";;;AAAA,2BAAkC;AAGlC,yDAA4D;AAC5D,+DAA8D;AAE9D,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAC1C,MAAM,iBAAiB,GAAG,4CAA4C,CAAC;AAE1D,QAAA,SAAS,GAAuB;IAC3C,cAAc,EAAE,CAAC,SAAS,CAAC;IAC3B,UA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 @@
|
|
|
1
|
+
{"version":3,"file":"gemfile.d.ts","sourceRoot":"","sources":["../../../src/code-scanning/integrations/gemfile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAY9C,eAAO,MAAM,OAAO,EAAE,kBAkDrB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gemfile = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const type_utils_1 = require("@transcend-io/type-utils");
|
|
6
|
+
const api_keys_1 = require("../../api-keys");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const privacy_types_1 = require("@transcend-io/privacy-types");
|
|
9
|
+
const GEM_PACKAGE_REGEX = /gem *('|")(.+?)('|")(, *('|")(.+?)('|")|)/;
|
|
10
|
+
const GEMFILE_PACKAGE_NAME_REGEX = /spec\.name *= *('|")(.+?)('|")/;
|
|
11
|
+
const GEMFILE_PACKAGE_DESCRIPTION_REGEX = /spec\.description *= *('|")(.+?)('|")/;
|
|
12
|
+
const GEMFILE_PACKAGE_SUMMARY_REGEX = /spec\.summary *= *('|")(.+?)('|")/;
|
|
13
|
+
exports.gemfile = {
|
|
14
|
+
supportedFiles: ['Gemfile'],
|
|
15
|
+
ignoreDirs: ['bin'],
|
|
16
|
+
scanFunction: (filePath) => {
|
|
17
|
+
const fileContents = (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
18
|
+
const directory = (0, path_1.dirname)(filePath);
|
|
19
|
+
const filesInFolder = (0, api_keys_1.listFiles)(directory);
|
|
20
|
+
// parse gemspec file for name
|
|
21
|
+
const gemspec = filesInFolder.find((file) => file === '.gemspec');
|
|
22
|
+
const gemspecContents = gemspec
|
|
23
|
+
? (0, fs_1.readFileSync)(gemspec, 'utf-8')
|
|
24
|
+
: undefined;
|
|
25
|
+
const gemfileName = gemspecContents
|
|
26
|
+
? (GEMFILE_PACKAGE_NAME_REGEX.exec(gemspecContents) || [])[2]
|
|
27
|
+
: undefined;
|
|
28
|
+
const gemfileDescription = gemspecContents
|
|
29
|
+
? (GEMFILE_PACKAGE_DESCRIPTION_REGEX.exec(gemspecContents) ||
|
|
30
|
+
GEMFILE_PACKAGE_SUMMARY_REGEX.exec(gemspecContents) ||
|
|
31
|
+
[])[1]
|
|
32
|
+
: undefined;
|
|
33
|
+
const targets = (0, type_utils_1.findAllWithRegex)({
|
|
34
|
+
value: new RegExp(GEM_PACKAGE_REGEX, 'g'),
|
|
35
|
+
matches: [
|
|
36
|
+
'quote1',
|
|
37
|
+
'name',
|
|
38
|
+
'quote2',
|
|
39
|
+
'hasVersion',
|
|
40
|
+
'quote3',
|
|
41
|
+
'version',
|
|
42
|
+
'quote4',
|
|
43
|
+
],
|
|
44
|
+
}, fileContents);
|
|
45
|
+
return [
|
|
46
|
+
{
|
|
47
|
+
name: gemfileName || directory.split('/').pop(),
|
|
48
|
+
description: gemfileDescription || undefined,
|
|
49
|
+
type: privacy_types_1.CodePackageType.RequirementsTxt,
|
|
50
|
+
softwareDevelopmentKits: targets.map((pkg) => ({
|
|
51
|
+
name: pkg.name,
|
|
52
|
+
version: pkg.version,
|
|
53
|
+
})),
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=gemfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemfile.js","sourceRoot":"","sources":["../../../src/code-scanning/integrations/gemfile.ts"],"names":[],"mappings":";;;AAAA,2BAAkC;AAElC,yDAA4D;AAC5D,6CAA2C;AAC3C,+BAA+B;AAC/B,+DAA8D;AAE9D,MAAM,iBAAiB,GAAG,2CAA2C,CAAC;AACtE,MAAM,0BAA0B,GAAG,gCAAgC,CAAC;AACpE,MAAM,iCAAiC,GACrC,uCAAuC,CAAC;AAC1C,MAAM,6BAA6B,GAAG,mCAAmC,CA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EAAE,WAAW,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG;gBAChD,WAAW,EAAE,kBAAkB,IAAI,SAAS;gBAC5C,IAAI,EAAE,+BAAe,CAAC,eAAe;gBACrC,uBAAuB,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;oBAC7C,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,OAAO,EAAE,GAAG,CAAC,OAAO;iBACrB,CAAC,CAAC;aACJ;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CodeScanningConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* So far, there are three ways of defining dependencies that is supported
|
|
4
|
+
* implementation group: 'org.eclipse.jdt', name: 'org.eclipse.jdt.core', version: '3.28.0'
|
|
5
|
+
* or
|
|
6
|
+
* implementation 'com.google.firebase:firebase-analytics:18.0.0'
|
|
7
|
+
* or
|
|
8
|
+
* apply plugin: 'com.google.gms.google-services'
|
|
9
|
+
*
|
|
10
|
+
* single and double quotes are both recognized
|
|
11
|
+
*/
|
|
12
|
+
export declare const gradle: CodeScanningConfig;
|
|
13
|
+
//# sourceMappingURL=gradle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradle.d.ts","sourceRoot":"","sources":["../../../src/code-scanning/integrations/gradle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAW9C;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM,EAAE,kBAwEpB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.gradle = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const type_utils_1 = require("@transcend-io/type-utils");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const GRADLE_IMPLEMENTATION_REGEX = /implementation( *)('|")(.+?):(.+?):(.+?|)('|")/;
|
|
8
|
+
const GRADLE_PLUGIN_REGEX = /apply plugin: *('|")(.+?)(:(.+?)|)('|")/;
|
|
9
|
+
const GRADLE_IMPLEMENTATION_GROUP_REGEX = /implementation group:( *)('|")(.+?)('|"),( *)name:( *)('|")(.+?)('|"),( *)version:( *)('|")(.+?)('|")/;
|
|
10
|
+
const GRADLE_APPLICATION_NAME_REGEX = /applicationId( *)"(.+?)"/;
|
|
11
|
+
/**
|
|
12
|
+
* So far, there are three ways of defining dependencies that is supported
|
|
13
|
+
* implementation group: 'org.eclipse.jdt', name: 'org.eclipse.jdt.core', version: '3.28.0'
|
|
14
|
+
* or
|
|
15
|
+
* implementation 'com.google.firebase:firebase-analytics:18.0.0'
|
|
16
|
+
* or
|
|
17
|
+
* apply plugin: 'com.google.gms.google-services'
|
|
18
|
+
*
|
|
19
|
+
* single and double quotes are both recognized
|
|
20
|
+
*/
|
|
21
|
+
exports.gradle = {
|
|
22
|
+
supportedFiles: ['build.gradle**'],
|
|
23
|
+
ignoreDirs: [
|
|
24
|
+
'gradle-app.setting',
|
|
25
|
+
'gradle-wrapper.jar',
|
|
26
|
+
'gradle-wrapper.properties',
|
|
27
|
+
],
|
|
28
|
+
scanFunction: (filePath) => {
|
|
29
|
+
var _a;
|
|
30
|
+
const fileContents = (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
31
|
+
const directory = (0, path_1.dirname)(filePath);
|
|
32
|
+
const targets = (0, type_utils_1.findAllWithRegex)({
|
|
33
|
+
value: new RegExp(GRADLE_IMPLEMENTATION_REGEX, 'g'),
|
|
34
|
+
matches: ['space', 'quote1', 'name', 'path', 'version', 'quote2'],
|
|
35
|
+
}, fileContents);
|
|
36
|
+
const targetPlugins = (0, type_utils_1.findAllWithRegex)({
|
|
37
|
+
value: new RegExp(GRADLE_PLUGIN_REGEX, 'g'),
|
|
38
|
+
matches: ['quote1', 'name', 'group', 'version', 'quote2'],
|
|
39
|
+
}, fileContents);
|
|
40
|
+
const targetGroups = (0, type_utils_1.findAllWithRegex)({
|
|
41
|
+
value: new RegExp(GRADLE_IMPLEMENTATION_GROUP_REGEX, 'g'),
|
|
42
|
+
matches: [
|
|
43
|
+
'space1',
|
|
44
|
+
'quote1',
|
|
45
|
+
'group',
|
|
46
|
+
'quote2',
|
|
47
|
+
'space2',
|
|
48
|
+
'space3',
|
|
49
|
+
'quote3',
|
|
50
|
+
'name',
|
|
51
|
+
'quote4',
|
|
52
|
+
'space4',
|
|
53
|
+
'space5',
|
|
54
|
+
'quote5',
|
|
55
|
+
'version',
|
|
56
|
+
'quote6',
|
|
57
|
+
],
|
|
58
|
+
}, fileContents);
|
|
59
|
+
const applications = (0, type_utils_1.findAllWithRegex)({
|
|
60
|
+
value: new RegExp(GRADLE_APPLICATION_NAME_REGEX, 'g'),
|
|
61
|
+
matches: ['space', 'name'],
|
|
62
|
+
}, fileContents);
|
|
63
|
+
if (applications.length > 1) {
|
|
64
|
+
throw new Error(`Expected only one applicationId per file: ${filePath}`);
|
|
65
|
+
}
|
|
66
|
+
return [
|
|
67
|
+
{
|
|
68
|
+
name: ((_a = applications[0]) === null || _a === void 0 ? void 0 : _a.name) || directory.split('/').pop(),
|
|
69
|
+
softwareDevelopmentKits: [
|
|
70
|
+
...targets,
|
|
71
|
+
...targetGroups,
|
|
72
|
+
...targetPlugins,
|
|
73
|
+
].map((target) => ({
|
|
74
|
+
name: target.name,
|
|
75
|
+
version: target.version || undefined,
|
|
76
|
+
})),
|
|
77
|
+
},
|
|
78
|
+
];
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=gradle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradle.js","sourceRoot":"","sources":["../../../src/code-scanning/integrations/gradle.ts"],"names":[],"mappings":";;;AAAA,2BAAkC;AAElC,yDAA4D;AAC5D,+BAA+B;AAE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ACR,SAAS;gBACT,QAAQ;aACT;SACF,EACD,YAAY,CACb,CAAC;QACF,MAAM,YAAY,GAAG,IAAA,6BAAgB,EACnC;YACE,KAAK,EAAE,IAAI,MAAM,CAAC,6BAA6B,EAAE,GAAG,CAAC;YACrD,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;SAC3B,EACD,YAAY,CACb,CAAC;QACF,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,6CAA6C,QAAQ,EAAE,CAAC,CAAC;SAC1E;QAED,OAAO;YACL;gBACE,IAAI,EAAE,CAAA,MAAA,YAAY,CAAC,CAAC,CAAC,0CAAE,IAAI,KAAI,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG;gBAC1D,uBAAuB,EAAE;oBACvB,GAAG,OAAO;oBACV,GAAG,YAAY;oBACf,GAAG,aAAa;iBACjB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;oBACjB,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,SAAS;iBACrC,CAAC,CAAC;aACJ;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +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"}
|
|
@@ -18,4 +18,6 @@ __exportStar(require("./cocoaPods"), exports);
|
|
|
18
18
|
__exportStar(require("./gradle"), exports);
|
|
19
19
|
__exportStar(require("./javascriptPackageJson"), exports);
|
|
20
20
|
__exportStar(require("./pythonRequirementsTxt"), exports);
|
|
21
|
+
__exportStar(require("./gemfile"), exports);
|
|
22
|
+
__exportStar(require("./pubspec"), exports);
|
|
21
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"javascriptPackageJson.d.ts","sourceRoot":"","sources":["../../../src/code-scanning/integrations/javascriptPackageJson.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAI9C,eAAO,MAAM,qBAAqB,EAAE,kBA2CnC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.javascriptPackageJson = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
exports.javascriptPackageJson = {
|
|
7
|
+
supportedFiles: ['package.json'],
|
|
8
|
+
ignoreDirs: ['node_modules', 'serverless-build', 'lambda-build'],
|
|
9
|
+
scanFunction: (filePath) => {
|
|
10
|
+
const file = (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
11
|
+
const directory = (0, path_1.dirname)(filePath);
|
|
12
|
+
const asJson = JSON.parse(file);
|
|
13
|
+
const { name, description, dependencies = {}, devDependencies = {}, optionalDependencies = {}, } = asJson;
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
// name of the package
|
|
17
|
+
name: name || directory.split('/').pop(),
|
|
18
|
+
description,
|
|
19
|
+
softwareDevelopmentKits: [
|
|
20
|
+
...Object.entries(dependencies).map(([name, version]) => ({
|
|
21
|
+
name,
|
|
22
|
+
version: typeof version === 'string' ? version : undefined,
|
|
23
|
+
})),
|
|
24
|
+
...Object.entries(devDependencies).map(([name, version]) => ({
|
|
25
|
+
name,
|
|
26
|
+
version: typeof version === 'string' ? version : undefined,
|
|
27
|
+
isDevDependency: true,
|
|
28
|
+
})),
|
|
29
|
+
...Object.entries(optionalDependencies).map(([name, version]) => ({
|
|
30
|
+
name,
|
|
31
|
+
version: typeof version === 'string' ? version : undefined,
|
|
32
|
+
})),
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=javascriptPackageJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"javascriptPackageJson.js","sourceRoot":"","sources":["../../../src/code-scanning/integrations/javascriptPackageJson.ts"],"names":[],"mappings":";;;AAAA,2BAAkC;AAGlC,+BAA+B;AAElB,QAAA,qBAAqB,GAAuB;IACvD,cAAc,EAAE,CAAC,cAAc,CAAC;IAChC,UAAU,EAAE,CAAC,cAAc,EAAE,kBAAkB,EAAE,cAAc,CAAC;IAChE,YAAY,EAAE,CAAC,QAAQ,EAAE,EAAE;QACzB,MAAM,IAAI,GAAG,IAAA,iBAAY,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC7C,MAAM,SAAS,GAAG,IAAA,cAAO,EAAC,QAAQ,CAAC,CAAC;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAChC,MAAM,EACJ,IAAI,EACJ,WAAW,EACX,YAAY,GAAG,EAAE,EACjB,eAAe,GAAG,EAAE,EACpB,oBAAoB,GAAG,EAAE,GAC1B,GAAG,MAAM,CAAC;QACX,OAAO;YACL;gBACE,sBAAsB;gBACtB,IAAI,EAAE,IAAI,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG;gBACzC,WAAW;gBACX,uBAAuB,EAAE;oBACvB,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,GAAG,CACjC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAkB,EAAE,CAAC,CAAC;wBACpC,IAAI;wBACJ,OAAO,EAAE,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;qBAC3D,CAAC,CACH;oBACD,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,GAAG,CACpC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAkB,EAAE,CAAC,CAAC;wBACpC,IAAI;wBACJ,OAAO,EAAE,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;wBAC1D,eAAe,EAAE,IAAI;qBACtB,CAAC,CACH;oBACD,GAAG,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,GAAG,CACzC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAkB,EAAE,CAAC,CAAC;wBACpC,IAAI;wBACJ,OAAO,EAAE,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;qBAC3D,CAAC,CACH;iBACF;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pubspec.d.ts","sourceRoot":"","sources":["../../../src/code-scanning/integrations/pubspec.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAgC9C,eAAO,MAAM,OAAO,EAAE,kBAkDrB,CAAC"}
|
|
@@ -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.pubspec = void 0;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const privacy_types_1 = require("@transcend-io/privacy-types");
|
|
9
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
10
|
+
const path_1 = require("path");
|
|
11
|
+
/**
|
|
12
|
+
* Remove YAML comments from a string
|
|
13
|
+
*
|
|
14
|
+
* @param yamlString - YAML string
|
|
15
|
+
* @returns String without comments
|
|
16
|
+
*/
|
|
17
|
+
function removeYAMLComments(yamlString) {
|
|
18
|
+
return yamlString
|
|
19
|
+
.split('\n')
|
|
20
|
+
.map((line) => {
|
|
21
|
+
// Remove inline comments
|
|
22
|
+
const commentIndex = line.indexOf('#');
|
|
23
|
+
if (commentIndex > -1) {
|
|
24
|
+
// Check if '#' is not inside a string
|
|
25
|
+
if (!line.substring(0, commentIndex).includes('"') &&
|
|
26
|
+
!line.substring(0, commentIndex).includes("'")) {
|
|
27
|
+
return line.substring(0, commentIndex).trim();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return line;
|
|
31
|
+
})
|
|
32
|
+
.filter((line) => line.length > 0)
|
|
33
|
+
.join('\n');
|
|
34
|
+
}
|
|
35
|
+
exports.pubspec = {
|
|
36
|
+
supportedFiles: ['pubspec.yml'],
|
|
37
|
+
ignoreDirs: ['build'],
|
|
38
|
+
scanFunction: (filePath) => {
|
|
39
|
+
const directory = (0, path_1.dirname)(filePath);
|
|
40
|
+
const fileContents = (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
41
|
+
const { name, description, dev_dependencies = {}, dependencies = {}, } = js_yaml_1.default.load(removeYAMLComments(fileContents));
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
name: name || directory.split('/').pop(),
|
|
45
|
+
description,
|
|
46
|
+
type: privacy_types_1.CodePackageType.RequirementsTxt,
|
|
47
|
+
softwareDevelopmentKits: [
|
|
48
|
+
...Object.entries(dependencies).map(([name, version]) => ({
|
|
49
|
+
name,
|
|
50
|
+
version: typeof version === 'string'
|
|
51
|
+
? version
|
|
52
|
+
: typeof version === 'number'
|
|
53
|
+
? version.toString()
|
|
54
|
+
: version === null || version === void 0 ? void 0 : version.sdk,
|
|
55
|
+
})),
|
|
56
|
+
...Object.entries(dev_dependencies).map(([name, version]) => ({
|
|
57
|
+
name,
|
|
58
|
+
version: typeof version === 'string'
|
|
59
|
+
? version
|
|
60
|
+
: typeof version === 'number'
|
|
61
|
+
? version.toString()
|
|
62
|
+
: version === null || version === void 0 ? void 0 : version.sdk,
|
|
63
|
+
isDevDependency: true,
|
|
64
|
+
})),
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=pubspec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pubspec.js","sourceRoot":"","sources":["../../../src/code-scanning/integrations/pubspec.ts"],"names":[],"mappings":";;;;;;AAAA,2BAAkC;AAElC,+DAA8D;AAC9D,sDAA2B;AAC3B,+BAA+B;AAE/B;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,UAAkB;IAC5C,OAAO,UAAU;SACd,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,yBAAyB;QACzB,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,YAAY,GAAG,CAAC,CAAC,EAAE;YACrB,sCAAsC;YACtC,IACE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC;gBAC9C,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAC9C;gBACA,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,IAAI,EAAE,CAAC;aAC/C;SACF;QACD,OAAO,IAAI,CAAC;I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OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;wBAC5D,IAAI;wBACJ,OAAO,EACL,OAAO,OAAO,KAAK,QAAQ;4BACzB,CAAC,CAAC,OAAO;4BACT,CAAC,CAAC,OAAO,OAAO,KAAK,QAAQ;gCAC7B,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE;gCACpB,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG;wBAClB,eAAe,EAAE,IAAI;qBACtB,CAAC,CAAC;iBACJ;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pythonRequirementsTxt.d.ts","sourceRoot":"","sources":["../../../src/code-scanning/integrations/pythonRequirementsTxt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAU9C,eAAO,MAAM,qBAAqB,EAAE,kBAwCnC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pythonRequirementsTxt = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const type_utils_1 = require("@transcend-io/type-utils");
|
|
6
|
+
const api_keys_1 = require("../../api-keys");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const privacy_types_1 = require("@transcend-io/privacy-types");
|
|
9
|
+
const REQUIREMENTS_PACKAGE_MATCH = /(.+?)(=+)(.+)/;
|
|
10
|
+
const PACKAGE_NAME = /name *= *('|")(.+?)('|")/;
|
|
11
|
+
const PACKAGE_DESCRIPTION = /description *= *('|")(.+?)('|")/;
|
|
12
|
+
exports.pythonRequirementsTxt = {
|
|
13
|
+
supportedFiles: ['requirements.txt'],
|
|
14
|
+
ignoreDirs: ['build', 'lib', 'lib64'],
|
|
15
|
+
scanFunction: (filePath) => {
|
|
16
|
+
const fileContents = (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
17
|
+
const directory = (0, path_1.dirname)(filePath);
|
|
18
|
+
const filesInFolder = (0, api_keys_1.listFiles)(directory);
|
|
19
|
+
// parse setup file for name
|
|
20
|
+
const setupFile = filesInFolder.find((file) => file === 'setup.py');
|
|
21
|
+
const setupFileContents = setupFile
|
|
22
|
+
? (0, fs_1.readFileSync)((0, path_1.join)(directory, setupFile), 'utf-8')
|
|
23
|
+
: undefined;
|
|
24
|
+
const packageName = setupFileContents
|
|
25
|
+
? (PACKAGE_NAME.exec(setupFileContents) || [])[2]
|
|
26
|
+
: undefined;
|
|
27
|
+
const packageDescription = setupFileContents
|
|
28
|
+
? (PACKAGE_DESCRIPTION.exec(setupFileContents) || [])[2]
|
|
29
|
+
: undefined;
|
|
30
|
+
const targets = (0, type_utils_1.findAllWithRegex)({
|
|
31
|
+
value: new RegExp(REQUIREMENTS_PACKAGE_MATCH, 'g'),
|
|
32
|
+
matches: ['name', 'equals', 'version'],
|
|
33
|
+
}, fileContents);
|
|
34
|
+
return [
|
|
35
|
+
{
|
|
36
|
+
name: packageName || directory.split('/').pop(),
|
|
37
|
+
description: packageDescription || undefined,
|
|
38
|
+
type: privacy_types_1.CodePackageType.RequirementsTxt,
|
|
39
|
+
softwareDevelopmentKits: targets.map((pkg) => ({
|
|
40
|
+
name: pkg.name,
|
|
41
|
+
version: pkg.version,
|
|
42
|
+
})),
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=pythonRequirementsTxt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pythonRequirementsTxt.js","sourceRoot":"","sources":["../../../src/code-scanning/integrations/pythonRequirementsTxt.ts"],"names":[],"mappings":";;;AAAA,2BAAkC;AAElC,yDAA4D;AAC5D,6CAA2C;AAC3C,+BAAqC;AACrC,+DAA8D;AAE9D,MAAM,0BAA0B,GAAG,eAAe,CAAC;AACnD,MAAM,YAAY,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AAC;QAEF,OAAO;YACL;gBACE,IAAI,EAAE,WAAW,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG;gBAChD,WAAW,EAAE,kBAAkB,IAAI,SAAS;gBAC5C,IAAI,EAAE,+BAAe,CAAC,eAAe;gBACrC,uBAAuB,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;oBAC7C,IAAI,EAAE,GAAG,CAAC,IAAI;oBACd,OAAO,EAAE,GAAG,CAAC,OAAO;iBACrB,CAAC,CAAC;aACJ;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CodePackageInput } from '../codecs';
|
|
2
|
+
export interface CodeScanningConfig {
|
|
3
|
+
/** Directories to ignore when traversing */
|
|
4
|
+
ignoreDirs: string[];
|
|
5
|
+
/** Types of file that are supported */
|
|
6
|
+
supportedFiles: string[];
|
|
7
|
+
/** The function that will parse in a code package configuration given an input file */
|
|
8
|
+
scanFunction: (filePath: string) => Omit<CodePackageInput, 'repositoryName' | 'relativePath' | 'type'>[];
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/code-scanning/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IACjC,4CAA4C;IAC5C,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,uCAAuC;IACvC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,uFAAuF;IACvF,YAAY,EAAE,CACZ,QAAQ,EAAE,MAAM,KACb,IAAI,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,cAAc,GAAG,MAAM,CAAC,EAAE,CAAC;CAC3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/code-scanning/types.ts"],"names":[],"mappings":""}
|
package/build/codecs.d.ts
CHANGED
|
@@ -11602,6 +11602,114 @@ export declare const BusinessEntityInput: t.IntersectionC<[t.TypeC<{
|
|
|
11602
11602
|
}>]>;
|
|
11603
11603
|
/** Type override */
|
|
11604
11604
|
export type BusinessEntityInput = t.TypeOf<typeof BusinessEntityInput>;
|
|
11605
|
+
/**
|
|
11606
|
+
* Software development kit inputs
|
|
11607
|
+
*
|
|
11608
|
+
* @see https://app.transcend.io/code-scanning/sdks
|
|
11609
|
+
*/
|
|
11610
|
+
export declare const SoftwareDevelopmentKitInput: t.IntersectionC<[t.TypeC<{
|
|
11611
|
+
/** Title of software development kit */
|
|
11612
|
+
name: t.StringC;
|
|
11613
|
+
/** Code package type */
|
|
11614
|
+
codePackageType: t.KeyofC<{
|
|
11615
|
+
PACKAGE_JSON: unknown;
|
|
11616
|
+
REQUIREMENTS_TXT: unknown;
|
|
11617
|
+
GRADLE: unknown;
|
|
11618
|
+
COCOA_PODS: unknown;
|
|
11619
|
+
PUBSPEC: unknown;
|
|
11620
|
+
GEMFILE: unknown;
|
|
11621
|
+
}>;
|
|
11622
|
+
}>, t.PartialC<{
|
|
11623
|
+
/** Description of the SDK */
|
|
11624
|
+
description: t.StringC;
|
|
11625
|
+
/** Github repository */
|
|
11626
|
+
repositoryUrl: t.StringC;
|
|
11627
|
+
/** Integration name */
|
|
11628
|
+
catalogIntegrationName: t.StringC;
|
|
11629
|
+
/** Doc links */
|
|
11630
|
+
documentationLinks: t.ArrayC<t.StringC>;
|
|
11631
|
+
/** Emails of owners */
|
|
11632
|
+
ownerEmails: t.ArrayC<t.StringC>;
|
|
11633
|
+
/** Team names */
|
|
11634
|
+
teamNames: t.ArrayC<t.StringC>;
|
|
11635
|
+
}>]>;
|
|
11636
|
+
/** Type override */
|
|
11637
|
+
export type SoftwareDevelopmentKitInput = t.TypeOf<typeof SoftwareDevelopmentKitInput>;
|
|
11638
|
+
/**
|
|
11639
|
+
* SDK defined for a code package
|
|
11640
|
+
*/
|
|
11641
|
+
export declare const CodePackageSdk: t.IntersectionC<[t.TypeC<{
|
|
11642
|
+
/** Name of SDK */
|
|
11643
|
+
name: t.StringC;
|
|
11644
|
+
}>, t.PartialC<{
|
|
11645
|
+
/** Version of SDK */
|
|
11646
|
+
version: t.StringC;
|
|
11647
|
+
/** Indicate if dependency is a dev dependency */
|
|
11648
|
+
isDevDependency: t.BooleanC;
|
|
11649
|
+
}>]>;
|
|
11650
|
+
/** Type override */
|
|
11651
|
+
export type CodePackageSdk = t.TypeOf<typeof CodePackageSdk>;
|
|
11652
|
+
/**
|
|
11653
|
+
* Input to define a code package
|
|
11654
|
+
*
|
|
11655
|
+
* @see https://app.transcend.io/code-scanning/code-packages
|
|
11656
|
+
*/
|
|
11657
|
+
export declare const CodePackageInput: t.IntersectionC<[t.TypeC<{
|
|
11658
|
+
/** The name of the package */
|
|
11659
|
+
name: t.StringC;
|
|
11660
|
+
/** Type of code package */
|
|
11661
|
+
type: t.KeyofC<{
|
|
11662
|
+
PACKAGE_JSON: unknown;
|
|
11663
|
+
REQUIREMENTS_TXT: unknown;
|
|
11664
|
+
GRADLE: unknown;
|
|
11665
|
+
COCOA_PODS: unknown;
|
|
11666
|
+
PUBSPEC: unknown;
|
|
11667
|
+
GEMFILE: unknown;
|
|
11668
|
+
}>;
|
|
11669
|
+
/** Relative path to code package within the repository */
|
|
11670
|
+
relativePath: t.StringC;
|
|
11671
|
+
/** Name of repository that the code packages are being uploaded to */
|
|
11672
|
+
repositoryName: t.StringC;
|
|
11673
|
+
}>, t.PartialC<{
|
|
11674
|
+
/** Description of the code package */
|
|
11675
|
+
description: t.StringC;
|
|
11676
|
+
/** Software development kits in the repository */
|
|
11677
|
+
softwareDevelopmentKits: t.ArrayC<t.IntersectionC<[t.TypeC<{
|
|
11678
|
+
/** Name of SDK */
|
|
11679
|
+
name: t.StringC;
|
|
11680
|
+
}>, t.PartialC<{
|
|
11681
|
+
/** Version of SDK */
|
|
11682
|
+
version: t.StringC;
|
|
11683
|
+
/** Indicate if dependency is a dev dependency */
|
|
11684
|
+
isDevDependency: t.BooleanC;
|
|
11685
|
+
}>]>>;
|
|
11686
|
+
/** Names of the teams that manage the code package */
|
|
11687
|
+
teamNames: t.ArrayC<t.StringC>;
|
|
11688
|
+
/** Names of the owner emails that manage the code package */
|
|
11689
|
+
ownerEmails: t.ArrayC<t.StringC>;
|
|
11690
|
+
}>]>;
|
|
11691
|
+
/** Type override */
|
|
11692
|
+
export type CodePackageInput = t.TypeOf<typeof CodePackageInput>;
|
|
11693
|
+
/**
|
|
11694
|
+
* Input to define a repository
|
|
11695
|
+
*
|
|
11696
|
+
* @see https://app.transcend.io/code-scanning/repositories
|
|
11697
|
+
*/
|
|
11698
|
+
export declare const RepositoryInput: t.IntersectionC<[t.TypeC<{
|
|
11699
|
+
/** The name of the repo */
|
|
11700
|
+
name: t.StringC;
|
|
11701
|
+
/** URL of repository */
|
|
11702
|
+
url: t.StringC;
|
|
11703
|
+
}>, t.PartialC<{
|
|
11704
|
+
/** Description of the repository */
|
|
11705
|
+
description: t.StringC;
|
|
11706
|
+
/** Names of the teams that manage the repository */
|
|
11707
|
+
teamNames: t.ArrayC<t.StringC>;
|
|
11708
|
+
/** Names of the owner emails that manage the repository */
|
|
11709
|
+
ownerEmails: t.ArrayC<t.StringC>;
|
|
11710
|
+
}>]>;
|
|
11711
|
+
/** Type override */
|
|
11712
|
+
export type RepositoryInput = t.TypeOf<typeof RepositoryInput>;
|
|
11605
11713
|
/**
|
|
11606
11714
|
* Input to define a data subject
|
|
11607
11715
|
*
|