@nicia-ai/typegraph 0.15.0 → 0.16.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.
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { G as GraphDef } from '../manager-Bj1UEnhE.cjs';
3
- import { W as Store } from '../store-BNercm8P.cjs';
3
+ import { Y as Store } from '../store-gTd_qa6u.cjs';
4
4
  import '../types-DMzKq0d5.cjs';
5
5
  import '../types-B3mmOMJV.cjs';
6
6
  import 'drizzle-orm';
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { G as GraphDef } from '../manager-Chhrq1vl.js';
3
- import { W as Store } from '../store-CD_0yf2s.js';
3
+ import { Y as Store } from '../store-Bitii3qj.js';
4
4
  import '../types-DMzKq0d5.js';
5
5
  import '../types-ThB4cFLp.js';
6
6
  import 'drizzle-orm';
@@ -1,6 +1,6 @@
1
1
  import { G as GraphDef } from '../manager-Bj1UEnhE.cjs';
2
2
  import { Q as QueryAst } from '../ast-Bh2NDeaK.cjs';
3
- import { W as Store } from '../store-BNercm8P.cjs';
3
+ import { Y as Store } from '../store-gTd_qa6u.cjs';
4
4
  import { P as ProfilerOptions, a as ProfileReport } from '../types-CVtGFpB9.cjs';
5
5
  export { D as DeclaredIndex, I as IndexRecommendation, b as ProfileSummary, c as PropertyAccessStats, d as PropertyPath, R as RecommendationPriority, U as UsageContext } from '../types-CVtGFpB9.cjs';
6
6
  import '../types-DMzKq0d5.cjs';
@@ -1,6 +1,6 @@
1
1
  import { G as GraphDef } from '../manager-Chhrq1vl.js';
2
2
  import { Q as QueryAst } from '../ast-COMyNeMn.js';
3
- import { W as Store } from '../store-CD_0yf2s.js';
3
+ import { Y as Store } from '../store-Bitii3qj.js';
4
4
  import { P as ProfilerOptions, a as ProfileReport } from '../types-COPePE8_.js';
5
5
  export { D as DeclaredIndex, I as IndexRecommendation, b as ProfileSummary, c as PropertyAccessStats, d as PropertyPath, R as RecommendationPriority, U as UsageContext } from '../types-COPePE8_.js';
6
6
  import '../types-DMzKq0d5.js';
@@ -1293,6 +1293,23 @@ type TransactionContext<G extends GraphDef> = Readonly<{
1293
1293
  nodes: GraphNodeCollections<G>;
1294
1294
  edges: GraphEdgeCollections<G>;
1295
1295
  }>;
1296
+ /**
1297
+ * A node collection with widened generics for runtime string-keyed access.
1298
+ *
1299
+ * This is the return type of `store.getNodeCollection(kind)`. It exposes
1300
+ * the full `NodeCollection` API but with `NodeType` and `string` constraint
1301
+ * names instead of the specific generic parameters, since the concrete type
1302
+ * is not known at compile time.
1303
+ */
1304
+ type DynamicNodeCollection = NodeCollection<NodeType, string>;
1305
+ /**
1306
+ * An edge collection with widened generics for runtime string-keyed access.
1307
+ *
1308
+ * This is the return type of `store.getEdgeCollection(kind)`. It exposes
1309
+ * the full `EdgeCollection` API but with `NodeType` endpoint types, since
1310
+ * the concrete from/to types are not known at compile time.
1311
+ */
1312
+ type DynamicEdgeCollection = EdgeCollection<AnyEdgeType, NodeType, NodeType>;
1296
1313
  /**
1297
1314
  * A type-level projection of a store's surface onto a subset of its
1298
1315
  * node and edge collections.
@@ -2103,6 +2120,23 @@ declare class Store<G extends GraphDef> {
2103
2120
  * ```
2104
2121
  */
2105
2122
  get edges(): GraphEdgeCollections<G>;
