@iglesys/techvulns-proto 0.0.3 → 0.0.4

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.
@@ -0,0 +1,547 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.8
4
+ // protoc v3.21.12
5
+ // source: techvulns/v1/tech.proto
6
+
7
+ /* eslint-disable */
8
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
9
+ import {
10
+ type CallOptions,
11
+ type ChannelCredentials,
12
+ Client,
13
+ type ClientOptions,
14
+ type ClientUnaryCall,
15
+ type handleUnaryCall,
16
+ makeGenericClientConstructor,
17
+ type Metadata,
18
+ type ServiceError,
19
+ type UntypedServiceImplementation,
20
+ } from "@grpc/grpc-js";
21
+
22
+ export const protobufPackage = "techvulns.v1";
23
+
24
+ export interface AnalyzeRequest {
25
+ target: string;
26
+ }
27
+
28
+ export interface AnalyzeResponse {
29
+ technologies: Technology[];
30
+ }
31
+
32
+ export interface Technology {
33
+ slug: string;
34
+ name: string;
35
+ description: string;
36
+ confidence: number;
37
+ version: string;
38
+ icon: string;
39
+ website: string;
40
+ cpe: string;
41
+ category: Technology_Category | undefined;
42
+ rootPath: boolean;
43
+ }
44
+
45
+ export interface Technology_Category {
46
+ id: number;
47
+ slug: string;
48
+ name: string;
49
+ }
50
+
51
+ function createBaseAnalyzeRequest(): AnalyzeRequest {
52
+ return { target: "" };
53
+ }
54
+
55
+ export const AnalyzeRequest: MessageFns<AnalyzeRequest> = {
56
+ encode(message: AnalyzeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
57
+ if (message.target !== "") {
58
+ writer.uint32(10).string(message.target);
59
+ }
60
+ return writer;
61
+ },
62
+
63
+ decode(input: BinaryReader | Uint8Array, length?: number): AnalyzeRequest {
64
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
65
+ const end = length === undefined ? reader.len : reader.pos + length;
66
+ const message = createBaseAnalyzeRequest();
67
+ while (reader.pos < end) {
68
+ const tag = reader.uint32();
69
+ switch (tag >>> 3) {
70
+ case 1: {
71
+ if (tag !== 10) {
72
+ break;
73
+ }
74
+
75
+ message.target = reader.string();
76
+ continue;
77
+ }
78
+ }
79
+ if ((tag & 7) === 4 || tag === 0) {
80
+ break;
81
+ }
82
+ reader.skip(tag & 7);
83
+ }
84
+ return message;
85
+ },
86
+
87
+ fromJSON(object: any): AnalyzeRequest {
88
+ return { target: isSet(object.target) ? globalThis.String(object.target) : "" };
89
+ },
90
+
91
+ toJSON(message: AnalyzeRequest): unknown {
92
+ const obj: any = {};
93
+ if (message.target !== "") {
94
+ obj.target = message.target;
95
+ }
96
+ return obj;
97
+ },
98
+
99
+ create(base?: DeepPartial<AnalyzeRequest>): AnalyzeRequest {
100
+ return AnalyzeRequest.fromPartial(base ?? {});
101
+ },
102
+ fromPartial(object: DeepPartial<AnalyzeRequest>): AnalyzeRequest {
103
+ const message = createBaseAnalyzeRequest();
104
+ message.target = object.target ?? "";
105
+ return message;
106
+ },
107
+ };
108
+
109
+ function createBaseAnalyzeResponse(): AnalyzeResponse {
110
+ return { technologies: [] };
111
+ }
112
+
113
+ export const AnalyzeResponse: MessageFns<AnalyzeResponse> = {
114
+ encode(message: AnalyzeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
115
+ for (const v of message.technologies) {
116
+ Technology.encode(v!, writer.uint32(10).fork()).join();
117
+ }
118
+ return writer;
119
+ },
120
+
121
+ decode(input: BinaryReader | Uint8Array, length?: number): AnalyzeResponse {
122
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
123
+ const end = length === undefined ? reader.len : reader.pos + length;
124
+ const message = createBaseAnalyzeResponse();
125
+ while (reader.pos < end) {
126
+ const tag = reader.uint32();
127
+ switch (tag >>> 3) {
128
+ case 1: {
129
+ if (tag !== 10) {
130
+ break;
131
+ }
132
+
133
+ message.technologies.push(Technology.decode(reader, reader.uint32()));
134
+ continue;
135
+ }
136
+ }
137
+ if ((tag & 7) === 4 || tag === 0) {
138
+ break;
139
+ }
140
+ reader.skip(tag & 7);
141
+ }
142
+ return message;
143
+ },
144
+
145
+ fromJSON(object: any): AnalyzeResponse {
146
+ return {
147
+ technologies: globalThis.Array.isArray(object?.technologies)
148
+ ? object.technologies.map((e: any) => Technology.fromJSON(e))
149
+ : [],
150
+ };
151
+ },
152
+
153
+ toJSON(message: AnalyzeResponse): unknown {
154
+ const obj: any = {};
155
+ if (message.technologies?.length) {
156
+ obj.technologies = message.technologies.map((e) => Technology.toJSON(e));
157
+ }
158
+ return obj;
159
+ },
160
+
161
+ create(base?: DeepPartial<AnalyzeResponse>): AnalyzeResponse {
162
+ return AnalyzeResponse.fromPartial(base ?? {});
163
+ },
164
+ fromPartial(object: DeepPartial<AnalyzeResponse>): AnalyzeResponse {
165
+ const message = createBaseAnalyzeResponse();
166
+ message.technologies = object.technologies?.map((e) => Technology.fromPartial(e)) || [];
167
+ return message;
168
+ },
169
+ };
170
+
171
+ function createBaseTechnology(): Technology {
172
+ return {
173
+ slug: "",
174
+ name: "",
175
+ description: "",
176
+ confidence: 0,
177
+ version: "",
178
+ icon: "",
179
+ website: "",
180
+ cpe: "",
181
+ category: undefined,
182
+ rootPath: false,
183
+ };
184
+ }
185
+
186
+ export const Technology: MessageFns<Technology> = {
187
+ encode(message: Technology, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
188
+ if (message.slug !== "") {
189
+ writer.uint32(10).string(message.slug);
190
+ }
191
+ if (message.name !== "") {
192
+ writer.uint32(18).string(message.name);
193
+ }
194
+ if (message.description !== "") {
195
+ writer.uint32(26).string(message.description);
196
+ }
197
+ if (message.confidence !== 0) {
198
+ writer.uint32(32).int32(message.confidence);
199
+ }
200
+ if (message.version !== "") {
201
+ writer.uint32(42).string(message.version);
202
+ }
203
+ if (message.icon !== "") {
204
+ writer.uint32(50).string(message.icon);
205
+ }
206
+ if (message.website !== "") {
207
+ writer.uint32(58).string(message.website);
208
+ }
209
+ if (message.cpe !== "") {
210
+ writer.uint32(66).string(message.cpe);
211
+ }
212
+ if (message.category !== undefined) {
213
+ Technology_Category.encode(message.category, writer.uint32(74).fork()).join();
214
+ }
215
+ if (message.rootPath !== false) {
216
+ writer.uint32(80).bool(message.rootPath);
217
+ }
218
+ return writer;
219
+ },
220
+
221
+ decode(input: BinaryReader | Uint8Array, length?: number): Technology {
222
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
223
+ const end = length === undefined ? reader.len : reader.pos + length;
224
+ const message = createBaseTechnology();
225
+ while (reader.pos < end) {
226
+ const tag = reader.uint32();
227
+ switch (tag >>> 3) {
228
+ case 1: {
229
+ if (tag !== 10) {
230
+ break;
231
+ }
232
+
233
+ message.slug = reader.string();
234
+ continue;
235
+ }
236
+ case 2: {
237
+ if (tag !== 18) {
238
+ break;
239
+ }
240
+
241
+ message.name = reader.string();
242
+ continue;
243
+ }
244
+ case 3: {
245
+ if (tag !== 26) {
246
+ break;
247
+ }
248
+
249
+ message.description = reader.string();
250
+ continue;
251
+ }
252
+ case 4: {
253
+ if (tag !== 32) {
254
+ break;
255
+ }
256
+
257
+ message.confidence = reader.int32();
258
+ continue;
259
+ }
260
+ case 5: {
261
+ if (tag !== 42) {
262
+ break;
263
+ }
264
+
265
+ message.version = reader.string();
266
+ continue;
267
+ }
268
+ case 6: {
269
+ if (tag !== 50) {
270
+ break;
271
+ }
272
+
273
+ message.icon = reader.string();
274
+ continue;
275
+ }
276
+ case 7: {
277
+ if (tag !== 58) {
278
+ break;
279
+ }
280
+
281
+ message.website = reader.string();
282
+ continue;
283
+ }
284
+ case 8: {
285
+ if (tag !== 66) {
286
+ break;
287
+ }
288
+
289
+ message.cpe = reader.string();
290
+ continue;
291
+ }
292
+ case 9: {
293
+ if (tag !== 74) {
294
+ break;
295
+ }
296
+
297
+ message.category = Technology_Category.decode(reader, reader.uint32());
298
+ continue;
299
+ }
300
+ case 10: {
301
+ if (tag !== 80) {
302
+ break;
303
+ }
304
+
305
+ message.rootPath = reader.bool();
306
+ continue;
307
+ }
308
+ }
309
+ if ((tag & 7) === 4 || tag === 0) {
310
+ break;
311
+ }
312
+ reader.skip(tag & 7);
313
+ }
314
+ return message;
315
+ },
316
+
317
+ fromJSON(object: any): Technology {
318
+ return {
319
+ slug: isSet(object.slug) ? globalThis.String(object.slug) : "",
320
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
321
+ description: isSet(object.description) ? globalThis.String(object.description) : "",
322
+ confidence: isSet(object.confidence) ? globalThis.Number(object.confidence) : 0,
323
+ version: isSet(object.version) ? globalThis.String(object.version) : "",
324
+ icon: isSet(object.icon) ? globalThis.String(object.icon) : "",
325
+ website: isSet(object.website) ? globalThis.String(object.website) : "",
326
+ cpe: isSet(object.cpe) ? globalThis.String(object.cpe) : "",
327
+ category: isSet(object.category) ? Technology_Category.fromJSON(object.category) : undefined,
328
+ rootPath: isSet(object.rootPath)
329
+ ? globalThis.Boolean(object.rootPath)
330
+ : isSet(object.root_path)
331
+ ? globalThis.Boolean(object.root_path)
332
+ : false,
333
+ };
334
+ },
335
+
336
+ toJSON(message: Technology): unknown {
337
+ const obj: any = {};
338
+ if (message.slug !== "") {
339
+ obj.slug = message.slug;
340
+ }
341
+ if (message.name !== "") {
342
+ obj.name = message.name;
343
+ }
344
+ if (message.description !== "") {
345
+ obj.description = message.description;
346
+ }
347
+ if (message.confidence !== 0) {
348
+ obj.confidence = Math.round(message.confidence);
349
+ }
350
+ if (message.version !== "") {
351
+ obj.version = message.version;
352
+ }
353
+ if (message.icon !== "") {
354
+ obj.icon = message.icon;
355
+ }
356
+ if (message.website !== "") {
357
+ obj.website = message.website;
358
+ }
359
+ if (message.cpe !== "") {
360
+ obj.cpe = message.cpe;
361
+ }
362
+ if (message.category !== undefined) {
363
+ obj.category = Technology_Category.toJSON(message.category);
364
+ }
365
+ if (message.rootPath !== false) {
366
+ obj.rootPath = message.rootPath;
367
+ }
368
+ return obj;
369
+ },
370
+
371
+ create(base?: DeepPartial<Technology>): Technology {
372
+ return Technology.fromPartial(base ?? {});
373
+ },
374
+ fromPartial(object: DeepPartial<Technology>): Technology {
375
+ const message = createBaseTechnology();
376
+ message.slug = object.slug ?? "";
377
+ message.name = object.name ?? "";
378
+ message.description = object.description ?? "";
379
+ message.confidence = object.confidence ?? 0;
380
+ message.version = object.version ?? "";
381
+ message.icon = object.icon ?? "";
382
+ message.website = object.website ?? "";
383
+ message.cpe = object.cpe ?? "";
384
+ message.category = (object.category !== undefined && object.category !== null)
385
+ ? Technology_Category.fromPartial(object.category)
386
+ : undefined;
387
+ message.rootPath = object.rootPath ?? false;
388
+ return message;
389
+ },
390
+ };
391
+
392
+ function createBaseTechnology_Category(): Technology_Category {
393
+ return { id: 0, slug: "", name: "" };
394
+ }
395
+
396
+ export const Technology_Category: MessageFns<Technology_Category> = {
397
+ encode(message: Technology_Category, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
398
+ if (message.id !== 0) {
399
+ writer.uint32(8).int32(message.id);
400
+ }
401
+ if (message.slug !== "") {
402
+ writer.uint32(18).string(message.slug);
403
+ }
404
+ if (message.name !== "") {
405
+ writer.uint32(26).string(message.name);
406
+ }
407
+ return writer;
408
+ },
409
+
410
+ decode(input: BinaryReader | Uint8Array, length?: number): Technology_Category {
411
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
412
+ const end = length === undefined ? reader.len : reader.pos + length;
413
+ const message = createBaseTechnology_Category();
414
+ while (reader.pos < end) {
415
+ const tag = reader.uint32();
416
+ switch (tag >>> 3) {
417
+ case 1: {
418
+ if (tag !== 8) {
419
+ break;
420
+ }
421
+
422
+ message.id = reader.int32();
423
+ continue;
424
+ }
425
+ case 2: {
426
+ if (tag !== 18) {
427
+ break;
428
+ }
429
+
430
+ message.slug = reader.string();
431
+ continue;
432
+ }
433
+ case 3: {
434
+ if (tag !== 26) {
435
+ break;
436
+ }
437
+
438
+ message.name = reader.string();
439
+ continue;
440
+ }
441
+ }
442
+ if ((tag & 7) === 4 || tag === 0) {
443
+ break;
444
+ }
445
+ reader.skip(tag & 7);
446
+ }
447
+ return message;
448
+ },
449
+
450
+ fromJSON(object: any): Technology_Category {
451
+ return {
452
+ id: isSet(object.id) ? globalThis.Number(object.id) : 0,
453
+ slug: isSet(object.slug) ? globalThis.String(object.slug) : "",
454
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
455
+ };
456
+ },
457
+
458
+ toJSON(message: Technology_Category): unknown {
459
+ const obj: any = {};
460
+ if (message.id !== 0) {
461
+ obj.id = Math.round(message.id);
462
+ }
463
+ if (message.slug !== "") {
464
+ obj.slug = message.slug;
465
+ }
466
+ if (message.name !== "") {
467
+ obj.name = message.name;
468
+ }
469
+ return obj;
470
+ },
471
+
472
+ create(base?: DeepPartial<Technology_Category>): Technology_Category {
473
+ return Technology_Category.fromPartial(base ?? {});
474
+ },
475
+ fromPartial(object: DeepPartial<Technology_Category>): Technology_Category {
476
+ const message = createBaseTechnology_Category();
477
+ message.id = object.id ?? 0;
478
+ message.slug = object.slug ?? "";
479
+ message.name = object.name ?? "";
480
+ return message;
481
+ },
482
+ };
483
+
484
+ export type TechnologyServiceService = typeof TechnologyServiceService;
485
+ export const TechnologyServiceService = {
486
+ analyze: {
487
+ path: "/techvulns.v1.TechnologyService/Analyze" as const,
488
+ requestStream: false as const,
489
+ responseStream: false as const,
490
+ requestSerialize: (value: AnalyzeRequest): Buffer => Buffer.from(AnalyzeRequest.encode(value).finish()),
491
+ requestDeserialize: (value: Buffer): AnalyzeRequest => AnalyzeRequest.decode(value),
492
+ responseSerialize: (value: AnalyzeResponse): Buffer => Buffer.from(AnalyzeResponse.encode(value).finish()),
493
+ responseDeserialize: (value: Buffer): AnalyzeResponse => AnalyzeResponse.decode(value),
494
+ },
495
+ } as const;
496
+
497
+ export interface TechnologyServiceServer extends UntypedServiceImplementation {
498
+ analyze: handleUnaryCall<AnalyzeRequest, AnalyzeResponse>;
499
+ }
500
+
501
+ export interface TechnologyServiceClient extends Client {
502
+ analyze(
503
+ request: AnalyzeRequest,
504
+ callback: (error: ServiceError | null, response: AnalyzeResponse) => void,
505
+ ): ClientUnaryCall;
506
+ analyze(
507
+ request: AnalyzeRequest,
508
+ metadata: Metadata,
509
+ callback: (error: ServiceError | null, response: AnalyzeResponse) => void,
510
+ ): ClientUnaryCall;
511
+ analyze(
512
+ request: AnalyzeRequest,
513
+ metadata: Metadata,
514
+ options: Partial<CallOptions>,
515
+ callback: (error: ServiceError | null, response: AnalyzeResponse) => void,
516
+ ): ClientUnaryCall;
517
+ }
518
+
519
+ export const TechnologyServiceClient = makeGenericClientConstructor(
520
+ TechnologyServiceService,
521
+ "techvulns.v1.TechnologyService",
522
+ ) as unknown as {
523
+ new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): TechnologyServiceClient;
524
+ service: typeof TechnologyServiceService;
525
+ serviceName: string;
526
+ };
527
+
528
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
529
+
530
+ export type DeepPartial<T> = T extends Builtin ? T
531
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
532
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
533
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
534
+ : Partial<T>;
535
+
536
+ function isSet(value: any): boolean {
537
+ return value !== null && value !== undefined;
538
+ }
539
+
540
+ export interface MessageFns<T> {
541
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
542
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
543
+ fromJSON(object: any): T;
544
+ toJSON(message: T): unknown;
545
+ create(base?: DeepPartial<T>): T;
546
+ fromPartial(object: DeepPartial<T>): T;
547
+ }
package/package.json CHANGED
@@ -3,10 +3,10 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.0.3",
7
- "main": "gen/js/techvulns/v1/tech_pb.js",
6
+ "version": "0.0.4",
7
+ "main": "gen/ts/techvulns/v1/tech.ts",
8
8
  "files": [
9
- "gen/js",
9
+ "gen/ts",
10
10
  "techvulns"
11
11
  ],
