@nicia-ai/typegraph 0.16.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.d.cts CHANGED
@@ -3,8 +3,8 @@ import { N as NodeType, E as EdgeType } from './types-DMzKq0d5.cjs';
3
3
  export { A as AnyEdgeType, C as Cardinality, a as Collation, D as DeleteBehavior, b as EdgeId, c as EdgeProps, d as EdgeRegistration, e as EdgeTypeWithEndpoints, f as EndpointExistence, G as GraphDefaults, g as NodeId, h as NodeProps, i as NodeRegistration, S as SqlDialect, T as TemporalMode, U as UniqueConstraint, j as UniquenessScope, k as isEdgeType, l as isEdgeTypeWithEndpoints, m as isNodeType } from './types-DMzKq0d5.cjs';
4
4
  import { I as InferenceType, M as MetaEdge, O as OntologyRelation } from './types-B3mmOMJV.cjs';
5
5
  export { D as DEFAULT_SQL_SCHEMA, G as GraphBackend, a as MetaEdgeProperties, S as SqlSchema, b as SqlTableNames, T as TransactionBackend, c as createSqlSchema, i as isMetaEdge } from './types-B3mmOMJV.cjs';
6
- import { A as AliasMap, E as EdgeAliasMap, Q as QueryBuilder, T as TraversalBuilder, C as CreateQueryBuilderOptions } from './store-gTd_qa6u.cjs';
7
- export { a as AggregateResult, b as AnyEdge, c as AnyNode, B as BatchResults, d as BatchableQuery, e as ConstraintNames, f as CreateEdgeInput, g as CreateNodeInput, D as DynamicEdgeCollection, h as DynamicNodeCollection, i as Edge, j as EdgeAccessor, k as EdgeCollection, l as EdgeFindByEndpointsOptions, m as EdgeGetOrCreateByEndpointsOptions, n as EdgeGetOrCreateByEndpointsResult, o as EmbeddingSchema, p as EmbeddingValue, q as ExecutableAggregateQuery, r as ExecutableQuery, F as FieldAccessor, G as GetOrCreateAction, s as GraphEdgeCollections, t as GraphNodeCollections, H as HookContext, I as IfExistsMode, N as Node, u as NodeAccessor, v as NodeAlias, w as NodeCollection, x as NodeGetOrCreateByConstraintOptions, y as NodeGetOrCreateByConstraintResult, z as NodeRef, O as OperationHookContext, P as PaginateOptions, J as PaginatedResult, K as Predicate, L as PreparedQuery, M as PropsAccessor, R as QueryHookContext, S as QueryOptions, U as RecursiveTraversalOptions, V as SelectContext, W as SelectableEdge, X as SelectableNode, Y as Store, Z as StoreHooks, _ as StoreOptions, $ as StoreProjection, a0 as StreamOptions, a1 as SubgraphOptions, a2 as SubgraphResult, a3 as SubsetEdge, a4 as SubsetNode, a5 as TransactionContext, a6 as TypedEdgeCollection, a7 as UnionableQuery, a8 as UpdateEdgeInput, a9 as UpdateNodeInput, aa as createStore, ab as createStoreWithSchema, ac as defineSubgraphProject, ad as embedding, ae as exists, af as fieldRef, ag as getEmbeddingDimensions, ah as inSubquery, ai as isEmbeddingSchema, aj as isParameterRef, ak as notExists, al as notInSubquery, am as param } from './store-gTd_qa6u.cjs';
6
+ import { A as AliasMap, E as EdgeAliasMap, Q as QueryBuilder, T as TraversalBuilder, C as CreateQueryBuilderOptions } from './store-BZ7BexR1.cjs';
7
+ export { a as AggregateResult, b as AnyEdge, c as AnyNode, B as BatchResults, d as BatchableQuery, e as ConstraintNames, f as CreateEdgeInput, g as CreateNodeInput, D as DynamicEdgeCollection, h as DynamicNodeCollection, i as Edge, j as EdgeAccessor, k as EdgeCollection, l as EdgeFindByEndpointsOptions, m as EdgeGetOrCreateByEndpointsOptions, n as EdgeGetOrCreateByEndpointsResult, o as EmbeddingSchema, p as EmbeddingValue, q as ExecutableAggregateQuery, r as ExecutableQuery, F as FieldAccessor, G as GetOrCreateAction, s as GraphEdgeCollections, t as GraphNodeCollections, H as HookContext, I as IfExistsMode, N as Node, u as NodeAccessor, v as NodeAlias, w as NodeCollection, x as NodeGetOrCreateByConstraintOptions, y as NodeGetOrCreateByConstraintResult, z as NodeRef, O as OperationHookContext, P as PaginateOptions, J as PaginatedResult, K as Predicate, L as PreparedQuery, M as PropsAccessor, R as QueryHookContext, S as QueryOptions, U as RecursiveTraversalOptions, V as SelectContext, W as SelectableEdge, X as SelectableNode, Y as Store, Z as StoreHooks, _ as StoreOptions, $ as StoreProjection, a0 as StreamOptions, a1 as SubgraphOptions, a2 as SubgraphResult, a3 as SubsetEdge, a4 as SubsetNode, a5 as TransactionContext, a6 as TypedEdgeCollection, a7 as UnionableQuery, a8 as UpdateEdgeInput, a9 as UpdateNodeInput, aa as createStore, ab as createStoreWithSchema, ac as defineSubgraphProject, ad as embedding, ae as exists, af as fieldRef, ag as getEmbeddingDimensions, ah as inSubquery, ai as isEmbeddingSchema, aj as isParameterRef, ak as notExists, al as notInSubquery, am as param } from './store-BZ7BexR1.cjs';
8
8
  import { G as GraphDef, K as KindRegistry } from './manager-Bj1UEnhE.cjs';
