@nicia-ai/typegraph 0.15.0 → 0.16.1
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 +27 -3
- 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 +27 -3
- 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-CD_0yf2s.d.ts → store--7Nft1Ii.d.ts} +63 -1
- package/dist/{store-BNercm8P.d.cts → store-BZ7BexR1.d.cts} +63 -1
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { G as GraphDef } from '../manager-Bj1UEnhE.cjs';
|
|
3
|
-
import {
|
|
3
|
+
import { Y as Store } from '../store-BZ7BexR1.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 {
|
|
3
|
+
import { Y as Store } from '../store--7Nft1Ii.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 {
|
|
3
|
+
import { Y as Store } from '../store-BZ7BexR1.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';
|
package/dist/profiler/index.d.ts
CHANGED
|
@@ -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 {
|
|
3
|
+
import { Y as Store } from '../store--7Nft1Ii.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,51 @@ type TransactionContext<G extends GraphDef> = Readonly<{
|
|
|
1293
1293
|
nodes: GraphNodeCollections<G>;
|
|
1294
1294
|
edges: GraphEdgeCollections<G>;
|
|
1295
1295
|
}>;
|
|
1296
|
+
/**
|
|
1297
|
+
* Replace branded `NodeId` / `EdgeId` with plain `string` in each
|
|
1298
|
+
* method's parameter list. Return types are preserved unchanged.
|
|
1299
|
+
*
|
|
1300
|
+
* Handles three shapes:
|
|
1301
|
+
* 1. Direct branded ID parameter → `string`
|
|
1302
|
+
* 2. `readonly NodeId[]` / `readonly EdgeId[]` → `readonly string[]`
|
|
1303
|
+
* 3. Branded IDs nested one level inside bulk-item object arrays
|
|
1304
|
+
*/
|
|
1305
|
+
type WidenBrandedIds<T> = {
|
|
1306
|
+
readonly [K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: {
|
|
1307
|
+
[P in keyof A]: UnbrandParam<A[P]>;
|
|
1308
|
+
}) => R : T[K];
|
|
1309
|
+
};
|
|
1310
|
+
/** Replace a branded ID with `string`, recursing one level into arrays. */
|
|
1311
|
+
type UnbrandParam<T> = T extends NodeId<NodeType> ? string : T extends EdgeId<AnyEdgeType> ? string : T extends readonly NodeId<NodeType>[] ? readonly string[] : T extends readonly EdgeId<AnyEdgeType>[] ? readonly string[] : T extends readonly (infer Item extends Record<string, unknown>)[] ? readonly UnbrandRecord<Item>[] : T;
|
|
1312
|
+
/** Replace branded ID values in object properties (does not recurse into nested structures). */
|
|
1313
|
+
type UnbrandRecord<T extends Record<string, unknown>> = {
|
|
1314
|
+
readonly [K in keyof T]: T[K] extends NodeId<NodeType> ? string : T[K] extends EdgeId<AnyEdgeType> ? string : T[K];
|
|
1315
|
+
};
|
|
1316
|
+
/**
|
|
1317
|
+
* A node collection with widened generics for runtime string-keyed access.
|
|
1318
|
+
*
|
|
1319
|
+
* This is the return type of `store.getNodeCollection(kind)`. It exposes
|
|
1320
|
+
* the full `NodeCollection` API but with `NodeType` and `string` constraint
|
|
1321
|
+
* names instead of the specific generic parameters, since the concrete type
|
|
1322
|
+
* is not known at compile time.
|
|
1323
|
+
*
|
|
1324
|
+
* ID parameters accept plain `string` instead of branded `NodeId<N>`, since
|
|
1325
|
+
* the dynamic path typically receives IDs from edge metadata, snapshots,
|
|
1326
|
+
* or external input where the brand is not available.
|
|
1327
|
+
*/
|
|
1328
|
+
type DynamicNodeCollection = WidenBrandedIds<NodeCollection<NodeType, string>>;
|
|
1329
|
+
/**
|
|
1330
|
+
* An edge collection with widened generics for runtime string-keyed access.
|
|
1331
|
+
*
|
|
1332
|
+
* This is the return type of `store.getEdgeCollection(kind)`. It exposes
|
|
1333
|
+
* the full `EdgeCollection` API but with `NodeType` endpoint types, since
|
|
1334
|
+
* the concrete from/to types are not known at compile time.
|
|
1335
|
+
*
|
|
1336
|
+
* ID parameters accept plain `string` instead of branded `EdgeId<E>`, since
|
|
1337
|
+
* the dynamic path typically receives IDs from edge metadata, snapshots,
|
|
1338
|
+
* or external input where the brand is not available.
|
|
1339
|
+
*/
|
|
1340
|
+
type DynamicEdgeCollection = WidenBrandedIds<EdgeCollection<AnyEdgeType, NodeType, NodeType>>;
|
|
1296
1341
|
/**
|
|
1297
1342
|
* A type-level projection of a store's surface onto a subset of its
|
|
1298
1343
|
* node and edge collections.
|
|
@@ -2103,6 +2148,23 @@ declare class Store<G extends GraphDef> {
|
|
|
2103
2148
|
* ```
|
|
2104
2149
|
*/
|
|
2105
2150
|
get edges(): GraphEdgeCollections<G>;
|
|
2151
|
+
/**
|
|
2152
|
+
* Returns the node collection for the given kind, or undefined if the kind
|
|
2153
|
+
* is not registered in this graph.
|
|
2154
|
+
*
|
|
2155
|
+
* Use this for runtime string-keyed access when the kind is not known at
|
|
2156
|
+
* compile time (e.g., iterating all kinds, resolving from edge metadata,
|
|
2157
|
+
* dynamic admin UIs).
|
|
2158
|
+
*/
|
|
2159
|
+
getNodeCollection(kind: string): DynamicNodeCollection | undefined;
|
|
2160
|
+
/**
|
|
2161
|
+
* Returns the edge collection for the given kind, or undefined if the kind
|
|
2162
|
+
* is not registered in this graph.
|
|
2163
|
+
*
|
|
2164
|
+
* Use this for runtime string-keyed access when the kind is not known at
|
|
2165
|
+
* compile time.
|
|
2166
|
+
*/
|
|
2167
|
+
getEdgeCollection(kind: string): DynamicEdgeCollection | undefined;
|
|
2106
2168
|
/**
|
|
2107
2169
|
* Creates a query builder for this store.
|
|
2108
2170
|
*
|
|
@@ -2275,4 +2337,4 @@ declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend
|
|
|
2275
2337
|
*/
|
|
2276
2338
|
declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options?: StoreOptions & SchemaManagerOptions): Promise<[Store<G>, SchemaValidationResult]>;
|
|
2277
2339
|
|
|
2278
|
-
export { type
|
|
2340
|
+
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,51 @@ type TransactionContext<G extends GraphDef> = Readonly<{
|
|
|
1293
1293
|
nodes: GraphNodeCollections<G>;
|
|
1294
1294
|
edges: GraphEdgeCollections<G>;
|
|
1295
1295
|
}>;
|
|
1296
|
+
/**
|
|
1297
|
+
* Replace branded `NodeId` / `EdgeId` with plain `string` in each
|
|
1298
|
+
* method's parameter list. Return types are preserved unchanged.
|
|
1299
|
+
*
|
|
1300
|
+
* Handles three shapes:
|
|
1301
|
+
* 1. Direct branded ID parameter → `string`
|
|
1302
|
+
* 2. `readonly NodeId[]` / `readonly EdgeId[]` → `readonly string[]`
|
|
1303
|
+
* 3. Branded IDs nested one level inside bulk-item object arrays
|
|
1304
|
+
*/
|
|
1305
|
+
type WidenBrandedIds<T> = {
|
|
1306
|
+
readonly [K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: {
|
|
1307
|
+
[P in keyof A]: UnbrandParam<A[P]>;
|
|
1308
|
+
}) => R : T[K];
|
|
1309
|
+
};
|
|
1310
|
+
/** Replace a branded ID with `string`, recursing one level into arrays. */
|
|
1311
|
+
type UnbrandParam<T> = T extends NodeId<NodeType> ? string : T extends EdgeId<AnyEdgeType> ? string : T extends readonly NodeId<NodeType>[] ? readonly string[] : T extends readonly EdgeId<AnyEdgeType>[] ? readonly string[] : T extends readonly (infer Item extends Record<string, unknown>)[] ? readonly UnbrandRecord<Item>[] : T;
|
|
1312
|
+
/** Replace branded ID values in object properties (does not recurse into nested structures). */
|
|
1313
|
+
type UnbrandRecord<T extends Record<string, unknown>> = {
|
|
1314
|
+
readonly [K in keyof T]: T[K] extends NodeId<NodeType> ? string : T[K] extends EdgeId<AnyEdgeType> ? string : T[K];
|
|
1315
|
+
};
|
|
1316
|
+
/**
|
|
1317
|
+
* A node collection with widened generics for runtime string-keyed access.
|
|
1318
|
+
*
|
|
1319
|
+
* This is the return type of `store.getNodeCollection(kind)`. It exposes
|
|
1320
|
+
* the full `NodeCollection` API but with `NodeType` and `string` constraint
|
|
1321
|
+
* names instead of the specific generic parameters, since the concrete type
|
|
1322
|
+
* is not known at compile time.
|
|
1323
|
+
*
|
|
1324
|
+
* ID parameters accept plain `string` instead of branded `NodeId<N>`, since
|
|
1325
|
+
* the dynamic path typically receives IDs from edge metadata, snapshots,
|
|
1326
|
+
* or external input where the brand is not available.
|
|
1327
|
+
*/
|
|
1328
|
+
type DynamicNodeCollection = WidenBrandedIds<NodeCollection<NodeType, string>>;
|
|
1329
|
+
/**
|
|
1330
|
+
* An edge collection with widened generics for runtime string-keyed access.
|
|
1331
|
+
*
|
|
1332
|
+
* This is the return type of `store.getEdgeCollection(kind)`. It exposes
|
|
1333
|
+
* the full `EdgeCollection` API but with `NodeType` endpoint types, since
|
|
1334
|
+
* the concrete from/to types are not known at compile time.
|
|
1335
|
+
*
|
|
1336
|
+
* ID parameters accept plain `string` instead of branded `EdgeId<E>`, since
|
|
1337
|
+
* the dynamic path typically receives IDs from edge metadata, snapshots,
|
|
1338
|
+
* or external input where the brand is not available.
|
|
1339
|
+
*/
|
|
1340
|
+
type DynamicEdgeCollection = WidenBrandedIds<EdgeCollection<AnyEdgeType, NodeType, NodeType>>;
|
|
1296
1341
|
/**
|
|
1297
1342
|
* A type-level projection of a store's surface onto a subset of its
|
|
1298
1343
|
* node and edge collections.
|
|
@@ -2103,6 +2148,23 @@ declare class Store<G extends GraphDef> {
|
|
|
2103
2148
|
* ```
|
|
2104
2149
|
*/
|
|
2105
2150
|
get edges(): GraphEdgeCollections<G>;
|
|
2151
|
+
/**
|
|
2152
|
+
* Returns the node collection for the given kind, or undefined if the kind
|
|
2153
|
+
* is not registered in this graph.
|
|
2154
|
+
*
|
|
2155
|
+
* Use this for runtime string-keyed access when the kind is not known at
|
|
2156
|
+
* compile time (e.g., iterating all kinds, resolving from edge metadata,
|
|
2157
|
+
* dynamic admin UIs).
|
|
2158
|
+
*/
|
|
2159
|
+
getNodeCollection(kind: string): DynamicNodeCollection | undefined;
|
|
2160
|
+
/**
|
|
2161
|
+
* Returns the edge collection for the given kind, or undefined if the kind
|
|
2162
|
+
* is not registered in this graph.
|
|
2163
|
+
*
|
|
2164
|
+
* Use this for runtime string-keyed access when the kind is not known at
|
|
2165
|
+
* compile time.
|
|
2166
|
+
*/
|
|
2167
|
+
getEdgeCollection(kind: string): DynamicEdgeCollection | undefined;
|
|
2106
2168
|
/**
|
|
2107
2169
|
* Creates a query builder for this store.
|
|
2108
2170
|
*
|
|
@@ -2275,4 +2337,4 @@ declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend
|
|
|
2275
2337
|
*/
|
|
2276
2338
|
declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options?: StoreOptions & SchemaManagerOptions): Promise<[Store<G>, SchemaValidationResult]>;
|
|
2277
2339
|
|
|
2278
|
-
export { type
|
|
2340
|
+
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.
|
|
3
|
+
"version": "0.16.1",
|
|
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.
|
|
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.
|
|
149
|
+
"sqlite-vec": "^0.1.8",
|
|
150
150
|
"tsd": "^0.33.0",
|
|
151
151
|
"tsup": "^8.5.1",
|
|
152
152
|
"typescript": "^5.9.3",
|