@nicia-ai/typegraph 0.20.0 → 0.22.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 (101) hide show
  1. package/dist/{ast-Bh2NDeaK.d.cts → ast-CSLbPIOC.d.ts} +56 -3
  2. package/dist/{ast-COMyNeMn.d.ts → ast-DogwbBqA.d.cts} +56 -3
  3. package/dist/backend/postgres/index.cjs +123 -45
  4. package/dist/backend/postgres/index.cjs.map +1 -1
  5. package/dist/backend/postgres/index.d.cts +15 -7
  6. package/dist/backend/postgres/index.d.ts +15 -7
  7. package/dist/backend/postgres/index.js +101 -23
  8. package/dist/backend/postgres/index.js.map +1 -1
  9. package/dist/backend/sqlite/index.cjs +15 -15
  10. package/dist/backend/sqlite/index.d.cts +22 -7
  11. package/dist/backend/sqlite/index.d.ts +22 -7
  12. package/dist/backend/sqlite/index.js +5 -5
  13. package/dist/backend/sqlite/libsql.cjs +8 -8
  14. package/dist/backend/sqlite/libsql.d.cts +4 -5
  15. package/dist/backend/sqlite/libsql.d.ts +4 -5
  16. package/dist/backend/sqlite/libsql.js +5 -5
  17. package/dist/backend/sqlite/local.cjs +27 -10
  18. package/dist/backend/sqlite/local.cjs.map +1 -1
  19. package/dist/backend/sqlite/local.d.cts +4 -5
  20. package/dist/backend/sqlite/local.d.ts +4 -5
  21. package/dist/backend/sqlite/local.js +22 -6
  22. package/dist/backend/sqlite/local.js.map +1 -1
  23. package/dist/{chunk-MME3H4ZF.cjs → chunk-3JK66E3I.cjs} +387 -9
  24. package/dist/chunk-3JK66E3I.cjs.map +1 -0
  25. package/dist/{chunk-6GWJH6AR.js → chunk-3PPEHLGK.js} +4 -4
  26. package/dist/{chunk-6GWJH6AR.js.map → chunk-3PPEHLGK.js.map} +1 -1
  27. package/dist/{chunk-QFZQGEQ3.js → chunk-5ZMMHUWR.js} +199 -38
  28. package/dist/chunk-5ZMMHUWR.js.map +1 -0
  29. package/dist/{chunk-GNIYZKBI.js → chunk-753F33CV.js} +378 -8
  30. package/dist/chunk-753F33CV.js.map +1 -0
  31. package/dist/{chunk-K7SQ3SWP.js → chunk-EYELZHKY.js} +120 -12
  32. package/dist/chunk-EYELZHKY.js.map +1 -0
  33. package/dist/{chunk-HXJXTOXR.cjs → chunk-GUYI6VAS.cjs} +101 -21
  34. package/dist/chunk-GUYI6VAS.cjs.map +1 -0
  35. package/dist/{chunk-X33WV2UF.cjs → chunk-HRNQ3DVJ.cjs} +24 -21
  36. package/dist/chunk-HRNQ3DVJ.cjs.map +1 -0
  37. package/dist/{chunk-W6M7XWKX.js → chunk-JYUQA77I.js} +21 -18
  38. package/dist/chunk-JYUQA77I.js.map +1 -0
  39. package/dist/{chunk-LLHFS53Q.js → chunk-NSLTDXVH.js} +91 -11
  40. package/dist/chunk-NSLTDXVH.js.map +1 -0
  41. package/dist/{chunk-LELLOHJK.cjs → chunk-PEE4EWXZ.cjs} +35 -35
  42. package/dist/{chunk-LELLOHJK.cjs.map → chunk-PEE4EWXZ.cjs.map} +1 -1
  43. package/dist/{chunk-G5CYWKRF.js → chunk-RS5OLGEW.js} +2 -2
  44. package/dist/{chunk-G5CYWKRF.js.map → chunk-RS5OLGEW.js.map} +1 -1
  45. package/dist/{chunk-IYWWXOVK.cjs → chunk-SCXOGKLD.cjs} +252 -91
  46. package/dist/chunk-SCXOGKLD.cjs.map +1 -0
  47. package/dist/{chunk-P5CNM325.cjs → chunk-UVZHTBZ5.cjs} +123 -11
  48. package/dist/chunk-UVZHTBZ5.cjs.map +1 -0
  49. package/dist/{chunk-5GZMPJOP.cjs → chunk-WRWVWKQL.cjs} +2 -2
  50. package/dist/{chunk-5GZMPJOP.cjs.map → chunk-WRWVWKQL.cjs.map} +1 -1
  51. package/dist/{ddl-BBo2EcFc.d.cts → ddl-BqkTShcR.d.ts} +28 -6
  52. package/dist/{ddl-D4jlcOH_.d.ts → ddl-Dk1NDN3M.d.cts} +28 -6
  53. package/dist/index.cjs +1809 -513
  54. package/dist/index.cjs.map +1 -1
  55. package/dist/index.d.cts +53 -11
  56. package/dist/index.d.ts +53 -11
  57. package/dist/index.js +1668 -398
  58. package/dist/index.js.map +1 -1
  59. package/dist/indexes/index.cjs +17 -17
  60. package/dist/indexes/index.d.cts +5 -5
  61. package/dist/indexes/index.d.ts +5 -5
  62. package/dist/indexes/index.js +3 -3
  63. package/dist/interchange/index.cjs +6 -6
  64. package/dist/interchange/index.d.cts +4 -5
  65. package/dist/interchange/index.d.ts +4 -5
  66. package/dist/interchange/index.js +1 -1
  67. package/dist/{manager-Chhrq1vl.d.ts → manager-0jVZtiE8.d.ts} +1 -2
  68. package/dist/{manager-Bj1UEnhE.d.cts → manager-BPK-2PUI.d.cts} +1 -2
  69. package/dist/profiler/index.cjs +15 -8
  70. package/dist/profiler/index.cjs.map +1 -1
  71. package/dist/profiler/index.d.cts +7 -8
  72. package/dist/profiler/index.d.ts +7 -8
  73. package/dist/profiler/index.js +8 -1
  74. package/dist/profiler/index.js.map +1 -1
  75. package/dist/schema/index.cjs +21 -21
  76. package/dist/schema/index.d.cts +4 -5
  77. package/dist/schema/index.d.ts +4 -5
  78. package/dist/schema/index.js +3 -3
  79. package/dist/{sqlite-DE-6NWtC.d.cts → sqlite-D1rrwcir.d.cts} +14 -1
  80. package/dist/{sqlite-Blq-AhmK.d.ts → sqlite-W3rmJMlc.d.ts} +14 -1
  81. package/dist/{store-BMrRi_mY.d.ts → store-2QW2SIRk.d.cts} +404 -5
  82. package/dist/{store-DRRvALu8.d.cts → store-C0q13mtJ.d.ts} +404 -5
  83. package/dist/{types-B3mmOMJV.d.cts → types-CQF88McG.d.cts} +475 -2
  84. package/dist/{types-ThB4cFLp.d.ts → types-CQF88McG.d.ts} +475 -2
  85. package/dist/{types-COPePE8_.d.ts → types-CglvhPKz.d.ts} +1 -1
  86. package/dist/{types-CVtGFpB9.d.cts → types-D23slCOA.d.cts} +1 -1
  87. package/dist/{types-Ceb01czq.d.ts → types-IMQCuser.d.ts} +2 -2
  88. package/dist/{types-CZd2PEOc.d.cts → types-vgjar7Ch.d.cts} +2 -2
  89. package/package.json +9 -9
  90. package/dist/chunk-GNIYZKBI.js.map +0 -1
  91. package/dist/chunk-HXJXTOXR.cjs.map +0 -1
  92. package/dist/chunk-IYWWXOVK.cjs.map +0 -1
  93. package/dist/chunk-K7SQ3SWP.js.map +0 -1
  94. package/dist/chunk-LLHFS53Q.js.map +0 -1
  95. package/dist/chunk-MME3H4ZF.cjs.map +0 -1
  96. package/dist/chunk-P5CNM325.cjs.map +0 -1
  97. package/dist/chunk-QFZQGEQ3.js.map +0 -1
  98. package/dist/chunk-W6M7XWKX.js.map +0 -1
  99. package/dist/chunk-X33WV2UF.cjs.map +0 -1
  100. package/dist/types-DMzKq0d5.d.cts +0 -181
  101. package/dist/types-DMzKq0d5.d.ts +0 -181
