@nicia-ai/typegraph 0.22.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 (73) 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 +165 -48
  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 +138 -21
  8. package/dist/backend/postgres/index.js.map +1 -1
  9. package/dist/backend/sqlite/index.cjs +13 -12
  10. package/dist/backend/sqlite/index.d.cts +6 -6
  11. package/dist/backend/sqlite/index.d.ts +6 -6
  12. package/dist/backend/sqlite/index.js +3 -2
  13. package/dist/backend/sqlite/libsql.cjs +6 -5
  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 +3 -2
  18. package/dist/backend/sqlite/libsql.js.map +1 -1
  19. package/dist/backend/sqlite/local.cjs +7 -6
  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 +3 -2
  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-SCXOGKLD.cjs → chunk-7OD2EPN4.cjs} +20 -42
  28. package/dist/chunk-7OD2EPN4.cjs.map +1 -0
  29. package/dist/chunk-7TU5EWQ7.js +47 -0
  30. package/dist/chunk-7TU5EWQ7.js.map +1 -0
  31. package/dist/{chunk-NSLTDXVH.js → chunk-EP2KSSD5.js} +18 -21
  32. package/dist/chunk-EP2KSSD5.js.map +1 -0
  33. package/dist/{chunk-5ZMMHUWR.js → chunk-H2CAJ4ZV.js} +20 -40
  34. package/dist/chunk-H2CAJ4ZV.js.map +1 -0
  35. package/dist/chunk-HTGDWIDE.cjs +89 -0
  36. package/dist/chunk-HTGDWIDE.cjs.map +1 -0
  37. package/dist/{chunk-GUYI6VAS.cjs → chunk-O5BRZEIZ.cjs} +34 -37
  38. package/dist/chunk-O5BRZEIZ.cjs.map +1 -0
  39. package/dist/chunk-RNUNP5JD.cjs +52 -0
  40. package/dist/chunk-RNUNP5JD.cjs.map +1 -0
  41. package/dist/{ddl-BqkTShcR.d.ts → ddl-1tFIvt9V.d.ts} +3 -3
  42. package/dist/{ddl-Dk1NDN3M.d.cts → ddl-B_H8JM-E.d.cts} +3 -3
  43. package/dist/index.cjs +133 -145
  44. package/dist/index.cjs.map +1 -1
  45. package/dist/index.d.cts +8 -8
  46. package/dist/index.d.ts +8 -8
  47. package/dist/index.js +94 -106
  48. package/dist/index.js.map +1 -1
  49. package/dist/indexes/index.d.cts +5 -5
  50. package/dist/indexes/index.d.ts +5 -5
  51. package/dist/interchange/index.d.cts +4 -4
  52. package/dist/interchange/index.d.ts +4 -4
  53. package/dist/{manager-BPK-2PUI.d.cts → manager-Vkz28eAC.d.cts} +1 -1
  54. package/dist/{manager-0jVZtiE8.d.ts → manager-nIhmttD-.d.ts} +1 -1
  55. package/dist/profiler/index.d.cts +6 -6
  56. package/dist/profiler/index.d.ts +6 -6
  57. package/dist/schema/index.d.cts +4 -4
  58. package/dist/schema/index.d.ts +4 -4
  59. package/dist/{sqlite-D1rrwcir.d.cts → sqlite-D0aceIe0.d.cts} +1 -1
  60. package/dist/{sqlite-W3rmJMlc.d.ts → sqlite-SUxbZqfy.d.ts} +1 -1
  61. package/dist/{store-C0q13mtJ.d.ts → store-CpvwTMxV.d.cts} +58 -8
  62. package/dist/{store-2QW2SIRk.d.cts → store-U3i2tUch.d.ts} +58 -8
  63. package/dist/{types-IMQCuser.d.ts → types-C-zfYDJB.d.ts} +2 -2
  64. package/dist/{types-vgjar7Ch.d.cts → types-CQx4iW5Y.d.cts} +2 -2
  65. package/dist/{types-CQF88McG.d.ts → types-Qk2l3IkQ.d.cts} +20 -1
  66. package/dist/{types-CQF88McG.d.cts → types-Qk2l3IkQ.d.ts} +20 -1
  67. package/dist/{types-CglvhPKz.d.ts → types-qYFZ9SqD.d.ts} +1 -1
  68. package/dist/{types-D23slCOA.d.cts → types-yH4_p0XB.d.cts} +1 -1
  69. package/package.json +15 -1
  70. package/dist/chunk-5ZMMHUWR.js.map +0 -1
  71. package/dist/chunk-GUYI6VAS.cjs.map +0 -1
  72. package/dist/chunk-NSLTDXVH.js.map +0 -1
  73. package/dist/chunk-SCXOGKLD.cjs.map +0 -1
