@bevorai/sdk 0.2.2-rc1 → 0.2.2-rc3
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/README.md +7 -6
- package/dist/client.d.ts +0 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +0 -3
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +9 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +9 -0
- package/dist/errors.js.map +1 -1
- package/dist/graph/call-node.d.ts +16 -15
- package/dist/graph/call-node.d.ts.map +1 -1
- package/dist/graph/call-node.js +113 -175
- package/dist/graph/call-node.js.map +1 -1
- package/dist/graph/cursor.d.ts +2 -0
- package/dist/graph/cursor.d.ts.map +1 -1
- package/dist/graph/cursor.js +22 -18
- package/dist/graph/cursor.js.map +1 -1
- package/dist/graph/graph.d.ts +30 -49
- package/dist/graph/graph.d.ts.map +1 -1
- package/dist/graph/graph.js +366 -192
- package/dist/graph/graph.js.map +1 -1
- package/dist/helpers/sarif.d.ts +16 -2
- package/dist/helpers/sarif.d.ts.map +1 -1
- package/dist/helpers/sarif.js +217 -59
- package/dist/helpers/sarif.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/resources/analyses.d.ts +31 -33
- package/dist/resources/analyses.d.ts.map +1 -1
- package/dist/resources/analyses.js +54 -42
- package/dist/resources/analyses.js.map +1 -1
- package/dist/resources/codes.d.ts +4 -20
- package/dist/resources/codes.d.ts.map +1 -1
- package/dist/resources/codes.js +5 -26
- package/dist/resources/codes.js.map +1 -1
- package/dist/resources/graph.d.ts +82 -0
- package/dist/resources/graph.d.ts.map +1 -0
- package/dist/resources/graph.js +133 -0
- package/dist/resources/graph.js.map +1 -0
- package/dist/resources/index.d.ts +1 -3
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +1 -3
- package/dist/resources/index.js.map +1 -1
- package/dist/resources/projects.d.ts +4 -4
- package/dist/resources/projects.d.ts.map +1 -1
- package/dist/resources/projects.js +5 -5
- package/dist/resources/projects.js.map +1 -1
- package/dist/resources/users.d.ts +4 -1
- package/dist/resources/users.d.ts.map +1 -1
- package/dist/resources/users.js +8 -5
- package/dist/resources/users.js.map +1 -1
- package/dist/types/generics.d.ts +7 -0
- package/dist/types/generics.d.ts.map +1 -1
- package/dist/types/graph-data.d.ts +44 -19
- package/dist/types/graph-data.d.ts.map +1 -1
- package/dist/types/literals.d.ts +2 -0
- package/dist/types/literals.d.ts.map +1 -1
- package/dist/types/node-locations.d.ts +16 -0
- package/dist/types/node-locations.d.ts.map +1 -0
- package/dist/types/node-locations.js +3 -0
- package/dist/types/node-locations.js.map +1 -0
- package/dist/types/requests.d.ts +53 -47
- package/dist/types/requests.d.ts.map +1 -1
- package/dist/types/responses.d.ts +34 -20
- package/dist/types/responses.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/resources/files.d.ts +0 -36
- package/dist/resources/files.d.ts.map +0 -1
- package/dist/resources/files.js +0 -55
- package/dist/resources/files.js.map +0 -1
- package/dist/resources/nodes.d.ts +0 -43
- package/dist/resources/nodes.d.ts.map +0 -1
- package/dist/resources/nodes.js +0 -75
- package/dist/resources/nodes.js.map +0 -1
- package/dist/resources/transitions.d.ts +0 -29
- package/dist/resources/transitions.d.ts.map +0 -1
- package/dist/resources/transitions.js +0 -37
- package/dist/resources/transitions.js.map +0 -1
package/dist/graph/cursor.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Edges are identified by their source node and their index among its edges. */
|
|
2
|
+
export const edgeKey = (edge) => `${edge.src_id}#${edge.index}`;
|
|
1
3
|
/**
|
|
2
4
|
* A movable position in the graph that remembers its path.
|
|
3
5
|
*
|
|
@@ -26,7 +28,7 @@ export class GraphCursor {
|
|
|
26
28
|
this.nodeId = nodeId;
|
|
27
29
|
}
|
|
28
30
|
get node() {
|
|
29
|
-
return this.graph.
|
|
31
|
+
return this.graph._resolveNodeLocId(this.nodeId);
|
|
30
32
|
}
|
|
31
33
|
get depth() {
|
|
32
34
|
return this.stack.length;
|
|
@@ -44,12 +46,13 @@ export class GraphCursor {
|
|
|
44
46
|
gotoFirstChild() {
|
|
45
47
|
if (this.isCycle)
|
|
46
48
|
return null;
|
|
47
|
-
for (const edge of this.graph.
|
|
49
|
+
for (const edge of this.graph.listEdges({
|
|
50
|
+
node_id: this.nodeId,
|
|
48
51
|
direction: "out",
|
|
49
52
|
})) {
|
|
50
|
-
if (this.used.has(edge
|
|
53
|
+
if (this.used.has(edgeKey(edge)))
|
|
51
54
|
continue;
|
|
52
|
-
this.used = new Set([...this.used, edge
|
|
55
|
+
this.used = new Set([...this.used, edgeKey(edge)]);
|
|
53
56
|
if (edge.dst_id) {
|
|
54
57
|
this.stack = [...this.stack, [this.nodeId, this.used]];
|
|
55
58
|
this.nodeId = edge.dst_id;
|
|
@@ -62,13 +65,13 @@ export class GraphCursor {
|
|
|
62
65
|
gotoFirstParent(edgeType = null) {
|
|
63
66
|
if (this.stack.length === 0 || this.isCycle)
|
|
64
67
|
return null;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
edgeType
|
|
68
|
-
|
|
69
|
-
if (this.used.has(edge
|
|
68
|
+
const params = { node_id: this.nodeId, direction: "in" };
|
|
69
|
+
if (edgeType)
|
|
70
|
+
params.edge_type = edgeType;
|
|
71
|
+
for (const edge of this.graph.listEdges(params)) {
|
|
72
|
+
if (this.used.has(edgeKey(edge)))
|
|
70
73
|
continue;
|
|
71
|
-
this.used = new Set([...this.used, edge
|
|
74
|
+
this.used = new Set([...this.used, edgeKey(edge)]);
|
|
72
75
|
this.stack = [...this.stack, [this.nodeId, this.used]];
|
|
73
76
|
this.nodeId = edge.src_id;
|
|
74
77
|
this.used = new Set();
|
|
@@ -104,25 +107,26 @@ export class GraphCursor {
|
|
|
104
107
|
if (this.stack.length === 0 || this.isCycle)
|
|
105
108
|
return [];
|
|
106
109
|
return this.graph
|
|
107
|
-
.
|
|
108
|
-
.filter((edge) => !this.used.has(edge
|
|
109
|
-
.map((edge) => [edge, this.graph.
|
|
110
|
+
.listEdges({ node_id: this.nodeId, direction: "in" })
|
|
111
|
+
.filter((edge) => !this.used.has(edgeKey(edge)))
|
|
112
|
+
.map((edge) => [edge, this.graph._resolveNodeLocId(edge.src_id)]);
|
|
110
113
|
}
|
|
111
114
|
peekDown() {
|
|
112
115
|
if (this.isCycle)
|
|
113
116
|
return [];
|
|
114
117
|
const out = [];
|
|
115
|
-
for (const edge of this.graph.
|
|
118
|
+
for (const edge of this.graph.listEdges({
|
|
119
|
+
node_id: this.nodeId,
|
|
116
120
|
direction: "out",
|
|
117
121
|
})) {
|
|
118
|
-
if (edge.dst_id && !this.used.has(edge
|
|
119
|
-
out.push([edge, this.graph.
|
|
122
|
+
if (edge.dst_id && !this.used.has(edgeKey(edge)))
|
|
123
|
+
out.push([edge, this.graph._resolveNodeLocId(edge.dst_id)]);
|
|
120
124
|
}
|
|
121
125
|
return out;
|
|
122
126
|
}
|
|
123
127
|
render(source = null) {
|
|
124
128
|
const node = this.node;
|
|
125
|
-
const path = this.stack.map(([nodeId]) => this.graph.
|
|
129
|
+
const path = this.stack.map(([nodeId]) => this.graph._resolveNodeLocId(nodeId));
|
|
126
130
|
const lines = [
|
|
127
131
|
`Path: ${[...path, node].map((n) => n.name).join(" > ")}`,
|
|
128
132
|
`At: ${node.name} (${node.node_type})`,
|
|
@@ -134,7 +138,7 @@ export class GraphCursor {
|
|
|
134
138
|
const down = this.peekDown();
|
|
135
139
|
const up = this.peekUp();
|
|
136
140
|
const external = this.graph
|
|
137
|
-
.
|
|
141
|
+
.listEdges({ node_id: this.nodeId, direction: "out" })
|
|
138
142
|
.filter((edge) => !edge.dst_id);
|
|
139
143
|
if (down.length)
|
|
140
144
|
lines.push("", "Children:", ...down.map(([e, n]) => `→ ${e.edge_type} ${n.name}`));
|
package/dist/graph/cursor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../src/graph/cursor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../src/graph/cursor.ts"],"names":[],"mappings":"AAUA,iFAAiF;AACjF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAuB,EAAU,EAAE,CAC1D,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;AAEhC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,WAAW;IACd,KAAK,CAAQ;IACtB,MAAM,CAAS;IACf,2DAA2D;IAC3D,IAAI,GAAwB,IAAI,GAAG,EAAE,CAAC;IACtC,KAAK,GAAqB,EAAE,CAAC;IAE7B,YAAY,KAAY,EAAE,MAAc;QACvC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED,IAAI,IAAI;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,KAAK;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC1B,CAAC;IAED,IAAI,IAAI;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED;;;OAGG;IACH,cAAc;QACb,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC;QAC9B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YACvC,OAAO,EAAE,IAAI,CAAC,MAA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AAM;YACd,KAAK,CAAC,IAAI,CACT,EAAE,EACF,WAAW,EACX,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CACrD,CAAC;QACH,IAAI,EAAE,CAAC,MAAM;YACZ,KAAK,CAAC,IAAI,CACT,EAAE,EACF,UAAU,EACV,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CACnD,CAAC;QACH,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;YACrB,KAAK,CAAC,IAAI,CACT,EAAE,EACF,WAAW,EACX,GAAG,QAAQ,CAAC,GAAG,CACd,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,cAAc,IAAI,SAAS,EAAE,CAC1D,CACD,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;CACD"}
|
package/dist/graph/graph.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { BevorClient } from "../client.js";
|
|
2
2
|
import type { GraphSnapshotEdge, GraphSnapshotFile, GraphSnapshotNode } from "../types/graph-data.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Language } from "../types/literals.js";
|
|
4
|
+
import type { NodeLocation } from "../types/node-locations.js";
|
|
5
|
+
import type { EdgeListParams, NodeContentParam, NodeListParams } from "../types/requests.js";
|
|
4
6
|
import { CallNode } from "./call-node.js";
|
|
5
7
|
import { GraphCursor } from "./cursor.js";
|
|
6
8
|
export interface GraphSnapshot {
|
|
@@ -8,10 +10,6 @@ export interface GraphSnapshot {
|
|
|
8
10
|
edges: GraphSnapshotEdge[];
|
|
9
11
|
files: GraphSnapshotFile[];
|
|
10
12
|
}
|
|
11
|
-
export interface EdgeFilter {
|
|
12
|
-
direction?: EdgeDirection | null;
|
|
13
|
-
edgeType?: EdgeType | null;
|
|
14
|
-
}
|
|
15
13
|
/**
|
|
16
14
|
* Language-agnostic graph view for one code version, backed by HTTP only.
|
|
17
15
|
*
|
|
@@ -20,57 +18,44 @@ export interface EdgeFilter {
|
|
|
20
18
|
export declare class Graph {
|
|
21
19
|
#private;
|
|
22
20
|
readonly codeId: string;
|
|
23
|
-
edges: GraphSnapshotEdge[];
|
|
24
|
-
fileMap: Map<string, GraphSnapshotFile>;
|
|
25
|
-
/** file id -> ids of the nodes in that file */
|
|
26
|
-
sourceMap: Map<string, string[]>;
|
|
27
|
-
nodeMap: Map<string, GraphSnapshotNode>;
|
|
28
|
-
/** short id -> id */
|
|
29
|
-
idMap: Map<string, string>;
|
|
30
|
-
/** id -> short id */
|
|
31
|
-
reverseIdMap: Map<string, string>;
|
|
32
21
|
constructor(client: BevorClient, codeId: string);
|
|
33
22
|
static fromSnapshot(client: BevorClient, codeId: string, snapshot: GraphSnapshot): Graph;
|
|
34
23
|
get isBuilt(): boolean;
|
|
35
|
-
/** Fetches the
|
|
24
|
+
/** Fetches whichever of the nodes, edges and files aren't loaded yet. */
|
|
36
25
|
build(): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
|
|
26
|
+
/** A node by full id, short id, or a physical location. */
|
|
27
|
+
getNode(ref: string | NodeLocation): Promise<GraphSnapshotNode>;
|
|
28
|
+
getNode(ref: string | NodeLocation, orNone: true): Promise<GraphSnapshotNode | null>;
|
|
29
|
+
/** Fetches a file's text, by file id or path, once and caches it. */
|
|
30
|
+
getFileContent(ref: string): Promise<string>;
|
|
39
31
|
/**
|
|
40
32
|
* The node's source, with oversized hex/string literals elided.
|
|
41
|
-
*
|
|
33
|
+
*
|
|
34
|
+
* With `with_docstring`, prefixes the node's docstring. With `resolve_docstring` as well, an
|
|
35
|
+
* `@inheritdoc` docstring is replaced by the natspec it references.
|
|
42
36
|
*/
|
|
43
|
-
reconstructChunk(
|
|
44
|
-
withDocstring?: boolean;
|
|
45
|
-
}): Promise<string>;
|
|
37
|
+
reconstructChunk(ref: string | NodeLocation, params?: NodeContentParam): Promise<string>;
|
|
46
38
|
static reconstruct(node: GraphSnapshotNode, source: Uint8Array, docstring?: string | null): string;
|
|
47
|
-
|
|
48
|
-
getIdFromShort(shortId: string): string;
|
|
49
|
-
getAllNodes(): GraphSnapshotNode[];
|
|
50
|
-
/** Nodes with no incoming edges. */
|
|
51
|
-
getRootNodes(): GraphSnapshotNode[];
|
|
52
|
-
getAllFiles(): GraphSnapshotFile[];
|
|
53
|
-
exists(nodeId: string): boolean;
|
|
54
|
-
existsShortId(shortId: string): boolean;
|
|
55
|
-
getNode(nodeId: string): GraphSnapshotNode;
|
|
56
|
-
getFile(fileId: string): GraphSnapshotFile;
|
|
57
|
-
/** Distinct languages in this snapshot (e.g. Solidity + Rust in a monorepo). */
|
|
58
|
-
get languages(): ReadonlySet<Language>;
|
|
59
|
-
getNodeLanguage(nodeId: string): Language;
|
|
39
|
+
listNodes(params?: NodeListParams): GraphSnapshotNode[];
|
|
60
40
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
41
|
+
* Lists edges. With `node_id`, each returned edge is a copy with `direction` set relative to
|
|
42
|
+
* that node; without it, `direction` is ignored and the snapshot's edges are returned as-is.
|
|
63
43
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
44
|
+
listEdges(params?: EdgeListParams): GraphSnapshotEdge[];
|
|
45
|
+
listFiles(): GraphSnapshotFile[];
|
|
46
|
+
/** @internal The node for a full id or a short id. */
|
|
47
|
+
_resolveNodeLocId(ref: string): GraphSnapshotNode;
|
|
48
|
+
/**
|
|
49
|
+
* The node's name preceded by its enclosing definitions, outermost first, and its module for
|
|
50
|
+
* languages that namespace by file.
|
|
51
|
+
*/
|
|
52
|
+
qualifiedParts(node: GraphSnapshotNode): string[];
|
|
53
|
+
/** A file by its id, its path, or a path suffix that matches exactly one file. */
|
|
54
|
+
getFile(ref: string): GraphSnapshotFile;
|
|
55
|
+
/** Distinct languages in this snapshot (e.g. Solidity + Rust in a monorepo). */
|
|
56
|
+
get languages(): ReadonlySet<Language>;
|
|
71
57
|
/** Walks incoming edges until it reaches a node of `nodeType`. */
|
|
72
|
-
traverseUpToNodeType(
|
|
73
|
-
getNodesInFile(fileId: string): string[];
|
|
58
|
+
traverseUpToNodeType(sourceNodeId: string, nodeType: string): GraphSnapshotNode | null;
|
|
74
59
|
/** Shortest path length treating the graph as undirected (-1 if disconnected). */
|
|
75
60
|
getDistance(fromNodeId: string, toNodeId: string): number;
|
|
76
61
|
/** True if `parentId` is reachable from `childId` following incoming `calls` edges. */
|
|
@@ -79,9 +64,5 @@ export declare class Graph {
|
|
|
79
64
|
cursor(nodeId: string): GraphCursor;
|
|
80
65
|
/** Depth-first search along outgoing edges for a node with `merkleHash`. */
|
|
81
66
|
getDescendantByMerkle(nodeId: string, merkleHash: string): string | null;
|
|
82
|
-
getCallableTypes(language: Language): Set<string>;
|
|
83
|
-
getDeclarationTypes(language: Language): Set<string>;
|
|
84
|
-
getExcludeTypes(language: Language): Set<string>;
|
|
85
|
-
getContainerTypes(language: Language): Set<string>;
|
|
86
67
|
}
|
|
87
68
|
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/graph/graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/graph/graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EACX,iBAAi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