12
12
  "license": "GPL-3.0-only",
@@ -20,4 +20,4 @@
20
20
  "url": "https://github.com/Iglesys347/tech-vulns-proto/issues"
21
21
  },
22
22
  "homepage": "https://github.com/Iglesys347/tech-vulns-proto#readme"
23
- }
23
+ }
package/gen/js/.keep DELETED
File without changes
@@ -1,44 +0,0 @@
1
- // GENERATED CODE -- DO NOT EDIT!
2
-
3
- 'use strict';
4
- var grpc = require('@grpc/grpc-js');
5
- var techvulns_v1_tech_pb = require('../../techvulns/v1/tech_pb.js');
6
-
7
- function serialize_techvulns_v1_AnalyzeRequest(arg) {
8
- if (!(arg instanceof techvulns_v1_tech_pb.AnalyzeRequest)) {
9
- throw new Error('Expected argument of type techvulns.v1.AnalyzeRequest');
10
- }
11
- return Buffer.from(arg.serializeBinary());
12
- }
13
-
14
- function deserialize_techvulns_v1_AnalyzeRequest(buffer_arg) {
15
- return techvulns_v1_tech_pb.AnalyzeRequest.deserializeBinary(new Uint8Array(buffer_arg));
16
- }
17
-
18
- function serialize_techvulns_v1_AnalyzeResponse(arg) {
19
- if (!(arg instanceof techvulns_v1_tech_pb.AnalyzeResponse)) {
20
- throw new Error('Expected argument of type techvulns.v1.AnalyzeResponse');
21
- }
22
- return Buffer.from(arg.serializeBinary());
23
- }
24
-
25
- function deserialize_techvulns_v1_AnalyzeResponse(buffer_arg) {
26
- return techvulns_v1_tech_pb.AnalyzeResponse.deserializeBinary(new Uint8Array(buffer_arg));
27
- }
28
-
29
-
30
- var TechnologyServiceService = exports.TechnologyServiceService = {
31
- analyze: {
32
- path: '/techvulns.v1.TechnologyService/Analyze',
33
- requestStream: false,
34
- responseStream: false,
35
- requestType: techvulns_v1_tech_pb.AnalyzeRequest,
36
- responseType: techvulns_v1_tech_pb.AnalyzeResponse,
37
- requestSerialize: serialize_techvulns_v1_AnalyzeRequest,
38
- requestDeserialize: deserialize_techvulns_v1_AnalyzeRequest,
39
- responseSerialize: serialize_techvulns_v1_AnalyzeResponse,
40
- responseDeserialize: deserialize_techvulns_v1_AnalyzeResponse,
41
- },
42
- };
43
-
44
- exports.TechnologyServiceClient = grpc.makeGenericClientConstructor(TechnologyServiceService, 'TechnologyService');