2123
+ /**
2124
+ * Returns the node collection for the given kind, or undefined if the kind
2125
+ * is not registered in this graph.
2126
+ *
2127
+ * Use this for runtime string-keyed access when the kind is not known at
2128
+ * compile time (e.g., iterating all kinds, resolving from edge metadata,
2129
+ * dynamic admin UIs).
2130
+ */
2131
+ getNodeCollection(kind: string): DynamicNodeCollection | undefined;
2132
+ /**
2133
+ * Returns the edge collection for the given kind, or undefined if the kind
2134
+ * is not registered in this graph.
2135
+ *
2136
+ * Use this for runtime string-keyed access when the kind is not known at
2137
+ * compile time.
2138
+ */
2139
+ getEdgeCollection(kind: string): DynamicEdgeCollection | undefined;
2106
2140
  /**
2107
2141
  * Creates a query builder for this store.
2108
2142
  *
@@ -2275,4 +2309,4 @@ declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend
2275
2309
  */
2276
2310
  declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options?: StoreOptions & SchemaManagerOptions): Promise<[Store<G>, SchemaValidationResult]>;
2277
2311
 
2278
- export { type SubgraphOptions as $, type AliasMap as A, type BatchResults as B, type CreateQueryBuilderOptions as C, type Predicate as D, type EdgeAliasMap as E, type FieldAccessor as F, type GetOrCreateAction as G, type HookContext as H, type IfExistsMode as I, PreparedQuery as J, type PropsAccessor as K, type QueryHookContext as L, type QueryOptions as M, type Node as N, type OperationHookContext as O, type PaginateOptions as P, QueryBuilder as Q, type RecursiveTraversalOptions as R, type SelectContext as S, TraversalBuilder as T, type SelectableEdge as U, type SelectableNode as V, Store as W, type StoreHooks as X, type StoreOptions as Y, type StoreProjection as Z, type StreamOptions as _, type AggregateResult as a, type SubgraphResult as a0, type SubsetEdge as a1, type SubsetNode as a2, type TransactionContext as a3, type TypedEdgeCollection as a4, UnionableQuery as a5, type UpdateEdgeInput as a6, type UpdateNodeInput as a7, createStore as a8, createStoreWithSchema as a9, defineSubgraphProject as aa, embedding as ab, exists as ac, fieldRef as ad, getEmbeddingDimensions as ae, inSubquery as af, isEmbeddingSchema as ag, isParameterRef as ah, notExists as ai, notInSubquery as aj, param as ak, type AnyEdge as b, type AnyNode as c, type BatchableQuery as d, type ConstraintNames as e, type CreateEdgeInput as f, type CreateNodeInput as g, type Edge as h, type EdgeAccessor as i, type EdgeCollection as j, type EdgeFindByEndpointsOptions as k, type EdgeGetOrCreateByEndpointsOptions as l, type EdgeGetOrCreateByEndpointsResult as m, type EmbeddingSchema as n, type EmbeddingValue as o, ExecutableAggregateQuery as p, ExecutableQuery as q, type GraphEdgeCollections as r, type GraphNodeCollections as s, type NodeAccessor as t, type NodeAlias as u, type NodeCollection as v, type NodeGetOrCreateByConstraintOptions as w, type NodeGetOrCreateByConstraintResult as x, type NodeRef as y, type PaginatedResult as z };
2312
+ export { type StoreProjection as $, type AliasMap as A, type BatchResults as B, type CreateQueryBuilderOptions as C, type DynamicEdgeCollection as D, type EdgeAliasMap as E, type FieldAccessor as F, type GetOrCreateAction as G, type HookContext as H, type IfExistsMode as I, type PaginatedResult as J, type Predicate as K, PreparedQuery as L, type PropsAccessor as M, type Node as N, type OperationHookContext as O, type PaginateOptions as P, QueryBuilder as Q, type QueryHookContext as R, type QueryOptions as S, TraversalBuilder as T, type RecursiveTraversalOptions as U, type SelectContext as V, type SelectableEdge as W, type SelectableNode as X, Store as Y, type StoreHooks as Z, type StoreOptions as _, type AggregateResult as a, type StreamOptions as a0, type SubgraphOptions as a1, type SubgraphResult as a2, type SubsetEdge as a3, type SubsetNode as a4, type TransactionContext as a5, type TypedEdgeCollection as a6, UnionableQuery as a7, type UpdateEdgeInput as a8, type UpdateNodeInput as a9, createStore as aa, createStoreWithSchema as ab, defineSubgraphProject as ac, embedding as ad, exists as ae, fieldRef as af, getEmbeddingDimensions as ag, inSubquery as ah, isEmbeddingSchema as ai, isParameterRef as aj, notExists as ak, notInSubquery as al, param as am, type AnyEdge as b, type AnyNode as c, type BatchableQuery as d, type ConstraintNames as e, type CreateEdgeInput as f, type CreateNodeInput as g, type DynamicNodeCollection as h, type Edge as i, type EdgeAccessor as j, type EdgeCollection as k, type EdgeFindByEndpointsOptions as l, type EdgeGetOrCreateByEndpointsOptions as m, type EdgeGetOrCreateByEndpointsResult as n, type EmbeddingSchema as o, type EmbeddingValue as p, ExecutableAggregateQuery as q, ExecutableQuery as r, type GraphEdgeCollections as s, type GraphNodeCollections as t, type NodeAccessor as u, type NodeAlias as v, type NodeCollection as w, type NodeGetOrCreateByConstraintOptions as x, type NodeGetOrCreateByConstraintResult as y, type NodeRef as z };
@@ -1293,6 +1293,23 @@ type TransactionContext<G extends GraphDef> = Readonly<{
1293
1293
  nodes: GraphNodeCollections<G>;
1294
1294
  edges: GraphEdgeCollections<G>;
1295
1295
  }>;
