@scanoss_test/sdk 2.0.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/bin/.gitkeep +0 -0
- package/dist/index.d.mts +444 -0
- package/dist/index.d.ts +444 -0
- package/dist/index.js +320 -0
- package/dist/index.mjs +298 -0
- package/package.json +67 -0
- package/src/binary.ts +57 -0
- package/src/client.ts +327 -0
- package/src/errors.ts +22 -0
- package/src/gen/.gitkeep +0 -0
- package/src/gen/scanoss/v1/commands_pb.ts +537 -0
- package/src/gen/scanoss/v1/enums_pb.ts +84 -0
- package/src/gen/scanoss/v1/types_pb.ts +191 -0
- package/src/index.ts +9 -0
- package/src/types.ts +98 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// @generated by protoc-gen-es v2.10.2 with parameter "target=ts"
|
|
2
|
+
// @generated from file scanoss/v1/types.proto (package scanoss.v1, syntax proto3)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
6
|
+
import { fileDesc, messageDesc } from "@bufbuild/protobuf/codegenv2";
|
|
7
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Describes the file scanoss/v1/types.proto.
|
|
11
|
+
*/
|
|
12
|
+
export const file_scanoss_v1_types: GenFile = /*@__PURE__*/
|
|
13
|
+
fileDesc("ChZzY2Fub3NzL3YxL3R5cGVzLnByb3RvEgpzY2Fub3NzLnYxIkYKCEZpbGVJbmZvEgwKBHBhdGgYASABKAkSDAoEc2l6ZRgCIAEoAxIRCglleHRlbnNpb24YAyABKAkSCwoDbWQ1GAQgASgJItsBCgVNYXRjaBIKCgJpZBgBIAEoCRIRCgljb21wb25lbnQYAiABKAkSDgoGdmVuZG9yGAMgASgJEg8KB3ZlcnNpb24YBCABKAkSFgoObGF0ZXN0X3ZlcnNpb24YBSABKAkSDwoHbGljZW5zZRgGIAEoCRIMCgRwdXJsGAcgASgJEgsKA3VybBgIIAEoCRIMCgRmaWxlGAkgASgJEg8KB21hdGNoZWQYCiABKAkSDQoFbGluZXMYCyABKAkSEQoJb3NzX2xpbmVzGAwgASgJEg0KBXNjb3JlGA0gASgCIksKCkZpbGVSZXN1bHQSDAoEcGF0aBgBIAEoCRILCgNtZDUYAiABKAkSIgoHbWF0Y2hlcxgDIAMoCzIRLnNjYW5vc3MudjEuTWF0Y2giNwoFRXJyb3ISDAoEY29kZRgBIAEoBRIPCgdtZXNzYWdlGAIgASgJEg8KB2RldGFpbHMYAyABKAlCTQoPY29tLnNjYW5vc3MuZ2VuUAFaOGdpdGh1Yi5jb20vc2Nhbm9zcy9zY2Fub3NzL2NvcmUvZ2VuL3NjYW5vc3MvdjE7c2Nhbm9zc3YxYgZwcm90bzM");
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Information about a file
|
|
17
|
+
*
|
|
18
|
+
* @generated from message scanoss.v1.FileInfo
|
|
19
|
+
*/
|
|
20
|
+
export type FileInfo = Message<"scanoss.v1.FileInfo"> & {
|
|
21
|
+
/**
|
|
22
|
+
* @generated from field: string path = 1;
|
|
23
|
+
*/
|
|
24
|
+
path: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @generated from field: int64 size = 2;
|
|
28
|
+
*/
|
|
29
|
+
size: bigint;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @generated from field: string extension = 3;
|
|
33
|
+
*/
|
|
34
|
+
extension: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @generated from field: string md5 = 4;
|
|
38
|
+
*/
|
|
39
|
+
md5: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Describes the message scanoss.v1.FileInfo.
|
|
44
|
+
* Use `create(FileInfoSchema)` to create a new message.
|
|
45
|
+
*/
|
|
46
|
+
export const FileInfoSchema: GenMessage<FileInfo> = /*@__PURE__*/
|
|
47
|
+
messageDesc(file_scanoss_v1_types, 0);
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A match found during scanning
|
|
51
|
+
*
|
|
52
|
+
* @generated from message scanoss.v1.Match
|
|
53
|
+
*/
|
|
54
|
+
export type Match = Message<"scanoss.v1.Match"> & {
|
|
55
|
+
/**
|
|
56
|
+
* @generated from field: string id = 1;
|
|
57
|
+
*/
|
|
58
|
+
id: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @generated from field: string component = 2;
|
|
62
|
+
*/
|
|
63
|
+
component: string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @generated from field: string vendor = 3;
|
|
67
|
+
*/
|
|
68
|
+
vendor: string;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @generated from field: string version = 4;
|
|
72
|
+
*/
|
|
73
|
+
version: string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @generated from field: string latest_version = 5;
|
|
77
|
+
*/
|
|
78
|
+
latestVersion: string;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @generated from field: string license = 6;
|
|
82
|
+
*/
|
|
83
|
+
license: string;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @generated from field: string purl = 7;
|
|
87
|
+
*/
|
|
88
|
+
purl: string;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @generated from field: string url = 8;
|
|
92
|
+
*/
|
|
93
|
+
url: string;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @generated from field: string file = 9;
|
|
97
|
+
*/
|
|
98
|
+
file: string;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Match percentage (e.g., "100%")
|
|
102
|
+
*
|
|
103
|
+
* @generated from field: string matched = 10;
|
|
104
|
+
*/
|
|
105
|
+
matched: string;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Lines in scanned file (e.g., "1-50")
|
|
109
|
+
*
|
|
110
|
+
* @generated from field: string lines = 11;
|
|
111
|
+
*/
|
|
112
|
+
lines: string;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Lines in matched OSS (e.g., "1-50")
|
|
116
|
+
*
|
|
117
|
+
* @generated from field: string oss_lines = 12;
|
|
118
|
+
*/
|
|
119
|
+
ossLines: string;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @generated from field: float score = 13;
|
|
123
|
+
*/
|
|
124
|
+
score: number;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Describes the message scanoss.v1.Match.
|
|
129
|
+
* Use `create(MatchSchema)` to create a new message.
|
|
130
|
+
*/
|
|
131
|
+
export const MatchSchema: GenMessage<Match> = /*@__PURE__*/
|
|
132
|
+
messageDesc(file_scanoss_v1_types, 1);
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Result for a single file scan
|
|
136
|
+
*
|
|
137
|
+
* @generated from message scanoss.v1.FileResult
|
|
138
|
+
*/
|
|
139
|
+
export type FileResult = Message<"scanoss.v1.FileResult"> & {
|
|
140
|
+
/**
|
|
141
|
+
* @generated from field: string path = 1;
|
|
142
|
+
*/
|
|
143
|
+
path: string;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @generated from field: string md5 = 2;
|
|
147
|
+
*/
|
|
148
|
+
md5: string;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @generated from field: repeated scanoss.v1.Match matches = 3;
|
|
152
|
+
*/
|
|
153
|
+
matches: Match[];
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Describes the message scanoss.v1.FileResult.
|
|
158
|
+
* Use `create(FileResultSchema)` to create a new message.
|
|
159
|
+
*/
|
|
160
|
+
export const FileResultSchema: GenMessage<FileResult> = /*@__PURE__*/
|
|
161
|
+
messageDesc(file_scanoss_v1_types, 2);
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Error information
|
|
165
|
+
*
|
|
166
|
+
* @generated from message scanoss.v1.Error
|
|
167
|
+
*/
|
|
168
|
+
export type Error = Message<"scanoss.v1.Error"> & {
|
|
169
|
+
/**
|
|
170
|
+
* @generated from field: int32 code = 1;
|
|
171
|
+
*/
|
|
172
|
+
code: number;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @generated from field: string message = 2;
|
|
176
|
+
*/
|
|
177
|
+
message: string;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* @generated from field: string details = 3;
|
|
181
|
+
*/
|
|
182
|
+
details: string;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Describes the message scanoss.v1.Error.
|
|
187
|
+
* Use `create(ErrorSchema)` to create a new message.
|
|
188
|
+
*/
|
|
189
|
+
export const ErrorSchema: GenMessage<Error> = /*@__PURE__*/
|
|
190
|
+
messageDesc(file_scanoss_v1_types, 3);
|
|
191
|
+
|
package/src/index.ts
ADDED
package/src/types.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for SCANOSS SDK
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/** Output format for scan results */
|
|
6
|
+
export type OutputFormat = 'json' | 'spdx' | 'cyclonedx' | 'csv' | 'wfp';
|
|
7
|
+
|
|
8
|
+
/** Type of scan to perform */
|
|
9
|
+
export type ScanType = 'identify' | 'blacklist';
|
|
10
|
+
|
|
11
|
+
/** File information */
|
|
12
|
+
export interface FileInfo {
|
|
13
|
+
path: string;
|
|
14
|
+
size: number;
|
|
15
|
+
extension: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Match information for a component */
|
|
19
|
+
export interface Match {
|
|
20
|
+
component: string;
|
|
21
|
+
version: string;
|
|
22
|
+
license: string;
|
|
23
|
+
purl: string;
|
|
24
|
+
score: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Result for a single file */
|
|
28
|
+
export interface FileResult {
|
|
29
|
+
path: string;
|
|
30
|
+
matches: Match[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Scan command parameters */
|
|
34
|
+
export interface ScanParams {
|
|
35
|
+
path: string;
|
|
36
|
+
format?: OutputFormat;
|
|
37
|
+
scanType?: ScanType;
|
|
38
|
+
include?: string[];
|
|
39
|
+
exclude?: string[];
|
|
40
|
+
apiUrl?: string;
|
|
41
|
+
apiKey?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Scan result */
|
|
45
|
+
export interface ScanResult {
|
|
46
|
+
files: FileResult[];
|
|
47
|
+
totalFiles: number;
|
|
48
|
+
filesWithMatches: number;
|
|
49
|
+
totalMatches: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Filter files command parameters */
|
|
53
|
+
export interface FilterFilesParams {
|
|
54
|
+
path: string;
|
|
55
|
+
include?: string[];
|
|
56
|
+
exclude?: string[];
|
|
57
|
+
skipHidden?: boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Filter files result */
|
|
61
|
+
export interface FilterFilesResult {
|
|
62
|
+
files: FileInfo[];
|
|
63
|
+
totalCount: number;
|
|
64
|
+
totalBytes: number;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Fingerprint command parameters */
|
|
68
|
+
export interface FingerprintParams {
|
|
69
|
+
path: string;
|
|
70
|
+
include?: string[];
|
|
71
|
+
exclude?: string[];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Fingerprint result */
|
|
75
|
+
export interface FingerprintResult {
|
|
76
|
+
wfp: string;
|
|
77
|
+
fileCount: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Generate SBOM command parameters */
|
|
81
|
+
export interface GenerateSbomParams {
|
|
82
|
+
path: string;
|
|
83
|
+
format?: 'spdx' | 'cyclonedx';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Generate SBOM result */
|
|
87
|
+
export interface GenerateSbomResult {
|
|
88
|
+
sbom: string;
|
|
89
|
+
format: string;
|
|
90
|
+
componentCount: number;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Version information */
|
|
94
|
+
export interface VersionResult {
|
|
95
|
+
version: string;
|
|
96
|
+
commit: string;
|
|
97
|
+
buildDate: string;
|
|
98
|
+
}
|