UNPKG

@appthreat/cdx-proto

Version:

Library to serialize/deserialize CycloneDX BOM with protocol buffers

65 lines 5.03 kB
import type { BinaryReadOptions, BinaryWriteOptions, JsonReadOptions, JsonValue, JsonWriteOptions, JsonWriteStringOptions, MessageInitShape, MessageJsonType } from "@bufbuild/protobuf"; import type { Bom as Bom15 } from "./lib/bom-1.5_pb.js"; import { BomSchema as BomSchema15 } from "./lib/bom-1.5_pb.js"; import type { Bom as Bom16 } from "./lib/bom-1.6_pb.js"; import { BomSchema as BomSchema16 } from "./lib/bom-1.6_pb.js"; import type { Bom as Bom17 } from "./lib/bom-1.7_pb.js"; import { BomSchema as BomSchema17 } from "./lib/bom-1.7_pb.js"; export declare const supportedSpecVersions: readonly ["1.5", "1.6", "1.7"]; export type SupportedSpecVersion = (typeof supportedSpecVersions)[number]; export type BomSchemaByVersion = { "1.5": typeof BomSchema15; "1.6": typeof BomSchema16; "1.7": typeof BomSchema17; }; export type BomByVersion = { "1.5": Bom15; "1.6": Bom16; "1.7": Bom17; }; export type BomInitByVersion = { [Version in SupportedSpecVersion]: MessageInitShape<BomSchemaByVersion[Version]>; }; export type BomJsonByVersion = { [Version in SupportedSpecVersion]: MessageJsonType<BomSchemaByVersion[Version]>; }; export type AnyBomSchema = BomSchemaByVersion[SupportedSpecVersion]; export type AnyBom = BomByVersion[SupportedSpecVersion]; export type AnyBomJson = BomJsonByVersion[SupportedSpecVersion]; type BomVersionCarrier = { specVersion?: unknown; spec_version?: unknown; }; export declare function getBomSchema(specVersion: "1.5"): typeof BomSchema15; export declare function getBomSchema(specVersion: "1.6"): typeof BomSchema16; export declare function getBomSchema(specVersion: "1.7"): typeof BomSchema17; export declare function getBomSchema(specVersion: string | number): AnyBomSchema; export declare function detectBomSpecVersion(value: BomVersionCarrier): SupportedSpecVersion; export declare function getBomSchemaForBom(bom: AnyBom): AnyBomSchema; export declare function createBom(specVersion: "1.5", init?: BomInitByVersion["1.5"]): BomByVersion["1.5"]; export declare function createBom(specVersion: "1.6", init?: BomInitByVersion["1.6"]): BomByVersion["1.6"]; export declare function createBom(specVersion: "1.7", init?: BomInitByVersion["1.7"]): BomByVersion["1.7"]; export declare function createBom(specVersion: string | number, init?: BomInitByVersion[SupportedSpecVersion]): AnyBom; export declare function decodeBomBinary(specVersion: "1.5", bytes: Uint8Array, options?: Partial<BinaryReadOptions>): BomByVersion["1.5"]; export declare function decodeBomBinary(specVersion: "1.6", bytes: Uint8Array, options?: Partial<BinaryReadOptions>): BomByVersion["1.6"]; export declare function decodeBomBinary(specVersion: "1.7", bytes: Uint8Array, options?: Partial<BinaryReadOptions>): BomByVersion["1.7"]; export declare function decodeBomBinary(specVersion: string | number, bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AnyBom; export declare function decodeBomJson(specVersion: "1.5", json: JsonValue, options?: Partial<JsonReadOptions>): BomByVersion["1.5"]; export declare function decodeBomJson(specVersion: "1.6", json: JsonValue, options?: Partial<JsonReadOptions>): BomByVersion["1.6"]; export declare function decodeBomJson(specVersion: "1.7", json: JsonValue, options?: Partial<JsonReadOptions>): BomByVersion["1.7"]; export declare function decodeBomJson(specVersion: string | number, json: JsonValue, options?: Partial<JsonReadOptions>): AnyBom; export declare function decodeBomJsonString(specVersion: "1.5", json: string, options?: Partial<JsonReadOptions>): BomByVersion["1.5"]; export declare function decodeBomJsonString(specVersion: "1.6", json: string, options?: Partial<JsonReadOptions>): BomByVersion["1.6"]; export declare function decodeBomJsonString(specVersion: "1.7", json: string, options?: Partial<JsonReadOptions>): BomByVersion["1.7"]; export declare function decodeBomJsonString(specVersion: string | number, json: string, options?: Partial<JsonReadOptions>): AnyBom; export declare function parseBomJson(json: JsonValue, options?: Partial<JsonReadOptions>): AnyBom; export declare function parseBomJsonString(json: string, options?: Partial<JsonReadOptions>): AnyBom; export declare function encodeBomBinary(bom: AnyBom, options?: Partial<BinaryWriteOptions>): Uint8Array; export declare function encodeBomJson(bom: BomByVersion["1.5"], options?: Partial<JsonWriteOptions>): BomJsonByVersion["1.5"]; export declare function encodeBomJson(bom: BomByVersion["1.6"], options?: Partial<JsonWriteOptions>): BomJsonByVersion["1.6"]; export declare function encodeBomJson(bom: BomByVersion["1.7"], options?: Partial<JsonWriteOptions>): BomJsonByVersion["1.7"]; export declare function encodeBomJson(bom: AnyBom, options?: Partial<JsonWriteOptions>): AnyBomJson; export declare function parseBomBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): AnyBom; export declare function encodeBomJsonString(bom: AnyBom, options?: Partial<JsonWriteStringOptions>): string; export {}; //# sourceMappingURL=helpers.d.ts.map