1296
+ /**
1297
+ * A node collection with widened generics for runtime string-keyed access.
1298
+ *
1299
+ * This is the return type of `store.getNodeCollection(kind)`. It exposes
1300
+ * the full `NodeCollection` API but with `NodeType` and `string` constraint
1301
+ * names instead of the specific generic parameters, since the concrete type
1302
+ * is not known at compile time.
1303
+ */
1304
+ type DynamicNodeCollection = NodeCollection<NodeType, string>;
1305
+ /**
1306
+ * An edge collection with widened generics for runtime string-keyed access.
1307
+ *
1308
+ * This is the return type of `store.getEdgeCollection(kind)`. It exposes
1309
+ * the full `EdgeCollection` API but with `NodeType` endpoint types, since
1310
+ * the concrete from/to types are not known at compile time.
1311
+ */
1312
+ type DynamicEdgeCollection = EdgeCollection<AnyEdgeType, NodeType, NodeType>;
1296
1313
  /**
1297
1314
  * A type-level projection of a store's surface onto a subset of its
1298
1315
  * node and edge collections.
@@ -2103,6 +2120,23 @@ declare class Store<G extends GraphDef> {
2103
2120
  * ```
2104
2121
  */
2105
2122
  get edges(): GraphEdgeCollections<G>;
2123
+ /**
2124
+ * Returns the node collection for the given kind, or undefined if the kind
2125
+ * is not registered in this graph.
2126
+ *
2127
+ * Use this for runtime string-keyed access when the kind is not known at
2128
+ * compile time (e.g., iterating all kinds, resolving from edge metadata,
2129
+ * dynamic admin UIs).
2130
+ */
2131
+ getNodeCollection(kind: string): DynamicNodeCollection | undefined;
2132
+ /**
2133
+ * Returns the edge collection for the given kind, or undefined if the kind
2134
+ * is not registered in this graph.
2135
+ *
2136
+ * Use this for runtime string-keyed access when the kind is not known at
2137
+ * compile time.
2138
+ */
2139
+ getEdgeCollection(kind: string): DynamicEdgeCollection | undefined;
2106
2140
  /**
2107
2141
  * Creates a query builder for this store.
2108
2142
  *
@@ -2275,4 +2309,4 @@ declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend
2275
2309
  */
2276
2310
  declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options?: StoreOptions & SchemaManagerOptions): Promise<[Store<G>, SchemaValidationResult]>;
2277
2311
 