@@ -1,12 +1,12 @@
1
- import { S as SqlDialect, A as AnyEdgeType, N as NodeType } from '../types-CQF88McG.cjs';
2
- import { E as EdgeIndex, T as TypeGraphIndex, N as NodeIndex, a as EdgeIndexConfig, b as NodeIndexConfig, I as IndexWhereExpression } from '../types-vgjar7Ch.cjs';
3
- export { c as EdgeIndexDirection, d as EdgeIndexWhereBuilder, e as IndexScope, f as IndexWhereFieldBuilder, g as IndexWhereInput, h as NodeIndexWhereBuilder, S as SystemColumnName } from '../types-vgjar7Ch.cjs';
1
+ import { S as SqlDialect, A as AnyEdgeType, N as NodeType } from '../types-Qk2l3IkQ.cjs';
2
+ import { E as EdgeIndex, T as TypeGraphIndex, N as NodeIndex, a as EdgeIndexConfig, b as NodeIndexConfig, I as IndexWhereExpression } from '../types-CQx4iW5Y.cjs';
3
+ export { c as EdgeIndexDirection, d as EdgeIndexWhereBuilder, e as IndexScope, f as IndexWhereFieldBuilder, g as IndexWhereInput, h as NodeIndexWhereBuilder, S as SystemColumnName } from '../types-CQx4iW5Y.cjs';
4
4
  import { SQLWrapper } from 'drizzle-orm';
5
5
  import { IndexBuilder } from 'drizzle-orm/pg-core';
6
6
  import { IndexBuilder as IndexBuilder$1 } from 'drizzle-orm/sqlite-core';
7
- import { D as DeclaredIndex } from '../types-D23slCOA.cjs';
7
+ import { D as DeclaredIndex } from '../types-yH4_p0XB.cjs';
8
8
  import 'zod';
9
- import '../ast-DogwbBqA.cjs';
9
+ import '../ast-dgLhLOg0.cjs';
10
10
 
