@manya-os/weave 1.0.0
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/CHANGELOG.md +23 -0
- package/LICENSE +21 -0
- package/README.md +252 -0
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/index.js.map +6 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/index.mjs +8 -0
- package/dist/esm/index.mjs.map +6 -0
- package/dist/esm/package.json +1 -0
- package/dist/types/errors.d.ts +28 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/export/exporter.d.ts +47 -0
- package/dist/types/export/exporter.d.ts.map +1 -0
- package/dist/types/export/index.d.ts +8 -0
- package/dist/types/export/index.d.ts.map +1 -0
- package/dist/types/filter/filter.d.ts +46 -0
- package/dist/types/filter/filter.d.ts.map +1 -0
- package/dist/types/filter/index.d.ts +8 -0
- package/dist/types/filter/index.d.ts.map +1 -0
- package/dist/types/graph/graph.d.ts +99 -0
- package/dist/types/graph/graph.d.ts.map +1 -0
- package/dist/types/graph/index.d.ts +8 -0
- package/dist/types/graph/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +25 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/interactive/index.d.ts +8 -0
- package/dist/types/interactive/index.d.ts.map +1 -0
- package/dist/types/interactive/interactive.d.ts +84 -0
- package/dist/types/interactive/interactive.d.ts.map +1 -0
- package/dist/types/layout/index.d.ts +9 -0
- package/dist/types/layout/index.d.ts.map +1 -0
- package/dist/types/layout/layout.d.ts +95 -0
- package/dist/types/layout/layout.d.ts.map +1 -0
- package/dist/types/logging.d.ts +33 -0
- package/dist/types/logging.d.ts.map +1 -0
- package/dist/types/render/index.d.ts +8 -0
- package/dist/types/render/index.d.ts.map +1 -0
- package/dist/types/render/renderer.d.ts +26 -0
- package/dist/types/render/renderer.d.ts.map +1 -0
- package/dist/types/search/index.d.ts +8 -0
- package/dist/types/search/index.d.ts.map +1 -0
- package/dist/types/search/search.d.ts +57 -0
- package/dist/types/search/search.d.ts.map +1 -0
- package/dist/types/topology/index.d.ts +8 -0
- package/dist/types/topology/index.d.ts.map +1 -0
- package/dist/types/topology/topology.d.ts +60 -0
- package/dist/types/topology/topology.d.ts.map +1 -0
- package/dist/types/types.d.ts +122 -0
- package/dist/types/types.d.ts.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/weave — typed error hierarchy.
|
|
3
|
+
*
|
|
4
|
+
* Every public Weave API throws a subclass of `WeaveError`. Errors carry a
|
|
5
|
+
* stable `code` string for programmatic discrimination.
|
|
6
|
+
*
|
|
7
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
8
|
+
* Licensed under the Apache License, Version 2.0.
|
|
9
|
+
*/
|
|
10
|
+
/** Base class for all @manya-os/weave errors. */
|
|
11
|
+
export declare class WeaveError extends Error {
|
|
12
|
+
readonly code: string;
|
|
13
|
+
readonly cause?: unknown;
|
|
14
|
+
constructor(message: string, code?: string, cause?: unknown);
|
|
15
|
+
}
|
|
16
|
+
/** Raised for invalid graph operations (missing nodes, duplicate ids, cycles in topo sort, etc.). */
|
|
17
|
+
export declare class GraphError extends WeaveError {
|
|
18
|
+
constructor(message: string, cause?: unknown);
|
|
19
|
+
}
|
|
20
|
+
/** Raised when a layout algorithm fails (e.g. unsupported graph shape, no nodes). */
|
|
21
|
+
export declare class LayoutError extends WeaveError {
|
|
22
|
+
constructor(message: string, cause?: unknown);
|
|
23
|
+
}
|
|
24
|
+
/** Raised when an export/render target is unsupported or malformed. */
|
|
25
|
+
export declare class ExportError extends WeaveError {
|
|
26
|
+
constructor(message: string, cause?: unknown);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,iDAAiD;AACjD,qBAAa,UAAW,SAAQ,KAAK;IACnC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAyB,KAAK,CAAC,EAAE,OAAO,CAAC;gBAC7B,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAO5D;AAED,qGAAqG;AACrG,qBAAa,UAAW,SAAQ,UAAU;gBAC5B,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAC7C;AAED,qFAAqF;AACrF,qBAAa,WAAY,SAAQ,UAAU;gBAC7B,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAC7C;AAED,uEAAuE;AACvE,qBAAa,WAAY,SAAQ,UAAU;gBAC7B,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAC7C"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/weave — graph exporters.
|
|
3
|
+
*
|
|
4
|
+
* Serialize a graph to multiple formats:
|
|
5
|
+
* - `toJSON` — JSON string of the graph shape.
|
|
6
|
+
* - `toDot` — Graphviz DOT.
|
|
7
|
+
* - `toMermaid`— Mermaid flowchart.
|
|
8
|
+
* - `toSVG` — minimal SVG using absolute positions from a layout.
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
11
|
+
* Licensed under the Apache License, Version 2.0.
|
|
12
|
+
*/
|
|
13
|
+
import type { Layout } from '../types.js';
|
|
14
|
+
import type { Graph } from '../graph/graph.js';
|
|
15
|
+
/**
|
|
16
|
+
* Serialize the graph to a JSON string.
|
|
17
|
+
*
|
|
18
|
+
* The shape is `{ directed, nodes: [...], edges: [...] }`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function toJSON(graph: Graph): string;
|
|
21
|
+
/**
|
|
22
|
+
* Serialize the graph to Graphviz DOT.
|
|
23
|
+
*
|
|
24
|
+
* Uses `digraph` for directed graphs and `graph` for undirected. Edge
|
|
25
|
+
* operators are `->` and `--` respectively.
|
|
26
|
+
*/
|
|
27
|
+
export declare function toDot(graph: Graph, name?: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Serialize the graph to a Mermaid flowchart string.
|
|
30
|
+
*
|
|
31
|
+
* Uses `flowchart TD` for directed graphs and `flowchart LR` for undirected
|
|
32
|
+
* (Mermaid has no first-class undirected flowchart; LR is the closest visual).
|
|
33
|
+
*/
|
|
34
|
+
export declare function toMermaid(graph: Graph): string;
|
|
35
|
+
/**
|
|
36
|
+
* Render a minimal SVG using absolute positions from a layout.
|
|
37
|
+
*
|
|
38
|
+
* This is intentionally simple. For a full-featured renderer with configurable
|
|
39
|
+
* colors, fonts, and canvas size, use `renderToSVG` from `@manya-os/weave/render`.
|
|
40
|
+
*
|
|
41
|
+
* @param graph input graph
|
|
42
|
+
* @param layout node positions
|
|
43
|
+
* @param width canvas width (default 800)
|
|
44
|
+
* @param height canvas height (default 600)
|
|
45
|
+
*/
|
|
46
|
+
export declare function toSVG(graph: Graph, layout: Layout, width?: number, height?: number): string;
|
|
47
|
+
//# sourceMappingURL=exporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../../src/export/exporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAyB/C;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAM3C;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,GAAE,MAAY,GAAG,MAAM,CAqB9D;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAqB9C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CACnB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAY,EACnB,MAAM,GAAE,MAAY,GACnB,MAAM,CAoCR"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/weave — export module barrel.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export { toJSON, toDot, toMermaid, toSVG } from './exporter.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/export/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/weave — graph filtering.
|
|
3
|
+
*
|
|
4
|
+
* Filtering produces a new `Graph` (subgraph) containing only the nodes/edges
|
|
5
|
+
* that satisfy the predicate. All filters preserve the `directed` flag.
|
|
6
|
+
*
|
|
7
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
8
|
+
* Licensed under the Apache License, Version 2.0.
|
|
9
|
+
*/
|
|
10
|
+
import type { Node, Edge, NodeID } from '../types.js';
|
|
11
|
+
import { Graph } from '../graph/graph.js';
|
|
12
|
+
/**
|
|
13
|
+
* Filter nodes by label.
|
|
14
|
+
*
|
|
15
|
+
* @param graph input
|
|
16
|
+
* @param predicate applied to each node's label; truthy → kept
|
|
17
|
+
*/
|
|
18
|
+
export declare function filterByLabel(graph: Graph, predicate: (label: string) => boolean): Graph;
|
|
19
|
+
/**
|
|
20
|
+
* Filter nodes by `type`.
|
|
21
|
+
*
|
|
22
|
+
* @param graph input
|
|
23
|
+
* @param type exact type string to match; undefined → nodes with no type
|
|
24
|
+
*/
|
|
25
|
+
export declare function filterByType(graph: Graph, type: string | undefined): Graph;
|
|
26
|
+
/**
|
|
27
|
+
* Filter edges by `type`, keeping all nodes but only matching edges.
|
|
28
|
+
*/
|
|
29
|
+
export declare function filterByEdgeType(graph: Graph, type: string | undefined): Graph;
|
|
30
|
+
/**
|
|
31
|
+
* Keep only the connected component containing `nodeId`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function filterByComponent(graph: Graph, nodeId: NodeID): Graph;
|
|
34
|
+
/**
|
|
35
|
+
* Keep only nodes within `maxDepth` hops of `rootId` (BFS).
|
|
36
|
+
*
|
|
37
|
+
* Edges between kept nodes are preserved. The root is always included.
|
|
38
|
+
*/
|
|
39
|
+
export declare function filterByDepth(graph: Graph, rootId: NodeID, maxDepth: number): Graph;
|
|
40
|
+
/** Keep only nodes whose properties match a predicate. */
|
|
41
|
+
export declare function filterByProperty(graph: Graph, predicate: (properties: Record<string, unknown> | undefined) => boolean): Graph;
|
|
42
|
+
/** Convenience: filter nodes by an arbitrary predicate. */
|
|
43
|
+
export declare function filterNodes(graph: Graph, predicate: (node: Node) => boolean): Graph;
|
|
44
|
+
/** Convenience: filter edges by an arbitrary predicate (nodes preserved). */
|
|
45
|
+
export declare function filterEdges(graph: Graph, predicate: (edge: Edge) => boolean): Graph;
|
|
46
|
+
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/filter/filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAY1C;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,KAAK,CAIxF;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,CAO1E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,CAQ9E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAGrE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAInF;AAED,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,KAAK,OAAO,GACtE,KAAK,CAIP;AAED,2DAA2D;AAC3D,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,GAAG,KAAK,CAInF;AAED,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,GAAG,KAAK,CAKnF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/weave — filter module barrel.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export { filterByLabel, filterByType, filterByEdgeType, filterByComponent, filterByDepth, filterByProperty, filterNodes, filterEdges, } from './filter.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/filter/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAC7C,iBAAiB,EAAE,aAAa,EAAE,gBAAgB,EAClD,WAAW,EAAE,WAAW,GACzB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/weave — core graph data model.
|
|
3
|
+
*
|
|
4
|
+
* The `Graph` class is the central abstraction of @manya-os/weave. It supports
|
|
5
|
+
* both directed and undirected graphs, exposes adjacency queries, cycle
|
|
6
|
+
* detection, topological sort, and connected-component detection. All graph
|
|
7
|
+
* mutations are O(1) amortized; queries are O(degree).
|
|
8
|
+
*
|
|
9
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
10
|
+
* Licensed under the Apache License, Version 2.0.
|
|
11
|
+
*/
|
|
12
|
+
import type { Node, Edge, NodeID, EdgeID } from '../types.js';
|
|
13
|
+
/**
|
|
14
|
+
* A mutable in-memory graph.
|
|
15
|
+
*
|
|
16
|
+
* Both directed and undirected graphs are supported. For undirected graphs
|
|
17
|
+
* adjacency is symmetric: an edge `a -> b` is reachable from both endpoints.
|
|
18
|
+
*/
|
|
19
|
+
export declare class Graph {
|
|
20
|
+
/** Whether this graph is directed. */
|
|
21
|
+
readonly directed: boolean;
|
|
22
|
+
private readonly nodesById;
|
|
23
|
+
private readonly edgesById;
|
|
24
|
+
/** Out-adjacency: node id → set of neighbor ids. */
|
|
25
|
+
private readonly outAdj;
|
|
26
|
+
/** In-adjacency: node id → set of predecessor ids. */
|
|
27
|
+
private readonly inAdj;
|
|
28
|
+
constructor(directed?: boolean);
|
|
29
|
+
/** Add a node. Throws if a node with the same id already exists. */
|
|
30
|
+
addNode(node: Node): this;
|
|
31
|
+
/** Add multiple nodes. */
|
|
32
|
+
addNodes(nodes: Iterable<Node>): this;
|
|
33
|
+
/** Remove a node and any incident edges. No-op if the node does not exist. */
|
|
34
|
+
removeNode(id: NodeID): this;
|
|
35
|
+
/** Get a node by id, or undefined. */
|
|
36
|
+
getNode(id: NodeID): Node | undefined;
|
|
37
|
+
/** True iff a node with this id exists. */
|
|
38
|
+
hasNode(id: NodeID): boolean;
|
|
39
|
+
/** Update an existing node's data (label/type/properties). Throws if missing. */
|
|
40
|
+
updateNode(id: NodeID, patch: Partial<Omit<Node, 'id'>>): this;
|
|
41
|
+
/** Add an edge. Both endpoints must already exist. */
|
|
42
|
+
addEdge(edge: Edge): this;
|
|
43
|
+
/** Add multiple edges. */
|
|
44
|
+
addEdges(edges: Iterable<Edge>): this;
|
|
45
|
+
/** Remove an edge. No-op if missing. */
|
|
46
|
+
removeEdge(id: EdgeID): this;
|
|
47
|
+
/** Get an edge by id. */
|
|
48
|
+
getEdge(id: EdgeID): Edge | undefined;
|
|
49
|
+
/** True iff an edge with this id exists. */
|
|
50
|
+
hasEdge(id: EdgeID): boolean;
|
|
51
|
+
/** Snapshot of all nodes (new array). */
|
|
52
|
+
get nodes(): Node[];
|
|
53
|
+
/** Snapshot of all edges (new array). */
|
|
54
|
+
get edges(): Edge[];
|
|
55
|
+
/** Number of nodes. */
|
|
56
|
+
size(): number;
|
|
57
|
+
/** Number of edges. */
|
|
58
|
+
edgeCount(): number;
|
|
59
|
+
/** Outgoing neighbors (successors) of a node. */
|
|
60
|
+
successors(id: NodeID): NodeID[];
|
|
61
|
+
/** Incoming neighbors (predecessors) of a node. */
|
|
62
|
+
predecessors(id: NodeID): NodeID[];
|
|
63
|
+
/** All neighbors. For undirected graphs this equals `successors`. */
|
|
64
|
+
neighbors(id: NodeID): NodeID[];
|
|
65
|
+
/** Out-degree (number of outgoing edges). */
|
|
66
|
+
outDegree(id: NodeID): number;
|
|
67
|
+
/** In-degree (number of incoming edges). */
|
|
68
|
+
inDegree(id: NodeID): number;
|
|
69
|
+
/** Total degree. For undirected graphs this equals 2 × incident edges. */
|
|
70
|
+
degree(id: NodeID): number;
|
|
71
|
+
/** True iff the graph contains at least one cycle. */
|
|
72
|
+
hasCycle(): boolean;
|
|
73
|
+
private hasCycleDirected;
|
|
74
|
+
private hasCycleUndirected;
|
|
75
|
+
/**
|
|
76
|
+
* Topologically sort the nodes of a directed acyclic graph.
|
|
77
|
+
* Throws `GraphError` if the graph contains a cycle or is undirected.
|
|
78
|
+
*/
|
|
79
|
+
topologicalSort(): NodeID[];
|
|
80
|
+
/** Find all connected components (undirected: connected; directed: weakly connected). */
|
|
81
|
+
findConnectedComponents(): NodeID[][];
|
|
82
|
+
/** Return the connected component containing `id`, as a sorted id array. */
|
|
83
|
+
componentOf(id: NodeID): NodeID[];
|
|
84
|
+
/**
|
|
85
|
+
* Breadth-first traversal from `start` up to `maxDepth` (inclusive).
|
|
86
|
+
* Returns a map of nodeId → depth.
|
|
87
|
+
*/
|
|
88
|
+
bfsDepths(start: NodeID, maxDepth?: number): Map<NodeID, number>;
|
|
89
|
+
/** Clone this graph (deep copy). */
|
|
90
|
+
clone(): Graph;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Build a `Graph` from a list of nodes and edges.
|
|
94
|
+
* @param nodes initial nodes
|
|
95
|
+
* @param edges initial edges
|
|
96
|
+
* @param directed whether the graph is directed (default false)
|
|
97
|
+
*/
|
|
98
|
+
export declare function createGraph(nodes: Iterable<Node>, edges?: Iterable<Edge>, directed?: boolean): Graph;
|
|
99
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/graph/graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,M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src/graph/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/weave — interactive visualization substrate for the MANYA Intelligence OS.
|
|
3
|
+
*
|
|
4
|
+
* Public API surface for @manya-os/weave. Everything exported here is part of the
|
|
5
|
+
* stable, semver-bound public API.
|
|
6
|
+
*
|
|
7
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
8
|
+
* Conceived, directed, and owned by Uviwe Menyiwe (Azura Daemon), founder
|
|
9
|
+
* of the Manya Hael Foundation.
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0.
|
|
12
|
+
*/
|
|
13
|
+
export * from './types.js';
|
|
14
|
+
export * from './errors.js';
|
|
15
|
+
export { Logger, LogLevel, ConsoleLogger, SilentLogger, scrubMetadata, shouldScrubField, SCRUBBED_FIELD_NAMES, } from './logging.js';
|
|
16
|
+
export { Graph, createGraph } from './graph/graph.js';
|
|
17
|
+
export { mulberry32, forceDirected, hierarchical, radial, grid, } from './layout/layout.js';
|
|
18
|
+
export type { LayoutOptions, ForceDirectedOptions, HierarchicalOptions, RadialOptions, GridOptions, } from './layout/layout.js';
|
|
19
|
+
export { filterByLabel, filterByType, filterByEdgeType, filterByComponent, filterByDepth, filterByProperty, filterNodes, filterEdges, } from './filter/filter.js';
|
|
20
|
+
export { levenshtein, similarity, search, fuzzySearch, bfsPath, dijkstra, } from './search/search.js';
|
|
21
|
+
export { toJSON, toDot, toMermaid, toSVG } from './export/exporter.js';
|
|
22
|
+
export { renderToSVG, mergeRenderConfig, DEFAULT_RENDER_CONFIG } from './render/renderer.js';
|
|
23
|
+
export { takeSnapshot, diffSnapshots, TopologyTracker } from './topology/topology.js';
|
|
24
|
+
export { SelectionModel, DEFAULT_VIEWPORT, IDENTITY_VIEWPORT, applyViewport, inverseViewport, panTo, zoomAt, } from './interactive/interactive.js';
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAG5B,OAAO,EACL,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAC7C,aAAa,EAAE,gBAAgB,EAAE,oBAAoB,GACtD,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGtD,OAAO,EACL,UAAU,EACV,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,GAC1C,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EACxD,aAAa,EAAE,WAAW,GAC3B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAC7C,iBAAiB,EAAE,aAAa,EAAE,gBAAgB,EAClD,WAAW,EAAE,WAAW,GACzB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,WAAW,EAAE,UAAU,EACvB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,QAAQ,GAClB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGvE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAG7F,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGtF,OAAO,EACL,cAAc,EACd,gBAAgB,EAAE,iBAAiB,EACnC,aAAa,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAC9C,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/weave — interactive module barrel.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export { SelectionModel, DEFAULT_VIEWPORT, IDENTITY_VIEWPORT, applyViewport, inverseViewport, panTo, zoomAt, } from './interactive.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/interactive/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,cAAc,EACd,gBAAgB,EAAE,iBAAiB,EACnC,aAAa,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAC9C,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/weave — interactive exploration primitives.
|
|
3
|
+
*
|
|
4
|
+
* `SelectionModel` tracks the currently selected nodes/edges.
|
|
5
|
+
* `Viewport` captures pan/zoom state and `applyViewport` transforms a point
|
|
6
|
+
* from graph coordinates to viewport (screen) coordinates.
|
|
7
|
+
*
|
|
8
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
9
|
+
* Licensed under the Apache License, Version 2.0.
|
|
10
|
+
*/
|
|
11
|
+
import type { NodeID, EdgeID, Point, Viewport } from '../types.js';
|
|
12
|
+
/** Default viewport: centered at origin, zoom 1. */
|
|
13
|
+
export declare const DEFAULT_VIEWPORT: Viewport;
|
|
14
|
+
/** A mutable selection of nodes and edges for interactive exploration. */
|
|
15
|
+
export declare class SelectionModel {
|
|
16
|
+
private readonly selectedNodes;
|
|
17
|
+
private readonly selectedEdges;
|
|
18
|
+
/** Select a node by id. */
|
|
19
|
+
selectNode(id: NodeID): this;
|
|
20
|
+
/** Select an edge by id. */
|
|
21
|
+
selectEdge(id: EdgeID): this;
|
|
22
|
+
/** Deselect a node. */
|
|
23
|
+
deselectNode(id: NodeID): this;
|
|
24
|
+
/** Deselect an edge. */
|
|
25
|
+
deselectEdge(id: EdgeID): this;
|
|
26
|
+
/** Toggle node selection. Returns the new selection state. */
|
|
27
|
+
toggleNode(id: NodeID): boolean;
|
|
28
|
+
/** Toggle edge selection. Returns the new selection state. */
|
|
29
|
+
toggleEdge(id: EdgeID): boolean;
|
|
30
|
+
/** True iff the node is currently selected. */
|
|
31
|
+
isNodeSelected(id: NodeID): boolean;
|
|
32
|
+
/** True iff the edge is currently selected. */
|
|
33
|
+
isEdgeSelected(id: EdgeID): boolean;
|
|
34
|
+
/** All currently selected node ids. */
|
|
35
|
+
selectedNodeIds(): NodeID[];
|
|
36
|
+
/** All currently selected edge ids. */
|
|
37
|
+
selectedEdgeIds(): EdgeID[];
|
|
38
|
+
/** Number of selected nodes. */
|
|
39
|
+
nodeCount(): number;
|
|
40
|
+
/** Number of selected edges. */
|
|
41
|
+
edgeCount(): number;
|
|
42
|
+
/** Clear all selections. */
|
|
43
|
+
clear(): this;
|
|
44
|
+
/** True iff nothing is selected. */
|
|
45
|
+
isEmpty(): boolean;
|
|
46
|
+
/** Replace the selection with the given node/edge ids. */
|
|
47
|
+
setSelection(nodes: Iterable<NodeID>, edges?: Iterable<EdgeID>): this;
|
|
48
|
+
/** Snapshot the current selection as plain arrays. */
|
|
49
|
+
toJSON(): {
|
|
50
|
+
nodes: NodeID[];
|
|
51
|
+
edges: EdgeID[];
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** Default viewport: centered at origin, zoom 1. Convenience alias. */
|
|
55
|
+
export declare const IDENTITY_VIEWPORT: Viewport;
|
|
56
|
+
/**
|
|
57
|
+
* Transform a point from graph coordinates to viewport (screen) coordinates.
|
|
58
|
+
*
|
|
59
|
+
* The viewport centers on `(centerX, centerY)` in graph coordinates and
|
|
60
|
+
* applies a uniform `zoom` factor. The transform is:
|
|
61
|
+
*
|
|
62
|
+
* ```
|
|
63
|
+
* screen.x = (graph.x - centerX) * zoom
|
|
64
|
+
* screen.y = (graph.y - centerY) * zoom
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @param point a point in graph coordinates
|
|
68
|
+
* @param viewport pan/zoom state
|
|
69
|
+
*/
|
|
70
|
+
export declare function applyViewport(point: Point, viewport: Viewport): Point;
|
|
71
|
+
/** Inverse of `applyViewport`: map a screen-space point back into graph space. */
|
|
72
|
+
export declare function inverseViewport(point: Point, viewport: Viewport): Point;
|
|
73
|
+
/**
|
|
74
|
+
* Compute a new viewport that pans so that the given graph-space point appears
|
|
75
|
+
* at the given screen-space point.
|
|
76
|
+
*
|
|
77
|
+
* @param graphPoint a point in graph coordinates to anchor
|
|
78
|
+
* @param screenPoint where it should appear in screen coordinates
|
|
79
|
+
* @param zoom the zoom factor (preserved)
|
|
80
|
+
*/
|
|
81
|
+
export declare function panTo(graphPoint: Point, screenPoint: Point, zoom: number): Viewport;
|
|
82
|
+
/** Create a viewport that zooms by `factor` while keeping `anchor` (screen point) fixed. */
|
|
83
|
+
export declare function zoomAt(viewport: Viewport, anchor: Point, factor: number): Viewport;
|
|
84
|
+
//# sourceMappingURL=interactive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../../../src/interactive/interactive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEnE,oDAAoD;AACpD,eAAO,MAAM,gBAAgB,EAAE,QAA8C,CAAC;AAE9E,0EAA0E;AAC1E,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0B;IACxD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0B;IAEx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KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,CAMvE;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAOnF;AAED,4FAA4F;AAC5F,wBAAgB,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,CAMlF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/weave — layout module barrel.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export { mulberry32, forceDirected, hierarchical, radial, grid, } from './layout.js';
|
|
8
|
+
export type { LayoutOptions, ForceDirectedOptions, HierarchicalOptions, RadialOptions, GridOptions, } from './layout.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,UAAU,EACV,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,GAC1C,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EACxD,aAAa,EAAE,WAAW,GAC3B,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/weave — layout algorithms.
|
|
3
|
+
*
|
|
4
|
+
* Computes 2-D positions for graph nodes. Four algorithms are provided:
|
|
5
|
+
* - `forceDirected` — simple Fruchterman-Reingold force simulation.
|
|
6
|
+
* - `hierarchical` — top-down layered layout (Sugiyama-style simplified).
|
|
7
|
+
* - `radial` — concentric rings around a root.
|
|
8
|
+
* - `grid` — regular rectangular grid.
|
|
9
|
+
*
|
|
10
|
+
* Every algorithm is **deterministic** for a given input: the force-directed
|
|
11
|
+
* layout accepts a numeric `seed` and uses a seeded PRNG (mulberry32).
|
|
12
|
+
*
|
|
13
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
14
|
+
* Licensed under the Apache License, Version 2.0.
|
|
15
|
+
*/
|
|
16
|
+
import type { NodeID, Layout } from '../types.js';
|
|
17
|
+
import type { Graph } from '../graph/graph.js';
|
|
18
|
+
/** Common options for layout algorithms. */
|
|
19
|
+
export interface LayoutOptions {
|
|
20
|
+
/** Canvas width. Default 800. */
|
|
21
|
+
width?: number;
|
|
22
|
+
/** Canvas height. Default 600. */
|
|
23
|
+
height?: number;
|
|
24
|
+
/** Padding from canvas edges. Default 40. */
|
|
25
|
+
padding?: number;
|
|
26
|
+
}
|
|
27
|
+
/** Force-directed layout options. */
|
|
28
|
+
export interface ForceDirectedOptions extends LayoutOptions {
|
|
29
|
+
/** Number of simulation iterations. Default 300. */
|
|
30
|
+
iterations?: number;
|
|
31
|
+
/** Numeric RNG seed for deterministic output. Default 1. */
|
|
32
|
+
seed?: number;
|
|
33
|
+
/** Ideal edge length. Default computed from canvas. */
|
|
34
|
+
idealLength?: number;
|
|
35
|
+
/** Repulsion constant. Default 1.0. */
|
|
36
|
+
repulsion?: number;
|
|
37
|
+
}
|
|
38
|
+
/** Hierarchical layout options. */
|
|
39
|
+
export interface HierarchicalOptions extends LayoutOptions {
|
|
40
|
+
/** Vertical gap between layers. Default 80. */
|
|
41
|
+
layerGap?: number;
|
|
42
|
+
/** Horizontal gap between nodes in a layer. Default 80. */
|
|
43
|
+
nodeGap?: number;
|
|
44
|
+
/** Optional root node id; if absent, nodes with in-degree 0 are used. */
|
|
45
|
+
root?: NodeID;
|
|
46
|
+
}
|
|
47
|
+
/** Radial layout options. */
|
|
48
|
+
export interface RadialOptions extends LayoutOptions {
|
|
49
|
+
/** Root node id at the center. If absent, the first node is used. */
|
|
50
|
+
root?: NodeID;
|
|
51
|
+
/** Gap between rings. Default 100. */
|
|
52
|
+
ringGap?: number;
|
|
53
|
+
}
|
|
54
|
+
/** Grid layout options. */
|
|
55
|
+
export interface GridOptions extends LayoutOptions {
|
|
56
|
+
/** Optional number of columns; if absent, computed as ceil(sqrt(n)). */
|
|
57
|
+
columns?: number;
|
|
58
|
+
/** Horizontal gap. Default 80. */
|
|
59
|
+
cellWidth?: number;
|
|
60
|
+
/** Vertical gap. Default 80. */
|
|
61
|
+
cellHeight?: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Seeded PRNG (mulberry32). Returns a function producing floats in [0, 1).
|
|
65
|
+
*/
|
|
66
|
+
export declare function mulberry32(seed: number): () => number;
|
|
67
|
+
/**
|
|
68
|
+
* Force-directed layout (simplified Fruchterman-Reingold).
|
|
69
|
+
*
|
|
70
|
+
* @param graph input graph
|
|
71
|
+
* @param opts options
|
|
72
|
+
* @returns layout map
|
|
73
|
+
*/
|
|
74
|
+
export declare function forceDirected(graph: Graph, opts?: ForceDirectedOptions): Layout;
|
|
75
|
+
/**
|
|
76
|
+
* Hierarchical top-down layered layout.
|
|
77
|
+
*
|
|
78
|
+
* Layers are computed via longest-path layering from a root set. Nodes within
|
|
79
|
+
* a layer are placed left-to-right in alphabetical id order for determinism.
|
|
80
|
+
*/
|
|
81
|
+
export declare function hierarchical(graph: Graph, opts?: HierarchicalOptions): Layout;
|
|
82
|
+
/**
|
|
83
|
+
* Radial layout — concentric rings around a root.
|
|
84
|
+
*
|
|
85
|
+
* The root is at the canvas center; nodes are placed on rings according to
|
|
86
|
+
* their BFS depth from the root, evenly spaced on each ring.
|
|
87
|
+
*/
|
|
88
|
+
export declare function radial(graph: Graph, opts?: RadialOptions): Layout;
|
|
89
|
+
/**
|
|
90
|
+
* Grid layout — regular rectangular grid.
|
|
91
|
+
*
|
|
92
|
+
* Nodes are placed in row-major order, sorted by id for determinism.
|
|
93
|
+
*/
|
|
94
|
+
export declare function grid(graph: Graph, opts?: GridOptions): Layout;
|
|
95
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../src/layout/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAS,MAAM,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG/C,4CAA4C;AAC5C,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qCAAqC;AACrC,MAAM,WAAW,oBAAqB,SAAQ,aAAa;IACzD,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,mCAAmC;AACnC,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,6BAA6B;AAC7B,MAAM,WAAW,aAAc,SAAQ,aAAa;IAClD,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,2BAA2B;AAC3B,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,MAAM,CASrD;AAyBD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,GAAE,oBAAyB,GAAG,MAAM,CA4FnF;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,GAAE,mBAAwB,GAAG,MAAM,CA+EjF;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,GAAE,aAAkB,GAAG,MAAM,CAgErE;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,GAAE,WAAgB,GAAG,MAAM,CAqBjE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/weave — structured logging (mirrors @manya-os/keyring pattern).
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export interface Logger {
|
|
8
|
+
debug(msg: string, meta?: Record<string, unknown>): void;
|
|
9
|
+
info(msg: string, meta?: Record<string, unknown>): void;
|
|
10
|
+
warn(msg: string, meta?: Record<string, unknown>): void;
|
|
11
|
+
error(msg: string, meta?: Record<string, unknown>): void;
|
|
12
|
+
}
|
|
13
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
14
|
+
export declare const SCRUBBED_FIELD_NAMES: readonly ["token", "secret", "apiKey", "password", "credentials", "cookie"];
|
|
15
|
+
export declare function shouldScrubField(name: string): boolean;
|
|
16
|
+
export declare function scrubMetadata(meta: unknown): unknown;
|
|
17
|
+
export declare class ConsoleLogger implements Logger {
|
|
18
|
+
private readonly level;
|
|
19
|
+
private readonly levelRank;
|
|
20
|
+
constructor(level?: LogLevel);
|
|
21
|
+
debug(msg: string, meta?: Record<string, unknown>): void;
|
|
22
|
+
info(msg: string, meta?: Record<string, unknown>): void;
|
|
23
|
+
warn(msg: string, meta?: Record<string, unknown>): void;
|
|
24
|
+
error(msg: string, meta?: Record<string, unknown>): void;
|
|
25
|
+
private emit;
|
|
26
|
+
}
|
|
27
|
+
export declare class SilentLogger implements Logger {
|
|
28
|
+
debug(): void;
|
|
29
|
+
info(): void;
|
|
30
|
+
warn(): void;
|
|
31
|
+
error(): void;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/logging.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACxD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC1D;AAED,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAMtE,eAAO,MAAM,oBAAoB,6EAEvB,CAAC;AAEX,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQtD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAWpD;AAED,qBAAa,aAAc,YAAW,MAAM;IAE9B,OAAO,CAAC,QAAQ,CAAC,KAAK;IADlC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBACN,KAAK,GAAE,QAAiB;IAGrD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IACxD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IACvD,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IACvD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IACxD,OAAO,CAAC,IAAI;CASb;AAED,qBAAa,YAAa,YAAW,MAAM;IACzC,KAAK,IAAI,IAAI;IACb,IAAI,IAAI,IAAI;IACZ,IAAI,IAAI,IAAI;IACZ,KAAK,IAAI,IAAI;CACd"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/weave — render module barrel.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export { renderToSVG, mergeRenderConfig, DEFAULT_RENDER_CONFIG } from './renderer.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/render/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/weave — SVG renderer with full configuration.
|
|
3
|
+
*
|
|
4
|
+
* `renderToSVG` produces a complete SVG document with configurable colors,
|
|
5
|
+
* node radius, font size, and optional label rendering. It is the
|
|
6
|
+
* feature-complete counterpart to the minimal `toSVG` in `@manya-os/weave/export`.
|
|
7
|
+
*
|
|
8
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
9
|
+
* Licensed under the Apache License, Version 2.0.
|
|
10
|
+
*/
|
|
11
|
+
import type { RenderConfig, Layout } from '../types.js';
|
|
12
|
+
import type { Graph } from '../graph/graph.js';
|
|
13
|
+
/** Default render configuration. */
|
|
14
|
+
export declare const DEFAULT_RENDER_CONFIG: RenderConfig;
|
|
15
|
+
/** Merge a partial config with defaults. */
|
|
16
|
+
export declare function mergeRenderConfig(partial?: Partial<RenderConfig>): RenderConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Render a graph to a full SVG document.
|
|
19
|
+
*
|
|
20
|
+
* @param graph input graph
|
|
21
|
+
* @param layout node positions
|
|
22
|
+
* @param config render configuration (partial OK; merged with defaults)
|
|
23
|
+
* @returns SVG string
|
|
24
|
+
*/
|
|
25
|
+
export declare function renderToSVG(graph: Graph, layout: Layout, config?: Partial<RenderConfig>): string;
|
|
26
|
+
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../../src/render/renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG/C,oCAAoC;AACpC,eAAO,MAAM,qBAAqB,EAAE,YASnC,CAAC;AAEF,4CAA4C;AAC5C,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAG/E;AAYD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC7B,MAAM,CA6DR"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @manya-os/weave — search module barrel.
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2024 Manya Hael Foundation. All rights reserved.
|
|
5
|
+
* Licensed under the Apache License, Version 2.0.
|
|
6
|
+
*/
|
|
7
|
+
export { levenshtein, similarity, search, fuzzySearch, bfsPath, dijkstra, } from './search.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/search/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,WAAW,EAAE,UAAU,EACvB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,QAAQ,GAClB,MAAM,aAAa,CAAC"}
|