2278
- export { type SubgraphOptions as $, type AliasMap as A, type BatchResults as B, type CreateQueryBuilderOptions as C, type Predicate as D, type EdgeAliasMap as E, type FieldAccessor as F, type GetOrCreateAction as G, type HookContext as H, type IfExistsMode as I, PreparedQuery as J, type PropsAccessor as K, type QueryHookContext as L, type QueryOptions as M, type Node as N, type OperationHookContext as O, type PaginateOptions as P, QueryBuilder as Q, type RecursiveTraversalOptions as R, type SelectContext as S, TraversalBuilder as T, type SelectableEdge as U, type SelectableNode as V, Store as W, type StoreHooks as X, type StoreOptions as Y, type StoreProjection as Z, type StreamOptions as _, type AggregateResult as a, type SubgraphResult as a0, type SubsetEdge as a1, type SubsetNode as a2, type TransactionContext as a3, type TypedEdgeCollection as a4, UnionableQuery as a5, type UpdateEdgeInput as a6, type UpdateNodeInput as a7, createStore as a8, createStoreWithSchema as a9, defineSubgraphProject as aa, embedding as ab, exists as ac, fieldRef as ad, getEmbeddingDimensions as ae, inSubquery as af, isEmbeddingSchema as ag, isParameterRef as ah, notExists as ai, notInSubquery as aj, param as ak, type AnyEdge as b, type AnyNode as c, type BatchableQuery as d, type ConstraintNames as e, type CreateEdgeInput as f, type CreateNodeInput as g, type Edge as h, type EdgeAccessor as i, type EdgeCollection as j, type EdgeFindByEndpointsOptions as k, type EdgeGetOrCreateByEndpointsOptions as l, type EdgeGetOrCreateByEndpointsResult as m, type EmbeddingSchema as n, type EmbeddingValue as o, ExecutableAggregateQuery as p, ExecutableQuery as q, type GraphEdgeCollections as r, type GraphNodeCollections as s, type NodeAccessor as t, type NodeAlias as u, type NodeCollection as v, type NodeGetOrCreateByConstraintOptions as w, type NodeGetOrCreateByConstraintResult as x, type NodeRef as y, type PaginatedResult as z };
2312
+ export { type StoreProjection as $, type AliasMap as A, type BatchResults as B, type CreateQueryBuilderOptions as C, type DynamicEdgeCollection as D, type EdgeAliasMap as E, type FieldAccessor as F, type GetOrCreateAction as G, type HookContext as H, type IfExistsMode as I, type PaginatedResult as J, type Predicate as K, PreparedQuery as L, type PropsAccessor as M, type Node as N, type OperationHookContext as O, type PaginateOptions as P, QueryBuilder as Q, type QueryHookContext as R, type QueryOptions as S, TraversalBuilder as T, type RecursiveTraversalOptions as U, type SelectContext as V, type SelectableEdge as W, type SelectableNode as X, Store as Y, type StoreHooks as Z, type StoreOptions as _, type AggregateResult as a, type StreamOptions as a0, type SubgraphOptions as a1, type SubgraphResult as a2, type SubsetEdge as a3, type SubsetNode as a4, type TransactionContext as a5, type TypedEdgeCollection as a6, UnionableQuery as a7, type UpdateEdgeInput as a8, type UpdateNodeInput as a9, createStore as aa, createStoreWithSchema as ab, defineSubgraphProject as ac, embedding as ad, exists as ae, fieldRef as af, getEmbeddingDimensions as ag, inSubquery as ah, isEmbeddingSchema as ai, isParameterRef as aj, notExists as ak, notInSubquery as al, param as am, type AnyEdge as b, type AnyNode as c, type BatchableQuery as d, type ConstraintNames as e, type CreateEdgeInput as f, type CreateNodeInput as g, type DynamicNodeCollection as h, type Edge as i, type EdgeAccessor as j, type EdgeCollection as k, type EdgeFindByEndpointsOptions as l, type EdgeGetOrCreateByEndpointsOptions as m, type EdgeGetOrCreateByEndpointsResult as n, type EmbeddingSchema as o, type EmbeddingValue as p, ExecutableAggregateQuery as q, ExecutableQuery as r, type GraphEdgeCollections as s, type GraphNodeCollections as t, type NodeAccessor as u, type NodeAlias as v, type NodeCollection as w, type NodeGetOrCreateByConstraintOptions as x, type NodeGetOrCreateByConstraintResult as y, type NodeRef as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nicia-ai/typegraph",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "TypeScript-first embedded knowledge graph library with ontological reasoning",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -142,11 +142,11 @@
142
142
  "@types/pg": "^8.20.0",
143
143
  "@vitest/coverage-v8": "^4.1.2",
144
144
  "better-sqlite3": "^12.8.0",
145
- "drizzle-orm": "^0.45.1",
145
+ "drizzle-orm": "^0.45.2",
146
146
  "eslint": "^10.1.0",
147
147
  "fast-check": "^4.6.0",
148
148
  "pg": "^8.20.0",
149
- "sqlite-vec": "^0.1.7",
149
+ "sqlite-vec": "^0.1.8",
150
150
  "tsd": "^0.33.0",
151
151
  "tsup": "^8.5.1",
152
152
  "typescript": "^5.9.3",