@nicia-ai/typegraph 0.32.0 → 0.33.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/README.md +31 -0
- package/dist/backend/postgres/index.cjs +28 -15
- package/dist/backend/postgres/index.d.cts +6 -6
- package/dist/backend/postgres/index.d.ts +6 -6
- package/dist/backend/postgres/index.js +6 -5
- package/dist/backend/postgres/pglite.cjs +10 -9
- package/dist/backend/postgres/pglite.cjs.map +1 -1
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +6 -5
- package/dist/backend/postgres/pglite.js.map +1 -1
- package/dist/backend/sqlite/index.cjs +27 -14
- package/dist/backend/sqlite/index.d.cts +7 -7
- package/dist/backend/sqlite/index.d.ts +7 -7
- 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 +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +6 -5
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +10 -9
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +6 -5
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-CAMMC3E4.cjs → chunk-3642VBVC.cjs} +65 -63
- package/dist/chunk-3642VBVC.cjs.map +1 -0
- package/dist/chunk-3E7SNSIA.cjs +55 -0
- package/dist/chunk-3E7SNSIA.cjs.map +1 -0
- package/dist/{chunk-6RMLO5O4.cjs → chunk-3IR2GEMJ.cjs} +8 -7
- package/dist/chunk-3IR2GEMJ.cjs.map +1 -0
- package/dist/{chunk-JKRKIEVA.cjs → chunk-4RBAJVEC.cjs} +125 -3
- package/dist/chunk-4RBAJVEC.cjs.map +1 -0
- package/dist/{chunk-IJORSAC3.js → chunk-6NRFUHMS.js} +4 -3
- package/dist/chunk-6NRFUHMS.js.map +1 -0
- package/dist/{chunk-YL4F3CMD.cjs → chunk-BF3ZDEUE.cjs} +96 -64
- package/dist/chunk-BF3ZDEUE.cjs.map +1 -0
- package/dist/{chunk-2LAT5BIK.cjs → chunk-D3EWZ67S.cjs} +2820 -1947
- package/dist/chunk-D3EWZ67S.cjs.map +1 -0
- package/dist/{chunk-XQFAJVYW.js → chunk-DJYRRDHA.js} +123 -4
- package/dist/chunk-DJYRRDHA.js.map +1 -0
- package/dist/{chunk-YQGLVWB2.cjs → chunk-EF3Z645U.cjs} +2 -52
- package/dist/chunk-EF3Z645U.cjs.map +1 -0
- package/dist/chunk-GYVBEZAO.js +120 -0
- package/dist/chunk-GYVBEZAO.js.map +1 -0
- package/dist/chunk-I4W7MKVG.cjs +1526 -0
- package/dist/chunk-I4W7MKVG.cjs.map +1 -0
- package/dist/{chunk-MXE2U3EX.js → chunk-IZ4PCL47.js} +3 -52
- package/dist/chunk-IZ4PCL47.js.map +1 -0
- package/dist/{chunk-7WW3WL6E.js → chunk-JHOBXD7O.js} +9 -7
- package/dist/chunk-JHOBXD7O.js.map +1 -0
- package/dist/{chunk-3HQDMOBK.cjs → chunk-KY5SDVA7.cjs} +619 -578
- package/dist/chunk-KY5SDVA7.cjs.map +1 -0
- package/dist/{chunk-EEYV6UOE.cjs → chunk-MBLXCV2Y.cjs} +2 -2
- package/dist/{chunk-EEYV6UOE.cjs.map → chunk-MBLXCV2Y.cjs.map} +1 -1
- package/dist/{chunk-LAZGHOZW.cjs → chunk-NG5N7R45.cjs} +28 -28
- package/dist/{chunk-LAZGHOZW.cjs.map → chunk-NG5N7R45.cjs.map} +1 -1
- package/dist/chunk-OIE2UPVG.cjs +126 -0
- package/dist/chunk-OIE2UPVG.cjs.map +1 -0
- package/dist/{chunk-NDM5PXEH.js → chunk-OS6KS3HV.js} +41 -9
- package/dist/chunk-OS6KS3HV.js.map +1 -0
- package/dist/chunk-PYD3UCDU.js +1480 -0
- package/dist/chunk-PYD3UCDU.js.map +1 -0
- package/dist/{chunk-W4ZX2GCP.js → chunk-QBYTJSAY.js} +2 -2
- package/dist/{chunk-W4ZX2GCP.js.map → chunk-QBYTJSAY.js.map} +1 -1
- package/dist/{chunk-HFBRAOF7.js → chunk-SPT5JMME.js} +3 -3
- package/dist/{chunk-HFBRAOF7.js.map → chunk-SPT5JMME.js.map} +1 -1
- package/dist/{chunk-SB65GJNY.cjs → chunk-SST7XDY6.cjs} +11 -11
- package/dist/{chunk-SB65GJNY.cjs.map → chunk-SST7XDY6.cjs.map} +1 -1
- package/dist/{chunk-TUA3MEJJ.js → chunk-UPDMJEW6.js} +606 -561
- package/dist/chunk-UPDMJEW6.js.map +1 -0
- package/dist/{chunk-WNORITK6.js → chunk-WLP6TKFB.js} +2691 -1817
- package/dist/chunk-WLP6TKFB.js.map +1 -0
- package/dist/chunk-XLUNB2TZ.js +53 -0
- package/dist/chunk-XLUNB2TZ.js.map +1 -0
- package/dist/{chunk-2BVHPOIG.js → chunk-XVUJY72M.js} +6 -6
- package/dist/{chunk-2BVHPOIG.js.map → chunk-XVUJY72M.js.map} +1 -1
- package/dist/{ddl-C8e8zDAE.d.ts → ddl-CVnHJcar.d.ts} +3 -3
- package/dist/{ddl-CwyG4HoQ.d.cts → ddl-Dxt_fBHr.d.cts} +3 -3
- package/dist/{extension-types-D1k0inWU.d.cts → extension-types-YGFJPrzK.d.cts} +1 -1
- package/dist/{extension-types-D1k0inWU.d.ts → extension-types-YGFJPrzK.d.ts} +1 -1
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-merge/index.cjs +24 -23
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +6 -6
- package/dist/graph-merge/index.d.ts +6 -6
- package/dist/graph-merge/index.js +9 -8
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-BEK0VtNB.d.ts → index-DGX6D9j1.d.ts} +2 -2
- package/dist/{index-C8sSTErx.d.cts → index-SEvUHDA6.d.cts} +2 -2
- package/dist/index.cjs +129 -104
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -55
- package/dist/index.d.ts +25 -55
- package/dist/index.js +12 -10
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +5 -4
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +3 -2
- package/dist/interchange/index.cjs +15 -15
- package/dist/interchange/index.d.cts +5 -5
- package/dist/interchange/index.d.ts +5 -5
- package/dist/interchange/index.js +2 -2
- package/dist/{manager-aVgxbGt-.d.cts → manager-BYl_zyZR.d.cts} +2 -2
- package/dist/{manager-8htmuGr-.d.ts → manager-C0_r0ALf.d.ts} +2 -2
- package/dist/{materialize-indexes-CAGhqPHQ.d.ts → materialize-indexes-CAkIYFV-.d.ts} +1 -1
- package/dist/{materialize-indexes-DEYkU-wr.d.cts → materialize-indexes-D20xNluI.d.cts} +1 -1
- package/dist/{postgres-jgXmD45C.d.cts → postgres-MzBPkYzq.d.ts} +2651 -596
- package/dist/{postgres-Dhom7iiX.d.ts → postgres-_9psmVGm.d.cts} +2651 -596
- package/dist/profiler/index.cjs +4 -3
- package/dist/profiler/index.cjs.map +1 -1
- package/dist/profiler/index.d.cts +7 -7
- package/dist/profiler/index.d.ts +7 -7
- package/dist/profiler/index.js +2 -1
- package/dist/profiler/index.js.map +1 -1
- package/dist/schema/index.cjs +30 -29
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +7 -7
- package/dist/schema/index.d.ts +7 -7
- package/dist/schema/index.js +7 -6
- package/dist/schema/index.js.map +1 -1
- package/dist/{sqlite-BfLsCEqO.d.ts → sqlite-BfksSb45.d.cts} +2726 -455
- package/dist/{sqlite-DcQ_BCUW.d.cts → sqlite-gm44dShb.d.ts} +2726 -455
- package/dist/{store-view-pBOUrQte.d.ts → store-view-9jQ2rPum.d.cts} +437 -129
- package/dist/{store-view-lTcb_cnp.d.cts → store-view-FfE5_7eo.d.ts} +437 -129
- package/dist/{types-5RQwzWXx.d.cts → types-B6mhrcLv.d.cts} +2 -2
- package/dist/{types-Dk8r09KY.d.ts → types-C_UnQOQp.d.cts} +154 -23
- package/dist/{types-DGDiXAYc.d.ts → types-CdWxK-nD.d.ts} +2 -2
- package/dist/{types-Dvmn-eal.d.cts → types-DGylBhWo.d.ts} +154 -23
- package/dist/{where-Cx_glEEB.d.cts → where-Bpp2ul_z.d.cts} +2 -2
- package/dist/{where-CHZFELX0.d.ts → where-BsEXraKW.d.ts} +2 -2
- package/package.json +1 -1
- package/dist/chunk-2LAT5BIK.cjs.map +0 -1
- package/dist/chunk-3HQDMOBK.cjs.map +0 -1
- package/dist/chunk-6G35I3VW.cjs +0 -40
- package/dist/chunk-6G35I3VW.cjs.map +0 -1
- package/dist/chunk-6RMLO5O4.cjs.map +0 -1
- package/dist/chunk-7WW3WL6E.js.map +0 -1
- package/dist/chunk-CAMMC3E4.cjs.map +0 -1
- package/dist/chunk-IJORSAC3.js.map +0 -1
- package/dist/chunk-JKRKIEVA.cjs.map +0 -1
- package/dist/chunk-M6OC455F.js +0 -65
- package/dist/chunk-M6OC455F.js.map +0 -1
- package/dist/chunk-MXE2U3EX.js.map +0 -1
- package/dist/chunk-NDM5PXEH.js.map +0 -1
- package/dist/chunk-RP7YITHX.cjs +0 -70
- package/dist/chunk-RP7YITHX.cjs.map +0 -1
- package/dist/chunk-SAJSMR2B.js +0 -35
- package/dist/chunk-SAJSMR2B.js.map +0 -1
- package/dist/chunk-TUA3MEJJ.js.map +0 -1
- package/dist/chunk-WNORITK6.js.map +0 -1
- package/dist/chunk-XQFAJVYW.js.map +0 -1
- package/dist/chunk-YL4F3CMD.cjs.map +0 -1
- package/dist/chunk-YQGLVWB2.cjs.map +0 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { K as KindRegistry, G as GraphDef, w as EdgeKinds, t as NodeKinds, v as AllNodeTypes, c as SchemaManagerOptions, d as SchemaValidationResult } from './manager-
|
|
2
|
-
import { T as TemporalMode, A as AnyEdgeType, N as NodeType, g as EdgeType, E as EdgeRegistration, e as EdgeId, d as NodeId, b as NodeRegistration, K as KindEntity, m as Cardinality,
|
|
1
|
+
import { K as KindRegistry, G as GraphDef, w as EdgeKinds, t as NodeKinds, v as AllNodeTypes, c as SchemaManagerOptions, d as SchemaValidationResult } from './manager-C0_r0ALf.js';
|
|
2
|
+
import { T as TemporalMode, A as AnyEdgeType, N as NodeType, g as EdgeType, E as EdgeRegistration, e as EdgeId, d as NodeId, b as NodeRegistration, K as KindEntity, m as Cardinality, q as EndpointExistence, f as KindAnnotations, s as UniquenessScope, n as Collation, G as GraphExtension } from './extension-types-YGFJPrzK.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { b as MaterializeIndexesOptions, M as MaterializeIndexesResult } from './materialize-indexes-DEYkU-wr.cjs';
|
|
4
|
+
import { b7 as ValueType, b8 as PredicateExpression, b9 as VectorMetricType, ae as FulltextQueryMode, Q as QueryAst, J as JsonPointer, P as FieldRef, ax as ParameterRef, G as GraphBackend, aP as TransactionBackend, ao as JsonPointerInput, aQ as TraversalExpansion, p as SqlDialect, aL as SqlSchema, ba as Traversal, bb as NodePredicate, bc as ProjectedField, aw as OrderSpec, bd as GroupBySpec, ak as HybridFusionOptions, be as RecursiveCyclePolicy, W as TraversalDirection$1, bf as EdgeRow, bg as NodeRow, aa as ExternalRecordedReadSource, X as AdoptedTransaction, L as AggregateExpr, a3 as CompiledSelectSql, F as FulltextStrategy, V as VectorStrategy, bh as VectorSlotMap, bi as RecordedReadBinding, bj as SelectiveField, bk as ComposableQuery, bl as SetOperationType, bm as SetOperation, aJ as SortDirection, bn as VectorMetric, m as JsonSchema, bo as TransactionOptions } from './types-DGylBhWo.js';
|
|
5
|
+
import { b as MaterializeIndexesOptions, M as MaterializeIndexesResult } from './materialize-indexes-CAkIYFV-.js';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Embedding type for vector search.
|
|
@@ -216,12 +215,43 @@ declare function searchable(options?: SearchableOptions): SearchableSchema;
|
|
|
216
215
|
declare function isSearchableSchema(value: unknown): value is SearchableSchema;
|
|
217
216
|
declare function getSearchableMetadata(schema: z.ZodType): SearchableMetadata | undefined;
|
|
218
217
|
|
|
218
|
+
declare const RECORDED_INSTANT_BRAND: unique symbol;
|
|
219
|
+
/**
|
|
220
|
+
* A canonical UTC ISO-8601 recorded-time instant (`YYYY-MM-DDTHH:mm:ss.sssZ`),
|
|
221
|
+
* nominally branded so it can only originate from a recorded-time source —
|
|
222
|
+
* {@link Store.recordedNow} or an explicit {@link asRecordedInstant} — never an
|
|
223
|
+
* ad-hoc wall-clock string.
|
|
224
|
+
*
|
|
225
|
+
* The recorded commit clock is a logical, monotonic per-graph instant that can
|
|
226
|
+
* run briefly ahead of wall time under bursty same-millisecond writes, so a raw
|
|
227
|
+
* `new Date().toISOString()` may sort *before* the most recent commits and
|
|
228
|
+
* silently omit them. The brand turns that footgun into a compile error:
|
|
229
|
+
* `store.asOfRecorded` accepts only a `RecordedInstant`, so a bare wall-clock
|
|
230
|
+
* string no longer type-checks — callers reach for `await store.recordedNow()`
|
|
231
|
+
* (the monotonic high-water mark) or {@link asRecordedInstant} instead.
|
|
232
|
+
*/
|
|
233
|
+
type RecordedInstant = string & {
|
|
234
|
+
readonly [RECORDED_INSTANT_BRAND]: "RecordedInstant";
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* Brands a canonical UTC ISO-8601 string as a {@link RecordedInstant}.
|
|
238
|
+
*
|
|
239
|
+
* The escape hatch for an instant that round-trips through untyped storage:
|
|
240
|
+
* captured from {@link Store.recordedNow}, persisted as a plain string, read
|
|
241
|
+
* back, and replayed into `asOfRecorded`. Validates the canonical form eagerly —
|
|
242
|
+
* the same check `asOfRecorded` applies — so a malformed value fails here, at the
|
|
243
|
+
* brand site, rather than deeper in a read. Does *not* assert the instant is a
|
|
244
|
+
* real captured commit; it only guarantees the value is well-formed enough to
|
|
245
|
+
* compare correctly against the recorded relations.
|
|
246
|
+
*
|
|
247
|
+
* @throws {ValidationError} when `value` is not a canonical UTC ISO-8601 string.
|
|
248
|
+
*/
|
|
249
|
+
declare function asRecordedInstant(value: string): RecordedInstant;
|
|
219
250
|
/**
|
|
220
251
|
* The single opaque temporal coordinate every pinned read is resolved
|
|
221
|
-
* against.
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* surfaces at once instead of splitting by surface.
|
|
252
|
+
* against. It carries the valid-time axis plus an optional recorded/system-time
|
|
253
|
+
* axis, so every surface can inject one coordinate object instead of threading
|
|
254
|
+
* each temporal dimension separately.
|
|
225
255
|
*/
|
|
226
256
|
type ReadCoordinate = Readonly<{
|
|
227
257
|
/**
|
|
@@ -233,6 +263,10 @@ type ReadCoordinate = Readonly<{
|
|
|
233
263
|
/** Defined only when `mode` is `"asOf"`. */
|
|
234
264
|
asOf?: string;
|
|
235
265
|
}>;
|
|
266
|
+
/** The recorded/system-time axis. Defined only for recorded-pinned views. */
|
|
267
|
+
recorded?: Readonly<{
|
|
268
|
+
asOf: RecordedInstant;
|
|
269
|
+
}>;
|
|
236
270
|
}>;
|
|
237
271
|
|
|
238
272
|
type FieldTypeInfo = Readonly<{
|
|
@@ -517,6 +551,7 @@ type DynamicSelectableEdge = Readonly<{
|
|
|
517
551
|
* and ExecutableQuery classes.
|
|
518
552
|
*/
|
|
519
553
|
|
|
554
|
+
type QueryCoordinateState = "open" | "sealed";
|
|
520
555
|
/**
|
|
521
556
|
* A query that can be executed within a `store.batch()` call.
|
|
522
557
|
*
|
|
@@ -559,6 +594,7 @@ type NodeAlias<K extends NodeType = NodeType, Optional extends boolean = false>
|
|
|
559
594
|
* A map of alias names to their node aliases.
|
|
560
595
|
*/
|
|
561
596
|
type AliasMap = Readonly<Record<string, NodeAlias<NodeType, boolean>>>;
|
|
597
|
+
type EmptyAliasMap = Readonly<Record<never, never>>;
|
|
562
598
|
/**
|
|
563
599
|
* An edge alias with its associated type and optional flag.
|
|
564
600
|
*/
|
|
@@ -571,6 +607,7 @@ type EdgeAlias<E extends AnyEdgeType = EdgeType, Optional extends boolean = fals
|
|
|
571
607
|
* A map of alias names to their edge aliases.
|
|
572
608
|
*/
|
|
573
609
|
type EdgeAliasMap = Readonly<Record<string, EdgeAlias<EdgeType, boolean>>>;
|
|
610
|
+
type EmptyEdgeAliasMap = Readonly<Record<never, never>>;
|
|
574
611
|
/**
|
|
575
612
|
* A recursive alias marker with its associated type (depth or path).
|
|
576
613
|
*/
|
|
@@ -581,6 +618,7 @@ type RecursiveAlias<T extends "depth" | "path"> = Readonly<{
|
|
|
581
618
|
* A map of recursive alias names to their types.
|
|
582
619
|
*/
|
|
583
620
|
type RecursiveAliasMap = Readonly<Record<string, RecursiveAlias<"depth" | "path">>>;
|
|
621
|
+
type EmptyRecursiveAliasMap = Readonly<Record<never, never>>;
|
|
584
622
|
/**
|
|
585
623
|
* Resolves a recursive alias marker to its runtime value type.
|
|
586
624
|
*/
|
|
@@ -860,14 +898,8 @@ type QueryBuilderConfig = Readonly<{
|
|
|
860
898
|
defaultTraversalExpansion: TraversalExpansion;
|
|
861
899
|
backend?: GraphBackend;
|
|
862
900
|
dialect?: SqlDialect;
|
|
863
|
-
/** SQL schema configuration for custom table names. */
|
|
901
|
+
/** SQL schema configuration from createSqlSchema(...) for custom table names. */
|
|
864
902
|
schema?: SqlSchema;
|
|
865
|
-
/**
|
|
866
|
-
* When set, the builder is pinned to a {@link StoreView}'s coordinate and
|
|
867
|
-
* its temporal axis is sealed: `.temporal(...)` throws. Threaded verbatim
|
|
868
|
-
* through every builder clone, so the seal survives the whole fluent chain.
|
|
869
|
-
*/
|
|
870
|
-
sealedCoordinate?: ReadCoordinate;
|
|
871
903
|
}>;
|
|
872
904
|
/**
|
|
873
905
|
* Internal state of the query builder.
|
|
@@ -886,6 +918,7 @@ type QueryBuilderState = Readonly<{
|
|
|
886
918
|
offset: number | undefined;
|
|
887
919
|
temporalMode: TemporalMode;
|
|
888
920
|
asOf: string | undefined;
|
|
921
|
+
recordedAsOf?: RecordedInstant | undefined;
|
|
889
922
|
groupBy: GroupBySpec | undefined;
|
|
890
923
|
having: PredicateExpression | undefined;
|
|
891
924
|
fusion: HybridFusionOptions | undefined;
|
|
@@ -906,18 +939,43 @@ type CreateQueryBuilderOptions = Readonly<{
|
|
|
906
939
|
backend?: GraphBackend;
|
|
907
940
|
/** SQL dialect for compilation */
|
|
908
941
|
dialect?: SqlDialect;
|
|
909
|
-
/** SQL schema configuration for custom table names */
|
|
942
|
+
/** SQL schema configuration from createSqlSchema(...) for custom table names */
|
|
910
943
|
schema?: SqlSchema;
|
|
911
944
|
/** Default traversal ontology expansion mode (default: "inverse"). */
|
|
912
945
|
defaultTraversalExpansion?: TraversalExpansion;
|
|
913
|
-
/**
|
|
914
|
-
* Pin the builder to a {@link StoreView} coordinate and seal its temporal
|
|
915
|
-
* axis. Seeds the initial `temporalMode` / `asOf` and makes `.temporal(...)`
|
|
916
|
-
* throw. Used by `store.view(...).query()`.
|
|
917
|
-
*/
|
|
918
|
-
sealedCoordinate?: ReadCoordinate;
|
|
919
946
|
}>;
|
|
920
947
|
|
|
948
|
+
/**
|
|
949
|
+
* StoreView collection surface buckets.
|
|
950
|
+
*
|
|
951
|
+
* The live NodeCollection / EdgeCollection partition into buckets a StoreView
|
|
952
|
+
* treats differently:
|
|
953
|
+
*
|
|
954
|
+
* - temporal reads honor the pinned coordinate;
|
|
955
|
+
* - current reads have no temporal axis and are refused on temporal pins;
|
|
956
|
+
* - writes are never available on a read-only view; and
|
|
957
|
+
* - batch reads require store.batch() and are absent from a view.
|
|
958
|
+
*
|
|
959
|
+
* These arrays are the single runtime source of truth for the proxy routing and
|
|
960
|
+
* the type-level source for the derived StoreView collection types. The
|
|
961
|
+
* StoreView surface-classification test asserts they exactly partition the live
|
|
962
|
+
* collection methods so new collection methods cannot be silently omitted.
|
|
963
|
+
*/
|
|
964
|
+
/** Temporal-aware node read method names. */
|
|
965
|
+
declare const NODE_TEMPORAL_READ_NAMES: readonly ["getById", "getByIds", "find", "count"];
|
|
966
|
+
/** Current-state-only node reads (constraint / index lookups). */
|
|
967
|
+
declare const CURRENT_ONLY_READ_NAMES: readonly ["findByConstraint", "bulkFindByConstraint", "bulkFindByIndex"];
|
|
968
|
+
/** Node write method names: never available on a read-only StoreView. */
|
|
969
|
+
declare const NODE_WRITE_NAMES: readonly ["create", "createFromRecord", "update", "delete", "hardDelete", "upsertById", "upsertByIdFromRecord", "bulkCreate", "bulkUpsertById", "bulkInsert", "bulkDelete", "getOrCreateByConstraint", "bulkGetOrCreateByConstraint"];
|
|
970
|
+
/** Temporal-aware edge read method names. */
|
|
971
|
+
declare const EDGE_TEMPORAL_READ_NAMES: readonly ["getById", "getByIds", "find", "count", "findFrom", "findTo", "findByEndpoints"];
|
|
972
|
+
/** Deferred edge batch-read method names. */
|
|
973
|
+
declare const EDGE_BATCH_READ_NAMES: readonly ["batchFindFrom", "batchFindTo", "batchFindByEndpoints"];
|
|
974
|
+
/** Edge write method names: never available on a read-only StoreView. */
|
|
975
|
+
declare const EDGE_WRITE_NAMES: readonly ["create", "update", "delete", "hardDelete", "bulkCreate", "bulkUpsertById", "bulkInsert", "bulkDelete", "getOrCreateByEndpoints", "bulkGetOrCreateByEndpoints"];
|
|
976
|
+
/** Recorded-time collection point reads that reconstruct safely by id. */
|
|
977
|
+
declare const RECORDED_POINT_READ_NAMES: readonly ["getById", "getByIds"];
|
|
978
|
+
|
|
921
979
|
/**
|
|
922
980
|
* Store types for TypeGraph operations.
|
|
923
981
|
*/
|
|
@@ -1034,7 +1092,15 @@ type UpdateEdgeInput<E extends AnyEdgeType = EdgeType> = Readonly<{
|
|
|
1034
1092
|
/**
|
|
1035
1093
|
* Options for node and edge queries.
|
|
1036
1094
|
*/
|
|
1037
|
-
type
|
|
1095
|
+
type NoRecordedCoordinate = Readonly<{
|
|
1096
|
+
/**
|
|
1097
|
+
* Recorded/system-time coordinates are internal-only and supplied by
|
|
1098
|
+
* RecordedStoreView. A public options object carrying this key is a type
|
|
1099
|
+
* error even when the object is pre-bound before the call site.
|
|
1100
|
+
*/
|
|
1101
|
+
recordedAsOf?: never;
|
|
1102
|
+
}>;
|
|
1103
|
+
type QueryOptions = NoRecordedCoordinate & Readonly<{
|
|
1038
1104
|
/** Temporal mode for the query */
|
|
1039
1105
|
temporalMode?: TemporalMode;
|
|
1040
1106
|
/** Specific timestamp for asOf queries */
|
|
@@ -1114,13 +1180,10 @@ type StoreHooks = Readonly<{
|
|
|
1114
1180
|
/** Called when an error occurs */
|
|
1115
1181
|
onError?: (ctx: HookContext, error: Error) => void;
|
|
1116
1182
|
}>;
|
|
1117
|
-
|
|
1118
|
-
* Options for creating a store.
|
|
1119
|
-
*/
|
|
1120
|
-
type StoreOptions = Readonly<{
|
|
1183
|
+
type BaseStoreOptions = Readonly<{
|
|
1121
1184
|
/** Observability hooks for monitoring */
|
|
1122
1185
|
hooks?: StoreHooks;
|
|
1123
|
-
/** SQL schema configuration for custom table names */
|
|
1186
|
+
/** SQL schema configuration from createSqlSchema(...) for custom table names */
|
|
1124
1187
|
schema?: SqlSchema;
|
|
1125
1188
|
/** Query default behaviors. */
|
|
1126
1189
|
queryDefaults?: Readonly<{
|
|
@@ -1128,6 +1191,28 @@ type StoreOptions = Readonly<{
|
|
|
1128
1191
|
traversalExpansion?: TraversalExpansion;
|
|
1129
1192
|
}>;
|
|
1130
1193
|
}>;
|
|
1194
|
+
/**
|
|
1195
|
+
* Store options without built-in recorded-time capture. A recorded read relation
|
|
1196
|
+
* can still be bound explicitly for hosts that populate history externally.
|
|
1197
|
+
*/
|
|
1198
|
+
type LiveStoreOptions = BaseStoreOptions & Readonly<{
|
|
1199
|
+
history?: false | undefined;
|
|
1200
|
+
recordedRead?: ExternalRecordedReadSource | undefined;
|
|
1201
|
+
}>;
|
|
1202
|
+
/**
|
|
1203
|
+
* Store options with TypeGraph-managed recorded-time capture. `history: true`
|
|
1204
|
+
* captures TypeGraph writes and binds TypeGraph's built-in recorded relation
|
|
1205
|
+
* internally. Externally populated recorded read sources are read-only bindings
|
|
1206
|
+
* and are intentionally accepted only by {@link LiveStoreOptions}.
|
|
1207
|
+
*/
|
|
1208
|
+
type HistoryStoreOptions = BaseStoreOptions & Readonly<{
|
|
1209
|
+
history: true;
|
|
1210
|
+
recordedRead?: never;
|
|
1211
|
+
}>;
|
|
1212
|
+
/**
|
|
1213
|
+
* Options for creating a store.
|
|
1214
|
+
*/
|
|
1215
|
+
type StoreOptions = LiveStoreOptions | HistoryStoreOptions;
|
|
1131
1216
|
/**
|
|
1132
1217
|
* A mutable handle to the current `Store`, used by `store.evolve(...)`
|
|
1133
1218
|
* so long-lived consumers can dereference through the ref and pick up
|
|
@@ -1665,15 +1750,7 @@ type GraphEdgeCollections<G extends GraphDef> = {
|
|
|
1665
1750
|
[K in keyof G["edges"] & string]-?: TypedEdgeCollection<G["edges"][K]>;
|
|
1666
1751
|
};
|
|
1667
1752
|
/** Temporal-aware node reads — a {@link StoreView} pins these. */
|
|
1668
|
-
type NodeTemporalReads<N extends NodeType, CN extends string = string> = Pick<NodeCollection<N, CN>,
|
|
1669
|
-
/**
|
|
1670
|
-
* The method names of the current-state-only node reads (constraint / index
|
|
1671
|
-
* lookups). Single source of truth: {@link NodeCurrentReads} (the type) and the
|
|
1672
|
-
* `StoreView`'s runtime routing Set are both derived from this array, so adding
|
|
1673
|
-
* a current-only read here updates both at once — a new read cannot pass the
|
|
1674
|
-
* type partition yet be misrouted at runtime (refused as a write).
|
|
1675
|
-
*/
|
|
1676
|
-
declare const CURRENT_ONLY_READ_NAMES: readonly ["findByConstraint", "bulkFindByConstraint", "bulkFindByIndex"];
|
|
1753
|
+
type NodeTemporalReads<N extends NodeType, CN extends string = string> = Pick<NodeCollection<N, CN>, (typeof NODE_TEMPORAL_READ_NAMES)[number]>;
|
|
1677
1754
|
/**
|
|
1678
1755
|
* Current-state-only node reads (constraint / index lookups). No temporal
|
|
1679
1756
|
* axis, so a {@link StoreView} delegates them on a `current` pin and refuses
|
|
@@ -1681,21 +1758,16 @@ declare const CURRENT_ONLY_READ_NAMES: readonly ["findByConstraint", "bulkFindBy
|
|
|
1681
1758
|
*/
|
|
1682
1759
|
type NodeCurrentReads<N extends NodeType, CN extends string = string> = Pick<NodeCollection<N, CN>, (typeof CURRENT_ONLY_READ_NAMES)[number]>;
|
|
1683
1760
|
/** Node writes — never available on a read-only {@link StoreView}. */
|
|
1684
|
-
type NodeWrites<N extends NodeType, CN extends string = string> = Pick<NodeCollection<N, CN>,
|
|
1685
|
-
/**
|
|
1686
|
-
|
|
1687
|
-
* collection, edges have no current-state-only reads: `findByEndpoints` honors
|
|
1688
|
-
* the temporal coordinate like `findFrom` / `findTo`, so every edge read is
|
|
1689
|
-
* pinnable.
|
|
1690
|
-
*/
|
|
1691
|
-
type EdgeTemporalReads<E extends AnyEdgeType, From extends NodeType = NodeType, To extends NodeType = NodeType> = Pick<EdgeCollection<E, From, To>, "getById" | "getByIds" | "find" | "count" | "findFrom" | "findTo" | "findByEndpoints">;
|
|
1761
|
+
type NodeWrites<N extends NodeType, CN extends string = string> = Pick<NodeCollection<N, CN>, (typeof NODE_WRITE_NAMES)[number]>;
|
|
1762
|
+
/** Temporal-aware edge reads — a {@link StoreView} pins these. */
|
|
1763
|
+
type EdgeTemporalReads<E extends AnyEdgeType, From extends NodeType = NodeType, To extends NodeType = NodeType> = Pick<EdgeCollection<E, From, To>, (typeof EDGE_TEMPORAL_READ_NAMES)[number]>;
|
|
1692
1764
|
/**
|
|
1693
1765
|
* Deferred edge reads for `store.batch()` — absent from a {@link StoreView},
|
|
1694
1766
|
* which has no batch context.
|
|
1695
1767
|
*/
|
|
1696
|
-
type EdgeBatchReads<E extends AnyEdgeType, From extends NodeType = NodeType, To extends NodeType = NodeType> = Pick<EdgeCollection<E, From, To>,
|
|
1768
|
+
type EdgeBatchReads<E extends AnyEdgeType, From extends NodeType = NodeType, To extends NodeType = NodeType> = Pick<EdgeCollection<E, From, To>, (typeof EDGE_BATCH_READ_NAMES)[number]>;
|
|
1697
1769
|
/** Edge writes — never available on a read-only {@link StoreView}. */
|
|
1698
|
-
type EdgeWrites<E extends AnyEdgeType, From extends NodeType = NodeType, To extends NodeType = NodeType> = Pick<EdgeCollection<E, From, To>,
|
|
1770
|
+
type EdgeWrites<E extends AnyEdgeType, From extends NodeType = NodeType, To extends NodeType = NodeType> = Pick<EdgeCollection<E, From, To>, (typeof EDGE_WRITE_NAMES)[number]>;
|
|
1699
1771
|
/**
|
|
1700
1772
|
* The read-only node surface a {@link StoreView} exposes for one node kind.
|
|
1701
1773
|
* The temporal reads drop the per-call temporal argument — the pin owns the
|
|
@@ -1762,6 +1834,20 @@ type StoreViewNodeCollections<G extends GraphDef> = {
|
|
|
1762
1834
|
type StoreViewEdgeCollections<G extends GraphDef> = {
|
|
1763
1835
|
[K in keyof G["edges"] & string]-?: TypedStoreViewEdgeCollection<G["edges"][K]>;
|
|
1764
1836
|
};
|
|
1837
|
+
/** Recorded-time node point reads for one node kind. */
|
|
1838
|
+
type RecordedStoreViewNodeCollection<N extends NodeType> = Pick<StoreViewNodeCollection<N>, (typeof RECORDED_POINT_READ_NAMES)[number]>;
|
|
1839
|
+
/** Recorded-time edge point reads for one edge kind. */
|
|
1840
|
+
type RecordedStoreViewEdgeCollection<E extends AnyEdgeType, From extends NodeType = NodeType, To extends NodeType = NodeType> = Pick<StoreViewEdgeCollection<E, From, To>, (typeof RECORDED_POINT_READ_NAMES)[number]>;
|
|
1841
|
+
/** Recorded-time edge collection derived from an `EdgeRegistration`. */
|
|
1842
|
+
type TypedRecordedStoreViewEdgeCollection<R extends EdgeRegistration> = RecordedStoreViewEdgeCollection<R["type"], EdgeFromTypes<R> extends NodeType ? EdgeFromTypes<R> : NodeType, EdgeToTypes<R> extends NodeType ? EdgeToTypes<R> : NodeType>;
|
|
1843
|
+
/** Mapped type of all recorded-time node point-read collections. */
|
|
1844
|
+
type RecordedStoreViewNodeCollections<G extends GraphDef> = {
|
|
1845
|
+
[K in keyof G["nodes"] & string]-?: RecordedStoreViewNodeCollection<G["nodes"][K]["type"]>;
|
|
1846
|
+
};
|
|
1847
|
+
/** Mapped type of all recorded-time edge point-read collections. */
|
|
1848
|
+
type RecordedStoreViewEdgeCollections<G extends GraphDef> = {
|
|
1849
|
+
[K in keyof G["edges"] & string]-?: TypedRecordedStoreViewEdgeCollection<G["edges"][K]>;
|
|
1850
|
+
};
|
|
1765
1851
|
/**
|
|
1766
1852
|
* A typed transaction context with collection API.
|
|
1767
1853
|
*
|
|
@@ -1803,6 +1889,12 @@ type StoreViewEdgeCollections<G extends GraphDef> = {
|
|
|
1803
1889
|
* Its type is the `AdoptedTransaction` union; cast to your concrete
|
|
1804
1890
|
* Drizzle database type at the call site.
|
|
1805
1891
|
*
|
|
1892
|
+
* When the store was created with `{ history: true }`, `tx.sql` is present but
|
|
1893
|
+
* replaced by a fail-loud guard because raw SQL would bypass recorded-time
|
|
1894
|
+
* capture. Use the typed `tx.nodes` / `tx.edges` collections inside
|
|
1895
|
+
* `transaction()`, or use `store.withRecordedTransaction(externalTx, fn)` when
|
|
1896
|
+
* the relational layer owns the transaction boundary.
|
|
1897
|
+
*
|
|
1806
1898
|
* @example
|
|
1807
1899
|
* ```typescript
|
|
1808
1900
|
* await store.transaction(async (tx) => {
|
|
@@ -1949,7 +2041,7 @@ declare class ExecutableAggregateQuery<G extends GraphDef, Aliases extends Alias
|
|
|
1949
2041
|
/**
|
|
1950
2042
|
* Compiles the query to a Drizzle SQL object.
|
|
1951
2043
|
*/
|
|
1952
|
-
compile():
|
|
2044
|
+
compile(): CompiledSelectSql;
|
|
1953
2045
|
/**
|
|
1954
2046
|
* Executes the query and returns typed results.
|
|
1955
2047
|
*
|
|
@@ -1971,7 +2063,7 @@ declare class ExecutableAggregateQuery<G extends GraphDef, Aliases extends Alias
|
|
|
1971
2063
|
type CompileQueryOptions = Readonly<{
|
|
1972
2064
|
/** SQL dialect ("sqlite" or "postgres"). Defaults to "sqlite". */
|
|
1973
2065
|
dialect?: SqlDialect | undefined;
|
|
1974
|
-
/** SQL schema configuration
|
|
2066
|
+
/** SQL schema configuration from createSqlSchema(...). Defaults to standard names. */
|
|
1975
2067
|
schema?: SqlSchema | undefined;
|
|
1976
2068
|
/**
|
|
1977
2069
|
* Fulltext strategy override. When set, overrides the dialect's
|
|
@@ -2000,6 +2092,13 @@ type CompileQueryOptions = Readonly<{
|
|
|
2000
2092
|
* declare the field. Callers build it from the graph's node schemas.
|
|
2001
2093
|
*/
|
|
2002
2094
|
vectorSlots?: VectorSlotMap | undefined;
|
|
2095
|
+
/**
|
|
2096
|
+
* Recorded read relation to use when the AST carries `recordedAsOf`.
|
|
2097
|
+
* Supplying a recorded timestamp without this binding is rejected so the
|
|
2098
|
+
* compiler never silently swaps to TypeGraph's built-in history tables when
|
|
2099
|
+
* the store was only configured for live/valid-time reads.
|
|
2100
|
+
*/
|
|
2101
|
+
recordedReadBinding?: RecordedReadBinding | undefined;
|
|
2003
2102
|
}>;
|
|
2004
2103
|
|
|
2005
2104
|
type PreparedQueryConfig<R> = Readonly<{
|
|
@@ -2116,7 +2215,7 @@ declare class UnionableQuery<G extends GraphDef, R> {
|
|
|
2116
2215
|
/**
|
|
2117
2216
|
* Compiles the set operation to SQL.
|
|
2118
2217
|
*/
|
|
2119
|
-
compile():
|
|
2218
|
+
compile(): CompiledSelectSql;
|
|
2120
2219
|
/**
|
|
2121
2220
|
* Executes the combined query.
|
|
2122
2221
|
*/
|
|
@@ -2208,7 +2307,7 @@ declare class ExecutableQuery<G extends GraphDef, Aliases extends AliasMap, Edge
|
|
|
2208
2307
|
* Returns a Drizzle SQL object that can be executed directly
|
|
2209
2308
|
* with db.all(), db.get(), etc.
|
|
2210
2309
|
*/
|
|
2211
|
-
compile():
|
|
2310
|
+
compile(): CompiledSelectSql;
|
|
2212
2311
|
/**
|
|
2213
2312
|
* Creates a prepared (pre-compiled) query that can be executed
|
|
2214
2313
|
* multiple times with different parameter bindings.
|
|
@@ -2307,7 +2406,7 @@ interface VariableLengthState {
|
|
|
2307
2406
|
* Type parameters track the edge kind and direction to constrain
|
|
2308
2407
|
* which node kinds are valid targets in the `to()` method.
|
|
2309
2408
|
*/
|
|
2310
|
-
declare class TraversalBuilder<G extends GraphDef, Aliases extends AliasMap, EdgeAliases extends EdgeAliasMap =
|
|
2409
|
+
declare class TraversalBuilder<G extends GraphDef, Aliases extends AliasMap, EdgeAliases extends EdgeAliasMap = EmptyEdgeAliasMap, EK extends keyof G["edges"] & string = keyof G["edges"] & string, EA extends string = string, Dir extends TraversalDirection$1 = "out", Optional extends boolean = false, DC extends boolean | string = false, PC extends boolean | string = false, RecAliases extends RecursiveAliasMap = EmptyRecursiveAliasMap, CoordinateState extends QueryCoordinateState = "open"> {
|
|
2311
2410
|
#private;
|
|
2312
2411
|
constructor(config: QueryBuilderConfig, state: QueryBuilderState, edgeKinds: readonly string[], edgeAlias: EA, direction: Dir, fromAlias: string, inverseEdgeKinds?: readonly string[], optional?: Optional, variableLength?: VariableLengthState, pendingEdgePredicates?: readonly NodePredicate[]);
|
|
2313
2412
|
/**
|
|
@@ -2319,14 +2418,14 @@ declare class TraversalBuilder<G extends GraphDef, Aliases extends AliasMap, Edg
|
|
|
2319
2418
|
depth: infer D extends boolean | string;
|
|
2320
2419
|
} ? D : DC, O extends {
|
|
2321
2420
|
path: infer P extends boolean | string;
|
|
2322
|
-
} ? P : PC, RecAliases>;
|
|
2421
|
+
} ? P : PC, RecAliases, CoordinateState>;
|
|
2323
2422
|
/**
|
|
2324
2423
|
* Adds a WHERE clause for the edge being traversed.
|
|
2325
2424
|
*
|
|
2326
2425
|
* @param alias - The edge alias to filter on (must be the current edge alias)
|
|
2327
2426
|
* @param predicateFunction - A function that builds predicates using the edge accessor
|
|
2328
2427
|
*/
|
|
2329
|
-
whereEdge(alias: EA, predicateFunction: (edge: EdgeAccessor<EdgeTypeForKey<G, EK>>) => Predicate): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, Dir, Optional, DC, PC, RecAliases>;
|
|
2428
|
+
whereEdge(alias: EA, predicateFunction: (edge: EdgeAccessor<EdgeTypeForKey<G, EK>>) => Predicate): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, Dir, Optional, DC, PC, RecAliases, CoordinateState>;
|
|
2330
2429
|
/**
|
|
2331
2430
|
* Specifies the target node kind.
|
|
2332
2431
|
*
|
|
@@ -2339,23 +2438,24 @@ declare class TraversalBuilder<G extends GraphDef, Aliases extends AliasMap, Edg
|
|
|
2339
2438
|
*/
|
|
2340
2439
|
to<K extends ValidEdgeTargets<G, EK, Dir>, A extends string>(kind: K, alias: UniqueAlias<A, Aliases>, options?: {
|
|
2341
2440
|
includeSubClasses?: false;
|
|
2342
|
-
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<G["nodes"][K]["type"], Optional>>, EdgeAliases & Record<EA, EdgeAlias<G["edges"][EK]["type"], Optional>>, RecAliases & BuildRecursiveAliases<DC, PC, A
|
|
2441
|
+
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<G["nodes"][K]["type"], Optional>>, EdgeAliases & Record<EA, EdgeAlias<G["edges"][EK]["type"], Optional>>, RecAliases & BuildRecursiveAliases<DC, PC, A>, CoordinateState>;
|
|
2343
2442
|
to<K extends ValidEdgeTargets<G, EK, Dir>, A extends string>(kind: K, alias: UniqueAlias<A, Aliases>, options: {
|
|
2344
2443
|
includeSubClasses: true;
|
|
2345
|
-
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<NodeType, Optional>>, EdgeAliases & Record<EA, EdgeAlias<G["edges"][EK]["type"], Optional>>, RecAliases & BuildRecursiveAliases<DC, PC, A
|
|
2444
|
+
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<NodeType, Optional>>, EdgeAliases & Record<EA, EdgeAlias<G["edges"][EK]["type"], Optional>>, RecAliases & BuildRecursiveAliases<DC, PC, A>, CoordinateState>;
|
|
2346
2445
|
/**
|
|
2347
2446
|
* String-keyed sibling of `to` for runtime-declared target kinds.
|
|
2348
2447
|
* Throws `KindNotFoundError` if the kind is not registered.
|
|
2349
2448
|
*/
|
|
2350
2449
|
toDynamic<A extends string>(kind: string, alias: UniqueAlias<A, Aliases>, options?: {
|
|
2351
2450
|
includeSubClasses?: boolean;
|
|
2352
|
-
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<DynamicNodeType, Optional>>, EdgeAliases & Record<EA, EdgeAlias<EdgeTypeForKey<G, EK>, Optional>>, RecAliases & BuildRecursiveAliases<DC, PC, A
|
|
2451
|
+
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<DynamicNodeType, Optional>>, EdgeAliases & Record<EA, EdgeAlias<EdgeTypeForKey<G, EK>, Optional>>, RecAliases & BuildRecursiveAliases<DC, PC, A>, CoordinateState>;
|
|
2353
2452
|
}
|
|
2354
2453
|
|
|
2355
2454
|
/**
|
|
2356
2455
|
* QueryBuilder - The fluent query builder.
|
|
2357
2456
|
*/
|
|
2358
2457
|
|
|
2458
|
+
type TemporalMethod<G extends GraphDef, Aliases extends AliasMap, EdgeAliases extends EdgeAliasMap, RecursiveAliases extends RecursiveAliasMap, CoordinateState extends QueryCoordinateState> = CoordinateState extends "open" ? (mode: TemporalMode, asOf?: string) => QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, "open"> : never;
|
|
2359
2459
|
/**
|
|
2360
2460
|
* The fluent query builder.
|
|
2361
2461
|
*
|
|
@@ -2364,8 +2464,9 @@ declare class TraversalBuilder<G extends GraphDef, Aliases extends AliasMap, Edg
|
|
|
2364
2464
|
* - Aliases: Map of alias names to their node kinds
|
|
2365
2465
|
* - EdgeAliases: Map of alias names to their edge kinds (accumulated during traversals)
|
|
2366
2466
|
*/
|
|
2367
|
-
declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap =
|
|
2467
|
+
declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = EmptyAliasMap, EdgeAliases extends EdgeAliasMap = EmptyEdgeAliasMap, RecursiveAliases extends RecursiveAliasMap = EmptyRecursiveAliasMap, CoordinateState extends QueryCoordinateState = "open"> {
|
|
2368
2468
|
#private;
|
|
2469
|
+
readonly temporal: TemporalMethod<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2369
2470
|
constructor(config: QueryBuilderConfig, state: QueryBuilderState);
|
|
2370
2471
|
/**
|
|
2371
2472
|
* Starts a query from a node kind.
|
|
@@ -2375,10 +2476,10 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2375
2476
|
*/
|
|
2376
2477
|
from<K extends keyof G["nodes"] & string, A extends string>(kind: K, alias: UniqueAlias<A, Aliases>, options?: {
|
|
2377
2478
|
includeSubClasses?: false;
|
|
2378
|
-
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<G["nodes"][K]["type"]>>, EdgeAliases, RecursiveAliases>;
|
|
2479
|
+
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<G["nodes"][K]["type"]>>, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2379
2480
|
from<K extends keyof G["nodes"] & string, A extends string>(kind: K, alias: UniqueAlias<A, Aliases>, options: {
|
|
2380
2481
|
includeSubClasses: true;
|
|
2381
|
-
}): QueryBuilder<G, Aliases & Record<A, NodeAlias>, EdgeAliases, RecursiveAliases>;
|
|
2482
|
+
}): QueryBuilder<G, Aliases & Record<A, NodeAlias>, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2382
2483
|
/**
|
|
2383
2484
|
* String-keyed sibling of `from` for runtime-declared kinds. Throws
|
|
2384
2485
|
* `KindNotFoundError` if the kind is not registered. Predicates use
|
|
@@ -2386,18 +2487,18 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2386
2487
|
*/
|
|
2387
2488
|
fromDynamic<A extends string>(kind: string, alias: UniqueAlias<A, Aliases>, options?: {
|
|
2388
2489
|
includeSubClasses?: boolean;
|
|
2389
|
-
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<DynamicNodeType>>, EdgeAliases, RecursiveAliases>;
|
|
2490
|
+
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<DynamicNodeType>>, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2390
2491
|
/**
|
|
2391
2492
|
* Adds a WHERE clause for a node.
|
|
2392
2493
|
*/
|
|
2393
|
-
whereNode<A extends keyof Aliases & string>(alias: A, predicateFunction: (n: NodeAccessor<Aliases[A]["type"]>) => Predicate): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2494
|
+
whereNode<A extends keyof Aliases & string>(alias: A, predicateFunction: (n: NodeAccessor<Aliases[A]["type"]>) => Predicate): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2394
2495
|
/**
|
|
2395
2496
|
* Adds a WHERE clause for an edge.
|
|
2396
2497
|
*
|
|
2397
2498
|
* @param alias - The edge alias to filter on
|
|
2398
2499
|
* @param predicateFunction - A function that builds predicates using the edge accessor
|
|
2399
2500
|
*/
|
|
2400
|
-
whereEdge<EA extends keyof EdgeAliases & string>(alias: EA, predicateFunction: (edge: EdgeAccessor<EdgeAliases[EA]["type"]>) => Predicate): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2501
|
+
whereEdge<EA extends keyof EdgeAliases & string>(alias: EA, predicateFunction: (edge: EdgeAccessor<EdgeAliases[EA]["type"]>) => Predicate): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2401
2502
|
/**
|
|
2402
2503
|
* Traverses an edge to another node (outgoing direction).
|
|
2403
2504
|
*
|
|
@@ -2411,7 +2512,7 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2411
2512
|
direction?: "out";
|
|
2412
2513
|
expand?: TraversalExpansion;
|
|
2413
2514
|
from?: keyof Aliases & string;
|
|
2414
|
-
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "out", false, false, false, RecursiveAliases>;
|
|
2515
|
+
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "out", false, false, false, RecursiveAliases, CoordinateState>;
|
|
2415
2516
|
/**
|
|
2416
2517
|
* Traverses an edge to another node (incoming direction).
|
|
2417
2518
|
*
|
|
@@ -2426,7 +2527,7 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2426
2527
|
direction: "in";
|
|
2427
2528
|
expand?: TraversalExpansion;
|
|
2428
2529
|
from?: keyof Aliases & string;
|
|
2429
|
-
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "in", false, false, false, RecursiveAliases>;
|
|
2530
|
+
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "in", false, false, false, RecursiveAliases, CoordinateState>;
|
|
2430
2531
|
/**
|
|
2431
2532
|
* String-keyed sibling of `traverse` for runtime-declared edge kinds.
|
|
2432
2533
|
* Throws `KindNotFoundError` if the edge kind is not registered.
|
|
@@ -2435,7 +2536,7 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2435
2536
|
direction?: TraversalDirection$1;
|
|
2436
2537
|
expand?: TraversalExpansion;
|
|
2437
2538
|
from?: keyof Aliases & string;
|
|
2438
|
-
}): TraversalBuilder<G, Aliases, EdgeAliases & Record<EA, EdgeAlias<DynamicEdgeType>>, string, EA, TraversalDirection$1, false, false, false, RecursiveAliases>;
|
|
2539
|
+
}): TraversalBuilder<G, Aliases, EdgeAliases & Record<EA, EdgeAlias<DynamicEdgeType>>, string, EA, TraversalDirection$1, false, false, false, RecursiveAliases, CoordinateState>;
|
|
2439
2540
|
/**
|
|
2440
2541
|
* Optionally traverses an edge to another node (LEFT JOIN semantics).
|
|
2441
2542
|
* If no matching edge/node exists, the result will include null values.
|
|
@@ -2451,12 +2552,12 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2451
2552
|
direction?: "out";
|
|
2452
2553
|
expand?: TraversalExpansion;
|
|
2453
2554
|
from?: keyof Aliases & string;
|
|
2454
|
-
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "out", true, false, false, RecursiveAliases>;
|
|
2555
|
+
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "out", true, false, false, RecursiveAliases, CoordinateState>;
|
|
2455
2556
|
optionalTraverse<EK extends keyof G["edges"] & string, EA extends string>(edgeKind: EK, edgeAlias: EA, options: {
|
|
2456
2557
|
direction: "in";
|
|
2457
2558
|
expand?: TraversalExpansion;
|
|
2458
2559
|
from?: keyof Aliases & string;
|
|
2459
|
-
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "in", true, false, false, RecursiveAliases>;
|
|
2560
|
+
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "in", true, false, false, RecursiveAliases, CoordinateState>;
|
|
2460
2561
|
/**
|
|
2461
2562
|
* String-keyed sibling of `optionalTraverse` for runtime-declared edge
|
|
2462
2563
|
* kinds. LEFT JOIN semantics — non-matching rows produce a null edge
|
|
@@ -2467,7 +2568,7 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2467
2568
|
direction?: TraversalDirection$1;
|
|
2468
2569
|
expand?: TraversalExpansion;
|
|
2469
2570
|
from?: keyof Aliases & string;
|
|
2470
|
-
}): TraversalBuilder<G, Aliases, EdgeAliases & Record<EA, EdgeAlias<DynamicEdgeType, true>>, string, EA, TraversalDirection$1, true, false, false, RecursiveAliases>;
|
|
2571
|
+
}): TraversalBuilder<G, Aliases, EdgeAliases & Record<EA, EdgeAlias<DynamicEdgeType, true>>, string, EA, TraversalDirection$1, true, false, false, RecursiveAliases, CoordinateState>;
|
|
2471
2572
|
/**
|
|
2472
2573
|
* Selects fields to return.
|
|
2473
2574
|
*/
|
|
@@ -2482,27 +2583,15 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2482
2583
|
/**
|
|
2483
2584
|
* Orders results.
|
|
2484
2585
|
*/
|
|
2485
|
-
orderBy<A extends (keyof Aliases | keyof EdgeAliases) & string>(alias: A, field: string, direction?: SortDirection): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2586
|
+
orderBy<A extends (keyof Aliases | keyof EdgeAliases) & string>(alias: A, field: string, direction?: SortDirection): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2486
2587
|
/**
|
|
2487
2588
|
* Limits the number of results.
|
|
2488
2589
|
*/
|
|
2489
|
-
limit(n: number): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2590
|
+
limit(n: number): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2490
2591
|
/**
|
|
2491
2592
|
* Offsets the results.
|
|
2492
2593
|
*/
|
|
2493
|
-
offset(n: number): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2494
|
-
/**
|
|
2495
|
-
* Sets temporal mode.
|
|
2496
|
-
*
|
|
2497
|
-
* @param mode - The temporal mode to use
|
|
2498
|
-
* @param asOf - Required timestamp for "asOf" mode (ISO 8601 string).
|
|
2499
|
-
* Rejected for every other mode — pinning an instant is only meaningful
|
|
2500
|
-
* in "asOf" mode, so `temporal("current", t)` is a caller error, not a
|
|
2501
|
-
* silently-dropped argument.
|
|
2502
|
-
* @throws ValidationError if mode is "asOf" but no timestamp is provided, or
|
|
2503
|
-
* if an asOf is supplied with a non-"asOf" mode.
|
|
2504
|
-
*/
|
|
2505
|
-
temporal(mode: TemporalMode, asOf?: string): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2594
|
+
offset(n: number): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2506
2595
|
/**
|
|
2507
2596
|
* Groups results by the specified field.
|
|
2508
2597
|
* Use with aggregate functions like COUNT, SUM, AVG in select().
|
|
@@ -2510,21 +2599,21 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2510
2599
|
* @param alias - The node alias to group by
|
|
2511
2600
|
* @param field - The field name to group by
|
|
2512
2601
|
*/
|
|
2513
|
-
groupBy<A extends keyof Aliases & string>(alias: A, field: string): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2602
|
+
groupBy<A extends keyof Aliases & string>(alias: A, field: string): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2514
2603
|
/**
|
|
2515
2604
|
* Groups results by the node ID.
|
|
2516
2605
|
* Use when you want to group by a complete node rather than a specific field.
|
|
2517
2606
|
*
|
|
2518
2607
|
* @param alias - The node alias to group by (uses the node's ID)
|
|
2519
2608
|
*/
|
|
2520
|
-
groupByNode<A extends keyof Aliases & string>(alias: A): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2609
|
+
groupByNode<A extends keyof Aliases & string>(alias: A): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2521
2610
|
/**
|
|
2522
2611
|
* Filters grouped results using aggregate conditions (HAVING clause).
|
|
2523
2612
|
* Use after groupBy() to filter based on aggregate values.
|
|
2524
2613
|
*
|
|
2525
2614
|
* @param predicate - A predicate expression to filter groups
|
|
2526
2615
|
*/
|
|
2527
|
-
having(predicate: PredicateExpression): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2616
|
+
having(predicate: PredicateExpression): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2528
2617
|
/**
|
|
2529
2618
|
* Sets fusion parameters for hybrid (vector + fulltext) queries.
|
|
2530
2619
|
*
|
|
@@ -2548,7 +2637,7 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2548
2637
|
* .execute();
|
|
2549
2638
|
* ```
|
|
2550
2639
|
*/
|
|
2551
|
-
fuseWith(options: HybridFusionOptions): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2640
|
+
fuseWith(options: HybridFusionOptions): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2552
2641
|
/**
|
|
2553
2642
|
* Applies a query fragment to transform this builder.
|
|
2554
2643
|
*
|
|
@@ -2574,9 +2663,22 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2574
2663
|
* @param fragment - A function that transforms the builder
|
|
2575
2664
|
* @returns The transformed builder
|
|
2576
2665
|
*/
|
|
2577
|
-
pipe<OutAliases extends AliasMap, OutEdgeAliases extends EdgeAliasMap = EdgeAliases, OutRecAliases extends RecursiveAliasMap = RecursiveAliases>(fragment: (builder: QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>) => QueryBuilder<G, OutAliases, OutEdgeAliases, OutRecAliases>): QueryBuilder<G, OutAliases, OutEdgeAliases, OutRecAliases>;
|
|
2666
|
+
pipe<OutAliases extends AliasMap, OutEdgeAliases extends EdgeAliasMap = EdgeAliases, OutRecAliases extends RecursiveAliasMap = RecursiveAliases>(fragment: (builder: QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>) => QueryBuilder<G, OutAliases, OutEdgeAliases, OutRecAliases, CoordinateState>): QueryBuilder<G, OutAliases, OutEdgeAliases, OutRecAliases, CoordinateState>;
|
|
2578
2667
|
}
|
|
2579
2668
|
|
|
2669
|
+
/**
|
|
2670
|
+
* Fluent query builder for TypeGraph.
|
|
2671
|
+
*
|
|
2672
|
+
* Provides a type-safe, chainable API for building queries.
|
|
2673
|
+
* Each method returns a new builder instance with expanded type information.
|
|
2674
|
+
*
|
|
2675
|
+
* This module re-exports from the builder submodules and provides the
|
|
2676
|
+
* createQueryBuilder factory function.
|
|
2677
|
+
*/
|
|
2678
|
+
|
|
2679
|
+
type InitialQueryBuilder<G extends GraphDef, CoordinateState extends QueryCoordinateState = "open"> = QueryBuilder<G, EmptyAliasMap, EmptyEdgeAliasMap, EmptyRecursiveAliasMap, CoordinateState>;
|
|
2680
|
+
declare function createQueryBuilder<G extends GraphDef>(graphId: string, registry: KindRegistry, options?: CreateQueryBuilderOptions): InitialQueryBuilder<G>;
|
|
2681
|
+
|
|
2580
2682
|
/**
|
|
2581
2683
|
* Shared types for Tier 1 graph algorithms.
|
|
2582
2684
|
*
|
|
@@ -2612,7 +2714,7 @@ type AlgorithmCyclePolicy = RecursiveCyclePolicy;
|
|
|
2612
2714
|
* mode. If neither option is supplied, the algorithm falls back to
|
|
2613
2715
|
* `graph.defaults.temporalMode`.
|
|
2614
2716
|
*/
|
|
2615
|
-
type TemporalAlgorithmOptions = Readonly<{
|
|
2717
|
+
type TemporalAlgorithmOptions = NoRecordedCoordinate & Readonly<{
|
|
2616
2718
|
/** Temporal mode. Defaults to the graph's configured default. */
|
|
2617
2719
|
temporalMode?: TemporalMode;
|
|
2618
2720
|
/**
|
|
@@ -2621,6 +2723,9 @@ type TemporalAlgorithmOptions = Readonly<{
|
|
|
2621
2723
|
*/
|
|
2622
2724
|
asOf?: string;
|
|
2623
2725
|
}>;
|
|
2726
|
+
type InternalTemporalAlgorithmOptions = Omit<TemporalAlgorithmOptions, "recordedAsOf"> & Readonly<{
|
|
2727
|
+
recordedAsOf?: RecordedInstant;
|
|
2728
|
+
}>;
|
|
2624
2729
|
/**
|
|
2625
2730
|
* Base options for traversal-style algorithms.
|
|
2626
2731
|
*/
|
|
@@ -2637,6 +2742,7 @@ type BaseTraversalOptions<G extends GraphDef> = TemporalAlgorithmOptions & Reado
|
|
|
2637
2742
|
/** Cycle policy (default: `"prevent"`). */
|
|
2638
2743
|
cyclePolicy?: AlgorithmCyclePolicy;
|
|
2639
2744
|
}>;
|
|
2745
|
+
type InternalBaseTraversalOptions<G extends GraphDef> = InternalTemporalAlgorithmOptions & Omit<BaseTraversalOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
2640
2746
|
/**
|
|
2641
2747
|
* A node reached during traversal, annotated with the shortest depth at which
|
|
2642
2748
|
* it was first discovered.
|
|
@@ -2669,6 +2775,7 @@ type ShortestPathResult = Readonly<{
|
|
|
2669
2775
|
* care about the first time a target is reached.
|
|
2670
2776
|
*/
|
|
2671
2777
|
type ShortestPathOptions<G extends GraphDef> = BaseTraversalOptions<G>;
|
|
2778
|
+
type InternalShortestPathOptions<G extends GraphDef> = InternalBaseTraversalOptions<G>;
|
|
2672
2779
|
/**
|
|
2673
2780
|
* Options for `reachable`.
|
|
2674
2781
|
*
|
|
@@ -2680,6 +2787,7 @@ type ReachableOptions<G extends GraphDef> = BaseTraversalOptions<G> & Readonly<{
|
|
|
2680
2787
|
/** Exclude the source node from the result set (default: `false`). */
|
|
2681
2788
|
excludeSource?: boolean;
|
|
2682
2789
|
}>;
|
|
2790
|
+
type InternalReachableOptions<G extends GraphDef> = InternalBaseTraversalOptions<G> & Omit<ReachableOptions<G>, keyof BaseTraversalOptions<G>>;
|
|
2683
2791
|
/**
|
|
2684
2792
|
* Options for `neighbors`.
|
|
2685
2793
|
*
|
|
@@ -2697,6 +2805,7 @@ type NeighborsOptions<G extends GraphDef> = TemporalAlgorithmOptions & Readonly<
|
|
|
2697
2805
|
/** Cycle policy (default: `"prevent"`). */
|
|
2698
2806
|
cyclePolicy?: AlgorithmCyclePolicy;
|
|
2699
2807
|
}>;
|
|
2808
|
+
type InternalNeighborsOptions<G extends GraphDef> = InternalTemporalAlgorithmOptions & Omit<NeighborsOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
2700
2809
|
/**
|
|
2701
2810
|
* Options for `degree`.
|
|
2702
2811
|
*
|
|
@@ -2712,6 +2821,7 @@ type DegreeOptions<G extends GraphDef> = TemporalAlgorithmOptions & Readonly<{
|
|
|
2712
2821
|
/** Direction (default: `"both"`). */
|
|
2713
2822
|
direction?: TraversalDirection;
|
|
2714
2823
|
}>;
|
|
2824
|
+
type InternalDegreeOptions<G extends GraphDef> = InternalTemporalAlgorithmOptions & Omit<DegreeOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
2715
2825
|
|
|
2716
2826
|
/**
|
|
2717
2827
|
* Raw node id or any object with an `id: string` field. Covers `Node`,
|
|
@@ -2769,6 +2879,13 @@ type GraphAlgorithms<G extends GraphDef> = Readonly<{
|
|
|
2769
2879
|
*/
|
|
2770
2880
|
degree: (node: NodeIdentifier, options?: DegreeOptions<G>) => Promise<number>;
|
|
2771
2881
|
}>;
|
|
2882
|
+
type InternalGraphAlgorithms<G extends GraphDef> = Readonly<{
|
|
2883
|
+
shortestPath: (from: NodeIdentifier, to: NodeIdentifier, options: InternalShortestPathOptions<G>) => Promise<ShortestPathResult | undefined>;
|
|
2884
|
+
reachable: (from: NodeIdentifier, options: InternalReachableOptions<G>) => Promise<readonly ReachableNode[]>;
|
|
2885
|
+
canReach: (from: NodeIdentifier, to: NodeIdentifier, options: InternalBaseTraversalOptions<G>) => Promise<boolean>;
|
|
2886
|
+
neighbors: (node: NodeIdentifier, options: InternalNeighborsOptions<G>) => Promise<readonly ReachableNode[]>;
|
|
2887
|
+
degree: (node: NodeIdentifier, options?: InternalDegreeOptions<G>) => Promise<number>;
|
|
2888
|
+
}>;
|
|
2772
2889
|
|
|
2773
2890
|
type RebuildFulltextOptions = Readonly<{
|
|
2774
2891
|
/** Page size. Must be a positive integer. Default: 500. */
|
|
@@ -3131,17 +3248,6 @@ type UniqueIntrospection = Readonly<{
|
|
|
3131
3248
|
collation: Collation;
|
|
3132
3249
|
}>;
|
|
3133
3250
|
|
|
3134
|
-
/**
|
|
3135
|
-
* Data-cleanup phase for `store.removeKinds()`.
|
|
3136
|
-
*
|
|
3137
|
-
* The removeKinds verb commits the new schema atomically (millisecond
|
|
3138
|
-
* budget); the data deletion happens here, scoped per-deployment via
|
|
3139
|
-
* the `typegraph_kind_removals` status table. Splitting the verbs
|
|
3140
|
-
* mirrors how `materializeIndexes` complements `evolve`: schema
|
|
3141
|
-
* commits are atomic and fast, data work is bounded by row count and
|
|
3142
|
-
* deferrable / parallelizable.
|
|
3143
|
-
*/
|
|
3144
|
-
|
|
3145
3251
|
type MaterializeRemovalsOptions = Readonly<{
|
|
3146
3252
|
/** Restrict to specific kind names. */
|
|
3147
3253
|
kinds?: readonly string[];
|
|
@@ -3295,6 +3401,8 @@ type SubgraphOptions<G extends GraphDef, EK extends EdgeKinds<G>, NK extends Nod
|
|
|
3295
3401
|
temporalMode?: TemporalMode;
|
|
3296
3402
|
/** ISO-8601 timestamp used when `temporalMode === "asOf"`. */
|
|
3297
3403
|
asOf?: string;
|
|
3404
|
+
/** @internal Recorded coordinates are supplied by StoreView only. */
|
|
3405
|
+
recordedAsOf?: never;
|
|
3298
3406
|
/**
|
|
3299
3407
|
* Optional field-level projection per node/edge kind.
|
|
3300
3408
|
*
|
|
@@ -3307,6 +3415,16 @@ type SubgraphOptions<G extends GraphDef, EK extends EdgeKinds<G>, NK extends Nod
|
|
|
3307
3415
|
*/
|
|
3308
3416
|
project?: P;
|
|
3309
3417
|
}>;
|
|
3418
|
+
/**
|
|
3419
|
+
* Subgraph options as seen by the internal executor: identical to the public
|
|
3420
|
+
* {@link SubgraphOptions} except the recorded/system-time pin is a branded
|
|
3421
|
+
* instant the StoreView seam supplies. The public surface keeps
|
|
3422
|
+
* `recordedAsOf?: never`;
|
|
3423
|
+
* recorded reads reach the executor only through `store.subgraphAtCoordinate`.
|
|
3424
|
+
*/
|
|
3425
|
+
type InternalSubgraphOptions<G extends GraphDef, EK extends EdgeKinds<G>, NK extends NodeKinds<G>, P extends SubgraphProject<G, NK, EK> | undefined = undefined> = Omit<SubgraphOptions<G, EK, NK, P>, "recordedAsOf"> & Readonly<{
|
|
3426
|
+
recordedAsOf?: RecordedInstant;
|
|
3427
|
+
}>;
|
|
3310
3428
|
/**
|
|
3311
3429
|
* Union of all node result types in a subgraph, respecting projection.
|
|
3312
3430
|
*/
|
|
@@ -3414,6 +3532,18 @@ declare class Store<G extends GraphDef> {
|
|
|
3414
3532
|
get registry(): KindRegistry;
|
|
3415
3533
|
/** The database backend */
|
|
3416
3534
|
get backend(): GraphBackend;
|
|
3535
|
+
/**
|
|
3536
|
+
* Whether recorded-time capture is enabled for this store.
|
|
3537
|
+
*
|
|
3538
|
+
* @internal
|
|
3539
|
+
*/
|
|
3540
|
+
get historyEnabled(): boolean;
|
|
3541
|
+
/**
|
|
3542
|
+
* Whether this store has a recorded read relation bound for reconstruction.
|
|
3543
|
+
*
|
|
3544
|
+
* @internal
|
|
3545
|
+
*/
|
|
3546
|
+
get recordedReadBound(): boolean;
|
|
3417
3547
|
/**
|
|
3418
3548
|
* Node collections for ergonomic CRUD operations.
|
|
3419
3549
|
*
|
|
@@ -3554,14 +3684,43 @@ declare class Store<G extends GraphDef> {
|
|
|
3554
3684
|
* .execute();
|
|
3555
3685
|
* ```
|
|
3556
3686
|
*/
|
|
3557
|
-
query():
|
|
3687
|
+
query(): InitialQueryBuilder<G, "open">;
|
|
3558
3688
|
/**
|
|
3559
3689
|
* Internal seam for {@link StoreView.query}: a query builder pinned to a
|
|
3560
3690
|
* view's {@link ReadCoordinate} with its temporal axis sealed
|
|
3561
3691
|
* (`.temporal()` throws). Not part of the stable public API — construct a
|
|
3562
3692
|
* view via {@link Store.view} / {@link Store.asOf} and call `.query()`.
|
|
3563
3693
|
*/
|
|
3564
|
-
sealedQuery(coordinate: ReadCoordinate):
|
|
3694
|
+
sealedQuery(coordinate: ReadCoordinate): InitialQueryBuilder<G, "sealed">;
|
|
3695
|
+
/**
|
|
3696
|
+
* Internal seam for {@link RecordedStoreView}: reconstruct a node point read
|
|
3697
|
+
* from the recorded-time relation while preserving live getById ordering and
|
|
3698
|
+
* duplicate-input behavior.
|
|
3699
|
+
*
|
|
3700
|
+
* @internal
|
|
3701
|
+
*/
|
|
3702
|
+
recordedNodeGetById<N extends NodeType>(kind: string, id: NodeId<N>, coordinate: ReadCoordinate): Promise<Node<N> | undefined>;
|
|
3703
|
+
/**
|
|
3704
|
+
* Internal seam for {@link RecordedStoreView}: reconstruct node point reads
|
|
3705
|
+
* from the recorded-time relation while preserving input order.
|
|
3706
|
+
*
|
|
3707
|
+
* @internal
|
|
3708
|
+
*/
|
|
3709
|
+
recordedNodeGetByIds<N extends NodeType>(kind: string, ids: readonly NodeId<N>[], coordinate: ReadCoordinate): Promise<readonly (Node<N> | undefined)[]>;
|
|
3710
|
+
/**
|
|
3711
|
+
* Internal seam for {@link RecordedStoreView}: reconstruct an edge point read
|
|
3712
|
+
* from the recorded-time relation while preserving live getById behavior.
|
|
3713
|
+
*
|
|
3714
|
+
* @internal
|
|
3715
|
+
*/
|
|
3716
|
+
recordedEdgeGetById<E extends AnyEdgeType>(kind: string, id: EdgeId<E>, coordinate: ReadCoordinate): Promise<Edge<E> | undefined>;
|
|
3717
|
+
/**
|
|
3718
|
+
* Internal seam for {@link RecordedStoreView}: reconstruct edge point reads
|
|
3719
|
+
* from the recorded-time relation while preserving input order.
|
|
3720
|
+
*
|
|
3721
|
+
* @internal
|
|
3722
|
+
*/
|
|
3723
|
+
recordedEdgeGetByIds<E extends AnyEdgeType>(kind: string, ids: readonly EdgeId<E>[], coordinate: ReadCoordinate): Promise<readonly (Edge<E> | undefined)[]>;
|
|
3565
3724
|
/**
|
|
3566
3725
|
* Returns a read-only {@link StoreView} pinned to a valid-time instant.
|
|
3567
3726
|
*
|
|
@@ -3585,6 +3744,47 @@ declare class Store<G extends GraphDef> {
|
|
|
3585
3744
|
* @param asOf - ISO-8601 timestamp to pin the valid-time coordinate to.
|
|
3586
3745
|
*/
|
|
3587
3746
|
asOf(asOf: string): StoreView<G>;
|
|
3747
|
+
/**
|
|
3748
|
+
* Returns a narrow read-only view pinned to a recorded/system-time instant.
|
|
3749
|
+
*
|
|
3750
|
+
* Direct `store.asOfRecorded(T)` is diagonal bitemporal sugar: it reads the
|
|
3751
|
+
* recorded-time relation as of `T` and uses the same `T` for the valid-time
|
|
3752
|
+
* axis. Use `store.asOf(validT).asOfRecorded(recordedT)` when the valid and
|
|
3753
|
+
* recorded axes should differ.
|
|
3754
|
+
*
|
|
3755
|
+
* The returned view exposes only reconstructing-safe reads: query,
|
|
3756
|
+
* subgraph, graph algorithms, and collection point reads.
|
|
3757
|
+
*
|
|
3758
|
+
* Prefer `await store.recordedNow()` as the anchor over a wall-clock
|
|
3759
|
+
* timestamp: recorded instants are monotonic and can run briefly ahead of the
|
|
3760
|
+
* wall clock under bursty writes, so a `new Date().toISOString()` passed here
|
|
3761
|
+
* may sort before the most recent commits and silently omit them.
|
|
3762
|
+
*/
|
|
3763
|
+
asOfRecorded(recordedAsOf: RecordedInstant): RecordedStoreView<G>;
|
|
3764
|
+
/**
|
|
3765
|
+
* Returns the latest recorded-time instant captured for this graph — the
|
|
3766
|
+
* recorded high-water mark. After guarding the `undefined` case,
|
|
3767
|
+
* `store.asOfRecorded(checkpoint)` reconstructs everything committed so far, a
|
|
3768
|
+
* deterministic anchor that avoids guessing with the wall clock (recorded
|
|
3769
|
+
* instants are monotonic and can run briefly ahead of wall-clock time under
|
|
3770
|
+
* bursty writes). Capture each anchor right after the writes it should cover.
|
|
3771
|
+
*
|
|
3772
|
+
* Returns `undefined` until the first write has been captured, so on a
|
|
3773
|
+
* brand-new graph guard the composition — `asOfRecorded(undefined)` rejects
|
|
3774
|
+
* (an instant is required) rather than reconstructing an empty view. Read the
|
|
3775
|
+
* value first and only pass it to `asOfRecorded` once it is defined.
|
|
3776
|
+
*
|
|
3777
|
+
* **Graph-global, not caller-scoped.** This is the single high-water mark for
|
|
3778
|
+
* the whole graph, advanced by every committed capture from any writer — not
|
|
3779
|
+
* a per-write or per-caller value. An advance between two reads means
|
|
3780
|
+
* "something committed to this graph in between," *not* "the write this caller
|
|
3781
|
+
* just made landed." Do not use a `recordedNow()` advance as a "did my write
|
|
3782
|
+
* succeed?" signal: under any concurrent writer to the same graph it both
|
|
3783
|
+
* misses dropped writes and misfires on no-op writes. Confirm a specific write
|
|
3784
|
+
* by observing the write itself (its return value, or `store.transaction(...)`
|
|
3785
|
+
* success), not the global clock.
|
|
3786
|
+
*/
|
|
3787
|
+
recordedNow(): Promise<RecordedInstant | undefined>;
|
|
3588
3788
|
/**
|
|
3589
3789
|
* Returns a read-only {@link StoreView} pinned to an arbitrary public
|
|
3590
3790
|
* temporal mode. Use {@link Store.asOf} for the common valid-time case;
|
|
@@ -3714,6 +3914,21 @@ declare class Store<G extends GraphDef> {
|
|
|
3714
3914
|
* ```
|
|
3715
3915
|
*/
|
|
3716
3916
|
subgraph<const EK extends EdgeKinds<G>, const NK extends NodeKinds<G> = NodeKinds<G>, const P extends SubgraphProject<G, NK, EK> | undefined = undefined>(rootId: NodeId<AllNodeTypes<G>>, options: SubgraphOptions<G, EK, NK, P>): Promise<SubgraphResult<G, NK, EK, P>>;
|
|
3917
|
+
/**
|
|
3918
|
+
* Internal seam for {@link StoreView} / {@link RecordedStoreView}: runs a
|
|
3919
|
+
* subgraph with a coordinate already flattened into the options (including a
|
|
3920
|
+
* recorded/system-time pin). Trusted caller — the public {@link Store.subgraph}
|
|
3921
|
+
* is the guarded entry point.
|
|
3922
|
+
*
|
|
3923
|
+
* @internal
|
|
3924
|
+
*/
|
|
3925
|
+
subgraphAtCoordinate<const EK extends EdgeKinds<G>, const NK extends NodeKinds<G> = NodeKinds<G>, const P extends SubgraphProject<G, NK, EK> | undefined = undefined>(rootId: NodeId<AllNodeTypes<G>>, options: InternalSubgraphOptions<G, EK, NK, P>): Promise<SubgraphResult<G, NK, EK, P>>;
|
|
3926
|
+
/**
|
|
3927
|
+
* Internal seam for StoreView graph algorithms at a pinned coordinate.
|
|
3928
|
+
*
|
|
3929
|
+
* @internal
|
|
3930
|
+
*/
|
|
3931
|
+
algorithmsAtCoordinate(coordinate: ReadCoordinate): InternalGraphAlgorithms<G>;
|
|
3717
3932
|
/**
|
|
3718
3933
|
* Executes a function within a transaction.
|
|
3719
3934
|
*
|
|
@@ -3726,6 +3941,10 @@ declare class Store<G extends GraphDef> {
|
|
|
3726
3941
|
* {@link Store.withTransaction}). See {@link TransactionContext}
|
|
3727
3942
|
* for per-backend semantics; it is `undefined` only on the
|
|
3728
3943
|
* non-transactional fallback.
|
|
3944
|
+
* When the store was created with `{ history: true }`, `tx.sql` is
|
|
3945
|
+
* replaced by a fail-loud guard because raw SQL would bypass
|
|
3946
|
+
* recorded-time capture; use the typed collections inside
|
|
3947
|
+
* `transaction()` or {@link Store.withRecordedTransaction}.
|
|
3729
3948
|
*
|
|
3730
3949
|
* @example
|
|
3731
3950
|
* ```typescript
|
|
@@ -3769,8 +3988,11 @@ declare class Store<G extends GraphDef> {
|
|
|
3769
3988
|
* @param options Optional {@link TransactionOptions} forwarded to the
|
|
3770
3989
|
* backend (e.g. `isolationLevel: "serializable"` on Postgres). Backends
|
|
3771
3990
|
* without isolation-level support ignore it; the non-transactional
|
|
3772
|
-
* fallback ignores it entirely.
|
|
3991
|
+
* fallback ignores it entirely. Stores created with `{ history: true }`
|
|
3992
|
+
* require read-committed semantics for PostgreSQL recorded-clock capture and
|
|
3993
|
+
* reject stronger snapshot isolation levels.
|
|
3773
3994
|
*/
|
|
3995
|
+
transaction<T>(this: HistoryStore<G>, fn: (tx: HistoryTransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
3774
3996
|
transaction<T>(fn: (tx: TransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
3775
3997
|
/**
|
|
3776
3998
|
* Adopts a caller-owned, already-open Drizzle transaction so the graph
|
|
@@ -3814,9 +4036,18 @@ declare class Store<G extends GraphDef> {
|
|
|
3814
4036
|
* }); // one COMMIT / ROLLBACK across both layers
|
|
3815
4037
|
* ```
|
|
3816
4038
|
*
|
|
3817
|
-
*
|
|
3818
|
-
*
|
|
3819
|
-
*
|
|
4039
|
+
* Not available when the store was created with `{ history: true }`: a
|
|
4040
|
+
* caller-owned transaction context would let writes happen after capture has
|
|
4041
|
+
* lost its flush point, so this throws `ConfigurationError`
|
|
4042
|
+
* (`RECORDED_CAPTURE_REQUIRES_CALLBACK_TRANSACTION`). Use
|
|
4043
|
+
* {@link Store.withRecordedTransaction} on a history-enabled store, which
|
|
4044
|
+
* adopts the same external transaction but flushes recorded-time capture
|
|
4045
|
+
* before the caller commits.
|
|
4046
|
+
*
|
|
4047
|
+
* @throws {ConfigurationError} when the store has history capture enabled
|
|
4048
|
+
* (use {@link Store.withRecordedTransaction} instead), or when the backend
|
|
4049
|
+
* cannot adopt an external transaction — either it is not a Drizzle
|
|
4050
|
+
* Postgres/SQLite backend, or `backend.capabilities.transactions` is `false`
|
|
3820
4051
|
* (`drizzle-orm/neon-http`, Cloudflare D1, SQLite
|
|
3821
4052
|
* `transactionMode: "none"`). A non-atomic fallback is deliberately
|
|
3822
4053
|
* not offered here: the caller's relational write *would* still
|
|
@@ -3828,6 +4059,20 @@ declare class Store<G extends GraphDef> {
|
|
|
3828
4059
|
* without emitting any DDL.
|
|
3829
4060
|
*/
|
|
3830
4061
|
withTransaction(externalTx: AdoptedTransaction): TransactionContext<G>;
|
|
4062
|
+
/**
|
|
4063
|
+
* Adopts a caller-owned transaction while giving recorded-time capture a
|
|
4064
|
+
* flush point before the caller commits. Required when `history: true` is
|
|
4065
|
+
* enabled because returning a long-lived transaction context would let writes
|
|
4066
|
+
* happen after TypeGraph has lost the chance to close/open recorded rows.
|
|
4067
|
+
*
|
|
4068
|
+
* Capture flushes once, when `fn` resolves. The flush seals the capture
|
|
4069
|
+
* session, so a graph write made through the transaction context *after* `fn`
|
|
4070
|
+
* returns (e.g. retaining `tx` and writing once more before the caller's
|
|
4071
|
+
* COMMIT) throws rather than committing uncaptured — the post-flush write
|
|
4072
|
+
* cannot silently diverge history from live state.
|
|
4073
|
+
*/
|
|
4074
|
+
withRecordedTransaction<T>(this: HistoryStore<G>, externalTx: AdoptedTransaction, fn: (tx: HistoryTransactionContext<G>) => Promise<T>): Promise<T>;
|
|
4075
|
+
withRecordedTransaction<T>(externalTx: AdoptedTransaction, fn: (tx: TransactionContext<G>) => Promise<T>): Promise<T>;
|
|
3831
4076
|
/**
|
|
3832
4077
|
* Hard-deletes all data for this graph from the database.
|
|
3833
4078
|
*
|
|
@@ -4073,6 +4318,29 @@ declare class Store<G extends GraphDef> {
|
|
|
4073
4318
|
*/
|
|
4074
4319
|
close(): Promise<void>;
|
|
4075
4320
|
}
|
|
4321
|
+
type HistorySafeBackend = Omit<GraphBackend, "executeStatement" | "executeDdl"> & Readonly<{
|
|
4322
|
+
executeStatement?: never;
|
|
4323
|
+
executeDdl?: never;
|
|
4324
|
+
}>;
|
|
4325
|
+
type HistorySafeTransactionBackend = Omit<TransactionBackend, "executeStatement" | "executeDdl"> & Readonly<{
|
|
4326
|
+
executeStatement?: never;
|
|
4327
|
+
executeDdl?: never;
|
|
4328
|
+
}>;
|
|
4329
|
+
type HistoryTransactionContext<G extends GraphDef> = Omit<TransactionContext<G>, "backend" | "sql"> & Readonly<{
|
|
4330
|
+
backend: HistorySafeTransactionBackend;
|
|
4331
|
+
sql?: never;
|
|
4332
|
+
}>;
|
|
4333
|
+
type RecordedReadStore<G extends GraphDef> = Store<G> & Readonly<{
|
|
4334
|
+
recordedReadBound: true;
|
|
4335
|
+
}>;
|
|
4336
|
+
type HistoryStore<G extends GraphDef> = Store<G> & Readonly<{
|
|
4337
|
+
backend: HistorySafeBackend;
|
|
4338
|
+
historyEnabled: true;
|
|
4339
|
+
recordedReadBound: true;
|
|
4340
|
+
}>;
|
|
4341
|
+
type ExplicitRecordedReadLiveOptions = LiveStoreOptions & Readonly<{
|
|
4342
|
+
recordedRead: NonNullable<LiveStoreOptions["recordedRead"]>;
|
|
4343
|
+
}>;
|
|
4076
4344
|
/**
|
|
4077
4345
|
* Creates a new Store instance.
|
|
4078
4346
|
*
|
|
@@ -4102,6 +4370,8 @@ declare class Store<G extends GraphDef> {
|
|
|
4102
4370
|
* });
|
|
4103
4371
|
* ```
|
|
4104
4372
|
*/
|
|
4373
|
+
declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: HistoryStoreOptions): HistoryStore<G>;
|
|
4374
|
+
declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: ExplicitRecordedReadLiveOptions): RecordedReadStore<G>;
|
|
4105
4375
|
declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend, options?: StoreOptions): Store<G>;
|
|
4106
4376
|
|
|
4107
4377
|
/**
|
|
@@ -4132,6 +4402,8 @@ declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend
|
|
|
4132
4402
|
* }
|
|
4133
4403
|
* ```
|
|
4134
4404
|
*/
|
|
4405
|
+
declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options: HistoryStoreOptions & SchemaManagerOptions): Promise<[HistoryStore<G>, SchemaValidationResult]>;
|
|
4406
|
+
declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options: ExplicitRecordedReadLiveOptions & SchemaManagerOptions): Promise<[RecordedReadStore<G>, SchemaValidationResult]>;
|
|
4135
4407
|
declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options?: StoreOptions & SchemaManagerOptions): Promise<[Store<G>, SchemaValidationResult]>;
|
|
4136
4408
|
/**
|
|
4137
4409
|
* Creates a Store after **verifying** that the database is at the same
|
|
@@ -4174,6 +4446,8 @@ declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: Gr
|
|
|
4174
4446
|
* @throws StoreNotInitializedError if runtime-contribution markers are
|
|
4175
4447
|
* missing/stale/failed for this graph on this connection.
|
|
4176
4448
|
*/
|
|
4449
|
+
declare function createVerifiedStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: HistoryStoreOptions): Promise<[HistoryStore<G>, SchemaValidationResult]>;
|
|
4450
|
+
declare function createVerifiedStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: ExplicitRecordedReadLiveOptions): Promise<[RecordedReadStore<G>, SchemaValidationResult]>;
|
|
4177
4451
|
declare function createVerifiedStore<G extends GraphDef>(graph: G, backend: GraphBackend, options?: StoreOptions): Promise<[Store<G>, SchemaValidationResult]>;
|
|
4178
4452
|
|
|
4179
4453
|
/**
|
|
@@ -4216,7 +4490,7 @@ type StoreViewCoordinate = Readonly<{
|
|
|
4216
4490
|
* {@link Store.subgraph} options with the temporal axis removed — the
|
|
4217
4491
|
* view's pinned coordinate supplies it.
|
|
4218
4492
|
*/
|
|
4219
|
-
type StoreViewSubgraphOptions<G extends GraphDef, EK extends EdgeKinds<G>, NK extends NodeKinds<G>, P extends SubgraphProject<G, NK, EK> | undefined = undefined> = Omit<SubgraphOptions<G, EK, NK, P>, "temporalMode" | "asOf">;
|
|
4493
|
+
type StoreViewSubgraphOptions<G extends GraphDef, EK extends EdgeKinds<G>, NK extends NodeKinds<G>, P extends SubgraphProject<G, NK, EK> | undefined = undefined> = Omit<SubgraphOptions<G, EK, NK, P>, "temporalMode" | "asOf" | "recordedAsOf">;
|
|
4220
4494
|
/** `reachable` options with the temporal axis removed (the pin supplies it). */
|
|
4221
4495
|
type StoreViewReachableOptions<G extends GraphDef> = Omit<ReachableOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
4222
4496
|
/** `shortestPath` options with the temporal axis removed (the pin supplies it). */
|
|
@@ -4228,35 +4502,29 @@ type StoreViewNeighborsOptions<G extends GraphDef> = Omit<NeighborsOptions<G>, k
|
|
|
4228
4502
|
/** `degree` options with the temporal axis removed (the pin supplies it). */
|
|
4229
4503
|
type StoreViewDegreeOptions<G extends GraphDef> = Omit<DegreeOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
4230
4504
|
/**
|
|
4231
|
-
*
|
|
4232
|
-
*
|
|
4233
|
-
*
|
|
4234
|
-
*
|
|
4235
|
-
*
|
|
4236
|
-
*
|
|
4237
|
-
* const past = store.asOf("2026-01-01T00:00:00.000Z");
|
|
4238
|
-
* const alice = await past.nodes.Person.getById(aliceId);
|
|
4239
|
-
* const jobs = await past.edges.worksAt.findFrom(alice!);
|
|
4240
|
-
* const reach = await past.reachable(alice!, { edges: ["knows"] });
|
|
4241
|
-
* ```
|
|
4505
|
+
* Shared base for the read-only views. Holds the pinned {@link ReadCoordinate}
|
|
4506
|
+
* and delegates the graph algorithms, `subgraph`, and `query` to the live store
|
|
4507
|
+
* with that coordinate flattened into each call. {@link StoreView} (valid-time)
|
|
4508
|
+
* and {@link RecordedStoreView} (recorded-time) extend it; only the surfaces
|
|
4509
|
+
* that genuinely differ — collections, search, and the coordinate-changing
|
|
4510
|
+
* helpers — live on the subclasses.
|
|
4242
4511
|
*/
|
|
4243
|
-
declare class
|
|
4512
|
+
declare abstract class CoordinatePinnedView<G extends GraphDef> {
|
|
4244
4513
|
#private;
|
|
4245
|
-
|
|
4514
|
+
protected readonly store: Store<G>;
|
|
4515
|
+
protected readonly coordinate: ReadCoordinate;
|
|
4516
|
+
constructor(store: Store<G>, coordinate: ReadCoordinate);
|
|
4246
4517
|
/** The temporal mode this view reads in. */
|
|
4247
4518
|
get mode(): TemporalMode;
|
|
4248
|
-
/** The pinned `asOf` timestamp, or `undefined` for
|
|
4519
|
+
/** The pinned valid-time `asOf` timestamp, or `undefined` for other modes. */
|
|
4249
4520
|
get asOf(): string | undefined;
|
|
4250
|
-
/** Read-only node collections pinned to this view's coordinate. */
|
|
4251
|
-
get nodes(): StoreViewNodeCollections<G>;
|
|
4252
|
-
/** Read-only edge collections pinned to this view's coordinate. */
|
|
4253
|
-
get edges(): StoreViewEdgeCollections<G>;
|
|
4254
4521
|
/**
|
|
4255
4522
|
* A query builder pinned to this view's coordinate. The temporal axis is
|
|
4256
4523
|
* sealed: calling `.temporal(...)` on the returned builder throws, so the
|
|
4257
4524
|
* view's coordinate cannot be overridden on a per-query basis.
|
|
4258
4525
|
*/
|
|
4259
|
-
query():
|
|
4526
|
+
query(): InitialQueryBuilder<G, "sealed">;
|
|
4527
|
+
protected algorithms(): InternalGraphAlgorithms<G>;
|
|
4260
4528
|
/** Extracts a subgraph at this view's pinned coordinate. */
|
|
4261
4529
|
subgraph<const EK extends EdgeKinds<G>, const NK extends NodeKinds<G> = NodeKinds<G>, const P extends SubgraphProject<G, NK, EK> | undefined = undefined>(rootId: NodeId<AllNodeTypes<G>>, options: StoreViewSubgraphOptions<G, EK, NK, P>): Promise<SubgraphResult<G, NK, EK, P>>;
|
|
4262
4530
|
/** Shortest path between two nodes at this view's pinned coordinate. */
|
|
@@ -4269,6 +4537,29 @@ declare class StoreView<G extends GraphDef> {
|
|
|
4269
4537
|
neighbors(node: NodeIdentifier, options: StoreViewNeighborsOptions<G>): Promise<readonly ReachableNode[]>;
|
|
4270
4538
|
/** Counts active edges incident to `node` at this view's pinned coordinate. */
|
|
4271
4539
|
degree(node: NodeIdentifier, options?: StoreViewDegreeOptions<G>): Promise<number>;
|
|
4540
|
+
}
|
|
4541
|
+
/**
|
|
4542
|
+
* A read-only `(mode, asOf)` lens over a {@link Store}. Construct one via
|
|
4543
|
+
* {@link Store.asOf} (valid-time) or {@link Store.view} (any public
|
|
4544
|
+
* mode), never directly.
|
|
4545
|
+
*
|
|
4546
|
+
* @example
|
|
4547
|
+
* ```typescript
|
|
4548
|
+
* const past = store.asOf("2026-01-01T00:00:00.000Z");
|
|
4549
|
+
* const alice = await past.nodes.Person.getById(aliceId);
|
|
4550
|
+
* const jobs = await past.edges.worksAt.findFrom(alice!);
|
|
4551
|
+
* const reach = await past.reachable(alice!, { edges: ["knows"] });
|
|
4552
|
+
* ```
|
|
4553
|
+
*/
|
|
4554
|
+
declare class StoreView<G extends GraphDef> extends CoordinatePinnedView<G> {
|
|
4555
|
+
#private;
|
|
4556
|
+
constructor(store: Store<G>, coordinate: StoreViewCoordinate | ReadCoordinate);
|
|
4557
|
+
/** Adds a recorded-time pin, returning the narrow reconstructing view. */
|
|
4558
|
+
asOfRecorded(recordedAsOf: RecordedInstant): RecordedStoreView<G>;
|
|
4559
|
+
/** Read-only node collections pinned to this view's coordinate. */
|
|
4560
|
+
get nodes(): StoreViewNodeCollections<G>;
|
|
4561
|
+
/** Read-only edge collections pinned to this view's coordinate. */
|
|
4562
|
+
get edges(): StoreViewEdgeCollections<G>;
|
|
4272
4563
|
/**
|
|
4273
4564
|
* Read-only search facade. On a `current` view the read methods
|
|
4274
4565
|
* (`fulltext` / `vector` / `hybrid`) delegate to the live `store.search`,
|
|
@@ -4279,5 +4570,22 @@ declare class StoreView<G extends GraphDef> {
|
|
|
4279
4570
|
*/
|
|
4280
4571
|
get search(): StoreSearch<G>;
|
|
4281
4572
|
}
|
|
4573
|
+
/**
|
|
4574
|
+
* A narrow recorded-time read lens. It preserves the valid-time coordinate
|
|
4575
|
+
* carried by the source view and adds a recorded/system-time pin. Collection
|
|
4576
|
+
* reads are intentionally limited to point reconstruction; broad collection
|
|
4577
|
+
* predicates, endpoint reads, search, and further coordinate changes are absent
|
|
4578
|
+
* from the typed surface and refused by the runtime proxies for JS callers.
|
|
4579
|
+
*/
|
|
4580
|
+
declare class RecordedStoreView<G extends GraphDef> extends CoordinatePinnedView<G> {
|
|
4581
|
+
#private;
|
|
4582
|
+
constructor(store: Store<G>, coordinate: ReadCoordinate);
|
|
4583
|
+
/** The recorded/system-time timestamp this view reconstructs. */
|
|
4584
|
+
get asOfRecorded(): string;
|
|
4585
|
+
/** Recorded-time node point-read collections. */
|
|
4586
|
+
get nodes(): RecordedStoreViewNodeCollections<G>;
|
|
4587
|
+
/** Recorded-time edge point-read collections. */
|
|
4588
|
+
get edges(): RecordedStoreViewEdgeCollections<G>;
|
|
4589
|
+
}
|
|
4282
4590
|
|
|
4283
|
-
export { type
|
|
4591
|
+
export { type GraphAlgorithms as $, type AliasMap as A, type BaseTraversalOptions as B, type ConstraintNames as C, DEFAULT_SEARCHABLE_LANGUAGE as D, type EmbeddingMetric as E, type EdgeFindByEndpointsOptions as F, type EdgeGetOrCreateByEndpointsOptions as G, type EdgeGetOrCreateByEndpointsResult as H, type EdgeIntrospection as I, type EdgeTemporalReads as J, type EdgeWrites as K, type EmbeddingSchema as L, type EmbeddingValue as M, type Node as N, type EmptyAliasMap as O, type EmptyEdgeAliasMap as P, type QueryCoordinateState as Q, type RecursiveAliasMap as R, Store as S, TraversalBuilder as T, type UniqueIntrospection as U, ExecutableAggregateQuery as V, ExecutableQuery as W, type FieldAccessor as X, type FulltextSearchHit as Y, type FulltextSearchOptions as Z, type GetOrCreateAction as _, type EmbeddingIndexType as a, type SelectableEdge as a$, type GraphEdgeCollections as a0, type GraphNodeCollections as a1, type HistorySafeBackend as a2, type HistorySafeTransactionBackend as a3, type HistoryStore as a4, type HistoryStoreOptions as a5, type HistoryTransactionContext as a6, type HookContext as a7, type HybridFulltextOptions as a8, type HybridSearchHit as a9, type PathNode as aA, type Predicate as aB, PreparedQuery as aC, type PropsAccessor as aD, type QueryHookContext as aE, type QueryOptions as aF, type ReachableNode as aG, type ReachableOptions as aH, type RebuildFulltextOptions as aI, type RebuildFulltextResult as aJ, type ReclaimedVectorFieldEntry as aK, type RecordedInstant as aL, type RecordedReadStore as aM, RecordedStoreView as aN, type RecordedStoreViewEdgeCollection as aO, type RecordedStoreViewEdgeCollections as aP, type RecordedStoreViewNodeCollection as aQ, type RecordedStoreViewNodeCollections as aR, type RecursiveTraversalOptions as aS, type ReembedFunction as aT, type ReembedVectorFieldOptions as aU, type ReembedVectorFieldResult as aV, type SchemaIntrospection as aW, type SearchableMetadata as aX, type SearchableOptions as aY, type SearchableSchema as aZ, type SelectContext as a_, type HybridSearchOptions as aa, type HybridVectorOptions as ab, type IfExistsMode as ac, type InitialQueryBuilder as ad, type KindIntrospection as ae, type LiveStoreOptions as af, type MaterializeRemovalsEntry as ag, type MaterializeRemovalsOptions as ah, type MaterializeRemovalsResult as ai, type NeighborsOptions as aj, type NoRecordedCoordinate as ak, type NodeAccessor as al, type NodeAlias as am, type NodeBulkFindByIndexOptions as an, type NodeCollection as ao, type NodeCurrentReads as ap, type NodeGetOrCreateByConstraintOptions as aq, type NodeGetOrCreateByConstraintResult as ar, type NodeIdentifier as as, type NodeRef as at, type NodeTemporalReads as au, type NodeWrites as av, type OntologyIntrospection as aw, type OperationHookContext as ax, type PaginateOptions as ay, type PaginatedResult as az, type EdgeAliasMap as b, type SelectableNode as b0, type ShortestPathOptions as b1, type ShortestPathResult as b2, type StoreHooks as b3, type StoreOptions as b4, type StoreProjection as b5, type StoreRef as b6, StoreSearch as b7, StoreView as b8, type StoreViewCanReachOptions as b9, type VectorSearchHit as bA, type VectorSearchOptions as bB, asRecordedInstant as bC, createQueryBuilder as bD, createStore as bE, createStoreWithSchema as bF, createVerifiedStore as bG, defineSubgraphProject as bH, embedding as bI, exists as bJ, fieldRef as bK, getEmbeddingDimensions as bL, getSearchableMetadata as bM, inSubquery as bN, isEmbeddingSchema as bO, isParameterRef as bP, isSearchableSchema as bQ, notExists as bR, notInSubquery as bS, param as bT, searchable as bU, type StoreViewCoordinate as ba, type StoreViewDegreeOptions as bb, type StoreViewEdgeCollection as bc, type StoreViewEdgeCollections as bd, type StoreViewNeighborsOptions as be, type StoreViewNodeCollection as bf, type StoreViewNodeCollections as bg, type StoreViewReachableOptions as bh, type StoreViewShortestPathOptions as bi, type StoreViewSubgraphOptions as bj, type StreamOptions as bk, type SubgraphEdgeResult as bl, type SubgraphNodeResult as bm, type SubgraphOptions as bn, type SubgraphResult as bo, type SubsetEdge as bp, type SubsetNode as bq, type TemporalAlgorithmOptions as br, type TransactionContext as bs, type TraversalDirection as bt, type TypedEdgeCollection as bu, type TypedRecordedStoreViewEdgeCollection as bv, type TypedStoreViewEdgeCollection as bw, UnionableQuery as bx, type UpdateEdgeInput as by, type UpdateNodeInput as bz, QueryBuilder as c, type EmptyRecursiveAliasMap as d, type AggregateResult as e, type AlgorithmCyclePolicy as f, type AnyEdge as g, type AnyNode as h, type BatchResults as i, type BatchableQuery as j, type CreateEdgeInput as k, type CreateNodeInput as l, type DegreeOptions as m, type DynamicEdgeAccessor as n, type DynamicEdgeCollection as o, type DynamicEdgeType as p, type DynamicFieldBuilder as q, type DynamicNodeAccessor as r, type DynamicNodeCollection as s, type DynamicNodeType as t, type DynamicSelectableEdge as u, type DynamicSelectableNode as v, type Edge as w, type EdgeAccessor as x, type EdgeBatchReads as y, type EdgeCollection as z };
|