@nicia-ai/typegraph 0.18.0 → 0.20.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/dist/index.cjs +454 -95
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +454 -95
- package/dist/index.js.map +1 -1
- package/dist/interchange/index.d.cts +1 -1
- package/dist/interchange/index.d.ts +1 -1
- package/dist/profiler/index.d.cts +1 -1
- package/dist/profiler/index.d.ts +1 -1
- package/dist/{store-DkY1pDfu.d.ts → store-BMrRi_mY.d.ts} +256 -19
- package/dist/{store-B_JzzHwb.d.cts → store-DRRvALu8.d.cts} +256 -19
- package/package.json +5 -5
|
@@ -2,7 +2,7 @@ import { S as SqlSchema, G as GraphBackend, T as TransactionBackend, E as EdgeRo
|
|
|
2
2
|
import { K as KindRegistry, G as GraphDef, E as EdgeKinds, N as NodeKinds, a as AllNodeTypes, S as SchemaManagerOptions, d as SchemaValidationResult } from './manager-Bj1UEnhE.cjs';
|
|
3
3
|
import { S as SqlDialect, N as NodeType, A as AnyEdgeType, T as TemporalMode, E as EdgeType, d as EdgeRegistration, b as EdgeId, g as NodeId, i as NodeRegistration } from './types-DMzKq0d5.cjs';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { V as ValueType, i as PredicateExpression, k as VectorMetricType, Q as QueryAst, J as JsonPointer, F as FieldRef, P as ParameterRef, c as JsonPointerInput, T as TraversalExpansion, l as Traversal, N as NodePredicate, m as ProjectedField, O as OrderSpec, G as GroupBySpec, o as RecursiveCyclePolicy, q as TraversalDirection, A as AggregateExpr, r as SelectiveField, s as ComposableQuery, t as SetOperationType, u as SetOperation, S as SortDirection } from './ast-Bh2NDeaK.cjs';
|
|
5
|
+
import { V as ValueType, i as PredicateExpression, k as VectorMetricType, Q as QueryAst, J as JsonPointer, F as FieldRef, P as ParameterRef, c as JsonPointerInput, T as TraversalExpansion, l as Traversal, N as NodePredicate, m as ProjectedField, O as OrderSpec, G as GroupBySpec, o as RecursiveCyclePolicy, q as TraversalDirection$1, A as AggregateExpr, r as SelectiveField, s as ComposableQuery, t as SetOperationType, u as SetOperation, S as SortDirection } from './ast-Bh2NDeaK.cjs';
|
|
6
6
|
import { SQL } from 'drizzle-orm';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -273,7 +273,7 @@ type BatchResults<Queries extends readonly BatchableQuery<unknown>[]> = {
|
|
|
273
273
|
* // ValidEdgeTargets<G, "worksAt", "out"> = "Company" | "Organization"
|
|
274
274
|
* // ValidEdgeTargets<G, "worksAt", "in"> = "Person"
|
|
275
275
|
*/
|
|
276
|
-
type ValidEdgeTargets<G extends GraphDef, EK extends keyof G["edges"] & string, Dir extends TraversalDirection> = G["edges"][EK] extends EdgeRegistration ? Dir extends "out" ? G["edges"][EK]["to"][number]["kind"] : G["edges"][EK]["from"][number]["kind"] : never;
|
|
276
|
+
type ValidEdgeTargets<G extends GraphDef, EK extends keyof G["edges"] & string, Dir extends TraversalDirection$1> = G["edges"][EK] extends EdgeRegistration ? Dir extends "out" ? G["edges"][EK]["to"][number]["kind"] : G["edges"][EK]["from"][number]["kind"] : never;
|
|
277
277
|
/**
|
|
278
278
|
* A node alias with its associated type.
|
|
279
279
|
*/
|
|
@@ -1485,6 +1485,13 @@ type SubgraphOptions<G extends GraphDef, EK extends EdgeKinds<G>, NK extends Nod
|
|
|
1485
1485
|
direction?: "out" | "both";
|
|
1486
1486
|
/** Cycle policy — reuse RecursiveCyclePolicy (default: "prevent"). */
|
|
1487
1487
|
cyclePolicy?: RecursiveCyclePolicy;
|
|
1488
|
+
/**
|
|
1489
|
+
* Temporal mode applied to both nodes and edges along the traversal and in
|
|
1490
|
+
* the hydrated result. Defaults to `graph.defaults.temporalMode`.
|
|
1491
|
+
*/
|
|
1492
|
+
temporalMode?: TemporalMode;
|
|
1493
|
+
/** ISO-8601 timestamp used when `temporalMode === "asOf"`. */
|
|
1494
|
+
asOf?: string;
|
|
1488
1495
|
/**
|
|
1489
1496
|
* Optional field-level projection per node/edge kind.
|
|
1490
1497
|
*
|
|
@@ -1497,13 +1504,26 @@ type SubgraphOptions<G extends GraphDef, EK extends EdgeKinds<G>, NK extends Nod
|
|
|
1497
1504
|
*/
|
|
1498
1505
|
project?: P;
|
|
1499
1506
|
}>;
|
|
1507
|
+
/**
|
|
1508
|
+
* Union of all node result types in a subgraph, respecting projection.
|
|
1509
|
+
*/
|
|
1510
|
+
type SubgraphNodeResult<G extends GraphDef, NK extends NodeKinds<G> = NodeKinds<G>, P = undefined> = {
|
|
1511
|
+
[Kind in NK]: SubgraphNodeResultForKind<G, Kind, P>;
|
|
1512
|
+
}[NK];
|
|
1513
|
+
/**
|
|
1514
|
+
* Union of all edge result types in a subgraph, respecting projection.
|
|
1515
|
+
*/
|
|
1516
|
+
type SubgraphEdgeResult<G extends GraphDef, EK extends EdgeKinds<G> = EdgeKinds<G>, P = undefined> = {
|
|
1517
|
+
[Kind in EK]: SubgraphEdgeResultForKind<G, Kind, P>;
|
|
1518
|
+
}[EK];
|
|
1500
1519
|
type SubgraphResult<G extends GraphDef, NK extends NodeKinds<G> = NodeKinds<G>, EK extends EdgeKinds<G> = EdgeKinds<G>, P extends SubgraphProject<G, NK, EK> | undefined = undefined> = Readonly<{
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1520
|
+
/** The root node, or undefined if the root was not found or excluded. */
|
|
1521
|
+
root: SubgraphNodeResult<G, NK, P> | undefined;
|
|
1522
|
+
nodes: ReadonlyMap<string, SubgraphNodeResult<G, NK, P>>;
|
|
1523
|
+
/** Forward adjacency: fromId → edgeKind → edges to targets. */
|
|
1524
|
+
adjacency: ReadonlyMap<string, ReadonlyMap<EK, readonly SubgraphEdgeResult<G, EK, P>[]>>;
|
|
1525
|
+
/** Reverse adjacency: toId → edgeKind → edges from sources. */
|
|
1526
|
+
reverseAdjacency: ReadonlyMap<string, ReadonlyMap<EK, readonly SubgraphEdgeResult<G, EK, P>[]>>;
|
|
1507
1527
|
}>;
|
|
1508
1528
|
|
|
1509
1529
|
/**
|
|
@@ -1853,7 +1873,7 @@ interface VariableLengthState {
|
|
|
1853
1873
|
* Type parameters track the edge kind and direction to constrain
|
|
1854
1874
|
* which node kinds are valid targets in the `to()` method.
|
|
1855
1875
|
*/
|
|
1856
|
-
declare class TraversalBuilder<G extends GraphDef, Aliases extends AliasMap, EdgeAliases extends EdgeAliasMap = {}, EK extends keyof G["edges"] & string = keyof G["edges"] & string, EA extends string = string, Dir extends TraversalDirection = "out", Optional extends boolean = false, DC extends boolean | string = false, PC extends boolean | string = false, RecAliases extends RecursiveAliasMap = {}> {
|
|
1876
|
+
declare class TraversalBuilder<G extends GraphDef, Aliases extends AliasMap, EdgeAliases extends EdgeAliasMap = {}, EK extends keyof G["edges"] & string = keyof G["edges"] & string, EA extends string = string, Dir extends TraversalDirection$1 = "out", Optional extends boolean = false, DC extends boolean | string = false, PC extends boolean | string = false, RecAliases extends RecursiveAliasMap = {}> {
|
|
1857
1877
|
#private;
|
|
1858
1878
|
constructor(config: QueryBuilderConfig, state: QueryBuilderState, edgeKinds: readonly string[], edgeAlias: EA, direction: Dir, fromAlias: string, inverseEdgeKinds?: readonly string[], optional?: Optional, variableLength?: VariableLengthState, pendingEdgePredicates?: readonly NodePredicate[]);
|
|
1859
1879
|
/**
|
|
@@ -2060,6 +2080,198 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2060
2080
|
pipe<OutAliases extends AliasMap, OutEdgeAliases extends EdgeAliasMap = EdgeAliases, OutRecAliases extends RecursiveAliasMap = RecursiveAliases>(fragment: (builder: QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>) => QueryBuilder<G, OutAliases, OutEdgeAliases, OutRecAliases>): QueryBuilder<G, OutAliases, OutEdgeAliases, OutRecAliases>;
|
|
2061
2081
|
}
|
|
2062
2082
|
|
|
2083
|
+
/**
|
|
2084
|
+
* Shared types for Tier 1 graph algorithms.
|
|
2085
|
+
*
|
|
2086
|
+
* Algorithms operate over one or more edge kinds and may traverse edges
|
|
2087
|
+
* in the forward direction ("out"), reverse ("in"), or undirected ("both").
|
|
2088
|
+
*/
|
|
2089
|
+
|
|
2090
|
+
/**
|
|
2091
|
+
* Direction of edge traversal.
|
|
2092
|
+
*
|
|
2093
|
+
* - `"out"` — follow edges from source to target (default)
|
|
2094
|
+
* - `"in"` — follow edges from target back to source
|
|
2095
|
+
* - `"both"` — undirected traversal over either endpoint
|
|
2096
|
+
*/
|
|
2097
|
+
type TraversalDirection = "out" | "in" | "both";
|
|
2098
|
+
/**
|
|
2099
|
+
* Cycle-handling strategy during recursive traversal.
|
|
2100
|
+
*
|
|
2101
|
+
* - `"prevent"` — skip any node already on the current path (default).
|
|
2102
|
+
* Guarantees termination even in cyclic graphs.
|
|
2103
|
+
* - `"allow"` — permit revisiting nodes. Only safe with a bounded `maxHops`.
|
|
2104
|
+
*
|
|
2105
|
+
* Aliased to `RecursiveCyclePolicy` so algorithms and query-builder traversals
|
|
2106
|
+
* share a single canonical union.
|
|
2107
|
+
*/
|
|
2108
|
+
type AlgorithmCyclePolicy = RecursiveCyclePolicy;
|
|
2109
|
+
/**
|
|
2110
|
+
* Temporal filter options shared by every algorithm.
|
|
2111
|
+
*
|
|
2112
|
+
* Algorithms honor the same temporal model as the rest of the store: both
|
|
2113
|
+
* nodes and edges are filtered according to the resolved mode. `asOf` is
|
|
2114
|
+
* only consulted when the resolved mode is `"asOf"`. If neither option is
|
|
2115
|
+
* supplied, the algorithm falls back to `graph.defaults.temporalMode`.
|
|
2116
|
+
*/
|
|
2117
|
+
type TemporalAlgorithmOptions = Readonly<{
|
|
2118
|
+
/** Temporal mode. Defaults to the graph's configured default. */
|
|
2119
|
+
temporalMode?: TemporalMode;
|
|
2120
|
+
/**
|
|
2121
|
+
* ISO-8601 timestamp used when `temporalMode` is `"asOf"`. Required in that
|
|
2122
|
+
* mode; ignored in all others.
|
|
2123
|
+
*/
|
|
2124
|
+
asOf?: string;
|
|
2125
|
+
}>;
|
|
2126
|
+
/**
|
|
2127
|
+
* Base options for traversal-style algorithms.
|
|
2128
|
+
*/
|
|
2129
|
+
type BaseTraversalOptions<G extends GraphDef> = TemporalAlgorithmOptions & Readonly<{
|
|
2130
|
+
/** Edge kinds to follow. At least one kind is required. */
|
|
2131
|
+
edges: readonly EdgeKinds<G>[];
|
|
2132
|
+
/**
|
|
2133
|
+
* Maximum number of hops to traverse. Defaults to 10.
|
|
2134
|
+
* Must be between 1 and 1000.
|
|
2135
|
+
*/
|
|
2136
|
+
maxHops?: number;
|
|
2137
|
+
/** Direction of traversal (default: `"out"`). */
|
|
2138
|
+
direction?: TraversalDirection;
|
|
2139
|
+
/** Cycle policy (default: `"prevent"`). */
|
|
2140
|
+
cyclePolicy?: AlgorithmCyclePolicy;
|
|
2141
|
+
}>;
|
|
2142
|
+
/**
|
|
2143
|
+
* A node reached during traversal, annotated with the shortest depth at which
|
|
2144
|
+
* it was first discovered.
|
|
2145
|
+
*/
|
|
2146
|
+
type ReachableNode = Readonly<{
|
|
2147
|
+
id: string;
|
|
2148
|
+
kind: string;
|
|
2149
|
+
/** Number of edges traversed from the source. 0 for the source itself. */
|
|
2150
|
+
depth: number;
|
|
2151
|
+
}>;
|
|
2152
|
+
/**
|
|
2153
|
+
* A node along a shortest path. Endpoints are included.
|
|
2154
|
+
*/
|
|
2155
|
+
type PathNode = Readonly<{
|
|
2156
|
+
id: string;
|
|
2157
|
+
kind: string;
|
|
2158
|
+
}>;
|
|
2159
|
+
/**
|
|
2160
|
+
* Result of `shortestPath`: the ordered node sequence and its length in hops.
|
|
2161
|
+
*/
|
|
2162
|
+
type ShortestPathResult = Readonly<{
|
|
2163
|
+
/** Ordered nodes from source to target (inclusive). */
|
|
2164
|
+
nodes: readonly PathNode[];
|
|
2165
|
+
/** Number of edges traversed. Equals `nodes.length - 1`. */
|
|
2166
|
+
depth: number;
|
|
2167
|
+
}>;
|
|
2168
|
+
/**
|
|
2169
|
+
* Options for `shortestPath` and `canReach`. Reuses the base traversal
|
|
2170
|
+
* options; cycle policy defaults to `"prevent"` since both algorithms only
|
|
2171
|
+
* care about the first time a target is reached.
|
|
2172
|
+
*/
|
|
2173
|
+
type ShortestPathOptions<G extends GraphDef> = BaseTraversalOptions<G>;
|
|
2174
|
+
/**
|
|
2175
|
+
* Options for `reachable`.
|
|
2176
|
+
*
|
|
2177
|
+
* Returns every node reachable from the source within `maxHops`, each
|
|
2178
|
+
* annotated with its minimum discovered depth. `depth: 0` refers to the
|
|
2179
|
+
* source itself and is included unless `excludeSource` is `true`.
|
|
2180
|
+
*/
|
|
2181
|
+
type ReachableOptions<G extends GraphDef> = BaseTraversalOptions<G> & Readonly<{
|
|
2182
|
+
/** Exclude the source node from the result set (default: `false`). */
|
|
2183
|
+
excludeSource?: boolean;
|
|
2184
|
+
}>;
|
|
2185
|
+
/**
|
|
2186
|
+
* Options for `neighbors`.
|
|
2187
|
+
*
|
|
2188
|
+
* Like `reachable`, but the parameter is named `depth` for readability —
|
|
2189
|
+
* "2-hop neighbors" reads more naturally than "reachable with maxHops=2".
|
|
2190
|
+
* The source is always excluded.
|
|
2191
|
+
*/
|
|
2192
|
+
type NeighborsOptions<G extends GraphDef> = TemporalAlgorithmOptions & Readonly<{
|
|
2193
|
+
/** Edge kinds to follow. At least one kind is required. */
|
|
2194
|
+
edges: readonly EdgeKinds<G>[];
|
|
2195
|
+
/** Maximum neighborhood depth (default: 1). Must be between 1 and 1000. */
|
|
2196
|
+
depth?: number;
|
|
2197
|
+
/** Direction of traversal (default: `"out"`). */
|
|
2198
|
+
direction?: TraversalDirection;
|
|
2199
|
+
/** Cycle policy (default: `"prevent"`). */
|
|
2200
|
+
cyclePolicy?: AlgorithmCyclePolicy;
|
|
2201
|
+
}>;
|
|
2202
|
+
/**
|
|
2203
|
+
* Options for `degree`.
|
|
2204
|
+
*
|
|
2205
|
+
* Counts active edges incident to a node. With `direction: "both"`, an edge
|
|
2206
|
+
* that happens to be a self-loop (from === to) is counted once, not twice.
|
|
2207
|
+
*/
|
|
2208
|
+
type DegreeOptions<G extends GraphDef> = TemporalAlgorithmOptions & Readonly<{
|
|
2209
|
+
/**
|
|
2210
|
+
* Edge kinds to count. If omitted, counts across all edge kinds in the
|
|
2211
|
+
* graph.
|
|
2212
|
+
*/
|
|
2213
|
+
edges?: readonly EdgeKinds<G>[];
|
|
2214
|
+
/** Direction (default: `"both"`). */
|
|
2215
|
+
direction?: TraversalDirection;
|
|
2216
|
+
}>;
|
|
2217
|
+
|
|
2218
|
+
/**
|
|
2219
|
+
* Raw node id or any object with an `id: string` field. Covers `Node`,
|
|
2220
|
+
* `NodeRef`, and the lightweight `ReachableNode` / `PathNode` shapes
|
|
2221
|
+
* returned by the algorithms themselves.
|
|
2222
|
+
*
|
|
2223
|
+
* Deliberately kind-agnostic: graph algorithms don't constrain the source
|
|
2224
|
+
* node's kind — you can start a traversal from any node reachable via the
|
|
2225
|
+
* given edge kinds. `NodeRef<N>` exists for the edge-endpoint case where
|
|
2226
|
+
* kind *is* load-bearing; using it here would paint a constraint onto a
|
|
2227
|
+
* contract that doesn't need one and would reject common patterns like
|
|
2228
|
+
* passing `ReachableNode` / cache entries / `{ id }` records straight
|
|
2229
|
+
* through.
|
|
2230
|
+
*/
|
|
2231
|
+
type NodeIdentifier = string | Readonly<{
|
|
2232
|
+
id: string;
|
|
2233
|
+
}>;
|
|
2234
|
+
type GraphAlgorithms<G extends GraphDef> = Readonly<{
|
|
2235
|
+
/**
|
|
2236
|
+
* Finds the shortest directed path from `from` to `to` using the given
|
|
2237
|
+
* edge kinds. Returns `undefined` when no path exists within `maxHops`.
|
|
2238
|
+
*
|
|
2239
|
+
* @example
|
|
2240
|
+
* ```typescript
|
|
2241
|
+
* const path = await store.algorithms.shortestPath(alice, bob, {
|
|
2242
|
+
* edges: ["knows"],
|
|
2243
|
+
* maxHops: 6,
|
|
2244
|
+
* });
|
|
2245
|
+
* if (path) {
|
|
2246
|
+
* console.log(`${path.depth} hops via`, path.nodes.map((n) => n.id));
|
|
2247
|
+
* }
|
|
2248
|
+
* ```
|
|
2249
|
+
*/
|
|
2250
|
+
shortestPath: (from: NodeIdentifier, to: NodeIdentifier, options: ShortestPathOptions<G>) => Promise<ShortestPathResult | undefined>;
|
|
2251
|
+
/**
|
|
2252
|
+
* Returns every node reachable from `from` within `maxHops` edges of the
|
|
2253
|
+
* allowed kinds. Each node carries its minimum discovered depth.
|
|
2254
|
+
*/
|
|
2255
|
+
reachable: (from: NodeIdentifier, options: ReachableOptions<G>) => Promise<readonly ReachableNode[]>;
|
|
2256
|
+
/**
|
|
2257
|
+
* Fast boolean check: is `to` reachable from `from` within `maxHops`
|
|
2258
|
+
* edges? Short-circuits the underlying recursive CTE with `LIMIT 1`.
|
|
2259
|
+
*/
|
|
2260
|
+
canReach: (from: NodeIdentifier, to: NodeIdentifier, options: BaseTraversalOptions<G>) => Promise<boolean>;
|
|
2261
|
+
/**
|
|
2262
|
+
* Returns the k-hop neighborhood of a node. The source is always
|
|
2263
|
+
* excluded. `depth` defaults to 1, matching the common "immediate
|
|
2264
|
+
* neighbors" interpretation.
|
|
2265
|
+
*/
|
|
2266
|
+
neighbors: (node: NodeIdentifier, options: NeighborsOptions<G>) => Promise<readonly ReachableNode[]>;
|
|
2267
|
+
/**
|
|
2268
|
+
* Counts active edges incident to `node`.
|
|
2269
|
+
*
|
|
2270
|
+
* With `direction: "both"` (default), self-loops contribute once.
|
|
2271
|
+
*/
|
|
2272
|
+
degree: (node: NodeIdentifier, options?: DegreeOptions<G>) => Promise<number>;
|
|
2273
|
+
}>;
|
|
2274
|
+
|
|
2063
2275
|
/**
|
|
2064
2276
|
* Main Store implementation for TypeGraph.
|
|
2065
2277
|
*
|
|
@@ -2148,6 +2360,27 @@ declare class Store<G extends GraphDef> {
|
|
|
2148
2360
|
* ```
|
|
2149
2361
|
*/
|
|
2150
2362
|
get edges(): GraphEdgeCollections<G>;
|
|
2363
|
+
/**
|
|
2364
|
+
* Tier 1 graph algorithms: shortest path, reachability, neighborhoods, and
|
|
2365
|
+
* degree centrality.
|
|
2366
|
+
*
|
|
2367
|
+
* Each call compiles to a single recursive-CTE query against the backend.
|
|
2368
|
+
* The facade is built lazily on first access and cached for the lifetime
|
|
2369
|
+
* of the store.
|
|
2370
|
+
*
|
|
2371
|
+
* @example
|
|
2372
|
+
* ```typescript
|
|
2373
|
+
* const path = await store.algorithms.shortestPath(alice, bob, {
|
|
2374
|
+
* edges: ["knows"],
|
|
2375
|
+
* });
|
|
2376
|
+
*
|
|
2377
|
+
* const friends = await store.algorithms.neighbors(alice, {
|
|
2378
|
+
* edges: ["knows"],
|
|
2379
|
+
* depth: 2,
|
|
2380
|
+
* });
|
|
2381
|
+
* ```
|
|
2382
|
+
*/
|
|
2383
|
+
get algorithms(): GraphAlgorithms<G>;
|
|
2151
2384
|
/**
|
|
2152
2385
|
* Returns the node collection for the given kind, or undefined if the kind
|
|
2153
2386
|
* is not registered in this graph.
|
|
@@ -2216,22 +2449,26 @@ declare class Store<G extends GraphDef> {
|
|
|
2216
2449
|
* Extracts a typed subgraph by traversing from a root node.
|
|
2217
2450
|
*
|
|
2218
2451
|
* Performs a BFS traversal from `rootId` following the specified edge kinds,
|
|
2219
|
-
*
|
|
2452
|
+
* returning an indexed result with adjacency maps for immediate traversal.
|
|
2220
2453
|
*
|
|
2221
2454
|
* @example
|
|
2222
2455
|
* ```typescript
|
|
2223
|
-
* const
|
|
2456
|
+
* const sg = await store.subgraph(run.id, {
|
|
2224
2457
|
* edges: ["has_task", "runs_agent", "uses_skill"],
|
|
2225
2458
|
* maxDepth: 4,
|
|
2226
|
-
* includeKinds: ["Run", "Task", "Agent", "Skill"],
|
|
2227
2459
|
* });
|
|
2228
2460
|
*
|
|
2229
|
-
*
|
|
2230
|
-
*
|
|
2231
|
-
*
|
|
2232
|
-
*
|
|
2233
|
-
*
|
|
2234
|
-
*
|
|
2461
|
+
* // Root node (the traversal starting point)
|
|
2462
|
+
* console.log(sg.root?.kind);
|
|
2463
|
+
*
|
|
2464
|
+
* // Lookup by ID
|
|
2465
|
+
* const task = sg.nodes.get(taskId);
|
|
2466
|
+
*
|
|
2467
|
+
* // Forward adjacency: edges of a kind from a node
|
|
2468
|
+
* const taskEdges = sg.adjacency.get(run.id)?.get("has_task") ?? [];
|
|
2469
|
+
*
|
|
2470
|
+
* // Reverse adjacency: edges of a kind pointing to a node
|
|
2471
|
+
* const parentEdges = sg.reverseAdjacency.get(taskId)?.get("has_task") ?? [];
|
|
2235
2472
|
* ```
|
|
2236
2473
|
*/
|
|
2237
2474
|
subgraph<const EK extends EdgeKinds<G>, const NK extends NodeKinds<G> = NodeKinds<G>, const P extends SubgraphProject<G, NK, EK> | undefined = undefined>(rootId: NodeId<AllNodeTypes<G>>, options: SubgraphOptions<G, EK, NK, P>): Promise<SubgraphResult<G, NK, EK, P>>;
|
|
@@ -2337,4 +2574,4 @@ declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend
|
|
|
2337
2574
|
*/
|
|
2338
2575
|
declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options?: StoreOptions & SchemaManagerOptions): Promise<[Store<G>, SchemaValidationResult]>;
|
|
2339
2576
|
|
|
2340
|
-
export { type
|
|
2577
|
+
export { type ReachableNode as $, type AliasMap as A, type BaseTraversalOptions as B, type CreateQueryBuilderOptions as C, type DegreeOptions as D, type EdgeAliasMap as E, type FieldAccessor as F, type GetOrCreateAction as G, type HookContext as H, type IfExistsMode as I, type NodeAlias as J, type NodeCollection as K, type NodeGetOrCreateByConstraintOptions as L, type NodeGetOrCreateByConstraintResult as M, type NeighborsOptions as N, type NodeIdentifier as O, type NodeRef as P, QueryBuilder as Q, type OperationHookContext as R, type PaginateOptions as S, TraversalBuilder as T, type PaginatedResult as U, type PathNode as V, type Predicate as W, PreparedQuery as X, type PropsAccessor as Y, type QueryHookContext as Z, type QueryOptions as _, type AggregateResult as a, type ReachableOptions as a0, type RecursiveTraversalOptions as a1, type SelectContext as a2, type SelectableEdge as a3, type SelectableNode as a4, type ShortestPathOptions as a5, type ShortestPathResult as a6, Store as a7, type StoreHooks as a8, type StoreOptions as a9, notInSubquery as aA, param as aB, type StoreProjection as aa, type StreamOptions as ab, type SubgraphEdgeResult as ac, type SubgraphNodeResult as ad, type SubgraphOptions as ae, type SubgraphResult as af, type SubsetEdge as ag, type SubsetNode as ah, type TemporalAlgorithmOptions as ai, type TransactionContext as aj, type TraversalDirection as ak, type TypedEdgeCollection as al, UnionableQuery as am, type UpdateEdgeInput as an, type UpdateNodeInput as ao, createStore as ap, createStoreWithSchema as aq, defineSubgraphProject as ar, embedding as as, exists as at, fieldRef as au, getEmbeddingDimensions as av, inSubquery as aw, isEmbeddingSchema as ax, isParameterRef as ay, notExists as az, type AlgorithmCyclePolicy as b, type AnyEdge as c, type AnyNode as d, type BatchResults as e, type BatchableQuery as f, type ConstraintNames as g, type CreateEdgeInput as h, type CreateNodeInput as i, type DynamicEdgeCollection as j, type DynamicNodeCollection as k, type Edge as l, type EdgeAccessor as m, type EdgeCollection as n, type EdgeFindByEndpointsOptions as o, type EdgeGetOrCreateByEndpointsOptions as p, type EdgeGetOrCreateByEndpointsResult as q, type EmbeddingSchema as r, type EmbeddingValue as s, ExecutableAggregateQuery as t, ExecutableQuery as u, type GraphAlgorithms as v, type GraphEdgeCollections as w, type GraphNodeCollections as x, type Node as y, type NodeAccessor as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nicia-ai/typegraph",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "TypeScript-first embedded knowledge graph library with ontological reasoning",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -155,17 +155,17 @@
|
|
|
155
155
|
"@types/better-sqlite3": "^7.6.13",
|
|
156
156
|
"@types/node": "^24.12.0",
|
|
157
157
|
"@types/pg": "^8.20.0",
|
|
158
|
-
"@vitest/coverage-v8": "^4.1.
|
|
158
|
+
"@vitest/coverage-v8": "^4.1.3",
|
|
159
159
|
"better-sqlite3": "^12.8.0",
|
|
160
160
|
"drizzle-orm": "^0.45.2",
|
|
161
|
-
"eslint": "^10.
|
|
161
|
+
"eslint": "^10.2.0",
|
|
162
162
|
"fast-check": "^4.6.0",
|
|
163
163
|
"pg": "^8.20.0",
|
|
164
|
-
"sqlite-vec": "^0.1.
|
|
164
|
+
"sqlite-vec": "^0.1.9",
|
|
165
165
|
"tsd": "^0.33.0",
|
|
166
166
|
"tsup": "^8.5.1",
|
|
167
167
|
"typescript": "^5.9.3",
|
|
168
|
-
"vitest": "^4.1.
|
|
168
|
+
"vitest": "^4.1.3",
|
|
169
169
|
"zod": "^4.3.6",
|
|
170
170
|
"@typegraph/eslint-config": "0.1.0"
|
|
171
171
|
},
|