1 | export interface Pkg {
|
2 | name: string;
|
3 | version?: string;
|
4 | }
|
5 | export declare type PurlString = string;
|
6 | export interface PkgInfo {
|
7 | name: string;
|
8 | version?: string;
|
9 | purl?: PurlString;
|
10 | }
|
11 | export interface VersionProvenance {
|
12 | type: string;
|
13 | location: string;
|
14 | property?: {
|
15 | name: string;
|
16 | };
|
17 | }
|
18 | export interface NodeInfo {
|
19 | versionProvenance?: VersionProvenance;
|
20 | labels?: {
|
21 | [key: string]: string | undefined;
|
22 | scope?: 'dev' | 'prod';
|
23 | pruned?: 'cyclic' | 'true';
|
24 | };
|
25 | }
|
26 | export interface Node {
|
27 | info: NodeInfo;
|
28 | }
|
29 | export interface GraphNode {
|
30 | nodeId: string;
|
31 | pkgId: string;
|
32 | info?: NodeInfo;
|
33 | deps: Array<{
|
34 | nodeId: string;
|
35 | }>;
|
36 | }
|
37 | export interface PkgManager {
|
38 | name: string;
|
39 | version?: string;
|
40 | repositories?: Array<{
|
41 | alias: string;
|
42 | }>;
|
43 | }
|
44 | export interface DepGraphData {
|
45 | schemaVersion: string;
|
46 | pkgManager: PkgManager;
|
47 | pkgs: Array<{
|
48 | id: string;
|
49 | info: PkgInfo;
|
50 | }>;
|
51 | graph: {
|
52 | rootNodeId: string;
|
53 | nodes: GraphNode[];
|
54 | };
|
55 | }
|
56 | export interface DepGraph {
|
57 | readonly pkgManager: PkgManager;
|
58 | readonly rootPkg: PkgInfo;
|
59 | getPkgs(): PkgInfo[];
|
60 | getDepPkgs(): PkgInfo[];
|
61 | getPkgNodes(pkg: Pkg): Node[];
|
62 | toJSON(): DepGraphData;
|
63 | pkgPathsToRoot(pkg: Pkg, opts?: {
|
64 | limit?: number;
|
65 | }): PkgInfo[][];
|
66 | isTransitive(pkg: Pkg): boolean;
|
67 | directDepsLeadingTo(pkg: Pkg): PkgInfo[];
|
68 | countPathsToRoot(pkg: Pkg, opts?: {
|
69 | limit?: number;
|
70 | }): number;
|
71 | equals(other: DepGraph, options?: {
|
72 | compareRoot?: boolean;
|
73 | }): boolean;
|
74 | }
|
75 | export interface DepGraphInternal extends DepGraph {
|
76 | readonly rootNodeId: string;
|
77 | getNode(nodeId: string): NodeInfo;
|
78 | getNodePkg(nodeId: string): PkgInfo;
|
79 | getPkgNodeIds(pkg: Pkg): string[];
|
80 | getNodeDepsNodeIds(nodeId: string): string[];
|
81 | getNodeParentsNodeIds(nodeId: string): string[];
|
82 | hasCycles(): boolean;
|
83 | }
|