@nicia-ai/typegraph 0.35.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/postgres/index.cjs +24 -24
- package/dist/backend/postgres/index.d.cts +6 -6
- package/dist/backend/postgres/index.d.ts +6 -6
- package/dist/backend/postgres/index.js +11 -11
- package/dist/backend/postgres/pglite.cjs +16 -16
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +11 -11
- package/dist/backend/sqlite/index.cjs +22 -21
- package/dist/backend/sqlite/index.d.cts +11 -9
- package/dist/backend/sqlite/index.d.ts +11 -9
- package/dist/backend/sqlite/index.js +10 -9
- package/dist/backend/sqlite/libsql.cjs +15 -14
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +11 -10
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +30 -23
- 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 +18 -11
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-TCOCYN2P.cjs → chunk-27SSDCEP.cjs} +14 -14
- package/dist/{chunk-TCOCYN2P.cjs.map → chunk-27SSDCEP.cjs.map} +1 -1
- package/dist/{chunk-5AQIKK56.cjs → chunk-2N6EOBTH.cjs} +16 -16
- package/dist/{chunk-5AQIKK56.cjs.map → chunk-2N6EOBTH.cjs.map} +1 -1
- package/dist/{chunk-FN35DLCN.cjs → chunk-3C2RYI6L.cjs} +13 -107
- package/dist/chunk-3C2RYI6L.cjs.map +1 -0
- package/dist/{chunk-4JEZZJ6S.cjs → chunk-3DS7Z4T4.cjs} +39 -39
- package/dist/{chunk-4JEZZJ6S.cjs.map → chunk-3DS7Z4T4.cjs.map} +1 -1
- package/dist/{chunk-BLZDPRXT.cjs → chunk-3GH67G4Z.cjs} +5 -5
- package/dist/{chunk-BLZDPRXT.cjs.map → chunk-3GH67G4Z.cjs.map} +1 -1
- package/dist/{chunk-K3PPLHY7.js → chunk-3RWZPJKV.js} +24 -9
- package/dist/chunk-3RWZPJKV.js.map +1 -0
- package/dist/{chunk-QWEUYILR.js → chunk-3SLPDKHQ.js} +4 -4
- package/dist/chunk-3SLPDKHQ.js.map +1 -0
- package/dist/{chunk-5A6FNS6N.cjs → chunk-3XXGYU62.cjs} +11 -11
- package/dist/{chunk-5A6FNS6N.cjs.map → chunk-3XXGYU62.cjs.map} +1 -1
- package/dist/{chunk-JBTOYDMN.js → chunk-44TA22QT.js} +58 -11
- package/dist/chunk-44TA22QT.js.map +1 -0
- package/dist/{chunk-UES55P7G.js → chunk-552KNYQJ.js} +2652 -409
- package/dist/chunk-552KNYQJ.js.map +1 -0
- package/dist/{chunk-VPYHY3LJ.cjs → chunk-5KEQ74YU.cjs} +14 -14
- package/dist/chunk-5KEQ74YU.cjs.map +1 -0
- package/dist/{chunk-Q5TEXCTB.js → chunk-5KPNWT6X.js} +3 -3
- package/dist/{chunk-Q5TEXCTB.js.map → chunk-5KPNWT6X.js.map} +1 -1
- package/dist/{chunk-MP2JQKSG.js → chunk-5PNMDJ7J.js} +108 -5
- package/dist/chunk-5PNMDJ7J.js.map +1 -0
- package/dist/{chunk-AW4A3P5A.cjs → chunk-5VQM6VWP.cjs} +2 -2
- package/dist/{chunk-AW4A3P5A.cjs.map → chunk-5VQM6VWP.cjs.map} +1 -1
- package/dist/{chunk-A3W7QG7K.js → chunk-5WWVZMVX.js} +2 -2
- package/dist/{chunk-A3W7QG7K.js.map → chunk-5WWVZMVX.js.map} +1 -1
- package/dist/{chunk-FACJJWGF.cjs → chunk-6EEO3OVU.cjs} +7 -7
- package/dist/{chunk-FACJJWGF.cjs.map → chunk-6EEO3OVU.cjs.map} +1 -1
- package/dist/{chunk-LGEALRC6.cjs → chunk-BVRDGYXQ.cjs} +113 -4
- package/dist/chunk-BVRDGYXQ.cjs.map +1 -0
- package/dist/{chunk-GSQ6NPH6.cjs → chunk-DEFQM7JU.cjs} +7 -7
- package/dist/{chunk-GSQ6NPH6.cjs.map → chunk-DEFQM7JU.cjs.map} +1 -1
- package/dist/{chunk-EM3CWPND.cjs → chunk-DIQ3AV5W.cjs} +574 -268
- package/dist/chunk-DIQ3AV5W.cjs.map +1 -0
- package/dist/{chunk-FPIZFYHE.js → chunk-EXU3RASM.js} +74 -15
- package/dist/chunk-EXU3RASM.js.map +1 -0
- package/dist/{chunk-H7YNSMA7.cjs → chunk-HAHNRASW.cjs} +20 -2
- package/dist/chunk-HAHNRASW.cjs.map +1 -0
- package/dist/{chunk-FL472AMI.cjs → chunk-IP3CGGPA.cjs} +8 -8
- package/dist/{chunk-FL472AMI.cjs.map → chunk-IP3CGGPA.cjs.map} +1 -1
- package/dist/{chunk-4TOD4LBZ.cjs → chunk-IPSVVTWT.cjs} +94 -35
- package/dist/chunk-IPSVVTWT.cjs.map +1 -0
- package/dist/{chunk-RGP33ZJ5.js → chunk-IXGYRP2P.js} +184 -92
- package/dist/chunk-IXGYRP2P.js.map +1 -0
- package/dist/{chunk-3TWF3SH4.js → chunk-J4IUSYFF.js} +251 -121
- package/dist/chunk-J4IUSYFF.js.map +1 -0
- package/dist/{chunk-O7UN7OXA.cjs → chunk-JBNOGRKW.cjs} +318 -188
- package/dist/chunk-JBNOGRKW.cjs.map +1 -0
- package/dist/{chunk-WDBCBWC4.js → chunk-K3Q3LJY3.js} +520 -221
- package/dist/chunk-K3Q3LJY3.js.map +1 -0
- package/dist/{chunk-OR5ZA5WP.js → chunk-K5UBVGJN.js} +4 -4
- package/dist/{chunk-OR5ZA5WP.js.map → chunk-K5UBVGJN.js.map} +1 -1
- package/dist/{chunk-UZV3AZKF.js → chunk-KQJ54OG5.js} +3 -3
- package/dist/{chunk-UZV3AZKF.js.map → chunk-KQJ54OG5.js.map} +1 -1
- package/dist/{chunk-QOTI55H7.js → chunk-L7HQ2OSI.js} +4 -4
- package/dist/{chunk-QOTI55H7.js.map → chunk-L7HQ2OSI.js.map} +1 -1
- package/dist/{chunk-55MZDDZV.js → chunk-M6VES7V6.js} +4 -4
- package/dist/{chunk-55MZDDZV.js.map → chunk-M6VES7V6.js.map} +1 -1
- package/dist/{chunk-J7WFGBJR.cjs → chunk-NBP2WTJW.cjs} +3249 -1006
- package/dist/chunk-NBP2WTJW.cjs.map +1 -0
- package/dist/{chunk-CK5BVQOW.cjs → chunk-NUIG3BCV.cjs} +100 -85
- package/dist/chunk-NUIG3BCV.cjs.map +1 -0
- package/dist/{chunk-EMF62TZG.cjs → chunk-NXQFATMF.cjs} +269 -177
- package/dist/chunk-NXQFATMF.cjs.map +1 -0
- package/dist/{chunk-KBGQIPRQ.js → chunk-PC2UBAUB.js} +20 -3
- package/dist/chunk-PC2UBAUB.js.map +1 -0
- package/dist/chunk-QARBLBXT.cjs +219 -0
- package/dist/chunk-QARBLBXT.cjs.map +1 -0
- package/dist/{chunk-6FR2MMS6.js → chunk-QERAIDRJ.js} +45 -4
- package/dist/chunk-QERAIDRJ.js.map +1 -0
- package/dist/chunk-QSXTWU4U.cjs +12 -0
- package/dist/{chunk-GUR2FNB5.cjs.map → chunk-QSXTWU4U.cjs.map} +1 -1
- package/dist/{chunk-QNKSQTKQ.js → chunk-RCVLFTCT.js} +49 -19
- package/dist/chunk-RCVLFTCT.js.map +1 -0
- package/dist/{chunk-VSPCZAXF.js → chunk-RRSNR3TP.js} +3 -3
- package/dist/{chunk-VSPCZAXF.js.map → chunk-RRSNR3TP.js.map} +1 -1
- package/dist/{chunk-WJT7OU7E.cjs → chunk-TGOMW4MB.cjs} +129 -98
- package/dist/chunk-TGOMW4MB.cjs.map +1 -0
- package/dist/{chunk-KMI7LYAF.js → chunk-TKT2XHED.js} +8 -8
- package/dist/{chunk-KMI7LYAF.js.map → chunk-TKT2XHED.js.map} +1 -1
- package/dist/{chunk-RGPG7EOJ.js → chunk-TPF25IG6.js} +3 -3
- package/dist/{chunk-RGPG7EOJ.js.map → chunk-TPF25IG6.js.map} +1 -1
- package/dist/{chunk-5SEGFTZX.js → chunk-UGZUAYAR.js} +3 -3
- package/dist/{chunk-5SEGFTZX.js.map → chunk-UGZUAYAR.js.map} +1 -1
- package/dist/{chunk-VHMPG6UL.js → chunk-UXLSNRYL.js} +11 -105
- package/dist/chunk-UXLSNRYL.js.map +1 -0
- package/dist/{chunk-FRV5Q5IO.js → chunk-UYQMBBWJ.js} +3 -3
- package/dist/{chunk-FRV5Q5IO.js.map → chunk-UYQMBBWJ.js.map} +1 -1
- package/dist/{chunk-UUT7UN2N.cjs → chunk-VGDDG3XJ.cjs} +7 -7
- package/dist/{chunk-UUT7UN2N.cjs.map → chunk-VGDDG3XJ.cjs.map} +1 -1
- package/dist/{chunk-CZQ3FO2Q.js → chunk-VKGKDOKR.js} +56 -21
- package/dist/chunk-VKGKDOKR.js.map +1 -0
- package/dist/{chunk-CTTSDJLY.cjs → chunk-VL2V6PEN.cjs} +11 -11
- package/dist/{chunk-CTTSDJLY.cjs.map → chunk-VL2V6PEN.cjs.map} +1 -1
- package/dist/{chunk-XOX22WHL.cjs → chunk-WOJMKB3N.cjs} +125 -90
- package/dist/chunk-WOJMKB3N.cjs.map +1 -0
- package/dist/{chunk-UMDVATGY.cjs → chunk-WWFHO375.cjs} +6 -6
- package/dist/{chunk-UMDVATGY.cjs.map → chunk-WWFHO375.cjs.map} +1 -1
- package/dist/{chunk-I7ZUZKFD.js → chunk-XGPUQ56G.js} +3 -3
- package/dist/{chunk-I7ZUZKFD.js.map → chunk-XGPUQ56G.js.map} +1 -1
- package/dist/{chunk-D7ZEOS56.cjs → chunk-XGU7DZDA.cjs} +74 -14
- package/dist/chunk-XGU7DZDA.cjs.map +1 -0
- package/dist/{chunk-S55OV6PW.cjs → chunk-XPCZADMT.cjs} +54 -11
- package/dist/chunk-XPCZADMT.cjs.map +1 -0
- package/dist/{chunk-T2WUSPDA.js → chunk-XWV4JT34.js} +3 -3
- package/dist/{chunk-T2WUSPDA.js.map → chunk-XWV4JT34.js.map} +1 -1
- package/dist/chunk-YTSN73ND.js +212 -0
- package/dist/chunk-YTSN73ND.js.map +1 -0
- package/dist/{ddl-CZz7a0E8.d.cts → ddl-BD-ZfKeX.d.cts} +3 -3
- package/dist/{ddl-C2rZ-Aen.d.ts → ddl-CS0KUVwB.d.ts} +3 -3
- package/dist/{extension-types-ixRpJVUp.d.cts → extension-types-BM2ACfYO.d.cts} +6 -1
- package/dist/{extension-types-ixRpJVUp.d.ts → extension-types-BM2ACfYO.d.ts} +6 -1
- package/dist/{fulltext-strategy-CDkSSYhq.d.cts → fulltext-strategy-C27vXaeB.d.cts} +127 -8
- package/dist/{fulltext-strategy-B57yvC5Q.d.ts → fulltext-strategy-DebsMrqg.d.ts} +127 -8
- package/dist/graph-extension/index.cjs +19 -19
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-extension/index.js +4 -4
- package/dist/graph-merge/index.cjs +88 -88
- 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 +19 -19
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-Bks_3HHK.d.cts → index-BPM59vsg.d.cts} +119 -7
- package/dist/{index-6CSUAq-x.d.ts → index-BeacbPoe.d.ts} +119 -7
- package/dist/index.cjs +230 -185
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +53 -40
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +30 -21
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +8 -7
- package/dist/interchange/index.cjs +208 -30
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +25 -8
- package/dist/interchange/index.d.ts +25 -8
- package/dist/interchange/index.js +191 -11
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-DwQi8eV0.d.cts → manager-D00_NXvT.d.ts} +11 -2
- package/dist/{manager-ejUCB52T.d.ts → manager-nU1vTJLy.d.cts} +11 -2
- package/dist/{materialize-indexes-B4e9360H.d.cts → materialize-indexes-CuR3gAZb.d.cts} +8 -2
- package/dist/{materialize-indexes-te9TPMMJ.d.ts → materialize-indexes-zK2J_flP.d.ts} +8 -2
- package/dist/{postgres-DQ5R6rzV.d.ts → postgres-IaBA4RgE.d.ts} +1 -1
- package/dist/{postgres-CfEqsRMp.d.cts → postgres-YrYmPlaU.d.cts} +1 -1
- package/dist/profiler/index.cjs +3 -3
- package/dist/profiler/index.d.cts +7 -7
- package/dist/profiler/index.d.ts +7 -7
- package/dist/profiler/index.js +2 -2
- package/dist/provenance/index.cjs +32 -33
- package/dist/provenance/index.cjs.map +1 -1
- package/dist/provenance/index.d.cts +5 -5
- package/dist/provenance/index.d.ts +5 -5
- package/dist/provenance/index.js +5 -6
- package/dist/provenance/index.js.map +1 -1
- package/dist/schema/index.cjs +35 -35
- package/dist/schema/index.d.cts +7 -7
- package/dist/schema/index.d.ts +7 -7
- package/dist/schema/index.js +11 -11
- package/dist/{sqlite-DvQndLky.d.ts → sqlite-BUOHPx7p.d.ts} +1 -1
- package/dist/{sqlite-D7zBinNR.d.cts → sqlite-Pp8O19WE.d.cts} +1 -1
- package/dist/{store-view-CKbHFRnn.d.ts → store-view-ANL6mTph.d.ts} +457 -57
- package/dist/{store-view-BSpqvAxK.d.cts → store-view-X96Rd00T.d.cts} +457 -57
- package/dist/{types-Bv9DcS_E.d.cts → types-r-Zyq2Hz.d.cts} +2 -2
- package/dist/{types-CoxuV7EJ.d.ts → types-wsvuBgPK.d.ts} +2 -2
- package/dist/where-CJOpJj3a.d.ts +36 -0
- package/dist/where-K3uBP33l.d.cts +36 -0
- package/package.json +1 -1
- package/dist/chunk-3TWF3SH4.js.map +0 -1
- package/dist/chunk-4TOD4LBZ.cjs.map +0 -1
- package/dist/chunk-6FR2MMS6.js.map +0 -1
- package/dist/chunk-CK5BVQOW.cjs.map +0 -1
- package/dist/chunk-CZQ3FO2Q.js.map +0 -1
- package/dist/chunk-D7ZEOS56.cjs.map +0 -1
- package/dist/chunk-EM3CWPND.cjs.map +0 -1
- package/dist/chunk-EMF62TZG.cjs.map +0 -1
- package/dist/chunk-EOLERH7Y.cjs +0 -40
- package/dist/chunk-EOLERH7Y.cjs.map +0 -1
- package/dist/chunk-FN35DLCN.cjs.map +0 -1
- package/dist/chunk-FPIZFYHE.js.map +0 -1
- package/dist/chunk-GUR2FNB5.cjs +0 -12
- package/dist/chunk-H7YNSMA7.cjs.map +0 -1
- package/dist/chunk-J7WFGBJR.cjs.map +0 -1
- package/dist/chunk-JBTOYDMN.js.map +0 -1
- package/dist/chunk-K3PPLHY7.js.map +0 -1
- package/dist/chunk-KBGQIPRQ.js.map +0 -1
- package/dist/chunk-LGEALRC6.cjs.map +0 -1
- package/dist/chunk-MP2JQKSG.js.map +0 -1
- package/dist/chunk-O7UN7OXA.cjs.map +0 -1
- package/dist/chunk-QNKSQTKQ.js.map +0 -1
- package/dist/chunk-QWEUYILR.js.map +0 -1
- package/dist/chunk-RGP33ZJ5.js.map +0 -1
- package/dist/chunk-S55OV6PW.cjs.map +0 -1
- package/dist/chunk-UES55P7G.js.map +0 -1
- package/dist/chunk-UT3S4SEN.js +0 -31
- package/dist/chunk-UT3S4SEN.js.map +0 -1
- package/dist/chunk-VHMPG6UL.js.map +0 -1
- package/dist/chunk-VPYHY3LJ.cjs.map +0 -1
- package/dist/chunk-WDBCBWC4.js.map +0 -1
- package/dist/chunk-WJT7OU7E.cjs.map +0 -1
- package/dist/chunk-XOX22WHL.cjs.map +0 -1
- package/dist/where-7RKFOsXt.d.ts +0 -11
- package/dist/where-DdMIXOtH.d.cts +0 -11
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { T as TemporalMode, N as NodeType, A as AnyEdgeType, g as EdgeType, E as EdgeRegistration, d as NodeId, K as KindEntity, b as NodeRegistration, e as EdgeId, s as UniquenessScope, n as Collation, f as KindAnnotations, m as Cardinality, q as EndpointExistence, G as GraphExtension } from './extension-types-
|
|
1
|
+
import { G as GraphDef, K as KindRegistry, w as EdgeKinds, t as NodeKinds, v as AllNodeTypes, c as SchemaManagerOptions, d as SchemaValidationResult } from './manager-D00_NXvT.js';
|
|
2
|
+
import { T as TemporalMode, N as NodeType, A as AnyEdgeType, g as EdgeType, E as EdgeRegistration, d as NodeId, K as KindEntity, b as NodeRegistration, e as EdgeId, s as UniquenessScope, n as Collation, f as KindAnnotations, m as Cardinality, q as EndpointExistence, G as GraphExtension } from './extension-types-BM2ACfYO.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import {
|
|
5
|
-
import { b as MaterializeIndexesOptions, M as MaterializeIndexesResult } from './materialize-indexes-
|
|
4
|
+
import { a_ as VectorSlot, be as ValueType, bf as PredicateExpression, ag as FulltextQueryMode, bg as VectorMetricType, Q as QueryAst, J as JsonPointer, P as FieldRef, aA as ParameterRef, ar as JsonPointerInput, G as GraphBackend, aT as TransactionBackend, aU as TraversalExpansion, c as SqlDialect, aP as SqlSchema, bh as Traversal, bi as NodePredicate, bj as ProjectedField, az as OrderSpec, bk as AggregateOrderSpec, bl as GroupBySpec, an as HybridFusionOptions, bm as RecursiveCyclePolicy, W as TraversalDirection$1, bn as NodeRow, aa as ExternalRecordedReadSource, bo as EdgeRow, X as AdoptedTransaction, L as AggregateExpr, aN as SortDirection, a3 as CompiledSelectSql, F as FulltextStrategy, V as VectorStrategy, bp as VectorSlotMap, bq as RecordedReadBinding, br as SelectiveField, bs as ComposableQuery, bt as SetOperationType, bu as SetOperation, bv as VectorMetric, z as JsonSchema, bw as TransactionOptions } from './fulltext-strategy-DebsMrqg.js';
|
|
5
|
+
import { b as MaterializeIndexesOptions, M as MaterializeIndexesResult, c as MaterializeSystemIndexesOptions } from './materialize-indexes-zK2J_flP.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Embedding type for vector search.
|
|
@@ -145,6 +145,16 @@ declare function isEmbeddingSchema(value: unknown): value is EmbeddingSchema;
|
|
|
145
145
|
* Returns undefined if the schema is not an embedding schema.
|
|
146
146
|
*/
|
|
147
147
|
declare function getEmbeddingDimensions(schema: z.ZodType): number | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Enumerates every embedding `(kind, field)` slot a graph declares, as a
|
|
150
|
+
* fully-resolved {@link VectorSlot}. The single source of truth for "what
|
|
151
|
+
* vector slots does this graph have?", shared by the privileged boot
|
|
152
|
+
* materializer (`materializeVectorContributions`) and the verified-attach
|
|
153
|
+
* gate (`assertVectorContributionsInitialized`) so the two can never
|
|
154
|
+
* provision and assert different sets. Walks `graph.nodes` and reuses
|
|
155
|
+
* {@link resolveEmbeddingFields} per node schema.
|
|
156
|
+
*/
|
|
157
|
+
declare function resolveGraphVectorSlots(graph: GraphDef): readonly VectorSlot[];
|
|
148
158
|
|
|
149
159
|
/**
|
|
150
160
|
* Searchable string type for fulltext search.
|
|
@@ -1290,6 +1300,55 @@ type BaseStoreOptions = Readonly<{
|
|
|
1290
1300
|
* manually after commit. `importGraph` handles its own refresh.
|
|
1291
1301
|
*/
|
|
1292
1302
|
autoRefreshStatistics?: false | number;
|
|
1303
|
+
/**
|
|
1304
|
+
* Skip the write for an `upsertById` (or `bulkUpsertById` item) whose
|
|
1305
|
+
* validated props are value-identical to the existing live row. Default
|
|
1306
|
+
* off.
|
|
1307
|
+
*
|
|
1308
|
+
* Enable this for at-least-once / replay materializers. An event log that
|
|
1309
|
+
* re-delivers a byte-identical change would otherwise rewrite the row anyway:
|
|
1310
|
+
* today an `upsertById` on an existing id calls `updateNode`
|
|
1311
|
+
* unconditionally, allocating a fresh recorded instant and a new history row
|
|
1312
|
+
* per re-delivery.
|
|
1313
|
+
*
|
|
1314
|
+
* The win is scoped to re-delivery of the **current** value. A full
|
|
1315
|
+
* replay-from-zero over the current state still writes wherever the stream
|
|
1316
|
+
* superseded a value in place: re-applying an older value over the live row
|
|
1317
|
+
* is a genuine change (and restoring the current value afterwards is
|
|
1318
|
+
* another), so only streams whose rows never supersede each other replay
|
|
1319
|
+
* without churn. A rebuild that should avoid that re-walk belongs in a fresh
|
|
1320
|
+
* store — replay into it and publish it, rather than re-applying the log
|
|
1321
|
+
* over current state.
|
|
1322
|
+
*
|
|
1323
|
+
* When enabled, an upsert that would not change the stored value performs
|
|
1324
|
+
* **no write at all**: no `updateNode`, no recorded-time capture, no history
|
|
1325
|
+
* row, no revision-anchor advance, and no `update` operation hooks (nothing
|
|
1326
|
+
* happened, so nothing is reported). It resolves with the **existing** node,
|
|
1327
|
+
* preserving its original `validFrom` / `updatedAt` / `version`.
|
|
1328
|
+
*
|
|
1329
|
+
* Receipt shape is unchanged and needs no new signal: a coalesced upsert
|
|
1330
|
+
* still counts as one write intent (`writes.total` includes it), but
|
|
1331
|
+
* captures nothing (`receipt.recorded` stays `undefined` when it is the only
|
|
1332
|
+
* write) — the same shape a no-op delete already produces, so a consumer
|
|
1333
|
+
* that carries the prior anchor forward on `recorded === undefined` handles
|
|
1334
|
+
* it unchanged.
|
|
1335
|
+
*
|
|
1336
|
+
* A write is coalesced only when **all** of the following hold; otherwise the
|
|
1337
|
+
* normal write happens:
|
|
1338
|
+
* 1. An existing row is found for the id (else it is a create).
|
|
1339
|
+
* 2. That row is not soft-deleted (a deleted row resurrects — a real
|
|
1340
|
+
* change — and is never coalesced).
|
|
1341
|
+
* 3. The caller passed no explicit `validFrom` / `validTo` (an explicit
|
|
1342
|
+
* temporal override is a deliberate request and is never coalesced;
|
|
1343
|
+
* applied per item in the bulk path).
|
|
1344
|
+
* 4. The new props, merged over the stored props and run through the
|
|
1345
|
+
* kind's Zod schema (defaults applied, values normalized), are deeply
|
|
1346
|
+
* value-identical to the stored props (key order aside).
|
|
1347
|
+
*
|
|
1348
|
+
* Default-off because some consumers *want* an audit row per re-delivery as
|
|
1349
|
+
* proof the event was reprocessed; coalescing removes that signal.
|
|
1350
|
+
*/
|
|
1351
|
+
coalesceUnchangedUpserts?: boolean;
|
|
1293
1352
|
/** SQL schema configuration from createSqlSchema(...) for custom table names */
|
|
1294
1353
|
schema?: SqlSchema;
|
|
1295
1354
|
/** Query default behaviors. */
|
|
@@ -1350,7 +1409,9 @@ interface StoreRef<T> {
|
|
|
1350
1409
|
current: T;
|
|
1351
1410
|
}
|
|
1352
1411
|
/**
|
|
1353
|
-
*
|
|
1412
|
+
* Result plus write summary. Returned by `store.transactionWithReceipt(fn)`,
|
|
1413
|
+
* `store.withRecordedTransaction(externalTx, fn)` (the adopted-commit path), and
|
|
1414
|
+
* `tx.measure(fn)` (a scoped sub-receipt). See {@link TransactionReceipt}.
|
|
1354
1415
|
*/
|
|
1355
1416
|
type TransactionOutcome<T> = Readonly<{
|
|
1356
1417
|
result: T;
|
|
@@ -1394,7 +1455,10 @@ type TransactionReceipt = Readonly<{
|
|
|
1394
1455
|
/**
|
|
1395
1456
|
* The recorded commit instant allocated for this store's graph by this
|
|
1396
1457
|
* transaction. Undefined when history capture is off, the transaction is
|
|
1397
|
-
* read-only, or no captured writes were flushed.
|
|
1458
|
+
* read-only, or no captured writes were flushed. **Always undefined on a
|
|
1459
|
+
* scoped receipt from {@link ScopedMeasure}** (`tx.measure`) — the recorded
|
|
1460
|
+
* instant is a per-transaction flush concern allocated once when the whole
|
|
1461
|
+
* transaction's capture flushes, unknowable mid-transaction.
|
|
1398
1462
|
*/
|
|
1399
1463
|
recorded?: RecordedInstant;
|
|
1400
1464
|
}>;
|
|
@@ -2032,6 +2096,14 @@ type RecordedStoreViewNodeCollections<G extends GraphDef> = {
|
|
|
2032
2096
|
type RecordedStoreViewEdgeCollections<G extends GraphDef> = {
|
|
2033
2097
|
[K in keyof G["edges"] & string]-?: TypedRecordedStoreViewEdgeCollection<G["edges"][K]>;
|
|
2034
2098
|
};
|
|
2099
|
+
/**
|
|
2100
|
+
* Whether — and why — `tx.sql` can be used on a transaction context. A single
|
|
2101
|
+
* required discriminant covering exactly the four states raw-SQL access can be
|
|
2102
|
+
* in, so a portable caller branches on capability instead of truthiness-testing
|
|
2103
|
+
* `tx.sql` (which is present-but-throwing under history / revision tracking).
|
|
2104
|
+
* See {@link TransactionContext.sqlAvailability} for the per-value semantics.
|
|
2105
|
+
*/
|
|
2106
|
+
type SqlAvailability = "available" | "history" | "revisionTracking" | "unavailable";
|
|
2035
2107
|
/**
|
|
2036
2108
|
* A typed transaction context with collection API.
|
|
2037
2109
|
*
|
|
@@ -2074,11 +2146,43 @@ type RecordedStoreViewEdgeCollections<G extends GraphDef> = {
|
|
|
2074
2146
|
* Drizzle database type at the call site.
|
|
2075
2147
|
*
|
|
2076
2148
|
* When the store was created with `{ history: true }` or
|
|
2077
|
-
* `{ revisionTracking: true }`, `tx.sql` is present but
|
|
2078
|
-
*
|
|
2079
|
-
*
|
|
2080
|
-
* `
|
|
2081
|
-
*
|
|
2149
|
+
* `{ revisionTracking: true }`, `tx.sql` is **present but throwing**: every
|
|
2150
|
+
* access raises {@link ConfigurationError} because raw SQL would bypass
|
|
2151
|
+
* recorded-time capture or the revision anchor. The static type marks it
|
|
2152
|
+
* `sql?: never` so a mistaken `tx.sql.run(...)` fails to typecheck; at runtime
|
|
2153
|
+
* it is a fail-loud guard, not `undefined`. Use the typed `tx.nodes` /
|
|
2154
|
+
* `tx.edges` collections inside `transaction()`, or
|
|
2155
|
+
* `store.withRecordedTransaction(externalTx, fn)` when the relational layer
|
|
2156
|
+
* owns the transaction boundary.
|
|
2157
|
+
*
|
|
2158
|
+
* **Feature detection — branch on {@link sqlAvailability}, not on `tx.sql`'s
|
|
2159
|
+
* truthiness.** Because `tx.sql` is present-but-throwing under history or
|
|
2160
|
+
* revision tracking, `if (tx.sql)` reads truthy and then throws. The honest
|
|
2161
|
+
* discriminant is `tx.sqlAvailability`:
|
|
2162
|
+
*
|
|
2163
|
+
* ```typescript
|
|
2164
|
+
* await store.transaction(async (tx) => {
|
|
2165
|
+
* switch (tx.sqlAvailability) {
|
|
2166
|
+
* case "available": {
|
|
2167
|
+
* const sqlTx = tx.sql as NodePgDatabase; // usable raw handle
|
|
2168
|
+
* await sqlTx.insert(rows).values(row);
|
|
2169
|
+
* break;
|
|
2170
|
+
* }
|
|
2171
|
+
* case "unavailable":
|
|
2172
|
+
* // non-transactional backend: tx.sql === undefined, no atomicity
|
|
2173
|
+
* await fallbackWithoutAtomicity();
|
|
2174
|
+
* break;
|
|
2175
|
+
* case "history":
|
|
2176
|
+
* case "revisionTracking":
|
|
2177
|
+
* // raw SQL disabled here — write your own tables through the external
|
|
2178
|
+
* // handle passed to store.withRecordedTransaction instead
|
|
2179
|
+
* break;
|
|
2180
|
+
* }
|
|
2181
|
+
* });
|
|
2182
|
+
* ```
|
|
2183
|
+
*
|
|
2184
|
+
* `tx.sql === undefined` still means exactly "non-transactional fallback"
|
|
2185
|
+
* (`sqlAvailability === "unavailable"`).
|
|
2082
2186
|
*
|
|
2083
2187
|
* @example
|
|
2084
2188
|
* ```typescript
|
|
@@ -2093,6 +2197,26 @@ type TransactionContext<G extends GraphDef> = Readonly<{
|
|
|
2093
2197
|
nodes: GraphNodeCollections<G>;
|
|
2094
2198
|
edges: GraphEdgeCollections<G>;
|
|
2095
2199
|
sql?: AdoptedTransaction;
|
|
2200
|
+
/**
|
|
2201
|
+
* Honest capability discriminant for `tx.sql` on this transaction. Prefer
|
|
2202
|
+
* this over truthiness-testing `tx.sql`, which is present-but-throwing under
|
|
2203
|
+
* history capture or revision tracking.
|
|
2204
|
+
*
|
|
2205
|
+
* - `"available"` — `tx.sql` is the usable raw handle bound to this
|
|
2206
|
+
* transaction.
|
|
2207
|
+
* - `"history"` — history capture is on; `tx.sql` is present but every access
|
|
2208
|
+
* throws {@link ConfigurationError} (`details.code`
|
|
2209
|
+
* `RECORDED_CAPTURE_RAW_SQL_DISABLED`). Use `tx.nodes` / `tx.edges`, or
|
|
2210
|
+
* `store.withRecordedTransaction` with your own external handle for
|
|
2211
|
+
* cross-store atomicity.
|
|
2212
|
+
* - `"revisionTracking"` — same shape as `"history"` (`details.code`
|
|
2213
|
+
* `REVISION_TRACKING_RAW_SQL_DISABLED`).
|
|
2214
|
+
* - `"unavailable"` — non-transactional fallback
|
|
2215
|
+
* (`backend.capabilities.transactions === false`, e.g. Cloudflare D1,
|
|
2216
|
+
* `drizzle-orm/neon-http`); `tx.sql` is `undefined` and there is no
|
|
2217
|
+
* atomicity.
|
|
2218
|
+
*/
|
|
2219
|
+
sqlAvailability: SqlAvailability;
|
|
2096
2220
|
/**
|
|
2097
2221
|
* The transaction-scoped backend the collections are bound to, for advanced
|
|
2098
2222
|
* raw reads that must observe the transaction's snapshot (e.g. graph-merge's
|
|
@@ -2116,6 +2240,40 @@ type TransactionContext<G extends GraphDef> = Readonly<{
|
|
|
2116
2240
|
*/
|
|
2117
2241
|
runNodeOperationHooks<T>(operation: "create" | "update" | "delete", kind: string, id: string, fn: () => Promise<T>): Promise<T>;
|
|
2118
2242
|
}>;
|
|
2243
|
+
/**
|
|
2244
|
+
* Scoped write measurement, available only on the receipt-enabled transaction
|
|
2245
|
+
* contexts (`transactionWithReceipt`, `withRecordedTransaction`). Runs `fn`,
|
|
2246
|
+
* passing it a **scoped context** — a second view over the same transaction — and
|
|
2247
|
+
* returns a {@link TransactionOutcome} whose receipt counts exactly the writes
|
|
2248
|
+
* made *through that scoped context* (`scoped.nodes` / `scoped.edges`).
|
|
2249
|
+
*
|
|
2250
|
+
* Attribution is by **which context you write through**, not by timing. A write
|
|
2251
|
+
* through the scoped context counts in both the scope and the outer receipt (it
|
|
2252
|
+
* happened in the transaction); a write through the outer `tx` during the scope
|
|
2253
|
+
* counts only in the outer receipt. This makes overlapping and concurrent
|
|
2254
|
+
* measures safe by construction — two scopes running under `Promise.all`, each
|
|
2255
|
+
* writing through its own scoped context, never cross-count. Nesting composes:
|
|
2256
|
+
* `scoped.measure(...)` opens a child scope that counts in itself, every
|
|
2257
|
+
* ancestor scope, and the outer receipt.
|
|
2258
|
+
*
|
|
2259
|
+
* Counts otherwise inherit {@link TransactionReceipt} (bulk by input length, a
|
|
2260
|
+
* rejected write counts 0). The returned receipt's `recorded` is **always
|
|
2261
|
+
* `undefined`**: the recorded commit instant is a per-transaction flush concern,
|
|
2262
|
+
* unknowable mid-transaction.
|
|
2263
|
+
*/
|
|
2264
|
+
type ScopedMeasure<Context> = <T>(fn: (scoped: Context) => Promise<T>) => Promise<TransactionOutcome<T>>;
|
|
2265
|
+
/**
|
|
2266
|
+
* A {@link TransactionContext} that also exposes {@link ScopedMeasure}. Only the
|
|
2267
|
+
* receipt-enabled entry points (`transactionWithReceipt`,
|
|
2268
|
+
* `withRecordedTransaction`) hand a callback this type; plain `transaction()`
|
|
2269
|
+
* contexts have no recorder and therefore no `measure`, keeping that path
|
|
2270
|
+
* zero-overhead. Assignable to {@link TransactionContext}, so a projector helper
|
|
2271
|
+
* typed `(tx: TransactionContext<G>) => ...` accepts a measurable context. The
|
|
2272
|
+
* scoped context handed to `measure` is itself measurable, so scopes nest.
|
|
2273
|
+
*/
|
|
2274
|
+
type MeasurableTransactionContext<G extends GraphDef> = TransactionContext<G> & Readonly<{
|
|
2275
|
+
measure: ScopedMeasure<MeasurableTransactionContext<G>>;
|
|
2276
|
+
}>;
|
|
2119
2277
|
/**
|
|
2120
2278
|
* Replace branded `NodeId` / `EdgeId` with plain `string` in each
|
|
2121
2279
|
* method's parameter list. Return types are preserved unchanged.
|
|
@@ -2975,14 +3133,10 @@ declare function createQueryBuilder<G extends GraphDef>(graphId: string, registr
|
|
|
2975
3133
|
*/
|
|
2976
3134
|
type TraversalDirection = "out" | "in" | "both";
|
|
2977
3135
|
/**
|
|
2978
|
-
* Cycle-handling
|
|
2979
|
-
*
|
|
2980
|
-
*
|
|
2981
|
-
*
|
|
2982
|
-
* - `"allow"` — permit revisiting nodes. Only safe with a bounded `maxHops`.
|
|
2983
|
-
*
|
|
2984
|
-
* Aliased to `RecursiveCyclePolicy` so algorithms and query-builder traversals
|
|
2985
|
-
* share a single canonical union.
|
|
3136
|
+
* Cycle-handling option retained for compatibility with recursive query-builder
|
|
3137
|
+
* traversals. Store algorithms are set-based and visit each node once at its
|
|
3138
|
+
* minimum depth, so `"prevent"` and `"allow"` produce the same algorithm
|
|
3139
|
+
* result. Aliased to `RecursiveCyclePolicy` so both APIs share one union.
|
|
2986
3140
|
*/
|
|
2987
3141
|
type AlgorithmCyclePolicy = RecursiveCyclePolicy;
|
|
2988
3142
|
/**
|
|
@@ -3006,10 +3160,38 @@ type TemporalAlgorithmOptions = NoRecordedCoordinate & Readonly<{
|
|
|
3006
3160
|
type InternalTemporalAlgorithmOptions = Omit<TemporalAlgorithmOptions, "recordedAsOf"> & Readonly<{
|
|
3007
3161
|
recordedAsOf?: RecordedInstant;
|
|
3008
3162
|
}>;
|
|
3163
|
+
/**
|
|
3164
|
+
* Opt-in, transaction-scoped override of the session's working memory for
|
|
3165
|
+
* iterative graph rounds.
|
|
3166
|
+
*
|
|
3167
|
+
* When set, PostgreSQL applies it with `SET LOCAL work_mem` semantics inside
|
|
3168
|
+
* the operation's own transaction — the override ends with the transaction
|
|
3169
|
+
* and the session and server settings are never modified. When omitted (the
|
|
3170
|
+
* default), the operation inherits the server's configured `work_mem`.
|
|
3171
|
+
*
|
|
3172
|
+
* `work_mem` is a threshold each sort/hash operator (and each parallel
|
|
3173
|
+
* worker) may allocate up to, NOT a per-operation budget: a single round can
|
|
3174
|
+
* allocate several multiples of it, and concurrent algorithm calls multiply
|
|
3175
|
+
* again. Raise it deliberately — e.g. `"64MB"` for large single-tenant
|
|
3176
|
+
* analytical runs where the configured default spills whole-graph sorts to
|
|
3177
|
+
* disk — not as a blanket setting on a shared cluster.
|
|
3178
|
+
*
|
|
3179
|
+
* The value must be a plain integer with a `kB`, `MB`, or `GB` suffix within
|
|
3180
|
+
* PostgreSQL's accepted `work_mem` range (`64kB` to `2147483647kB`); both
|
|
3181
|
+
* backends reject malformed or out-of-range values identically. SQLite has
|
|
3182
|
+
* no equivalent setting and otherwise ignores the option.
|
|
3183
|
+
*/
|
|
3184
|
+
type IterativeMemoryOptions = Readonly<{
|
|
3185
|
+
/**
|
|
3186
|
+
* Transaction-scoped `work_mem` override, e.g. `"64MB"`. Omit to inherit
|
|
3187
|
+
* the server's configured setting.
|
|
3188
|
+
*/
|
|
3189
|
+
workingMemory?: string;
|
|
3190
|
+
}>;
|
|
3009
3191
|
/**
|
|
3010
3192
|
* Base options for traversal-style algorithms.
|
|
3011
3193
|
*/
|
|
3012
|
-
type BaseTraversalOptions<G extends GraphDef> = TemporalAlgorithmOptions & Readonly<{
|
|
3194
|
+
type BaseTraversalOptions<G extends GraphDef> = TemporalAlgorithmOptions & IterativeMemoryOptions & Readonly<{
|
|
3013
3195
|
/** Edge kinds to follow. At least one kind is required. */
|
|
3014
3196
|
edges: readonly EdgeKinds<G>[];
|
|
3015
3197
|
/**
|
|
@@ -3019,7 +3201,7 @@ type BaseTraversalOptions<G extends GraphDef> = TemporalAlgorithmOptions & Reado
|
|
|
3019
3201
|
maxHops?: number;
|
|
3020
3202
|
/** Direction of traversal (default: `"out"`). */
|
|
3021
3203
|
direction?: TraversalDirection;
|
|
3022
|
-
/**
|
|
3204
|
+
/** Compatibility option; set-based algorithms always visit a node once. */
|
|
3023
3205
|
cyclePolicy?: AlgorithmCyclePolicy;
|
|
3024
3206
|
}>;
|
|
3025
3207
|
type InternalBaseTraversalOptions<G extends GraphDef> = InternalTemporalAlgorithmOptions & Omit<BaseTraversalOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
@@ -3056,6 +3238,56 @@ type ShortestPathResult = Readonly<{
|
|
|
3056
3238
|
*/
|
|
3057
3239
|
type ShortestPathOptions<G extends GraphDef> = BaseTraversalOptions<G>;
|
|
3058
3240
|
type InternalShortestPathOptions<G extends GraphDef> = InternalBaseTraversalOptions<G>;
|
|
3241
|
+
/**
|
|
3242
|
+
* Options for `weightedShortestPath`.
|
|
3243
|
+
*
|
|
3244
|
+
* Each traversed edge contributes the value of `weightProperty` — a JSON
|
|
3245
|
+
* number stored on the edge — to the path's total weight. The traversal
|
|
3246
|
+
* fails fast with `InvalidEdgeWeightError` (before any rounds run) when any
|
|
3247
|
+
* visible edge of the selected kinds has a negative, non-numeric, or
|
|
3248
|
+
* out-of-range weight, or is missing the property with no `defaultWeight`
|
|
3249
|
+
* configured. Weight arithmetic uses IEEE 754 doubles on both backends:
|
|
3250
|
+
* total weights are always backend-identical, and — unless the `edges` list
|
|
3251
|
+
* is large enough to exceed the backend's bind-parameter budget (hundreds
|
|
3252
|
+
* of kinds in one call, where equal-weight predecessor ties may resolve
|
|
3253
|
+
* differently) — so is the returned node sequence.
|
|
3254
|
+
*
|
|
3255
|
+
* Unlike `shortestPath`, there is no `maxHops`: cost-ordered discovery does
|
|
3256
|
+
* not settle nodes in hop order, so a hop bound is not a natural stopping
|
|
3257
|
+
* rule. `maxIterations` caps relaxation rounds purely as a runaway backstop
|
|
3258
|
+
* — the algorithm normally converges (and prunes against the best known
|
|
3259
|
+
* target distance) long before reaching it.
|
|
3260
|
+
*/
|
|
3261
|
+
type WeightedShortestPathOptions<G extends GraphDef> = Omit<BaseTraversalOptions<G>, "maxHops" | "cyclePolicy"> & Readonly<{
|
|
3262
|
+
/**
|
|
3263
|
+
* Top-level edge property supplying each edge's non-negative numeric
|
|
3264
|
+
* weight.
|
|
3265
|
+
*/
|
|
3266
|
+
weightProperty: string;
|
|
3267
|
+
/**
|
|
3268
|
+
* Weight substituted for edges missing `weightProperty`. Must be a
|
|
3269
|
+
* non-negative number within the same upper bound the audit applies to
|
|
3270
|
+
* stored weights (~9.7e289, so accumulated path sums can never
|
|
3271
|
+
* overflow). Without it, a missing weight throws
|
|
3272
|
+
* `InvalidEdgeWeightError`.
|
|
3273
|
+
*/
|
|
3274
|
+
defaultWeight?: number;
|
|
3275
|
+
/** Maximum relaxation rounds before throwing. Defaults to 1000. */
|
|
3276
|
+
maxIterations?: number;
|
|
3277
|
+
}>;
|
|
3278
|
+
type InternalWeightedShortestPathOptions<G extends GraphDef> = InternalTemporalAlgorithmOptions & Omit<WeightedShortestPathOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
3279
|
+
/**
|
|
3280
|
+
* Result of `weightedShortestPath`: the minimum-total-weight node sequence
|
|
3281
|
+
* from source to target.
|
|
3282
|
+
*/
|
|
3283
|
+
type WeightedShortestPathResult = Readonly<{
|
|
3284
|
+
/** Ordered nodes from source to target (inclusive). */
|
|
3285
|
+
nodes: readonly PathNode[];
|
|
3286
|
+
/** Number of edges traversed. Equals `nodes.length - 1`. */
|
|
3287
|
+
depth: number;
|
|
3288
|
+
/** Sum of the traversed edges' weights. 0 for a self-path. */
|
|
3289
|
+
totalWeight: number;
|
|
3290
|
+
}>;
|
|
3059
3291
|
/**
|
|
3060
3292
|
* Options for `reachable`.
|
|
3061
3293
|
*
|
|
@@ -3075,14 +3307,14 @@ type InternalReachableOptions<G extends GraphDef> = InternalBaseTraversalOptions
|
|
|
3075
3307
|
* "2-hop neighbors" reads more naturally than "reachable with maxHops=2".
|
|
3076
3308
|
* The source is always excluded.
|
|
3077
3309
|
*/
|
|
3078
|
-
type NeighborsOptions<G extends GraphDef> = TemporalAlgorithmOptions & Readonly<{
|
|
3310
|
+
type NeighborsOptions<G extends GraphDef> = TemporalAlgorithmOptions & IterativeMemoryOptions & Readonly<{
|
|
3079
3311
|
/** Edge kinds to follow. At least one kind is required. */
|
|
3080
3312
|
edges: readonly EdgeKinds<G>[];
|
|
3081
3313
|
/** Maximum neighborhood depth (default: 1). Must be between 1 and 1000. */
|
|
3082
3314
|
depth?: number;
|
|
3083
3315
|
/** Direction of traversal (default: `"out"`). */
|
|
3084
3316
|
direction?: TraversalDirection;
|
|
3085
|
-
/**
|
|
3317
|
+
/** Compatibility option; set-based algorithms always visit a node once. */
|
|
3086
3318
|
cyclePolicy?: AlgorithmCyclePolicy;
|
|
3087
3319
|
}>;
|
|
3088
3320
|
type InternalNeighborsOptions<G extends GraphDef> = InternalTemporalAlgorithmOptions & Omit<NeighborsOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
@@ -3102,6 +3334,34 @@ type DegreeOptions<G extends GraphDef> = TemporalAlgorithmOptions & Readonly<{
|
|
|
3102
3334
|
direction?: TraversalDirection;
|
|
3103
3335
|
}>;
|
|
3104
3336
|
type InternalDegreeOptions<G extends GraphDef> = InternalTemporalAlgorithmOptions & Omit<DegreeOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
3337
|
+
/**
|
|
3338
|
+
* Options for exact weakly connected components.
|
|
3339
|
+
*
|
|
3340
|
+
* Selected edges are treated as undirected, regardless of their declared
|
|
3341
|
+
* direction. By default every visible graph node is returned; `nodeKinds`
|
|
3342
|
+
* restricts the operation to the induced subgraph over those kinds. Nodes in
|
|
3343
|
+
* scope with no selected incident edge form singleton components.
|
|
3344
|
+
*/
|
|
3345
|
+
type WeaklyConnectedComponentsOptions<G extends GraphDef> = TemporalAlgorithmOptions & IterativeMemoryOptions & Readonly<{
|
|
3346
|
+
/** Edge kinds whose undirected projection defines connectivity. */
|
|
3347
|
+
edges: readonly EdgeKinds<G>[];
|
|
3348
|
+
/** Optional node kinds defining the induced subgraph to analyze. */
|
|
3349
|
+
nodeKinds?: readonly NodeKinds<G>[];
|
|
3350
|
+
/** Maximum label-propagation rounds before throwing. Defaults to 1000. */
|
|
3351
|
+
maxIterations?: number;
|
|
3352
|
+
}>;
|
|
3353
|
+
type InternalWeaklyConnectedComponentsOptions<G extends GraphDef> = InternalTemporalAlgorithmOptions & Omit<WeaklyConnectedComponentsOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
3354
|
+
/** One node's membership in an exact weakly connected component. */
|
|
3355
|
+
type WeaklyConnectedComponentMembership = Readonly<{
|
|
3356
|
+
id: string;
|
|
3357
|
+
kind: string;
|
|
3358
|
+
/** Deterministic minimum node id in this component. */
|
|
3359
|
+
componentId: string;
|
|
3360
|
+
/** Kind paired with `componentId`; node identity is `(kind, id)`. */
|
|
3361
|
+
componentKind: string;
|
|
3362
|
+
/** Number of visible nodes in this component. */
|
|
3363
|
+
size: number;
|
|
3364
|
+
}>;
|
|
3105
3365
|
|
|
3106
3366
|
/**
|
|
3107
3367
|
* Raw node id or any object with an `id: string` field. Covers `Node`,
|
|
@@ -3136,6 +3396,27 @@ type GraphAlgorithms<G extends GraphDef> = Readonly<{
|
|
|
3136
3396
|
* ```
|
|
3137
3397
|
*/
|
|
3138
3398
|
shortestPath: (from: NodeIdentifier, to: NodeIdentifier, options: ShortestPathOptions<G>) => Promise<ShortestPathResult | undefined>;
|
|
3399
|
+
/**
|
|
3400
|
+
* Finds the minimum-total-weight path from `from` to `to`, weighting each
|
|
3401
|
+
* traversed edge by the numeric `weightProperty` stored on it. Returns
|
|
3402
|
+
* `undefined` when no path exists. Weights must be non-negative; a
|
|
3403
|
+
* negative, non-numeric, or (without `defaultWeight`) missing weight on
|
|
3404
|
+
* any visible edge of the selected kinds throws `InvalidEdgeWeightError`
|
|
3405
|
+
* before traversal starts.
|
|
3406
|
+
*
|
|
3407
|
+
* @example
|
|
3408
|
+
* ```typescript
|
|
3409
|
+
* const path = await store.algorithms.weightedShortestPath(alice, bob, {
|
|
3410
|
+
* edges: ["knows"],
|
|
3411
|
+
* weightProperty: "interactionCost",
|
|
3412
|
+
* direction: "both",
|
|
3413
|
+
* });
|
|
3414
|
+
* if (path) {
|
|
3415
|
+
* console.log(`total weight ${path.totalWeight} over ${path.depth} hops`);
|
|
3416
|
+
* }
|
|
3417
|
+
* ```
|
|
3418
|
+
*/
|
|
3419
|
+
weightedShortestPath: (from: NodeIdentifier, to: NodeIdentifier, options: WeightedShortestPathOptions<G>) => Promise<WeightedShortestPathResult | undefined>;
|
|
3139
3420
|
/**
|
|
3140
3421
|
* Returns every node reachable from `from` within `maxHops` edges of the
|
|
3141
3422
|
* allowed kinds. Each node carries its minimum discovered depth.
|
|
@@ -3143,7 +3424,7 @@ type GraphAlgorithms<G extends GraphDef> = Readonly<{
|
|
|
3143
3424
|
reachable: (from: NodeIdentifier, options: ReachableOptions<G>) => Promise<readonly ReachableNode[]>;
|
|
3144
3425
|
/**
|
|
3145
3426
|
* Fast boolean check: is `to` reachable from `from` within `maxHops`
|
|
3146
|
-
* edges?
|
|
3427
|
+
* edges? Uses bidirectional BFS and stops when the frontiers meet.
|
|
3147
3428
|
*/
|
|
3148
3429
|
canReach: (from: NodeIdentifier, to: NodeIdentifier, options: BaseTraversalOptions<G>) => Promise<boolean>;
|
|
3149
3430
|
/**
|
|
@@ -3158,13 +3439,22 @@ type GraphAlgorithms<G extends GraphDef> = Readonly<{
|
|
|
3158
3439
|
* With `direction: "both"` (default), self-loops contribute once.
|
|
3159
3440
|
*/
|
|
3160
3441
|
degree: (node: NodeIdentifier, options?: DegreeOptions<G>) => Promise<number>;
|
|
3442
|
+
/**
|
|
3443
|
+
* Computes exact weakly connected components over the selected edge kinds.
|
|
3444
|
+
*
|
|
3445
|
+
* Iterative: runs multiple SQL rounds in one snapshot and requires
|
|
3446
|
+
* `backend.capabilities.graphAnalytics.supported`.
|
|
3447
|
+
*/
|
|
3448
|
+
weaklyConnectedComponents: (options: WeaklyConnectedComponentsOptions<G>) => Promise<readonly WeaklyConnectedComponentMembership[]>;
|
|
3161
3449
|
}>;
|
|
3162
3450
|
type InternalGraphAlgorithms<G extends GraphDef> = Readonly<{
|
|
3163
3451
|
shortestPath: (from: NodeIdentifier, to: NodeIdentifier, options: InternalShortestPathOptions<G>) => Promise<ShortestPathResult | undefined>;
|
|
3452
|
+
weightedShortestPath: (from: NodeIdentifier, to: NodeIdentifier, options: InternalWeightedShortestPathOptions<G>) => Promise<WeightedShortestPathResult | undefined>;
|
|
3164
3453
|
reachable: (from: NodeIdentifier, options: InternalReachableOptions<G>) => Promise<readonly ReachableNode[]>;
|
|
3165
3454
|
canReach: (from: NodeIdentifier, to: NodeIdentifier, options: InternalBaseTraversalOptions<G>) => Promise<boolean>;
|
|
3166
3455
|
neighbors: (node: NodeIdentifier, options: InternalNeighborsOptions<G>) => Promise<readonly ReachableNode[]>;
|
|
3167
3456
|
degree: (node: NodeIdentifier, options?: InternalDegreeOptions<G>) => Promise<number>;
|
|
3457
|
+
weaklyConnectedComponents: (options: InternalWeaklyConnectedComponentsOptions<G>) => Promise<readonly WeaklyConnectedComponentMembership[]>;
|
|
3168
3458
|
}>;
|
|
3169
3459
|
|
|
3170
3460
|
type RebuildFulltextOptions = Readonly<{
|
|
@@ -3901,9 +4191,11 @@ declare class Store<G extends GraphDef> {
|
|
|
3901
4191
|
* Tier 1 graph algorithms: shortest path, reachability, neighborhoods, and
|
|
3902
4192
|
* degree centrality.
|
|
3903
4193
|
*
|
|
3904
|
-
*
|
|
3905
|
-
*
|
|
3906
|
-
*
|
|
4194
|
+
* Traversal calls use the iterative graph-operation substrate: a set-based
|
|
4195
|
+
* breadth-first frontier backed by a temporary working table, or a chunked
|
|
4196
|
+
* inline relation when the backend cannot pin a transactional connection.
|
|
4197
|
+
* `degree` uses a single count query. The facade is built lazily on first
|
|
4198
|
+
* access and cached for the lifetime of the store.
|
|
3907
4199
|
*
|
|
3908
4200
|
* @example
|
|
3909
4201
|
* ```typescript
|
|
@@ -4277,13 +4569,16 @@ declare class Store<G extends GraphDef> {
|
|
|
4277
4569
|
* transaction**, for writing the caller's own relational tables in
|
|
4278
4570
|
* the same atomic boundary (the graph-owned counterpart of
|
|
4279
4571
|
* {@link Store.withTransaction}). See {@link TransactionContext}
|
|
4280
|
-
* for per-backend semantics
|
|
4281
|
-
*
|
|
4282
|
-
*
|
|
4283
|
-
*
|
|
4284
|
-
*
|
|
4285
|
-
*
|
|
4286
|
-
* `
|
|
4572
|
+
* for per-backend semantics. To decide at runtime whether `tx.sql` is
|
|
4573
|
+
* usable, branch on `tx.sqlAvailability` rather than truthiness-testing
|
|
4574
|
+
* `tx.sql` — under history capture or revision tracking `tx.sql` is
|
|
4575
|
+
* present-but-throwing (`sqlAvailability` is `"history"` /
|
|
4576
|
+
* `"revisionTracking"`), and it is `undefined` only on the non-transactional
|
|
4577
|
+
* fallback (`sqlAvailability === "unavailable"`). When it reports
|
|
4578
|
+
* `"history"` / `"revisionTracking"`, raw SQL is disabled because it would
|
|
4579
|
+
* bypass recorded-time capture or the revision anchor; use the typed
|
|
4580
|
+
* collections inside `transaction()` or
|
|
4581
|
+
* {@link Store.withRecordedTransaction}.
|
|
4287
4582
|
*
|
|
4288
4583
|
* @example
|
|
4289
4584
|
* ```typescript
|
|
@@ -4355,11 +4650,12 @@ declare class Store<G extends GraphDef> {
|
|
|
4355
4650
|
*
|
|
4356
4651
|
* The receipt does not count writes that bypass the `tx.nodes.*` /
|
|
4357
4652
|
* `tx.edges.*` collections, such as direct backend writes, raw SQL, or
|
|
4358
|
-
* import helpers.
|
|
4359
|
-
*
|
|
4360
|
-
*
|
|
4361
|
-
*
|
|
4362
|
-
*
|
|
4653
|
+
* import helpers. The adopted-commit sibling
|
|
4654
|
+
* {@link Store.withRecordedTransaction} also returns a
|
|
4655
|
+
* {@link TransactionOutcome}; only `withTransaction` (whose commit belongs
|
|
4656
|
+
* entirely to the caller with no flush point) produces no receipt. On
|
|
4657
|
+
* non-transactional backends, the receipt is still returned, but it describes
|
|
4658
|
+
* operations that individually committed rather than one atomic commit; if the
|
|
4363
4659
|
* callback rejects on such a backend, no receipt is returned even though
|
|
4364
4660
|
* earlier operations committed individually.
|
|
4365
4661
|
*
|
|
@@ -4367,6 +4663,12 @@ declare class Store<G extends GraphDef> {
|
|
|
4367
4663
|
* recorded commit instant this transaction allocated for the store's
|
|
4368
4664
|
* graph, or `undefined` when nothing was captured.
|
|
4369
4665
|
*
|
|
4666
|
+
* The callback receives a {@link MeasurableTransactionContext}: call
|
|
4667
|
+
* `tx.measure((scoped) => ...)` to scope a sub-receipt to the writes made
|
|
4668
|
+
* through the `scoped` context (e.g. to attribute writes to user code the
|
|
4669
|
+
* caller invokes, excluding its own bookkeeping written through `tx`). See
|
|
4670
|
+
* {@link MeasurableTransactionContext} for semantics.
|
|
4671
|
+
*
|
|
4370
4672
|
* @example
|
|
4371
4673
|
* ```typescript
|
|
4372
4674
|
* const outcome = await store.transactionWithReceipt(async (tx) => {
|
|
@@ -4377,8 +4679,8 @@ declare class Store<G extends GraphDef> {
|
|
|
4377
4679
|
* outcome.receipt.writes; // { nodes: { Person: 1 }, edges: {}, total: 1 }
|
|
4378
4680
|
* ```
|
|
4379
4681
|
*/
|
|
4380
|
-
transactionWithReceipt<T>(this: HistoryStore<G>, fn: (tx:
|
|
4381
|
-
transactionWithReceipt<T>(fn: (tx:
|
|
4682
|
+
transactionWithReceipt<T>(this: HistoryStore<G>, fn: (tx: MeasurableHistoryTransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<TransactionOutcome<T>>;
|
|
4683
|
+
transactionWithReceipt<T>(fn: (tx: MeasurableTransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<TransactionOutcome<T>>;
|
|
4382
4684
|
/**
|
|
4383
4685
|
* Adopts a caller-owned, already-open Drizzle transaction so the graph
|
|
4384
4686
|
* store and the caller's relational writes commit or roll back as one
|
|
@@ -4431,11 +4733,14 @@ declare class Store<G extends GraphDef> {
|
|
|
4431
4733
|
*
|
|
4432
4734
|
* Not available when the store was created with `{ history: true }`: a
|
|
4433
4735
|
* caller-owned transaction context would let writes happen after capture has
|
|
4434
|
-
* lost its flush point
|
|
4435
|
-
* (`
|
|
4436
|
-
* {@link Store.withRecordedTransaction}
|
|
4437
|
-
*
|
|
4438
|
-
*
|
|
4736
|
+
* lost its flush point. On a {@link HistoryStore} this is a **compile error**
|
|
4737
|
+
* at the call site (the `externalTx` argument is rejected against a message
|
|
4738
|
+
* type naming {@link Store.withRecordedTransaction}); the runtime guard still
|
|
4739
|
+
* throws `ConfigurationError`
|
|
4740
|
+
* (`RECORDED_CAPTURE_REQUIRES_CALLBACK_TRANSACTION`) if the check is
|
|
4741
|
+
* suppressed. Use {@link Store.withRecordedTransaction} on a history-enabled
|
|
4742
|
+
* store, which adopts the same external transaction but flushes recorded-time
|
|
4743
|
+
* capture before the caller commits.
|
|
4439
4744
|
*
|
|
4440
4745
|
* @throws {ConfigurationError} when the store has history capture enabled
|
|
4441
4746
|
* (use {@link Store.withRecordedTransaction} instead), or when the backend
|
|
@@ -4451,7 +4756,7 @@ declare class Store<G extends GraphDef> {
|
|
|
4451
4756
|
* `createStoreWithSchema`). Rolls back the caller's transaction
|
|
4452
4757
|
* without emitting any DDL.
|
|
4453
4758
|
*/
|
|
4454
|
-
withTransaction(externalTx: AdoptedTransaction): TransactionContext<G>;
|
|
4759
|
+
withTransaction<This extends Store<G>>(this: This, externalTx: This extends HistoryStore<G> ? HistoryWithTransactionUnavailable : AdoptedTransaction): This extends HistoryStore<G> ? never : TransactionContext<G>;
|
|
4455
4760
|
/**
|
|
4456
4761
|
* Adopts a caller-owned transaction while giving recorded-time capture a
|
|
4457
4762
|
* flush point before the caller commits. Required when `history: true` is
|
|
@@ -4462,16 +4767,55 @@ declare class Store<G extends GraphDef> {
|
|
|
4462
4767
|
* session, so a graph write made through the transaction context *after* `fn`
|
|
4463
4768
|
* returns (e.g. retaining `tx` and writing once more before the caller's
|
|
4464
4769
|
* COMMIT) throws rather than committing uncaptured — the post-flush write
|
|
4465
|
-
* cannot silently diverge history from live state.
|
|
4770
|
+
* cannot silently diverge history from live state. This sealing behavior is
|
|
4771
|
+
* unchanged by the receipt return.
|
|
4772
|
+
*
|
|
4773
|
+
* Returns a {@link TransactionOutcome} — the adopted path is the only way to
|
|
4774
|
+
* get exactly-once cursors and graph writes atomically on a history store, so
|
|
4775
|
+
* it surfaces the same receipt `transactionWithReceipt` does: `receipt.writes`
|
|
4776
|
+
* for drop detection (a non-delete change that wrote nothing) and
|
|
4777
|
+
* `receipt.recorded` as the per-transaction replay anchor. Destructure
|
|
4778
|
+
* `{ result, receipt }`:
|
|
4466
4779
|
*
|
|
4467
|
-
*
|
|
4468
|
-
*
|
|
4469
|
-
*
|
|
4470
|
-
*
|
|
4471
|
-
*
|
|
4780
|
+
* ```typescript
|
|
4781
|
+
* const { result, receipt } = await store.withRecordedTransaction(
|
|
4782
|
+
* externalTx,
|
|
4783
|
+
* async (tx) => tx.nodes.Document.update(documentId, props),
|
|
4784
|
+
* );
|
|
4785
|
+
* ```
|
|
4786
|
+
*
|
|
4787
|
+
* `receipt.recorded` is the recorded commit instant this transaction allocated
|
|
4788
|
+
* for the store's graph at the flush point (when `fn` resolved), and is
|
|
4789
|
+
* `undefined` when nothing was captured — a read-only `fn`, or a non-history
|
|
4790
|
+
* store (where the receipt still counts write intents but there is no recorded
|
|
4791
|
+
* time). To attribute writes when `fn` invokes user code that also
|
|
4792
|
+
* bookkeeps, use `tx.measure((scoped) => ...)` and have that code write
|
|
4793
|
+
* through the `scoped` context (see {@link MeasurableTransactionContext}).
|
|
4794
|
+
*
|
|
4795
|
+
* Write your own relational tables through the **external transaction handle
|
|
4796
|
+
* you passed in** (`externalTx`) — it *is* the pinned connection. `tx.sql` is
|
|
4797
|
+
* unavailable here (it is a fail-loud guard under history capture, since raw
|
|
4798
|
+
* SQL bypasses recorded-time capture, and `HistoryTransactionContext` types it
|
|
4799
|
+
* `sql?: never`). Writing through `externalTx` is the sanctioned way to get
|
|
4800
|
+
* cross-store atomicity on a history-enabled store:
|
|
4801
|
+
*
|
|
4802
|
+
* ```typescript
|
|
4803
|
+
* // Async driver (Postgres / libsql):
|
|
4804
|
+
* await db.transaction(async (pgTx) => {
|
|
4805
|
+
* const { receipt } = await store.withRecordedTransaction(pgTx, async (tx) => {
|
|
4806
|
+
* await tx.nodes.Document.update(documentId, props); // graph write
|
|
4807
|
+
* });
|
|
4808
|
+
* await pgTx.insert(streamCursors).values(cursorRow); // your own table
|
|
4809
|
+
* }); // one COMMIT / ROLLBACK across both layers
|
|
4810
|
+
* ```
|
|
4811
|
+
*
|
|
4812
|
+
* The graph writes and your `externalTx` statements share the caller's one
|
|
4813
|
+
* pinned connection. TypeGraph serializes the statements its collections
|
|
4814
|
+
* issue; sequence your own raw statements (and don't `Promise.all` them with
|
|
4815
|
+
* graph writes) so two queries never race on that connection.
|
|
4472
4816
|
*/
|
|
4473
|
-
withRecordedTransaction<T>(this: HistoryStore<G>, externalTx: AdoptedTransaction, fn: (tx:
|
|
4474
|
-
withRecordedTransaction<T>(externalTx: AdoptedTransaction, fn: (tx:
|
|
4817
|
+
withRecordedTransaction<T>(this: HistoryStore<G>, externalTx: AdoptedTransaction, fn: (tx: MeasurableHistoryTransactionContext<G>) => Promise<T>): Promise<TransactionOutcome<T>>;
|
|
4818
|
+
withRecordedTransaction<T>(externalTx: AdoptedTransaction, fn: (tx: MeasurableTransactionContext<G>) => Promise<T>): Promise<TransactionOutcome<T>>;
|
|
4475
4819
|
/**
|
|
4476
4820
|
* Hard-deletes all data for this graph from the database.
|
|
4477
4821
|
*
|
|
@@ -4649,6 +4993,19 @@ declare class Store<G extends GraphDef> {
|
|
|
4649
4993
|
* has no schema yet.
|
|
4650
4994
|
*/
|
|
4651
4995
|
materializeIndexes(options?: MaterializeIndexesOptions): Promise<MaterializeIndexesResult>;
|
|
4996
|
+
/**
|
|
4997
|
+
* Materializes TypeGraph's own base-relation indexes
|
|
4998
|
+
* (`SYSTEM_INDEX_DECLARATIONS`) against the live database.
|
|
4999
|
+
*
|
|
5000
|
+
* Bootstrap DDL runs only on first boot, so a system index shipped in a
|
|
5001
|
+
* newer library version never reaches an already-initialized database on
|
|
5002
|
+
* its own. `createStoreWithSchema` runs this automatically; deployments
|
|
5003
|
+
* that boot with plain `createStore` / `createVerifiedStore` (zero-DDL by
|
|
5004
|
+
* contract) adopt new system indexes by calling this once under a role
|
|
5005
|
+
* that may run DDL. Same status-table, drift-signature, and Postgres
|
|
5006
|
+
* `CREATE INDEX CONCURRENTLY` claim semantics as `materializeIndexes`.
|
|
5007
|
+
*/
|
|
5008
|
+
materializeSystemIndexes(options?: MaterializeSystemIndexesOptions): Promise<MaterializeIndexesResult>;
|
|
4652
5009
|
/**
|
|
4653
5010
|
* Recreate a vector field's per-field storage at its current declared
|
|
4654
5011
|
* dimension, then optionally re-embed existing rows.
|
|
@@ -4729,6 +5086,17 @@ type HistoryTransactionContext<G extends GraphDef> = Omit<TransactionContext<G>,
|
|
|
4729
5086
|
backend: HistorySafeTransactionBackend;
|
|
4730
5087
|
sql?: never;
|
|
4731
5088
|
}>;
|
|
5089
|
+
/**
|
|
5090
|
+
* The {@link HistoryTransactionContext} handed to a `withRecordedTransaction`
|
|
5091
|
+
* callback, extended with {@link ScopedMeasure}. Its `measure` scopes to a child
|
|
5092
|
+
* {@link MeasurableHistoryTransactionContext} (so nested scopes keep the
|
|
5093
|
+
* history-safe `sql?: never` / backend typing). Assignable to
|
|
5094
|
+
* {@link MeasurableTransactionContext} (and hence to {@link TransactionContext}),
|
|
5095
|
+
* so a projector helper typed against either still accepts it.
|
|
5096
|
+
*/
|
|
5097
|
+
type MeasurableHistoryTransactionContext<G extends GraphDef> = HistoryTransactionContext<G> & Readonly<{
|
|
5098
|
+
measure: ScopedMeasure<MeasurableHistoryTransactionContext<G>>;
|
|
5099
|
+
}>;
|
|
4732
5100
|
type RecordedReadStore<G extends GraphDef> = Store<G> & Readonly<{
|
|
4733
5101
|
recordedReadBound: true;
|
|
4734
5102
|
}>;
|
|
@@ -4737,6 +5105,15 @@ type HistoryStore<G extends GraphDef> = Store<G> & Readonly<{
|
|
|
4737
5105
|
historyEnabled: true;
|
|
4738
5106
|
recordedReadBound: true;
|
|
4739
5107
|
}>;
|
|
5108
|
+
/**
|
|
5109
|
+
* The `externalTx` parameter type {@link Store.withTransaction} resolves to when
|
|
5110
|
+
* called on a {@link HistoryStore}. A real {@link AdoptedTransaction} is not
|
|
5111
|
+
* assignable to this string literal, so the call is a compile error whose
|
|
5112
|
+
* message names the working alternative. `HistoryStore` cannot be excluded from
|
|
5113
|
+
* the general signature by a `this` constraint alone — it is a subtype of
|
|
5114
|
+
* `Store<G>` — so the block is expressed on the argument instead.
|
|
5115
|
+
*/
|
|
5116
|
+
type HistoryWithTransactionUnavailable = "withTransaction() is unavailable on a history-enabled store — use store.withRecordedTransaction() so recorded-time capture can flush before the caller commits";
|
|
4740
5117
|
type ExplicitRecordedReadLiveOptions = LiveStoreOptions & Readonly<{
|
|
4741
5118
|
recordedRead: NonNullable<LiveStoreOptions["recordedRead"]>;
|
|
4742
5119
|
}>;
|
|
@@ -4894,12 +5271,29 @@ type StoreViewSubgraphOptions<G extends GraphDef, EK extends EdgeKinds<G>, NK ex
|
|
|
4894
5271
|
type StoreViewReachableOptions<G extends GraphDef> = Omit<ReachableOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
4895
5272
|
/** `shortestPath` options with the temporal axis removed (the pin supplies it). */
|
|
4896
5273
|
type StoreViewShortestPathOptions<G extends GraphDef> = Omit<ShortestPathOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
5274
|
+
/**
|
|
5275
|
+
* `weightedShortestPath` options with the temporal axis removed (the pin
|
|
5276
|
+
* supplies it).
|
|
5277
|
+
*/
|
|
5278
|
+
type StoreViewWeightedShortestPathOptions<G extends GraphDef> = Omit<WeightedShortestPathOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
4897
5279
|
/** `canReach` options with the temporal axis removed (the pin supplies it). */
|
|
4898
5280
|
type StoreViewCanReachOptions<G extends GraphDef> = Omit<BaseTraversalOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
4899
5281
|
/** `neighbors` options with the temporal axis removed (the pin supplies it). */
|
|
4900
5282
|
type StoreViewNeighborsOptions<G extends GraphDef> = Omit<NeighborsOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
4901
5283
|
/** `degree` options with the temporal axis removed (the pin supplies it). */
|
|
4902
5284
|
type StoreViewDegreeOptions<G extends GraphDef> = Omit<DegreeOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
5285
|
+
/** WCC options with the temporal axis removed (the view's pin supplies it). */
|
|
5286
|
+
type StoreViewWeaklyConnectedComponentsOptions<G extends GraphDef> = Omit<WeaklyConnectedComponentsOptions<G>, keyof TemporalAlgorithmOptions>;
|
|
5287
|
+
/** Graph-algorithm facade sealed to a {@link StoreView}'s coordinate. */
|
|
5288
|
+
type StoreViewGraphAlgorithms<G extends GraphDef> = Readonly<{
|
|
5289
|
+
shortestPath: (from: NodeIdentifier, to: NodeIdentifier, options: StoreViewShortestPathOptions<G>) => Promise<ShortestPathResult | undefined>;
|
|
5290
|
+
weightedShortestPath: (from: NodeIdentifier, to: NodeIdentifier, options: StoreViewWeightedShortestPathOptions<G>) => Promise<WeightedShortestPathResult | undefined>;
|
|
5291
|
+
reachable: (from: NodeIdentifier, options: StoreViewReachableOptions<G>) => Promise<readonly ReachableNode[]>;
|
|
5292
|
+
canReach: (from: NodeIdentifier, to: NodeIdentifier, options: StoreViewCanReachOptions<G>) => Promise<boolean>;
|
|
5293
|
+
neighbors: (node: NodeIdentifier, options: StoreViewNeighborsOptions<G>) => Promise<readonly ReachableNode[]>;
|
|
5294
|
+
degree: (node: NodeIdentifier, options?: StoreViewDegreeOptions<G>) => Promise<number>;
|
|
5295
|
+
weaklyConnectedComponents: (options: StoreViewWeaklyConnectedComponentsOptions<G>) => Promise<readonly WeaklyConnectedComponentMembership[]>;
|
|
5296
|
+
}>;
|
|
4903
5297
|
/**
|
|
4904
5298
|
* Shared base for the read-only views. Holds the pinned {@link ReadCoordinate}
|
|
4905
5299
|
* and delegates the graph algorithms, `subgraph`, and `query` to the live store
|
|
@@ -4923,11 +5317,15 @@ declare abstract class CoordinatePinnedView<G extends GraphDef> {
|
|
|
4923
5317
|
* view's coordinate cannot be overridden on a per-query basis.
|
|
4924
5318
|
*/
|
|
4925
5319
|
query(): InitialQueryBuilder<G, "sealed">;
|
|
4926
|
-
protected
|
|
5320
|
+
protected internalAlgorithms(): InternalGraphAlgorithms<G>;
|
|
5321
|
+
/** Graph algorithms pinned to this view's immutable temporal coordinate. */
|
|
5322
|
+
get algorithms(): StoreViewGraphAlgorithms<G>;
|
|
4927
5323
|
/** Extracts a subgraph at this view's pinned coordinate. */
|
|
4928
5324
|
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>>;
|
|
4929
5325
|
/** Shortest path between two nodes at this view's pinned coordinate. */
|
|
4930
5326
|
shortestPath(from: NodeIdentifier, to: NodeIdentifier, options: StoreViewShortestPathOptions<G>): Promise<ShortestPathResult | undefined>;
|
|
5327
|
+
/** Minimum-total-weight path at this view's pinned coordinate. */
|
|
5328
|
+
weightedShortestPath(from: NodeIdentifier, to: NodeIdentifier, options: StoreViewWeightedShortestPathOptions<G>): Promise<WeightedShortestPathResult | undefined>;
|
|
4931
5329
|
/** Nodes reachable from `from` at this view's pinned coordinate. */
|
|
4932
5330
|
reachable(from: NodeIdentifier, options: StoreViewReachableOptions<G>): Promise<readonly ReachableNode[]>;
|
|
4933
5331
|
/** Whether `to` is reachable from `from` at this view's pinned coordinate. */
|
|
@@ -4936,6 +5334,8 @@ declare abstract class CoordinatePinnedView<G extends GraphDef> {
|
|
|
4936
5334
|
neighbors(node: NodeIdentifier, options: StoreViewNeighborsOptions<G>): Promise<readonly ReachableNode[]>;
|
|
4937
5335
|
/** Counts active edges incident to `node` at this view's pinned coordinate. */
|
|
4938
5336
|
degree(node: NodeIdentifier, options?: StoreViewDegreeOptions<G>): Promise<number>;
|
|
5337
|
+
/** Exact WCC memberships at this view's pinned coordinate. */
|
|
5338
|
+
weaklyConnectedComponents(options: StoreViewWeaklyConnectedComponentsOptions<G>): Promise<readonly WeaklyConnectedComponentMembership[]>;
|
|
4939
5339
|
}
|
|
4940
5340
|
/**
|
|
4941
5341
|
* A read-only `(mode, asOf)` lens over a {@link Store}. Construct one via
|
|
@@ -4987,4 +5387,4 @@ declare class RecordedStoreView<G extends GraphDef> extends CoordinatePinnedView
|
|
|
4987
5387
|
get edges(): RecordedStoreViewEdgeCollections<G>;
|
|
4988
5388
|
}
|
|
4989
5389
|
|
|
4990
|
-
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
|
|
5390
|
+
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 SearchScopeOptions 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 HistoryWithTransactionUnavailable as a7, type HookContext as a8, type HybridFulltextOptions as a9, type OperationHookContext as aA, type PaginateOptions as aB, type PaginatedResult as aC, type PathNode as aD, type Predicate as aE, PreparedQuery as aF, type PropsAccessor as aG, type QueryHookContext as aH, type QueryOptions as aI, type ReachableNode as aJ, type ReachableOptions as aK, type RebuildFulltextOptions as aL, type RebuildFulltextResult as aM, type ReclaimedVectorFieldEntry as aN, type RecordedInstant as aO, type RecordedReadStore as aP, RecordedStoreView as aQ, type RecordedStoreViewEdgeCollection as aR, type RecordedStoreViewEdgeCollections as aS, type RecordedStoreViewNodeCollection as aT, type RecordedStoreViewNodeCollections as aU, type RecursiveTraversalOptions as aV, type ReembedFunction as aW, type ReembedVectorFieldOptions as aX, type ReembedVectorFieldResult as aY, type SchemaIntrospection as aZ, type ScopedMeasure as a_, type HybridSearchHit as aa, type HybridSearchOptions as ab, type HybridVectorOptions as ac, type IfExistsMode as ad, type InitialQueryBuilder as ae, type KindIntrospection as af, type LiveStoreOptions as ag, type MaterializeRemovalsEntry as ah, type MaterializeRemovalsOptions as ai, type MaterializeRemovalsResult as aj, type MeasurableHistoryTransactionContext as ak, type MeasurableTransactionContext as al, type NeighborsOptions as am, type NoRecordedCoordinate as an, type NodeAccessor as ao, type NodeAlias as ap, type NodeBulkFindByIndexOptions as aq, type NodeCollection as ar, type NodeCurrentReads as as, type NodeGetOrCreateByConstraintOptions as at, type NodeGetOrCreateByConstraintResult as au, type NodeIdentifier as av, type NodeRef as aw, type NodeTemporalReads as ax, type NodeWrites as ay, type OntologyIntrospection as az, type EdgeAliasMap as b, getSearchableMetadata as b$, type SearchableMetadata as b0, type SearchableOptions as b1, type SearchableSchema as b2, type SelectContext as b3, type SelectableEdge as b4, type SelectableNode as b5, type ShortestPathOptions as b6, type ShortestPathResult as b7, type SqlAvailability as b8, type StoreHooks as b9, type TemporalAlgorithmOptions as bA, type TransactionContext as bB, type TransactionOutcome as bC, type TransactionReceipt as bD, type TraversalDirection as bE, type TypedEdgeCollection as bF, type TypedRecordedStoreViewEdgeCollection as bG, type TypedStoreViewEdgeCollection as bH, UnionableQuery as bI, type UpdateEdgeInput as bJ, type UpdateNodeInput as bK, type VectorSearchHit as bL, type VectorSearchOptions as bM, type WeaklyConnectedComponentMembership as bN, type WeaklyConnectedComponentsOptions as bO, type WeightedShortestPathOptions as bP, type WeightedShortestPathResult as bQ, asRecordedInstant as bR, createQueryBuilder as bS, createStore as bT, createStoreWithSchema as bU, createVerifiedStore as bV, defineSubgraphProject as bW, embedding as bX, exists as bY, fieldRef as bZ, getEmbeddingDimensions as b_, type StoreOptions as ba, type StoreProjection as bb, type StoreRef as bc, StoreSearch as bd, StoreView as be, type StoreViewCanReachOptions as bf, type StoreViewCoordinate as bg, type StoreViewDegreeOptions as bh, type StoreViewEdgeCollection as bi, type StoreViewEdgeCollections as bj, type StoreViewGraphAlgorithms as bk, type StoreViewNeighborsOptions as bl, type StoreViewNodeCollection as bm, type StoreViewNodeCollections as bn, type StoreViewReachableOptions as bo, type StoreViewShortestPathOptions as bp, type StoreViewSubgraphOptions as bq, type StoreViewWeaklyConnectedComponentsOptions as br, type StoreViewWeightedShortestPathOptions as bs, type StreamOptions as bt, type SubgraphEdgeResult as bu, type SubgraphNodeResult as bv, type SubgraphOptions as bw, type SubgraphResult as bx, type SubsetEdge as by, type SubsetNode as bz, QueryBuilder as c, inSubquery as c0, isEmbeddingSchema as c1, isParameterRef as c2, isSearchableSchema as c3, notExists as c4, notInSubquery as c5, param as c6, resolveGraphVectorSlots as c7, searchable as c8, 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 };
|