@nicia-ai/typegraph 0.32.0 → 0.34.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 +51 -0
- package/dist/backend/postgres/index.cjs +36 -19
- package/dist/backend/postgres/index.d.cts +6 -6
- package/dist/backend/postgres/index.d.ts +6 -6
- package/dist/backend/postgres/index.js +14 -9
- package/dist/backend/postgres/pglite.cjs +18 -13
- 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 +14 -9
- package/dist/backend/postgres/pglite.js.map +1 -1
- package/dist/backend/sqlite/index.cjs +34 -17
- package/dist/backend/sqlite/index.d.cts +7 -7
- package/dist/backend/sqlite/index.d.ts +7 -7
- package/dist/backend/sqlite/index.js +13 -8
- package/dist/backend/sqlite/libsql.cjs +19 -14
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +12 -5
- package/dist/backend/sqlite/libsql.d.ts +12 -5
- package/dist/backend/sqlite/libsql.js +15 -10
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +19 -14
- 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 +14 -9
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/chunk-2EBMPJBO.js +16 -0
- package/dist/chunk-2EBMPJBO.js.map +1 -0
- package/dist/{chunk-CFNT3ITG.cjs → chunk-2JXB3NYJ.cjs} +15 -35
- package/dist/chunk-2JXB3NYJ.cjs.map +1 -0
- package/dist/chunk-2MRAX3UE.js +105 -0
- package/dist/chunk-2MRAX3UE.js.map +1 -0
- package/dist/{chunk-2LAT5BIK.cjs → chunk-3BRVBQQD.cjs} +2328 -3131
- package/dist/chunk-3BRVBQQD.cjs.map +1 -0
- package/dist/chunk-3E7SNSIA.cjs +55 -0
- package/dist/chunk-3E7SNSIA.cjs.map +1 -0
- package/dist/{chunk-FDN43KXV.cjs → chunk-3Z6TW3CT.cjs} +20 -19
- package/dist/chunk-3Z6TW3CT.cjs.map +1 -0
- package/dist/{chunk-IJORSAC3.js → chunk-4DIBPQNJ.js} +6 -4
- package/dist/chunk-4DIBPQNJ.js.map +1 -0
- package/dist/chunk-4S2FXGBJ.js +9 -0
- package/dist/chunk-4S2FXGBJ.js.map +1 -0
- package/dist/chunk-5IQIX7LU.cjs +2070 -0
- package/dist/chunk-5IQIX7LU.cjs.map +1 -0
- package/dist/{chunk-CWFPJ3RC.js → chunk-6GNSY7AV.js} +3 -3
- package/dist/{chunk-CWFPJ3RC.js.map → chunk-6GNSY7AV.js.map} +1 -1
- package/dist/{chunk-LAZGHOZW.cjs → chunk-6HVOHZHS.cjs} +184 -117
- package/dist/chunk-6HVOHZHS.cjs.map +1 -0
- package/dist/chunk-6SCVW4AS.js +20 -0
- package/dist/chunk-6SCVW4AS.js.map +1 -0
- package/dist/chunk-A7SZZFAG.js +2010 -0
- package/dist/chunk-A7SZZFAG.js.map +1 -0
- package/dist/chunk-ACSVZPK7.cjs +21 -0
- package/dist/chunk-ACSVZPK7.cjs.map +1 -0
- package/dist/{chunk-MXE2U3EX.js → chunk-BVTWD66D.js} +4 -115
- package/dist/chunk-BVTWD66D.js.map +1 -0
- package/dist/{chunk-W4ZX2GCP.js → chunk-CHXTTSC6.js} +5 -39
- package/dist/chunk-CHXTTSC6.js.map +1 -0
- package/dist/{chunk-XQFAJVYW.js → chunk-CYX2JTDG.js} +124 -5
- package/dist/chunk-CYX2JTDG.js.map +1 -0
- package/dist/{chunk-PRMKPFN5.js → chunk-DEQFL35G.js} +4 -3
- package/dist/chunk-DEQFL35G.js.map +1 -0
- package/dist/chunk-DI74SMXS.cjs +29 -0
- package/dist/chunk-DI74SMXS.cjs.map +1 -0
- package/dist/{chunk-WWVV44DY.cjs → chunk-G6SOJEDI.cjs} +11 -11
- package/dist/{chunk-WWVV44DY.cjs.map → chunk-G6SOJEDI.cjs.map} +1 -1
- package/dist/{chunk-LM2IC4ZJ.cjs → chunk-GQANNXXT.cjs} +15 -14
- package/dist/chunk-GQANNXXT.cjs.map +1 -0
- package/dist/chunk-GZCNZ7QW.js +24 -0
- package/dist/chunk-GZCNZ7QW.js.map +1 -0
- package/dist/{chunk-KTIEB7VH.cjs → chunk-HK5SATYM.cjs} +35 -58
- package/dist/chunk-HK5SATYM.cjs.map +1 -0
- package/dist/chunk-HMFK4BXR.cjs +12 -0
- package/dist/{chunk-6ZR4QC3O.cjs.map → chunk-HMFK4BXR.cjs.map} +1 -1
- package/dist/chunk-ITE4IXAK.js +25 -0
- package/dist/chunk-ITE4IXAK.js.map +1 -0
- package/dist/chunk-JJRCLAUN.cjs +155 -0
- package/dist/chunk-JJRCLAUN.cjs.map +1 -0
- package/dist/{chunk-ZFWNO3GE.cjs → chunk-JQGIPGVL.cjs} +66 -2
- package/dist/chunk-JQGIPGVL.cjs.map +1 -0
- package/dist/{chunk-2BVHPOIG.js → chunk-K2TGS3EN.js} +105 -38
- package/dist/chunk-K2TGS3EN.js.map +1 -0
- package/dist/chunk-K34OPSJK.js +29 -0
- package/dist/chunk-K34OPSJK.js.map +1 -0
- package/dist/{chunk-YW7GHMF4.cjs → chunk-KGC4LY5T.cjs} +18 -17
- package/dist/chunk-KGC4LY5T.cjs.map +1 -0
- package/dist/{chunk-SB65GJNY.cjs → chunk-KNHYNQQ3.cjs} +111 -72
- package/dist/chunk-KNHYNQQ3.cjs.map +1 -0
- package/dist/{chunk-C4C4Q7A6.js → chunk-KUTNI6SI.js} +6 -21
- package/dist/chunk-KUTNI6SI.js.map +1 -0
- package/dist/{chunk-NDM5PXEH.js → chunk-LANHCOXB.js} +44 -11
- package/dist/chunk-LANHCOXB.js.map +1 -0
- package/dist/chunk-N6WTUSBV.cjs +23 -0
- package/dist/chunk-N6WTUSBV.cjs.map +1 -0
- package/dist/{chunk-73KASJGO.cjs → chunk-NAUA4PW5.cjs} +4 -28
- package/dist/chunk-NAUA4PW5.cjs.map +1 -0
- package/dist/chunk-QV245VMN.js +145 -0
- package/dist/chunk-QV245VMN.js.map +1 -0
- package/dist/{chunk-CEF2QOTO.js → chunk-RBV7YCQD.js} +4 -3
- package/dist/chunk-RBV7YCQD.js.map +1 -0
- package/dist/chunk-RHZWOJVA.cjs +109 -0
- package/dist/chunk-RHZWOJVA.cjs.map +1 -0
- package/dist/{chunk-6RMLO5O4.cjs → chunk-RRKQAKD6.cjs} +13 -11
- package/dist/chunk-RRKQAKD6.cjs.map +1 -0
- package/dist/{chunk-TUA3MEJJ.js → chunk-RY2VIWAM.js} +612 -564
- package/dist/chunk-RY2VIWAM.js.map +1 -0
- package/dist/{chunk-PIHXFF73.js → chunk-SHLY4MCM.js} +3 -3
- package/dist/{chunk-PIHXFF73.js.map → chunk-SHLY4MCM.js.map} +1 -1
- package/dist/{chunk-HFBRAOF7.js → chunk-T2DWPQNE.js} +103 -64
- package/dist/chunk-T2DWPQNE.js.map +1 -0
- package/dist/{chunk-WYTUF3QO.js → chunk-T46GR2VY.js} +3 -3
- package/dist/{chunk-WYTUF3QO.js.map → chunk-T46GR2VY.js.map} +1 -1
- package/dist/{chunk-EEYV6UOE.cjs → chunk-T6SPUYLX.cjs} +5 -43
- package/dist/chunk-T6SPUYLX.cjs.map +1 -0
- package/dist/{chunk-3QRBXYT5.cjs → chunk-TGJE22RM.cjs} +6 -6
- package/dist/{chunk-3QRBXYT5.cjs.map → chunk-TGJE22RM.cjs.map} +1 -1
- package/dist/{chunk-YL4F3CMD.cjs → chunk-TOTPVGOG.cjs} +105 -72
- package/dist/chunk-TOTPVGOG.cjs.map +1 -0
- package/dist/{chunk-3HQDMOBK.cjs → chunk-UJLOZYKT.cjs} +680 -636
- package/dist/chunk-UJLOZYKT.cjs.map +1 -0
- package/dist/chunk-UNNPKQUG.cjs +1390 -0
- package/dist/chunk-UNNPKQUG.cjs.map +1 -0
- package/dist/chunk-UR7W5YQK.js +18 -0
- package/dist/chunk-UR7W5YQK.js.map +1 -0
- package/dist/chunk-V3QNTB7Z.js +1351 -0
- package/dist/chunk-V3QNTB7Z.js.map +1 -0
- package/dist/{chunk-XKNAK27R.js → chunk-VCGO4V26.js} +4 -3
- package/dist/chunk-VCGO4V26.js.map +1 -0
- package/dist/{chunk-YQGLVWB2.cjs → chunk-WL2SG7ZV.cjs} +6 -122
- package/dist/chunk-WL2SG7ZV.cjs.map +1 -0
- package/dist/{chunk-WNORITK6.js → chunk-WLRIWYHQ.js} +2041 -2834
- package/dist/chunk-WLRIWYHQ.js.map +1 -0
- package/dist/{chunk-JKRKIEVA.cjs → chunk-WVC2Q2FD.cjs} +128 -6
- package/dist/chunk-WVC2Q2FD.cjs.map +1 -0
- package/dist/chunk-XLUNB2TZ.js +53 -0
- package/dist/chunk-XLUNB2TZ.js.map +1 -0
- package/dist/chunk-XXVEULWX.js +39 -0
- package/dist/chunk-XXVEULWX.js.map +1 -0
- package/dist/chunk-YAZE7QZR.cjs +32 -0
- package/dist/chunk-YAZE7QZR.cjs.map +1 -0
- package/dist/chunk-YC6PWTHY.cjs +44 -0
- package/dist/chunk-YC6PWTHY.cjs.map +1 -0
- package/dist/chunk-Z5HBYM7U.cjs +11 -0
- package/dist/chunk-Z5HBYM7U.cjs.map +1 -0
- package/dist/{chunk-454I6GDF.js → chunk-Z5XBMDXU.js} +63 -3
- package/dist/chunk-Z5XBMDXU.js.map +1 -0
- package/dist/{chunk-CAMMC3E4.cjs → chunk-ZP5WHI4C.cjs} +109 -81
- package/dist/chunk-ZP5WHI4C.cjs.map +1 -0
- package/dist/{chunk-YCV72E6L.js → chunk-ZURTTSCM.js} +4 -25
- package/dist/chunk-ZURTTSCM.js.map +1 -0
- package/dist/{chunk-7WW3WL6E.js → chunk-ZV5N4DBG.js} +49 -21
- package/dist/chunk-ZV5N4DBG.js.map +1 -0
- package/dist/chunk-ZY4GXIVN.cjs +32 -0
- package/dist/chunk-ZY4GXIVN.cjs.map +1 -0
- package/dist/{ddl-C8e8zDAE.d.ts → ddl-BrmPg61z.d.ts} +3 -3
- package/dist/{ddl-CwyG4HoQ.d.cts → ddl-j1-sH6lE.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.cjs +18 -17
- 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 -2
- package/dist/graph-merge/index.cjs +295 -146
- 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 +173 -24
- 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 +206 -172
- 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 +32 -22
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +28 -25
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +10 -7
- package/dist/interchange/index.cjs +25 -16
- package/dist/interchange/index.d.cts +5 -5
- package/dist/interchange/index.d.ts +5 -5
- package/dist/interchange/index.js +12 -3
- package/dist/{manager-8htmuGr-.d.ts → manager-BZUeN_BU.d.ts} +2 -2
- package/dist/{manager-aVgxbGt-.d.cts → manager-ms9cKdc6.d.cts} +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-Dhom7iiX.d.ts → postgres-BhpxGMC5.d.cts} +2651 -596
- package/dist/{postgres-jgXmD45C.d.cts → postgres-CWHLwNl1.d.ts} +2651 -596
- package/dist/profiler/index.cjs +5 -4
- 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 +3 -2
- package/dist/profiler/index.js.map +1 -1
- package/dist/provenance/index.cjs +591 -0
- package/dist/provenance/index.cjs.map +1 -0
- package/dist/provenance/index.d.cts +73 -0
- package/dist/provenance/index.d.ts +73 -0
- package/dist/provenance/index.js +589 -0
- package/dist/provenance/index.js.map +1 -0
- package/dist/schema/index.cjs +37 -32
- 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 +14 -9
- package/dist/schema/index.js.map +1 -1
- package/dist/{sqlite-DcQ_BCUW.d.cts → sqlite-CGu5SLsw.d.ts} +2726 -455
- package/dist/{sqlite-BfLsCEqO.d.ts → sqlite-XrDxNaa7.d.cts} +2726 -455
- package/dist/{store-view-pBOUrQte.d.ts → store-view-BlgnhEYf.d.ts} +467 -131
- package/dist/{store-view-lTcb_cnp.d.cts → store-view-D09po4H6.d.cts} +467 -131
- package/dist/{types-DGDiXAYc.d.ts → types-B1TbZJYS.d.ts} +2 -2
- package/dist/{types-Dk8r09KY.d.ts → types-D1Sqeyxy.d.ts} +161 -26
- package/dist/{types-5RQwzWXx.d.cts → types-DiE1AO7p.d.cts} +2 -2
- package/dist/{types-Dvmn-eal.d.cts → types-DkNnF-7K.d.cts} +161 -26
- package/dist/{where-Cx_glEEB.d.cts → where-DKjuofPr.d.cts} +2 -2
- package/dist/{where-CHZFELX0.d.ts → where-DrUIIWHb.d.ts} +2 -2
- package/package.json +8 -2
- package/dist/chunk-2BVHPOIG.js.map +0 -1
- package/dist/chunk-2LAT5BIK.cjs.map +0 -1
- package/dist/chunk-2YMGNYXY.js +0 -40
- package/dist/chunk-2YMGNYXY.js.map +0 -1
- package/dist/chunk-3HQDMOBK.cjs.map +0 -1
- package/dist/chunk-454I6GDF.js.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-6ZR4QC3O.cjs +0 -12
- package/dist/chunk-73KASJGO.cjs.map +0 -1
- package/dist/chunk-7WW3WL6E.js.map +0 -1
- package/dist/chunk-C4C4Q7A6.js.map +0 -1
- package/dist/chunk-CAMMC3E4.cjs.map +0 -1
- package/dist/chunk-CEF2QOTO.js.map +0 -1
- package/dist/chunk-CFNT3ITG.cjs.map +0 -1
- package/dist/chunk-EEYV6UOE.cjs.map +0 -1
- package/dist/chunk-FDN43KXV.cjs.map +0 -1
- package/dist/chunk-HFBRAOF7.js.map +0 -1
- package/dist/chunk-IJORSAC3.js.map +0 -1
- package/dist/chunk-JKRKIEVA.cjs.map +0 -1
- package/dist/chunk-KTIEB7VH.cjs.map +0 -1
- package/dist/chunk-LAZGHOZW.cjs.map +0 -1
- package/dist/chunk-LM2IC4ZJ.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-PRMKPFN5.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-SB65GJNY.cjs.map +0 -1
- package/dist/chunk-TUA3MEJJ.js.map +0 -1
- package/dist/chunk-W4ZX2GCP.js.map +0 -1
- package/dist/chunk-WNORITK6.js.map +0 -1
- package/dist/chunk-XKNAK27R.js.map +0 -1
- package/dist/chunk-XQFAJVYW.js.map +0 -1
- package/dist/chunk-YCV72E6L.js.map +0 -1
- package/dist/chunk-YL4F3CMD.cjs.map +0 -1
- package/dist/chunk-YQGLVWB2.cjs.map +0 -1
- package/dist/chunk-YW7GHMF4.cjs.map +0 -1
- package/dist/chunk-ZFWNO3GE.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-ms9cKdc6.cjs';
|
|
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.cjs';
|
|
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-DkNnF-7K.cjs';
|
|
5
|
+
import { b as MaterializeIndexesOptions, M as MaterializeIndexesResult } from './materialize-indexes-D20xNluI.cjs';
|
|
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 */
|
|
@@ -1107,20 +1173,30 @@ type StoreHooks = Readonly<{
|
|
|
1107
1173
|
}>) => void;
|
|
1108
1174
|
/** Called before a CRUD operation starts */
|
|
1109
1175
|
onOperationStart?: (ctx: OperationHookContext) => void;
|
|
1110
|
-
/**
|
|
1176
|
+
/**
|
|
1177
|
+
* Called after a CRUD operation completes AND is durably committed. For a
|
|
1178
|
+
* top-level operation that is when its own transaction commits; for an
|
|
1179
|
+
* operation inside `store.transaction`, emission is deferred until the
|
|
1180
|
+
* enclosing transaction commits — if that commit fails, the operation is
|
|
1181
|
+
* reported through `onError` instead. (Inside an adopted transaction —
|
|
1182
|
+
* `withTransaction` / `withRecordedTransaction` — the commit belongs to
|
|
1183
|
+
* the caller and cannot be observed, so this fires when the operation
|
|
1184
|
+
* completes within the still-open transaction.)
|
|
1185
|
+
*/
|
|
1111
1186
|
onOperationEnd?: (ctx: OperationHookContext, result: Readonly<{
|
|
1112
1187
|
durationMs: number;
|
|
1113
1188
|
}>) => void;
|
|
1114
|
-
/**
|
|
1189
|
+
/**
|
|
1190
|
+
* Called when an operation fails — including an operation that completed
|
|
1191
|
+
* inside a `store.transaction` whose commit then failed and rolled it
|
|
1192
|
+
* back.
|
|
1193
|
+
*/
|
|
1115
1194
|
onError?: (ctx: HookContext, error: Error) => void;
|
|
1116
1195
|
}>;
|
|
1117
|
-
|
|
1118
|
-
* Options for creating a store.
|
|
1119
|
-
*/
|
|
1120
|
-
type StoreOptions = Readonly<{
|
|
1196
|
+
type BaseStoreOptions = Readonly<{
|
|
1121
1197
|
/** Observability hooks for monitoring */
|
|
1122
1198
|
hooks?: StoreHooks;
|
|
1123
|
-
/** SQL schema configuration for custom table names */
|
|
1199
|
+
/** SQL schema configuration from createSqlSchema(...) for custom table names */
|
|
1124
1200
|
schema?: SqlSchema;
|
|
1125
1201
|
/** Query default behaviors. */
|
|
1126
1202
|
queryDefaults?: Readonly<{
|
|
@@ -1128,6 +1204,28 @@ type StoreOptions = Readonly<{
|
|
|
1128
1204
|
traversalExpansion?: TraversalExpansion;
|
|
1129
1205
|
}>;
|
|
1130
1206
|
}>;
|
|
1207
|
+
/**
|
|
1208
|
+
* Store options without built-in recorded-time capture. A recorded read relation
|
|
1209
|
+
* can still be bound explicitly for hosts that populate history externally.
|
|
1210
|
+
*/
|
|
1211
|
+
type LiveStoreOptions = BaseStoreOptions & Readonly<{
|
|
1212
|
+
history?: false | undefined;
|
|
1213
|
+
recordedRead?: ExternalRecordedReadSource | undefined;
|
|
1214
|
+
}>;
|
|
1215
|
+
/**
|
|
1216
|
+
* Store options with TypeGraph-managed recorded-time capture. `history: true`
|
|
1217
|
+
* captures TypeGraph writes and binds TypeGraph's built-in recorded relation
|
|
1218
|
+
* internally. Externally populated recorded read sources are read-only bindings
|
|
1219
|
+
* and are intentionally accepted only by {@link LiveStoreOptions}.
|
|
1220
|
+
*/
|
|
1221
|
+
type HistoryStoreOptions = BaseStoreOptions & Readonly<{
|
|
1222
|
+
history: true;
|
|
1223
|
+
recordedRead?: never;
|
|
1224
|
+
}>;
|
|
1225
|
+
/**
|
|
1226
|
+
* Options for creating a store.
|
|
1227
|
+
*/
|
|
1228
|
+
type StoreOptions = LiveStoreOptions | HistoryStoreOptions;
|
|
1131
1229
|
/**
|
|
1132
1230
|
* A mutable handle to the current `Store`, used by `store.evolve(...)`
|
|
1133
1231
|
* so long-lived consumers can dereference through the ref and pick up
|
|
@@ -1665,15 +1763,7 @@ type GraphEdgeCollections<G extends GraphDef> = {
|
|
|
1665
1763
|
[K in keyof G["edges"] & string]-?: TypedEdgeCollection<G["edges"][K]>;
|
|
1666
1764
|
};
|
|
1667
1765
|
/** 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"];
|
|
1766
|
+
type NodeTemporalReads<N extends NodeType, CN extends string = string> = Pick<NodeCollection<N, CN>, (typeof NODE_TEMPORAL_READ_NAMES)[number]>;
|
|
1677
1767
|
/**
|
|
1678
1768
|
* Current-state-only node reads (constraint / index lookups). No temporal
|
|
1679
1769
|
* axis, so a {@link StoreView} delegates them on a `current` pin and refuses
|
|
@@ -1681,21 +1771,16 @@ declare const CURRENT_ONLY_READ_NAMES: readonly ["findByConstraint", "bulkFindBy
|
|
|
1681
1771
|
*/
|
|
1682
1772
|
type NodeCurrentReads<N extends NodeType, CN extends string = string> = Pick<NodeCollection<N, CN>, (typeof CURRENT_ONLY_READ_NAMES)[number]>;
|
|
1683
1773
|
/** 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">;
|
|
1774
|
+
type NodeWrites<N extends NodeType, CN extends string = string> = Pick<NodeCollection<N, CN>, (typeof NODE_WRITE_NAMES)[number]>;
|
|
1775
|
+
/** Temporal-aware edge reads — a {@link StoreView} pins these. */
|
|
1776
|
+
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
1777
|
/**
|
|
1693
1778
|
* Deferred edge reads for `store.batch()` — absent from a {@link StoreView},
|
|
1694
1779
|
* which has no batch context.
|
|
1695
1780
|
*/
|
|
1696
|
-
type EdgeBatchReads<E extends AnyEdgeType, From extends NodeType = NodeType, To extends NodeType = NodeType> = Pick<EdgeCollection<E, From, To>,
|
|
1781
|
+
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
1782
|
/** 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>,
|
|
1783
|
+
type EdgeWrites<E extends AnyEdgeType, From extends NodeType = NodeType, To extends NodeType = NodeType> = Pick<EdgeCollection<E, From, To>, (typeof EDGE_WRITE_NAMES)[number]>;
|
|
1699
1784
|
/**
|
|
1700
1785
|
* The read-only node surface a {@link StoreView} exposes for one node kind.
|
|
1701
1786
|
* The temporal reads drop the per-call temporal argument — the pin owns the
|
|
@@ -1762,6 +1847,20 @@ type StoreViewNodeCollections<G extends GraphDef> = {
|
|
|
1762
1847
|
type StoreViewEdgeCollections<G extends GraphDef> = {
|
|
1763
1848
|
[K in keyof G["edges"] & string]-?: TypedStoreViewEdgeCollection<G["edges"][K]>;
|
|
1764
1849
|
};
|
|
1850
|
+
/** Recorded-time node point reads for one node kind. */
|
|
1851
|
+
type RecordedStoreViewNodeCollection<N extends NodeType> = Pick<StoreViewNodeCollection<N>, (typeof RECORDED_POINT_READ_NAMES)[number]>;
|
|
1852
|
+
/** Recorded-time edge point reads for one edge kind. */
|
|
1853
|
+
type RecordedStoreViewEdgeCollection<E extends AnyEdgeType, From extends NodeType = NodeType, To extends NodeType = NodeType> = Pick<StoreViewEdgeCollection<E, From, To>, (typeof RECORDED_POINT_READ_NAMES)[number]>;
|
|
1854
|
+
/** Recorded-time edge collection derived from an `EdgeRegistration`. */
|
|
1855
|
+
type TypedRecordedStoreViewEdgeCollection<R extends EdgeRegistration> = RecordedStoreViewEdgeCollection<R["type"], EdgeFromTypes<R> extends NodeType ? EdgeFromTypes<R> : NodeType, EdgeToTypes<R> extends NodeType ? EdgeToTypes<R> : NodeType>;
|
|
1856
|
+
/** Mapped type of all recorded-time node point-read collections. */
|
|
1857
|
+
type RecordedStoreViewNodeCollections<G extends GraphDef> = {
|
|
1858
|
+
[K in keyof G["nodes"] & string]-?: RecordedStoreViewNodeCollection<G["nodes"][K]["type"]>;
|
|
1859
|
+
};
|
|
1860
|
+
/** Mapped type of all recorded-time edge point-read collections. */
|
|
1861
|
+
type RecordedStoreViewEdgeCollections<G extends GraphDef> = {
|
|
1862
|
+
[K in keyof G["edges"] & string]-?: TypedRecordedStoreViewEdgeCollection<G["edges"][K]>;
|
|
1863
|
+
};
|
|
1765
1864
|
/**
|
|
1766
1865
|
* A typed transaction context with collection API.
|
|
1767
1866
|
*
|
|
@@ -1803,6 +1902,12 @@ type StoreViewEdgeCollections<G extends GraphDef> = {
|
|
|
1803
1902
|
* Its type is the `AdoptedTransaction` union; cast to your concrete
|
|
1804
1903
|
* Drizzle database type at the call site.
|
|
1805
1904
|
*
|
|
1905
|
+
* When the store was created with `{ history: true }`, `tx.sql` is present but
|
|
1906
|
+
* replaced by a fail-loud guard because raw SQL would bypass recorded-time
|
|
1907
|
+
* capture. Use the typed `tx.nodes` / `tx.edges` collections inside
|
|
1908
|
+
* `transaction()`, or use `store.withRecordedTransaction(externalTx, fn)` when
|
|
1909
|
+
* the relational layer owns the transaction boundary.
|
|
1910
|
+
*
|
|
1806
1911
|
* @example
|
|
1807
1912
|
* ```typescript
|
|
1808
1913
|
* await store.transaction(async (tx) => {
|
|
@@ -1823,6 +1928,21 @@ type TransactionContext<G extends GraphDef> = Readonly<{
|
|
|
1823
1928
|
* is the store's plain backend — reads work, but there is no snapshot.
|
|
1824
1929
|
*/
|
|
1825
1930
|
backend: TransactionBackend;
|
|
1931
|
+
/**
|
|
1932
|
+
* Runtime string-keyed node collection access, mirroring
|
|
1933
|
+
* `Store.getNodeCollection` — for callers (e.g. provenance) that resolve a
|
|
1934
|
+
* kind dynamically rather than through the static `nodes.<Kind>` property.
|
|
1935
|
+
* Returns `undefined` when `kind` is not registered in this graph.
|
|
1936
|
+
*/
|
|
1937
|
+
getNodeCollection(kind: string): DynamicNodeCollection | undefined;
|
|
1938
|
+
/**
|
|
1939
|
+
* @internal Runs a graph-owned node mutation through this transaction's
|
|
1940
|
+
* operation-hook lifecycle when the mutation cannot use a public collection
|
|
1941
|
+
* verb directly (provenance fact close/reopen). Routed through the
|
|
1942
|
+
* transaction's hook runner, so a successful operation's `onOperationEnd`
|
|
1943
|
+
* is deferred until the transaction commits.
|
|
1944
|
+
*/
|
|
1945
|
+
runNodeOperationHooks<T>(operation: "create" | "update" | "delete", kind: string, id: string, fn: () => Promise<T>): Promise<T>;
|
|
1826
1946
|
}>;
|
|
1827
1947
|
/**
|
|
1828
1948
|
* Replace branded `NodeId` / `EdgeId` with plain `string` in each
|
|
@@ -1949,7 +2069,7 @@ declare class ExecutableAggregateQuery<G extends GraphDef, Aliases extends Alias
|
|
|
1949
2069
|
/**
|
|
1950
2070
|
* Compiles the query to a Drizzle SQL object.
|
|
1951
2071
|
*/
|
|
1952
|
-
compile():
|
|
2072
|
+
compile(): CompiledSelectSql;
|
|
1953
2073
|
/**
|
|
1954
2074
|
* Executes the query and returns typed results.
|
|
1955
2075
|
*
|
|
@@ -1971,7 +2091,7 @@ declare class ExecutableAggregateQuery<G extends GraphDef, Aliases extends Alias
|
|
|
1971
2091
|
type CompileQueryOptions = Readonly<{
|
|
1972
2092
|
/** SQL dialect ("sqlite" or "postgres"). Defaults to "sqlite". */
|
|
1973
2093
|
dialect?: SqlDialect | undefined;
|
|
1974
|
-
/** SQL schema configuration
|
|
2094
|
+
/** SQL schema configuration from createSqlSchema(...). Defaults to standard names. */
|
|
1975
2095
|
schema?: SqlSchema | undefined;
|
|
1976
2096
|
/**
|
|
1977
2097
|
* Fulltext strategy override. When set, overrides the dialect's
|
|
@@ -2000,6 +2120,13 @@ type CompileQueryOptions = Readonly<{
|
|
|
2000
2120
|
* declare the field. Callers build it from the graph's node schemas.
|
|
2001
2121
|
*/
|
|
2002
2122
|
vectorSlots?: VectorSlotMap | undefined;
|
|
2123
|
+
/**
|
|
2124
|
+
* Recorded read relation to use when the AST carries `recordedAsOf`.
|
|
2125
|
+
* Supplying a recorded timestamp without this binding is rejected so the
|
|
2126
|
+
* compiler never silently swaps to TypeGraph's built-in history tables when
|
|
2127
|
+
* the store was only configured for live/valid-time reads.
|
|
2128
|
+
*/
|
|
2129
|
+
recordedReadBinding?: RecordedReadBinding | undefined;
|
|
2003
2130
|
}>;
|
|
2004
2131
|
|
|
2005
2132
|
type PreparedQueryConfig<R> = Readonly<{
|
|
@@ -2116,7 +2243,7 @@ declare class UnionableQuery<G extends GraphDef, R> {
|
|
|
2116
2243
|
/**
|
|
2117
2244
|
* Compiles the set operation to SQL.
|
|
2118
2245
|
*/
|
|
2119
|
-
compile():
|
|
2246
|
+
compile(): CompiledSelectSql;
|
|
2120
2247
|
/**
|
|
2121
2248
|
* Executes the combined query.
|
|
2122
2249
|
*/
|
|
@@ -2208,7 +2335,7 @@ declare class ExecutableQuery<G extends GraphDef, Aliases extends AliasMap, Edge
|
|
|
2208
2335
|
* Returns a Drizzle SQL object that can be executed directly
|
|
2209
2336
|
* with db.all(), db.get(), etc.
|
|
2210
2337
|
*/
|
|
2211
|
-
compile():
|
|
2338
|
+
compile(): CompiledSelectSql;
|
|
2212
2339
|
/**
|
|
2213
2340
|
* Creates a prepared (pre-compiled) query that can be executed
|
|
2214
2341
|
* multiple times with different parameter bindings.
|
|
@@ -2307,7 +2434,7 @@ interface VariableLengthState {
|
|
|
2307
2434
|
* Type parameters track the edge kind and direction to constrain
|
|
2308
2435
|
* which node kinds are valid targets in the `to()` method.
|
|
2309
2436
|
*/
|
|
2310
|
-
declare class TraversalBuilder<G extends GraphDef, Aliases extends AliasMap, EdgeAliases extends EdgeAliasMap =
|
|
2437
|
+
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
2438
|
#private;
|
|
2312
2439
|
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
2440
|
/**
|
|
@@ -2319,14 +2446,14 @@ declare class TraversalBuilder<G extends GraphDef, Aliases extends AliasMap, Edg
|
|
|
2319
2446
|
depth: infer D extends boolean | string;
|
|
2320
2447
|
} ? D : DC, O extends {
|
|
2321
2448
|
path: infer P extends boolean | string;
|
|
2322
|
-
} ? P : PC, RecAliases>;
|
|
2449
|
+
} ? P : PC, RecAliases, CoordinateState>;
|
|
2323
2450
|
/**
|
|
2324
2451
|
* Adds a WHERE clause for the edge being traversed.
|
|
2325
2452
|
*
|
|
2326
2453
|
* @param alias - The edge alias to filter on (must be the current edge alias)
|
|
2327
2454
|
* @param predicateFunction - A function that builds predicates using the edge accessor
|
|
2328
2455
|
*/
|
|
2329
|
-
whereEdge(alias: EA, predicateFunction: (edge: EdgeAccessor<EdgeTypeForKey<G, EK>>) => Predicate): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, Dir, Optional, DC, PC, RecAliases>;
|
|
2456
|
+
whereEdge(alias: EA, predicateFunction: (edge: EdgeAccessor<EdgeTypeForKey<G, EK>>) => Predicate): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, Dir, Optional, DC, PC, RecAliases, CoordinateState>;
|
|
2330
2457
|
/**
|
|
2331
2458
|
* Specifies the target node kind.
|
|
2332
2459
|
*
|
|
@@ -2339,23 +2466,24 @@ declare class TraversalBuilder<G extends GraphDef, Aliases extends AliasMap, Edg
|
|
|
2339
2466
|
*/
|
|
2340
2467
|
to<K extends ValidEdgeTargets<G, EK, Dir>, A extends string>(kind: K, alias: UniqueAlias<A, Aliases>, options?: {
|
|
2341
2468
|
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
|
|
2469
|
+
}): 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
2470
|
to<K extends ValidEdgeTargets<G, EK, Dir>, A extends string>(kind: K, alias: UniqueAlias<A, Aliases>, options: {
|
|
2344
2471
|
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
|
|
2472
|
+
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<NodeType, Optional>>, EdgeAliases & Record<EA, EdgeAlias<G["edges"][EK]["type"], Optional>>, RecAliases & BuildRecursiveAliases<DC, PC, A>, CoordinateState>;
|
|
2346
2473
|
/**
|
|
2347
2474
|
* String-keyed sibling of `to` for runtime-declared target kinds.
|
|
2348
2475
|
* Throws `KindNotFoundError` if the kind is not registered.
|
|
2349
2476
|
*/
|
|
2350
2477
|
toDynamic<A extends string>(kind: string, alias: UniqueAlias<A, Aliases>, options?: {
|
|
2351
2478
|
includeSubClasses?: boolean;
|
|
2352
|
-
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<DynamicNodeType, Optional>>, EdgeAliases & Record<EA, EdgeAlias<EdgeTypeForKey<G, EK>, Optional>>, RecAliases & BuildRecursiveAliases<DC, PC, A
|
|
2479
|
+
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<DynamicNodeType, Optional>>, EdgeAliases & Record<EA, EdgeAlias<EdgeTypeForKey<G, EK>, Optional>>, RecAliases & BuildRecursiveAliases<DC, PC, A>, CoordinateState>;
|
|
2353
2480
|
}
|
|
2354
2481
|
|
|
2355
2482
|
/**
|
|
2356
2483
|
* QueryBuilder - The fluent query builder.
|
|
2357
2484
|
*/
|
|
2358
2485
|
|
|
2486
|
+
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
2487
|
/**
|
|
2360
2488
|
* The fluent query builder.
|
|
2361
2489
|
*
|
|
@@ -2364,8 +2492,9 @@ declare class TraversalBuilder<G extends GraphDef, Aliases extends AliasMap, Edg
|
|
|
2364
2492
|
* - Aliases: Map of alias names to their node kinds
|
|
2365
2493
|
* - EdgeAliases: Map of alias names to their edge kinds (accumulated during traversals)
|
|
2366
2494
|
*/
|
|
2367
|
-
declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap =
|
|
2495
|
+
declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = EmptyAliasMap, EdgeAliases extends EdgeAliasMap = EmptyEdgeAliasMap, RecursiveAliases extends RecursiveAliasMap = EmptyRecursiveAliasMap, CoordinateState extends QueryCoordinateState = "open"> {
|
|
2368
2496
|
#private;
|
|
2497
|
+
readonly temporal: TemporalMethod<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2369
2498
|
constructor(config: QueryBuilderConfig, state: QueryBuilderState);
|
|
2370
2499
|
/**
|
|
2371
2500
|
* Starts a query from a node kind.
|
|
@@ -2375,10 +2504,10 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2375
2504
|
*/
|
|
2376
2505
|
from<K extends keyof G["nodes"] & string, A extends string>(kind: K, alias: UniqueAlias<A, Aliases>, options?: {
|
|
2377
2506
|
includeSubClasses?: false;
|
|
2378
|
-
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<G["nodes"][K]["type"]>>, EdgeAliases, RecursiveAliases>;
|
|
2507
|
+
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<G["nodes"][K]["type"]>>, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2379
2508
|
from<K extends keyof G["nodes"] & string, A extends string>(kind: K, alias: UniqueAlias<A, Aliases>, options: {
|
|
2380
2509
|
includeSubClasses: true;
|
|
2381
|
-
}): QueryBuilder<G, Aliases & Record<A, NodeAlias>, EdgeAliases, RecursiveAliases>;
|
|
2510
|
+
}): QueryBuilder<G, Aliases & Record<A, NodeAlias>, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2382
2511
|
/**
|
|
2383
2512
|
* String-keyed sibling of `from` for runtime-declared kinds. Throws
|
|
2384
2513
|
* `KindNotFoundError` if the kind is not registered. Predicates use
|
|
@@ -2386,18 +2515,18 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2386
2515
|
*/
|
|
2387
2516
|
fromDynamic<A extends string>(kind: string, alias: UniqueAlias<A, Aliases>, options?: {
|
|
2388
2517
|
includeSubClasses?: boolean;
|
|
2389
|
-
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<DynamicNodeType>>, EdgeAliases, RecursiveAliases>;
|
|
2518
|
+
}): QueryBuilder<G, Aliases & Record<A, NodeAlias<DynamicNodeType>>, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2390
2519
|
/**
|
|
2391
2520
|
* Adds a WHERE clause for a node.
|
|
2392
2521
|
*/
|
|
2393
|
-
whereNode<A extends keyof Aliases & string>(alias: A, predicateFunction: (n: NodeAccessor<Aliases[A]["type"]>) => Predicate): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2522
|
+
whereNode<A extends keyof Aliases & string>(alias: A, predicateFunction: (n: NodeAccessor<Aliases[A]["type"]>) => Predicate): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2394
2523
|
/**
|
|
2395
2524
|
* Adds a WHERE clause for an edge.
|
|
2396
2525
|
*
|
|
2397
2526
|
* @param alias - The edge alias to filter on
|
|
2398
2527
|
* @param predicateFunction - A function that builds predicates using the edge accessor
|
|
2399
2528
|
*/
|
|
2400
|
-
whereEdge<EA extends keyof EdgeAliases & string>(alias: EA, predicateFunction: (edge: EdgeAccessor<EdgeAliases[EA]["type"]>) => Predicate): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2529
|
+
whereEdge<EA extends keyof EdgeAliases & string>(alias: EA, predicateFunction: (edge: EdgeAccessor<EdgeAliases[EA]["type"]>) => Predicate): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2401
2530
|
/**
|
|
2402
2531
|
* Traverses an edge to another node (outgoing direction).
|
|
2403
2532
|
*
|
|
@@ -2411,7 +2540,7 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2411
2540
|
direction?: "out";
|
|
2412
2541
|
expand?: TraversalExpansion;
|
|
2413
2542
|
from?: keyof Aliases & string;
|
|
2414
|
-
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "out", false, false, false, RecursiveAliases>;
|
|
2543
|
+
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "out", false, false, false, RecursiveAliases, CoordinateState>;
|
|
2415
2544
|
/**
|
|
2416
2545
|
* Traverses an edge to another node (incoming direction).
|
|
2417
2546
|
*
|
|
@@ -2426,7 +2555,7 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2426
2555
|
direction: "in";
|
|
2427
2556
|
expand?: TraversalExpansion;
|
|
2428
2557
|
from?: keyof Aliases & string;
|
|
2429
|
-
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "in", false, false, false, RecursiveAliases>;
|
|
2558
|
+
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "in", false, false, false, RecursiveAliases, CoordinateState>;
|
|
2430
2559
|
/**
|
|
2431
2560
|
* String-keyed sibling of `traverse` for runtime-declared edge kinds.
|
|
2432
2561
|
* Throws `KindNotFoundError` if the edge kind is not registered.
|
|
@@ -2435,7 +2564,7 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2435
2564
|
direction?: TraversalDirection$1;
|
|
2436
2565
|
expand?: TraversalExpansion;
|
|
2437
2566
|
from?: keyof Aliases & string;
|
|
2438
|
-
}): TraversalBuilder<G, Aliases, EdgeAliases & Record<EA, EdgeAlias<DynamicEdgeType>>, string, EA, TraversalDirection$1, false, false, false, RecursiveAliases>;
|
|
2567
|
+
}): TraversalBuilder<G, Aliases, EdgeAliases & Record<EA, EdgeAlias<DynamicEdgeType>>, string, EA, TraversalDirection$1, false, false, false, RecursiveAliases, CoordinateState>;
|
|
2439
2568
|
/**
|
|
2440
2569
|
* Optionally traverses an edge to another node (LEFT JOIN semantics).
|
|
2441
2570
|
* If no matching edge/node exists, the result will include null values.
|
|
@@ -2451,12 +2580,12 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2451
2580
|
direction?: "out";
|
|
2452
2581
|
expand?: TraversalExpansion;
|
|
2453
2582
|
from?: keyof Aliases & string;
|
|
2454
|
-
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "out", true, false, false, RecursiveAliases>;
|
|
2583
|
+
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "out", true, false, false, RecursiveAliases, CoordinateState>;
|
|
2455
2584
|
optionalTraverse<EK extends keyof G["edges"] & string, EA extends string>(edgeKind: EK, edgeAlias: EA, options: {
|
|
2456
2585
|
direction: "in";
|
|
2457
2586
|
expand?: TraversalExpansion;
|
|
2458
2587
|
from?: keyof Aliases & string;
|
|
2459
|
-
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "in", true, false, false, RecursiveAliases>;
|
|
2588
|
+
}): TraversalBuilder<G, Aliases, EdgeAliases, EK, EA, "in", true, false, false, RecursiveAliases, CoordinateState>;
|
|
2460
2589
|
/**
|
|
2461
2590
|
* String-keyed sibling of `optionalTraverse` for runtime-declared edge
|
|
2462
2591
|
* kinds. LEFT JOIN semantics — non-matching rows produce a null edge
|
|
@@ -2467,7 +2596,7 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2467
2596
|
direction?: TraversalDirection$1;
|
|
2468
2597
|
expand?: TraversalExpansion;
|
|
2469
2598
|
from?: keyof Aliases & string;
|
|
2470
|
-
}): TraversalBuilder<G, Aliases, EdgeAliases & Record<EA, EdgeAlias<DynamicEdgeType, true>>, string, EA, TraversalDirection$1, true, false, false, RecursiveAliases>;
|
|
2599
|
+
}): TraversalBuilder<G, Aliases, EdgeAliases & Record<EA, EdgeAlias<DynamicEdgeType, true>>, string, EA, TraversalDirection$1, true, false, false, RecursiveAliases, CoordinateState>;
|
|
2471
2600
|
/**
|
|
2472
2601
|
* Selects fields to return.
|
|
2473
2602
|
*/
|
|
@@ -2482,27 +2611,15 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2482
2611
|
/**
|
|
2483
2612
|
* Orders results.
|
|
2484
2613
|
*/
|
|
2485
|
-
orderBy<A extends (keyof Aliases | keyof EdgeAliases) & string>(alias: A, field: string, direction?: SortDirection): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2614
|
+
orderBy<A extends (keyof Aliases | keyof EdgeAliases) & string>(alias: A, field: string, direction?: SortDirection): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2486
2615
|
/**
|
|
2487
2616
|
* Limits the number of results.
|
|
2488
2617
|
*/
|
|
2489
|
-
limit(n: number): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2618
|
+
limit(n: number): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2490
2619
|
/**
|
|
2491
2620
|
* Offsets the results.
|
|
2492
2621
|
*/
|
|
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>;
|
|
2622
|
+
offset(n: number): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2506
2623
|
/**
|
|
2507
2624
|
* Groups results by the specified field.
|
|
2508
2625
|
* Use with aggregate functions like COUNT, SUM, AVG in select().
|
|
@@ -2510,21 +2627,21 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2510
2627
|
* @param alias - The node alias to group by
|
|
2511
2628
|
* @param field - The field name to group by
|
|
2512
2629
|
*/
|
|
2513
|
-
groupBy<A extends keyof Aliases & string>(alias: A, field: string): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2630
|
+
groupBy<A extends keyof Aliases & string>(alias: A, field: string): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2514
2631
|
/**
|
|
2515
2632
|
* Groups results by the node ID.
|
|
2516
2633
|
* Use when you want to group by a complete node rather than a specific field.
|
|
2517
2634
|
*
|
|
2518
2635
|
* @param alias - The node alias to group by (uses the node's ID)
|
|
2519
2636
|
*/
|
|
2520
|
-
groupByNode<A extends keyof Aliases & string>(alias: A): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2637
|
+
groupByNode<A extends keyof Aliases & string>(alias: A): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2521
2638
|
/**
|
|
2522
2639
|
* Filters grouped results using aggregate conditions (HAVING clause).
|
|
2523
2640
|
* Use after groupBy() to filter based on aggregate values.
|
|
2524
2641
|
*
|
|
2525
2642
|
* @param predicate - A predicate expression to filter groups
|
|
2526
2643
|
*/
|
|
2527
|
-
having(predicate: PredicateExpression): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2644
|
+
having(predicate: PredicateExpression): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2528
2645
|
/**
|
|
2529
2646
|
* Sets fusion parameters for hybrid (vector + fulltext) queries.
|
|
2530
2647
|
*
|
|
@@ -2548,7 +2665,7 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2548
2665
|
* .execute();
|
|
2549
2666
|
* ```
|
|
2550
2667
|
*/
|
|
2551
|
-
fuseWith(options: HybridFusionOptions): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases>;
|
|
2668
|
+
fuseWith(options: HybridFusionOptions): QueryBuilder<G, Aliases, EdgeAliases, RecursiveAliases, CoordinateState>;
|
|
2552
2669
|
/**
|
|
2553
2670
|
* Applies a query fragment to transform this builder.
|
|
2554
2671
|
*
|
|
@@ -2574,9 +2691,22 @@ declare class QueryBuilder<G extends GraphDef, Aliases extends AliasMap = {}, Ed
|
|
|
2574
2691
|
* @param fragment - A function that transforms the builder
|
|
2575
2692
|
* @returns The transformed builder
|
|
2576
2693
|
*/
|
|
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>;
|
|
2694
|
+
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
2695
|
}
|
|
2579
2696
|
|
|
2697
|
+
/**
|
|
2698
|
+
* Fluent query builder for TypeGraph.
|
|
2699
|
+
*
|
|
2700
|
+
* Provides a type-safe, chainable API for building queries.
|
|
2701
|
+
* Each method returns a new builder instance with expanded type information.
|
|
2702
|
+
*
|
|
2703
|
+
* This module re-exports from the builder submodules and provides the
|
|
2704
|
+
* createQueryBuilder factory function.
|
|
2705
|
+
*/
|
|
2706
|
+
|
|
2707
|
+
type InitialQueryBuilder<G extends GraphDef, CoordinateState extends QueryCoordinateState = "open"> = QueryBuilder<G, EmptyAliasMap, EmptyEdgeAliasMap, EmptyRecursiveAliasMap, CoordinateState>;
|
|
2708
|
+
declare function createQueryBuilder<G extends GraphDef>(graphId: string, registry: KindRegistry, options?: CreateQueryBuilderOptions): InitialQueryBuilder<G>;
|
|
2709
|
+
|
|
2580
2710
|
/**
|
|
2581
2711
|
* Shared types for Tier 1 graph algorithms.
|
|
2582
2712
|
*
|
|
@@ -2612,7 +2742,7 @@ type AlgorithmCyclePolicy = RecursiveCyclePolicy;
|
|
|
2612
2742
|
* mode. If neither option is supplied, the algorithm falls back to
|
|
2613
2743
|
* `graph.defaults.temporalMode`.
|
|
2614
2744
|
*/
|
|
2615
|
-
type TemporalAlgorithmOptions = Readonly<{
|
|
2745
|
+
type TemporalAlgorithmOptions = NoRecordedCoordinate & Readonly<{
|
|
2616
2746
|
/** Temporal mode. Defaults to the graph's configured default. */
|
|
2617
2747
|
temporalMode?: TemporalMode;
|
|
2618
2748
|
/**
|
|
@@ -2621,6 +2751,9 @@ type TemporalAlgorithmOptions = Readonly<{
|
|
|
2621
2751
|
*/
|
|
2622
2752
|
asOf?: string;
|
|
2623
2753
|
}>;
|
|
2754
|
+
type InternalTemporalAlgorithmOptions = Omit<TemporalAlgorithmOptions, "recordedAsOf"> & Readonly<{
|
|
2755
|
+
recordedAsOf?: RecordedInstant;
|
|
2756
|
+
}>;
|
|
2624
2757
|
/**
|
|
2625
2758
|
* Base options for traversal-style algorithms.
|
|
2626
2759
|
*/
|
|
@@ -2637,6 +2770,7 @@ type BaseTraversalOptions<G extends GraphDef> = TemporalAlgorithmOptions & Reado
|
|
|
2637
2770
|
/** Cycle policy (default: `"prevent"`). */
|
|
2638
2771
|
cyclePolicy?: AlgorithmCyclePolicy;
|
|
2639
2772
|
}>;
|
|
2773
|
+
type InternalBaseTraversalOptions<G extends GraphDef> = InternalTemporalAlgorithmOptions & Omit<BaseTraversalOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
2640
2774
|
/**
|
|
2641
2775
|
* A node reached during traversal, annotated with the shortest depth at which
|
|
2642
2776
|
* it was first discovered.
|
|
@@ -2669,6 +2803,7 @@ type ShortestPathResult = Readonly<{
|
|
|
2669
2803
|
* care about the first time a target is reached.
|
|
2670
2804
|
*/
|
|
2671
2805
|
type ShortestPathOptions<G extends GraphDef> = BaseTraversalOptions<G>;
|
|
2806
|
+
type InternalShortestPathOptions<G extends GraphDef> = InternalBaseTraversalOptions<G>;
|
|
2672
2807
|
/**
|
|
2673
2808
|
* Options for `reachable`.
|
|
2674
2809
|
*
|
|
@@ -2680,6 +2815,7 @@ type ReachableOptions<G extends GraphDef> = BaseTraversalOptions<G> & Readonly<{
|
|
|
2680
2815
|
/** Exclude the source node from the result set (default: `false`). */
|
|
2681
2816
|
excludeSource?: boolean;
|
|
2682
2817
|
}>;
|
|
2818
|
+
type InternalReachableOptions<G extends GraphDef> = InternalBaseTraversalOptions<G> & Omit<ReachableOptions<G>, keyof BaseTraversalOptions<G>>;
|
|
2683
2819
|
/**
|
|
2684
2820
|
* Options for `neighbors`.
|
|
2685
2821
|
*
|
|
@@ -2697,6 +2833,7 @@ type NeighborsOptions<G extends GraphDef> = TemporalAlgorithmOptions & Readonly<
|
|
|
2697
2833
|
/** Cycle policy (default: `"prevent"`). */
|
|
2698
2834
|
cyclePolicy?: AlgorithmCyclePolicy;
|
|
2699
2835
|
}>;
|
|
2836
|
+
type InternalNeighborsOptions<G extends GraphDef> = InternalTemporalAlgorithmOptions & Omit<NeighborsOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
2700
2837
|
/**
|
|
2701
2838
|
* Options for `degree`.
|
|
2702
2839
|
*
|
|
@@ -2712,6 +2849,7 @@ type DegreeOptions<G extends GraphDef> = TemporalAlgorithmOptions & Readonly<{
|
|
|
2712
2849
|
/** Direction (default: `"both"`). */
|
|
2713
2850
|
direction?: TraversalDirection;
|
|
2714
2851
|
}>;
|
|
2852
|
+
type InternalDegreeOptions<G extends GraphDef> = InternalTemporalAlgorithmOptions & Omit<DegreeOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
2715
2853
|
|
|
2716
2854
|
/**
|
|
2717
2855
|
* Raw node id or any object with an `id: string` field. Covers `Node`,
|
|
@@ -2769,6 +2907,13 @@ type GraphAlgorithms<G extends GraphDef> = Readonly<{
|
|
|
2769
2907
|
*/
|
|
2770
2908
|
degree: (node: NodeIdentifier, options?: DegreeOptions<G>) => Promise<number>;
|
|
2771
2909
|
}>;
|
|
2910
|
+
type InternalGraphAlgorithms<G extends GraphDef> = Readonly<{
|
|
2911
|
+
shortestPath: (from: NodeIdentifier, to: NodeIdentifier, options: InternalShortestPathOptions<G>) => Promise<ShortestPathResult | undefined>;
|
|
2912
|
+
reachable: (from: NodeIdentifier, options: InternalReachableOptions<G>) => Promise<readonly ReachableNode[]>;
|
|
2913
|
+
canReach: (from: NodeIdentifier, to: NodeIdentifier, options: InternalBaseTraversalOptions<G>) => Promise<boolean>;
|
|
2914
|
+
neighbors: (node: NodeIdentifier, options: InternalNeighborsOptions<G>) => Promise<readonly ReachableNode[]>;
|
|
2915
|
+
degree: (node: NodeIdentifier, options?: InternalDegreeOptions<G>) => Promise<number>;
|
|
2916
|
+
}>;
|
|
2772
2917
|
|
|
2773
2918
|
type RebuildFulltextOptions = Readonly<{
|
|
2774
2919
|
/** Page size. Must be a positive integer. Default: 500. */
|
|
@@ -3131,17 +3276,6 @@ type UniqueIntrospection = Readonly<{
|
|
|
3131
3276
|
collation: Collation;
|
|
3132
3277
|
}>;
|
|
3133
3278
|
|
|
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
3279
|
type MaterializeRemovalsOptions = Readonly<{
|
|
3146
3280
|
/** Restrict to specific kind names. */
|
|
3147
3281
|
kinds?: readonly string[];
|
|
@@ -3295,6 +3429,8 @@ type SubgraphOptions<G extends GraphDef, EK extends EdgeKinds<G>, NK extends Nod
|
|
|
3295
3429
|
temporalMode?: TemporalMode;
|
|
3296
3430
|
/** ISO-8601 timestamp used when `temporalMode === "asOf"`. */
|
|
3297
3431
|
asOf?: string;
|
|
3432
|
+
/** @internal Recorded coordinates are supplied by StoreView only. */
|
|
3433
|
+
recordedAsOf?: never;
|
|
3298
3434
|
/**
|
|
3299
3435
|
* Optional field-level projection per node/edge kind.
|
|
3300
3436
|
*
|
|
@@ -3307,6 +3443,16 @@ type SubgraphOptions<G extends GraphDef, EK extends EdgeKinds<G>, NK extends Nod
|
|
|
3307
3443
|
*/
|
|
3308
3444
|
project?: P;
|
|
3309
3445
|
}>;
|
|
3446
|
+
/**
|
|
3447
|
+
* Subgraph options as seen by the internal executor: identical to the public
|
|
3448
|
+
* {@link SubgraphOptions} except the recorded/system-time pin is a branded
|
|
3449
|
+
* instant the StoreView seam supplies. The public surface keeps
|
|
3450
|
+
* `recordedAsOf?: never`;
|
|
3451
|
+
* recorded reads reach the executor only through `store.subgraphAtCoordinate`.
|
|
3452
|
+
*/
|
|
3453
|
+
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<{
|
|
3454
|
+
recordedAsOf?: RecordedInstant;
|
|
3455
|
+
}>;
|
|
3310
3456
|
/**
|
|
3311
3457
|
* Union of all node result types in a subgraph, respecting projection.
|
|
3312
3458
|
*/
|
|
@@ -3414,6 +3560,18 @@ declare class Store<G extends GraphDef> {
|
|
|
3414
3560
|
get registry(): KindRegistry;
|
|
3415
3561
|
/** The database backend */
|
|
3416
3562
|
get backend(): GraphBackend;
|
|
3563
|
+
/**
|
|
3564
|
+
* Whether recorded-time capture is enabled for this store.
|
|
3565
|
+
*
|
|
3566
|
+
* @internal
|
|
3567
|
+
*/
|
|
3568
|
+
get historyEnabled(): boolean;
|
|
3569
|
+
/**
|
|
3570
|
+
* Whether this store has a recorded read relation bound for reconstruction.
|
|
3571
|
+
*
|
|
3572
|
+
* @internal
|
|
3573
|
+
*/
|
|
3574
|
+
get recordedReadBound(): boolean;
|
|
3417
3575
|
/**
|
|
3418
3576
|
* Node collections for ergonomic CRUD operations.
|
|
3419
3577
|
*
|
|
@@ -3554,14 +3712,43 @@ declare class Store<G extends GraphDef> {
|
|
|
3554
3712
|
* .execute();
|
|
3555
3713
|
* ```
|
|
3556
3714
|
*/
|
|
3557
|
-
query():
|
|
3715
|
+
query(): InitialQueryBuilder<G, "open">;
|
|
3558
3716
|
/**
|
|
3559
3717
|
* Internal seam for {@link StoreView.query}: a query builder pinned to a
|
|
3560
3718
|
* view's {@link ReadCoordinate} with its temporal axis sealed
|
|
3561
3719
|
* (`.temporal()` throws). Not part of the stable public API — construct a
|
|
3562
3720
|
* view via {@link Store.view} / {@link Store.asOf} and call `.query()`.
|
|
3563
3721
|
*/
|
|
3564
|
-
sealedQuery(coordinate: ReadCoordinate):
|
|
3722
|
+
sealedQuery(coordinate: ReadCoordinate): InitialQueryBuilder<G, "sealed">;
|
|
3723
|
+
/**
|
|
3724
|
+
* Internal seam for {@link RecordedStoreView}: reconstruct a node point read
|
|
3725
|
+
* from the recorded-time relation while preserving live getById ordering and
|
|
3726
|
+
* duplicate-input behavior.
|
|
3727
|
+
*
|
|
3728
|
+
* @internal
|
|
3729
|
+
*/
|
|
3730
|
+
recordedNodeGetById<N extends NodeType>(kind: string, id: NodeId<N>, coordinate: ReadCoordinate): Promise<Node<N> | undefined>;
|
|
3731
|
+
/**
|
|
3732
|
+
* Internal seam for {@link RecordedStoreView}: reconstruct node point reads
|
|
3733
|
+
* from the recorded-time relation while preserving input order.
|
|
3734
|
+
*
|
|
3735
|
+
* @internal
|
|
3736
|
+
*/
|
|
3737
|
+
recordedNodeGetByIds<N extends NodeType>(kind: string, ids: readonly NodeId<N>[], coordinate: ReadCoordinate): Promise<readonly (Node<N> | undefined)[]>;
|
|
3738
|
+
/**
|
|
3739
|
+
* Internal seam for {@link RecordedStoreView}: reconstruct an edge point read
|
|
3740
|
+
* from the recorded-time relation while preserving live getById behavior.
|
|
3741
|
+
*
|
|
3742
|
+
* @internal
|
|
3743
|
+
*/
|
|
3744
|
+
recordedEdgeGetById<E extends AnyEdgeType>(kind: string, id: EdgeId<E>, coordinate: ReadCoordinate): Promise<Edge<E> | undefined>;
|
|
3745
|
+
/**
|
|
3746
|
+
* Internal seam for {@link RecordedStoreView}: reconstruct edge point reads
|
|
3747
|
+
* from the recorded-time relation while preserving input order.
|
|
3748
|
+
*
|
|
3749
|
+
* @internal
|
|
3750
|
+
*/
|
|
3751
|
+
recordedEdgeGetByIds<E extends AnyEdgeType>(kind: string, ids: readonly EdgeId<E>[], coordinate: ReadCoordinate): Promise<readonly (Edge<E> | undefined)[]>;
|
|
3565
3752
|
/**
|
|
3566
3753
|
* Returns a read-only {@link StoreView} pinned to a valid-time instant.
|
|
3567
3754
|
*
|
|
@@ -3585,6 +3772,47 @@ declare class Store<G extends GraphDef> {
|
|
|
3585
3772
|
* @param asOf - ISO-8601 timestamp to pin the valid-time coordinate to.
|
|
3586
3773
|
*/
|
|
3587
3774
|
asOf(asOf: string): StoreView<G>;
|
|
3775
|
+
/**
|
|
3776
|
+
* Returns a narrow read-only view pinned to a recorded/system-time instant.
|
|
3777
|
+
*
|
|
3778
|
+
* Direct `store.asOfRecorded(T)` is diagonal bitemporal sugar: it reads the
|
|
3779
|
+
* recorded-time relation as of `T` and uses the same `T` for the valid-time
|
|
3780
|
+
* axis. Use `store.asOf(validT).asOfRecorded(recordedT)` when the valid and
|
|
3781
|
+
* recorded axes should differ.
|
|
3782
|
+
*
|
|
3783
|
+
* The returned view exposes only reconstructing-safe reads: query,
|
|
3784
|
+
* subgraph, graph algorithms, and collection point reads.
|
|
3785
|
+
*
|
|
3786
|
+
* Prefer `await store.recordedNow()` as the anchor over a wall-clock
|
|
3787
|
+
* timestamp: recorded instants are monotonic and can run briefly ahead of the
|
|
3788
|
+
* wall clock under bursty writes, so a `new Date().toISOString()` passed here
|
|
3789
|
+
* may sort before the most recent commits and silently omit them.
|
|
3790
|
+
*/
|
|
3791
|
+
asOfRecorded(recordedAsOf: RecordedInstant): RecordedStoreView<G>;
|
|
3792
|
+
/**
|
|
3793
|
+
* Returns the latest recorded-time instant captured for this graph — the
|
|
3794
|
+
* recorded high-water mark. After guarding the `undefined` case,
|
|
3795
|
+
* `store.asOfRecorded(checkpoint)` reconstructs everything committed so far, a
|
|
3796
|
+
* deterministic anchor that avoids guessing with the wall clock (recorded
|
|
3797
|
+
* instants are monotonic and can run briefly ahead of wall-clock time under
|
|
3798
|
+
* bursty writes). Capture each anchor right after the writes it should cover.
|
|
3799
|
+
*
|
|
3800
|
+
* Returns `undefined` until the first write has been captured, so on a
|
|
3801
|
+
* brand-new graph guard the composition — `asOfRecorded(undefined)` rejects
|
|
3802
|
+
* (an instant is required) rather than reconstructing an empty view. Read the
|
|
3803
|
+
* value first and only pass it to `asOfRecorded` once it is defined.
|
|
3804
|
+
*
|
|
3805
|
+
* **Graph-global, not caller-scoped.** This is the single high-water mark for
|
|
3806
|
+
* the whole graph, advanced by every committed capture from any writer — not
|
|
3807
|
+
* a per-write or per-caller value. An advance between two reads means
|
|
3808
|
+
* "something committed to this graph in between," *not* "the write this caller
|
|
3809
|
+
* just made landed." Do not use a `recordedNow()` advance as a "did my write
|
|
3810
|
+
* succeed?" signal: under any concurrent writer to the same graph it both
|
|
3811
|
+
* misses dropped writes and misfires on no-op writes. Confirm a specific write
|
|
3812
|
+
* by observing the write itself (its return value, or `store.transaction(...)`
|
|
3813
|
+
* success), not the global clock.
|
|
3814
|
+
*/
|
|
3815
|
+
recordedNow(): Promise<RecordedInstant | undefined>;
|
|
3588
3816
|
/**
|
|
3589
3817
|
* Returns a read-only {@link StoreView} pinned to an arbitrary public
|
|
3590
3818
|
* temporal mode. Use {@link Store.asOf} for the common valid-time case;
|
|
@@ -3714,6 +3942,21 @@ declare class Store<G extends GraphDef> {
|
|
|
3714
3942
|
* ```
|
|
3715
3943
|
*/
|
|
3716
3944
|
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>>;
|
|
3945
|
+
/**
|
|
3946
|
+
* Internal seam for {@link StoreView} / {@link RecordedStoreView}: runs a
|
|
3947
|
+
* subgraph with a coordinate already flattened into the options (including a
|
|
3948
|
+
* recorded/system-time pin). Trusted caller — the public {@link Store.subgraph}
|
|
3949
|
+
* is the guarded entry point.
|
|
3950
|
+
*
|
|
3951
|
+
* @internal
|
|
3952
|
+
*/
|
|
3953
|
+
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>>;
|
|
3954
|
+
/**
|
|
3955
|
+
* Internal seam for StoreView graph algorithms at a pinned coordinate.
|
|
3956
|
+
*
|
|
3957
|
+
* @internal
|
|
3958
|
+
*/
|
|
3959
|
+
algorithmsAtCoordinate(coordinate: ReadCoordinate): InternalGraphAlgorithms<G>;
|
|
3717
3960
|
/**
|
|
3718
3961
|
* Executes a function within a transaction.
|
|
3719
3962
|
*
|
|
@@ -3726,6 +3969,10 @@ declare class Store<G extends GraphDef> {
|
|
|
3726
3969
|
* {@link Store.withTransaction}). See {@link TransactionContext}
|
|
3727
3970
|
* for per-backend semantics; it is `undefined` only on the
|
|
3728
3971
|
* non-transactional fallback.
|
|
3972
|
+
* When the store was created with `{ history: true }`, `tx.sql` is
|
|
3973
|
+
* replaced by a fail-loud guard because raw SQL would bypass
|
|
3974
|
+
* recorded-time capture; use the typed collections inside
|
|
3975
|
+
* `transaction()` or {@link Store.withRecordedTransaction}.
|
|
3729
3976
|
*
|
|
3730
3977
|
* @example
|
|
3731
3978
|
* ```typescript
|
|
@@ -3769,8 +4016,11 @@ declare class Store<G extends GraphDef> {
|
|
|
3769
4016
|
* @param options Optional {@link TransactionOptions} forwarded to the
|
|
3770
4017
|
* backend (e.g. `isolationLevel: "serializable"` on Postgres). Backends
|
|
3771
4018
|
* without isolation-level support ignore it; the non-transactional
|
|
3772
|
-
* fallback ignores it entirely.
|
|
4019
|
+
* fallback ignores it entirely. Stores created with `{ history: true }`
|
|
4020
|
+
* require read-committed semantics for PostgreSQL recorded-clock capture and
|
|
4021
|
+
* reject stronger snapshot isolation levels.
|
|
3773
4022
|
*/
|
|
4023
|
+
transaction<T>(this: HistoryStore<G>, fn: (tx: HistoryTransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
3774
4024
|
transaction<T>(fn: (tx: TransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
3775
4025
|
/**
|
|
3776
4026
|
* Adopts a caller-owned, already-open Drizzle transaction so the graph
|
|
@@ -3814,9 +4064,18 @@ declare class Store<G extends GraphDef> {
|
|
|
3814
4064
|
* }); // one COMMIT / ROLLBACK across both layers
|
|
3815
4065
|
* ```
|
|
3816
4066
|
*
|
|
3817
|
-
*
|
|
3818
|
-
*
|
|
3819
|
-
*
|
|
4067
|
+
* Not available when the store was created with `{ history: true }`: a
|
|
4068
|
+
* caller-owned transaction context would let writes happen after capture has
|
|
4069
|
+
* lost its flush point, so this throws `ConfigurationError`
|
|
4070
|
+
* (`RECORDED_CAPTURE_REQUIRES_CALLBACK_TRANSACTION`). Use
|
|
4071
|
+
* {@link Store.withRecordedTransaction} on a history-enabled store, which
|
|
4072
|
+
* adopts the same external transaction but flushes recorded-time capture
|
|
4073
|
+
* before the caller commits.
|
|
4074
|
+
*
|
|
4075
|
+
* @throws {ConfigurationError} when the store has history capture enabled
|
|
4076
|
+
* (use {@link Store.withRecordedTransaction} instead), or when the backend
|
|
4077
|
+
* cannot adopt an external transaction — either it is not a Drizzle
|
|
4078
|
+
* Postgres/SQLite backend, or `backend.capabilities.transactions` is `false`
|
|
3820
4079
|
* (`drizzle-orm/neon-http`, Cloudflare D1, SQLite
|
|
3821
4080
|
* `transactionMode: "none"`). A non-atomic fallback is deliberately
|
|
3822
4081
|
* not offered here: the caller's relational write *would* still
|
|
@@ -3828,6 +4087,20 @@ declare class Store<G extends GraphDef> {
|
|
|
3828
4087
|
* without emitting any DDL.
|
|
3829
4088
|
*/
|
|
3830
4089
|
withTransaction(externalTx: AdoptedTransaction): TransactionContext<G>;
|
|
4090
|
+
/**
|
|
4091
|
+
* Adopts a caller-owned transaction while giving recorded-time capture a
|
|
4092
|
+
* flush point before the caller commits. Required when `history: true` is
|
|
4093
|
+
* enabled because returning a long-lived transaction context would let writes
|
|
4094
|
+
* happen after TypeGraph has lost the chance to close/open recorded rows.
|
|
4095
|
+
*
|
|
4096
|
+
* Capture flushes once, when `fn` resolves. The flush seals the capture
|
|
4097
|
+
* session, so a graph write made through the transaction context *after* `fn`
|
|
4098
|
+
* returns (e.g. retaining `tx` and writing once more before the caller's
|
|
4099
|
+
* COMMIT) throws rather than committing uncaptured — the post-flush write
|
|
4100
|
+
* cannot silently diverge history from live state.
|
|
4101
|
+
*/
|
|
4102
|
+
withRecordedTransaction<T>(this: HistoryStore<G>, externalTx: AdoptedTransaction, fn: (tx: HistoryTransactionContext<G>) => Promise<T>): Promise<T>;
|
|
4103
|
+
withRecordedTransaction<T>(externalTx: AdoptedTransaction, fn: (tx: TransactionContext<G>) => Promise<T>): Promise<T>;
|
|
3831
4104
|
/**
|
|
3832
4105
|
* Hard-deletes all data for this graph from the database.
|
|
3833
4106
|
*
|
|
@@ -4073,6 +4346,29 @@ declare class Store<G extends GraphDef> {
|
|
|
4073
4346
|
*/
|
|
4074
4347
|
close(): Promise<void>;
|
|
4075
4348
|
}
|
|
4349
|
+
type HistorySafeBackend = Omit<GraphBackend, "executeStatement" | "executeDdl"> & Readonly<{
|
|
4350
|
+
executeStatement?: never;
|
|
4351
|
+
executeDdl?: never;
|
|
4352
|
+
}>;
|
|
4353
|
+
type HistorySafeTransactionBackend = Omit<TransactionBackend, "executeStatement" | "executeDdl"> & Readonly<{
|
|
4354
|
+
executeStatement?: never;
|
|
4355
|
+
executeDdl?: never;
|
|
4356
|
+
}>;
|
|
4357
|
+
type HistoryTransactionContext<G extends GraphDef> = Omit<TransactionContext<G>, "backend" | "sql"> & Readonly<{
|
|
4358
|
+
backend: HistorySafeTransactionBackend;
|
|
4359
|
+
sql?: never;
|
|
4360
|
+
}>;
|
|
4361
|
+
type RecordedReadStore<G extends GraphDef> = Store<G> & Readonly<{
|
|
4362
|
+
recordedReadBound: true;
|
|
4363
|
+
}>;
|
|
4364
|
+
type HistoryStore<G extends GraphDef> = Store<G> & Readonly<{
|
|
4365
|
+
backend: HistorySafeBackend;
|
|
4366
|
+
historyEnabled: true;
|
|
4367
|
+
recordedReadBound: true;
|
|
4368
|
+
}>;
|
|
4369
|
+
type ExplicitRecordedReadLiveOptions = LiveStoreOptions & Readonly<{
|
|
4370
|
+
recordedRead: NonNullable<LiveStoreOptions["recordedRead"]>;
|
|
4371
|
+
}>;
|
|
4076
4372
|
/**
|
|
4077
4373
|
* Creates a new Store instance.
|
|
4078
4374
|
*
|
|
@@ -4102,6 +4398,8 @@ declare class Store<G extends GraphDef> {
|
|
|
4102
4398
|
* });
|
|
4103
4399
|
* ```
|
|
4104
4400
|
*/
|
|
4401
|
+
declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: HistoryStoreOptions): HistoryStore<G>;
|
|
4402
|
+
declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: ExplicitRecordedReadLiveOptions): RecordedReadStore<G>;
|
|
4105
4403
|
declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend, options?: StoreOptions): Store<G>;
|
|
4106
4404
|
|
|
4107
4405
|
/**
|
|
@@ -4132,6 +4430,8 @@ declare function createStore<G extends GraphDef>(graph: G, backend: GraphBackend
|
|
|
4132
4430
|
* }
|
|
4133
4431
|
* ```
|
|
4134
4432
|
*/
|
|
4433
|
+
declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options: HistoryStoreOptions & SchemaManagerOptions): Promise<[HistoryStore<G>, SchemaValidationResult]>;
|
|
4434
|
+
declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options: ExplicitRecordedReadLiveOptions & SchemaManagerOptions): Promise<[RecordedReadStore<G>, SchemaValidationResult]>;
|
|
4135
4435
|
declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: GraphBackend, options?: StoreOptions & SchemaManagerOptions): Promise<[Store<G>, SchemaValidationResult]>;
|
|
4136
4436
|
/**
|
|
4137
4437
|
* Creates a Store after **verifying** that the database is at the same
|
|
@@ -4174,6 +4474,8 @@ declare function createStoreWithSchema<G extends GraphDef>(graph: G, backend: Gr
|
|
|
4174
4474
|
* @throws StoreNotInitializedError if runtime-contribution markers are
|
|
4175
4475
|
* missing/stale/failed for this graph on this connection.
|
|
4176
4476
|
*/
|
|
4477
|
+
declare function createVerifiedStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: HistoryStoreOptions): Promise<[HistoryStore<G>, SchemaValidationResult]>;
|
|
4478
|
+
declare function createVerifiedStore<G extends GraphDef>(graph: G, backend: GraphBackend, options: ExplicitRecordedReadLiveOptions): Promise<[RecordedReadStore<G>, SchemaValidationResult]>;
|
|
4177
4479
|
declare function createVerifiedStore<G extends GraphDef>(graph: G, backend: GraphBackend, options?: StoreOptions): Promise<[Store<G>, SchemaValidationResult]>;
|
|
4178
4480
|
|
|
4179
4481
|
/**
|
|
@@ -4216,7 +4518,7 @@ type StoreViewCoordinate = Readonly<{
|
|
|
4216
4518
|
* {@link Store.subgraph} options with the temporal axis removed — the
|
|
4217
4519
|
* view's pinned coordinate supplies it.
|
|
4218
4520
|
*/
|
|
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">;
|
|
4521
|
+
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
4522
|
/** `reachable` options with the temporal axis removed (the pin supplies it). */
|
|
4221
4523
|
type StoreViewReachableOptions<G extends GraphDef> = Omit<ReachableOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
4222
4524
|
/** `shortestPath` options with the temporal axis removed (the pin supplies it). */
|
|
@@ -4228,35 +4530,29 @@ type StoreViewNeighborsOptions<G extends GraphDef> = Omit<NeighborsOptions<G>, k
|
|
|
4228
4530
|
/** `degree` options with the temporal axis removed (the pin supplies it). */
|
|
4229
4531
|
type StoreViewDegreeOptions<G extends GraphDef> = Omit<DegreeOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
4230
4532
|
/**
|
|
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
|
-
* ```
|
|
4533
|
+
* Shared base for the read-only views. Holds the pinned {@link ReadCoordinate}
|
|
4534
|
+
* and delegates the graph algorithms, `subgraph`, and `query` to the live store
|
|
4535
|
+
* with that coordinate flattened into each call. {@link StoreView} (valid-time)
|
|
4536
|
+
* and {@link RecordedStoreView} (recorded-time) extend it; only the surfaces
|
|
4537
|
+
* that genuinely differ — collections, search, and the coordinate-changing
|
|
4538
|
+
* helpers — live on the subclasses.
|
|
4242
4539
|
*/
|
|
4243
|
-
declare class
|
|
4540
|
+
declare abstract class CoordinatePinnedView<G extends GraphDef> {
|
|
4244
4541
|
#private;
|
|
4245
|
-
|
|
4542
|
+
protected readonly store: Store<G>;
|
|
4543
|
+
protected readonly coordinate: ReadCoordinate;
|
|
4544
|
+
constructor(store: Store<G>, coordinate: ReadCoordinate);
|
|
4246
4545
|
/** The temporal mode this view reads in. */
|
|
4247
4546
|
get mode(): TemporalMode;
|
|
4248
|
-
/** The pinned `asOf` timestamp, or `undefined` for
|
|
4547
|
+
/** The pinned valid-time `asOf` timestamp, or `undefined` for other modes. */
|
|
4249
4548
|
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
4549
|
/**
|
|
4255
4550
|
* A query builder pinned to this view's coordinate. The temporal axis is
|
|
4256
4551
|
* sealed: calling `.temporal(...)` on the returned builder throws, so the
|
|
4257
4552
|
* view's coordinate cannot be overridden on a per-query basis.
|
|
4258
4553
|
*/
|
|
4259
|
-
query():
|
|
4554
|
+
query(): InitialQueryBuilder<G, "sealed">;
|
|
4555
|
+
protected algorithms(): InternalGraphAlgorithms<G>;
|
|
4260
4556
|
/** Extracts a subgraph at this view's pinned coordinate. */
|
|
4261
4557
|
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
4558
|
/** Shortest path between two nodes at this view's pinned coordinate. */
|
|
@@ -4269,6 +4565,29 @@ declare class StoreView<G extends GraphDef> {
|
|
|
4269
4565
|
neighbors(node: NodeIdentifier, options: StoreViewNeighborsOptions<G>): Promise<readonly ReachableNode[]>;
|
|
4270
4566
|
/** Counts active edges incident to `node` at this view's pinned coordinate. */
|
|
4271
4567
|
degree(node: NodeIdentifier, options?: StoreViewDegreeOptions<G>): Promise<number>;
|
|
4568
|
+
}
|
|
4569
|
+
/**
|
|
4570
|
+
* A read-only `(mode, asOf)` lens over a {@link Store}. Construct one via
|
|
4571
|
+
* {@link Store.asOf} (valid-time) or {@link Store.view} (any public
|
|
4572
|
+
* mode), never directly.
|
|
4573
|
+
*
|
|
4574
|
+
* @example
|
|
4575
|
+
* ```typescript
|
|
4576
|
+
* const past = store.asOf("2026-01-01T00:00:00.000Z");
|
|
4577
|
+
* const alice = await past.nodes.Person.getById(aliceId);
|
|
4578
|
+
* const jobs = await past.edges.worksAt.findFrom(alice!);
|
|
4579
|
+
* const reach = await past.reachable(alice!, { edges: ["knows"] });
|
|
4580
|
+
* ```
|
|
4581
|
+
*/
|
|
4582
|
+
declare class StoreView<G extends GraphDef> extends CoordinatePinnedView<G> {
|
|
4583
|
+
#private;
|
|
4584
|
+
constructor(store: Store<G>, coordinate: StoreViewCoordinate | ReadCoordinate);
|
|
4585
|
+
/** Adds a recorded-time pin, returning the narrow reconstructing view. */
|
|
4586
|
+
asOfRecorded(recordedAsOf: RecordedInstant): RecordedStoreView<G>;
|
|
4587
|
+
/** Read-only node collections pinned to this view's coordinate. */
|
|
4588
|
+
get nodes(): StoreViewNodeCollections<G>;
|
|
4589
|
+
/** Read-only edge collections pinned to this view's coordinate. */
|
|
4590
|
+
get edges(): StoreViewEdgeCollections<G>;
|
|
4272
4591
|
/**
|
|
4273
4592
|
* Read-only search facade. On a `current` view the read methods
|
|
4274
4593
|
* (`fulltext` / `vector` / `hybrid`) delegate to the live `store.search`,
|
|
@@ -4279,5 +4598,22 @@ declare class StoreView<G extends GraphDef> {
|
|
|
4279
4598
|
*/
|
|
4280
4599
|
get search(): StoreSearch<G>;
|
|
4281
4600
|
}
|
|
4601
|
+
/**
|
|
4602
|
+
* A narrow recorded-time read lens. It preserves the valid-time coordinate
|
|
4603
|
+
* carried by the source view and adds a recorded/system-time pin. Collection
|
|
4604
|
+
* reads are intentionally limited to point reconstruction; broad collection
|
|
4605
|
+
* predicates, endpoint reads, search, and further coordinate changes are absent
|
|
4606
|
+
* from the typed surface and refused by the runtime proxies for JS callers.
|
|
4607
|
+
*/
|
|
4608
|
+
declare class RecordedStoreView<G extends GraphDef> extends CoordinatePinnedView<G> {
|
|
4609
|
+
#private;
|
|
4610
|
+
constructor(store: Store<G>, coordinate: ReadCoordinate);
|
|
4611
|
+
/** The recorded/system-time timestamp this view reconstructs. */
|
|
4612
|
+
get asOfRecorded(): string;
|
|
4613
|
+
/** Recorded-time node point-read collections. */
|
|
4614
|
+
get nodes(): RecordedStoreViewNodeCollections<G>;
|
|
4615
|
+
/** Recorded-time edge point-read collections. */
|
|
4616
|
+
get edges(): RecordedStoreViewEdgeCollections<G>;
|
|
4617
|
+
}
|
|
4282
4618
|
|
|
4283
|
-
export { type
|
|
4619
|
+
export { type GetOrCreateAction 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 HistoryStore as H, type EdgeGetOrCreateByEndpointsResult as I, type EdgeIntrospection as J, type EdgeTemporalReads as K, type EdgeWrites as L, type EmbeddingSchema as M, type Node as N, type EmbeddingValue as O, type EmptyAliasMap as P, type QueryCoordinateState as Q, type RecursiveAliasMap as R, Store as S, TraversalBuilder as T, type UniqueIntrospection as U, type EmptyEdgeAliasMap as V, ExecutableAggregateQuery as W, ExecutableQuery as X, type FieldAccessor as Y, type FulltextSearchHit as Z, type FulltextSearchOptions as _, type EmbeddingIndexType as a, type SelectableEdge as a$, type GraphAlgorithms as a0, type GraphEdgeCollections as a1, type GraphNodeCollections as a2, type HistorySafeBackend as a3, type HistorySafeTransactionBackend 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 };
|