@nicia-ai/typegraph 0.22.0 → 0.24.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.
- package/dist/{ast-CSLbPIOC.d.ts → ast-C8S37w1A.d.ts} +1 -1
- package/dist/{ast-DogwbBqA.d.cts → ast-dgLhLOg0.d.cts} +1 -1
- package/dist/backend/postgres/index.cjs +165 -48
- package/dist/backend/postgres/index.cjs.map +1 -1
- package/dist/backend/postgres/index.d.cts +43 -6
- package/dist/backend/postgres/index.d.ts +43 -6
- package/dist/backend/postgres/index.js +138 -21
- package/dist/backend/postgres/index.js.map +1 -1
- package/dist/backend/sqlite/index.cjs +13 -12
- package/dist/backend/sqlite/index.d.cts +6 -6
- package/dist/backend/sqlite/index.d.ts +6 -6
- package/dist/backend/sqlite/index.js +3 -2
- package/dist/backend/sqlite/libsql.cjs +6 -5
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +4 -4
- package/dist/backend/sqlite/libsql.d.ts +4 -4
- package/dist/backend/sqlite/libsql.js +3 -2
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +7 -6
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +4 -4
- package/dist/backend/sqlite/local.d.ts +4 -4
- package/dist/backend/sqlite/local.js +3 -2
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/chunk-3EUKJEQ3.js +77 -0
- package/dist/chunk-3EUKJEQ3.js.map +1 -0
- package/dist/{chunk-GUYI6VAS.cjs → chunk-3MDBMCFF.cjs} +67 -42
- package/dist/chunk-3MDBMCFF.cjs.map +1 -0
- package/dist/{chunk-SCXOGKLD.cjs → chunk-5HVDOPZU.cjs} +88 -45
- package/dist/chunk-5HVDOPZU.cjs.map +1 -0
- package/dist/chunk-7TU5EWQ7.js +47 -0
- package/dist/chunk-7TU5EWQ7.js.map +1 -0
- package/dist/{chunk-5ZMMHUWR.js → chunk-EY4LBX3F.js} +88 -43
- package/dist/chunk-EY4LBX3F.js.map +1 -0
- package/dist/{chunk-NSLTDXVH.js → chunk-GTG5J4UP.js} +52 -27
- package/dist/chunk-GTG5J4UP.js.map +1 -0
- package/dist/chunk-HTGDWIDE.cjs +89 -0
- package/dist/chunk-HTGDWIDE.cjs.map +1 -0
- package/dist/chunk-RNUNP5JD.cjs +52 -0
- package/dist/chunk-RNUNP5JD.cjs.map +1 -0
- package/dist/{ddl-BqkTShcR.d.ts → ddl-1tFIvt9V.d.ts} +3 -3
- package/dist/{ddl-Dk1NDN3M.d.cts → ddl-B_H8JM-E.d.cts} +3 -3
- package/dist/index.cjs +133 -145
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +94 -106
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/interchange/index.d.cts +4 -4
- package/dist/interchange/index.d.ts +4 -4
- package/dist/{manager-BPK-2PUI.d.cts → manager-Vkz28eAC.d.cts} +1 -1
- package/dist/{manager-0jVZtiE8.d.ts → manager-nIhmttD-.d.ts} +1 -1
- package/dist/profiler/index.d.cts +6 -6
- package/dist/profiler/index.d.ts +6 -6
- package/dist/schema/index.d.cts +4 -4
- package/dist/schema/index.d.ts +4 -4
- package/dist/{sqlite-D1rrwcir.d.cts → sqlite-D0aceIe0.d.cts} +1 -1
- package/dist/{sqlite-W3rmJMlc.d.ts → sqlite-SUxbZqfy.d.ts} +1 -1
- package/dist/{store-C0q13mtJ.d.ts → store-CpvwTMxV.d.cts} +58 -8
- package/dist/{store-2QW2SIRk.d.cts → store-U3i2tUch.d.ts} +58 -8
- package/dist/{types-IMQCuser.d.ts → types-C-zfYDJB.d.ts} +2 -2
- package/dist/{types-vgjar7Ch.d.cts → types-CQx4iW5Y.d.cts} +2 -2
- package/dist/{types-CQF88McG.d.ts → types-Qk2l3IkQ.d.cts} +20 -1
- package/dist/{types-CQF88McG.d.cts → types-Qk2l3IkQ.d.ts} +20 -1
- package/dist/{types-CglvhPKz.d.ts → types-qYFZ9SqD.d.ts} +1 -1
- package/dist/{types-D23slCOA.d.cts → types-yH4_p0XB.d.cts} +1 -1
- package/package.json +15 -1
- package/dist/chunk-5ZMMHUWR.js.map +0 -1
- package/dist/chunk-GUYI6VAS.cjs.map +0 -1
- package/dist/chunk-NSLTDXVH.js.map +0 -1
- package/dist/chunk-SCXOGKLD.cjs.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-
|
|
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-
|
|
4
|
-
import { A as AliasMap, E as EdgeAliasMap, Q as QueryBuilder, T as TraversalBuilder, C as CreateQueryBuilderOptions } from './store-
|
|
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-
|
|
6
|
-
import { G as GraphDef, K as KindRegistry } from './manager-
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
/**
|
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-
|
|
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-
|
|
4
|
-
import { A as AliasMap, E as EdgeAliasMap, Q as QueryBuilder, T as TraversalBuilder, C as CreateQueryBuilderOptions } from './store-
|
|
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-
|
|
6
|
-
import { G as GraphDef, K as KindRegistry } from './manager-
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { quoteIdentifier, EMPTY_REQUIRED_COLUMNS, addRequiredColumn, markSelectiveFieldAsRequired, markFieldRefAsRequired, NODE_COLUMNS, shouldProjectColumn, mapSelectiveSystemFieldToColumn, isIdFieldRef, isAggregateExpr, EDGE_COLUMNS } from './chunk-3EUKJEQ3.js';
|
|
1
2
|
import { META_EDGE_BRAND, META_EDGE_SUB_CLASS_OF, META_EDGE_NARROWER, META_EDGE_BROADER, META_EDGE_RELATED_TO, META_EDGE_EQUIVALENT_TO, META_EDGE_SAME_AS, META_EDGE_DIFFERENT_FROM, META_EDGE_DISJOINT_WITH, META_EDGE_HAS_PART, META_EDGE_PART_OF, META_EDGE_INVERSE_OF, META_EDGE_IMPLIES, ensureSchema, computeClosuresFromOntology, createEmptyClosures, KindRegistry, validateNodeProps, validateEdgeProps } from './chunk-JYUQA77I.js';
|
|
2
3
|
export { isMetaEdge } from './chunk-JYUQA77I.js';
|
|
3
4
|
import { NODE_TYPE_BRAND, EDGE_TYPE_BRAND, nowIso, validateOptionalIsoDate, getNodeKinds, getEdgeKinds } from './chunk-RS5OLGEW.js';
|
|
4
5
|
export { defineGraph, getEdgeKinds, getNodeKinds, isEdgeType, isEdgeTypeWithEndpoints, isGraphDef, isNodeType } from './chunk-RS5OLGEW.js';
|
|
6
|
+
import { runOptionallyInTransaction } from './chunk-7TU5EWQ7.js';
|
|
5
7
|
import { ConfigurationError, UnsupportedPredicateError, ValidationError, CompilerInvariantError, KindNotFoundError, DatabaseOperationError, EdgeNotFoundError, NodeConstraintNotFoundError, RestrictedDeleteError, NodeNotFoundError, EndpointNotFoundError, UniquenessError, CardinalityError, EndpointError, DisjointError } from './chunk-WFMTAEEN.js';
|
|
6
8
|
export { BackendDisposedError, CardinalityError, CompilerInvariantError, ConfigurationError, DatabaseOperationError, DisjointError, EdgeNotFoundError, EndpointError, EndpointNotFoundError, KindNotFoundError, MigrationError, NodeConstraintNotFoundError, NodeNotFoundError, RestrictedDeleteError, SchemaMismatchError, TypeGraphError, UniquenessError, UnsupportedPredicateError, ValidationError, VersionConflictError, getErrorSuggestion, isConstraintError, isSystemError, isTypeGraphError, isUserRecoverable } from './chunk-WFMTAEEN.js';
|
|
7
9
|
import { MAX_PG_IDENTIFIER_LENGTH, DEFAULT_PAGINATION_LIMIT, getDialect, DEFAULT_STREAM_BATCH_SIZE, NODE_META_KEYS, EDGE_META_KEYS, SQLITE_PATH_DELIMITER, PG_ARRAY_START, PG_ARRAY_END, PG_PATH_ELEMENT_SEPARATOR, fnv1aBase36 } from './chunk-753F33CV.js';
|
|
@@ -1944,7 +1946,7 @@ function validateTableName(name, label) {
|
|
|
1944
1946
|
);
|
|
1945
1947
|
}
|
|
1946
1948
|
}
|
|
1947
|
-
function
|
|
1949
|
+
function quoteIdentifier2(name) {
|
|
1948
1950
|
return `"${name.replaceAll('"', '""')}"`;
|
|
1949
1951
|
}
|
|
1950
1952
|
function createSqlSchema(names = {}) {
|
|
@@ -1955,10 +1957,10 @@ function createSqlSchema(names = {}) {
|
|
|
1955
1957
|
validateTableName(tables.fulltext, "fulltext");
|
|
1956
1958
|
return {
|
|
1957
1959
|
tables,
|
|
1958
|
-
nodesTable: sql.raw(
|
|
1959
|
-
edgesTable: sql.raw(
|
|
1960
|
-
embeddingsTable: sql.raw(
|
|
1961
|
-
fulltextTable: sql.raw(
|
|
1960
|
+
nodesTable: sql.raw(quoteIdentifier2(tables.nodes)),
|
|
1961
|
+
edgesTable: sql.raw(quoteIdentifier2(tables.edges)),
|
|
1962
|
+
embeddingsTable: sql.raw(quoteIdentifier2(tables.embeddings)),
|
|
1963
|
+
fulltextTable: sql.raw(quoteIdentifier2(tables.fulltext))
|
|
1962
1964
|
};
|
|
1963
1965
|
}
|
|
1964
1966
|
var DEFAULT_SQL_SCHEMA = createSqlSchema();
|
|
@@ -1996,76 +1998,6 @@ function compileTypedJsonExtract(input) {
|
|
|
1996
1998
|
}
|
|
1997
1999
|
}
|
|
1998
2000
|
}
|
|
1999
|
-
var NODE_COLUMNS = [
|
|
2000
|
-
"id",
|
|
2001
|
-
"kind",
|
|
2002
|
-
"props",
|
|
2003
|
-
"version",
|
|
2004
|
-
"valid_from",
|
|
2005
|
-
"valid_to",
|
|
2006
|
-
"created_at",
|
|
2007
|
-
"updated_at",
|
|
2008
|
-
"deleted_at"
|
|
2009
|
-
];
|
|
2010
|
-
var EDGE_COLUMNS = [
|
|
2011
|
-
"id",
|
|
2012
|
-
"kind",
|
|
2013
|
-
"from_id",
|
|
2014
|
-
"to_id",
|
|
2015
|
-
"props",
|
|
2016
|
-
"valid_from",
|
|
2017
|
-
"valid_to",
|
|
2018
|
-
"created_at",
|
|
2019
|
-
"updated_at",
|
|
2020
|
-
"deleted_at"
|
|
2021
|
-
];
|
|
2022
|
-
var EMPTY_REQUIRED_COLUMNS = /* @__PURE__ */ new Set();
|
|
2023
|
-
function quoteIdentifier2(identifier) {
|
|
2024
|
-
return sql.raw(`"${identifier.replaceAll('"', '""')}"`);
|
|
2025
|
-
}
|
|
2026
|
-
function shouldProjectColumn(requiredColumns, column, alwaysRequiredColumns) {
|
|
2027
|
-
if (alwaysRequiredColumns?.has(column)) return true;
|
|
2028
|
-
if (requiredColumns === void 0) return true;
|
|
2029
|
-
return requiredColumns.has(column);
|
|
2030
|
-
}
|
|
2031
|
-
function addRequiredColumn(requiredColumnsByAlias, alias, column) {
|
|
2032
|
-
const existing = requiredColumnsByAlias.get(alias);
|
|
2033
|
-
if (existing) {
|
|
2034
|
-
existing.add(column);
|
|
2035
|
-
return;
|
|
2036
|
-
}
|
|
2037
|
-
requiredColumnsByAlias.set(alias, /* @__PURE__ */ new Set([column]));
|
|
2038
|
-
}
|
|
2039
|
-
function markFieldRefAsRequired(requiredColumnsByAlias, field2) {
|
|
2040
|
-
const column = field2.path[0];
|
|
2041
|
-
if (column === void 0) return;
|
|
2042
|
-
addRequiredColumn(requiredColumnsByAlias, field2.alias, column);
|
|
2043
|
-
}
|
|
2044
|
-
function mapSelectiveSystemFieldToColumn(field2) {
|
|
2045
|
-
if (field2 === "fromId") return "from_id";
|
|
2046
|
-
if (field2 === "toId") return "to_id";
|
|
2047
|
-
if (field2.startsWith("meta.")) {
|
|
2048
|
-
return field2.slice(5).replaceAll(/([A-Z])/g, "_$1").toLowerCase();
|
|
2049
|
-
}
|
|
2050
|
-
return field2;
|
|
2051
|
-
}
|
|
2052
|
-
function markSelectiveFieldAsRequired(requiredColumnsByAlias, field2) {
|
|
2053
|
-
if (field2.isSystemField) {
|
|
2054
|
-
addRequiredColumn(
|
|
2055
|
-
requiredColumnsByAlias,
|
|
2056
|
-
field2.alias,
|
|
2057
|
-
mapSelectiveSystemFieldToColumn(field2.field)
|
|
2058
|
-
);
|
|
2059
|
-
return;
|
|
2060
|
-
}
|
|
2061
|
-
addRequiredColumn(requiredColumnsByAlias, field2.alias, "props");
|
|
2062
|
-
}
|
|
2063
|
-
function isIdFieldRef(field2) {
|
|
2064
|
-
return field2.path.length === 1 && field2.path[0] === "id" && field2.jsonPointer === void 0;
|
|
2065
|
-
}
|
|
2066
|
-
function isAggregateExpr(source) {
|
|
2067
|
-
return "__type" in source && source.__type === "aggregate";
|
|
2068
|
-
}
|
|
2069
2001
|
|
|
2070
2002
|
// src/query/compiler/emitter/standard-builders.ts
|
|
2071
2003
|
function compileColumnReference(tableAlias, column) {
|
|
@@ -2075,7 +2007,7 @@ function compileColumnReference(tableAlias, column) {
|
|
|
2075
2007
|
return sql`${sql.raw(tableAlias)}.${sql.raw(column)}`;
|
|
2076
2008
|
}
|
|
2077
2009
|
function qualifyColumn(owner, name) {
|
|
2078
|
-
return sql`${
|
|
2010
|
+
return sql`${quoteIdentifier(owner)}.${quoteIdentifier(name)}`;
|
|
2079
2011
|
}
|
|
2080
2012
|
var SCOPED_RELEVANCE_NODES_ALIAS = "scoped_relevance_nodes";
|
|
2081
2013
|
function buildScopedNodeIdsSubquery(nodeAlias) {
|
|
@@ -2085,7 +2017,7 @@ function buildScopedNodeIdsSubquery(nodeAlias) {
|
|
|
2085
2017
|
SELECT DISTINCT
|
|
2086
2018
|
${qualifyColumn(cteAlias, `${nodeAlias}_id`)} AS node_id,
|
|
2087
2019
|
${qualifyColumn(cteAlias, `${nodeAlias}_kind`)} AS node_kind
|
|
2088
|
-
FROM ${
|
|
2020
|
+
FROM ${quoteIdentifier(cteAlias)}
|
|
2089
2021
|
) AS ${sql.raw(SCOPED_RELEVANCE_NODES_ALIAS)}
|
|
2090
2022
|
`;
|
|
2091
2023
|
}
|
|
@@ -2347,7 +2279,7 @@ function buildStandardProjection(input) {
|
|
|
2347
2279
|
}
|
|
2348
2280
|
const projectedFields = fields.map((field2) => {
|
|
2349
2281
|
const source = compileProjectedSource(field2, dialect);
|
|
2350
|
-
return sql`${source} AS ${
|
|
2282
|
+
return sql`${source} AS ${quoteIdentifier(field2.outputName)}`;
|
|
2351
2283
|
});
|
|
2352
2284
|
return sql.join(projectedFields, sql`, `);
|
|
2353
2285
|
}
|
|
@@ -2367,7 +2299,7 @@ function compileSelectiveProjection(fields, dialect, ast, collapsedTraversalCteA
|
|
|
2367
2299
|
const cteAlias = collapsedTraversalCteAlias ?? aliasToCte.get(field2.alias) ?? `cte_${field2.alias}`;
|
|
2368
2300
|
if (field2.isSystemField) {
|
|
2369
2301
|
const dbColumn = mapSelectiveSystemFieldToColumn(field2.field);
|
|
2370
|
-
return sql`${sql.raw(cteAlias)}.${sql.raw(`${field2.alias}_${dbColumn}`)} AS ${
|
|
2302
|
+
return sql`${sql.raw(cteAlias)}.${sql.raw(`${field2.alias}_${dbColumn}`)} AS ${quoteIdentifier(field2.outputName)}`;
|
|
2371
2303
|
}
|
|
2372
2304
|
const propsColumn = `${field2.alias}_props`;
|
|
2373
2305
|
const column = sql`${sql.raw(cteAlias)}.${sql.raw(propsColumn)}`;
|
|
@@ -2378,7 +2310,7 @@ function compileSelectiveProjection(fields, dialect, ast, collapsedTraversalCteA
|
|
|
2378
2310
|
pointer,
|
|
2379
2311
|
valueType: field2.valueType
|
|
2380
2312
|
});
|
|
2381
|
-
return sql`${extracted} AS ${
|
|
2313
|
+
return sql`${extracted} AS ${quoteIdentifier(field2.outputName)}`;
|
|
2382
2314
|
});
|
|
2383
2315
|
return sql.join(columns, sql`, `);
|
|
2384
2316
|
}
|
|
@@ -3709,10 +3641,10 @@ function compileRecursiveProjection(ast, traversal, dialect) {
|
|
|
3709
3641
|
sql`${sql.raw(nodeAlias)}_deleted_at`
|
|
3710
3642
|
];
|
|
3711
3643
|
if (vl.depthAlias !== void 0) {
|
|
3712
|
-
fields.push(sql`depth AS ${
|
|
3644
|
+
fields.push(sql`depth AS ${quoteIdentifier(vl.depthAlias)}`);
|
|
3713
3645
|
}
|
|
3714
3646
|
if (vl.pathAlias !== void 0) {
|
|
3715
|
-
fields.push(sql`path AS ${
|
|
3647
|
+
fields.push(sql`path AS ${quoteIdentifier(vl.pathAlias)}`);
|
|
3716
3648
|
}
|
|
3717
3649
|
return sql.join(fields, sql`, `);
|
|
3718
3650
|
}
|
|
@@ -3726,7 +3658,7 @@ function compileRecursiveSelectiveProjection(fields, ast, traversal, dialect) {
|
|
|
3726
3658
|
}
|
|
3727
3659
|
if (field2.isSystemField) {
|
|
3728
3660
|
const dbColumn = mapSelectiveSystemFieldToColumn(field2.field);
|
|
3729
|
-
return sql`${sql.raw(`${field2.alias}_${dbColumn}`)} AS ${
|
|
3661
|
+
return sql`${sql.raw(`${field2.alias}_${dbColumn}`)} AS ${quoteIdentifier(field2.outputName)}`;
|
|
3730
3662
|
}
|
|
3731
3663
|
const column = sql.raw(`${field2.alias}_props`);
|
|
3732
3664
|
const extracted = compileTypedJsonExtract({
|
|
@@ -3735,14 +3667,14 @@ function compileRecursiveSelectiveProjection(fields, ast, traversal, dialect) {
|
|
|
3735
3667
|
pointer: jsonPointer([field2.field]),
|
|
3736
3668
|
valueType: field2.valueType
|
|
3737
3669
|
});
|
|
3738
|
-
return sql`${extracted} AS ${
|
|
3670
|
+
return sql`${extracted} AS ${quoteIdentifier(field2.outputName)}`;
|
|
3739
3671
|
});
|
|
3740
3672
|
const vl = traversal.variableLength;
|
|
3741
3673
|
if (vl.depthAlias !== void 0) {
|
|
3742
|
-
columns.push(sql`depth AS ${
|
|
3674
|
+
columns.push(sql`depth AS ${quoteIdentifier(vl.depthAlias)}`);
|
|
3743
3675
|
}
|
|
3744
3676
|
if (vl.pathAlias !== void 0) {
|
|
3745
|
-
columns.push(sql`path AS ${
|
|
3677
|
+
columns.push(sql`path AS ${quoteIdentifier(vl.pathAlias)}`);
|
|
3746
3678
|
}
|
|
3747
3679
|
return sql.join(columns, sql`, `);
|
|
3748
3680
|
}
|
|
@@ -4257,7 +4189,7 @@ function buildProjectedPropertyColumns(alias, plan, dialect) {
|
|
|
4257
4189
|
valueType: fieldPlan.typeInfo?.valueType
|
|
4258
4190
|
});
|
|
4259
4191
|
columns.push(
|
|
4260
|
-
sql`CASE WHEN ${sql.raw(alias)}.kind = ${kind} THEN ${extracted} ELSE NULL END AS ${
|
|
4192
|
+
sql`CASE WHEN ${sql.raw(alias)}.kind = ${kind} THEN ${extracted} ELSE NULL END AS ${quoteIdentifier(fieldPlan.outputName)}`
|
|
4261
4193
|
);
|
|
4262
4194
|
}
|
|
4263
4195
|
}
|
|
@@ -5472,12 +5404,12 @@ function compileCountAggregateFastPath(ast, graphId, ctx, logicalPlan, requiredC
|
|
|
5472
5404
|
source.valueType,
|
|
5473
5405
|
`cte_${source.alias}`
|
|
5474
5406
|
);
|
|
5475
|
-
return sql`${value} AS ${
|
|
5407
|
+
return sql`${value} AS ${quoteIdentifier(projectedField.outputName)}`;
|
|
5476
5408
|
}
|
|
5477
5409
|
const projectedCountColumn = resolveCountColumn(source);
|
|
5478
5410
|
const countValue = sql`${sql.raw(countCteAlias)}.${sql.raw(projectedCountColumn)}`;
|
|
5479
5411
|
const aggregateValue = traversal.optional ? sql`COALESCE(${countValue}, 0)` : countValue;
|
|
5480
|
-
return sql`${aggregateValue} AS ${
|
|
5412
|
+
return sql`${aggregateValue} AS ${quoteIdentifier(projectedField.outputName)}`;
|
|
5481
5413
|
}),
|
|
5482
5414
|
sql`, `
|
|
5483
5415
|
);
|
|
@@ -12787,17 +12719,17 @@ async function rebuildFulltextIndex(ctx, nodeKind, options) {
|
|
|
12787
12719
|
if (remaining > 0 && pageResult.skippedIds.length > 0) {
|
|
12788
12720
|
skippedIds.push(...pageResult.skippedIds.slice(0, remaining));
|
|
12789
12721
|
}
|
|
12790
|
-
|
|
12722
|
+
const writePage = async (target) => {
|
|
12791
12723
|
if (pageResult.toUpsert.length > 0) {
|
|
12792
|
-
if (
|
|
12793
|
-
await
|
|
12724
|
+
if (target.upsertFulltextBatch) {
|
|
12725
|
+
await target.upsertFulltextBatch({
|
|
12794
12726
|
graphId: ctx.graphId,
|
|
12795
12727
|
nodeKind: kind,
|
|
12796
12728
|
rows: pageResult.toUpsert
|
|
12797
12729
|
});
|
|
12798
|
-
} else if (
|
|
12730
|
+
} else if (target.upsertFulltext) {
|
|
12799
12731
|
for (const item of pageResult.toUpsert) {
|
|
12800
|
-
await
|
|
12732
|
+
await target.upsertFulltext({
|
|
12801
12733
|
graphId: ctx.graphId,
|
|
12802
12734
|
nodeKind: kind,
|
|
12803
12735
|
nodeId: item.nodeId,
|
|
@@ -12808,15 +12740,15 @@ async function rebuildFulltextIndex(ctx, nodeKind, options) {
|
|
|
12808
12740
|
}
|
|
12809
12741
|
}
|
|
12810
12742
|
if (pageResult.toDelete.length > 0) {
|
|
12811
|
-
if (
|
|
12812
|
-
await
|
|
12743
|
+
if (target.deleteFulltextBatch) {
|
|
12744
|
+
await target.deleteFulltextBatch({
|
|
12813
12745
|
graphId: ctx.graphId,
|
|
12814
12746
|
nodeKind: kind,
|
|
12815
12747
|
nodeIds: pageResult.toDelete
|
|
12816
12748
|
});
|
|
12817
|
-
} else if (
|
|
12749
|
+
} else if (target.deleteFulltext) {
|
|
12818
12750
|
for (const nodeId of pageResult.toDelete) {
|
|
12819
|
-
await
|
|
12751
|
+
await target.deleteFulltext({
|
|
12820
12752
|
graphId: ctx.graphId,
|
|
12821
12753
|
nodeKind: kind,
|
|
12822
12754
|
nodeId
|
|
@@ -12824,7 +12756,8 @@ async function rebuildFulltextIndex(ctx, nodeKind, options) {
|
|
|
12824
12756
|
}
|
|
12825
12757
|
}
|
|
12826
12758
|
}
|
|
12827
|
-
}
|
|
12759
|
+
};
|
|
12760
|
+
await runOptionallyInTransaction(backend, writePage);
|
|
12828
12761
|
processed += rows.length;
|
|
12829
12762
|
upserted += pageResult.toUpsert.length;
|
|
12830
12763
|
cleared += pageResult.toDelete.length;
|
|
@@ -13506,12 +13439,19 @@ var Store = class {
|
|
|
13506
13439
|
}
|
|
13507
13440
|
// === Batch Query Execution ===
|
|
13508
13441
|
/**
|
|
13509
|
-
* Executes multiple queries
|
|
13442
|
+
* Executes multiple queries and returns a typed tuple of results.
|
|
13443
|
+
*
|
|
13444
|
+
* Each query preserves its own result type, projection, filtering, sorting,
|
|
13445
|
+
* and pagination.
|
|
13510
13446
|
*
|
|
13511
|
-
*
|
|
13512
|
-
*
|
|
13513
|
-
*
|
|
13514
|
-
*
|
|
13447
|
+
* **Snapshot consistency is conditional.** When
|
|
13448
|
+
* `backend.capabilities.transactions` is `true`, queries run sequentially
|
|
13449
|
+
* on a single connection inside an implicit transaction and observe the
|
|
13450
|
+
* same database snapshot. When transactions are unavailable
|
|
13451
|
+
* (Cloudflare D1, `drizzle-orm/neon-http`), queries run sequentially over
|
|
13452
|
+
* independent connections and may observe writes that landed between them.
|
|
13453
|
+
* Branch on `backend.capabilities.transactions` if you need a guaranteed
|
|
13454
|
+
* snapshot.
|
|
13515
13455
|
*
|
|
13516
13456
|
* Read-only — use `bulkCreate`, `bulkInsert`, etc. for write batching.
|
|
13517
13457
|
*
|
|
@@ -13535,10 +13475,10 @@ var Store = class {
|
|
|
13535
13475
|
* @returns A tuple with per-query typed results, preserving input order
|
|
13536
13476
|
*/
|
|
13537
13477
|
async batch(...queries) {
|
|
13538
|
-
return this.#backend
|
|
13478
|
+
return runOptionallyInTransaction(this.#backend, async (target) => {
|
|
13539
13479
|
const results = [];
|
|
13540
13480
|
for (const query of queries) {
|
|
13541
|
-
const result = await query.executeOn(
|
|
13481
|
+
const result = await query.executeOn(target);
|
|
13542
13482
|
results.push(result);
|
|
13543
13483
|
}
|
|
13544
13484
|
return results;
|
|
@@ -13602,8 +13542,26 @@ var Store = class {
|
|
|
13602
13542
|
* );
|
|
13603
13543
|
* });
|
|
13604
13544
|
* ```
|
|
13545
|
+
*
|
|
13546
|
+
* **Backends without transactions.** When `backend.capabilities.transactions`
|
|
13547
|
+
* is `false` (Cloudflare D1, `drizzle-orm/neon-http`), this method runs the
|
|
13548
|
+
* callback against the same backend used outside `transaction()` — writes
|
|
13549
|
+
* are applied as they happen and a thrown error does **not** roll back
|
|
13550
|
+
* earlier writes inside the callback. Branch on
|
|
13551
|
+
* `backend.capabilities.transactions` if you require atomicity:
|
|
13552
|
+
*
|
|
13553
|
+
* ```typescript
|
|
13554
|
+
* if (backend.capabilities.transactions) {
|
|
13555
|
+
* await store.transaction(async (tx) => { ... });
|
|
13556
|
+
* } else {
|
|
13557
|
+
* // sequential, non-atomic — handle partial-failure recovery yourself
|
|
13558
|
+
* }
|
|
13559
|
+
* ```
|
|
13605
13560
|
*/
|
|
13606
13561
|
async transaction(fn) {
|
|
13562
|
+
if (!this.#backend.capabilities.transactions) {
|
|
13563
|
+
return fn({ nodes: this.nodes, edges: this.edges });
|
|
13564
|
+
}
|
|
13607
13565
|
return this.#backend.transaction(async (txBackend) => {
|
|
13608
13566
|
const txNodeOperations = {
|
|
13609
13567
|
...this.#nodeOperations,
|
|
@@ -13651,6 +13609,36 @@ var Store = class {
|
|
|
13651
13609
|
this.#search = void 0;
|
|
13652
13610
|
}
|
|
13653
13611
|
// === Lifecycle ===
|
|
13612
|
+
/**
|
|
13613
|
+
* Refreshes the backend's query-planner statistics.
|
|
13614
|
+
*
|
|
13615
|
+
* Call this once after a large initial import or bulk backfill. The
|
|
13616
|
+
* planner uses table statistics to choose between TypeGraph's
|
|
13617
|
+
* multi-column indexes; without fresh stats a forward traversal can
|
|
13618
|
+
* pick a reverse index and run an order of magnitude slower than
|
|
13619
|
+
* needed. Autovacuum / background statistics will catch up
|
|
13620
|
+
* eventually, but calling this explicitly after a bulk load gives
|
|
13621
|
+
* you correct latencies immediately.
|
|
13622
|
+
*
|
|
13623
|
+
* Implementations:
|
|
13624
|
+
* - SQLite runs `ANALYZE`, populating `sqlite_stat1`
|
|
13625
|
+
* - PostgreSQL runs `ANALYZE` on the TypeGraph-managed tables
|
|
13626
|
+
*
|
|
13627
|
+
* Costs a few tens of milliseconds at the sizes this library is
|
|
13628
|
+
* designed for. Safe to call at any time.
|
|
13629
|
+
*
|
|
13630
|
+
* @example
|
|
13631
|
+
* ```typescript
|
|
13632
|
+
* // After a bulk import
|
|
13633
|
+
* for (const batch of batches) {
|
|
13634
|
+
* await store.nodes.Document.bulkCreate(batch);
|
|
13635
|
+
* }
|
|
13636
|
+
* await store.refreshStatistics();
|
|
13637
|
+
* ```
|
|
13638
|
+
*/
|
|
13639
|
+
async refreshStatistics() {
|
|
13640
|
+
await this.#backend.refreshStatistics();
|
|
13641
|
+
}
|
|
13654
13642
|
/**
|
|
13655
13643
|
* Closes the store and releases underlying resources.
|
|
13656
13644
|
*
|