@nicia-ai/typegraph 0.21.0 → 0.23.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.
Files changed (85) hide show
  1. package/dist/{ast-CSLbPIOC.d.ts → ast-C8S37w1A.d.ts} +1 -1
  2. package/dist/{ast-DogwbBqA.d.cts → ast-dgLhLOg0.d.cts} +1 -1
  3. package/dist/backend/postgres/index.cjs +169 -52
  4. package/dist/backend/postgres/index.cjs.map +1 -1
  5. package/dist/backend/postgres/index.d.cts +43 -6
  6. package/dist/backend/postgres/index.d.ts +43 -6
  7. package/dist/backend/postgres/index.js +140 -23
  8. package/dist/backend/postgres/index.js.map +1 -1
  9. package/dist/backend/sqlite/index.cjs +15 -14
  10. package/dist/backend/sqlite/index.d.cts +17 -6
  11. package/dist/backend/sqlite/index.d.ts +17 -6
  12. package/dist/backend/sqlite/index.js +5 -4
  13. package/dist/backend/sqlite/libsql.cjs +8 -7
  14. package/dist/backend/sqlite/libsql.cjs.map +1 -1
  15. package/dist/backend/sqlite/libsql.d.cts +4 -4
  16. package/dist/backend/sqlite/libsql.d.ts +4 -4
  17. package/dist/backend/sqlite/libsql.js +5 -4
  18. package/dist/backend/sqlite/libsql.js.map +1 -1
  19. package/dist/backend/sqlite/local.cjs +27 -9
  20. package/dist/backend/sqlite/local.cjs.map +1 -1
  21. package/dist/backend/sqlite/local.d.cts +4 -4
  22. package/dist/backend/sqlite/local.d.ts +4 -4
  23. package/dist/backend/sqlite/local.js +22 -5
  24. package/dist/backend/sqlite/local.js.map +1 -1
  25. package/dist/chunk-3EUKJEQ3.js +77 -0
  26. package/dist/chunk-3EUKJEQ3.js.map +1 -0
  27. package/dist/{chunk-FQCQM3KG.cjs → chunk-3JK66E3I.cjs} +4 -2
  28. package/dist/chunk-3JK66E3I.cjs.map +1 -0
  29. package/dist/{chunk-SMMOAVJ5.js → chunk-3PPEHLGK.js} +3 -3
  30. package/dist/{chunk-SMMOAVJ5.js.map → chunk-3PPEHLGK.js.map} +1 -1
  31. package/dist/{chunk-4XNE2JG3.js → chunk-753F33CV.js} +4 -2
  32. package/dist/chunk-753F33CV.js.map +1 -0
  33. package/dist/{chunk-Q73OWTJY.cjs → chunk-7OD2EPN4.cjs} +130 -106
  34. package/dist/chunk-7OD2EPN4.cjs.map +1 -0
  35. package/dist/chunk-7TU5EWQ7.js +47 -0
  36. package/dist/chunk-7TU5EWQ7.js.map +1 -0
  37. package/dist/{chunk-NRNJ52AA.js → chunk-EP2KSSD5.js} +41 -25
  38. package/dist/chunk-EP2KSSD5.js.map +1 -0
  39. package/dist/{chunk-UQVBVBVG.js → chunk-H2CAJ4ZV.js} +71 -45
  40. package/dist/chunk-H2CAJ4ZV.js.map +1 -0
  41. package/dist/chunk-HTGDWIDE.cjs +89 -0
  42. package/dist/chunk-HTGDWIDE.cjs.map +1 -0
  43. package/dist/{chunk-CQL6FOTT.cjs → chunk-O5BRZEIZ.cjs} +58 -42
  44. package/dist/chunk-O5BRZEIZ.cjs.map +1 -0
  45. package/dist/{chunk-2X7P7AD5.cjs → chunk-PEE4EWXZ.cjs} +22 -22
  46. package/dist/{chunk-2X7P7AD5.cjs.map → chunk-PEE4EWXZ.cjs.map} +1 -1
  47. package/dist/chunk-RNUNP5JD.cjs +52 -0
  48. package/dist/chunk-RNUNP5JD.cjs.map +1 -0
  49. package/dist/{ddl-BqkTShcR.d.ts → ddl-1tFIvt9V.d.ts} +3 -3
  50. package/dist/{ddl-Dk1NDN3M.d.cts → ddl-B_H8JM-E.d.cts} +3 -3
  51. package/dist/index.cjs +267 -198
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.cts +53 -9
  54. package/dist/index.d.ts +53 -9
  55. package/dist/index.js +209 -142
  56. package/dist/index.js.map +1 -1
  57. package/dist/indexes/index.cjs +16 -16
  58. package/dist/indexes/index.d.cts +5 -5
  59. package/dist/indexes/index.d.ts +5 -5
  60. package/dist/indexes/index.js +2 -2
  61. package/dist/interchange/index.d.cts +4 -4
  62. package/dist/interchange/index.d.ts +4 -4
  63. package/dist/{manager-BPK-2PUI.d.cts → manager-Vkz28eAC.d.cts} +1 -1
  64. package/dist/{manager-0jVZtiE8.d.ts → manager-nIhmttD-.d.ts} +1 -1
  65. package/dist/profiler/index.d.cts +6 -6
  66. package/dist/profiler/index.d.ts +6 -6
  67. package/dist/schema/index.d.cts +4 -4
  68. package/dist/schema/index.d.ts +4 -4
  69. package/dist/{sqlite-D1rrwcir.d.cts → sqlite-D0aceIe0.d.cts} +1 -1
  70. package/dist/{sqlite-W3rmJMlc.d.ts → sqlite-SUxbZqfy.d.ts} +1 -1
  71. package/dist/{store-C0q13mtJ.d.ts → store-CpvwTMxV.d.cts} +58 -8
  72. package/dist/{store-2QW2SIRk.d.cts → store-U3i2tUch.d.ts} +58 -8
  73. package/dist/{types-IMQCuser.d.ts → types-C-zfYDJB.d.ts} +2 -2
  74. package/dist/{types-vgjar7Ch.d.cts → types-CQx4iW5Y.d.cts} +2 -2
  75. package/dist/{types-CQF88McG.d.ts → types-Qk2l3IkQ.d.cts} +20 -1
  76. package/dist/{types-CQF88McG.d.cts → types-Qk2l3IkQ.d.ts} +20 -1
  77. package/dist/{types-CglvhPKz.d.ts → types-qYFZ9SqD.d.ts} +1 -1
  78. package/dist/{types-D23slCOA.d.cts → types-yH4_p0XB.d.cts} +1 -1
  79. package/package.json +15 -1
  80. package/dist/chunk-4XNE2JG3.js.map +0 -1
  81. package/dist/chunk-CQL6FOTT.cjs.map +0 -1
  82. package/dist/chunk-FQCQM3KG.cjs.map +0 -1
  83. package/dist/chunk-NRNJ52AA.js.map +0 -1
  84. package/dist/chunk-Q73OWTJY.cjs.map +0 -1
  85. package/dist/chunk-UQVBVBVG.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { z } from 'zod';
