@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.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-BNercm8P.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, h as Edge, i as EdgeAccessor, j as EdgeCollection, k as EdgeFindByEndpointsOptions, l as EdgeGetOrCreateByEndpointsOptions, m as EdgeGetOrCreateByEndpointsResult, n as EmbeddingSchema, o as EmbeddingValue, p as ExecutableAggregateQuery, q as ExecutableQuery, F as FieldAccessor, G as GetOrCreateAction, r as GraphEdgeCollections, s as GraphNodeCollections, H as HookContext, I as IfExistsMode, N as Node, t as NodeAccessor, u as NodeAlias, v as NodeCollection, w as NodeGetOrCreateByConstraintOptions, x as NodeGetOrCreateByConstraintResult, y as NodeRef, O as OperationHookContext, P as PaginateOptions, z as PaginatedResult, D as Predicate, J as PreparedQuery, K as PropsAccessor, L as QueryHookContext, M as QueryOptions, R as RecursiveTraversalOptions, S as SelectContext, U as SelectableEdge, V as SelectableNode, W as Store, X as StoreHooks, Y as StoreOptions, Z as StoreProjection, _ as StreamOptions, $ as SubgraphOptions, a0 as SubgraphResult, a1 as SubsetEdge, a2 as SubsetNode, a3 as TransactionContext, a4 as TypedEdgeCollection, a5 as UnionableQuery, a6 as UpdateEdgeInput, a7 as UpdateNodeInput, a8 as createStore, a9 as createStoreWithSchema, aa as defineSubgraphProject, ab as embedding, ac as exists, ad as fieldRef, ae as getEmbeddingDimensions, af as inSubquery, ag as isEmbeddingSchema, ah as isParameterRef, ai as notExists, aj as notInSubquery, ak as param } from './store-BNercm8P.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-CD_0yf2s.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, h as Edge, i as EdgeAccessor, j as EdgeCollection, k as EdgeFindByEndpointsOptions, l as EdgeGetOrCreateByEndpointsOptions, m as EdgeGetOrCreateByEndpointsResult, n as EmbeddingSchema, o as EmbeddingValue, p as ExecutableAggregateQuery, q as ExecutableQuery, F as FieldAccessor, G as GetOrCreateAction, r as GraphEdgeCollections, s as GraphNodeCollections, H as HookContext, I as IfExistsMode, N as Node, t as NodeAccessor, u as NodeAlias, v as NodeCollection, w as NodeGetOrCreateByConstraintOptions, x as NodeGetOrCreateByConstraintResult, y as NodeRef, O as OperationHookContext, P as PaginateOptions, z as PaginatedResult, D as Predicate, J as PreparedQuery, K as PropsAccessor, L as QueryHookContext, M as QueryOptions, R as RecursiveTraversalOptions, S as SelectContext, U as SelectableEdge, V as SelectableNode, W as Store, X as StoreHooks, Y as StoreOptions, Z as StoreProjection, _ as StreamOptions, $ as SubgraphOptions, a0 as SubgraphResult, a1 as SubsetEdge, a2 as SubsetNode, a3 as TransactionContext, a4 as TypedEdgeCollection, a5 as UnionableQuery, a6 as UpdateEdgeInput, a7 as UpdateNodeInput, a8 as createStore, a9 as createStoreWithSchema, aa as defineSubgraphProject, ab as embedding, ac as exists, ad as fieldRef, ae as getEmbeddingDimensions, af as inSubquery, ag as isEmbeddingSchema, ah as isParameterRef, ai as notExists, aj as notInSubquery, ak as param } from './store-CD_0yf2s.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';
package/dist/index.js CHANGED
@@ -2315,7 +2315,7 @@ function buildStandardEmbeddingsCte(input) {
2315
2315
  const { ctx, graphId, vectorPredicate } = input;
2316
2316
  const { dialect } = ctx;
2317
2317
  const { field: field2, metric, minScore, queryEmbedding } = vectorPredicate;
2318
- const fieldPath = field2.jsonPointer ? field2.jsonPointer : field2.path.length > 1 && field2.path[0] === "props" ? `/${field2.path.slice(1).join("/")}` : `/${field2.path.join("/")}`;
2318
+ const fieldPath = field2.jsonPointer ?? (field2.path.length > 1 && field2.path[0] === "props" ? `/${field2.path.slice(1).join("/")}` : `/${field2.path.join("/")}`);
2319
2319
  const distanceExpr = dialect.vectorDistance(
2320
2320
  sql.raw("embedding"),
2321
2321
  queryEmbedding,
@@ -9595,7 +9595,7 @@ function createNodeCollectionsProxy(graph, graphId, registry, backend, operation
9595
9595
  const collectionCache = /* @__PURE__ */ new Map();
9596
9596
  return new Proxy({}, {
9597
9597
  get: (_, kind) => {
9598
- if (!(kind in graph.nodes)) {
9598
+ if (!Object.hasOwn(graph.nodes, kind)) {
9599
9599
  throw new KindNotFoundError(kind, "node");
9600
9600
  }
9601
9601
  const cached = collectionCache.get(kind);
@@ -9617,7 +9617,7 @@ function createEdgeCollectionsProxy(graph, graphId, registry, backend, operation
9617
9617
  const collectionCache = /* @__PURE__ */ new Map();
9618
9618
  return new Proxy({}, {
9619
9619
  get: (_, kind) => {
9620
- if (!(kind in graph.edges)) {
9620
+ if (!Object.hasOwn(graph.edges, kind)) {
9621
9621
  throw new KindNotFoundError(kind, "edge");
9622
9622
  }
9623
9623
  const cached = collectionCache.get(kind);
@@ -11707,6 +11707,30 @@ var Store = class {
11707
11707
  }
11708
11708
  return this.#edgeCollections;
11709
11709
  }
11710
+ // === Dynamic Collection Access ===
11711
+ /**
11712
+ * Returns the node collection for the given kind, or undefined if the kind
11713
+ * is not registered in this graph.
11714
+ *
11715
+ * Use this for runtime string-keyed access when the kind is not known at
11716
+ * compile time (e.g., iterating all kinds, resolving from edge metadata,
11717
+ * dynamic admin UIs).
11718
+ */
11719
+ getNodeCollection(kind) {
11720
+ if (!Object.hasOwn(this.#graph.nodes, kind)) return void 0;
11721
+ return this.nodes[kind];
11722
+ }
11723
+ /**
11724
+ * Returns the edge collection for the given kind, or undefined if the kind
11725
+ * is not registered in this graph.
11726
+ *
11727
+ * Use this for runtime string-keyed access when the kind is not known at
11728
+ * compile time.
11729
+ */
11730
+ getEdgeCollection(kind) {
11731
+ if (!Object.hasOwn(this.#graph.edges, kind)) return void 0;
11732
+ return this.edges[kind];
11733
+ }
11710
11734
  /**
11711
11735
  * Node operations bound to this store instance.
11712
11736
  */