9
9
  export { A as AllEdgeTypes, a as AllNodeTypes, E as EdgeKinds, b as GetEdgeType, c as GetNodeType, N as NodeKinds, S as SchemaManagerOptions, d as SchemaValidationResult, e as defineGraph, g as getEdgeKinds, f as getNodeKinds, i as isGraphDef } from './manager-Bj1UEnhE.cjs';
10
10
  export { C as CardinalityError, a as CompilerInvariantError, b as ConfigurationError, D as DatabaseOperationError, c as DisjointError, E as EdgeNotFoundError, d as EndpointError, e as EndpointNotFoundError, f as ErrorCategory, K as KindNotFoundError, M as MigrationError, N as NodeConstraintNotFoundError, g as NodeNotFoundError, R as RestrictedDeleteError, S as SchemaMismatchError, T as TypeGraphError, h as TypeGraphErrorOptions, U as UniquenessError, i as UnsupportedPredicateError, V as ValidationError, j as ValidationErrorDetails, k as ValidationIssue, l as VersionConflictError, m as getErrorSuggestion, n as isConstraintError, o as isSystemError, p as isTypeGraphError, q as isUserRecoverable } from './index-QTnQwakS.cjs';
package/dist/index.d.ts CHANGED
@@ -3,8 +3,8 @@ import { N as NodeType, E as EdgeType } from './types-DMzKq0d5.js';
3
3
  export { A as AnyEdgeType, C as Cardinality, a as Collation, D as DeleteBehavior, b as EdgeId, c as EdgeProps, d as EdgeRegistration, e as EdgeTypeWithEndpoints, f as EndpointExistence, G as GraphDefaults, g as NodeId, h as NodeProps, i as NodeRegistration, S as SqlDialect, T as TemporalMode, U as UniqueConstraint, j as UniquenessScope, k as isEdgeType, l as isEdgeTypeWithEndpoints, m as isNodeType } from './types-DMzKq0d5.js';
4
4
  import { I as InferenceType, M as MetaEdge, O as OntologyRelation } from './types-ThB4cFLp.js';
5
5
  export { D as DEFAULT_SQL_SCHEMA, G as GraphBackend, a as MetaEdgeProperties, S as SqlSchema, b as SqlTableNames, T as TransactionBackend, c as createSqlSchema, i as isMetaEdge } from './types-ThB4cFLp.js';