package/dist/index.d.cts CHANGED
@@ -1,15 +1,13 @@
1
1
  import { z } from 'zod';
2
- import { N as NodeType, E as EdgeType } from './types-DMzKq0d5.cjs';
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
- import { I as InferenceType, M as MetaEdge, O as OntologyRelation } from './types-B3mmOMJV.cjs';
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-DRRvALu8.cjs';
7
- 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 DegreeOptions, j as DynamicEdgeCollection, k as DynamicNodeCollection, l as Edge, m as EdgeAccessor, n as EdgeCollection, o as EdgeFindByEndpointsOptions, p as EdgeGetOrCreateByEndpointsOptions, q as EdgeGetOrCreateByEndpointsResult, r as EmbeddingSchema, s as EmbeddingValue, t as ExecutableAggregateQuery, u as ExecutableQuery, F as FieldAccessor, G as GetOrCreateAction, v as GraphAlgorithms, w as GraphEdgeCollections, x as GraphNodeCollections, H as HookContext, I as IfExistsMode, N as NeighborsOptions, y as Node, z as NodeAccessor, J as NodeAlias, K as NodeCollection, L as NodeGetOrCreateByConstraintOptions, M as NodeGetOrCreateByConstraintResult, O as NodeIdentifier, P as NodeRef, R as OperationHookContext, S as PaginateOptions, U as PaginatedResult, V as PathNode, W as Predicate, X as PreparedQuery, Y as PropsAccessor, Z as QueryHookContext, _ as QueryOptions, $ as ReachableNode, a0 as ReachableOptions, a1 as RecursiveTraversalOptions, a2 as SelectContext, a3 as SelectableEdge, a4 as SelectableNode, a5 as ShortestPathOptions, a6 as ShortestPathResult, a7 as Store, a8 as StoreHooks, a9 as StoreOptions, aa as StoreProjection, ab as StreamOptions, ac as SubgraphEdgeResult, ad as SubgraphNodeResult, ae as SubgraphOptions, af as SubgraphResult, ag as SubsetEdge, ah as SubsetNode, ai as TemporalAlgorithmOptions, aj as TransactionContext, ak as TraversalDirection, al as TypedEdgeCollection, am as UnionableQuery, an as UpdateEdgeInput, ao as UpdateNodeInput, ap as createStore, aq as createStoreWithSchema, ar as defineSubgraphProject, as as embedding, at as exists, au as fieldRef, av as getEmbeddingDimensions, aw as inSubquery, ax as isEmbeddingSchema, ay as isParameterRef, az as notExists, aA as notInSubquery, aB as param } from './store-DRRvALu8.cjs';
8
- import { G as GraphDef, K as KindRegistry } from './manager-Bj1UEnhE.cjs';
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';
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';
10
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';
11
- import { A as AggregateExpr, F as FieldRef, C as ComparisonOp, a as AggregateComparisonPredicate } from './ast-Bh2NDeaK.cjs';
12
- export { 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-Bh2NDeaK.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';
13
11
  import 'drizzle-orm';
14
12
 
15
13
  /**
@@ -482,6 +480,50 @@ declare function count(alias: string, field?: string): AggregateExpr;
482
480
  * @param field - Optional field to count distinct values of
483
481
  */
484
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;
485
527
  /**
486
528
  * Creates a SUM aggregate expression.
487
529
  *
@@ -724,4 +766,4 @@ type IdConfig = Readonly<{
724
766
  edgeIdGenerator: IdGenerator;
725
767
  }>;
726
768
 
727
- 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,15 +1,13 @@
1
1
  import { z } from 'zod';
2
- import { N as NodeType, E as EdgeType } from './types-DMzKq0d5.js';
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
- import { I as InferenceType, M as MetaEdge, O as OntologyRelation } from './types-ThB4cFLp.js';
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-BMrRi_mY.js';
7
- 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 DegreeOptions, j as DynamicEdgeCollection, k as DynamicNodeCollection, l as Edge, m as EdgeAccessor, n as EdgeCollection, o as EdgeFindByEndpointsOptions, p as EdgeGetOrCreateByEndpointsOptions, q as EdgeGetOrCreateByEndpointsResult, r as EmbeddingSchema, s as EmbeddingValue, t as ExecutableAggregateQuery, u as ExecutableQuery, F as FieldAccessor, G as GetOrCreateAction, v as GraphAlgorithms, w as GraphEdgeCollections, x as GraphNodeCollections, H as HookContext, I as IfExistsMode, N as NeighborsOptions, y as Node, z as NodeAccessor, J as NodeAlias, K as NodeCollection, L as NodeGetOrCreateByConstraintOptions, M as NodeGetOrCreateByConstraintResult, O as NodeIdentifier, P as NodeRef, R as OperationHookContext, S as PaginateOptions, U as PaginatedResult, V as PathNode, W as Predicate, X as PreparedQuery, Y as PropsAccessor, Z as QueryHookContext, _ as QueryOptions, $ as ReachableNode, a0 as ReachableOptions, a1 as RecursiveTraversalOptions, a2 as SelectContext, a3 as SelectableEdge, a4 as SelectableNode, a5 as ShortestPathOptions, a6 as ShortestPathResult, a7 as Store, a8 as StoreHooks, a9 as StoreOptions, aa as StoreProjection, ab as StreamOptions, ac as SubgraphEdgeResult, ad as SubgraphNodeResult, ae as SubgraphOptions, af as SubgraphResult, ag as SubsetEdge, ah as SubsetNode, ai as TemporalAlgorithmOptions, aj as TransactionContext, ak as TraversalDirection, al as TypedEdgeCollection, am as UnionableQuery, an as UpdateEdgeInput, ao as UpdateNodeInput, ap as createStore, aq as createStoreWithSchema, ar as defineSubgraphProject, as as embedding, at as exists, au as fieldRef, av as getEmbeddingDimensions, aw as inSubquery, ax as isEmbeddingSchema, ay as isParameterRef, az as notExists, aA as notInSubquery, aB as param } from './store-BMrRi_mY.js';
8
- import { G as GraphDef, K as KindRegistry } from './manager-Chhrq1vl.js';
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';
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';
10
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';
11
- import { A as AggregateExpr, F as FieldRef, C as ComparisonOp, a as AggregateComparisonPredicate } from './ast-COMyNeMn.js';
12
- export { 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-COMyNeMn.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';
13
11
  import 'drizzle-orm';
14
12
 
15
13
  /**
@@ -482,6 +480,50 @@ declare function count(alias: string, field?: string): AggregateExpr;
482
480
  * @param field - Optional field to count distinct values of
483
481
  */
484
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;
485
527
  /**
486
528
  * Creates a SUM aggregate expression.
487
529
  *
@@ -724,4 +766,4 @@ type IdConfig = Readonly<{
724
766
  edgeIdGenerator: IdGenerator;
725
767
  }>;
726
768
 
727
- 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 };