@nicia-ai/typegraph 0.25.1 → 0.27.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/backend/postgres/index.cjs +161 -113
- package/dist/backend/postgres/index.cjs.map +1 -1
- package/dist/backend/postgres/index.d.cts +6 -8
- package/dist/backend/postgres/index.d.ts +6 -8
- package/dist/backend/postgres/index.js +116 -68
- package/dist/backend/postgres/index.js.map +1 -1
- package/dist/backend/sqlite/index.cjs +16 -15
- package/dist/backend/sqlite/index.d.cts +11 -26
- package/dist/backend/sqlite/index.d.ts +11 -26
- package/dist/backend/sqlite/index.js +6 -5
- package/dist/backend/sqlite/libsql.cjs +9 -8
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +4 -3
- package/dist/backend/sqlite/libsql.d.ts +4 -3
- package/dist/backend/sqlite/libsql.js +6 -5
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +11 -10
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +4 -3
- package/dist/backend/sqlite/local.d.ts +4 -3
- package/dist/backend/sqlite/local.js +6 -5
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/chunk-4FJVSF3K.cjs +12 -0
- package/dist/{chunk-D2GO3RBL.cjs.map → chunk-4FJVSF3K.cjs.map} +1 -1
- package/dist/chunk-5H3BAMTB.js +32 -0
- package/dist/chunk-5H3BAMTB.js.map +1 -0
- package/dist/{chunk-CLEUFN2K.js → chunk-DDVA4QBA.js} +174 -78
- package/dist/chunk-DDVA4QBA.js.map +1 -0
- package/dist/{chunk-OECDVACY.cjs → chunk-DN4RUDF3.cjs} +2 -2
- package/dist/chunk-DN4RUDF3.cjs.map +1 -0
- package/dist/{chunk-NHQWXSTS.js → chunk-E5ROA3MN.js} +3 -3
- package/dist/{chunk-NHQWXSTS.js.map → chunk-E5ROA3MN.js.map} +1 -1
- package/dist/{chunk-CPFR3O7L.js → chunk-ENXJLDRK.js} +2 -2
- package/dist/chunk-ENXJLDRK.js.map +1 -0
- package/dist/chunk-IUIWCFG3.cjs +36 -0
- package/dist/chunk-IUIWCFG3.cjs.map +1 -0
- package/dist/{chunk-EG6TJ3I5.js → chunk-OYLF3IC7.js} +3 -3
- package/dist/{chunk-EG6TJ3I5.js.map → chunk-OYLF3IC7.js.map} +1 -1
- package/dist/{chunk-JTI5WT4P.cjs → chunk-PN37HVAV.cjs} +32 -10
- package/dist/chunk-PN37HVAV.cjs.map +1 -0
- package/dist/{chunk-RCAJZG67.cjs → chunk-PYJOBZR3.cjs} +10 -10
- package/dist/{chunk-RCAJZG67.cjs.map → chunk-PYJOBZR3.cjs.map} +1 -1
- package/dist/{chunk-PSKUWVCB.js → chunk-RF5EUQWS.js} +336 -36
- package/dist/chunk-RF5EUQWS.js.map +1 -0
- package/dist/{chunk-CLGC7AQ2.cjs → chunk-RVT2N4RF.cjs} +206 -110
- package/dist/chunk-RVT2N4RF.cjs.map +1 -0
- package/dist/{chunk-4BOWVUGQ.js → chunk-TSGBRPNE.js} +3 -3
- package/dist/{chunk-4BOWVUGQ.js.map → chunk-TSGBRPNE.js.map} +1 -1
- package/dist/{chunk-CQVNGKU7.cjs → chunk-TVUARC7S.cjs} +410 -100
- package/dist/chunk-TVUARC7S.cjs.map +1 -0
- package/dist/{chunk-DOTEN2FG.js → chunk-U5ROKVRF.js} +26 -3
- package/dist/chunk-U5ROKVRF.js.map +1 -0
- package/dist/{chunk-E5JZSEGJ.cjs → chunk-WFUN6DCM.cjs} +8 -8
- package/dist/{chunk-E5JZSEGJ.cjs.map → chunk-WFUN6DCM.cjs.map} +1 -1
- package/dist/{chunk-AAA2CR3P.js → chunk-X53YKGHR.js} +78 -37
- package/dist/chunk-X53YKGHR.js.map +1 -0
- package/dist/{chunk-W5MTHMTE.cjs → chunk-YEDQLNVE.cjs} +26 -2
- package/dist/chunk-YEDQLNVE.cjs.map +1 -0
- package/dist/{chunk-QMQYK3IF.cjs → chunk-ZGEMI7MJ.cjs} +163 -122
- package/dist/chunk-ZGEMI7MJ.cjs.map +1 -0
- package/dist/{chunk-YZZBDCLV.js → chunk-ZTREJOGB.js} +32 -11
- package/dist/chunk-ZTREJOGB.js.map +1 -0
- package/dist/{ddl-BqMmpNor.d.ts → ddl-9kw8UADK.d.ts} +298 -12
- package/dist/{ddl-Bwjh8Hff.d.cts → ddl-Cw82BPM4.d.cts} +298 -12
- package/dist/{extension-types-D07e_NTw.d.cts → extension-types-B78CZfA5.d.cts} +1 -1
- package/dist/{extension-types-D07e_NTw.d.ts → extension-types-B78CZfA5.d.ts} +1 -1
- package/dist/graph-extension/index.cjs +18 -18
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-extension/index.js +3 -3
- package/dist/{index-CT6nvtxL.d.cts → index-Bilw0pYm.d.cts} +34 -3
- package/dist/{index-DQheiVQV.d.ts → index-CWdBFWbI.d.ts} +34 -3
- package/dist/index.cjs +482 -361
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -11
- package/dist/index.d.ts +13 -11
- package/dist/index.js +153 -37
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +13 -13
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +1 -1
- package/dist/interchange/index.cjs +7 -7
- package/dist/interchange/index.d.cts +7 -5
- package/dist/interchange/index.d.ts +7 -5
- package/dist/interchange/index.js +2 -2
- package/dist/{manager-Cy3dhwYO.d.cts → manager-CWa9cgwb.d.cts} +36 -9
- package/dist/{manager-sZkU2VPC.d.ts → manager-Cfcb2sJL.d.ts} +36 -9
- package/dist/{materialize-indexes-BB9N5uQl.d.cts → materialize-indexes-BQfaAZKA.d.cts} +1 -1
- package/dist/{materialize-indexes-BYpU2RKh.d.ts → materialize-indexes-DFavFQah.d.ts} +1 -1
- package/dist/profiler/index.d.cts +9 -7
- package/dist/profiler/index.d.ts +9 -7
- package/dist/schema/index.cjs +32 -27
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +9 -7
- package/dist/schema/index.d.ts +9 -7
- package/dist/schema/index.js +6 -5
- package/dist/schema/index.js.map +1 -1
- package/dist/{sqlite-h6dta1IJ.d.ts → sqlite-BvSEbybu.d.cts} +320 -1
- package/dist/{sqlite-BhFswiAR.d.cts → sqlite-GKvcDPVn.d.ts} +320 -1
- package/dist/{store-BS_hehiz.d.ts → store-C57kdvAa.d.ts} +155 -5
- package/dist/{store-CkCvqRUf.d.cts → store-Ojf0NOKk.d.cts} +155 -5
- package/dist/{types-BpgACExN.d.cts → types-CF7nDH3q.d.cts} +2 -2
- package/dist/{types-Bz-Pi681.d.ts → types-Cars4JZ1.d.ts} +2 -2
- package/dist/{types-DptZHe-l.d.ts → types-DZPBXZOK.d.cts} +272 -14
- package/dist/{types-WF5ItKQu.d.cts → types-Dzkr0Eqi.d.ts} +272 -14
- package/dist/{where-DZYMiXVq.d.cts → where-BmtjfWuS.d.cts} +2 -2
- package/dist/{where-C40InMIp.d.ts → where-kk1Zz2En.d.ts} +2 -2
- package/package.json +3 -1
- package/dist/chunk-AAA2CR3P.js.map +0 -1
- package/dist/chunk-CLEUFN2K.js.map +0 -1
- package/dist/chunk-CLGC7AQ2.cjs.map +0 -1
- package/dist/chunk-CPFR3O7L.js.map +0 -1
- package/dist/chunk-CQVNGKU7.cjs.map +0 -1
- package/dist/chunk-D2GO3RBL.cjs +0 -12
- package/dist/chunk-DOTEN2FG.js.map +0 -1
- package/dist/chunk-JTI5WT4P.cjs.map +0 -1
- package/dist/chunk-OECDVACY.cjs.map +0 -1
- package/dist/chunk-PSKUWVCB.js.map +0 -1
- package/dist/chunk-QMQYK3IF.cjs.map +0 -1
- package/dist/chunk-W5MTHMTE.cjs.map +0 -1
- package/dist/chunk-YZZBDCLV.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
export { A as AnyEdgeType,
|
|
4
|
-
import {
|
|
5
|
-
export { B as BackendCapabilities,
|
|
6
|
-
import { A as AliasMap, E as EdgeAliasMap, Q as QueryBuilder, T as TraversalBuilder, C as CreateQueryBuilderOptions } from './store-
|
|
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 DEFAULT_SEARCHABLE_LANGUAGE, j as DegreeOptions, k as DynamicEdgeAccessor, l as DynamicEdgeCollection, m as DynamicEdgeType, n as DynamicFieldBuilder, o as DynamicNodeAccessor, p as DynamicNodeCollection, q as DynamicNodeType, r as DynamicSelectableEdge, s as DynamicSelectableNode, t as Edge, u as EdgeAccessor, v as EdgeCollection, w as EdgeFindByEndpointsOptions, x as EdgeGetOrCreateByEndpointsOptions, y as EdgeGetOrCreateByEndpointsResult, z as EdgeIntrospection, F as EmbeddingSchema, G as EmbeddingValue, H as ExecutableAggregateQuery, I as ExecutableQuery, J as FieldAccessor, K as FulltextSearchHit, L as FulltextSearchOptions, M as GetOrCreateAction, N as GraphAlgorithms, O as GraphEdgeCollections, P as GraphNodeCollections, R as HookContext, U as HybridFulltextOptions, V as HybridSearchHit, W as HybridSearchOptions, X as HybridVectorOptions, Y as IfExistsMode, Z as KindIntrospection, _ as MaterializeRemovalsEntry, $ as MaterializeRemovalsOptions, a0 as MaterializeRemovalsResult, a1 as NeighborsOptions, a2 as Node, a3 as NodeAccessor, a4 as NodeAlias, a5 as NodeCollection, a6 as NodeGetOrCreateByConstraintOptions, a7 as NodeGetOrCreateByConstraintResult, a8 as NodeIdentifier, a9 as NodeRef, aa as OntologyIntrospection, ab as OperationHookContext, ac as PaginateOptions, ad as PaginatedResult, ae as PathNode, af as Predicate, ag as PreparedQuery, ah as PropsAccessor, ai as QueryHookContext, aj as QueryOptions, ak as ReachableNode, al as ReachableOptions, am as RebuildFulltextOptions, an as RebuildFulltextResult, ao as RecursiveTraversalOptions, ap as SchemaIntrospection, aq as SearchableMetadata, ar as SearchableOptions, as as SearchableSchema, at as SelectContext, au as SelectableEdge, av as SelectableNode, aw as ShortestPathOptions, ax as ShortestPathResult, S as Store, ay as StoreHooks, az as StoreOptions, aA as StoreProjection, aB as StoreRef, aC as StoreSearch, aD as StreamOptions, aE as SubgraphEdgeResult, aF as SubgraphNodeResult, aG as SubgraphOptions, aH as SubgraphResult, aI as SubsetEdge, aJ as SubsetNode, aK as TemporalAlgorithmOptions, aL as TransactionContext, aM as TraversalDirection, aN as TypedEdgeCollection, aO as UnionableQuery, aP as UniqueIntrospection, aQ as UpdateEdgeInput, aR as UpdateNodeInput, aS as VectorSearchHit, aT as VectorSearchOptions, aU as createStore, aV as createStoreWithSchema, aW as
|
|
8
|
-
import { G as GraphDef, K as KindRegistry } from './manager-
|
|
9
|
-
export { A as AllEdgeTypes,
|
|
10
|
-
export { B as BackendDisposedError, C as CardinalityError, b as CompilerInvariantError, c as ConfigurationError, D as DatabaseOperationError, d as DisjointError, E as EagerMaterializationError, e as EdgeNotFoundError, f as EndpointError, g as EndpointNotFoundError, h as ErrorCategory, K as KindNotFoundError, M as MigrationError, N as NodeConstraintNotFoundError, i as NodeNotFoundError, R as RestrictedDeleteError, S as SchemaContentConflictError, j as SchemaMismatchError, k as StaleVersionError, T as TypeGraphError,
|
|
11
|
-
export { a as MaterializeIndexesEntry, b as MaterializeIndexesOptions, M as MaterializeIndexesResult } from './materialize-indexes-
|
|
12
|
-
export { a as andWhere, d as defineEdgeIndex, b as defineNodeIndex, n as notWhere, o as orWhere } from './where-
|
|
2
|
+
import { d as KindAnnotations, N as NodeType, e as EdgeType } from './extension-types-B78CZfA5.cjs';
|
|
3
|
+
export { A as AnyEdgeType, C as CURRENT_GRAPH_EXTENSION_VERSION, f as Cardinality, g as Collation, D as DeleteBehavior, h as EdgeId, i as EdgeProps, E as EdgeRegistration, j as EdgeTypeWithEndpoints, k as EndpointExistence, c as GraphDefaults, G as GraphExtension, l as GraphExtensionVersion, J as JsonValue, L as LEGACY_GRAPH_EXTENSION_VERSION, m as NodeId, n as NodeProps, b as NodeRegistration, T as TemporalMode, U as UniqueConstraint, o as UniquenessScope, p as isEdgeType, q as isEdgeTypeWithEndpoints, r as isNodeType } from './extension-types-B78CZfA5.cjs';
|
|
4
|
+
import { H as InferenceType, M as MetaEdge, O as OntologyRelation, K as AggregateExpr, L as FieldRef, P as ComparisonOp, T as AggregateComparisonPredicate } from './types-DZPBXZOK.cjs';
|
|
5
|
+
export { U as AdoptedTransaction, B as BackendCapabilities, W as CommitSchemaVersionExpected, X as CommitSchemaVersionParams, Y as DEFAULT_SQL_SCHEMA, Z as DeleteFulltextBatchParams, E as EdgeIndexConfig, c as EdgeIndexDeclaration, q as EdgeIndexDirection, r as EdgeIndexWhereBuilder, _ as FulltextBatchRow, $ as FulltextCapabilities, a0 as FulltextQueryMode, a1 as FulltextSearchParams, a2 as FulltextSearchResult, F as FulltextStrategy, G as GraphBackend, a3 as HybridFusionOptions, I as IndexDeclaration, s as IndexOrigin, t as IndexScope, e as IndexWhereExpression, u as IndexWhereFieldBuilder, v as IndexWhereInput, J as JsonPointer, a4 as JsonPointerFor, a5 as JsonPointerInput, a6 as JsonPointerSegment, a7 as JsonPointerSegments, a8 as JsonPointerSegmentsFor, a9 as MAX_JSON_POINTER_DEPTH, aa as MetaEdgeProperties, N as NodeIndexConfig, d as NodeIndexDeclaration, w as NodeIndexWhereBuilder, ab as OrderSpec, ac as ParameterRef, ad as ResolveJsonPointer, ae as ResolveJsonPointerSegments, D as SchemaVersionRow, af as SetActiveVersionParams, ag as SortDirection, p as SqlDialect, ah as SqlSchema, ai as SqlTableNames, aj as StrategyTableContribution, ak as TableContribution, al as TransactionBackend, am as TraversalExpansion, an as UpsertFulltextBatchParams, ao as VectorCapabilities, ap as createSqlSchema, aq as fts5Strategy, ar as isMetaEdge, as as joinJsonPointers, at as jsonPointer, au as normalizeJsonPointer, av as parseJsonPointer, aw as tsvectorStrategy } from './types-DZPBXZOK.cjs';
|
|
6
|
+
import { A as AliasMap, E as EdgeAliasMap, Q as QueryBuilder, T as TraversalBuilder, C as CreateQueryBuilderOptions } from './store-Ojf0NOKk.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 DEFAULT_SEARCHABLE_LANGUAGE, j as DegreeOptions, k as DynamicEdgeAccessor, l as DynamicEdgeCollection, m as DynamicEdgeType, n as DynamicFieldBuilder, o as DynamicNodeAccessor, p as DynamicNodeCollection, q as DynamicNodeType, r as DynamicSelectableEdge, s as DynamicSelectableNode, t as Edge, u as EdgeAccessor, v as EdgeCollection, w as EdgeFindByEndpointsOptions, x as EdgeGetOrCreateByEndpointsOptions, y as EdgeGetOrCreateByEndpointsResult, z as EdgeIntrospection, F as EmbeddingSchema, G as EmbeddingValue, H as ExecutableAggregateQuery, I as ExecutableQuery, J as FieldAccessor, K as FulltextSearchHit, L as FulltextSearchOptions, M as GetOrCreateAction, N as GraphAlgorithms, O as GraphEdgeCollections, P as GraphNodeCollections, R as HookContext, U as HybridFulltextOptions, V as HybridSearchHit, W as HybridSearchOptions, X as HybridVectorOptions, Y as IfExistsMode, Z as KindIntrospection, _ as MaterializeRemovalsEntry, $ as MaterializeRemovalsOptions, a0 as MaterializeRemovalsResult, a1 as NeighborsOptions, a2 as Node, a3 as NodeAccessor, a4 as NodeAlias, a5 as NodeCollection, a6 as NodeGetOrCreateByConstraintOptions, a7 as NodeGetOrCreateByConstraintResult, a8 as NodeIdentifier, a9 as NodeRef, aa as OntologyIntrospection, ab as OperationHookContext, ac as PaginateOptions, ad as PaginatedResult, ae as PathNode, af as Predicate, ag as PreparedQuery, ah as PropsAccessor, ai as QueryHookContext, aj as QueryOptions, ak as ReachableNode, al as ReachableOptions, am as RebuildFulltextOptions, an as RebuildFulltextResult, ao as RecursiveTraversalOptions, ap as SchemaIntrospection, aq as SearchableMetadata, ar as SearchableOptions, as as SearchableSchema, at as SelectContext, au as SelectableEdge, av as SelectableNode, aw as ShortestPathOptions, ax as ShortestPathResult, S as Store, ay as StoreHooks, az as StoreOptions, aA as StoreProjection, aB as StoreRef, aC as StoreSearch, aD as StreamOptions, aE as SubgraphEdgeResult, aF as SubgraphNodeResult, aG as SubgraphOptions, aH as SubgraphResult, aI as SubsetEdge, aJ as SubsetNode, aK as TemporalAlgorithmOptions, aL as TransactionContext, aM as TraversalDirection, aN as TypedEdgeCollection, aO as UnionableQuery, aP as UniqueIntrospection, aQ as UpdateEdgeInput, aR as UpdateNodeInput, aS as VectorSearchHit, aT as VectorSearchOptions, aU as createStore, aV as createStoreWithSchema, aW as createVerifiedStore, aX as defineSubgraphProject, aY as embedding, aZ as exists, a_ as fieldRef, a$ as getEmbeddingDimensions, b0 as getSearchableMetadata, b1 as inSubquery, b2 as isEmbeddingSchema, b3 as isParameterRef, b4 as isSearchableSchema, b5 as notExists, b6 as notInSubquery, b7 as param, b8 as searchable } from './store-Ojf0NOKk.cjs';
|
|
8
|
+
import { G as GraphDef, K as KindRegistry } from './manager-CWa9cgwb.cjs';
|
|
9
|
+
export { A as AllEdgeTypes, t as AllNodeTypes, u as EdgeKinds, v as GetEdgeType, w as GetNodeType, x as NodeKinds, c as SchemaManagerOptions, d as SchemaValidationResult, y as defineGraph, z as getEdgeKinds, B as getNodeKinds, F as isGraphDef } from './manager-CWa9cgwb.cjs';
|
|
10
|
+
export { B as BackendDisposedError, C as CardinalityError, b as CompilerInvariantError, c as ConfigurationError, D as DatabaseOperationError, d as DisjointError, E as EagerMaterializationError, e as EdgeNotFoundError, f as EndpointError, g as EndpointNotFoundError, h as ErrorCategory, K as KindNotFoundError, M as MigrationError, N as NodeConstraintNotFoundError, i as NodeNotFoundError, R as RestrictedDeleteError, S as SchemaContentConflictError, j as SchemaMismatchError, k as StaleVersionError, l as StoreNotInitializedError, m as StoreNotInitializedReason, T as TypeGraphError, n as TypeGraphErrorOptions, U as UniquenessError, o as UnsupportedPredicateError, a as ValidationError, p as ValidationErrorDetails, V as ValidationIssue, q as VersionConflictError, r as getErrorSuggestion, s as isConstraintError, t as isSystemError, u as isTypeGraphError, v as isUserRecoverable } from './index-Bilw0pYm.cjs';
|
|
11
|
+
export { a as MaterializeIndexesEntry, b as MaterializeIndexesOptions, M as MaterializeIndexesResult } from './materialize-indexes-BQfaAZKA.cjs';
|
|
12
|
+
export { a as andWhere, d as defineEdgeIndex, b as defineNodeIndex, n as notWhere, o as orWhere } from './where-BmtjfWuS.cjs';
|
|
13
13
|
export { GraphExtensionError, GraphExtensionIssue, GraphExtensionIssueCode, GraphExtensionUnresolvedEndpointError, GraphExtensionValidationError, GraphExtensionVersionUnsupportedError, IncompatibleChange, IncompatibleChangeError, KindCollisionError, KindHasReferentsError, KindReferent, RemoveCompileTimeKindError, defineGraphExtension, validateGraphExtension } from './graph-extension/index.cjs';
|
|
14
14
|
import 'drizzle-orm';
|
|
15
|
+
import 'drizzle-orm/pg-core';
|
|
16
|
+
import 'drizzle-orm/sqlite-core';
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Options for defining a node type.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
export { A as AnyEdgeType,
|
|
4
|
-
import {
|
|
5
|
-
export { B as BackendCapabilities,
|
|
6
|
-
import { A as AliasMap, E as EdgeAliasMap, Q as QueryBuilder, T as TraversalBuilder, C as CreateQueryBuilderOptions } from './store-
|
|
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 DEFAULT_SEARCHABLE_LANGUAGE, j as DegreeOptions, k as DynamicEdgeAccessor, l as DynamicEdgeCollection, m as DynamicEdgeType, n as DynamicFieldBuilder, o as DynamicNodeAccessor, p as DynamicNodeCollection, q as DynamicNodeType, r as DynamicSelectableEdge, s as DynamicSelectableNode, t as Edge, u as EdgeAccessor, v as EdgeCollection, w as EdgeFindByEndpointsOptions, x as EdgeGetOrCreateByEndpointsOptions, y as EdgeGetOrCreateByEndpointsResult, z as EdgeIntrospection, F as EmbeddingSchema, G as EmbeddingValue, H as ExecutableAggregateQuery, I as ExecutableQuery, J as FieldAccessor, K as FulltextSearchHit, L as FulltextSearchOptions, M as GetOrCreateAction, N as GraphAlgorithms, O as GraphEdgeCollections, P as GraphNodeCollections, R as HookContext, U as HybridFulltextOptions, V as HybridSearchHit, W as HybridSearchOptions, X as HybridVectorOptions, Y as IfExistsMode, Z as KindIntrospection, _ as MaterializeRemovalsEntry, $ as MaterializeRemovalsOptions, a0 as MaterializeRemovalsResult, a1 as NeighborsOptions, a2 as Node, a3 as NodeAccessor, a4 as NodeAlias, a5 as NodeCollection, a6 as NodeGetOrCreateByConstraintOptions, a7 as NodeGetOrCreateByConstraintResult, a8 as NodeIdentifier, a9 as NodeRef, aa as OntologyIntrospection, ab as OperationHookContext, ac as PaginateOptions, ad as PaginatedResult, ae as PathNode, af as Predicate, ag as PreparedQuery, ah as PropsAccessor, ai as QueryHookContext, aj as QueryOptions, ak as ReachableNode, al as ReachableOptions, am as RebuildFulltextOptions, an as RebuildFulltextResult, ao as RecursiveTraversalOptions, ap as SchemaIntrospection, aq as SearchableMetadata, ar as SearchableOptions, as as SearchableSchema, at as SelectContext, au as SelectableEdge, av as SelectableNode, aw as ShortestPathOptions, ax as ShortestPathResult, S as Store, ay as StoreHooks, az as StoreOptions, aA as StoreProjection, aB as StoreRef, aC as StoreSearch, aD as StreamOptions, aE as SubgraphEdgeResult, aF as SubgraphNodeResult, aG as SubgraphOptions, aH as SubgraphResult, aI as SubsetEdge, aJ as SubsetNode, aK as TemporalAlgorithmOptions, aL as TransactionContext, aM as TraversalDirection, aN as TypedEdgeCollection, aO as UnionableQuery, aP as UniqueIntrospection, aQ as UpdateEdgeInput, aR as UpdateNodeInput, aS as VectorSearchHit, aT as VectorSearchOptions, aU as createStore, aV as createStoreWithSchema, aW as
|
|
8
|
-
import { G as GraphDef, K as KindRegistry } from './manager-
|
|
9
|
-
export { A as AllEdgeTypes,
|
|
10
|
-
export { B as BackendDisposedError, C as CardinalityError, b as CompilerInvariantError, c as ConfigurationError, D as DatabaseOperationError, d as DisjointError, E as EagerMaterializationError, e as EdgeNotFoundError, f as EndpointError, g as EndpointNotFoundError, h as ErrorCategory, K as KindNotFoundError, M as MigrationError, N as NodeConstraintNotFoundError, i as NodeNotFoundError, R as RestrictedDeleteError, S as SchemaContentConflictError, j as SchemaMismatchError, k as StaleVersionError, T as TypeGraphError,
|
|
11
|
-
export { a as MaterializeIndexesEntry, b as MaterializeIndexesOptions, M as MaterializeIndexesResult } from './materialize-indexes-
|
|
12
|
-
export { a as andWhere, d as defineEdgeIndex, b as defineNodeIndex, n as notWhere, o as orWhere } from './where-
|
|
2
|
+
import { d as KindAnnotations, N as NodeType, e as EdgeType } from './extension-types-B78CZfA5.js';
|
|
3
|
+
export { A as AnyEdgeType, C as CURRENT_GRAPH_EXTENSION_VERSION, f as Cardinality, g as Collation, D as DeleteBehavior, h as EdgeId, i as EdgeProps, E as EdgeRegistration, j as EdgeTypeWithEndpoints, k as EndpointExistence, c as GraphDefaults, G as GraphExtension, l as GraphExtensionVersion, J as JsonValue, L as LEGACY_GRAPH_EXTENSION_VERSION, m as NodeId, n as NodeProps, b as NodeRegistration, T as TemporalMode, U as UniqueConstraint, o as UniquenessScope, p as isEdgeType, q as isEdgeTypeWithEndpoints, r as isNodeType } from './extension-types-B78CZfA5.js';
|
|
4
|
+
import { H as InferenceType, M as MetaEdge, O as OntologyRelation, K as AggregateExpr, L as FieldRef, P as ComparisonOp, T as AggregateComparisonPredicate } from './types-Dzkr0Eqi.js';
|
|
5
|
+
export { U as AdoptedTransaction, B as BackendCapabilities, W as CommitSchemaVersionExpected, X as CommitSchemaVersionParams, Y as DEFAULT_SQL_SCHEMA, Z as DeleteFulltextBatchParams, E as EdgeIndexConfig, c as EdgeIndexDeclaration, q as EdgeIndexDirection, r as EdgeIndexWhereBuilder, _ as FulltextBatchRow, $ as FulltextCapabilities, a0 as FulltextQueryMode, a1 as FulltextSearchParams, a2 as FulltextSearchResult, F as FulltextStrategy, G as GraphBackend, a3 as HybridFusionOptions, I as IndexDeclaration, s as IndexOrigin, t as IndexScope, e as IndexWhereExpression, u as IndexWhereFieldBuilder, v as IndexWhereInput, J as JsonPointer, a4 as JsonPointerFor, a5 as JsonPointerInput, a6 as JsonPointerSegment, a7 as JsonPointerSegments, a8 as JsonPointerSegmentsFor, a9 as MAX_JSON_POINTER_DEPTH, aa as MetaEdgeProperties, N as NodeIndexConfig, d as NodeIndexDeclaration, w as NodeIndexWhereBuilder, ab as OrderSpec, ac as ParameterRef, ad as ResolveJsonPointer, ae as ResolveJsonPointerSegments, D as SchemaVersionRow, af as SetActiveVersionParams, ag as SortDirection, p as SqlDialect, ah as SqlSchema, ai as SqlTableNames, aj as StrategyTableContribution, ak as TableContribution, al as TransactionBackend, am as TraversalExpansion, an as UpsertFulltextBatchParams, ao as VectorCapabilities, ap as createSqlSchema, aq as fts5Strategy, ar as isMetaEdge, as as joinJsonPointers, at as jsonPointer, au as normalizeJsonPointer, av as parseJsonPointer, aw as tsvectorStrategy } from './types-Dzkr0Eqi.js';
|
|
6
|
+
import { A as AliasMap, E as EdgeAliasMap, Q as QueryBuilder, T as TraversalBuilder, C as CreateQueryBuilderOptions } from './store-C57kdvAa.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 DEFAULT_SEARCHABLE_LANGUAGE, j as DegreeOptions, k as DynamicEdgeAccessor, l as DynamicEdgeCollection, m as DynamicEdgeType, n as DynamicFieldBuilder, o as DynamicNodeAccessor, p as DynamicNodeCollection, q as DynamicNodeType, r as DynamicSelectableEdge, s as DynamicSelectableNode, t as Edge, u as EdgeAccessor, v as EdgeCollection, w as EdgeFindByEndpointsOptions, x as EdgeGetOrCreateByEndpointsOptions, y as EdgeGetOrCreateByEndpointsResult, z as EdgeIntrospection, F as EmbeddingSchema, G as EmbeddingValue, H as ExecutableAggregateQuery, I as ExecutableQuery, J as FieldAccessor, K as FulltextSearchHit, L as FulltextSearchOptions, M as GetOrCreateAction, N as GraphAlgorithms, O as GraphEdgeCollections, P as GraphNodeCollections, R as HookContext, U as HybridFulltextOptions, V as HybridSearchHit, W as HybridSearchOptions, X as HybridVectorOptions, Y as IfExistsMode, Z as KindIntrospection, _ as MaterializeRemovalsEntry, $ as MaterializeRemovalsOptions, a0 as MaterializeRemovalsResult, a1 as NeighborsOptions, a2 as Node, a3 as NodeAccessor, a4 as NodeAlias, a5 as NodeCollection, a6 as NodeGetOrCreateByConstraintOptions, a7 as NodeGetOrCreateByConstraintResult, a8 as NodeIdentifier, a9 as NodeRef, aa as OntologyIntrospection, ab as OperationHookContext, ac as PaginateOptions, ad as PaginatedResult, ae as PathNode, af as Predicate, ag as PreparedQuery, ah as PropsAccessor, ai as QueryHookContext, aj as QueryOptions, ak as ReachableNode, al as ReachableOptions, am as RebuildFulltextOptions, an as RebuildFulltextResult, ao as RecursiveTraversalOptions, ap as SchemaIntrospection, aq as SearchableMetadata, ar as SearchableOptions, as as SearchableSchema, at as SelectContext, au as SelectableEdge, av as SelectableNode, aw as ShortestPathOptions, ax as ShortestPathResult, S as Store, ay as StoreHooks, az as StoreOptions, aA as StoreProjection, aB as StoreRef, aC as StoreSearch, aD as StreamOptions, aE as SubgraphEdgeResult, aF as SubgraphNodeResult, aG as SubgraphOptions, aH as SubgraphResult, aI as SubsetEdge, aJ as SubsetNode, aK as TemporalAlgorithmOptions, aL as TransactionContext, aM as TraversalDirection, aN as TypedEdgeCollection, aO as UnionableQuery, aP as UniqueIntrospection, aQ as UpdateEdgeInput, aR as UpdateNodeInput, aS as VectorSearchHit, aT as VectorSearchOptions, aU as createStore, aV as createStoreWithSchema, aW as createVerifiedStore, aX as defineSubgraphProject, aY as embedding, aZ as exists, a_ as fieldRef, a$ as getEmbeddingDimensions, b0 as getSearchableMetadata, b1 as inSubquery, b2 as isEmbeddingSchema, b3 as isParameterRef, b4 as isSearchableSchema, b5 as notExists, b6 as notInSubquery, b7 as param, b8 as searchable } from './store-C57kdvAa.js';
|
|
8
|
+
import { G as GraphDef, K as KindRegistry } from './manager-Cfcb2sJL.js';
|
|
9
|
+
export { A as AllEdgeTypes, t as AllNodeTypes, u as EdgeKinds, v as GetEdgeType, w as GetNodeType, x as NodeKinds, c as SchemaManagerOptions, d as SchemaValidationResult, y as defineGraph, z as getEdgeKinds, B as getNodeKinds, F as isGraphDef } from './manager-Cfcb2sJL.js';
|
|
10
|
+
export { B as BackendDisposedError, C as CardinalityError, b as CompilerInvariantError, c as ConfigurationError, D as DatabaseOperationError, d as DisjointError, E as EagerMaterializationError, e as EdgeNotFoundError, f as EndpointError, g as EndpointNotFoundError, h as ErrorCategory, K as KindNotFoundError, M as MigrationError, N as NodeConstraintNotFoundError, i as NodeNotFoundError, R as RestrictedDeleteError, S as SchemaContentConflictError, j as SchemaMismatchError, k as StaleVersionError, l as StoreNotInitializedError, m as StoreNotInitializedReason, T as TypeGraphError, n as TypeGraphErrorOptions, U as UniquenessError, o as UnsupportedPredicateError, a as ValidationError, p as ValidationErrorDetails, V as ValidationIssue, q as VersionConflictError, r as getErrorSuggestion, s as isConstraintError, t as isSystemError, u as isTypeGraphError, v as isUserRecoverable } from './index-CWdBFWbI.js';
|
|
11
|
+
export { a as MaterializeIndexesEntry, b as MaterializeIndexesOptions, M as MaterializeIndexesResult } from './materialize-indexes-DFavFQah.js';
|
|
12
|
+
export { a as andWhere, d as defineEdgeIndex, b as defineNodeIndex, n as notWhere, o as orWhere } from './where-kk1Zz2En.js';
|
|
13
13
|
export { GraphExtensionError, GraphExtensionIssue, GraphExtensionIssueCode, GraphExtensionUnresolvedEndpointError, GraphExtensionValidationError, GraphExtensionVersionUnsupportedError, IncompatibleChange, IncompatibleChangeError, KindCollisionError, KindHasReferentsError, KindReferent, RemoveCompileTimeKindError, defineGraphExtension, validateGraphExtension } from './graph-extension/index.js';
|
|
14
14
|
import 'drizzle-orm';
|
|
15
|
+
import 'drizzle-orm/pg-core';
|
|
16
|
+
import 'drizzle-orm/sqlite-core';
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Options for defining a node type.
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { quoteIdentifier, EMPTY_REQUIRED_COLUMNS, addRequiredColumn, markSelectiveFieldAsRequired, markFieldRefAsRequired, NODE_COLUMNS, shouldProjectColumn, mapSelectiveSystemFieldToColumn, isIdFieldRef, isAggregateExpr, EDGE_COLUMNS } from './chunk-3EUKJEQ3.js';
|
|
2
|
-
import { META_EDGE_BRAND, loadAndMergeGraphExtensionDocument, ensureSchema, mergeGraphExtension, commitNewSchemaVersion, applyDeprecatedKinds, loadActiveSchemaWithBootstrap, parseSerializedSchema, computeClosuresFromOntology, createEmptyClosures, KindRegistry, extensionKindNames, serializeSchemaProperties, buildGraphExtensionOntologyKeySet, compileTimeOntologyKey, getTypeName, validateNodeProps, validateEdgeProps
|
|
3
|
-
export { broader, core, defineEdge, defineNode, differentFrom, disjointWith, equivalentTo, hasPart, implies, inverseOf, isMetaEdge, narrower, partOf, relatedTo, sameAs, subClassOf } from './chunk-
|
|
4
|
-
import { nowIso, isKnownKind, validateOptionalIsoDate, getNodeKinds, getEdgeKinds } from './chunk-
|
|
5
|
-
export { defineGraph, getEdgeKinds, getNodeKinds, isEdgeType, isEdgeTypeWithEndpoints, isGraphDef, isNodeType } from './chunk-
|
|
6
|
-
export { defineGraphExtension } from './chunk-
|
|
7
|
-
import { IncompatibleChangeError, filterReservedKeys, RESERVED_NODE_KEYS, RESERVED_EDGE_KEYS, RemoveCompileTimeKindError, KindHasReferentsError, validateProjectionField } from './chunk-
|
|
8
|
-
export { CURRENT_GRAPH_EXTENSION_VERSION, GraphExtensionError, GraphExtensionUnresolvedEndpointError, GraphExtensionValidationError, GraphExtensionVersionUnsupportedError, IncompatibleChangeError, KindCollisionError, KindHasReferentsError, LEGACY_GRAPH_EXTENSION_VERSION, RemoveCompileTimeKindError, validateGraphExtension } from './chunk-
|
|
9
|
-
import { runOptionallyInTransaction } from './chunk-
|
|
10
|
-
import {
|
|
11
|
-
|
|
2
|
+
import { META_EDGE_BRAND, loadAndMergeGraphExtensionDocument, ensureSchema, loadAndVerifyGraph, mergeGraphExtension, commitNewSchemaVersion, applyDeprecatedKinds, loadActiveSchemaWithBootstrap, parseSerializedSchema, computeClosuresFromOntology, createEmptyClosures, KindRegistry, extensionKindNames, serializeSchemaProperties, buildGraphExtensionOntologyKeySet, compileTimeOntologyKey, getTypeName, validateNodeProps, validateEdgeProps } from './chunk-X53YKGHR.js';
|
|
3
|
+
export { broader, core, defineEdge, defineNode, differentFrom, disjointWith, equivalentTo, hasPart, implies, inverseOf, isMetaEdge, narrower, partOf, relatedTo, sameAs, subClassOf } from './chunk-X53YKGHR.js';
|
|
4
|
+
import { nowIso, isKnownKind, validateOptionalIsoDate, getNodeKinds, getEdgeKinds } from './chunk-OYLF3IC7.js';
|
|
5
|
+
export { defineGraph, getEdgeKinds, getNodeKinds, isEdgeType, isEdgeTypeWithEndpoints, isGraphDef, isNodeType } from './chunk-OYLF3IC7.js';
|
|
6
|
+
export { defineGraphExtension } from './chunk-E5ROA3MN.js';
|
|
7
|
+
import { IncompatibleChangeError, filterReservedKeys, RESERVED_NODE_KEYS, RESERVED_EDGE_KEYS, RemoveCompileTimeKindError, KindHasReferentsError, validateProjectionField } from './chunk-TSGBRPNE.js';
|
|
8
|
+
export { CURRENT_GRAPH_EXTENSION_VERSION, GraphExtensionError, GraphExtensionUnresolvedEndpointError, GraphExtensionValidationError, GraphExtensionVersionUnsupportedError, IncompatibleChangeError, KindCollisionError, KindHasReferentsError, LEGACY_GRAPH_EXTENSION_VERSION, RemoveCompileTimeKindError, validateGraphExtension } from './chunk-TSGBRPNE.js';
|
|
9
|
+
import { runOptionallyInTransaction } from './chunk-ENXJLDRK.js';
|
|
10
|
+
import { canonicalEqual, sortedReplacer } from './chunk-5H3BAMTB.js';
|
|
11
|
+
import { getDialect, generateIndexDDL } from './chunk-ZTREJOGB.js';
|
|
12
|
+
export { andWhere, fts5Strategy, notWhere, orWhere, tsvectorStrategy } from './chunk-ZTREJOGB.js';
|
|
12
13
|
import { MAX_PG_IDENTIFIER_LENGTH, DEFAULT_PAGINATION_LIMIT, DEFAULT_STREAM_BATCH_SIZE, NODE_META_KEYS, EDGE_META_KEYS, SQLITE_PATH_DELIMITER, PG_ARRAY_START, PG_ARRAY_END, PG_PATH_ELEMENT_SEPARATOR, fnv1aBase36, sha256Hex } from './chunk-EJCDOA37.js';
|
|
13
14
|
export { defineEdgeIndex, defineNodeIndex } from './chunk-EJCDOA37.js';
|
|
14
15
|
import { createSchemaIntrospector, resolveFieldTypeInfoAtJsonPointer, getSearchableMetadata, DEFAULT_SEARCHABLE_LANGUAGE } from './chunk-OOS2RKRH.js';
|
|
15
16
|
export { DEFAULT_SEARCHABLE_LANGUAGE, getSearchableMetadata, isSearchableSchema, searchable } from './chunk-OOS2RKRH.js';
|
|
16
17
|
import { getEmbeddingDimensions, isEmbeddingSchema } from './chunk-WVQXAFP3.js';
|
|
17
18
|
export { embedding, getEmbeddingDimensions, isEmbeddingSchema } from './chunk-WVQXAFP3.js';
|
|
18
|
-
import { ConfigurationError, UnsupportedPredicateError, ValidationError, KindNotFoundError, EndpointError, EagerMaterializationError, CompilerInvariantError, DatabaseOperationError, EdgeNotFoundError, NodeConstraintNotFoundError, RestrictedDeleteError, NodeNotFoundError, EndpointNotFoundError, UniquenessError, CardinalityError, DisjointError } from './chunk-
|
|
19
|
-
export { BackendDisposedError, CardinalityError, CompilerInvariantError, ConfigurationError, DatabaseOperationError, DisjointError, EagerMaterializationError, EdgeNotFoundError, EndpointError, EndpointNotFoundError, KindNotFoundError, MigrationError, NodeConstraintNotFoundError, NodeNotFoundError, RestrictedDeleteError, SchemaContentConflictError, SchemaMismatchError, StaleVersionError, TypeGraphError, UniquenessError, UnsupportedPredicateError, ValidationError, VersionConflictError, getErrorSuggestion, isConstraintError, isSystemError, isTypeGraphError, isUserRecoverable } from './chunk-
|
|
19
|
+
import { ConfigurationError, UnsupportedPredicateError, ValidationError, KindNotFoundError, EndpointError, EagerMaterializationError, CompilerInvariantError, DatabaseOperationError, EdgeNotFoundError, NodeConstraintNotFoundError, RestrictedDeleteError, NodeNotFoundError, EndpointNotFoundError, UniquenessError, CardinalityError, DisjointError } from './chunk-U5ROKVRF.js';
|
|
20
|
+
export { BackendDisposedError, CardinalityError, CompilerInvariantError, ConfigurationError, DatabaseOperationError, DisjointError, EagerMaterializationError, EdgeNotFoundError, EndpointError, EndpointNotFoundError, KindNotFoundError, MigrationError, NodeConstraintNotFoundError, NodeNotFoundError, RestrictedDeleteError, SchemaContentConflictError, SchemaMismatchError, StaleVersionError, StoreNotInitializedError, TypeGraphError, UniquenessError, UnsupportedPredicateError, ValidationError, VersionConflictError, getErrorSuggestion, isConstraintError, isSystemError, isTypeGraphError, isUserRecoverable } from './chunk-U5ROKVRF.js';
|
|
20
21
|
import { jsonPointer, parseJsonPointer, normalizeJsonPointer, joinJsonPointers } from './chunk-NZ5PMBTG.js';
|
|
21
22
|
export { MAX_JSON_POINTER_DEPTH, joinJsonPointers, jsonPointer, normalizeJsonPointer, parseJsonPointer } from './chunk-NZ5PMBTG.js';
|
|
22
23
|
import { z } from 'zod';
|
|
@@ -14736,6 +14737,12 @@ var Store = class _Store {
|
|
|
14736
14737
|
* The transaction context provides the same collection API as the Store:
|
|
14737
14738
|
* - `tx.nodes.Person.create(...)` - Create a node
|
|
14738
14739
|
* - `tx.edges.worksAt.create(...)` - Create an edge
|
|
14740
|
+
* - `tx.sql` - the raw Drizzle handle **bound to this same
|
|
14741
|
+
* transaction**, for writing the caller's own relational tables in
|
|
14742
|
+
* the same atomic boundary (the graph-owned counterpart of
|
|
14743
|
+
* {@link Store.withTransaction}). See {@link TransactionContext}
|
|
14744
|
+
* for per-backend semantics; it is `undefined` only on the
|
|
14745
|
+
* non-transactional fallback.
|
|
14739
14746
|
*
|
|
14740
14747
|
* @example
|
|
14741
14748
|
* ```typescript
|
|
@@ -14750,6 +14757,16 @@ var Store = class _Store {
|
|
|
14750
14757
|
* });
|
|
14751
14758
|
* ```
|
|
14752
14759
|
*
|
|
14760
|
+
* @example Cross-store write via `tx.sql` (graph-owned boundary):
|
|
14761
|
+
* ```typescript
|
|
14762
|
+
* await store.transaction(async (tx) => {
|
|
14763
|
+
* await tx.nodes.Document.update(documentId, props);
|
|
14764
|
+
* // cast `tx.sql` to your concrete Drizzle database type
|
|
14765
|
+
* const sqlTx = tx.sql as NodePgDatabase;
|
|
14766
|
+
* await sqlTx.insert(documentVersions).values(versionRow);
|
|
14767
|
+
* });
|
|
14768
|
+
* ```
|
|
14769
|
+
*
|
|
14753
14770
|
* **Backends without transactions.** When `backend.capabilities.transactions`
|
|
14754
14771
|
* is `false` (Cloudflare D1, `drizzle-orm/neon-http`), this method runs the
|
|
14755
14772
|
* callback against the same backend used outside `transaction()` — writes
|
|
@@ -14769,31 +14786,108 @@ var Store = class _Store {
|
|
|
14769
14786
|
if (!this.#backend.capabilities.transactions) {
|
|
14770
14787
|
return fn({ nodes: this.nodes, edges: this.edges });
|
|
14771
14788
|
}
|
|
14772
|
-
return this.#backend.transaction(
|
|
14773
|
-
|
|
14774
|
-
|
|
14775
|
-
|
|
14776
|
-
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
|
|
14780
|
-
|
|
14781
|
-
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
|
|
14785
|
-
|
|
14786
|
-
|
|
14787
|
-
|
|
14788
|
-
|
|
14789
|
-
|
|
14790
|
-
|
|
14791
|
-
|
|
14792
|
-
|
|
14793
|
-
|
|
14789
|
+
return this.#backend.transaction(
|
|
14790
|
+
async (txBackend, sql17) => fn(this.#buildTransactionContext(txBackend, sql17))
|
|
14791
|
+
);
|
|
14792
|
+
}
|
|
14793
|
+
/**
|
|
14794
|
+
* Adopts a caller-owned, already-open Drizzle transaction so the graph
|
|
14795
|
+
* store and the caller's relational writes commit or roll back as one
|
|
14796
|
+
* Postgres/SQLite transaction (#134).
|
|
14797
|
+
*
|
|
14798
|
+
* Use this when the **relational layer owns the transaction**: the
|
|
14799
|
+
* caller has opened a transaction and needs TypeGraph writes enlisted
|
|
14800
|
+
* on the *same* connection. Unlike {@link transaction}, this opens no
|
|
14801
|
+
* transaction — the caller's transaction is the single commit/rollback
|
|
14802
|
+
* boundary.
|
|
14803
|
+
*
|
|
14804
|
+
* `withTransaction` is driver-agnostic; how the caller opens the
|
|
14805
|
+
* transaction is not. **Async drivers** (node-postgres,
|
|
14806
|
+
* `neon-serverless` Pool, libsql) use `db.transaction(async …)`.
|
|
14807
|
+
* **Synchronous `better-sqlite3`** cannot — its driver rejects an
|
|
14808
|
+
* `async` transaction callback (`Transaction function cannot return a
|
|
14809
|
+
* promise`) and the async continuation would run outside the
|
|
14810
|
+
* rolled-back transaction — so the caller opens the transaction with
|
|
14811
|
+
* explicit `BEGIN`/`COMMIT`/`ROLLBACK` on the single connection
|
|
14812
|
+
* instead. See the "Cross-Store Transactions" recipe for both shapes.
|
|
14813
|
+
*
|
|
14814
|
+
* The returned context reuses this store's already-resolved
|
|
14815
|
+
* schema/registry: it runs **no** schema bootstrap, `evolve`, or
|
|
14816
|
+
* migration, and emits **no DDL** inside the caller's transaction.
|
|
14817
|
+
* Fulltext operations assert the durable materialization marker (a
|
|
14818
|
+
* cached SELECT) and throw {@link StoreNotInitializedError} on a
|
|
14819
|
+
* missing/stale/failed marker rather than migrating mid-transaction —
|
|
14820
|
+
* so boot the parent store via `createStoreWithSchema` once at
|
|
14821
|
+
* startup.
|
|
14822
|
+
*
|
|
14823
|
+
* @example
|
|
14824
|
+
* ```typescript
|
|
14825
|
+
* // Async driver (Postgres / libsql):
|
|
14826
|
+
* await db.transaction(async (sqlTx) => {
|
|
14827
|
+
* const connector = await createConnectorRow(sqlTx, input); // Drizzle
|
|
14828
|
+
* const txStore = store.withTransaction(sqlTx);
|
|
14829
|
+
* await txStore.nodes.ArtifactSource.create({ // TypeGraph
|
|
14830
|
+
* connectorId: connector.id,
|
|
14831
|
+
* });
|
|
14832
|
+
* }); // one COMMIT / ROLLBACK across both layers
|
|
14833
|
+
* ```
|
|
14834
|
+
*
|
|
14835
|
+
* @throws {ConfigurationError} when the backend cannot adopt an
|
|
14836
|
+
* external transaction — either it is not a Drizzle Postgres/SQLite
|
|
14837
|
+
* backend, or `backend.capabilities.transactions` is `false`
|
|
14838
|
+
* (`drizzle-orm/neon-http`, Cloudflare D1, SQLite
|
|
14839
|
+
* `transactionMode: "none"`). A non-atomic fallback is deliberately
|
|
14840
|
+
* not offered here: the caller's relational write *would* still
|
|
14841
|
+
* commit, defeating the purpose of cross-store atomicity.
|
|
14842
|
+
* @throws {StoreNotInitializedError} at point of use, when a fulltext
|
|
14843
|
+
* operation on the returned context observes a missing/stale/failed
|
|
14844
|
+
* durable materialization marker (parent store not booted via
|
|
14845
|
+
* `createStoreWithSchema`). Rolls back the caller's transaction
|
|
14846
|
+
* without emitting any DDL.
|
|
14847
|
+
*/
|
|
14848
|
+
withTransaction(externalTx) {
|
|
14849
|
+
const adopt = this.#backend.adoptTransaction;
|
|
14850
|
+
if (!adopt) {
|
|
14851
|
+
throw new ConfigurationError(
|
|
14852
|
+
"This backend cannot adopt an external transaction for cross-store atomicity. adoptTransaction is provided only by the Drizzle Postgres/SQLite backends with transaction support. Check backend.capabilities.transactions, or run the relational and graph writes as separate transactions with manual compensation.",
|
|
14853
|
+
{ capability: "adoptTransaction" }
|
|
14794
14854
|
);
|
|
14795
|
-
|
|
14796
|
-
|
|
14855
|
+
}
|
|
14856
|
+
return this.#buildTransactionContext(adopt(externalTx), externalTx);
|
|
14857
|
+
}
|
|
14858
|
+
/**
|
|
14859
|
+
* Builds the `{ nodes, edges, sql }` projection bound to a
|
|
14860
|
+
* transaction-scoped backend. Shared verbatim by {@link transaction}
|
|
14861
|
+
* (TypeGraph opens the tx) and {@link withTransaction} (#134 — the
|
|
14862
|
+
* caller opened it) so both surfaces resolve collections, query
|
|
14863
|
+
* factories, and the reused graph/registry identically. `sql` is the
|
|
14864
|
+
* raw Drizzle handle bound to the same transaction (#140);
|
|
14865
|
+
* `undefined` only on the non-transactional fallback.
|
|
14866
|
+
*/
|
|
14867
|
+
#buildTransactionContext(txBackend, sql17) {
|
|
14868
|
+
const txNodeOperations = {
|
|
14869
|
+
...this.#nodeOperations,
|
|
14870
|
+
createQuery: () => this.#createQueryForBackend(txBackend)
|
|
14871
|
+
};
|
|
14872
|
+
const txEdgeOperations = {
|
|
14873
|
+
...this.#edgeOperations,
|
|
14874
|
+
createQuery: () => this.#createQueryForBackend(txBackend)
|
|
14875
|
+
};
|
|
14876
|
+
const nodes = createNodeCollectionsProxy(
|
|
14877
|
+
this.#graph,
|
|
14878
|
+
this.graphId,
|
|
14879
|
+
this.#registry,
|
|
14880
|
+
txBackend,
|
|
14881
|
+
txNodeOperations
|
|
14882
|
+
);
|
|
14883
|
+
const edges = createEdgeCollectionsProxy(
|
|
14884
|
+
this.#graph,
|
|
14885
|
+
this.graphId,
|
|
14886
|
+
this.#registry,
|
|
14887
|
+
txBackend,
|
|
14888
|
+
txEdgeOperations
|
|
14889
|
+
);
|
|
14890
|
+
return sql17 === void 0 ? { nodes, edges } : { nodes, edges, sql: sql17 };
|
|
14797
14891
|
}
|
|
14798
14892
|
// === Graph Lifecycle ===
|
|
14799
14893
|
/**
|
|
@@ -15374,6 +15468,13 @@ function schemaMetadataForResult(activeRow, result) {
|
|
|
15374
15468
|
}
|
|
15375
15469
|
return schemaMetadataFromRow(activeRow);
|
|
15376
15470
|
}
|
|
15471
|
+
async function materializeRuntimeContributions(backend, graphId) {
|
|
15472
|
+
if (backend.ensureRuntimeContributions) {
|
|
15473
|
+
await backend.ensureRuntimeContributions(graphId);
|
|
15474
|
+
return;
|
|
15475
|
+
}
|
|
15476
|
+
await backend.ensureFulltextTable?.(graphId);
|
|
15477
|
+
}
|
|
15377
15478
|
async function createStoreWithSchema(graph, backend, options) {
|
|
15378
15479
|
const {
|
|
15379
15480
|
graph: merged,
|
|
@@ -15384,6 +15485,7 @@ async function createStoreWithSchema(graph, backend, options) {
|
|
|
15384
15485
|
...options,
|
|
15385
15486
|
preloaded: { activeRow, storedSchema }
|
|
15386
15487
|
});
|
|
15488
|
+
await materializeRuntimeContributions(backend, merged.id);
|
|
15387
15489
|
const store = new Store(
|
|
15388
15490
|
merged,
|
|
15389
15491
|
backend,
|
|
@@ -15392,7 +15494,21 @@ async function createStoreWithSchema(graph, backend, options) {
|
|
|
15392
15494
|
);
|
|
15393
15495
|
return [store, result];
|
|
15394
15496
|
}
|
|
15497
|
+
async function createVerifiedStore(graph, backend, options) {
|
|
15498
|
+
const {
|
|
15499
|
+
graph: merged,
|
|
15500
|
+
activeRow,
|
|
15501
|
+
result
|
|
15502
|
+
} = await loadAndVerifyGraph(backend, graph);
|
|
15503
|
+
const store = new Store(
|
|
15504
|
+
merged,
|
|
15505
|
+
backend,
|
|
15506
|
+
options,
|
|
15507
|
+
schemaMetadataFromRow(activeRow)
|
|
15508
|
+
);
|
|
15509
|
+
return [store, result];
|
|
15510
|
+
}
|
|
15395
15511
|
|
|
15396
|
-
export { DEFAULT_SQL_SCHEMA, ExecutableAggregateQuery, ExecutableQuery, MAX_EXPLICIT_RECURSIVE_DEPTH, MAX_RECURSIVE_DEPTH, PreparedQuery, QueryBuilder, StoreSearch, UnionableQuery, avg, composeFragments, count, countDistinct, countDistinctEdges, countEdges, createExternalRef, createFragment, createQueryBuilder, createSqlSchema, createStore, createStoreWithSchema, defineSubgraphProject, exists, externalRef, field, fieldRef, generateId, getExternalRefTable, having, havingEq, havingGt, havingGte, havingLt, havingLte, inSubquery, isExternalRefSchema, isParameterRef, limitFragment, max, metaEdge, min, notExists, notInSubquery, offsetFragment, orderByFragment, param, sum };
|
|
15512
|
+
export { DEFAULT_SQL_SCHEMA, ExecutableAggregateQuery, ExecutableQuery, MAX_EXPLICIT_RECURSIVE_DEPTH, MAX_RECURSIVE_DEPTH, PreparedQuery, QueryBuilder, StoreSearch, UnionableQuery, avg, composeFragments, count, countDistinct, countDistinctEdges, countEdges, createExternalRef, createFragment, createQueryBuilder, createSqlSchema, createStore, createStoreWithSchema, createVerifiedStore, defineSubgraphProject, exists, externalRef, field, fieldRef, generateId, getExternalRefTable, having, havingEq, havingGt, havingGte, havingLt, havingLte, inSubquery, isExternalRefSchema, isParameterRef, limitFragment, max, metaEdge, min, notExists, notInSubquery, offsetFragment, orderByFragment, param, sum };
|
|
15397
15513
|
//# sourceMappingURL=index.js.map
|
|
15398
15514
|
//# sourceMappingURL=index.js.map
|