6
- import { A as AliasMap, E as EdgeAliasMap, Q as QueryBuilder, T as TraversalBuilder, C as CreateQueryBuilderOptions } from './store-Bitii3qj.js';
7
- export { a as AggregateResult, b as AnyEdge, c as AnyNode, B as BatchResults, d as BatchableQuery, e as ConstraintNames, f as CreateEdgeInput, g as CreateNodeInput, D as DynamicEdgeCollection, h as DynamicNodeCollection, i as Edge, j as EdgeAccessor, k as EdgeCollection, l as EdgeFindByEndpointsOptions, m as EdgeGetOrCreateByEndpointsOptions, n as EdgeGetOrCreateByEndpointsResult, o as EmbeddingSchema, p as EmbeddingValue, q as ExecutableAggregateQuery, r as ExecutableQuery, F as FieldAccessor, G as GetOrCreateAction, s as GraphEdgeCollections, t as GraphNodeCollections, H as HookContext, I as IfExistsMode, N as Node, u as NodeAccessor, v as NodeAlias, w as NodeCollection, x as NodeGetOrCreateByConstraintOptions, y as NodeGetOrCreateByConstraintResult, z as NodeRef, O as OperationHookContext, P as PaginateOptions, J as PaginatedResult, K as Predicate, L as PreparedQuery, M as PropsAccessor, R as QueryHookContext, S as QueryOptions, U as RecursiveTraversalOptions, V as SelectContext, W as SelectableEdge, X as SelectableNode, Y as Store, Z as StoreHooks, _ as StoreOptions, $ as StoreProjection, a0 as StreamOptions, a1 as SubgraphOptions, a2 as SubgraphResult, a3 as SubsetEdge, a4 as SubsetNode, a5 as TransactionContext, a6 as TypedEdgeCollection, a7 as UnionableQuery, a8 as UpdateEdgeInput, a9 as UpdateNodeInput, aa as createStore, ab as createStoreWithSchema, ac as defineSubgraphProject, ad as embedding, ae as exists, af as fieldRef, ag as getEmbeddingDimensions, ah as inSubquery, ai as isEmbeddingSchema, aj as isParameterRef, ak as notExists, al as notInSubquery, am as param } from './store-Bitii3qj.js';
6
+ import { A as AliasMap, E as EdgeAliasMap, Q as QueryBuilder, T as TraversalBuilder, C as CreateQueryBuilderOptions } from './store--7Nft1Ii.js';
7
+ export { a as AggregateResult, b as AnyEdge, c as AnyNode, B as BatchResults, d as BatchableQuery, e as ConstraintNames, f as CreateEdgeInput, g as CreateNodeInput, D as DynamicEdgeCollection, h as DynamicNodeCollection, i as Edge, j as EdgeAccessor, k as EdgeCollection, l as EdgeFindByEndpointsOptions, m as EdgeGetOrCreateByEndpointsOptions, n as EdgeGetOrCreateByEndpointsResult, o as EmbeddingSchema, p as EmbeddingValue, q as ExecutableAggregateQuery, r as ExecutableQuery, F as FieldAccessor, G as GetOrCreateAction, s as GraphEdgeCollections, t as GraphNodeCollections, H as HookContext, I as IfExistsMode, N as Node, u as NodeAccessor, v as NodeAlias, w as NodeCollection, x as NodeGetOrCreateByConstraintOptions, y as NodeGetOrCreateByConstraintResult, z as NodeRef, O as OperationHookContext, P as PaginateOptions, J as PaginatedResult, K as Predicate, L as PreparedQuery, M as PropsAccessor, R as QueryHookContext, S as QueryOptions, U as RecursiveTraversalOptions, V as SelectContext, W as SelectableEdge, X as SelectableNode, Y as Store, Z as StoreHooks, _ as StoreOptions, $ as StoreProjection, a0 as StreamOptions, a1 as SubgraphOptions, a2 as SubgraphResult, a3 as SubsetEdge, a4 as SubsetNode, a5 as TransactionContext, a6 as TypedEdgeCollection, a7 as UnionableQuery, a8 as UpdateEdgeInput, a9 as UpdateNodeInput, aa as createStore, ab as createStoreWithSchema, ac as defineSubgraphProject, ad as embedding, ae as exists, af as fieldRef, ag as getEmbeddingDimensions, ah as inSubquery, ai as isEmbeddingSchema, aj as isParameterRef, ak as notExists, al as notInSubquery, am as param } from './store--7Nft1Ii.js';
8
8
  import { G as GraphDef, K as KindRegistry } from './manager-Chhrq1vl.js';
