scanoss 0.7.8 → 0.7.10
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/build/main/index.d.ts +2 -0
- package/build/main/index.js +3 -1
- package/build/main/sdk/FileCount/FileCount.d.ts +6 -0
- package/build/main/sdk/FileCount/FileCount.js +88 -0
- package/build/main/sdk/FileCount/FileCountFilter.d.ts +2 -0
- package/build/main/sdk/FileCount/FileCountFilter.js +10 -0
- package/build/main/sdk/FileCount/Interfaces.d.ts +19 -0
- package/build/main/sdk/FileCount/Interfaces.js +8 -0
- package/build/main/sdk/Filtering/DefaultFilterForDependencies.d.ts +2 -0
- package/build/main/sdk/Filtering/DefaultFilterForDependencies.js +144 -0
- package/build/main/sdk/Filtering/DefaultFilterForScanning.d.ts +2 -0
- package/build/main/sdk/Filtering/DefaultFilterForScanning.js +193 -0
- package/build/main/sdk/Filtering/Filtering.d.ts +80 -0
- package/build/main/sdk/Filtering/Filtering.js +259 -0
- package/build/main/sdk/scanner/WfpProvider/WfpCalculator/WfpCalculator.d.ts +1 -1
- package/build/main/sdk/tree/Filters/DependencyFilter.js +4 -4
- package/build/main/sdk/tree/Filters/ScanFilter.js +4 -4
- package/build/main/tsconfig.tsbuildinfo +82 -39
- package/build/module/index.d.ts +2 -0
- package/build/module/index.js +3 -1
- package/build/module/sdk/FileCount/FileCount.d.ts +6 -0
- package/build/module/sdk/FileCount/FileCount.js +63 -0
- package/build/module/sdk/FileCount/FileCountFilter.d.ts +2 -0
- package/build/module/sdk/FileCount/FileCountFilter.js +8 -0
- package/build/module/sdk/FileCount/Interfaces.d.ts +19 -0
- package/build/module/sdk/FileCount/Interfaces.js +6 -0
- package/build/module/sdk/Filtering/DefaultFilterForDependencies.d.ts +2 -0
- package/build/module/sdk/Filtering/DefaultFilterForDependencies.js +142 -0
- package/build/module/sdk/Filtering/DefaultFilterForScanning.d.ts +2 -0
- package/build/module/sdk/Filtering/DefaultFilterForScanning.js +191 -0
- package/build/module/sdk/Filtering/Filtering.d.ts +80 -0
- package/build/module/sdk/Filtering/Filtering.js +229 -0
- package/build/module/sdk/scanner/WfpProvider/WfpCalculator/WfpCalculator.d.ts +1 -1
- package/build/module/sdk/tree/Filters/DependencyFilter.js +4 -4
- package/build/module/sdk/tree/Filters/ScanFilter.js +4 -4
- package/build/module/tsconfig.module.tsbuildinfo +82 -39
- package/package.json +3 -3
- package/.circleci/config.yml +0 -64
- package/.cspell.json +0 -36
- package/.editorconfig +0 -15
- package/.eslintrc.json +0 -37
- package/.github/workflows/reuse.yml +0 -15
- package/.github/workflows/scanoss.yml +0 -24
- package/.gitignore +0 -10
- package/.idea/.gitignore +0 -5
- package/.idea/codeStyles/Project.xml +0 -61
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/scanoss.js.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -297
- package/.prettierignore +0 -2
- package/.reuse/dep5 +0 -16
- package/.vscode/extensions.json +0 -8
- package/.vscode/launch.json +0 -29
- package/.vscode/settings.json +0 -7
- package/LICENSES/CC0-1.0.txt +0 -121
- package/LICENSES/MIT.txt +0 -9
- package/assets/ReportHTMLTemplate/index.html +0 -1181
- package/build/main/package.json +0 -120
- package/build/main/sdk/filters/DefaultFilterForDependencies.d.ts +0 -16
- package/build/main/sdk/filters/DefaultFilterForDependencies.js +0 -145
- package/build/main/sdk/filters/DefaultFilterForScanning.d.ts +0 -16
- package/build/main/sdk/filters/DefaultFilterForScanning.js +0 -194
- package/build/main/sdk/filters/filtering.d.ts +0 -32
- package/build/main/sdk/filters/filtering.js +0 -228
- package/build/main/src/cli/bin/cli-bin.d.ts +0 -2
- package/build/main/src/cli/bin/cli-bin.js +0 -68
- package/build/main/src/cli/commands/dep.d.ts +0 -1
- package/build/main/src/cli/commands/dep.js +0 -38
- package/build/main/src/cli/commands/helpers.d.ts +0 -2
- package/build/main/src/cli/commands/helpers.js +0 -25
- package/build/main/src/cli/commands/scan.d.ts +0 -1
- package/build/main/src/cli/commands/scan.js +0 -138
- package/build/main/src/cli/commands/wfp.d.ts +0 -1
- package/build/main/src/cli/commands/wfp.js +0 -54
- package/build/main/src/index.d.ts +0 -14
- package/build/main/src/index.js +0 -30
- package/build/main/src/sdk/DataLayer/DataLayerTypes.d.ts +0 -108
- package/build/main/src/sdk/DataLayer/DataLayerTypes.js +0 -5
- package/build/main/src/sdk/DataLayer/DataProviderManager.d.ts +0 -7
- package/build/main/src/sdk/DataLayer/DataProviderManager.js +0 -24
- package/build/main/src/sdk/DataLayer/DataProviders/ComponentDataProvider.d.ts +0 -13
- package/build/main/src/sdk/DataLayer/DataProviders/ComponentDataProvider.js +0 -164
- package/build/main/src/sdk/DataLayer/DataProviders/DependencyDataProvider.d.ts +0 -9
- package/build/main/src/sdk/DataLayer/DataProviders/DependencyDataProvider.js +0 -37
- package/build/main/src/sdk/DataLayer/DataProviders/LicenseDataProvider.d.ts +0 -18
- package/build/main/src/sdk/DataLayer/DataProviders/LicenseDataProvider.js +0 -148
- package/build/main/src/sdk/DataLayer/DataProviders/SummaryDataProvider.d.ts +0 -11
- package/build/main/src/sdk/DataLayer/DataProviders/SummaryDataProvider.js +0 -33
- package/build/main/src/sdk/Decompress/DecompressionManager.d.ts +0 -12
- package/build/main/src/sdk/Decompress/DecompressionManager.js +0 -73
- package/build/main/src/sdk/Decompress/Decompressor/DecompressTgz.d.ts +0 -5
- package/build/main/src/sdk/Decompress/Decompressor/DecompressTgz.js +0 -22
- package/build/main/src/sdk/Decompress/Decompressor/DecompressZips.d.ts +0 -5
- package/build/main/src/sdk/Decompress/Decompressor/DecompressZips.js +0 -24
- package/build/main/src/sdk/Decompress/Decompressor/Decompressor.d.ts +0 -10
- package/build/main/src/sdk/Decompress/Decompressor/Decompressor.js +0 -18
- package/build/main/src/sdk/Dependencies/DependencyScanner.d.ts +0 -11
- package/build/main/src/sdk/Dependencies/DependencyScanner.js +0 -96
- package/build/main/src/sdk/Dependencies/DependencyScannerCfg.d.ts +0 -4
- package/build/main/src/sdk/Dependencies/DependencyScannerCfg.js +0 -10
- package/build/main/src/sdk/Dependencies/DependencyTypes.d.ts +0 -21
- package/build/main/src/sdk/Dependencies/DependencyTypes.js +0 -2
- package/build/main/src/sdk/Dependencies/LocalDependency/DependencyTypes.d.ts +0 -16
- package/build/main/src/sdk/Dependencies/LocalDependency/DependencyTypes.js +0 -2
- package/build/main/src/sdk/Dependencies/LocalDependency/LocalDependency.d.ts +0 -8
- package/build/main/src/sdk/Dependencies/LocalDependency/LocalDependency.js +0 -102
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/buildGradleParser.d.ts +0 -2
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/buildGradleParser.js +0 -95
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/golangParser.d.ts +0 -3
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/golangParser.js +0 -97
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/mavenParser.d.ts +0 -2
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/mavenParser.js +0 -183
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/npmParser.d.ts +0 -13
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/npmParser.js +0 -187
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/nugetParser.d.ts +0 -3
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/nugetParser.js +0 -58
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/pyParser.d.ts +0 -2
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/pyParser.js +0 -64
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/rubyParser.d.ts +0 -3
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/rubyParser.js +0 -132
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/utils.d.ts +0 -2
- package/build/main/src/sdk/Dependencies/LocalDependency/parsers/utils.js +0 -19
- package/build/main/src/sdk/Report/Report.d.ts +0 -8
- package/build/main/src/sdk/Report/Report.js +0 -26
- package/build/main/src/sdk/filters/DefaultFilterForDependencies.d.ts +0 -16
- package/build/main/src/sdk/filters/DefaultFilterForDependencies.js +0 -145
- package/build/main/src/sdk/filters/DefaultFilterForScanning.d.ts +0 -16
- package/build/main/src/sdk/filters/DefaultFilterForScanning.js +0 -194
- package/build/main/src/sdk/filters/filtering.d.ts +0 -32
- package/build/main/src/sdk/filters/filtering.js +0 -228
- package/build/main/src/sdk/grpc/GrpcDependencyService.d.ts +0 -11
- package/build/main/src/sdk/grpc/GrpcDependencyService.js +0 -86
- package/build/main/src/sdk/grpc/scanoss/api/common/v2/scanoss-common_grpc_pb.d.ts +0 -0
- package/build/main/src/sdk/grpc/scanoss/api/common/v2/scanoss-common_grpc_pb.js +0 -2
- package/build/main/src/sdk/grpc/scanoss/api/common/v2/scanoss-common_pb.d.ts +0 -1
- package/build/main/src/sdk/grpc/scanoss/api/common/v2/scanoss-common_pb.js +0 -404
- package/build/main/src/sdk/grpc/scanoss/api/dependencies/v2/scanoss-dependencies_grpc_pb.d.ts +0 -39
- package/build/main/src/sdk/grpc/scanoss/api/dependencies/v2/scanoss-dependencies_grpc_pb.js +0 -98
- package/build/main/src/sdk/grpc/scanoss/api/dependencies/v2/scanoss-dependencies_pb.d.ts +0 -1
- package/build/main/src/sdk/grpc/scanoss/api/dependencies/v2/scanoss-dependencies_pb.js +0 -1197
- package/build/main/src/sdk/grpc/scanoss/api/scanning/v2/scanoss-scanning_grpc_pb.d.ts +0 -19
- package/build/main/src/sdk/grpc/scanoss/api/scanning/v2/scanoss-scanning_grpc_pb.js +0 -66
- package/build/main/src/sdk/grpc/scanoss/api/scanning/v2/scanoss-scanning_pb.d.ts +0 -1
- package/build/main/src/sdk/grpc/scanoss/api/scanning/v2/scanoss-scanning_pb.js +0 -14
- package/build/main/src/sdk/scanner/Dispatcher/DispatchableItem.d.ts +0 -19
- package/build/main/src/sdk/scanner/Dispatcher/DispatchableItem.js +0 -43
- package/build/main/src/sdk/scanner/Dispatcher/Dispatcher.d.ts +0 -20
- package/build/main/src/sdk/scanner/Dispatcher/Dispatcher.js +0 -160
- package/build/main/src/sdk/scanner/Dispatcher/DispatcherResponse.d.ts +0 -12
- package/build/main/src/sdk/scanner/Dispatcher/DispatcherResponse.js +0 -33
- package/build/main/src/sdk/scanner/Dispatcher/GlobalControllerAborter.d.ts +0 -10
- package/build/main/src/sdk/scanner/Dispatcher/GlobalControllerAborter.js +0 -32
- package/build/main/src/sdk/scanner/Fingerprint.d.ts +0 -16
- package/build/main/src/sdk/scanner/Fingerprint.js +0 -78
- package/build/main/src/sdk/scanner/Scannable/ScannableItem.d.ts +0 -15
- package/build/main/src/sdk/scanner/Scannable/ScannableItem.js +0 -27
- package/build/main/src/sdk/scanner/Scanner.d.ts +0 -46
- package/build/main/src/sdk/scanner/Scanner.js +0 -283
- package/build/main/src/sdk/scanner/ScannerCfg.d.ts +0 -16
- package/build/main/src/sdk/scanner/ScannerCfg.js +0 -30
- package/build/main/src/sdk/scanner/ScannerTypes.d.ts +0 -121
- package/build/main/src/sdk/scanner/ScannerTypes.js +0 -48
- package/build/main/src/sdk/scanner/WfpProvider/FingerprintPackage.d.ts +0 -9
- package/build/main/src/sdk/scanner/WfpProvider/FingerprintPackage.js +0 -31
- package/build/main/src/sdk/scanner/WfpProvider/WfpCalculator/WfpCalculator.d.ts +0 -20
- package/build/main/src/sdk/scanner/WfpProvider/WfpCalculator/WfpCalculator.js +0 -492
- package/build/main/src/sdk/scanner/WfpProvider/WfpProvider.d.ts +0 -35
- package/build/main/src/sdk/scanner/WfpProvider/WfpProvider.js +0 -68
- package/build/main/src/sdk/scanner/WfpProvider/WfpSplitter/WfpSplitter.d.ts +0 -21
- package/build/main/src/sdk/scanner/WfpProvider/WfpSplitter/WfpSplitter.js +0 -139
- package/build/main/src/sdk/tree/File.d.ts +0 -7
- package/build/main/src/sdk/tree/File.js +0 -24
- package/build/main/src/sdk/tree/Filters/DecompressionFilter.d.ts +0 -7
- package/build/main/src/sdk/tree/Filters/DecompressionFilter.js +0 -21
- package/build/main/src/sdk/tree/Filters/DependencyFilter.d.ts +0 -7
- package/build/main/src/sdk/tree/Filters/DependencyFilter.js +0 -17
- package/build/main/src/sdk/tree/Filters/Filter.d.ts +0 -4
- package/build/main/src/sdk/tree/Filters/Filter.js +0 -6
- package/build/main/src/sdk/tree/Filters/ScanFilter.d.ts +0 -7
- package/build/main/src/sdk/tree/Filters/ScanFilter.js +0 -17
- package/build/main/src/sdk/tree/Folder.d.ts +0 -12
- package/build/main/src/sdk/tree/Folder.js +0 -58
- package/build/main/src/sdk/tree/Node.d.ts +0 -17
- package/build/main/src/sdk/tree/Node.js +0 -25
- package/build/main/src/sdk/tree/Tree.d.ts +0 -18
- package/build/main/src/sdk/tree/Tree.js +0 -70
- package/build/module/package.json +0 -120
- package/build/module/sdk/filters/DefaultFilterForDependencies.d.ts +0 -16
- package/build/module/sdk/filters/DefaultFilterForDependencies.js +0 -143
- package/build/module/sdk/filters/DefaultFilterForScanning.d.ts +0 -16
- package/build/module/sdk/filters/DefaultFilterForScanning.js +0 -192
- package/build/module/sdk/filters/filtering.d.ts +0 -32
- package/build/module/sdk/filters/filtering.js +0 -203
- package/build/module/src/cli/bin/cli-bin.d.ts +0 -2
- package/build/module/src/cli/bin/cli-bin.js +0 -67
- package/build/module/src/cli/commands/dep.d.ts +0 -1
- package/build/module/src/cli/commands/dep.js +0 -32
- package/build/module/src/cli/commands/helpers.d.ts +0 -2
- package/build/module/src/cli/commands/helpers.js +0 -19
- package/build/module/src/cli/commands/scan.d.ts +0 -1
- package/build/module/src/cli/commands/scan.js +0 -135
- package/build/module/src/cli/commands/wfp.d.ts +0 -1
- package/build/module/src/cli/commands/wfp.js +0 -48
- package/build/module/src/index.d.ts +0 -14
- package/build/module/src/index.js +0 -19
- package/build/module/src/sdk/DataLayer/DataLayerTypes.d.ts +0 -108
- package/build/module/src/sdk/DataLayer/DataLayerTypes.js +0 -5
- package/build/module/src/sdk/DataLayer/DataProviderManager.d.ts +0 -7
- package/build/module/src/sdk/DataLayer/DataProviderManager.js +0 -21
- package/build/module/src/sdk/DataLayer/DataProviders/ComponentDataProvider.d.ts +0 -13
- package/build/module/src/sdk/DataLayer/DataProviders/ComponentDataProvider.js +0 -159
- package/build/module/src/sdk/DataLayer/DataProviders/DependencyDataProvider.d.ts +0 -9
- package/build/module/src/sdk/DataLayer/DataProviders/DependencyDataProvider.js +0 -34
- package/build/module/src/sdk/DataLayer/DataProviders/LicenseDataProvider.d.ts +0 -18
- package/build/module/src/sdk/DataLayer/DataProviders/LicenseDataProvider.js +0 -145
- package/build/module/src/sdk/DataLayer/DataProviders/SummaryDataProvider.d.ts +0 -11
- package/build/module/src/sdk/DataLayer/DataProviders/SummaryDataProvider.js +0 -30
- package/build/module/src/sdk/Decompress/DecompressionManager.d.ts +0 -12
- package/build/module/src/sdk/Decompress/DecompressionManager.js +0 -67
- package/build/module/src/sdk/Decompress/Decompressor/DecompressTgz.d.ts +0 -5
- package/build/module/src/sdk/Decompress/Decompressor/DecompressTgz.js +0 -16
- package/build/module/src/sdk/Decompress/Decompressor/DecompressZips.d.ts +0 -5
- package/build/module/src/sdk/Decompress/Decompressor/DecompressZips.js +0 -18
- package/build/module/src/sdk/Decompress/Decompressor/Decompressor.d.ts +0 -10
- package/build/module/src/sdk/Decompress/Decompressor/Decompressor.js +0 -15
- package/build/module/src/sdk/Dependencies/DependencyScanner.d.ts +0 -11
- package/build/module/src/sdk/Dependencies/DependencyScanner.js +0 -93
- package/build/module/src/sdk/Dependencies/DependencyScannerCfg.d.ts +0 -4
- package/build/module/src/sdk/Dependencies/DependencyScannerCfg.js +0 -7
- package/build/module/src/sdk/Dependencies/DependencyTypes.d.ts +0 -21
- package/build/module/src/sdk/Dependencies/DependencyTypes.js +0 -2
- package/build/module/src/sdk/Dependencies/LocalDependency/DependencyTypes.d.ts +0 -16
- package/build/module/src/sdk/Dependencies/LocalDependency/DependencyTypes.js +0 -2
- package/build/module/src/sdk/Dependencies/LocalDependency/LocalDependency.d.ts +0 -8
- package/build/module/src/sdk/Dependencies/LocalDependency/LocalDependency.js +0 -96
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/buildGradleParser.d.ts +0 -2
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/buildGradleParser.js +0 -87
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/golangParser.d.ts +0 -3
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/golangParser.js +0 -88
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/mavenParser.d.ts +0 -2
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/mavenParser.js +0 -180
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/npmParser.d.ts +0 -13
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/npmParser.js +0 -175
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/nugetParser.d.ts +0 -3
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/nugetParser.js +0 -49
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/pyParser.d.ts +0 -2
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/pyParser.js +0 -57
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/rubyParser.d.ts +0 -3
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/rubyParser.js +0 -125
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/utils.d.ts +0 -2
- package/build/module/src/sdk/Dependencies/LocalDependency/parsers/utils.js +0 -15
- package/build/module/src/sdk/Report/Report.d.ts +0 -8
- package/build/module/src/sdk/Report/Report.js +0 -20
- package/build/module/src/sdk/filters/DefaultFilterForDependencies.d.ts +0 -16
- package/build/module/src/sdk/filters/DefaultFilterForDependencies.js +0 -143
- package/build/module/src/sdk/filters/DefaultFilterForScanning.d.ts +0 -16
- package/build/module/src/sdk/filters/DefaultFilterForScanning.js +0 -192
- package/build/module/src/sdk/filters/filtering.d.ts +0 -32
- package/build/module/src/sdk/filters/filtering.js +0 -203
- package/build/module/src/sdk/grpc/GrpcDependencyService.d.ts +0 -11
- package/build/module/src/sdk/grpc/GrpcDependencyService.js +0 -64
- package/build/module/src/sdk/grpc/scanoss/api/common/v2/scanoss-common_grpc_pb.d.ts +0 -0
- package/build/module/src/sdk/grpc/scanoss/api/common/v2/scanoss-common_grpc_pb.js +0 -2
- package/build/module/src/sdk/grpc/scanoss/api/common/v2/scanoss-common_pb.d.ts +0 -1
- package/build/module/src/sdk/grpc/scanoss/api/common/v2/scanoss-common_pb.js +0 -404
- package/build/module/src/sdk/grpc/scanoss/api/dependencies/v2/scanoss-dependencies_grpc_pb.d.ts +0 -39
- package/build/module/src/sdk/grpc/scanoss/api/dependencies/v2/scanoss-dependencies_grpc_pb.js +0 -98
- package/build/module/src/sdk/grpc/scanoss/api/dependencies/v2/scanoss-dependencies_pb.d.ts +0 -1
- package/build/module/src/sdk/grpc/scanoss/api/dependencies/v2/scanoss-dependencies_pb.js +0 -1197
- package/build/module/src/sdk/grpc/scanoss/api/scanning/v2/scanoss-scanning_grpc_pb.d.ts +0 -19
- package/build/module/src/sdk/grpc/scanoss/api/scanning/v2/scanoss-scanning_grpc_pb.js +0 -66
- package/build/module/src/sdk/grpc/scanoss/api/scanning/v2/scanoss-scanning_pb.d.ts +0 -1
- package/build/module/src/sdk/grpc/scanoss/api/scanning/v2/scanoss-scanning_pb.js +0 -14
- package/build/module/src/sdk/scanner/Dispatcher/DispatchableItem.d.ts +0 -19
- package/build/module/src/sdk/scanner/Dispatcher/DispatchableItem.js +0 -37
- package/build/module/src/sdk/scanner/Dispatcher/Dispatcher.d.ts +0 -20
- package/build/module/src/sdk/scanner/Dispatcher/Dispatcher.js +0 -135
- package/build/module/src/sdk/scanner/Dispatcher/DispatcherResponse.d.ts +0 -12
- package/build/module/src/sdk/scanner/Dispatcher/DispatcherResponse.js +0 -30
- package/build/module/src/sdk/scanner/Dispatcher/GlobalControllerAborter.d.ts +0 -10
- package/build/module/src/sdk/scanner/Dispatcher/GlobalControllerAborter.js +0 -26
- package/build/module/src/sdk/scanner/Fingerprint.d.ts +0 -16
- package/build/module/src/sdk/scanner/Fingerprint.js +0 -54
- package/build/module/src/sdk/scanner/Scannable/ScannableItem.d.ts +0 -15
- package/build/module/src/sdk/scanner/Scannable/ScannableItem.js +0 -24
- package/build/module/src/sdk/scanner/Scanner.d.ts +0 -46
- package/build/module/src/sdk/scanner/Scanner.js +0 -275
- package/build/module/src/sdk/scanner/ScannerCfg.d.ts +0 -16
- package/build/module/src/sdk/scanner/ScannerCfg.js +0 -27
- package/build/module/src/sdk/scanner/ScannerTypes.d.ts +0 -121
- package/build/module/src/sdk/scanner/ScannerTypes.js +0 -46
- package/build/module/src/sdk/scanner/WfpProvider/FingerprintPackage.d.ts +0 -9
- package/build/module/src/sdk/scanner/WfpProvider/FingerprintPackage.js +0 -28
- package/build/module/src/sdk/scanner/WfpProvider/WfpCalculator/WfpCalculator.d.ts +0 -20
- package/build/module/src/sdk/scanner/WfpProvider/WfpCalculator/WfpCalculator.js +0 -486
- package/build/module/src/sdk/scanner/WfpProvider/WfpProvider.d.ts +0 -35
- package/build/module/src/sdk/scanner/WfpProvider/WfpProvider.js +0 -65
- package/build/module/src/sdk/scanner/WfpProvider/WfpSplitter/WfpSplitter.d.ts +0 -21
- package/build/module/src/sdk/scanner/WfpProvider/WfpSplitter/WfpSplitter.js +0 -132
- package/build/module/src/sdk/tree/File.d.ts +0 -7
- package/build/module/src/sdk/tree/File.js +0 -19
- package/build/module/src/sdk/tree/Filters/DecompressionFilter.d.ts +0 -7
- package/build/module/src/sdk/tree/Filters/DecompressionFilter.js +0 -18
- package/build/module/src/sdk/tree/Filters/DependencyFilter.d.ts +0 -7
- package/build/module/src/sdk/tree/Filters/DependencyFilter.js +0 -14
- package/build/module/src/sdk/tree/Filters/Filter.d.ts +0 -4
- package/build/module/src/sdk/tree/Filters/Filter.js +0 -3
- package/build/module/src/sdk/tree/Filters/ScanFilter.d.ts +0 -7
- package/build/module/src/sdk/tree/Filters/ScanFilter.js +0 -14
- package/build/module/src/sdk/tree/Folder.d.ts +0 -12
- package/build/module/src/sdk/tree/Folder.js +0 -53
- package/build/module/src/sdk/tree/Node.d.ts +0 -17
- package/build/module/src/sdk/tree/Node.js +0 -22
- package/build/module/src/sdk/tree/Tree.d.ts +0 -18
- package/build/module/src/sdk/tree/Tree.js +0 -64
- package/package-lock.json +0 -17117
- package/src/cli/bin/cli-bin.ts +0 -81
- package/src/cli/commands/dep.ts +0 -37
- package/src/cli/commands/helpers.ts +0 -19
- package/src/cli/commands/scan.ts +0 -173
- package/src/cli/commands/wfp.ts +0 -60
- package/src/index.ts +0 -26
- package/src/sdk/DataLayer/DataLayerTypes.ts +0 -129
- package/src/sdk/DataLayer/DataProviderManager.ts +0 -27
- package/src/sdk/DataLayer/DataProviders/ComponentDataProvider.ts +0 -195
- package/src/sdk/DataLayer/DataProviders/DependencyDataProvider.ts +0 -48
- package/src/sdk/DataLayer/DataProviders/LicenseDataProvider.ts +0 -184
- package/src/sdk/DataLayer/DataProviders/SummaryDataProvider.ts +0 -47
- package/src/sdk/Decompress/DecompressionManager.ts +0 -91
- package/src/sdk/Decompress/Decompressor/DecompressTgz.ts +0 -20
- package/src/sdk/Decompress/Decompressor/DecompressZips.ts +0 -21
- package/src/sdk/Decompress/Decompressor/Decompressor.ts +0 -20
- package/src/sdk/Dependencies/DependencyScanner.ts +0 -108
- package/src/sdk/Dependencies/DependencyScannerCfg.ts +0 -7
- package/src/sdk/Dependencies/DependencyTypes.ts +0 -24
- package/src/sdk/Dependencies/LocalDependency/DependencyTypes.ts +0 -21
- package/src/sdk/Dependencies/LocalDependency/LocalDependency.ts +0 -111
- package/src/sdk/Dependencies/LocalDependency/parsers/buildGradleParser.ts +0 -115
- package/src/sdk/Dependencies/LocalDependency/parsers/golangParser.ts +0 -130
- package/src/sdk/Dependencies/LocalDependency/parsers/mavenParser.ts +0 -209
- package/src/sdk/Dependencies/LocalDependency/parsers/npmParser.ts +0 -227
- package/src/sdk/Dependencies/LocalDependency/parsers/nugetParser.ts +0 -64
- package/src/sdk/Dependencies/LocalDependency/parsers/pyParser.ts +0 -58
- package/src/sdk/Dependencies/LocalDependency/parsers/rubyParser.ts +0 -174
- package/src/sdk/Dependencies/LocalDependency/parsers/utils.ts +0 -15
- package/src/sdk/Report/Report.ts +0 -30
- package/src/sdk/filters/DefaultFilterForDependencies.ts +0 -149
- package/src/sdk/filters/DefaultFilterForScanning.ts +0 -207
- package/src/sdk/filters/filtering.ts +0 -235
- package/src/sdk/grpc/GrpcDependencyService.ts +0 -72
- package/src/sdk/grpc/scanoss/api/common/v2/scanoss-common_grpc_pb.d.ts +0 -1
- package/src/sdk/grpc/scanoss/api/common/v2/scanoss-common_grpc_pb.js +0 -1
- package/src/sdk/grpc/scanoss/api/common/v2/scanoss-common_pb.d.ts +0 -79
- package/src/sdk/grpc/scanoss/api/common/v2/scanoss-common_pb.js +0 -482
- package/src/sdk/grpc/scanoss/api/dependencies/v2/scanoss-dependencies_grpc_pb.d.ts +0 -30
- package/src/sdk/grpc/scanoss/api/dependencies/v2/scanoss-dependencies_grpc_pb.js +0 -109
- package/src/sdk/grpc/scanoss/api/dependencies/v2/scanoss-dependencies_pb.d.ts +0 -206
- package/src/sdk/grpc/scanoss/api/dependencies/v2/scanoss-dependencies_pb.js +0 -1489
- package/src/sdk/grpc/scanoss/api/scanning/v2/scanoss-scanning_grpc_pb.d.ts +0 -25
- package/src/sdk/grpc/scanoss/api/scanning/v2/scanoss-scanning_grpc_pb.js +0 -73
- package/src/sdk/grpc/scanoss/api/scanning/v2/scanoss-scanning_pb.d.ts +0 -6
- package/src/sdk/grpc/scanoss/api/scanning/v2/scanoss-scanning_pb.js +0 -15
- package/src/sdk/scanner/Dispatcher/DispatchableItem.ts +0 -62
- package/src/sdk/scanner/Dispatcher/Dispatcher.ts +0 -173
- package/src/sdk/scanner/Dispatcher/DispatcherResponse.ts +0 -40
- package/src/sdk/scanner/Dispatcher/GlobalControllerAborter.ts +0 -33
- package/src/sdk/scanner/Fingerprint.ts +0 -82
- package/src/sdk/scanner/Scannable/ScannableItem.ts +0 -43
- package/src/sdk/scanner/Scanner.ts +0 -360
- package/src/sdk/scanner/ScannerCfg.ts +0 -43
- package/src/sdk/scanner/ScannerTypes.ts +0 -127
- package/src/sdk/scanner/WfpProvider/FingerprintPackage.ts +0 -34
- package/src/sdk/scanner/WfpProvider/WfpCalculator/WfpCalculator.ts +0 -516
- package/src/sdk/scanner/WfpProvider/WfpProvider.ts +0 -105
- package/src/sdk/scanner/WfpProvider/WfpSplitter/WfpSplitter.ts +0 -184
- package/src/sdk/tree/File.ts +0 -22
- package/src/sdk/tree/Filters/DecompressionFilter.ts +0 -22
- package/src/sdk/tree/Filters/DependencyFilter.ts +0 -22
- package/src/sdk/tree/Filters/Filter.ts +0 -5
- package/src/sdk/tree/Filters/ScanFilter.ts +0 -22
- package/src/sdk/tree/Folder.ts +0 -57
- package/src/sdk/tree/Node.ts +0 -39
- package/src/sdk/tree/Tree.ts +0 -82
- package/tests/scanoss.sh +0 -56
- package/tests/sdk/DataLayer/DataProviders/ComponentDataProvider.spec.ts +0 -176
- package/tests/sdk/DataLayer/DataProviders/DependencyDataProvider.spec.ts +0 -51
- package/tests/sdk/DataLayer/DataProviders/SummaryDataProvider.spec.ts +0 -35
- package/tests/sdk/DataLayer/DataProviders/samples/results-with-dep.json +0 -665
- package/tests/sdk/DataLayer/DataProviders/samples/results.json +0 -556
- package/tests/sdk/DataLayer/samples/simple/results-with-dep.json +0 -665
- package/tests/sdk/DataLayer/samples/simple-1/output1.json +0 -1196
- package/tests/sdk/Dependencies/LocalDependency/LocalDependency.spec.ts +0 -24
- package/tests/sdk/Dependencies/LocalDependency/Parsers/buildGradle.spec.ts +0 -48
- package/tests/sdk/Dependencies/LocalDependency/Parsers/golangParser.spec.ts +0 -146
- package/tests/sdk/Dependencies/LocalDependency/Parsers/npmParser.spec.ts +0 -135
- package/tests/sdk/Dependencies/LocalDependency/Parsers/nugetParser.spec.ts +0 -73
- package/tests/sdk/Dependencies/LocalDependency/Parsers/pomParser.spec.ts +0 -45
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/Gemfile/1/Gemfile +0 -6
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/Gemfile/1/Gemfile~ +0 -0
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/Gemfile/2/Gemfile +0 -3
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/Gemfile/2/Gemfile~ +0 -6
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/Gemfile/3/Gemfile +0 -7
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/Gemfile/3/Gemfile~ +0 -6
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/Gemfile/4/Gemfile +0 -31
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/Gemfile/4/Gemfile~ +0 -7
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/Gemfile.lock/1/Gemfile.lock +0 -180
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/Gemfile.lock/2/Gemfile.lock +0 -60
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/Gemfile.lock/2/Gemfile.lock~ +0 -0
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/go.sum/1/go.sum +0 -119
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/go.sum/depJSON.sh +0 -23
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/gradle/1/build.gradle +0 -26
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/gradle/2/build.gradle +0 -16
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/nuget/NoDependencies.csproj +0 -115
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/nuget/netcore-2.csproj +0 -18
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/nuget/netcore.csproj +0 -14
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/nuget/packageConfig-1/packages.config +0 -5
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/pom.xml/1/pom.xml +0 -670
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/pom.xml/2/pom.xml +0 -780
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/yarn-lock/generate_expected_output.sh +0 -4
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/yarn-lock/v1/yarn.lock +0 -50
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/yarn-lock/v1/yarn.lock-expected +0 -13
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/yarn-lock/v1-complex/yarn.lock +0 -27
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/yarn-lock/v1-complex/yarn.lock-expected +0 -8
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/yarn-lock/v1_2/scancode-out.json +0 -149662
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/yarn-lock/v1_2/yarn.lock +0 -8409
- package/tests/sdk/Dependencies/LocalDependency/Parsers/samples/yarn-lock/v1_2/yarn.lock-expected +0 -1153
- package/tests/sdk/Scanner/WfpProvider/WfpCalculator/WfpCalculator.spec.ts +0 -102
- package/tests/sdk/Scanner/WfpProvider/WfpCalculator/samples/file1.c +0 -41
- package/tests/sdk/Scanner/WfpProvider/WfpCalculator/samples/file2.go +0 -87
- package/tests/sdk/Scanner/WfpProvider/WfpSplitter/WfpSplitter.spec.ts +0 -35
- package/tests/sdk/Scanner/WfpProvider/WfpSplitter/samples/wfp.wfp +0 -68
- package/tests/sdk/Scanner/WfpProvider/WfpSplitter/samples/wfp.wfp~ +0 -68
- package/tsconfig.json +0 -31
- package/tsconfig.module.json +0 -11
- package/yarn.lock +0 -5481
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { IWfpProviderInput, WfpProvider } from "../WfpProvider";
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import { ScannerCfg } from "../../ScannerCfg";
|
|
4
|
-
import { Readable } from "stream";
|
|
5
|
-
|
|
6
|
-
//Regex find paths from wfp string
|
|
7
|
-
|
|
8
|
-
export class WfpSplitter extends WfpProvider {
|
|
9
|
-
|
|
10
|
-
private continue: boolean;
|
|
11
|
-
|
|
12
|
-
private wfpStream: Readable;
|
|
13
|
-
|
|
14
|
-
private chunkDataRead: string;
|
|
15
|
-
|
|
16
|
-
private fingerprints: Array<string>;
|
|
17
|
-
|
|
18
|
-
private fingerprintIndex: number;
|
|
19
|
-
|
|
20
|
-
private timer: ReturnType<typeof setTimeout>;
|
|
21
|
-
|
|
22
|
-
private ignoreFiles: Set<string>;
|
|
23
|
-
|
|
24
|
-
constructor(scannerCfg = new ScannerCfg()) {
|
|
25
|
-
super();
|
|
26
|
-
this.scannerCfg = scannerCfg;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
public start(params: IWfpProviderInput): Promise<void> {
|
|
30
|
-
|
|
31
|
-
this.sendLog('[ SCANNER ]: WFP Splitter starting...');
|
|
32
|
-
|
|
33
|
-
this.init();
|
|
34
|
-
this.pendingFiles = true;
|
|
35
|
-
this.chunkDataRead = '';
|
|
36
|
-
this.fingerprints = [];
|
|
37
|
-
this.continue = true;
|
|
38
|
-
this.fingerprintIndex = 0;
|
|
39
|
-
this.ignoreFiles = new Set(params?.fileList);
|
|
40
|
-
|
|
41
|
-
const wfpPath = params.wfpPath;
|
|
42
|
-
|
|
43
|
-
if (!wfpPath) this.sendError('WFP path is not defined');
|
|
44
|
-
|
|
45
|
-
this.wfpStream = fs.createReadStream(wfpPath, { encoding: 'utf8' });
|
|
46
|
-
this.setStreamListeners();
|
|
47
|
-
|
|
48
|
-
return this.finishPromise;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public stop(): void {
|
|
52
|
-
this.continue = false;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public pause(): void {
|
|
56
|
-
this.sendLog('[ SCANNER ]: WFP Splitter paused...')
|
|
57
|
-
this.continue = false;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
public resume(): void {
|
|
61
|
-
this.sendLog('[ SCANNER ]: WFP Splitter resumed...')
|
|
62
|
-
this.continue = true;
|
|
63
|
-
this.sendFingerprints();
|
|
64
|
-
this.streamBufferFlush();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
private sendFingerprints() {
|
|
69
|
-
//The timer allows the main thread not to be blocked while sending wfps
|
|
70
|
-
if(this.timer === undefined) {
|
|
71
|
-
this.timer = setInterval(() => {
|
|
72
|
-
if(this.fingerprintIndex < this.fingerprints.length && this.continue) {
|
|
73
|
-
this.fingerprintPacker(this.fingerprints[this.fingerprintIndex]);
|
|
74
|
-
this.fingerprintIndex++;
|
|
75
|
-
} else {
|
|
76
|
-
this.stopSendFingerprints();
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
private stopSendFingerprints() {
|
|
85
|
-
clearInterval(this.timer);
|
|
86
|
-
this.timer = undefined;
|
|
87
|
-
if(this.fingerprintIndex === this.fingerprints.length){
|
|
88
|
-
this.finishWinnowing();
|
|
89
|
-
this.sendLog('[ SCANNER ]: WFP Splitter finished...');
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
private streamBufferFlush(): void {
|
|
94
|
-
|
|
95
|
-
let ignoreFirstChunkOfFingerprint = false;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
//Use a loop to make sure we read all currently available data
|
|
99
|
-
while (this.continue && null !== (this.chunkDataRead = this.wfpStream.read(1 * 1024 * 1024))) { // Read chunks of 1MB 1*1024*1024
|
|
100
|
-
|
|
101
|
-
/**** This part removes all the wfp that includes the paths inside this.ignoreFiles ****/
|
|
102
|
-
if (this.ignoreFiles.size > 0) {
|
|
103
|
-
|
|
104
|
-
// Removes fingerprints that are loose because the file=...... was removed in previous iteration
|
|
105
|
-
if (ignoreFirstChunkOfFingerprint) { //TODO: Test this scenario
|
|
106
|
-
//If there is no file= delete everything then
|
|
107
|
-
if (this.chunkDataRead.indexOf("file=") >= 0) {
|
|
108
|
-
this.chunkDataRead = this.chunkDataRead.substring(this.chunkDataRead.indexOf('file='));
|
|
109
|
-
ignoreFirstChunkOfFingerprint = false;
|
|
110
|
-
} else this.chunkDataRead = "";
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const rWfpPath = new RegExp(/^file=\w+,\d+,(?<path>.+)$/gm)
|
|
115
|
-
//Search for paths in the wfp and compares with the ignorefiles set
|
|
116
|
-
//When there is a match the matched fingerprint is deleted on the fly
|
|
117
|
-
let result;
|
|
118
|
-
while ((result = rWfpPath.exec(this.chunkDataRead)) !== null) {
|
|
119
|
-
if (this.ignoreFiles.has(result?.groups?.path)) {
|
|
120
|
-
const indexDeleteFrom = result.index
|
|
121
|
-
|
|
122
|
-
//TODO: Verify this condition
|
|
123
|
-
//If there is no next file= in the string, remove until end.
|
|
124
|
-
let indexDeleteTo = this.chunkDataRead.indexOf('file=', indexDeleteFrom + 1)
|
|
125
|
-
if (indexDeleteTo < 0) {
|
|
126
|
-
indexDeleteTo = this.chunkDataRead.length;
|
|
127
|
-
|
|
128
|
-
//After the deletion of a wfp there are no other file=, so then set ignoreFirstChunkOfFingerprint to true.
|
|
129
|
-
//In the next iteration, the next chunk of data will be fingerprints without a file=. So, this first part will be discarded.
|
|
130
|
-
ignoreFirstChunkOfFingerprint = true;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const first = this.chunkDataRead.substring(0, indexDeleteFrom);
|
|
134
|
-
const second = this.chunkDataRead.substring(indexDeleteTo, this.chunkDataRead.length);
|
|
135
|
-
this.chunkDataRead = first + second;
|
|
136
|
-
rWfpPath.lastIndex = 0; //Make sure we reset the state of the regex.
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
/**** This part removes all the wfp that includes the paths inside this.ignoreFiles ****/
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
/**** This part process a chunk of wfp and send the packages to the subscriber ****/
|
|
145
|
-
if(this.chunkDataRead.length){
|
|
146
|
-
|
|
147
|
-
// Extract the first portion of the chunk until the first file=
|
|
148
|
-
// Then append the chunk to the last fingerprint.
|
|
149
|
-
if (!this.chunkDataRead.startsWith('file=') ) {
|
|
150
|
-
const chunkOfData = this.chunkDataRead.substring(0, this.chunkDataRead.indexOf('file='));
|
|
151
|
-
this.fingerprints[this.fingerprints.length-1] += chunkOfData;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
this.fingerprints = [...this.fingerprints, ...this.splitFingerprints(this.chunkDataRead)];
|
|
155
|
-
this.sendFingerprints();
|
|
156
|
-
}
|
|
157
|
-
/**** This part process a chunk of wfp and send the packages to the subscriber ****/
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
private setStreamListeners() {
|
|
163
|
-
this.wfpStream.on('readable', () => {
|
|
164
|
-
this.streamBufferFlush();
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
this.wfpStream.on('end', () => {});
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
private splitFingerprints(chunkOfData:string): Array<string> {
|
|
171
|
-
const reg = /file=/g;
|
|
172
|
-
const blocksIndex = [...((chunkOfData).matchAll(reg))].map(x => x.index);
|
|
173
|
-
const fingerprints = [];
|
|
174
|
-
for (let i = 0; i < blocksIndex.length ; i++) {
|
|
175
|
-
const fingerprint = chunkOfData.substring(blocksIndex[i], blocksIndex[i + 1]);
|
|
176
|
-
fingerprints.push(fingerprint);
|
|
177
|
-
}
|
|
178
|
-
return fingerprints;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
package/src/sdk/tree/File.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { NodeType } from './Node';
|
|
2
|
-
import Node from './Node';
|
|
3
|
-
import { Filter } from './Filters/Filter';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export default class File extends Node {
|
|
7
|
-
constructor(name: string, path: string) {
|
|
8
|
-
super(name, path);
|
|
9
|
-
this.type = NodeType.FILE;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
public getNode(path: string): Node {
|
|
13
|
-
if (path === this.getPath()) return this;
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public getFiles(f: Filter): Array<string> {
|
|
18
|
-
if (!f || !f.evaluate(this)) return [];
|
|
19
|
-
return [this.getPath()];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Filter } from './Filter';
|
|
2
|
-
import Node, { NodeType } from '../Node';
|
|
3
|
-
import { DecompressionManager } from '../../Decompress/DecompressionManager';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
|
|
6
|
-
export class DecompressionFilter extends Filter {
|
|
7
|
-
|
|
8
|
-
private supportedFileExtension: Array<string>;
|
|
9
|
-
|
|
10
|
-
public constructor(filterName: string) {
|
|
11
|
-
super();
|
|
12
|
-
this.supportedFileExtension = new DecompressionManager().getSupportedFormats();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
//Returns true if you want the file
|
|
16
|
-
public evaluate(node: Node): boolean {
|
|
17
|
-
if(node.getType() == NodeType.FOLDER) return true;
|
|
18
|
-
if (this.supportedFileExtension.some(supportedFormat => node.getName().endsWith(supportedFormat))) return true;
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Filter } from './Filter';
|
|
2
|
-
import Node from '../Node'
|
|
3
|
-
import { FilterList } from '../../filters/filtering';
|
|
4
|
-
import {
|
|
5
|
-
defaultFilterForDependencies
|
|
6
|
-
} from '../../filters/DefaultFilterForDependencies';
|
|
7
|
-
|
|
8
|
-
export class DependencyFilter extends Filter {
|
|
9
|
-
|
|
10
|
-
private filter: FilterList;
|
|
11
|
-
|
|
12
|
-
public constructor(filterName: string) {
|
|
13
|
-
super();
|
|
14
|
-
this.filter = new FilterList(filterName);
|
|
15
|
-
this.filter.load(defaultFilterForDependencies as FilterList)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public evaluate(node: Node): boolean {
|
|
19
|
-
return this.filter.include(node.getPath());
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Filter } from './Filter';
|
|
2
|
-
import Node from '../Node'
|
|
3
|
-
import { FilterList } from '../../filters/filtering';
|
|
4
|
-
import {
|
|
5
|
-
defaultFilterForScanning
|
|
6
|
-
} from '../../filters/DefaultFilterForScanning';
|
|
7
|
-
|
|
8
|
-
export class ScanFilter extends Filter {
|
|
9
|
-
|
|
10
|
-
private filter: FilterList;
|
|
11
|
-
|
|
12
|
-
public constructor(filterName: string) {
|
|
13
|
-
super();
|
|
14
|
-
this.filter = new FilterList(filterName);
|
|
15
|
-
this.filter.load(defaultFilterForScanning as FilterList)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public evaluate(node: Node): boolean {
|
|
19
|
-
return this.filter.include(node.getPath());
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
}
|
package/src/sdk/tree/Folder.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { NodeType } from "./Node";
|
|
2
|
-
import Node from './Node';
|
|
3
|
-
import { Filter } from './Filters/Filter';
|
|
4
|
-
|
|
5
|
-
export default class Folder extends Node {
|
|
6
|
-
private children: Node[];
|
|
7
|
-
|
|
8
|
-
constructor(path: string, label: string) {
|
|
9
|
-
super(path, label);
|
|
10
|
-
this.type = NodeType.FOLDER;
|
|
11
|
-
this.children = [];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public addChild(node: Node): void {
|
|
15
|
-
this.children.push(node);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public getChildren(): Node[] {
|
|
19
|
-
return this.children;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public getNode(path: string): Node {
|
|
23
|
-
if (!this.checkMyPath(path)) return null;
|
|
24
|
-
if (path === this.getPath()) return this;
|
|
25
|
-
for (const child of this.children) {
|
|
26
|
-
const node = child.getNode(path);
|
|
27
|
-
if (node !== null) return node;
|
|
28
|
-
}
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Returns true only if my path is contained in the path (parameter)
|
|
33
|
-
private checkMyPath(path: string): boolean {
|
|
34
|
-
if (!path.includes(this.getPath())) return false;
|
|
35
|
-
// Only if first filter is passed.
|
|
36
|
-
const myPathExploded = this.getPath().split('/');
|
|
37
|
-
const pathExploded = path.split('/');
|
|
38
|
-
for (let i = 0; i < myPathExploded.length; i += 1) {
|
|
39
|
-
if (myPathExploded[i] !== pathExploded[i]) return false;
|
|
40
|
-
}
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
public getFiles(f?: Filter): Array<string> {
|
|
45
|
-
if (!f || !f.evaluate(this)) return [];
|
|
46
|
-
|
|
47
|
-
const files: Array<string> = [];
|
|
48
|
-
this.children.forEach((child) => {
|
|
49
|
-
files.push(...child.getFiles(f));
|
|
50
|
-
});
|
|
51
|
-
return files;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public removeChildren(){
|
|
55
|
-
this.children = [];
|
|
56
|
-
}
|
|
57
|
-
}
|
package/src/sdk/tree/Node.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { FilterList } from '../filters/filtering';
|
|
2
|
-
import { Filter } from './Filters/Filter';
|
|
3
|
-
|
|
4
|
-
export default abstract class Node {
|
|
5
|
-
protected type: NodeType;
|
|
6
|
-
|
|
7
|
-
protected path: string; // Relative path to the folder or file
|
|
8
|
-
|
|
9
|
-
protected label: string;
|
|
10
|
-
|
|
11
|
-
protected action: string;
|
|
12
|
-
|
|
13
|
-
constructor(path: string, label: string) {
|
|
14
|
-
this.path = path;
|
|
15
|
-
this.label = label;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public abstract getNode(path: string): Node;
|
|
19
|
-
|
|
20
|
-
public abstract getFiles(f: Filter): Array<string>;
|
|
21
|
-
|
|
22
|
-
public getName(): string {
|
|
23
|
-
return this.label;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public getPath(): string {
|
|
27
|
-
return this.path;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public getType(): NodeType {
|
|
31
|
-
return this.type;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export enum NodeType {
|
|
37
|
-
FOLDER = 'FOLDER',
|
|
38
|
-
FILE = 'FILE',
|
|
39
|
-
};
|
package/src/sdk/tree/Tree.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import pathLib from 'path';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { NodeType } from './Node';
|
|
6
|
-
import Node from './Node';
|
|
7
|
-
import File from './File';
|
|
8
|
-
import Folder from './Folder';
|
|
9
|
-
import { FilterList } from '../filters/filtering';
|
|
10
|
-
import { Filter } from './Filters/Filter';
|
|
11
|
-
|
|
12
|
-
export class Tree {
|
|
13
|
-
private rootFolder: Folder;
|
|
14
|
-
|
|
15
|
-
private rootName: string;
|
|
16
|
-
|
|
17
|
-
private rootPath: string;
|
|
18
|
-
|
|
19
|
-
private filter: FilterList;
|
|
20
|
-
|
|
21
|
-
constructor(path: string) {
|
|
22
|
-
const pathParts = path.split(pathLib.sep);
|
|
23
|
-
this.rootName = pathLib.basename(path);
|
|
24
|
-
this.rootPath = path;
|
|
25
|
-
this.rootFolder = new Folder('/', this.rootName);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public build(): Node {
|
|
29
|
-
this.rootFolder.removeChildren();
|
|
30
|
-
this.buildRec(this.rootPath, this.rootFolder);
|
|
31
|
-
return this.rootFolder;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
private buildRec(path: string, root: Folder): Node {
|
|
35
|
-
const dirEntries = fs
|
|
36
|
-
.readdirSync(path, { withFileTypes: true }) // Returns a list of files and folders
|
|
37
|
-
.sort(this.dirFirstFileAfter)
|
|
38
|
-
.filter((dirent: any) => !dirent.isSymbolicLink());
|
|
39
|
-
|
|
40
|
-
for (const dirEntry of dirEntries) {
|
|
41
|
-
const fullPath = `${path}/${dirEntry.name}`;
|
|
42
|
-
const relativePath = fullPath.replace(this.rootPath, '');
|
|
43
|
-
if (dirEntry.isDirectory()) {
|
|
44
|
-
const f: Folder = new Folder(fullPath, dirEntry.name);
|
|
45
|
-
const subTree = this.buildRec(`${path}/${dirEntry.name}`, f);
|
|
46
|
-
root.addChild(subTree);
|
|
47
|
-
} else root.addChild(new File(fullPath, dirEntry.name));
|
|
48
|
-
}
|
|
49
|
-
return root;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// This is a sorter that will sort folders before files in alphabetical order.
|
|
53
|
-
private dirFirstFileAfter(a: any, b: any) {
|
|
54
|
-
if (!a.isDirectory() && b.isDirectory()) return 1;
|
|
55
|
-
if (a.isDirectory() && !b.isDirectory()) return -1;
|
|
56
|
-
return 0;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
public loadTree(data: any): void {
|
|
60
|
-
this.rootFolder = this.deserialize(data) as Folder;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
private deserialize(data: any): Node {
|
|
64
|
-
if (data.type === NodeType.FILE) {
|
|
65
|
-
return Object.assign(Object.create(File.prototype), data);
|
|
66
|
-
}
|
|
67
|
-
const children = data.children.map((child: any) => this.deserialize(child));
|
|
68
|
-
return Object.assign(Object.create(Folder.prototype), { ...data, children });
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public getRootFolder(): Folder {
|
|
72
|
-
return this.rootFolder;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
public getRootPath(): string {
|
|
76
|
-
return this.rootPath;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public getFileList(f?: Filter): Array<string> {
|
|
80
|
-
return this.rootFolder.getFiles(f);
|
|
81
|
-
}
|
|
82
|
-
}
|
package/tests/scanoss.sh
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
# Print help info
|
|
5
|
-
#
|
|
6
|
-
help() {
|
|
7
|
-
echo "Usage: $0 [-h] -w winnowing.wfp -r result.json
|
|
8
|
-
[-r file to result.json]
|
|
9
|
-
[-w file to winnowing]"
|
|
10
|
-
exit 2
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
cmd_compare_wfp_result() {
|
|
14
|
-
result_json_path=$1
|
|
15
|
-
winnowing_path=$2
|
|
16
|
-
if [ ! -e "$result_json_path" ] || [ ! -e "$winnowing_path" ]; then
|
|
17
|
-
echo "Error: Please, specify a valid path"
|
|
18
|
-
exit 1
|
|
19
|
-
fi
|
|
20
|
-
|
|
21
|
-
diff <(sed -n -E 's/file=\w+,[[:digit:]]+,//p' "$winnowing_path" | sort) <(jq -r '.scanner | keys | .[]' "$result_json_path" | sort)
|
|
22
|
-
|
|
23
|
-
exit 1
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
#
|
|
28
|
-
# Parse command options and take action
|
|
29
|
-
#
|
|
30
|
-
force=false
|
|
31
|
-
while getopts ":r:w:,h" o; do
|
|
32
|
-
case "${o}" in
|
|
33
|
-
r)
|
|
34
|
-
r=${OPTARG}
|
|
35
|
-
;;
|
|
36
|
-
w)
|
|
37
|
-
w=${OPTARG}
|
|
38
|
-
;;
|
|
39
|
-
h)
|
|
40
|
-
help
|
|
41
|
-
;;
|
|
42
|
-
*)
|
|
43
|
-
echo "Unknown option: $o"
|
|
44
|
-
help
|
|
45
|
-
;;
|
|
46
|
-
esac
|
|
47
|
-
done
|
|
48
|
-
shift $((OPTIND - 1))
|
|
49
|
-
|
|
50
|
-
if [ -z "${r}" ] || [ -z "${w}" ]; then
|
|
51
|
-
echo "Please specify a result json and a winnowing file"
|
|
52
|
-
help
|
|
53
|
-
fi
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
cmd_compare_wfp_result "$r" "$w"
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
import { ComponentDataProvider } from '../../../../src/sdk/DataLayer/DataProviders/ComponentDataProvider';
|
|
5
|
-
import { ComponentDataLayer } from '../../../../src/sdk/DataLayer/DataLayerTypes';
|
|
6
|
-
|
|
7
|
-
const deepEqualInAnyOrder = require('deep-equal-in-any-order');
|
|
8
|
-
const chai = require('chai');
|
|
9
|
-
chai.use(deepEqualInAnyOrder);
|
|
10
|
-
const { expect } = chai;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
describe('Suit test for DataProvider', () => {
|
|
14
|
-
|
|
15
|
-
it('Test ComponentDataLayer', function () {
|
|
16
|
-
const result = JSON.parse(fs.readFileSync(path.join(__dirname, '/samples/results-with-dep.json'), 'utf-8'));
|
|
17
|
-
const componentDataProvider = new ComponentDataProvider(result.scanner, result.dependencies);
|
|
18
|
-
const componentData = componentDataProvider.getData();
|
|
19
|
-
|
|
20
|
-
const expectedOutput: ComponentDataLayer[] = [
|
|
21
|
-
|
|
22
|
-
//First component
|
|
23
|
-
{
|
|
24
|
-
key : "pkg:npm/url-parse",
|
|
25
|
-
purls: [
|
|
26
|
-
"pkg:npm/url-parse",
|
|
27
|
-
"pkg:github/unshiftio/url-parse",
|
|
28
|
-
"pkg:deb/debian/node-url-parse",
|
|
29
|
-
"pkg:maven/org.webjars.bowergithub.unshiftio/url-parse"
|
|
30
|
-
],
|
|
31
|
-
name: "url-parse",
|
|
32
|
-
vendor: "Arnout Kazemier",
|
|
33
|
-
url: "https://www.npmjs.com/package/url-parse",
|
|
34
|
-
versions: [
|
|
35
|
-
{
|
|
36
|
-
version: "1.5.10",
|
|
37
|
-
licenses: ["MIT"],
|
|
38
|
-
copyrights: [
|
|
39
|
-
{
|
|
40
|
-
name: "Copyright (c) 2015 Unshift.io; Arnout Kazemier; the Contributors.",
|
|
41
|
-
source: "license_file"
|
|
42
|
-
}
|
|
43
|
-
],
|
|
44
|
-
cryptography: null,
|
|
45
|
-
quality: null
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
health: null,
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
//Second component with multiple versions detected
|
|
52
|
-
{
|
|
53
|
-
key: "pkg:github/unshiftio/url-parse",
|
|
54
|
-
purls: [
|
|
55
|
-
"pkg:github/unshiftio/url-parse",
|
|
56
|
-
"pkg:deb/debian/node-url-parse",
|
|
57
|
-
"pkg:maven/org.webjars.bowergithub.unshiftio/url-parse",
|
|
58
|
-
"pkg:npm/url-parse"
|
|
59
|
-
],
|
|
60
|
-
name: "url-parse",
|
|
61
|
-
vendor: "unshiftio",
|
|
62
|
-
url: "https://github.com/unshiftio/url-parse",
|
|
63
|
-
versions: [
|
|
64
|
-
{
|
|
65
|
-
version: "1.5.3",
|
|
66
|
-
licenses: ["MIT"],
|
|
67
|
-
copyrights: [
|
|
68
|
-
{
|
|
69
|
-
name: "Copyright (c) 2015 Unshift.io; Arnout Kazemier; the Contributors.",
|
|
70
|
-
source: "license_file"
|
|
71
|
-
}
|
|
72
|
-
],
|
|
73
|
-
cryptography: null,
|
|
74
|
-
quality: {
|
|
75
|
-
sum: 4,
|
|
76
|
-
scoreAvg: 4,
|
|
77
|
-
count: 1
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
version: "1.5.0",
|
|
82
|
-
licenses: ["MIT"],
|
|
83
|
-
copyrights: [
|
|
84
|
-
{
|
|
85
|
-
name: "Copyright (c) 2015 Unshift.io; Arnout Kazemier; the Contributors.",
|
|
86
|
-
source: "license_file"
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
cryptography: null,
|
|
90
|
-
quality: {
|
|
91
|
-
sum: 4,
|
|
92
|
-
scoreAvg: 4,
|
|
93
|
-
count: 1
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
version: "1.5.10",
|
|
98
|
-
licenses: ["MIT"],
|
|
99
|
-
copyrights: [
|
|
100
|
-
{
|
|
101
|
-
name: "Copyright (c) 2015 Unshift.io; Arnout Kazemier; the Contributors.",
|
|
102
|
-
source: "license_file"
|
|
103
|
-
}
|
|
104
|
-
],
|
|
105
|
-
cryptography: null,
|
|
106
|
-
quality: null
|
|
107
|
-
}
|
|
108
|
-
],
|
|
109
|
-
health: null,
|
|
110
|
-
},{
|
|
111
|
-
key: "pkg:npm/querystringify",
|
|
112
|
-
purls: ["pkg:npm/querystringify"],
|
|
113
|
-
name: "querystringify",
|
|
114
|
-
url: null,
|
|
115
|
-
versions: [{
|
|
116
|
-
version: "2.2.0",
|
|
117
|
-
licenses: ["MIT"],
|
|
118
|
-
copyrights: null,
|
|
119
|
-
cryptography: null,
|
|
120
|
-
quality: null
|
|
121
|
-
}],
|
|
122
|
-
vendor: null,
|
|
123
|
-
health: null,
|
|
124
|
-
},{
|
|
125
|
-
key: "pkg:npm/requires-port",
|
|
126
|
-
purls: ["pkg:npm/requires-port"],
|
|
127
|
-
name: "requires-port",
|
|
128
|
-
url: null,
|
|
129
|
-
versions: [{
|
|
130
|
-
version: "1.0.0",
|
|
131
|
-
licenses: ["MIT"],
|
|
132
|
-
copyrights: null,
|
|
133
|
-
cryptography: null,
|
|
134
|
-
quality: null
|
|
135
|
-
}],
|
|
136
|
-
vendor: null,
|
|
137
|
-
health: null,
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
key: "pkg:npm/assume",
|
|
141
|
-
purls: ["pkg:npm/assume"],
|
|
142
|
-
name: "assume",
|
|
143
|
-
url: null,
|
|
144
|
-
versions: [{
|
|
145
|
-
version: "2.3.0",
|
|
146
|
-
licenses: ["MIT"],
|
|
147
|
-
copyrights: null,
|
|
148
|
-
cryptography: null,
|
|
149
|
-
quality: null
|
|
150
|
-
}],
|
|
151
|
-
health: null,
|
|
152
|
-
vendor: null,
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
key: "pkg:npm/browserify",
|
|
156
|
-
purls: ["pkg:npm/browserify"],
|
|
157
|
-
name: "browserify",
|
|
158
|
-
url: null,
|
|
159
|
-
versions: [{
|
|
160
|
-
version: "17.0.0",
|
|
161
|
-
licenses: ["MIT"],
|
|
162
|
-
copyrights: null,
|
|
163
|
-
cryptography: null,
|
|
164
|
-
quality: null
|
|
165
|
-
}],
|
|
166
|
-
vendor: null,
|
|
167
|
-
health: null,
|
|
168
|
-
}
|
|
169
|
-
];
|
|
170
|
-
|
|
171
|
-
expect(componentData.component).to.deep.equalInAnyOrder(expectedOutput);
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
|