11
11
  type GenerateIndexDdlOptions = Readonly<{
12
12
  nodesTableName?: string | undefined;
@@ -1,12 +1,12 @@
1
- import { S as SqlDialect, A as AnyEdgeType, N as NodeType } from '../types-CQF88McG.js';
2
- import { E as EdgeIndex, T as TypeGraphIndex, N as NodeIndex, a as EdgeIndexConfig, b as NodeIndexConfig, I as IndexWhereExpression } from '../types-IMQCuser.js';
3
- export { c as EdgeIndexDirection, d as EdgeIndexWhereBuilder, e as IndexScope, f as IndexWhereFieldBuilder, g as IndexWhereInput, h as NodeIndexWhereBuilder, S as SystemColumnName } from '../types-IMQCuser.js';
1
+ import { S as SqlDialect, A as AnyEdgeType, N as NodeType } from '../types-Qk2l3IkQ.js';
2
+ import { E as EdgeIndex, T as TypeGraphIndex, N as NodeIndex, a as EdgeIndexConfig, b as NodeIndexConfig, I as IndexWhereExpression } from '../types-C-zfYDJB.js';
3
+ export { c as EdgeIndexDirection, d as EdgeIndexWhereBuilder, e as IndexScope, f as IndexWhereFieldBuilder, g as IndexWhereInput, h as NodeIndexWhereBuilder, S as SystemColumnName } from '../types-C-zfYDJB.js';
4
4
  import { SQLWrapper } from 'drizzle-orm';
5
5
  import { IndexBuilder } from 'drizzle-orm/pg-core';
6
6
  import { IndexBuilder as IndexBuilder$1 } from 'drizzle-orm/sqlite-core';
7
- import { D as DeclaredIndex } from '../types-CglvhPKz.js';
7
+ import { D as DeclaredIndex } from '../types-qYFZ9SqD.js';
8
8
  import 'zod';
9
- import '../ast-CSLbPIOC.js';
9
+ import '../ast-C8S37w1A.js';
10
10
 
11
11
  type GenerateIndexDdlOptions = Readonly<{
12
12
  nodesTableName?: string | undefined;
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
- import { G as GraphDef } from '../manager-BPK-2PUI.cjs';
3
- import { aj as Store } from '../store-2QW2SIRk.cjs';
4
- import '../types-CQF88McG.cjs';
2
+ import { G as GraphDef } from '../manager-Vkz28eAC.cjs';
3
+ import { aj as Store } from '../store-CpvwTMxV.cjs';
4
+ import '../types-Qk2l3IkQ.cjs';
5
5
  import 'drizzle-orm';
6
- import '../ast-DogwbBqA.cjs';
6
+ import '../ast-dgLhLOg0.cjs';
7
7
 
8
8
  /**
9
9
  * Graph interchange format types.
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
- import { G as GraphDef } from '../manager-0jVZtiE8.js';
3
- import { aj as Store } from '../store-C0q13mtJ.js';
4
- import '../types-CQF88McG.js';
2
+ import { G as GraphDef } from '../manager-nIhmttD-.js';
3
+ import { aj as Store } from '../store-U3i2tUch.js';
4
+ import '../types-Qk2l3IkQ.js';
5
5
  import 'drizzle-orm';
6
- import '../ast-CSLbPIOC.js';
6
+ import '../ast-C8S37w1A.js';
7
7
 
8
8
  /**
9
9
  * Graph interchange format types.
@@ -1,4 +1,4 @@
1
- import { r as NodeRegistration, f as EdgeRegistration, O as OntologyRelation, b as DeleteBehavior, T as TemporalMode, N as NodeType, A as AnyEdgeType, n as GraphDefaults, W as SerializedNodeDef, X as SerializedEdgeDef, $ as SerializedSchema, G as GraphBackend, a4 as SchemaVersionRow } from './types-CQF88McG.cjs';
1
+ import { r as NodeRegistration, f as EdgeRegistration, O as OntologyRelation, b as DeleteBehavior, T as TemporalMode, N as NodeType, A as AnyEdgeType, n as GraphDefaults, W as SerializedNodeDef, X as SerializedEdgeDef, $ as SerializedSchema, G as GraphBackend, a4 as SchemaVersionRow } from './types-Qk2l3IkQ.cjs';
2
2
 
3
3
  /** Brand key for GraphDef */
4
4
  declare const GRAPH_DEF_BRAND: "__graphDef";
@@ -1,4 +1,4 @@
1
- import { r as NodeRegistration, f as EdgeRegistration, O as OntologyRelation, b as DeleteBehavior, T as TemporalMode, N as NodeType, A as AnyEdgeType, n as GraphDefaults, W as SerializedNodeDef, X as SerializedEdgeDef, $ as SerializedSchema, G as GraphBackend, a4 as SchemaVersionRow } from './types-CQF88McG.js';
1
+ import { r as NodeRegistration, f as EdgeRegistration, O as OntologyRelation, b as DeleteBehavior, T as TemporalMode, N as NodeType, A as AnyEdgeType, n as GraphDefaults, W as SerializedNodeDef, X as SerializedEdgeDef, $ as SerializedSchema, G as GraphBackend, a4 as SchemaVersionRow } from './types-Qk2l3IkQ.js';
2
2
 
3
3
  /** Brand key for GraphDef */
4
4
  declare const GRAPH_DEF_BRAND: "__graphDef";
@@ -1,9 +1,9 @@
1
- import { G as GraphDef } from '../manager-BPK-2PUI.cjs';
2
- import { Q as QueryAst } from '../ast-DogwbBqA.cjs';
3
- import { aj as Store } from '../store-2QW2SIRk.cjs';
4
- import { P as ProfilerOptions, a as ProfileReport } from '../types-D23slCOA.cjs';
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-D23slCOA.cjs';
6
- import '../types-CQF88McG.cjs';
1
+ import { G as GraphDef } from '../manager-Vkz28eAC.cjs';
2
+ import { Q as QueryAst } from '../ast-dgLhLOg0.cjs';
3
+ import { aj as Store } from '../store-CpvwTMxV.cjs';
4
+ import { P as ProfilerOptions, a as ProfileReport } from '../types-yH4_p0XB.cjs';
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-yH4_p0XB.cjs';
6
+ import '../types-Qk2l3IkQ.cjs';
7
7
  import 'drizzle-orm';
8
8
  import 'zod';
9
9
 
@@ -1,9 +1,9 @@
1
- import { G as GraphDef } from '../manager-0jVZtiE8.js';
2
- import { Q as QueryAst } from '../ast-CSLbPIOC.js';
3
- import { aj as Store } from '../store-C0q13mtJ.js';
4
- import { P as ProfilerOptions, a as ProfileReport } from '../types-CglvhPKz.js';
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-CglvhPKz.js';
6
- import '../types-CQF88McG.js';
1
+ import { G as GraphDef } from '../manager-nIhmttD-.js';
2
+ import { Q as QueryAst } from '../ast-C8S37w1A.js';
3
+ import { aj as Store } from '../store-U3i2tUch.js';
4
+ import { P as ProfilerOptions, a as ProfileReport } from '../types-qYFZ9SqD.js';
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-qYFZ9SqD.js';
6
+ import '../types-Qk2l3IkQ.js';
7
7
  import 'drizzle-orm';
8
8
  import 'zod';
9
9
 
@@ -1,7 +1,7 @@
1
- import { K as KindRegistry, G as GraphDef } from '../manager-BPK-2PUI.cjs';
2
- export { C as ChangeSeverity, h as ChangeType, j as EdgeChange, M as MigrationHookContext, k as NodeChange, O as OntologyChange, l as SchemaDiff, S as SchemaManagerOptions, d as SchemaValidationResult, m as computeSchemaDiff, n as ensureSchema, o as getActiveSchema, p as getMigrationActions, q as getSchemaChanges, r as initializeSchema, s as isBackwardsCompatible, t as isSchemaInitialized, u as migrateSchema, v as rollbackSchema } from '../manager-BPK-2PUI.cjs';
3
- import { W as SerializedNodeDef, X as SerializedEdgeDef, Y as SerializedMetaEdge, Z as SerializedOntologyRelation, _ as SerializedClosures, $ as SerializedSchema, a0 as SchemaHash } from '../types-CQF88McG.cjs';
4
- export { a1 as JsonSchema, a2 as SerializedOntology, a3 as SerializedUniqueConstraint } from '../types-CQF88McG.cjs';
1
+ import { K as KindRegistry, G as GraphDef } from '../manager-Vkz28eAC.cjs';
2
+ export { C as ChangeSeverity, h as ChangeType, j as EdgeChange, M as MigrationHookContext, k as NodeChange, O as OntologyChange, l as SchemaDiff, S as SchemaManagerOptions, d as SchemaValidationResult, m as computeSchemaDiff, n as ensureSchema, o as getActiveSchema, p as getMigrationActions, q as getSchemaChanges, r as initializeSchema, s as isBackwardsCompatible, t as isSchemaInitialized, u as migrateSchema, v as rollbackSchema } from '../manager-Vkz28eAC.cjs';
3
+ import { W as SerializedNodeDef, X as SerializedEdgeDef, Y as SerializedMetaEdge, Z as SerializedOntologyRelation, _ as SerializedClosures, $ as SerializedSchema, a0 as SchemaHash } from '../types-Qk2l3IkQ.cjs';
4
+ export { a1 as JsonSchema, a2 as SerializedOntology, a3 as SerializedUniqueConstraint } from '../types-Qk2l3IkQ.cjs';
5
5
  import { ZodType, ZodError } from 'zod';
6
6
  import { k as ValidationIssue, V as ValidationError } from '../index-DXkEXpNz.cjs';
7
7
  import 'drizzle-orm';
@@ -1,7 +1,7 @@
1
- import { K as KindRegistry, G as GraphDef } from '../manager-0jVZtiE8.js';
2
- export { C as ChangeSeverity, h as ChangeType, j as EdgeChange, M as MigrationHookContext, k as NodeChange, O as OntologyChange, l as SchemaDiff, S as SchemaManagerOptions, d as SchemaValidationResult, m as computeSchemaDiff, n as ensureSchema, o as getActiveSchema, p as getMigrationActions, q as getSchemaChanges, r as initializeSchema, s as isBackwardsCompatible, t as isSchemaInitialized, u as migrateSchema, v as rollbackSchema } from '../manager-0jVZtiE8.js';
3
- import { W as SerializedNodeDef, X as SerializedEdgeDef, Y as SerializedMetaEdge, Z as SerializedOntologyRelation, _ as SerializedClosures, $ as SerializedSchema, a0 as SchemaHash } from '../types-CQF88McG.js';
4
- export { a1 as JsonSchema, a2 as SerializedOntology, a3 as SerializedUniqueConstraint } from '../types-CQF88McG.js';
1
+ import { K as KindRegistry, G as GraphDef } from '../manager-nIhmttD-.js';
2
+ export { C as ChangeSeverity, h as ChangeType, j as EdgeChange, M as MigrationHookContext, k as NodeChange, O as OntologyChange, l as SchemaDiff, S as SchemaManagerOptions, d as SchemaValidationResult, m as computeSchemaDiff, n as ensureSchema, o as getActiveSchema, p as getMigrationActions, q as getSchemaChanges, r as initializeSchema, s as isBackwardsCompatible, t as isSchemaInitialized, u as migrateSchema, v as rollbackSchema } from '../manager-nIhmttD-.js';
3
+ import { W as SerializedNodeDef, X as SerializedEdgeDef, Y as SerializedMetaEdge, Z as SerializedOntologyRelation, _ as SerializedClosures, $ as SerializedSchema, a0 as SchemaHash } from '../types-Qk2l3IkQ.js';
4
+ export { a1 as JsonSchema, a2 as SerializedOntology, a3 as SerializedUniqueConstraint } from '../types-Qk2l3IkQ.js';
5
5
  import { ZodType, ZodError } from 'zod';
6
6
  import { k as ValidationIssue, V as ValidationError } from '../index-DXkEXpNz.js';
7
7
  import 'drizzle-orm';
@@ -1,5 +1,5 @@
1
1
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
2
- import { T as TypeGraphIndex } from './types-vgjar7Ch.cjs';
2
+ import { T as TypeGraphIndex } from './types-CQx4iW5Y.cjs';
3
3
 
4
4
  /**
5
5
  * Table name configuration.
@@ -1,5 +1,5 @@
1
1
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
2
- import { T as TypeGraphIndex } from './types-IMQCuser.js';
2
+ import { T as TypeGraphIndex } from './types-C-zfYDJB.js';
3
3
 
4
4
  /**
5
5
  * Table name configuration.
@@ -1,7 +1,7 @@
1
- import { S as SqlDialect, s as SqlSchema, m as FulltextStrategy, j as FulltextQueryMode, N as NodeType, G as GraphBackend, u as TransactionBackend, A as AnyEdgeType, T as TemporalMode, E as EdgeType, f as EdgeRegistration, d as EdgeId, p as NodeId, P as EdgeRow, Q as NodeRow, r as NodeRegistration, R as VectorMetric } from './types-CQF88McG.js';
2
- import { K as KindRegistry, G as GraphDef, E as EdgeKinds, N as NodeKinds, a as AllNodeTypes, S as SchemaManagerOptions, d as SchemaValidationResult } from './manager-0jVZtiE8.js';
1
+ import { S as SqlDialect, s as SqlSchema, m as FulltextStrategy, j as FulltextQueryMode, N as NodeType, G as GraphBackend, u as TransactionBackend, A as AnyEdgeType, T as TemporalMode, E as EdgeType, f as EdgeRegistration, d as EdgeId, p as NodeId, P as EdgeRow, Q as NodeRow, r as NodeRegistration, R as VectorMetric } from './types-Qk2l3IkQ.cjs';
2
+ import { K as KindRegistry, G as GraphDef, E as EdgeKinds, N as NodeKinds, a as AllNodeTypes, S as SchemaManagerOptions, d as SchemaValidationResult } from './manager-Vkz28eAC.cjs';
3
3
  import { z } from 'zod';
4
- import { V as ValueType, i as PredicateExpression, k as VectorMetricType, Q as QueryAst, J as JsonPointer, F as FieldRef, P as ParameterRef, c as JsonPointerInput, T as TraversalExpansion, l as Traversal, N as NodePredicate, m as ProjectedField, O as OrderSpec, G as GroupBySpec, H as HybridFusionOptions, o as RecursiveCyclePolicy, q as TraversalDirection$1, A as AggregateExpr, r as SelectiveField, s as ComposableQuery, t as SetOperationType, u as SetOperation, S as SortDirection } from './ast-CSLbPIOC.js';
4
+ import { V as ValueType, i as PredicateExpression, k as VectorMetricType, Q as QueryAst, J as JsonPointer, F as FieldRef, P as ParameterRef, c as JsonPointerInput, T as TraversalExpansion, l as Traversal, N as NodePredicate, m as ProjectedField, O as OrderSpec, G as GroupBySpec, H as HybridFusionOptions, o as RecursiveCyclePolicy, q as TraversalDirection$1, A as AggregateExpr, r as SelectiveField, s as ComposableQuery, t as SetOperationType, u as SetOperation, S as SortDirection } from './ast-dgLhLOg0.cjs';
5
5
  import { SQL } from 'drizzle-orm';
6
6
 
7
7
  /**
@@ -2811,12 +2811,19 @@ declare class Store<G extends GraphDef> {
2811
2811
  */
2812
2812
  get search(): StoreSearch<G>;
2813
2813
  /**
2814
- * Executes multiple queries over a single connection with snapshot consistency.
2814
+ * Executes multiple queries and returns a typed tuple of results.
2815
2815
  *
2816
- * Acquires one connection via an implicit transaction, executes each query
2817
- * sequentially on that connection, and returns a typed tuple of results.
2818
- * Each query preserves its own result type, projection, filtering,
2819
- * sorting, and pagination.
2816
+ * Each query preserves its own result type, projection, filtering, sorting,
2817
+ * and pagination.
2818
+ *
2819
+ * **Snapshot consistency is conditional.** When
2820
+ * `backend.capabilities.transactions` is `true`, queries run sequentially
2821
+ * on a single connection inside an implicit transaction and observe the
2822
+ * same database snapshot. When transactions are unavailable
2823
+ * (Cloudflare D1, `drizzle-orm/neon-http`), queries run sequentially over
2824
+ * independent connections and may observe writes that landed between them.
2825
+ * Branch on `backend.capabilities.transactions` if you need a guaranteed
2826
+ * snapshot.
2820
2827
  *
2821
2828
  * Read-only — use `bulkCreate`, `bulkInsert`, etc. for write batching.
2822
2829
  *
@@ -2890,6 +2897,21 @@ declare class Store<G extends GraphDef> {
2890
2897
  * );
2891
2898
  * });
2892
2899
  * ```
2900
+ *
2901
+ * **Backends without transactions.** When `backend.capabilities.transactions`
2902
+ * is `false` (Cloudflare D1, `drizzle-orm/neon-http`), this method runs the
2903
+ * callback against the same backend used outside `transaction()` — writes
2904
+ * are applied as they happen and a thrown error does **not** roll back
2905
+ * earlier writes inside the callback. Branch on
2906
+ * `backend.capabilities.transactions` if you require atomicity:
2907
+ *
2908
+ * ```typescript
2909
+ * if (backend.capabilities.transactions) {
2910
+ * await store.transaction(async (tx) => { ... });
2911
+ * } else {
2912
+ * // sequential, non-atomic — handle partial-failure recovery yourself
2913
+ * }
2914
+ * ```
2893
2915
  */
2894
2916
  transaction<T>(fn: (tx: TransactionContext<G>) => Promise<T>): Promise<T>;
2895
2917
  /**
@@ -2902,6 +2924,34 @@ declare class Store<G extends GraphDef> {
2902
2924
  * The store is usable after clearing — new data can be created immediately.
2903
2925
  */
2904
2926
  clear(): Promise<void>;
2927
+ /**
2928
+ * Refreshes the backend's query-planner statistics.
2929
+ *
2930
+ * Call this once after a large initial import or bulk backfill. The
2931
+ * planner uses table statistics to choose between TypeGraph's
2932
+ * multi-column indexes; without fresh stats a forward traversal can
2933
+ * pick a reverse index and run an order of magnitude slower than
2934
+ * needed. Autovacuum / background statistics will catch up
2935
+ * eventually, but calling this explicitly after a bulk load gives
2936
+ * you correct latencies immediately.
2937
+ *
2938
+ * Implementations:
2939
+ * - SQLite runs `ANALYZE`, populating `sqlite_stat1`
2940
+ * - PostgreSQL runs `ANALYZE` on the TypeGraph-managed tables
2941
+ *
2942
+ * Costs a few tens of milliseconds at the sizes this library is
2943
+ * designed for. Safe to call at any time.
2944
+ *
2945
+ * @example
2946
+ * ```typescript
2947
+ * // After a bulk import
2948
+ * for (const batch of batches) {
2949
+ * await store.nodes.Document.bulkCreate(batch);
2950
+ * }
2951
+ * await store.refreshStatistics();
2952
+ * ```
2953
+ */
2954
+ refreshStatistics(): Promise<void>;
2905
2955
  /**
2906
2956
  * Closes the store and releases underlying resources.
2907
2957
  *
@@ -1,7 +1,7 @@
1
- import { S as SqlDialect, s as SqlSchema, m as FulltextStrategy, j as FulltextQueryMode, N as NodeType, G as GraphBackend, u as TransactionBackend, A as AnyEdgeType, T as TemporalMode, E as EdgeType, f as EdgeRegistration, d as EdgeId, p as NodeId, P as EdgeRow, Q as NodeRow, r as NodeRegistration, R as VectorMetric } from './types-CQF88McG.cjs';
2
- import { K as KindRegistry, G as GraphDef, E as EdgeKinds, N as NodeKinds, a as AllNodeTypes, S as SchemaManagerOptions, d as SchemaValidationResult } from './manager-BPK-2PUI.cjs';
1
+ import { S as SqlDialect, s as SqlSchema, m as FulltextStrategy, j as FulltextQueryMode, N as NodeType, G as GraphBackend, u as TransactionBackend, A as AnyEdgeType, T as TemporalMode, E as EdgeType, f as EdgeRegistration, d as EdgeId, p as NodeId, P as EdgeRow, Q as NodeRow, r as NodeRegistration, R as VectorMetric } from './types-Qk2l3IkQ.js';
2
+ import { K as KindRegistry, G as GraphDef, E as EdgeKinds, N as NodeKinds, a as AllNodeTypes, S as SchemaManagerOptions, d as SchemaValidationResult } from './manager-nIhmttD-.js';
3
3
  import { z } from 'zod';
4
- import { V as ValueType, i as PredicateExpression, k as VectorMetricType, Q as QueryAst, J as JsonPointer, F as FieldRef, P as ParameterRef, c as JsonPointerInput, T as TraversalExpansion, l as Traversal, N as NodePredicate, m as ProjectedField, O as OrderSpec, G as GroupBySpec, H as HybridFusionOptions, o as RecursiveCyclePolicy, q as TraversalDirection$1, A as AggregateExpr, r as SelectiveField, s as ComposableQuery, t as SetOperationType, u as SetOperation, S as SortDirection } from './ast-DogwbBqA.cjs';
4
+ import { V as ValueType, i as PredicateExpression, k as VectorMetricType, Q as QueryAst, J as JsonPointer, F as FieldRef, P as ParameterRef, c as JsonPointerInput, T as TraversalExpansion, l as Traversal, N as NodePredicate, m as ProjectedField, O as OrderSpec, G as GroupBySpec, H as HybridFusionOptions, o as RecursiveCyclePolicy, q as TraversalDirection$1, A as AggregateExpr, r as SelectiveField, s as ComposableQuery, t as SetOperationType, u as SetOperation, S as SortDirection } from './ast-C8S37w1A.js';
5
5
  import { SQL } from 'drizzle-orm';
6
6
 
7
7
  /**
@@ -2811,12 +2811,19 @@ declare class Store<G extends GraphDef> {
2811
2811
  */
2812
2812
  get search(): StoreSearch<G>;
2813
2813
  /**
2814
- * Executes multiple queries over a single connection with snapshot consistency.
2814
+ * Executes multiple queries and returns a typed tuple of results.
2815
2815
  *
2816
- * Acquires one connection via an implicit transaction, executes each query
2817
- * sequentially on that connection, and returns a typed tuple of results.
2818
- * Each query preserves its own result type, projection, filtering,
2819
- * sorting, and pagination.
2816
+ * Each query preserves its own result type, projection, filtering, sorting,
2817
+ * and pagination.
2818
+ *
2819
+ * **Snapshot consistency is conditional.** When
2820
+ * `backend.capabilities.transactions` is `true`, queries run sequentially
2821
+ * on a single connection inside an implicit transaction and observe the
2822
+ * same database snapshot. When transactions are unavailable
2823
+ * (Cloudflare D1, `drizzle-orm/neon-http`), queries run sequentially over
2824
+ * independent connections and may observe writes that landed between them.
2825
+ * Branch on `backend.capabilities.transactions` if you need a guaranteed
2826
+ * snapshot.
2820
2827
  *
2821
2828
  * Read-only — use `bulkCreate`, `bulkInsert`, etc. for write batching.
2822
2829
  *
@@ -2890,6 +2897,21 @@ declare class Store<G extends GraphDef> {
2890
2897
  * );
2891
2898
  * });
2892
2899
  * ```
2900
+ *
2901
+ * **Backends without transactions.** When `backend.capabilities.transactions`
2902
+ * is `false` (Cloudflare D1, `drizzle-orm/neon-http`), this method runs the
2903
+ * callback against the same backend used outside `transaction()` — writes
2904
+ * are applied as they happen and a thrown error does **not** roll back
2905
+ * earlier writes inside the callback. Branch on
2906
+ * `backend.capabilities.transactions` if you require atomicity:
2907
+ *
2908
+ * ```typescript
2909
+ * if (backend.capabilities.transactions) {
2910
+ * await store.transaction(async (tx) => { ... });
2911
+ * } else {
2912
+ * // sequential, non-atomic — handle partial-failure recovery yourself
2913
+ * }
2914
+ * ```
2893
2915
  */
2894
2916
  transaction<T>(fn: (tx: TransactionContext<G>) => Promise<T>): Promise<T>;
2895
2917
  /**
@@ -2902,6 +2924,34 @@ declare class Store<G extends GraphDef> {
2902
2924
  * The store is usable after clearing — new data can be created immediately.
2903
2925
  */
2904
2926
  clear(): Promise<void>;
2927
+ /**
2928
+ * Refreshes the backend's query-planner statistics.
2929
+ *
2930
+ * Call this once after a large initial import or bulk backfill. The
2931
+ * planner uses table statistics to choose between TypeGraph's
2932
+ * multi-column indexes; without fresh stats a forward traversal can
2933
+ * pick a reverse index and run an order of magnitude slower than
2934
+ * needed. Autovacuum / background statistics will catch up
2935
+ * eventually, but calling this explicitly after a bulk load gives
2936
+ * you correct latencies immediately.
2937
+ *
2938
+ * Implementations:
2939
+ * - SQLite runs `ANALYZE`, populating `sqlite_stat1`
2940
+ * - PostgreSQL runs `ANALYZE` on the TypeGraph-managed tables
2941
+ *
2942
+ * Costs a few tens of milliseconds at the sizes this library is
2943
+ * designed for. Safe to call at any time.
2944
+ *
2945
+ * @example
2946
+ * ```typescript
2947
+ * // After a bulk import
2948
+ * for (const batch of batches) {
2949
+ * await store.nodes.Document.bulkCreate(batch);
2950
+ * }
2951
+ * await store.refreshStatistics();
2952
+ * ```
2953
+ */
2954
+ refreshStatistics(): Promise<void>;
2905
2955
  /**
2906
2956
  * Closes the store and releases underlying resources.
2907
2957
  *
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { A as AnyEdgeType, E as EdgeType, N as NodeType } from './types-CQF88McG.js';
3
- import { J as JsonPointer, V as ValueType, b as JsonPointerFor, f as JsonPointerSegmentsFor } from './ast-CSLbPIOC.js';
2
+ import { A as AnyEdgeType, E as EdgeType, N as NodeType } from './types-Qk2l3IkQ.js';
3
+ import { J as JsonPointer, V as ValueType, b as JsonPointerFor, f as JsonPointerSegmentsFor } from './ast-C8S37w1A.js';
4
4
 
5
5
  type IndexScope =
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { A as AnyEdgeType, E as EdgeType, N as NodeType } from './types-CQF88McG.cjs';
3
- import { J as JsonPointer, V as ValueType, b as JsonPointerFor, f as JsonPointerSegmentsFor } from './ast-DogwbBqA.cjs';
2
+ import { A as AnyEdgeType, E as EdgeType, N as NodeType } from './types-Qk2l3IkQ.cjs';
3
+ import { J as JsonPointer, V as ValueType, b as JsonPointerFor, f as JsonPointerSegmentsFor } from './ast-dgLhLOg0.cjs';
4
4
 
5
5
  type IndexScope =
6
6
  /**
@@ -970,7 +970,7 @@ type TransactionOptions = Readonly<{
970
970
  /**
971
971
  * Transaction backend - a backend scoped to a transaction.
972
972
  */
973
- type TransactionBackend = Omit<GraphBackend, "transaction" | "close">;
973
+ type TransactionBackend = Omit<GraphBackend, "transaction" | "close" | "refreshStatistics">;
974
974
  /**
975
975
  * The GraphBackend interface abstracts database operations.
976
976
  *
@@ -1060,6 +1060,25 @@ type GraphBackend = Readonly<{
1060
1060
  * hit this path.
1061
1061
  */
1062
1062
  bootstrapTables?: () => Promise<void>;
1063
+ /**
1064
+ * Refreshes the backend's query-planner statistics.
1065
+ *
1066
+ * Call this once after a large initial import or bulk backfill. Without
1067
+ * up-to-date statistics, the planner can pick suboptimal execution plans
1068
+ * — on PostgreSQL this is the difference between a 0.5ms and a 5ms
1069
+ * forward traversal; on SQLite it's the difference between 0.9ms and
1070
+ * 23ms fulltext search. Autovacuum / background statistics collection
1071
+ * will catch up eventually, but calling this explicitly after a bulk
1072
+ * load gives you correct latencies immediately.
1073
+ *
1074
+ * Implementations:
1075
+ * - SQLite runs `ANALYZE`, which populates `sqlite_stat1`
1076
+ * - PostgreSQL runs `ANALYZE` on the TypeGraph-managed tables
1077
+ *
1078
+ * Safe to call at any time; costs a few tens of milliseconds on the
1079
+ * sizes this library is designed for.
1080
+ */
1081
+ refreshStatistics: () => Promise<void>;
1063
1082
  execute: <T>(query: SQL) => Promise<readonly T[]>;
1064
1083
  /** Execute pre-compiled SQL text with bound parameters. Available on sync SQLite and pg backends. */
1065
1084
  executeRaw?: <T>(sqlText: string, params: readonly unknown[]) => Promise<readonly T[]>;
@@ -970,7 +970,7 @@ type TransactionOptions = Readonly<{
970
970
  /**
971
971
  * Transaction backend - a backend scoped to a transaction.
972
972
  */
973
- type TransactionBackend = Omit<GraphBackend, "transaction" | "close">;
973
+ type TransactionBackend = Omit<GraphBackend, "transaction" | "close" | "refreshStatistics">;
974
974
  /**
975
975
  * The GraphBackend interface abstracts database operations.
976
976
  *
@@ -1060,6 +1060,25 @@ type GraphBackend = Readonly<{
1060
1060
  * hit this path.
1061
1061
  */
1062
1062
  bootstrapTables?: () => Promise<void>;
1063
+ /**
1064
+ * Refreshes the backend's query-planner statistics.
1065
+ *
1066
+ * Call this once after a large initial import or bulk backfill. Without
1067
+ * up-to-date statistics, the planner can pick suboptimal execution plans
1068
+ * — on PostgreSQL this is the difference between a 0.5ms and a 5ms
1069
+ * forward traversal; on SQLite it's the difference between 0.9ms and
1070
+ * 23ms fulltext search. Autovacuum / background statistics collection
1071
+ * will catch up eventually, but calling this explicitly after a bulk
1072
+ * load gives you correct latencies immediately.
1073
+ *
1074
+ * Implementations:
1075
+ * - SQLite runs `ANALYZE`, which populates `sqlite_stat1`
1076
+ * - PostgreSQL runs `ANALYZE` on the TypeGraph-managed tables
1077
+ *
1078
+ * Safe to call at any time; costs a few tens of milliseconds on the
1079
+ * sizes this library is designed for.
1080
+ */
1081
+ refreshStatistics: () => Promise<void>;
1063
1082
  execute: <T>(query: SQL) => Promise<readonly T[]>;
1064
1083
  /** Execute pre-compiled SQL text with bound parameters. Available on sync SQLite and pg backends. */
1065
1084
  executeRaw?: <T>(sqlText: string, params: readonly unknown[]) => Promise<readonly T[]>;
@@ -1,4 +1,4 @@
1
- import { J as JsonPointer } from './ast-CSLbPIOC.js';
1
+ import { J as JsonPointer } from './ast-C8S37w1A.js';
2
2
 
3
3
  /**
4
4
  * QueryProfiler types.
@@ -1,4 +1,4 @@
1
- import { J as JsonPointer } from './ast-DogwbBqA.cjs';
1
+ import { J as JsonPointer } from './ast-dgLhLOg0.cjs';
2
2
 
3
3
  /**
4
4
  * QueryProfiler types.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nicia-ai/typegraph",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "TypeScript-first embedded knowledge graph library with ontological reasoning",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -133,16 +133,28 @@
133
133
  },
134
134
  "peerDependencies": {
135
135
  "@libsql/client": ">=0.6.0",
136
+ "@neondatabase/serverless": ">=0.9.0 <2.0.0",
136
137
  "better-sqlite3": ">=9.0.0 <13.0.0",
137
138
  "drizzle-orm": ">=0.35.0 <1.0.0",
139
+ "pg": ">=8.0.0 <9.0.0",
140
+ "postgres": ">=3.4.0 <4.0.0",
138
141
  "zod": "^4.0.0"
139
142
  },
140
143
  "peerDependenciesMeta": {
141
144
  "@libsql/client": {
142
145
  "optional": true
143
146
  },
147
+ "@neondatabase/serverless": {
148
+ "optional": true
149
+ },
144
150
  "better-sqlite3": {
145
151
  "optional": true
152
+ },
153
+ "pg": {
154
+ "optional": true
155
+ },
156
+ "postgres": {
157
+ "optional": true
146
158
  }
147
159
  },
148
160
  "dependencies": {
@@ -150,6 +162,7 @@
150
162
  },
151
163
  "devDependencies": {
152
164
  "@libsql/client": "^0.17.2",
165
+ "@neondatabase/serverless": "^1.1.0",
153
166
  "@stryker-mutator/core": "^9.6.1",
154
167
  "@stryker-mutator/vitest-runner": "^9.6.1",
155
168
  "@types/better-sqlite3": "^7.6.13",
@@ -161,6 +174,7 @@
161
174
  "eslint": "^10.2.1",
162
175
  "fast-check": "^4.7.0",
163
176
  "pg": "^8.20.0",
177
+ "postgres": "^3.4.9",
164
178
  "sqlite-vec": "^0.1.9",
165
179
  "tsd": "^0.33.0",
166
180
  "tsup": "^8.5.1",