9
9
  export { A as AllEdgeTypes, a as AllNodeTypes, E as EdgeKinds, b as GetEdgeType, c as GetNodeType, N as NodeKinds, S as SchemaManagerOptions, d as SchemaValidationResult, e as defineGraph, g as getEdgeKinds, f as getNodeKinds, i as isGraphDef } from './manager-Chhrq1vl.js';
10
10
  export { C as CardinalityError, a as CompilerInvariantError, b as ConfigurationError, D as DatabaseOperationError, c as DisjointError, E as EdgeNotFoundError, d as EndpointError, e as EndpointNotFoundError, f as ErrorCategory, K as KindNotFoundError, M as MigrationError, N as NodeConstraintNotFoundError, g as NodeNotFoundError, R as RestrictedDeleteError, S as SchemaMismatchError, T as TypeGraphError, h as TypeGraphErrorOptions, U as UniquenessError, i as UnsupportedPredicateError, V as ValidationError, j as ValidationErrorDetails, k as ValidationIssue, l as VersionConflictError, m as getErrorSuggestion, n as isConstraintError, o as isSystemError, p as isTypeGraphError, q as isUserRecoverable } from './index-QTnQwakS.js';
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { G as GraphDef } from '../manager-Bj1UEnhE.cjs';
3
- import { Y as Store } from '../store-gTd_qa6u.cjs';
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 { Y as Store } from '../store-Bitii3qj.js';
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 { Y as Store } from '../store-gTd_qa6u.cjs';
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';
@@ -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 { Y as Store } from '../store-Bitii3qj.js';
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,26 @@ 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
+ };
1296
1316
  /**
1297
1317
  * A node collection with widened generics for runtime string-keyed access.
1298
1318
  *
@@ -1300,16 +1320,24 @@ type TransactionContext<G extends GraphDef> = Readonly<{
1300
1320
  * the full `NodeCollection` API but with `NodeType` and `string` constraint
1301
1321
  * names instead of the specific generic parameters, since the concrete type
1302
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.
1303
1327
  */
1304
- type DynamicNodeCollection = NodeCollection<NodeType, string>;
1328
+ type DynamicNodeCollection = WidenBrandedIds<NodeCollection<NodeType, string>>;
1305
1329
  /**
1306
1330
  * An edge collection with widened generics for runtime string-keyed access.
1307
1331
  *
1308
1332
  * This is the return type of `store.getEdgeCollection(kind)`. It exposes
1309
1333
  * the full `EdgeCollection` API but with `NodeType` endpoint types, since
1310
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.
1311
1339
  */
1312
- type DynamicEdgeCollection = EdgeCollection<AnyEdgeType, NodeType, NodeType>;
1340
+ type DynamicEdgeCollection = WidenBrandedIds<EdgeCollection<AnyEdgeType, NodeType, NodeType>>;
1313
1341
  /**
1314
1342
  * A type-level projection of a store's surface onto a subset of its
1315
1343
  * node and edge collections.
@@ -1293,6 +1293,26 @@ 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
+ };
1296
1316
  /**
1297
1317
  * A node collection with widened generics for runtime string-keyed access.
1298
1318
  *
@@ -1300,16 +1320,24 @@ type TransactionContext<G extends GraphDef> = Readonly<{
1300
1320
  * the full `NodeCollection` API but with `NodeType` and `string` constraint
1301
1321
  * names instead of the specific generic parameters, since the concrete type
1302
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.
1303
1327
  */
1304
- type DynamicNodeCollection = NodeCollection<NodeType, string>;
1328
+ type DynamicNodeCollection = WidenBrandedIds<NodeCollection<NodeType, string>>;
1305
1329
  /**
1306
1330
  * An edge collection with widened generics for runtime string-keyed access.
1307
1331
  *
1308
1332
  * This is the return type of `store.getEdgeCollection(kind)`. It exposes
1309
1333
  * the full `EdgeCollection` API but with `NodeType` endpoint types, since
1310
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.
1311
1339
  */
1312
- type DynamicEdgeCollection = EdgeCollection<AnyEdgeType, NodeType, NodeType>;
1340
+ type DynamicEdgeCollection = WidenBrandedIds<EdgeCollection<AnyEdgeType, NodeType, NodeType>>;
1313
1341
  /**
1314
1342
  * A type-level projection of a store's surface onto a subset of its
1315
1343
  * node and edge collections.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nicia-ai/typegraph",
3
- "version": "0.16.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",