2
- import { N as NodeType, E as EdgeType, I as InferenceType, M as MetaEdge, O as OntologyRelation } from './types-CQF88McG.cjs';
3
- export { A as AnyEdgeType, B as BackendCapabilities, C as Cardinality, a as Collation, D as DEFAULT_SQL_SCHEMA, b as DeleteBehavior, c as DeleteFulltextBatchParams, d as EdgeId, e as EdgeProps, f as EdgeRegistration, g as EdgeTypeWithEndpoints, h as EndpointExistence, F as FulltextBatchRow, i as FulltextCapabilities, j as FulltextQueryMode, k as FulltextSearchParams, l as FulltextSearchResult, m as FulltextStrategy, G as GraphBackend, n as GraphDefaults, o as MetaEdgeProperties, p as NodeId, q as NodeProps, r as NodeRegistration, S as SqlDialect, s as SqlSchema, t as SqlTableNames, T as TemporalMode, u as TransactionBackend, U as UniqueConstraint, v as UniquenessScope, w as UpsertFulltextBatchParams, V as VectorCapabilities, x as createSqlSchema, y as fts5Strategy, z as isEdgeType, H as isEdgeTypeWithEndpoints, J as isMetaEdge, K as isNodeType, L as tsvectorStrategy } from './types-CQF88McG.cjs';
4
- import { A as AliasMap, E as EdgeAliasMap, Q as QueryBuilder, T as TraversalBuilder, C as CreateQueryBuilderOptions } from './store-2QW2SIRk.cjs';
5
- export { a as AggregateResult, b as AlgorithmCyclePolicy, c as AnyEdge, d as AnyNode, B as BaseTraversalOptions, e as BatchResults, f as BatchableQuery, g as ConstraintNames, h as CreateEdgeInput, i as CreateNodeInput, D as DEFAULT_SEARCHABLE_LANGUAGE, j as DegreeOptions, k as DynamicEdgeCollection, l as DynamicNodeCollection, m as Edge, n as EdgeAccessor, o as EdgeCollection, p as EdgeFindByEndpointsOptions, q as EdgeGetOrCreateByEndpointsOptions, r as EdgeGetOrCreateByEndpointsResult, s as EmbeddingSchema, t as EmbeddingValue, u as ExecutableAggregateQuery, v as ExecutableQuery, F as FieldAccessor, w as FulltextSearchHit, x as FulltextSearchOptions, G as GetOrCreateAction, y as GraphAlgorithms, z as GraphEdgeCollections, H as GraphNodeCollections, I as HookContext, J as HybridFulltextOptions, K as HybridSearchHit, L as HybridSearchOptions, M as HybridVectorOptions, N as IfExistsMode, O as NeighborsOptions, P as Node, R as NodeAccessor, S as NodeAlias, U as NodeCollection, V as NodeGetOrCreateByConstraintOptions, W as NodeGetOrCreateByConstraintResult, X as NodeIdentifier, Y as NodeRef, Z as OperationHookContext, _ as PaginateOptions, $ as PaginatedResult, a0 as PathNode, a1 as Predicate, a2 as PreparedQuery, a3 as PropsAccessor, a4 as QueryHookContext, a5 as QueryOptions, a6 as ReachableNode, a7 as ReachableOptions, a8 as RebuildFulltextOptions, a9 as RebuildFulltextResult, aa as RecursiveTraversalOptions, ab as SearchableMetadata, ac as SearchableOptions, ad as SearchableSchema, ae as SelectContext, af as SelectableEdge, ag as SelectableNode, ah as ShortestPathOptions, ai as ShortestPathResult, aj as Store, ak as StoreHooks, al as StoreOptions, am as StoreProjection, an as StoreSearch, ao as StreamOptions, ap as SubgraphEdgeResult, aq as SubgraphNodeResult, ar as SubgraphOptions, as as SubgraphResult, at as SubsetEdge, au as SubsetNode, av as TemporalAlgorithmOptions, aw as TransactionContext, ax as TraversalDirection, ay as TypedEdgeCollection, az as UnionableQuery, aA as UpdateEdgeInput, aB as UpdateNodeInput, aC as VectorSearchHit, aD as createStore, aE as createStoreWithSchema, aF as defineSubgraphProject, aG as embedding, aH as exists, aI as fieldRef, aJ as getEmbeddingDimensions, aK as getSearchableMetadata, aL as inSubquery, aM as isEmbeddingSchema, aN as isParameterRef, aO as isSearchableSchema, aP as notExists, aQ as notInSubquery, aR as param, aS as searchable } from './store-2QW2SIRk.cjs';
6
- import { G as GraphDef, K as KindRegistry } from './manager-BPK-2PUI.cjs';
7
- 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-BPK-2PUI.cjs';
2
+ import { N as NodeType, E as EdgeType, I as InferenceType, M as MetaEdge, O as OntologyRelation } from './types-Qk2l3IkQ.cjs';
3
+ export { A as AnyEdgeType, B as BackendCapabilities, C as Cardinality, a as Collation, D as DEFAULT_SQL_SCHEMA, b as DeleteBehavior, c as DeleteFulltextBatchParams, d as EdgeId, e as EdgeProps, f as EdgeRegistration, g as EdgeTypeWithEndpoints, h as EndpointExistence, F as FulltextBatchRow, i as FulltextCapabilities, j as FulltextQueryMode, k as FulltextSearchParams, l as FulltextSearchResult, m as FulltextStrategy, G as GraphBackend, n as GraphDefaults, o as MetaEdgeProperties, p as NodeId, q as NodeProps, r as NodeRegistration, S as SqlDialect, s as SqlSchema, t as SqlTableNames, T as TemporalMode, u as TransactionBackend, U as UniqueConstraint, v as UniquenessScope, w as UpsertFulltextBatchParams, V as VectorCapabilities, x as createSqlSchema, y as fts5Strategy, z as isEdgeType, H as isEdgeTypeWithEndpoints, J as isMetaEdge, K as isNodeType, L as tsvectorStrategy } from './types-Qk2l3IkQ.cjs';
4
+ import { A as AliasMap, E as EdgeAliasMap, Q as QueryBuilder, T as TraversalBuilder, C as CreateQueryBuilderOptions } from './store-CpvwTMxV.cjs';
5
+ export { a as AggregateResult, b as AlgorithmCyclePolicy, c as AnyEdge, d as AnyNode, B as BaseTraversalOptions, e as BatchResults, f as BatchableQuery, g as ConstraintNames, h as CreateEdgeInput, i as CreateNodeInput, D as DEFAULT_SEARCHABLE_LANGUAGE, j as DegreeOptions, k as DynamicEdgeCollection, l as DynamicNodeCollection, m as Edge, n as EdgeAccessor, o as EdgeCollection, p as EdgeFindByEndpointsOptions, q as EdgeGetOrCreateByEndpointsOptions, r as EdgeGetOrCreateByEndpointsResult, s as EmbeddingSchema, t as EmbeddingValue, u as ExecutableAggregateQuery, v as ExecutableQuery, F as FieldAccessor, w as FulltextSearchHit, x as FulltextSearchOptions, G as GetOrCreateAction, y as GraphAlgorithms, z as GraphEdgeCollections, H as GraphNodeCollections, I as HookContext, J as HybridFulltextOptions, K as HybridSearchHit, L as HybridSearchOptions, M as HybridVectorOptions, N as IfExistsMode, O as NeighborsOptions, P as Node, R as NodeAccessor, S as NodeAlias, U as NodeCollection, V as NodeGetOrCreateByConstraintOptions, W as NodeGetOrCreateByConstraintResult, X as NodeIdentifier, Y as NodeRef, Z as OperationHookContext, _ as PaginateOptions, $ as PaginatedResult, a0 as PathNode, a1 as Predicate, a2 as PreparedQuery, a3 as PropsAccessor, a4 as QueryHookContext, a5 as QueryOptions, a6 as ReachableNode, a7 as ReachableOptions, a8 as RebuildFulltextOptions, a9 as RebuildFulltextResult, aa as RecursiveTraversalOptions, ab as SearchableMetadata, ac as SearchableOptions, ad as SearchableSchema, ae as SelectContext, af as SelectableEdge, ag as SelectableNode, ah as ShortestPathOptions, ai as ShortestPathResult, aj as Store, ak as StoreHooks, al as StoreOptions, am as StoreProjection, an as StoreSearch, ao as StreamOptions, ap as SubgraphEdgeResult, aq as SubgraphNodeResult, ar as SubgraphOptions, as as SubgraphResult, at as SubsetEdge, au as SubsetNode, av as TemporalAlgorithmOptions, aw as TransactionContext, ax as TraversalDirection, ay as TypedEdgeCollection, az as UnionableQuery, aA as UpdateEdgeInput, aB as UpdateNodeInput, aC as VectorSearchHit, aD as createStore, aE as createStoreWithSchema, aF as defineSubgraphProject, aG as embedding, aH as exists, aI as fieldRef, aJ as getEmbeddingDimensions, aK as getSearchableMetadata, aL as inSubquery, aM as isEmbeddingSchema, aN as isParameterRef, aO as isSearchableSchema, aP as notExists, aQ as notInSubquery, aR as param, aS as searchable } from './store-CpvwTMxV.cjs';
6
+ import { G as GraphDef, K as KindRegistry } from './manager-Vkz28eAC.cjs';
7
+ 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-Vkz28eAC.cjs';
8
8
  export { B as BackendDisposedError, 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-DXkEXpNz.cjs';
9
- import { A as AggregateExpr, F as FieldRef, C as ComparisonOp, a as AggregateComparisonPredicate } from './ast-DogwbBqA.cjs';
10
- export { H as HybridFusionOptions, J as JsonPointer, b as JsonPointerFor, c as JsonPointerInput, d as JsonPointerSegment, e as JsonPointerSegments, f as JsonPointerSegmentsFor, M as MAX_JSON_POINTER_DEPTH, O as OrderSpec, P as ParameterRef, R as ResolveJsonPointer, g as ResolveJsonPointerSegments, S as SortDirection, T as TraversalExpansion, j as joinJsonPointers, h as jsonPointer, n as normalizeJsonPointer, p as parseJsonPointer } from './ast-DogwbBqA.cjs';
9
+ import { A as AggregateExpr, F as FieldRef, C as ComparisonOp, a as AggregateComparisonPredicate } from './ast-dgLhLOg0.cjs';
10
+ export { H as HybridFusionOptions, J as JsonPointer, b as JsonPointerFor, c as JsonPointerInput, d as JsonPointerSegment, e as JsonPointerSegments, f as JsonPointerSegmentsFor, M as MAX_JSON_POINTER_DEPTH, O as OrderSpec, P as ParameterRef, R as ResolveJsonPointer, g as ResolveJsonPointerSegments, S as SortDirection, T as TraversalExpansion, j as joinJsonPointers, h as jsonPointer, n as normalizeJsonPointer, p as parseJsonPointer } from './ast-dgLhLOg0.cjs';
11
11
  import 'drizzle-orm';
12
12
 
13
13
  /**
@@ -480,6 +480,50 @@ declare function count(alias: string, field?: string): AggregateExpr;
480
480
  * @param field - Optional field to count distinct values of
481
481
  */
482
482
  declare function countDistinct(alias: string, field?: string): AggregateExpr;
483
+ /**
484
+ * Creates a COUNT aggregate expression over an edge alias.
485
+ *
486
+ * Counts edges directly, without joining back to the target node table.
487
+ * This has different semantics from `count(targetAlias)`:
488
+ *
489
+ * - `countEdges(edgeAlias)` — counts live edges, regardless of target-node
490
+ * temporal state. If a target node's `validTo` is in the past while its
491
+ * incident edges are still live, those edges are still counted.
492
+ * - `count(targetAlias)` — counts edges whose target node is currently
493
+ * valid under the query's temporal mode.
494
+ *
495
+ * For the common case ("how many follow relationships does this user
496
+ * have?") the edge-count semantics is what you want, and the compiler
497
+ * can skip the target-node join entirely — measurably faster on
498
+ * full-graph aggregates where the join dominates cost.
499
+ *
500
+ * @example
501
+ * ```typescript
502
+ * store
503
+ * .query()
504
+ * .from("User", "u")
505
+ * .optionalTraverse("follows", "e", { expand: "none" })
506
+ * .to("User", "target")
507
+ * .groupByNode("u")
508
+ * .aggregate({
509
+ * name: field("u", "name"),
510
+ * // counts edges — skips the target-node join
511
+ * followCount: countEdges("e"),
512
+ * })
513
+ * .execute();
514
+ * ```
515
+ */
516
+ declare function countEdges(edgeAlias: string): AggregateExpr;
517
+ /**
518
+ * Creates a COUNT DISTINCT aggregate expression over an edge alias.
519
+ * See {@link countEdges} for semantics.
520
+ *
521
+ * Distinct-on-edge-id is equivalent to `countEdges` when the query
522
+ * surface produces each edge exactly once, but stays meaningful under
523
+ * polymorphic expansions and ontology-driven edge fan-outs where the
524
+ * same edge can appear multiple times in the join output.
525
+ */
526
+ declare function countDistinctEdges(edgeAlias: string): AggregateExpr;
483
527
  /**
484
528
  * Creates a SUM aggregate expression.
485
529
  *
@@ -722,4 +766,4 @@ type IdConfig = Readonly<{
722
766
  edgeIdGenerator: IdGenerator;
723
767
  }>;
724
768
 
725
- export { AliasMap, type DefineEdgeOptions, type DefineNodeOptions, EdgeType, type ExternalRefSchema, type ExternalRefValue, FieldRef, type FlexibleQueryFragment, GraphDef, type IdConfig, type IdGenerator, InferenceType, MAX_EXPLICIT_RECURSIVE_DEPTH, MAX_RECURSIVE_DEPTH, MetaEdge, type MetaEdgeOptions, NodeType, OntologyRelation, QueryBuilder, type QueryFragment, type TraversalFragment, avg, broader, composeFragments, core, count, countDistinct, createExternalRef, createFragment, createQueryBuilder, defineEdge, defineNode, differentFrom, disjointWith, equivalentTo, externalRef, field, generateId, getExternalRefTable, hasPart, having, havingEq, havingGt, havingGte, havingLt, havingLte, implies, inverseOf, isExternalRefSchema, limitFragment, max, metaEdge, min, narrower, offsetFragment, orderByFragment, partOf, relatedTo, sameAs, subClassOf, sum };
769
+ export { AliasMap, type DefineEdgeOptions, type DefineNodeOptions, EdgeType, type ExternalRefSchema, type ExternalRefValue, FieldRef, type FlexibleQueryFragment, GraphDef, type IdConfig, type IdGenerator, InferenceType, MAX_EXPLICIT_RECURSIVE_DEPTH, MAX_RECURSIVE_DEPTH, MetaEdge, type MetaEdgeOptions, NodeType, OntologyRelation, QueryBuilder, type QueryFragment, type TraversalFragment, avg, broader, composeFragments, core, count, countDistinct, countDistinctEdges, countEdges, createExternalRef, createFragment, createQueryBuilder, defineEdge, defineNode, differentFrom, disjointWith, equivalentTo, externalRef, field, generateId, getExternalRefTable, hasPart, having, havingEq, havingGt, havingGte, havingLt, havingLte, implies, inverseOf, isExternalRefSchema, limitFragment, max, metaEdge, min, narrower, offsetFragment, orderByFragment, partOf, relatedTo, sameAs, subClassOf, sum };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { z } from 'zod';
2
- import { N as NodeType, E as EdgeType, I as InferenceType, M as MetaEdge, O as OntologyRelation } from './types-CQF88McG.js';
3
- export { A as AnyEdgeType, B as BackendCapabilities, C as Cardinality, a as Collation, D as DEFAULT_SQL_SCHEMA, b as DeleteBehavior, c as DeleteFulltextBatchParams, d as EdgeId, e as EdgeProps, f as EdgeRegistration, g as EdgeTypeWithEndpoints, h as EndpointExistence, F as FulltextBatchRow, i as FulltextCapabilities, j as FulltextQueryMode, k as FulltextSearchParams, l as FulltextSearchResult, m as FulltextStrategy, G as GraphBackend, n as GraphDefaults, o as MetaEdgeProperties, p as NodeId, q as NodeProps, r as NodeRegistration, S as SqlDialect, s as SqlSchema, t as SqlTableNames, T as TemporalMode, u as TransactionBackend, U as UniqueConstraint, v as UniquenessScope, w as UpsertFulltextBatchParams, V as VectorCapabilities, x as createSqlSchema, y as fts5Strategy, z as isEdgeType, H as isEdgeTypeWithEndpoints, J as isMetaEdge, K as isNodeType, L as tsvectorStrategy } from './types-CQF88McG.js';
4
- import { A as AliasMap, E as EdgeAliasMap, Q as QueryBuilder, T as TraversalBuilder, C as CreateQueryBuilderOptions } from './store-C0q13mtJ.js';
5
- export { a as AggregateResult, b as AlgorithmCyclePolicy, c as AnyEdge, d as AnyNode, B as BaseTraversalOptions, e as BatchResults, f as BatchableQuery, g as ConstraintNames, h as CreateEdgeInput, i as CreateNodeInput, D as DEFAULT_SEARCHABLE_LANGUAGE, j as DegreeOptions, k as DynamicEdgeCollection, l as DynamicNodeCollection, m as Edge, n as EdgeAccessor, o as EdgeCollection, p as EdgeFindByEndpointsOptions, q as EdgeGetOrCreateByEndpointsOptions, r as EdgeGetOrCreateByEndpointsResult, s as EmbeddingSchema, t as EmbeddingValue, u as ExecutableAggregateQuery, v as ExecutableQuery, F as FieldAccessor, w as FulltextSearchHit, x as FulltextSearchOptions, G as GetOrCreateAction, y as GraphAlgorithms, z as GraphEdgeCollections, H as GraphNodeCollections, I as HookContext, J as HybridFulltextOptions, K as HybridSearchHit, L as HybridSearchOptions, M as HybridVectorOptions, N as IfExistsMode, O as NeighborsOptions, P as Node, R as NodeAccessor, S as NodeAlias, U as NodeCollection, V as NodeGetOrCreateByConstraintOptions, W as NodeGetOrCreateByConstraintResult, X as NodeIdentifier, Y as NodeRef, Z as OperationHookContext, _ as PaginateOptions, $ as PaginatedResult, a0 as PathNode, a1 as Predicate, a2 as PreparedQuery, a3 as PropsAccessor, a4 as QueryHookContext, a5 as QueryOptions, a6 as ReachableNode, a7 as ReachableOptions, a8 as RebuildFulltextOptions, a9 as RebuildFulltextResult, aa as RecursiveTraversalOptions, ab as SearchableMetadata, ac as SearchableOptions, ad as SearchableSchema, ae as SelectContext, af as SelectableEdge, ag as SelectableNode, ah as ShortestPathOptions, ai as ShortestPathResult, aj as Store, ak as StoreHooks, al as StoreOptions, am as StoreProjection, an as StoreSearch, ao as StreamOptions, ap as SubgraphEdgeResult, aq as SubgraphNodeResult, ar as SubgraphOptions, as as SubgraphResult, at as SubsetEdge, au as SubsetNode, av as TemporalAlgorithmOptions, aw as TransactionContext, ax as TraversalDirection, ay as TypedEdgeCollection, az as UnionableQuery, aA as UpdateEdgeInput, aB as UpdateNodeInput, aC as VectorSearchHit, aD as createStore, aE as createStoreWithSchema, aF as defineSubgraphProject, aG as embedding, aH as exists, aI as fieldRef, aJ as getEmbeddingDimensions, aK as getSearchableMetadata, aL as inSubquery, aM as isEmbeddingSchema, aN as isParameterRef, aO as isSearchableSchema, aP as notExists, aQ as notInSubquery, aR as param, aS as searchable } from './store-C0q13mtJ.js';
6
- import { G as GraphDef, K as KindRegistry } from './manager-0jVZtiE8.js';
7
- 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-0jVZtiE8.js';
2
+ import { N as NodeType, E as EdgeType, I as InferenceType, M as MetaEdge, O as OntologyRelation } from './types-Qk2l3IkQ.js';
3
+ export { A as AnyEdgeType, B as BackendCapabilities, C as Cardinality, a as Collation, D as DEFAULT_SQL_SCHEMA, b as DeleteBehavior, c as DeleteFulltextBatchParams, d as EdgeId, e as EdgeProps, f as EdgeRegistration, g as EdgeTypeWithEndpoints, h as EndpointExistence, F as FulltextBatchRow, i as FulltextCapabilities, j as FulltextQueryMode, k as FulltextSearchParams, l as FulltextSearchResult, m as FulltextStrategy, G as GraphBackend, n as GraphDefaults, o as MetaEdgeProperties, p as NodeId, q as NodeProps, r as NodeRegistration, S as SqlDialect, s as SqlSchema, t as SqlTableNames, T as TemporalMode, u as TransactionBackend, U as UniqueConstraint, v as UniquenessScope, w as UpsertFulltextBatchParams, V as VectorCapabilities, x as createSqlSchema, y as fts5Strategy, z as isEdgeType, H as isEdgeTypeWithEndpoints, J as isMetaEdge, K as isNodeType, L as tsvectorStrategy } from './types-Qk2l3IkQ.js';
4
+ import { A as AliasMap, E as EdgeAliasMap, Q as QueryBuilder, T as TraversalBuilder, C as CreateQueryBuilderOptions } from './store-U3i2tUch.js';
5
+ export { a as AggregateResult, b as AlgorithmCyclePolicy, c as AnyEdge, d as AnyNode, B as BaseTraversalOptions, e as BatchResults, f as BatchableQuery, g as ConstraintNames, h as CreateEdgeInput, i as CreateNodeInput, D as DEFAULT_SEARCHABLE_LANGUAGE, j as DegreeOptions, k as DynamicEdgeCollection, l as DynamicNodeCollection, m as Edge, n as EdgeAccessor, o as EdgeCollection, p as EdgeFindByEndpointsOptions, q as EdgeGetOrCreateByEndpointsOptions, r as EdgeGetOrCreateByEndpointsResult, s as EmbeddingSchema, t as EmbeddingValue, u as ExecutableAggregateQuery, v as ExecutableQuery, F as FieldAccessor, w as FulltextSearchHit, x as FulltextSearchOptions, G as GetOrCreateAction, y as GraphAlgorithms, z as GraphEdgeCollections, H as GraphNodeCollections, I as HookContext, J as HybridFulltextOptions, K as HybridSearchHit, L as HybridSearchOptions, M as HybridVectorOptions, N as IfExistsMode, O as NeighborsOptions, P as Node, R as NodeAccessor, S as NodeAlias, U as NodeCollection, V as NodeGetOrCreateByConstraintOptions, W as NodeGetOrCreateByConstraintResult, X as NodeIdentifier, Y as NodeRef, Z as OperationHookContext, _ as PaginateOptions, $ as PaginatedResult, a0 as PathNode, a1 as Predicate, a2 as PreparedQuery, a3 as PropsAccessor, a4 as QueryHookContext, a5 as QueryOptions, a6 as ReachableNode, a7 as ReachableOptions, a8 as RebuildFulltextOptions, a9 as RebuildFulltextResult, aa as RecursiveTraversalOptions, ab as SearchableMetadata, ac as SearchableOptions, ad as SearchableSchema, ae as SelectContext, af as SelectableEdge, ag as SelectableNode, ah as ShortestPathOptions, ai as ShortestPathResult, aj as Store, ak as StoreHooks, al as StoreOptions, am as StoreProjection, an as StoreSearch, ao as StreamOptions, ap as SubgraphEdgeResult, aq as SubgraphNodeResult, ar as SubgraphOptions, as as SubgraphResult, at as SubsetEdge, au as SubsetNode, av as TemporalAlgorithmOptions, aw as TransactionContext, ax as TraversalDirection, ay as TypedEdgeCollection, az as UnionableQuery, aA as UpdateEdgeInput, aB as UpdateNodeInput, aC as VectorSearchHit, aD as createStore, aE as createStoreWithSchema, aF as defineSubgraphProject, aG as embedding, aH as exists, aI as fieldRef, aJ as getEmbeddingDimensions, aK as getSearchableMetadata, aL as inSubquery, aM as isEmbeddingSchema, aN as isParameterRef, aO as isSearchableSchema, aP as notExists, aQ as notInSubquery, aR as param, aS as searchable } from './store-U3i2tUch.js';
6
+ import { G as GraphDef, K as KindRegistry } from './manager-nIhmttD-.js';
7
+ 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-nIhmttD-.js';
8
8
  export { B as BackendDisposedError, 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-DXkEXpNz.js';
9
- import { A as AggregateExpr, F as FieldRef, C as ComparisonOp, a as AggregateComparisonPredicate } from './ast-CSLbPIOC.js';
10
- export { H as HybridFusionOptions, J as JsonPointer, b as JsonPointerFor, c as JsonPointerInput, d as JsonPointerSegment, e as JsonPointerSegments, f as JsonPointerSegmentsFor, M as MAX_JSON_POINTER_DEPTH, O as OrderSpec, P as ParameterRef, R as ResolveJsonPointer, g as ResolveJsonPointerSegments, S as SortDirection, T as TraversalExpansion, j as joinJsonPointers, h as jsonPointer, n as normalizeJsonPointer, p as parseJsonPointer } from './ast-CSLbPIOC.js';
9
+ import { A as AggregateExpr, F as FieldRef, C as ComparisonOp, a as AggregateComparisonPredicate } from './ast-C8S37w1A.js';
10
+ export { H as HybridFusionOptions, J as JsonPointer, b as JsonPointerFor, c as JsonPointerInput, d as JsonPointerSegment, e as JsonPointerSegments, f as JsonPointerSegmentsFor, M as MAX_JSON_POINTER_DEPTH, O as OrderSpec, P as ParameterRef, R as ResolveJsonPointer, g as ResolveJsonPointerSegments, S as SortDirection, T as TraversalExpansion, j as joinJsonPointers, h as jsonPointer, n as normalizeJsonPointer, p as parseJsonPointer } from './ast-C8S37w1A.js';
11
11
  import 'drizzle-orm';
12
12
 
13
13
  /**
@@ -480,6 +480,50 @@ declare function count(alias: string, field?: string): AggregateExpr;
480
480
  * @param field - Optional field to count distinct values of
481
481
  */
482
482
  declare function countDistinct(alias: string, field?: string): AggregateExpr;
483
+ /**
484
+ * Creates a COUNT aggregate expression over an edge alias.
485
+ *
486
+ * Counts edges directly, without joining back to the target node table.
487
+ * This has different semantics from `count(targetAlias)`:
488
+ *
489
+ * - `countEdges(edgeAlias)` — counts live edges, regardless of target-node
490
+ * temporal state. If a target node's `validTo` is in the past while its
491
+ * incident edges are still live, those edges are still counted.
492
+ * - `count(targetAlias)` — counts edges whose target node is currently
493
+ * valid under the query's temporal mode.
494
+ *
495
+ * For the common case ("how many follow relationships does this user
496
+ * have?") the edge-count semantics is what you want, and the compiler
497
+ * can skip the target-node join entirely — measurably faster on
498
+ * full-graph aggregates where the join dominates cost.
499
+ *
500
+ * @example
501
+ * ```typescript
502
+ * store
503
+ * .query()
504
+ * .from("User", "u")
505
+ * .optionalTraverse("follows", "e", { expand: "none" })
506
+ * .to("User", "target")
507
+ * .groupByNode("u")
508
+ * .aggregate({
509
+ * name: field("u", "name"),
510
+ * // counts edges — skips the target-node join
511
+ * followCount: countEdges("e"),
512
+ * })
513
+ * .execute();
514
+ * ```
515
+ */
516
+ declare function countEdges(edgeAlias: string): AggregateExpr;
517
+ /**
518
+ * Creates a COUNT DISTINCT aggregate expression over an edge alias.
519
+ * See {@link countEdges} for semantics.
520
+ *
521
+ * Distinct-on-edge-id is equivalent to `countEdges` when the query
522
+ * surface produces each edge exactly once, but stays meaningful under
523
+ * polymorphic expansions and ontology-driven edge fan-outs where the
524
+ * same edge can appear multiple times in the join output.
525
+ */
526
+ declare function countDistinctEdges(edgeAlias: string): AggregateExpr;
483
527
  /**
484
528
  * Creates a SUM aggregate expression.
485
529
  *
@@ -722,4 +766,4 @@ type IdConfig = Readonly<{
722
766
  edgeIdGenerator: IdGenerator;
723
767
  }>;
724
768
 
725
- export { AliasMap, type DefineEdgeOptions, type DefineNodeOptions, EdgeType, type ExternalRefSchema, type ExternalRefValue, FieldRef, type FlexibleQueryFragment, GraphDef, type IdConfig, type IdGenerator, InferenceType, MAX_EXPLICIT_RECURSIVE_DEPTH, MAX_RECURSIVE_DEPTH, MetaEdge, type MetaEdgeOptions, NodeType, OntologyRelation, QueryBuilder, type QueryFragment, type TraversalFragment, avg, broader, composeFragments, core, count, countDistinct, createExternalRef, createFragment, createQueryBuilder, defineEdge, defineNode, differentFrom, disjointWith, equivalentTo, externalRef, field, generateId, getExternalRefTable, hasPart, having, havingEq, havingGt, havingGte, havingLt, havingLte, implies, inverseOf, isExternalRefSchema, limitFragment, max, metaEdge, min, narrower, offsetFragment, orderByFragment, partOf, relatedTo, sameAs, subClassOf, sum };
769
+ export { AliasMap, type DefineEdgeOptions, type DefineNodeOptions, EdgeType, type ExternalRefSchema, type ExternalRefValue, FieldRef, type FlexibleQueryFragment, GraphDef, type IdConfig, type IdGenerator, InferenceType, MAX_EXPLICIT_RECURSIVE_DEPTH, MAX_RECURSIVE_DEPTH, MetaEdge, type MetaEdgeOptions, NodeType, OntologyRelation, QueryBuilder, type QueryFragment, type TraversalFragment, avg, broader, composeFragments, core, count, countDistinct, countDistinctEdges, countEdges, createExternalRef, createFragment, createQueryBuilder, defineEdge, defineNode, differentFrom, disjointWith, equivalentTo, externalRef, field, generateId, getExternalRefTable, hasPart, having, havingEq, havingGt, havingGte, havingLt, havingLte, implies, inverseOf, isExternalRefSchema, limitFragment, max, metaEdge, min, narrower, offsetFragment, orderByFragment, partOf, relatedTo, sameAs, subClassOf, sum };