@nicia-ai/typegraph 0.34.0 → 0.36.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 +29 -29
- package/dist/backend/postgres/index.d.cts +39 -7
- package/dist/backend/postgres/index.d.ts +39 -7
- package/dist/backend/postgres/index.js +16 -16
- package/dist/backend/postgres/pglite.cjs +21 -21
- package/dist/backend/postgres/pglite.d.cts +4 -4
- package/dist/backend/postgres/pglite.d.ts +4 -4
- package/dist/backend/postgres/pglite.js +16 -16
- package/dist/backend/sqlite/index.cjs +25 -26
- package/dist/backend/sqlite/index.d.cts +8 -8
- package/dist/backend/sqlite/index.d.ts +8 -8
- package/dist/backend/sqlite/index.js +13 -14
- package/dist/backend/sqlite/libsql.cjs +19 -19
- package/dist/backend/sqlite/libsql.d.cts +4 -4
- package/dist/backend/sqlite/libsql.d.ts +4 -4
- package/dist/backend/sqlite/libsql.js +15 -15
- package/dist/backend/sqlite/local.cjs +101 -21
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +95 -5
- package/dist/backend/sqlite/local.d.ts +95 -5
- package/dist/backend/sqlite/local.js +95 -16
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-T6SPUYLX.cjs → chunk-2THZ3TQI.cjs} +116 -10
- package/dist/chunk-2THZ3TQI.cjs.map +1 -0
- package/dist/{chunk-UJLOZYKT.cjs → chunk-456Z2U7Y.cjs} +441 -115
- package/dist/chunk-456Z2U7Y.cjs.map +1 -0
- package/dist/chunk-4BCU6VFZ.cjs +100 -0
- package/dist/chunk-4BCU6VFZ.cjs.map +1 -0
- package/dist/chunk-4BMPGT35.cjs +12 -0
- package/dist/{chunk-HMFK4BXR.cjs.map → chunk-4BMPGT35.cjs.map} +1 -1
- package/dist/chunk-4CAXEB2F.cjs +1366 -0
- package/dist/chunk-4CAXEB2F.cjs.map +1 -0
- package/dist/{chunk-RY2VIWAM.js → chunk-4GX2JJXS.js} +355 -32
- package/dist/chunk-4GX2JJXS.js.map +1 -0
- package/dist/{chunk-GQANNXXT.cjs → chunk-5A6FNS6N.cjs} +75 -20
- package/dist/chunk-5A6FNS6N.cjs.map +1 -0
- package/dist/{chunk-3Z6TW3CT.cjs → chunk-5AQIKK56.cjs} +65 -25
- package/dist/chunk-5AQIKK56.cjs.map +1 -0
- package/dist/{chunk-WLRIWYHQ.js → chunk-5DIPR3L3.js} +2145 -1937
- package/dist/chunk-5DIPR3L3.js.map +1 -0
- package/dist/{chunk-BVTWD66D.js → chunk-5SEGFTZX.js} +3 -3
- package/dist/{chunk-BVTWD66D.js.map → chunk-5SEGFTZX.js.map} +1 -1
- package/dist/{chunk-A7SZZFAG.js → chunk-5VTR2F2K.js} +452 -109
- package/dist/chunk-5VTR2F2K.js.map +1 -0
- package/dist/{chunk-JJRCLAUN.cjs → chunk-5W4L6DLF.cjs} +116 -10
- package/dist/chunk-5W4L6DLF.cjs.map +1 -0
- package/dist/{chunk-6GNSY7AV.js → chunk-6FR2MMS6.js} +7 -7
- package/dist/chunk-6FR2MMS6.js.map +1 -0
- package/dist/{chunk-3BRVBQQD.cjs → chunk-7BQLPXK6.cjs} +2648 -2440
- package/dist/chunk-7BQLPXK6.cjs.map +1 -0
- package/dist/chunk-7YSP4V4R.cjs +69 -0
- package/dist/chunk-7YSP4V4R.cjs.map +1 -0
- package/dist/chunk-A42GCBGX.cjs +28 -0
- package/dist/chunk-A42GCBGX.cjs.map +1 -0
- package/dist/{chunk-ZV5N4DBG.js → chunk-BJVEU3ZL.js} +300 -58
- package/dist/chunk-BJVEU3ZL.js.map +1 -0
- package/dist/chunk-BYPOGQWK.js +25 -0
- package/dist/chunk-BYPOGQWK.js.map +1 -0
- package/dist/chunk-CUHM5CWJ.cjs +12 -0
- package/dist/chunk-CUHM5CWJ.cjs.map +1 -0
- package/dist/{chunk-2JXB3NYJ.cjs → chunk-D7ZEOS56.cjs} +25 -32
- package/dist/chunk-D7ZEOS56.cjs.map +1 -0
- package/dist/chunk-DFVLCOP6.js +10 -0
- package/dist/chunk-DFVLCOP6.js.map +1 -0
- package/dist/{chunk-JIEJCTDS.cjs → chunk-DIK74MXX.cjs} +37 -4
- package/dist/chunk-DIK74MXX.cjs.map +1 -0
- package/dist/chunk-DN5VP4JC.js +1343 -0
- package/dist/chunk-DN5VP4JC.js.map +1 -0
- package/dist/chunk-EOLERH7Y.cjs +40 -0
- package/dist/chunk-EOLERH7Y.cjs.map +1 -0
- package/dist/{chunk-TGJE22RM.cjs → chunk-FACJJWGF.cjs} +24 -6
- package/dist/chunk-FACJJWGF.cjs.map +1 -0
- package/dist/{chunk-WVC2Q2FD.cjs → chunk-FN35DLCN.cjs} +31 -9
- package/dist/chunk-FN35DLCN.cjs.map +1 -0
- package/dist/{chunk-KUTNI6SI.js → chunk-FPIZFYHE.js} +10 -18
- package/dist/chunk-FPIZFYHE.js.map +1 -0
- package/dist/{chunk-VCGO4V26.js → chunk-FRV5Q5IO.js} +64 -9
- package/dist/chunk-FRV5Q5IO.js.map +1 -0
- package/dist/{chunk-K5P5OZXS.js → chunk-G6Q5UM7U.js} +2 -2
- package/dist/{chunk-K5P5OZXS.js.map → chunk-G6Q5UM7U.js.map} +1 -1
- package/dist/{chunk-JQGIPGVL.cjs → chunk-H7YNSMA7.cjs} +43 -2
- package/dist/chunk-H7YNSMA7.cjs.map +1 -0
- package/dist/chunk-HW3LW7DH.cjs +1271 -0
- package/dist/chunk-HW3LW7DH.cjs.map +1 -0
- package/dist/{chunk-V3QNTB7Z.js → chunk-IU46OHVW.js} +194 -114
- package/dist/chunk-IU46OHVW.js.map +1 -0
- package/dist/{chunk-HK5SATYM.cjs → chunk-J3LEGNQB.cjs} +16 -109
- package/dist/chunk-J3LEGNQB.cjs.map +1 -0
- package/dist/{chunk-ZP5WHI4C.cjs → chunk-JFMEONLG.cjs} +358 -116
- package/dist/chunk-JFMEONLG.cjs.map +1 -0
- package/dist/{chunk-2MRAX3UE.js → chunk-JFUPDJXD.js} +47 -4
- package/dist/chunk-JFUPDJXD.js.map +1 -0
- package/dist/{chunk-Z5XBMDXU.js → chunk-KBGQIPRQ.js} +42 -3
- package/dist/chunk-KBGQIPRQ.js.map +1 -0
- package/dist/{chunk-K2TGS3EN.js → chunk-M75SUBFG.js} +138 -89
- package/dist/chunk-M75SUBFG.js.map +1 -0
- package/dist/chunk-OHMP6N2J.js +47 -0
- package/dist/chunk-OHMP6N2J.js.map +1 -0
- package/dist/{chunk-4DIBPQNJ.js → chunk-OR5ZA5WP.js} +135 -25
- package/dist/chunk-OR5ZA5WP.js.map +1 -0
- package/dist/{chunk-6HVOHZHS.cjs → chunk-PWGX5DF5.cjs} +213 -168
- package/dist/chunk-PWGX5DF5.cjs.map +1 -0
- package/dist/chunk-PZKNKG5M.js +1252 -0
- package/dist/chunk-PZKNKG5M.js.map +1 -0
- package/dist/{chunk-DEQFL35G.js → chunk-Q5TEXCTB.js} +61 -7
- package/dist/chunk-Q5TEXCTB.js.map +1 -0
- package/dist/{chunk-QV245VMN.js → chunk-RAXU3RMB.js} +100 -6
- package/dist/chunk-RAXU3RMB.js.map +1 -0
- package/dist/{chunk-RHZWOJVA.cjs → chunk-RSSQKPSZ.cjs} +52 -4
- package/dist/chunk-RSSQKPSZ.cjs.map +1 -0
- package/dist/{chunk-G6SOJEDI.cjs → chunk-S55OV6PW.cjs} +15 -15
- package/dist/chunk-S55OV6PW.cjs.map +1 -0
- package/dist/chunk-S5F7ZLP2.js +94 -0
- package/dist/chunk-S5F7ZLP2.js.map +1 -0
- package/dist/{chunk-3E7SNSIA.cjs → chunk-SJDMVITW.cjs} +4 -4
- package/dist/{chunk-3E7SNSIA.cjs.map → chunk-SJDMVITW.cjs.map} +1 -1
- package/dist/{chunk-CHXTTSC6.js → chunk-SKCOUWAX.js} +104 -5
- package/dist/chunk-SKCOUWAX.js.map +1 -0
- package/dist/{chunk-XLUNB2TZ.js → chunk-SNXVDZAJ.js} +3 -3
- package/dist/{chunk-XLUNB2TZ.js.map → chunk-SNXVDZAJ.js.map} +1 -1
- package/dist/{chunk-ZURTTSCM.js → chunk-SXGE7ITL.js} +6 -94
- package/dist/chunk-SXGE7ITL.js.map +1 -0
- package/dist/{chunk-RBV7YCQD.js → chunk-T2WUSPDA.js} +49 -9
- package/dist/chunk-T2WUSPDA.js.map +1 -0
- package/dist/{chunk-KGC4LY5T.cjs → chunk-TCOCYN2P.cjs} +75 -21
- package/dist/chunk-TCOCYN2P.cjs.map +1 -0
- package/dist/{chunk-FLRCVI2G.cjs → chunk-TDXIBCGY.cjs} +2 -2
- package/dist/{chunk-FLRCVI2G.cjs.map → chunk-TDXIBCGY.cjs.map} +1 -1
- package/dist/{chunk-ZY4GXIVN.cjs → chunk-TEDRJXOG.cjs} +5 -5
- package/dist/{chunk-ZY4GXIVN.cjs.map → chunk-TEDRJXOG.cjs.map} +1 -1
- package/dist/{chunk-WL2SG7ZV.cjs → chunk-UMDVATGY.cjs} +6 -6
- package/dist/{chunk-WL2SG7ZV.cjs.map → chunk-UMDVATGY.cjs.map} +1 -1
- package/dist/chunk-UT3S4SEN.js +31 -0
- package/dist/chunk-UT3S4SEN.js.map +1 -0
- package/dist/{chunk-RRKQAKD6.cjs → chunk-UUT7UN2N.cjs} +149 -39
- package/dist/chunk-UUT7UN2N.cjs.map +1 -0
- package/dist/{chunk-SHLY4MCM.js → chunk-UZV3AZKF.js} +21 -3
- package/dist/chunk-UZV3AZKF.js.map +1 -0
- package/dist/{chunk-CYX2JTDG.js → chunk-VHMPG6UL.js} +29 -7
- package/dist/chunk-VHMPG6UL.js.map +1 -0
- package/dist/{chunk-LANHCOXB.js → chunk-VQEXF5D4.js} +485 -83
- package/dist/chunk-VQEXF5D4.js.map +1 -0
- package/dist/{chunk-K34OPSJK.js → chunk-W63OVYY4.js} +3 -3
- package/dist/{chunk-K34OPSJK.js.map → chunk-W63OVYY4.js.map} +1 -1
- package/dist/{chunk-TQOYM4LN.js → chunk-WI7ISNQF.js} +35 -5
- package/dist/chunk-WI7ISNQF.js.map +1 -0
- package/dist/{chunk-UNNPKQUG.cjs → chunk-X4JBT642.cjs} +246 -155
- package/dist/chunk-X4JBT642.cjs.map +1 -0
- package/dist/chunk-ZAMFOJ5P.cjs +1176 -0
- package/dist/chunk-ZAMFOJ5P.cjs.map +1 -0
- package/dist/{chunk-T46GR2VY.js → chunk-ZIGXMKQQ.js} +3 -3
- package/dist/{chunk-T46GR2VY.js.map → chunk-ZIGXMKQQ.js.map} +1 -1
- package/dist/{chunk-5IQIX7LU.cjs → chunk-ZUNQ5BEP.cjs} +518 -172
- package/dist/chunk-ZUNQ5BEP.cjs.map +1 -0
- package/dist/{ddl-BrmPg61z.d.ts → ddl-C2rZ-Aen.d.ts} +4 -4
- package/dist/{ddl-j1-sH6lE.d.cts → ddl-CZz7a0E8.d.cts} +4 -4
- package/dist/{extension-types-YGFJPrzK.d.cts → extension-types-ixRpJVUp.d.cts} +24 -1
- package/dist/{extension-types-YGFJPrzK.d.ts → extension-types-ixRpJVUp.d.ts} +24 -1
- package/dist/{types-DkNnF-7K.d.cts → fulltext-strategy-B57yvC5Q.d.ts} +2562 -2133
- package/dist/{types-D1Sqeyxy.d.ts → fulltext-strategy-CDkSSYhq.d.cts} +2562 -2133
- package/dist/graph-extension/index.cjs +20 -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 +5 -4
- package/dist/graph-merge/index.cjs +255 -164
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +63 -33
- package/dist/graph-merge/index.d.ts +63 -33
- package/dist/graph-merge/index.js +135 -44
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-DGX6D9j1.d.ts → index-BFvdmBPV.d.ts} +301 -93
- package/dist/{index-SEvUHDA6.d.cts → index-BLtQWKRj.d.cts} +301 -93
- package/dist/index.cjs +216 -188
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +33 -33
- package/dist/indexes/index.cjs +19 -20
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +10 -11
- package/dist/interchange/index.cjs +48 -26
- package/dist/interchange/index.d.cts +126 -12
- package/dist/interchange/index.d.ts +126 -12
- package/dist/interchange/index.js +15 -13
- package/dist/{manager-ms9cKdc6.d.cts → manager-DwQi8eV0.d.cts} +9 -2
- package/dist/{manager-BZUeN_BU.d.ts → manager-ejUCB52T.d.ts} +9 -2
- package/dist/{materialize-indexes-D20xNluI.d.cts → materialize-indexes-B4e9360H.d.cts} +20 -4
- package/dist/{materialize-indexes-CAkIYFV-.d.ts → materialize-indexes-te9TPMMJ.d.ts} +20 -4
- package/dist/{postgres-BhpxGMC5.d.cts → postgres-CfEqsRMp.d.cts} +152 -1
- package/dist/{postgres-CWHLwNl1.d.ts → postgres-DQ5R6rzV.d.ts} +152 -1
- package/dist/profiler/index.cjs +11 -11
- package/dist/profiler/index.d.cts +7 -7
- package/dist/profiler/index.d.ts +7 -7
- package/dist/profiler/index.js +4 -4
- package/dist/provenance/index.cjs +40 -41
- 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 +11 -12
- package/dist/provenance/index.js.map +1 -1
- package/dist/schema/index.cjs +53 -40
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +57 -57
- package/dist/schema/index.d.ts +57 -57
- package/dist/schema/index.js +28 -15
- package/dist/schema/index.js.map +1 -1
- package/dist/{sqlite-XrDxNaa7.d.cts → sqlite-D7zBinNR.d.cts} +92 -1
- package/dist/{sqlite-CGu5SLsw.d.ts → sqlite-DvQndLky.d.ts} +92 -1
- package/dist/{store-view-D09po4H6.d.cts → store-view-9KDOpZzF.d.cts} +643 -58
- package/dist/{store-view-BlgnhEYf.d.ts → store-view-DplHC3Nt.d.ts} +643 -58
- package/dist/{types-DiE1AO7p.d.cts → types-Bv9DcS_E.d.cts} +2 -2
- package/dist/{types-B1TbZJYS.d.ts → types-CoxuV7EJ.d.ts} +2 -2
- package/dist/{where-DKjuofPr.d.cts → where-7RKFOsXt.d.ts} +2 -2
- package/dist/{where-DrUIIWHb.d.ts → where-DdMIXOtH.d.cts} +2 -2
- package/package.json +14 -13
- package/dist/chunk-2EBMPJBO.js +0 -16
- package/dist/chunk-2EBMPJBO.js.map +0 -1
- package/dist/chunk-2JXB3NYJ.cjs.map +0 -1
- package/dist/chunk-2MRAX3UE.js.map +0 -1
- package/dist/chunk-3BRVBQQD.cjs.map +0 -1
- package/dist/chunk-3EUKJEQ3.js +0 -77
- package/dist/chunk-3EUKJEQ3.js.map +0 -1
- package/dist/chunk-3Z6TW3CT.cjs.map +0 -1
- package/dist/chunk-4DIBPQNJ.js.map +0 -1
- package/dist/chunk-4S2FXGBJ.js +0 -9
- package/dist/chunk-4S2FXGBJ.js.map +0 -1
- package/dist/chunk-5IQIX7LU.cjs.map +0 -1
- package/dist/chunk-6GNSY7AV.js.map +0 -1
- package/dist/chunk-6HVOHZHS.cjs.map +0 -1
- package/dist/chunk-6SCVW4AS.js +0 -20
- package/dist/chunk-6SCVW4AS.js.map +0 -1
- package/dist/chunk-A7SZZFAG.js.map +0 -1
- package/dist/chunk-CHXTTSC6.js.map +0 -1
- package/dist/chunk-CYX2JTDG.js.map +0 -1
- package/dist/chunk-DEQFL35G.js.map +0 -1
- package/dist/chunk-G6SOJEDI.cjs.map +0 -1
- package/dist/chunk-GQANNXXT.cjs.map +0 -1
- package/dist/chunk-GZCNZ7QW.js +0 -24
- package/dist/chunk-GZCNZ7QW.js.map +0 -1
- package/dist/chunk-HK5SATYM.cjs.map +0 -1
- package/dist/chunk-HMFK4BXR.cjs +0 -12
- package/dist/chunk-HTGDWIDE.cjs +0 -89
- package/dist/chunk-HTGDWIDE.cjs.map +0 -1
- package/dist/chunk-JIEJCTDS.cjs.map +0 -1
- package/dist/chunk-JJRCLAUN.cjs.map +0 -1
- package/dist/chunk-JQGIPGVL.cjs.map +0 -1
- package/dist/chunk-K2TGS3EN.js.map +0 -1
- package/dist/chunk-KGC4LY5T.cjs.map +0 -1
- package/dist/chunk-KNHYNQQ3.cjs +0 -663
- package/dist/chunk-KNHYNQQ3.cjs.map +0 -1
- package/dist/chunk-KUTNI6SI.js.map +0 -1
- package/dist/chunk-LANHCOXB.js.map +0 -1
- package/dist/chunk-N6WTUSBV.cjs +0 -23
- package/dist/chunk-N6WTUSBV.cjs.map +0 -1
- package/dist/chunk-NAUA4PW5.cjs +0 -28
- package/dist/chunk-NAUA4PW5.cjs.map +0 -1
- package/dist/chunk-QV245VMN.js.map +0 -1
- package/dist/chunk-RBV7YCQD.js.map +0 -1
- package/dist/chunk-RHZWOJVA.cjs.map +0 -1
- package/dist/chunk-RRKQAKD6.cjs.map +0 -1
- package/dist/chunk-RY2VIWAM.js.map +0 -1
- package/dist/chunk-SHLY4MCM.js.map +0 -1
- package/dist/chunk-T2DWPQNE.js +0 -649
- package/dist/chunk-T2DWPQNE.js.map +0 -1
- package/dist/chunk-T6SPUYLX.cjs.map +0 -1
- package/dist/chunk-TGJE22RM.cjs.map +0 -1
- package/dist/chunk-TOTPVGOG.cjs +0 -774
- package/dist/chunk-TOTPVGOG.cjs.map +0 -1
- package/dist/chunk-TQOYM4LN.js.map +0 -1
- package/dist/chunk-UJLOZYKT.cjs.map +0 -1
- package/dist/chunk-UNNPKQUG.cjs.map +0 -1
- package/dist/chunk-V3QNTB7Z.js.map +0 -1
- package/dist/chunk-VCGO4V26.js.map +0 -1
- package/dist/chunk-WLRIWYHQ.js.map +0 -1
- package/dist/chunk-WVC2Q2FD.cjs.map +0 -1
- package/dist/chunk-XXVEULWX.js +0 -39
- package/dist/chunk-XXVEULWX.js.map +0 -1
- package/dist/chunk-YAZE7QZR.cjs +0 -32
- package/dist/chunk-YAZE7QZR.cjs.map +0 -1
- package/dist/chunk-YC6PWTHY.cjs +0 -44
- package/dist/chunk-YC6PWTHY.cjs.map +0 -1
- package/dist/chunk-Z5HBYM7U.cjs +0 -11
- package/dist/chunk-Z5HBYM7U.cjs.map +0 -1
- package/dist/chunk-Z5XBMDXU.js.map +0 -1
- package/dist/chunk-ZP5WHI4C.cjs.map +0 -1
- package/dist/chunk-ZURTTSCM.js.map +0 -1
- package/dist/chunk-ZV5N4DBG.js.map +0 -1
|
@@ -1,8 +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,
|
|
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-ejUCB52T.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-ixRpJVUp.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import {
|
|
5
|
-
import { b as MaterializeIndexesOptions, M as MaterializeIndexesResult } from './materialize-indexes-
|
|
4
|
+
import { bc as ValueType, bd as PredicateExpression, ag as FulltextQueryMode, be as VectorMetricType, Q as QueryAst, J as JsonPointer, P as FieldRef, az as ParameterRef, aq as JsonPointerInput, G as GraphBackend, aS as TransactionBackend, aT as TraversalExpansion, f as SqlDialect, aO as SqlSchema, bf as Traversal, bg as NodePredicate, bh as ProjectedField, ay as OrderSpec, bi as AggregateOrderSpec, bj as GroupBySpec, am as HybridFusionOptions, bk as RecursiveCyclePolicy, W as TraversalDirection$1, bl as NodeRow, aa as ExternalRecordedReadSource, bm as EdgeRow, X as AdoptedTransaction, L as AggregateExpr, aM as SortDirection, a3 as CompiledSelectSql, F as FulltextStrategy, V as VectorStrategy, bn as VectorSlotMap, bo as RecordedReadBinding, bp as SelectiveField, bq as ComposableQuery, br as SetOperationType, bs as SetOperation, bt as VectorMetric, z as JsonSchema, bu as TransactionOptions } from './fulltext-strategy-B57yvC5Q.js';
|
|
5
|
+
import { b as MaterializeIndexesOptions, M as MaterializeIndexesResult } from './materialize-indexes-te9TPMMJ.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Embedding type for vector search.
|
|
@@ -354,7 +354,11 @@ type MatchesOptions = Readonly<{
|
|
|
354
354
|
*/
|
|
355
355
|
mode?: FulltextQueryMode;
|
|
356
356
|
/**
|
|
357
|
-
* Language override. Default:
|
|
357
|
+
* Language override for query parsing. Default: the kind's declared
|
|
358
|
+
* language when every kind in the alias shares one (a plan-time
|
|
359
|
+
* constant, so PostgreSQL can serve the match from the GIN index);
|
|
360
|
+
* mixed-language subclass aliases fall back to the per-row language
|
|
361
|
+
* column.
|
|
358
362
|
*/
|
|
359
363
|
language?: string;
|
|
360
364
|
/** Minimum relevance score to include. */
|
|
@@ -373,6 +377,17 @@ type SimilarToOptions = Readonly<{
|
|
|
373
377
|
* For inner_product: minimum inner product value.
|
|
374
378
|
*/
|
|
375
379
|
minScore?: number;
|
|
380
|
+
/**
|
|
381
|
+
* Opt into approximate retrieval: each declaring kind's candidates come
|
|
382
|
+
* from the engine's native ANN structure (pgvector HNSW/IVFFlat scans,
|
|
383
|
+
* vec0 `MATCH … k=`, libSQL `vector_top_k`) instead of an exact
|
|
384
|
+
* distance scan. This is a SEMANTIC change — results are subject to the
|
|
385
|
+
* index's recall, and predicates composed alongside constrain the ANN
|
|
386
|
+
* candidate set (exact on pgvector/vec0; bounded by over-fetch on
|
|
387
|
+
* libSQL). A slot declared with `indexType: "none"` falls back to the
|
|
388
|
+
* exact scan. Default: exact.
|
|
389
|
+
*/
|
|
390
|
+
approximate?: boolean;
|
|
376
391
|
}>;
|
|
377
392
|
/**
|
|
378
393
|
* Creates a field reference.
|
|
@@ -789,9 +804,13 @@ type SelectableNodeMeta = Readonly<{
|
|
|
789
804
|
* For aliases declared via `fromDynamic` / `toDynamic` this resolves to
|
|
790
805
|
* `DynamicSelectableNode` — same wire shape, schema properties typed
|
|
791
806
|
* `unknown` for narrowing at the call site.
|
|
807
|
+
*
|
|
808
|
+
* `id` carries the same `NodeId<N>` brand as `Node<N>` (see `store/types.ts`)
|
|
809
|
+
* so a projected id can be passed straight back into `getById`/`getByIds`
|
|
810
|
+
* without a cast.
|
|
792
811
|
*/
|
|
793
812
|
type SelectableNode<N extends NodeType> = IsDynamicNodeType<N> extends true ? DynamicSelectableNode : Readonly<{
|
|
794
|
-
id:
|
|
813
|
+
id: NodeId<N>;
|
|
795
814
|
kind: N["kind"];
|
|
796
815
|
meta: SelectableNodeMeta;
|
|
797
816
|
}> & Readonly<z.infer<N["schema"]>>;
|
|
@@ -813,6 +832,46 @@ type SelectableEdgeMeta = Readonly<{
|
|
|
813
832
|
* - System metadata is under `edge.meta.*`
|
|
814
833
|
*
|
|
815
834
|
* Dynamic-mode counterpart: see `SelectableNode`.
|
|
835
|
+
*
|
|
836
|
+
* `traverse(edgeKind, alias)` defaults to `expand: "inverse"` (see
|
|
837
|
+
* `GraphAlgorithms`/`QueryBuilder.traverse`'s `defaultTraversalExpansion`),
|
|
838
|
+
* which UNIONs in rows for the *registered inverse* edge kind alongside the
|
|
839
|
+
* requested one — `EdgeAlias<E>`'s `E` stays pinned to the single requested
|
|
840
|
+
* kind regardless, so under the default expansion mode the row backing
|
|
841
|
+
* `alias` can genuinely be a different edge kind (with different endpoint
|
|
842
|
+
* kinds and a different props schema — `inverseOf(edgeA, edgeB)` doesn't
|
|
843
|
+
* require `edgeA`/`edgeB` to share a schema) than `E` says. Three distinct
|
|
844
|
+
* consequences follow:
|
|
845
|
+
*
|
|
846
|
+
* - `kind: E["kind"]` is a **literal type that can already be wrong today**
|
|
847
|
+
* — not a branding gap, a plain type-accuracy gap. It's typed as the
|
|
848
|
+
* requested kind (e.g. `"manages"`) but the runtime value can be the
|
|
849
|
+
* inverse kind (e.g. `"managedBy"`); see the `"proves why edge
|
|
850
|
+
* id/kind/schema props can't be trusted"` test in
|
|
851
|
+
* `tests/query-execution.test.ts` for a concrete repro. This predates
|
|
852
|
+
* and is independent of the id/endpoint branding question below.
|
|
853
|
+
* - The flattened `z.infer<E["schema"]>` properties have the same
|
|
854
|
+
* type-accuracy gap as `kind`, for the same reason: `ctx.e.role` is typed
|
|
855
|
+
* against the requested kind's schema, but an inverse-branch row's real
|
|
856
|
+
* props came from a different schema and may not have a `role` field at
|
|
857
|
+
* all (reading it returns `undefined`, not a type error).
|
|
858
|
+
* - `id`/`fromId`/`toId` stay plain `string`, unlike `SelectableNode`'s
|
|
859
|
+
* `id: NodeId<N>` — a real ergonomics gap, but not an accuracy one: `string`
|
|
860
|
+
* never overclaims. Branding them would compile but be actively wrong:
|
|
861
|
+
* e.g. `store.edges.<E>.getById()` filters on `row.kind !== kind` and
|
|
862
|
+
* silently returns `undefined` for a mismatched-kind id — worse than the
|
|
863
|
+
* unsafe cast it would have replaced.
|
|
864
|
+
*
|
|
865
|
+
* Proving any of these safe requires tracking `expand` mode (`"none"` vs
|
|
866
|
+
* not) at the type level through `TraversalBuilder`/`EdgeAlias` — evaluated
|
|
867
|
+
* for #235 and deliberately not built: the machinery would touch every
|
|
868
|
+
* traversal-entry overload for a benefit that only applies when a caller
|
|
869
|
+
* opts out of the default expansion. When you know a traversal is
|
|
870
|
+
* single-kind (e.g. via `expand: "none"`), re-brand `id`/`fromId`/`toId`
|
|
871
|
+
* explicitly with `asNodeId`/`asEdgeId` (see #223) — e.g.
|
|
872
|
+
* `asNodeId<typeof Person>(edge.fromId)` for a `Person -> Company` edge —
|
|
873
|
+
* and don't trust `kind` or schema properties without independently
|
|
874
|
+
* verifying the traversal can't have expanded.
|
|
816
875
|
*/
|
|
817
876
|
type SelectableEdge<E extends AnyEdgeType = EdgeType> = IsDynamicEdgeType<E> extends true ? DynamicSelectableEdge : Readonly<{
|
|
818
877
|
id: string;
|
|
@@ -914,6 +973,8 @@ type QueryBuilderState = Readonly<{
|
|
|
914
973
|
predicates: readonly NodePredicate[];
|
|
915
974
|
projection: readonly ProjectedField[];
|
|
916
975
|
orderBy: readonly OrderSpec[];
|
|
976
|
+
/** ORDER BY entries added via `ExecutableAggregateQuery.orderBy()`. */
|
|
977
|
+
aggregateOrderBy: readonly AggregateOrderSpec[];
|
|
917
978
|
limit: number | undefined;
|
|
918
979
|
offset: number | undefined;
|
|
919
980
|
temporalMode: TemporalMode;
|
|
@@ -1196,6 +1257,82 @@ type StoreHooks = Readonly<{
|
|
|
1196
1257
|
type BaseStoreOptions = Readonly<{
|
|
1197
1258
|
/** Observability hooks for monitoring */
|
|
1198
1259
|
hooks?: StoreHooks;
|
|
1260
|
+
/**
|
|
1261
|
+
* Maintain a durable, graph-wide revision anchor for TypeGraph writes:
|
|
1262
|
+
* a random per-graph origin plus a monotonic revision clock. `branch()` uses
|
|
1263
|
+
* this anchor to validate that its base has not moved without
|
|
1264
|
+
* re-fingerprinting every live row, and cannot confuse a coincident clock in
|
|
1265
|
+
* a separately created store for its original base. `history: true` enables
|
|
1266
|
+
* the same tracking automatically through its recorded-time commit clock.
|
|
1267
|
+
*
|
|
1268
|
+
* This is intentionally opt-in for live stores: each successful graph write
|
|
1269
|
+
* advances the anchor inside its write transaction. On PostgreSQL, those
|
|
1270
|
+
* transactions take a graph-scoped advisory lock until commit; writes to the
|
|
1271
|
+
* same graph therefore serialize. Enable it for branchable graphs, but size
|
|
1272
|
+
* high-throughput multi-writer workloads for that trade-off.
|
|
1273
|
+
*
|
|
1274
|
+
* Writes performed directly through a backend — including raw graph-table
|
|
1275
|
+
* writes through `tx.sql` — bypass the anchor and are outside the
|
|
1276
|
+
* revision-tracking contract.
|
|
1277
|
+
*/
|
|
1278
|
+
revisionTracking?: boolean;
|
|
1279
|
+
/**
|
|
1280
|
+
* Automatic planner-statistics refresh after large autocommit bulk
|
|
1281
|
+
* writes (bulkCreate and bulkInsert on nodes and edges). Stale statistics after a
|
|
1282
|
+
* bulk load are a whole class of planner cliffs: the planner keeps
|
|
1283
|
+
* pre-load row estimates until ANALYZE runs. When a single
|
|
1284
|
+
* autocommit bulk write reaches the threshold
|
|
1285
|
+
* ({@link AUTO_REFRESH_STATISTICS_ROW_THRESHOLD} rows by default),
|
|
1286
|
+
* the store runs `refreshStatistics()` after the write commits.
|
|
1287
|
+
* Pass a number to change the threshold, or `false` to disable.
|
|
1288
|
+
* Bulk writes inside a caller-provided transaction never
|
|
1289
|
+
* auto-refresh (statistics cannot see uncommitted rows); refresh
|
|
1290
|
+
* manually after commit. `importGraph` handles its own refresh.
|
|
1291
|
+
*/
|
|
1292
|
+
autoRefreshStatistics?: false | number;
|
|
1293
|
+
/**
|
|
1294
|
+
* Skip the write for an `upsertById` (or `bulkUpsertById` item) whose
|
|
1295
|
+
* validated props are value-identical to the existing live row. Default
|
|
1296
|
+
* off.
|
|
1297
|
+
*
|
|
1298
|
+
* Enable this for at-least-once / replay materializers. An event log that
|
|
1299
|
+
* re-delivers a byte-identical change, or a full replay that reprocesses an
|
|
1300
|
+
* already-materialized log, would otherwise rewrite every row it touches:
|
|
1301
|
+
* today an `upsertById` on an existing id calls `updateNode`
|
|
1302
|
+
* unconditionally, allocating a fresh recorded instant and a new history row
|
|
1303
|
+
* per re-delivery. A rebuild — the workload replay is recommended for — is
|
|
1304
|
+
* the one that inflates recorded history most, with a dense band of
|
|
1305
|
+
* "changes" that changed nothing.
|
|
1306
|
+
*
|
|
1307
|
+
* When enabled, an upsert that would not change the stored value performs
|
|
1308
|
+
* **no write at all**: no `updateNode`, no recorded-time capture, no history
|
|
1309
|
+
* row, no revision-anchor advance, and no `update` operation hooks (nothing
|
|
1310
|
+
* happened, so nothing is reported). It resolves with the **existing** node,
|
|
1311
|
+
* preserving its original `validFrom` / `updatedAt` / `version`.
|
|
1312
|
+
*
|
|
1313
|
+
* Receipt shape is unchanged and needs no new signal: a coalesced upsert
|
|
1314
|
+
* still counts as one write intent (`writes.total` includes it), but
|
|
1315
|
+
* captures nothing (`receipt.recorded` stays `undefined` when it is the only
|
|
1316
|
+
* write) — the same shape a no-op delete already produces, so a consumer
|
|
1317
|
+
* that carries the prior anchor forward on `recorded === undefined` handles
|
|
1318
|
+
* it unchanged.
|
|
1319
|
+
*
|
|
1320
|
+
* A write is coalesced only when **all** of the following hold; otherwise the
|
|
1321
|
+
* normal write happens:
|
|
1322
|
+
* 1. An existing row is found for the id (else it is a create).
|
|
1323
|
+
* 2. That row is not soft-deleted (a deleted row resurrects — a real
|
|
1324
|
+
* change — and is never coalesced).
|
|
1325
|
+
* 3. The caller passed no explicit `validFrom` / `validTo` (an explicit
|
|
1326
|
+
* temporal override is a deliberate request and is never coalesced;
|
|
1327
|
+
* applied per item in the bulk path).
|
|
1328
|
+
* 4. The new props, merged over the stored props and run through the
|
|
1329
|
+
* kind's Zod schema (defaults applied, values normalized), are deeply
|
|
1330
|
+
* value-identical to the stored props (key order aside).
|
|
1331
|
+
*
|
|
1332
|
+
* Default-off because some consumers *want* an audit row per re-delivery as
|
|
1333
|
+
* proof the event was reprocessed; coalescing removes that signal.
|
|
1334
|
+
*/
|
|
1335
|
+
coalesceUnchangedUpserts?: boolean;
|
|
1199
1336
|
/** SQL schema configuration from createSqlSchema(...) for custom table names */
|
|
1200
1337
|
schema?: SqlSchema;
|
|
1201
1338
|
/** Query default behaviors. */
|
|
@@ -1255,6 +1392,60 @@ type StoreOptions = LiveStoreOptions | HistoryStoreOptions;
|
|
|
1255
1392
|
interface StoreRef<T> {
|
|
1256
1393
|
current: T;
|
|
1257
1394
|
}
|
|
1395
|
+
/**
|
|
1396
|
+
* Result plus write summary. Returned by `store.transactionWithReceipt(fn)`,
|
|
1397
|
+
* `store.withRecordedTransaction(externalTx, fn)` (the adopted-commit path), and
|
|
1398
|
+
* `tx.measure(fn)` (a scoped sub-receipt). See {@link TransactionReceipt}.
|
|
1399
|
+
*/
|
|
1400
|
+
type TransactionOutcome<T> = Readonly<{
|
|
1401
|
+
result: T;
|
|
1402
|
+
receipt: TransactionReceipt;
|
|
1403
|
+
}>;
|
|
1404
|
+
/**
|
|
1405
|
+
* Transaction write summary.
|
|
1406
|
+
*
|
|
1407
|
+
* Receipt counts are completed write intents at the collection surface, not
|
|
1408
|
+
* rows affected:
|
|
1409
|
+
*
|
|
1410
|
+
* 1. Every successful completion of a write method on `tx.nodes.*` /
|
|
1411
|
+
* `tx.edges.*` counts. The authoritative method list is
|
|
1412
|
+
* {@link NodeWrites} / {@link EdgeWrites}.
|
|
1413
|
+
* 2. Bulk methods count by input length; an empty bulk call (`bulkCreate([])`)
|
|
1414
|
+
* counts 0.
|
|
1415
|
+
* 3. Single-row methods count 1 on resolve — including `delete` of an absent
|
|
1416
|
+
* id and `getOrCreate*` that found an existing row. Consumers that need
|
|
1417
|
+
* "did anything actually change" semantics apply their own per-operation
|
|
1418
|
+
* policy.
|
|
1419
|
+
* 4. A method that rejects counts 0 — even when the backend applied part of a
|
|
1420
|
+
* bulk input before failing. On SQLite a failed statement does not abort
|
|
1421
|
+
* the surrounding transaction, so a caller that catches the rejection and
|
|
1422
|
+
* commits can persist rows the receipt never counted. Do not read the
|
|
1423
|
+
* receipt as rows-affected in that scenario.
|
|
1424
|
+
* 5. A node `delete` under `cascade` / `disconnect` removes connected edges
|
|
1425
|
+
* through the backend, not the edge-collection surface; those removals do
|
|
1426
|
+
* not appear in `edges`.
|
|
1427
|
+
* 6. Rows-affected fidelity is intentionally out of scope for this first
|
|
1428
|
+
* version; a future extension could ask backends to return row counts.
|
|
1429
|
+
*/
|
|
1430
|
+
type TransactionReceipt = Readonly<{
|
|
1431
|
+
writes: Readonly<{
|
|
1432
|
+
/** Completed node write intents by node kind. */
|
|
1433
|
+
nodes: Readonly<Record<string, number>>;
|
|
1434
|
+
/** Completed edge write intents by edge kind. */
|
|
1435
|
+
edges: Readonly<Record<string, number>>;
|
|
1436
|
+
/** Sum of all node and edge write intents. */
|
|
1437
|
+
total: number;
|
|
1438
|
+
}>;
|
|
1439
|
+
/**
|
|
1440
|
+
* The recorded commit instant allocated for this store's graph by this
|
|
1441
|
+
* transaction. Undefined when history capture is off, the transaction is
|
|
1442
|
+
* read-only, or no captured writes were flushed. **Always undefined on a
|
|
1443
|
+
* scoped receipt from {@link ScopedMeasure}** (`tx.measure`) — the recorded
|
|
1444
|
+
* instant is a per-transaction flush concern allocated once when the whole
|
|
1445
|
+
* transaction's capture flushes, unknowable mid-transaction.
|
|
1446
|
+
*/
|
|
1447
|
+
recorded?: RecordedInstant;
|
|
1448
|
+
}>;
|
|
1258
1449
|
/**
|
|
1259
1450
|
* Behavior when a get-or-create operation matches an existing record.
|
|
1260
1451
|
*/
|
|
@@ -1327,7 +1518,11 @@ type EdgeGetOrCreateByEndpointsOptions<E extends AnyEdgeType> = Readonly<{
|
|
|
1327
1518
|
* Provides ergonomic CRUD operations for a single node type.
|
|
1328
1519
|
*/
|
|
1329
1520
|
type NodeCollection<N extends NodeType, CN extends string = string> = Readonly<{
|
|
1330
|
-
/**
|
|
1521
|
+
/**
|
|
1522
|
+
* Create a new node.
|
|
1523
|
+
*
|
|
1524
|
+
* `validFrom` defaults to the operation's creation timestamp when omitted.
|
|
1525
|
+
*/
|
|
1331
1526
|
create: (props: z.input<N["schema"]>, options?: Readonly<{
|
|
1332
1527
|
id?: string;
|
|
1333
1528
|
validFrom?: string;
|
|
@@ -1374,6 +1569,8 @@ type NodeCollection<N extends NodeType, CN extends string = string> = Readonly<{
|
|
|
1374
1569
|
* Use this for dynamic dispatch (changesets, migrations, imports) where
|
|
1375
1570
|
* the data shape is determined at runtime, not compile time.
|
|
1376
1571
|
* The return type is fully typed — only the input gate is relaxed.
|
|
1572
|
+
*
|
|
1573
|
+
* `validFrom` defaults to the operation's creation timestamp when omitted.
|
|
1377
1574
|
*/
|
|
1378
1575
|
createFromRecord: (data: Record<string, unknown>, options?: Readonly<{
|
|
1379
1576
|
id?: string;
|
|
@@ -1385,6 +1582,9 @@ type NodeCollection<N extends NodeType, CN extends string = string> = Readonly<{
|
|
|
1385
1582
|
*
|
|
1386
1583
|
* If a node with the given ID exists, updates it with the provided props.
|
|
1387
1584
|
* Otherwise, creates a new node with that ID.
|
|
1585
|
+
*
|
|
1586
|
+
* `validFrom` only applies on the create branch, defaulting to the
|
|
1587
|
+
* operation's creation timestamp when omitted; it has no effect on update.
|
|
1388
1588
|
*/
|
|
1389
1589
|
upsertById: (id: string, props: z.input<N["schema"]>, options?: Readonly<{
|
|
1390
1590
|
validFrom?: string;
|
|
@@ -1396,6 +1596,9 @@ type NodeCollection<N extends NodeType, CN extends string = string> = Readonly<{
|
|
|
1396
1596
|
* Use this for dynamic dispatch (changesets, migrations, imports) where
|
|
1397
1597
|
* the data shape is determined at runtime, not compile time.
|
|
1398
1598
|
* The return type is fully typed — only the input gate is relaxed.
|
|
1599
|
+
*
|
|
1600
|
+
* `validFrom` only applies on the create branch, defaulting to the
|
|
1601
|
+
* operation's creation timestamp when omitted; it has no effect on update.
|
|
1399
1602
|
*/
|
|
1400
1603
|
upsertByIdFromRecord: (id: string, data: Record<string, unknown>, options?: Readonly<{
|
|
1401
1604
|
validFrom?: string;
|
|
@@ -1406,6 +1609,8 @@ type NodeCollection<N extends NodeType, CN extends string = string> = Readonly<{
|
|
|
1406
1609
|
*
|
|
1407
1610
|
* More efficient than calling create() multiple times.
|
|
1408
1611
|
* Use `bulkInsert` for the dedicated fast path that skips returning results.
|
|
1612
|
+
*
|
|
1613
|
+
* `validFrom` defaults to the operation's creation timestamp when omitted.
|
|
1409
1614
|
*/
|
|
1410
1615
|
bulkCreate: (items: readonly Readonly<{
|
|
1411
1616
|
props: z.input<N["schema"]>;
|
|
@@ -1418,6 +1623,9 @@ type NodeCollection<N extends NodeType, CN extends string = string> = Readonly<{
|
|
|
1418
1623
|
*
|
|
1419
1624
|
* For each item, if a node with the given ID exists, updates it.
|
|
1420
1625
|
* Otherwise, creates a new node with that ID.
|
|
1626
|
+
*
|
|
1627
|
+
* `validFrom` only applies on the create branch, defaulting to the
|
|
1628
|
+
* operation's creation timestamp when omitted; it has no effect on update.
|
|
1421
1629
|
*/
|
|
1422
1630
|
bulkUpsertById: (items: readonly Readonly<{
|
|
1423
1631
|
id: string;
|
|
@@ -1431,6 +1639,8 @@ type NodeCollection<N extends NodeType, CN extends string = string> = Readonly<{
|
|
|
1431
1639
|
* This is the dedicated fast path for bulk inserts. Unlike `bulkCreate`
|
|
1432
1640
|
* with `returnResults: false`, the intent is unambiguous: no results
|
|
1433
1641
|
* are returned and the operation is wrapped in a transaction.
|
|
1642
|
+
*
|
|
1643
|
+
* `validFrom` defaults to the operation's creation timestamp when omitted.
|
|
1434
1644
|
*/
|
|
1435
1645
|
bulkInsert: (items: readonly Readonly<{
|
|
1436
1646
|
props: z.input<N["schema"]>;
|
|
@@ -1565,6 +1775,8 @@ type EdgeCollection<E extends AnyEdgeType, From extends NodeType = NodeType, To
|
|
|
1565
1775
|
/**
|
|
1566
1776
|
* Create a new edge.
|
|
1567
1777
|
*
|
|
1778
|
+
* `validFrom` defaults to the operation's creation timestamp when omitted.
|
|
1779
|
+
*
|
|
1568
1780
|
* @param from - Source node (must be one of the allowed 'from' types)
|
|
1569
1781
|
* @param to - Target node (must be one of the allowed 'to' types)
|
|
1570
1782
|
* @param args - Edge properties (optional if schema is empty) and creation options
|
|
@@ -1644,6 +1856,8 @@ type EdgeCollection<E extends AnyEdgeType, From extends NodeType = NodeType, To
|
|
|
1644
1856
|
*
|
|
1645
1857
|
* More efficient than calling create() multiple times.
|
|
1646
1858
|
* Use `bulkInsert` for the dedicated fast path that skips returning results.
|
|
1859
|
+
*
|
|
1860
|
+
* `validFrom` defaults to the operation's creation timestamp when omitted.
|
|
1647
1861
|
*/
|
|
1648
1862
|
bulkCreate: (items: readonly Readonly<{
|
|
1649
1863
|
from: NodeRef<From>;
|
|
@@ -1658,6 +1872,9 @@ type EdgeCollection<E extends AnyEdgeType, From extends NodeType = NodeType, To
|
|
|
1658
1872
|
*
|
|
1659
1873
|
* For each item, if an edge with the given ID exists, updates it.
|
|
1660
1874
|
* Otherwise, creates a new edge with that ID.
|
|
1875
|
+
*
|
|
1876
|
+
* `validFrom` only applies on the create branch, defaulting to the
|
|
1877
|
+
* operation's creation timestamp when omitted; it has no effect on update.
|
|
1661
1878
|
*/
|
|
1662
1879
|
bulkUpsertById: (items: readonly Readonly<{
|
|
1663
1880
|
id: EdgeId<E>;
|
|
@@ -1673,6 +1890,8 @@ type EdgeCollection<E extends AnyEdgeType, From extends NodeType = NodeType, To
|
|
|
1673
1890
|
* This is the dedicated fast path for bulk inserts. Unlike `bulkCreate`
|
|
1674
1891
|
* with `returnResults: false`, the intent is unambiguous: no results
|
|
1675
1892
|
* are returned and the operation is wrapped in a transaction.
|
|
1893
|
+
*
|
|
1894
|
+
* `validFrom` defaults to the operation's creation timestamp when omitted.
|
|
1676
1895
|
*/
|
|
1677
1896
|
bulkInsert: (items: readonly Readonly<{
|
|
1678
1897
|
from: NodeRef<From>;
|
|
@@ -1861,6 +2080,14 @@ type RecordedStoreViewNodeCollections<G extends GraphDef> = {
|
|
|
1861
2080
|
type RecordedStoreViewEdgeCollections<G extends GraphDef> = {
|
|
1862
2081
|
[K in keyof G["edges"] & string]-?: TypedRecordedStoreViewEdgeCollection<G["edges"][K]>;
|
|
1863
2082
|
};
|
|
2083
|
+
/**
|
|
2084
|
+
* Whether — and why — `tx.sql` can be used on a transaction context. A single
|
|
2085
|
+
* required discriminant covering exactly the four states raw-SQL access can be
|
|
2086
|
+
* in, so a portable caller branches on capability instead of truthiness-testing
|
|
2087
|
+
* `tx.sql` (which is present-but-throwing under history / revision tracking).
|
|
2088
|
+
* See {@link TransactionContext.sqlAvailability} for the per-value semantics.
|
|
2089
|
+
*/
|
|
2090
|
+
type SqlAvailability = "available" | "history" | "revisionTracking" | "unavailable";
|
|
1864
2091
|
/**
|
|
1865
2092
|
* A typed transaction context with collection API.
|
|
1866
2093
|
*
|
|
@@ -1902,11 +2129,44 @@ type RecordedStoreViewEdgeCollections<G extends GraphDef> = {
|
|
|
1902
2129
|
* Its type is the `AdoptedTransaction` union; cast to your concrete
|
|
1903
2130
|
* Drizzle database type at the call site.
|
|
1904
2131
|
*
|
|
1905
|
-
* When the store was created with `{ history: true }
|
|
1906
|
-
*
|
|
1907
|
-
*
|
|
1908
|
-
*
|
|
1909
|
-
*
|
|
2132
|
+
* When the store was created with `{ history: true }` or
|
|
2133
|
+
* `{ revisionTracking: true }`, `tx.sql` is **present but throwing**: every
|
|
2134
|
+
* access raises {@link ConfigurationError} because raw SQL would bypass
|
|
2135
|
+
* recorded-time capture or the revision anchor. The static type marks it
|
|
2136
|
+
* `sql?: never` so a mistaken `tx.sql.run(...)` fails to typecheck; at runtime
|
|
2137
|
+
* it is a fail-loud guard, not `undefined`. Use the typed `tx.nodes` /
|
|
2138
|
+
* `tx.edges` collections inside `transaction()`, or
|
|
2139
|
+
* `store.withRecordedTransaction(externalTx, fn)` when the relational layer
|
|
2140
|
+
* owns the transaction boundary.
|
|
2141
|
+
*
|
|
2142
|
+
* **Feature detection — branch on {@link sqlAvailability}, not on `tx.sql`'s
|
|
2143
|
+
* truthiness.** Because `tx.sql` is present-but-throwing under history or
|
|
2144
|
+
* revision tracking, `if (tx.sql)` reads truthy and then throws. The honest
|
|
2145
|
+
* discriminant is `tx.sqlAvailability`:
|
|
2146
|
+
*
|
|
2147
|
+
* ```typescript
|
|
2148
|
+
* await store.transaction(async (tx) => {
|
|
2149
|
+
* switch (tx.sqlAvailability) {
|
|
2150
|
+
* case "available": {
|
|
2151
|
+
* const sqlTx = tx.sql as NodePgDatabase; // usable raw handle
|
|
2152
|
+
* await sqlTx.insert(rows).values(row);
|
|
2153
|
+
* break;
|
|
2154
|
+
* }
|
|
2155
|
+
* case "unavailable":
|
|
2156
|
+
* // non-transactional backend: tx.sql === undefined, no atomicity
|
|
2157
|
+
* await fallbackWithoutAtomicity();
|
|
2158
|
+
* break;
|
|
2159
|
+
* case "history":
|
|
2160
|
+
* case "revisionTracking":
|
|
2161
|
+
* // raw SQL disabled here — write your own tables through the external
|
|
2162
|
+
* // handle passed to store.withRecordedTransaction instead
|
|
2163
|
+
* break;
|
|
2164
|
+
* }
|
|
2165
|
+
* });
|
|
2166
|
+
* ```
|
|
2167
|
+
*
|
|
2168
|
+
* `tx.sql === undefined` still means exactly "non-transactional fallback"
|
|
2169
|
+
* (`sqlAvailability === "unavailable"`).
|
|
1910
2170
|
*
|
|
1911
2171
|
* @example
|
|
1912
2172
|
* ```typescript
|
|
@@ -1921,6 +2181,26 @@ type TransactionContext<G extends GraphDef> = Readonly<{
|
|
|
1921
2181
|
nodes: GraphNodeCollections<G>;
|
|
1922
2182
|
edges: GraphEdgeCollections<G>;
|
|
1923
2183
|
sql?: AdoptedTransaction;
|
|
2184
|
+
/**
|
|
2185
|
+
* Honest capability discriminant for `tx.sql` on this transaction. Prefer
|
|
2186
|
+
* this over truthiness-testing `tx.sql`, which is present-but-throwing under
|
|
2187
|
+
* history capture or revision tracking.
|
|
2188
|
+
*
|
|
2189
|
+
* - `"available"` — `tx.sql` is the usable raw handle bound to this
|
|
2190
|
+
* transaction.
|
|
2191
|
+
* - `"history"` — history capture is on; `tx.sql` is present but every access
|
|
2192
|
+
* throws {@link ConfigurationError} (`details.code`
|
|
2193
|
+
* `RECORDED_CAPTURE_RAW_SQL_DISABLED`). Use `tx.nodes` / `tx.edges`, or
|
|
2194
|
+
* `store.withRecordedTransaction` with your own external handle for
|
|
2195
|
+
* cross-store atomicity.
|
|
2196
|
+
* - `"revisionTracking"` — same shape as `"history"` (`details.code`
|
|
2197
|
+
* `REVISION_TRACKING_RAW_SQL_DISABLED`).
|
|
2198
|
+
* - `"unavailable"` — non-transactional fallback
|
|
2199
|
+
* (`backend.capabilities.transactions === false`, e.g. Cloudflare D1,
|
|
2200
|
+
* `drizzle-orm/neon-http`); `tx.sql` is `undefined` and there is no
|
|
2201
|
+
* atomicity.
|
|
2202
|
+
*/
|
|
2203
|
+
sqlAvailability: SqlAvailability;
|
|
1924
2204
|
/**
|
|
1925
2205
|
* The transaction-scoped backend the collections are bound to, for advanced
|
|
1926
2206
|
* raw reads that must observe the transaction's snapshot (e.g. graph-merge's
|
|
@@ -1944,6 +2224,40 @@ type TransactionContext<G extends GraphDef> = Readonly<{
|
|
|
1944
2224
|
*/
|
|
1945
2225
|
runNodeOperationHooks<T>(operation: "create" | "update" | "delete", kind: string, id: string, fn: () => Promise<T>): Promise<T>;
|
|
1946
2226
|
}>;
|
|
2227
|
+
/**
|
|
2228
|
+
* Scoped write measurement, available only on the receipt-enabled transaction
|
|
2229
|
+
* contexts (`transactionWithReceipt`, `withRecordedTransaction`). Runs `fn`,
|
|
2230
|
+
* passing it a **scoped context** — a second view over the same transaction — and
|
|
2231
|
+
* returns a {@link TransactionOutcome} whose receipt counts exactly the writes
|
|
2232
|
+
* made *through that scoped context* (`scoped.nodes` / `scoped.edges`).
|
|
2233
|
+
*
|
|
2234
|
+
* Attribution is by **which context you write through**, not by timing. A write
|
|
2235
|
+
* through the scoped context counts in both the scope and the outer receipt (it
|
|
2236
|
+
* happened in the transaction); a write through the outer `tx` during the scope
|
|
2237
|
+
* counts only in the outer receipt. This makes overlapping and concurrent
|
|
2238
|
+
* measures safe by construction — two scopes running under `Promise.all`, each
|
|
2239
|
+
* writing through its own scoped context, never cross-count. Nesting composes:
|
|
2240
|
+
* `scoped.measure(...)` opens a child scope that counts in itself, every
|
|
2241
|
+
* ancestor scope, and the outer receipt.
|
|
2242
|
+
*
|
|
2243
|
+
* Counts otherwise inherit {@link TransactionReceipt} (bulk by input length, a
|
|
2244
|
+
* rejected write counts 0). The returned receipt's `recorded` is **always
|
|
2245
|
+
* `undefined`**: the recorded commit instant is a per-transaction flush concern,
|
|
2246
|
+
* unknowable mid-transaction.
|
|
2247
|
+
*/
|
|
2248
|
+
type ScopedMeasure<Context> = <T>(fn: (scoped: Context) => Promise<T>) => Promise<TransactionOutcome<T>>;
|
|
2249
|
+
/**
|
|
2250
|
+
* A {@link TransactionContext} that also exposes {@link ScopedMeasure}. Only the
|
|
2251
|
+
* receipt-enabled entry points (`transactionWithReceipt`,
|
|
2252
|
+
* `withRecordedTransaction`) hand a callback this type; plain `transaction()`
|
|
2253
|
+
* contexts have no recorder and therefore no `measure`, keeping that path
|
|
2254
|
+
* zero-overhead. Assignable to {@link TransactionContext}, so a projector helper
|
|
2255
|
+
* typed `(tx: TransactionContext<G>) => ...` accepts a measurable context. The
|
|
2256
|
+
* scoped context handed to `measure` is itself measurable, so scopes nest.
|
|
2257
|
+
*/
|
|
2258
|
+
type MeasurableTransactionContext<G extends GraphDef> = TransactionContext<G> & Readonly<{
|
|
2259
|
+
measure: ScopedMeasure<MeasurableTransactionContext<G>>;
|
|
2260
|
+
}>;
|
|
1947
2261
|
/**
|
|
1948
2262
|
* Replace branded `NodeId` / `EdgeId` with plain `string` in each
|
|
1949
2263
|
* method's parameter list. Return types are preserved unchanged.
|
|
@@ -2048,6 +2362,33 @@ declare class ExecutableAggregateQuery<G extends GraphDef, Aliases extends Alias
|
|
|
2048
2362
|
* Builds the query AST.
|
|
2049
2363
|
*/
|
|
2050
2364
|
toAst(): QueryAst;
|
|
2365
|
+
/**
|
|
2366
|
+
* Orders results by a grouped field or aggregate alias.
|
|
2367
|
+
*
|
|
2368
|
+
* `key` is one of the output names passed to `.aggregate({...})` — either
|
|
2369
|
+
* a grouped field (e.g. `genre`) or an aggregate alias (e.g. `bookCount`).
|
|
2370
|
+
* Both are ordered the same way: by referencing the SELECT-list output
|
|
2371
|
+
* column, since every `.aggregate()` field is projected with an alias.
|
|
2372
|
+
*
|
|
2373
|
+
* Chain multiple calls to sort by more than one key, in call order:
|
|
2374
|
+
* `.orderBy("genre").orderBy("bookCount", "desc")` sorts by genre first,
|
|
2375
|
+
* then by book count within each genre.
|
|
2376
|
+
*
|
|
2377
|
+
* @example
|
|
2378
|
+
* ```typescript
|
|
2379
|
+
* // Top 2 authors by book count
|
|
2380
|
+
* store.query()
|
|
2381
|
+
* .from("Author", "a")
|
|
2382
|
+
* .traverse("wrote", "e")
|
|
2383
|
+
* .to("Book", "b")
|
|
2384
|
+
* .groupByNode("a")
|
|
2385
|
+
* .aggregate({ author: field("a", "name"), bookCount: count("b") })
|
|
2386
|
+
* .orderBy("bookCount", "desc")
|
|
2387
|
+
* .limit(2)
|
|
2388
|
+
* .execute();
|
|
2389
|
+
* ```
|
|
2390
|
+
*/
|
|
2391
|
+
orderBy<K extends keyof R & string>(key: K, direction?: SortDirection): ExecutableAggregateQuery<G, Aliases, R>;
|
|
2051
2392
|
/**
|
|
2052
2393
|
* Limits the number of results.
|
|
2053
2394
|
*/
|
|
@@ -2078,6 +2419,30 @@ declare class ExecutableAggregateQuery<G extends GraphDef, Aliases extends Alias
|
|
|
2078
2419
|
execute(): Promise<readonly AggregateResult<R>[]>;
|
|
2079
2420
|
}
|
|
2080
2421
|
|
|
2422
|
+
/**
|
|
2423
|
+
* Temporal Filter Compilation
|
|
2424
|
+
*
|
|
2425
|
+
* Generates SQL clauses for temporal filtering based on valid_from/valid_to
|
|
2426
|
+
* and deleted_at timestamps. Consolidates the previously duplicated temporal
|
|
2427
|
+
* filter functions into a single, parameterized implementation.
|
|
2428
|
+
*/
|
|
2429
|
+
|
|
2430
|
+
/**
|
|
2431
|
+
* How a "current" valid-time read instant is emitted into compiled SQL:
|
|
2432
|
+
*
|
|
2433
|
+
* - `"literal"` — bound as a concrete value at compile time
|
|
2434
|
+
* ({@link currentReadInstant}). The instant is frozen into the compiled
|
|
2435
|
+
* statement, so the statement must be recompiled to observe a newer "now".
|
|
2436
|
+
* - `"placeholder"` — bound as a reserved execution-time placeholder
|
|
2437
|
+
* ({@link currentReadInstantPlaceholder}). The statement can be compiled
|
|
2438
|
+
* once and reused across executions, filling a fresh instant each call.
|
|
2439
|
+
*
|
|
2440
|
+
* Defaults to `"literal"` everywhere except the query builder's compiled
|
|
2441
|
+
* template cache, which opts into `"placeholder"` so a reused/prepared query
|
|
2442
|
+
* never freezes "now" the way a cached literal would (the #246 regression).
|
|
2443
|
+
*/
|
|
2444
|
+
type ReadInstantMode = "literal" | "placeholder";
|
|
2445
|
+
|
|
2081
2446
|
/**
|
|
2082
2447
|
* Query Compiler Module
|
|
2083
2448
|
*
|
|
@@ -2120,6 +2485,8 @@ type CompileQueryOptions = Readonly<{
|
|
|
2120
2485
|
* declare the field. Callers build it from the graph's node schemas.
|
|
2121
2486
|
*/
|
|
2122
2487
|
vectorSlots?: VectorSlotMap | undefined;
|
|
2488
|
+
/** Per-kind declared fulltext language (see buildFulltextLanguages). */
|
|
2489
|
+
fulltextLanguages?: ReadonlyMap<string, string> | undefined;
|
|
2123
2490
|
/**
|
|
2124
2491
|
* Recorded read relation to use when the AST carries `recordedAsOf`.
|
|
2125
2492
|
* Supplying a recorded timestamp without this binding is rejected so the
|
|
@@ -2127,15 +2494,40 @@ type CompileQueryOptions = Readonly<{
|
|
|
2127
2494
|
* the store was only configured for live/valid-time reads.
|
|
2128
2495
|
*/
|
|
2129
2496
|
recordedReadBinding?: RecordedReadBinding | undefined;
|
|
2497
|
+
/**
|
|
2498
|
+
* How the "current" valid-time read instant is emitted. Defaults to
|
|
2499
|
+
* `"literal"` (a value frozen at compile time). The query builder's
|
|
2500
|
+
* compiled template cache passes `"placeholder"` so the instant is a
|
|
2501
|
+
* reserved execution-time slot, letting one compiled statement be reused
|
|
2502
|
+
* across executions with a fresh "now" each call. See {@link ReadInstantMode}.
|
|
2503
|
+
*/
|
|
2504
|
+
readInstant?: ReadInstantMode | undefined;
|
|
2130
2505
|
}>;
|
|
2131
2506
|
|
|
2507
|
+
/**
|
|
2508
|
+
* PreparedQuery — a pre-validated, parameterized query.
|
|
2509
|
+
*
|
|
2510
|
+
* Created via `ExecutableQuery.prepare()`. Builds and structurally validates
|
|
2511
|
+
* the query AST once at prepare time (so a malformed query fails fast, before
|
|
2512
|
+
* the first `execute()`).
|
|
2513
|
+
*
|
|
2514
|
+
* Fast path: when the backend can compile and run raw SQL (`compileSql` +
|
|
2515
|
+
* `executeRaw`), the statement is compiled ONCE into a cached template whose
|
|
2516
|
+
* "current" read instant and user `param()` refs are reserved placeholders
|
|
2517
|
+
* (see {@link buildReadInstantTemplate}). Every `execute()` fills those
|
|
2518
|
+
* placeholders — a fresh instant plus the call's bindings — and runs the
|
|
2519
|
+
* cached SQL text directly, so a reused prepared query never recompiles and
|
|
2520
|
+
* never freezes "now" the way a cached literal instant would (the #246
|
|
2521
|
+
* regression).
|
|
2522
|
+
*
|
|
2523
|
+
* Fallback: on a backend without raw execution (custom/async), substitutes
|
|
2524
|
+
* parameter refs into the AST, compiles fresh per call, and executes via the
|
|
2525
|
+
* standard `backend.execute` path.
|
|
2526
|
+
*/
|
|
2527
|
+
|
|
2132
2528
|
type PreparedQueryConfig<R> = Readonly<{
|
|
2133
2529
|
ast: QueryAst;
|
|
2134
2530
|
unoptimizedAst: QueryAst;
|
|
2135
|
-
sqlText: string | undefined;
|
|
2136
|
-
sqlParams: readonly unknown[] | undefined;
|
|
2137
|
-
unoptimizedSqlText: string | undefined;
|
|
2138
|
-
unoptimizedSqlParams: readonly unknown[] | undefined;
|
|
2139
2531
|
backend: GraphBackend;
|
|
2140
2532
|
dialect: SqlDialect;
|
|
2141
2533
|
graphId: string;
|
|
@@ -2146,7 +2538,9 @@ type PreparedQueryConfig<R> = Readonly<{
|
|
|
2146
2538
|
schemaIntrospector: SchemaIntrospector;
|
|
2147
2539
|
}>;
|
|
2148
2540
|
/**
|
|
2149
|
-
* A pre-
|
|
2541
|
+
* A pre-validated, parameterized query — see the module doc comment above for
|
|
2542
|
+
* how a reused prepared query runs a cached SQL template with a fresh read
|
|
2543
|
+
* instant filled per call.
|
|
2150
2544
|
*
|
|
2151
2545
|
* @example
|
|
2152
2546
|
* ```typescript
|
|
@@ -2195,10 +2589,6 @@ type UnionableQueryState = Readonly<{
|
|
|
2195
2589
|
traversals?: readonly Traversal[];
|
|
2196
2590
|
selectFn?: (context: SelectContext<AliasMap, EdgeAliasMap>) => unknown;
|
|
2197
2591
|
}>;
|
|
2198
|
-
/**
|
|
2199
|
-
* A query formed by combining multiple queries with set operations.
|
|
2200
|
-
* Supports chaining: q1.union(q2).intersect(q3)
|
|
2201
|
-
*/
|
|
2202
2592
|
declare class UnionableQuery<G extends GraphDef, R> {
|
|
2203
2593
|
#private;
|
|
2204
2594
|
constructor(config: QueryBuilderConfig, state: UnionableQueryState);
|
|
@@ -2267,7 +2657,7 @@ declare class ExecutableQuery<G extends GraphDef, Aliases extends AliasMap, Edge
|
|
|
2267
2657
|
#private;
|
|
2268
2658
|
constructor(config: QueryBuilderConfig, state: QueryBuilderState, selectFunction: (context: SelectContext<Aliases, EdgeAliases, RecursiveAliases>) => R);
|
|
2269
2659
|
/**
|
|
2270
|
-
* Builds the query AST.
|
|
2660
|
+
* Builds the query AST (memoized — the instance is immutable).
|
|
2271
2661
|
*/
|
|
2272
2662
|
toAst(): QueryAst;
|
|
2273
2663
|
/**
|
|
@@ -2337,8 +2727,12 @@ declare class ExecutableQuery<G extends GraphDef, Aliases extends AliasMap, Edge
|
|
|
2337
2727
|
*/
|
|
2338
2728
|
compile(): CompiledSelectSql;
|
|
2339
2729
|
/**
|
|
2340
|
-
* Creates a prepared (pre-
|
|
2341
|
-
*
|
|
2730
|
+
* Creates a prepared (pre-validated) query that can be executed multiple
|
|
2731
|
+
* times with different parameter bindings. Builds and structurally
|
|
2732
|
+
* validates the AST once (a malformed query fails fast, here, instead of on
|
|
2733
|
+
* first use); the prepared query then compiles once into a reusable template
|
|
2734
|
+
* and fills a fresh read instant per execute() — see PreparedQuery's class
|
|
2735
|
+
* doc comment.
|
|
2342
2736
|
*
|
|
2343
2737
|
* Use `param("name")` in predicates to create parameterized slots,
|
|
2344
2738
|
* then pass values via `prepared.execute({ name: "value" })`.
|
|
@@ -2950,16 +3344,6 @@ type RebuildFulltextResult = Readonly<{
|
|
|
2950
3344
|
skippedTruncated: boolean;
|
|
2951
3345
|
}>;
|
|
2952
3346
|
|
|
2953
|
-
/**
|
|
2954
|
-
* Store-level search helpers.
|
|
2955
|
-
*
|
|
2956
|
-
* `fulltextSearch` is a thin typed wrapper over `backend.fulltextSearch`.
|
|
2957
|
-
* `hybridSearch` runs a vector and a fulltext query in parallel and
|
|
2958
|
-
* fuses the two ranked lists with Reciprocal Rank Fusion. RRF is
|
|
2959
|
-
* rank-based, so it papers over score-scale differences between
|
|
2960
|
-
* pgvector/sqlite-vec (distance-derived) and tsvector/FTS5 (BM25-style).
|
|
2961
|
-
*/
|
|
2962
|
-
|
|
2963
3347
|
/**
|
|
2964
3348
|
* A fulltext search hit. `N` defaults to the generic `Node`; the
|
|
2965
3349
|
* `store.search.fulltext<K>(kind)` facade narrows it to the concrete
|
|
@@ -2994,7 +3378,36 @@ type HybridSearchHit<N = Node> = Readonly<{
|
|
|
2994
3378
|
/** Sub-result from the fulltext half, if it ranked this node. */
|
|
2995
3379
|
fulltext?: FulltextSearchHit<N>;
|
|
2996
3380
|
}>;
|
|
2997
|
-
|
|
3381
|
+
/**
|
|
3382
|
+
* Scope options shared by every facade search leg.
|
|
3383
|
+
*
|
|
3384
|
+
* `where` and `includeSubClasses` compile into the search statement's
|
|
3385
|
+
* candidate set (a subquery produced by the store's own query compiler), so
|
|
3386
|
+
* filtering happens INSIDE the engine's top-k — never by post-filtering a
|
|
3387
|
+
* ranked list. `offset` is rank-relative pagination: the engine fetches
|
|
3388
|
+
* `limit + offset` ranked candidates and discards the leading page.
|
|
3389
|
+
*/
|
|
3390
|
+
type SearchScopeOptions<N extends NodeType = NodeType> = Readonly<{
|
|
3391
|
+
/**
|
|
3392
|
+
* Predicate over the node's properties, compiled by the shared query
|
|
3393
|
+
* compiler into the candidate subquery. Requires a query-capable store.
|
|
3394
|
+
* The facade instantiates `N` to the searched kind's node type, so the
|
|
3395
|
+
* accessor is fully typed at the call site; the base instantiation
|
|
3396
|
+
* exposes the system accessors (`id`, `kind`) for standalone option
|
|
3397
|
+
* values.
|
|
3398
|
+
*/
|
|
3399
|
+
where?: (accessor: NodeAccessor<N>) => Predicate;
|
|
3400
|
+
/** Rows to skip after ranking (rank-relative pagination). */
|
|
3401
|
+
offset?: number;
|
|
3402
|
+
/**
|
|
3403
|
+
* Expand the searched kind to include its `subClassOf` descendants.
|
|
3404
|
+
* Vector legs search each declaring kind's storage and merge by score;
|
|
3405
|
+
* kinds that don't declare the embedding field are skipped (mirroring
|
|
3406
|
+
* the query builder). Requires a query-capable store.
|
|
3407
|
+
*/
|
|
3408
|
+
includeSubClasses?: boolean;
|
|
3409
|
+
}>;
|
|
3410
|
+
type FulltextSearchOptions<N extends NodeType = NodeType> = SearchScopeOptions<N> & Readonly<{
|
|
2998
3411
|
/** The user-supplied query string. */
|
|
2999
3412
|
query: string;
|
|
3000
3413
|
/** Max results. Required. */
|
|
@@ -3002,8 +3415,10 @@ type FulltextSearchOptions = Readonly<{
|
|
|
3002
3415
|
/** Query parser mode. Default: "websearch". */
|
|
3003
3416
|
mode?: FulltextQueryMode;
|
|
3004
3417
|
/**
|
|
3005
|
-
* Language override for query parsing. Default:
|
|
3006
|
-
*
|
|
3418
|
+
* Language override for query parsing. Default: the kind's
|
|
3419
|
+
* declared language (the same config rows were indexed with),
|
|
3420
|
+
* which keeps the parsed tsquery a plan-time constant on
|
|
3421
|
+
* PostgreSQL so the GIN index can serve the match.
|
|
3007
3422
|
*/
|
|
3008
3423
|
language?: string;
|
|
3009
3424
|
/** Minimum relevance score to include in results. */
|
|
@@ -3036,7 +3451,7 @@ type HybridVectorOptions = Readonly<{
|
|
|
3036
3451
|
* vector half of `HybridSearchOptions` but flattens it because the
|
|
3037
3452
|
* standalone path doesn't fuse against fulltext.
|
|
3038
3453
|
*/
|
|
3039
|
-
type VectorSearchOptions = Readonly<{
|
|
3454
|
+
type VectorSearchOptions<N extends NodeType = NodeType> = SearchScopeOptions<N> & Readonly<{
|
|
3040
3455
|
/** Field path of the embedding column on the node kind. */
|
|
3041
3456
|
fieldPath: string;
|
|
3042
3457
|
/** Query embedding to compare against. */
|
|
@@ -3073,7 +3488,7 @@ type HybridFulltextOptions = Readonly<{
|
|
|
3073
3488
|
minScore?: number;
|
|
3074
3489
|
includeSnippets?: boolean;
|
|
3075
3490
|
}>;
|
|
3076
|
-
type HybridSearchOptions = Readonly<{
|
|
3491
|
+
type HybridSearchOptions<N extends NodeType = NodeType> = SearchScopeOptions<N> & Readonly<{
|
|
3077
3492
|
vector: HybridVectorOptions;
|
|
3078
3493
|
fulltext: HybridFulltextOptions;
|
|
3079
3494
|
fusion?: HybridFusionOptions;
|
|
@@ -3105,10 +3520,17 @@ type HybridSearchOptions = Readonly<{
|
|
|
3105
3520
|
* when) the literal is statically known.
|
|
3106
3521
|
*/
|
|
3107
3522
|
type ResolveNode<G extends GraphDef, K extends string> = K extends NodeKinds<G> ? G["nodes"][K] extends NodeRegistration<infer N extends NodeType> ? Node<N> : Node : Node;
|
|
3523
|
+
/**
|
|
3524
|
+
* The registered `NodeType` behind a kind literal — the accessor-level
|
|
3525
|
+
* companion of {@link ResolveNode}, used to type `where` predicates.
|
|
3526
|
+
* Falls back to the base `NodeType` for dynamic (string) kinds.
|
|
3527
|
+
*/
|
|
3528
|
+
type ResolveNodeType<G extends GraphDef, K extends string> = K extends NodeKinds<G> ? G["nodes"][K] extends NodeRegistration<infer N extends NodeType> ? N : NodeType : NodeType;
|
|
3108
3529
|
type StoreSearchContext = Readonly<{
|
|
3109
3530
|
graphId: string;
|
|
3110
3531
|
backend: GraphBackend;
|
|
3111
3532
|
registry: KindRegistry;
|
|
3533
|
+
createQuery?: () => QueryBuilder<GraphDef>;
|
|
3112
3534
|
}>;
|
|
3113
3535
|
/**
|
|
3114
3536
|
* Search-related operations exposed via `store.search`.
|
|
@@ -3157,7 +3579,7 @@ declare class StoreSearch<G extends GraphDef> {
|
|
|
3157
3579
|
* configured with) and resolves the matching node IDs back to typed
|
|
3158
3580
|
* `Node` objects.
|
|
3159
3581
|
*/
|
|
3160
|
-
fulltext<K extends string>(nodeKind: K, options: FulltextSearchOptions): Promise<readonly FulltextSearchHit<ResolveNode<G, K>>[]>;
|
|
3582
|
+
fulltext<K extends string>(nodeKind: K, options: FulltextSearchOptions<ResolveNodeType<G, K>>): Promise<readonly FulltextSearchHit<ResolveNode<G, K>>[]>;
|
|
3161
3583
|
/**
|
|
3162
3584
|
* Runs a vector similarity search against nodes of the given kind.
|
|
3163
3585
|
*
|
|
@@ -3169,7 +3591,7 @@ declare class StoreSearch<G extends GraphDef> {
|
|
|
3169
3591
|
* Pure vector — no fulltext leg, no fusion. For combined
|
|
3170
3592
|
* vector+fulltext ranking, use `hybrid`.
|
|
3171
3593
|
*/
|
|
3172
|
-
vector<K extends string>(nodeKind: K, options: VectorSearchOptions): Promise<readonly VectorSearchHit<ResolveNode<G, K>>[]>;
|
|
3594
|
+
vector<K extends string>(nodeKind: K, options: VectorSearchOptions<ResolveNodeType<G, K>>): Promise<readonly VectorSearchHit<ResolveNode<G, K>>[]>;
|
|
3173
3595
|
/**
|
|
3174
3596
|
* Runs a vector + fulltext hybrid search and fuses the results with
|
|
3175
3597
|
* Reciprocal Rank Fusion.
|
|
@@ -3179,7 +3601,7 @@ declare class StoreSearch<G extends GraphDef> {
|
|
|
3179
3601
|
* over-fetch is 4× `limit` from each source — tune via `vector.k` /
|
|
3180
3602
|
* `fulltext.k` for higher-recall corpora.
|
|
3181
3603
|
*/
|
|
3182
|
-
hybrid<K extends string>(nodeKind: K, options: HybridSearchOptions): Promise<readonly HybridSearchHit<ResolveNode<G, K>>[]>;
|
|
3604
|
+
hybrid<K extends string>(nodeKind: K, options: HybridSearchOptions<ResolveNodeType<G, K>>): Promise<readonly HybridSearchHit<ResolveNode<G, K>>[]>;
|
|
3183
3605
|
/**
|
|
3184
3606
|
* Rebuilds the fulltext index from existing node data.
|
|
3185
3607
|
*
|
|
@@ -3566,6 +3988,18 @@ declare class Store<G extends GraphDef> {
|
|
|
3566
3988
|
* @internal
|
|
3567
3989
|
*/
|
|
3568
3990
|
get historyEnabled(): boolean;
|
|
3991
|
+
/**
|
|
3992
|
+
* Whether this Store advances a durable revision anchor for graph writes.
|
|
3993
|
+
*
|
|
3994
|
+
* @internal
|
|
3995
|
+
*/
|
|
3996
|
+
get revisionTrackingEnabled(): boolean;
|
|
3997
|
+
/**
|
|
3998
|
+
* SQL schema that owns the durable revision clock relation.
|
|
3999
|
+
*
|
|
4000
|
+
* @internal
|
|
4001
|
+
*/
|
|
4002
|
+
get revisionSchema(): SqlSchema;
|
|
3569
4003
|
/**
|
|
3570
4004
|
* Whether this store has a recorded read relation bound for reconstruction.
|
|
3571
4005
|
*
|
|
@@ -3813,6 +4247,24 @@ declare class Store<G extends GraphDef> {
|
|
|
3813
4247
|
* success), not the global clock.
|
|
3814
4248
|
*/
|
|
3815
4249
|
recordedNow(): Promise<RecordedInstant | undefined>;
|
|
4250
|
+
/**
|
|
4251
|
+
* Returns the durable graph revision used by graph branching. It is undefined
|
|
4252
|
+
* until the first successful tracked write, which is itself a stable initial
|
|
4253
|
+
* anchor. Unlike {@link recordedNow}, this is also available on a live Store
|
|
4254
|
+
* created with `{ revisionTracking: true }`.
|
|
4255
|
+
*
|
|
4256
|
+
* @internal
|
|
4257
|
+
*/
|
|
4258
|
+
revisionNow(): Promise<string | undefined>;
|
|
4259
|
+
/**
|
|
4260
|
+
* Returns the durable random namespace for this graph's revision clock. A
|
|
4261
|
+
* tracked base token combines it with {@link revisionNow}, preventing a
|
|
4262
|
+
* branch from one independent store from matching a coincident timestamp in
|
|
4263
|
+
* another store.
|
|
4264
|
+
*
|
|
4265
|
+
* @internal
|
|
4266
|
+
*/
|
|
4267
|
+
revisionOriginNow(): Promise<string>;
|
|
3816
4268
|
/**
|
|
3817
4269
|
* Returns a read-only {@link StoreView} pinned to an arbitrary public
|
|
3818
4270
|
* temporal mode. Use {@link Store.asOf} for the common valid-time case;
|
|
@@ -3967,12 +4419,16 @@ declare class Store<G extends GraphDef> {
|
|
|
3967
4419
|
* transaction**, for writing the caller's own relational tables in
|
|
3968
4420
|
* the same atomic boundary (the graph-owned counterpart of
|
|
3969
4421
|
* {@link Store.withTransaction}). See {@link TransactionContext}
|
|
3970
|
-
* for per-backend semantics
|
|
3971
|
-
*
|
|
3972
|
-
*
|
|
3973
|
-
*
|
|
3974
|
-
*
|
|
3975
|
-
*
|
|
4422
|
+
* for per-backend semantics. To decide at runtime whether `tx.sql` is
|
|
4423
|
+
* usable, branch on `tx.sqlAvailability` rather than truthiness-testing
|
|
4424
|
+
* `tx.sql` — under history capture or revision tracking `tx.sql` is
|
|
4425
|
+
* present-but-throwing (`sqlAvailability` is `"history"` /
|
|
4426
|
+
* `"revisionTracking"`), and it is `undefined` only on the non-transactional
|
|
4427
|
+
* fallback (`sqlAvailability === "unavailable"`). When it reports
|
|
4428
|
+
* `"history"` / `"revisionTracking"`, raw SQL is disabled because it would
|
|
4429
|
+
* bypass recorded-time capture or the revision anchor; use the typed
|
|
4430
|
+
* collections inside `transaction()` or
|
|
4431
|
+
* {@link Store.withRecordedTransaction}.
|
|
3976
4432
|
*
|
|
3977
4433
|
* @example
|
|
3978
4434
|
* ```typescript
|
|
@@ -3997,6 +4453,16 @@ declare class Store<G extends GraphDef> {
|
|
|
3997
4453
|
* });
|
|
3998
4454
|
* ```
|
|
3999
4455
|
*
|
|
4456
|
+
* **`tx.sql` shares the one pinned connection — await it, don't overlap it.**
|
|
4457
|
+
* TypeGraph serializes the statements *its own* collections issue, so a
|
|
4458
|
+
* `Promise.all` of graph writes is safe. A statement you issue through
|
|
4459
|
+
* `tx.sql` bypasses that queue: run it concurrently with a graph write (or
|
|
4460
|
+
* with another `tx.sql` statement) and two queries race on the one
|
|
4461
|
+
* transaction connection — the exact overlap Postgres removes in `pg@9`.
|
|
4462
|
+
* Await each `tx.sql` statement before starting the next write. TypeGraph
|
|
4463
|
+
* cannot police this: it never sees the raw handle's traffic, so it also
|
|
4464
|
+
* cannot drain a raw statement still in flight when the transaction commits.
|
|
4465
|
+
*
|
|
4000
4466
|
* **Backends without transactions.** When `backend.capabilities.transactions`
|
|
4001
4467
|
* is `false` (Cloudflare D1, `drizzle-orm/neon-http`), this method runs the
|
|
4002
4468
|
* callback against the same backend used outside `transaction()` — writes
|
|
@@ -4022,6 +4488,49 @@ declare class Store<G extends GraphDef> {
|
|
|
4022
4488
|
*/
|
|
4023
4489
|
transaction<T>(this: HistoryStore<G>, fn: (tx: HistoryTransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
4024
4490
|
transaction<T>(fn: (tx: TransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
4491
|
+
/**
|
|
4492
|
+
* Runs a transaction exactly like {@link transaction} and additionally
|
|
4493
|
+
* returns a {@link TransactionOutcome} whose receipt summarizes the
|
|
4494
|
+
* completed write intents on the transaction-scoped collection surface.
|
|
4495
|
+
*
|
|
4496
|
+
* A dedicated method (rather than an option on `transaction()`) keeps the
|
|
4497
|
+
* return type tied to static dispatch: forwarding options through wrappers
|
|
4498
|
+
* can never change what a call returns. See {@link TransactionReceipt} for
|
|
4499
|
+
* exact count semantics.
|
|
4500
|
+
*
|
|
4501
|
+
* The receipt does not count writes that bypass the `tx.nodes.*` /
|
|
4502
|
+
* `tx.edges.*` collections, such as direct backend writes, raw SQL, or
|
|
4503
|
+
* import helpers. The adopted-commit sibling
|
|
4504
|
+
* {@link Store.withRecordedTransaction} also returns a
|
|
4505
|
+
* {@link TransactionOutcome}; only `withTransaction` (whose commit belongs
|
|
4506
|
+
* entirely to the caller with no flush point) produces no receipt. On
|
|
4507
|
+
* non-transactional backends, the receipt is still returned, but it describes
|
|
4508
|
+
* operations that individually committed rather than one atomic commit; if the
|
|
4509
|
+
* callback rejects on such a backend, no receipt is returned even though
|
|
4510
|
+
* earlier operations committed individually.
|
|
4511
|
+
*
|
|
4512
|
+
* For stores created with `{ history: true }`, `receipt.recorded` is the
|
|
4513
|
+
* recorded commit instant this transaction allocated for the store's
|
|
4514
|
+
* graph, or `undefined` when nothing was captured.
|
|
4515
|
+
*
|
|
4516
|
+
* The callback receives a {@link MeasurableTransactionContext}: call
|
|
4517
|
+
* `tx.measure((scoped) => ...)` to scope a sub-receipt to the writes made
|
|
4518
|
+
* through the `scoped` context (e.g. to attribute writes to user code the
|
|
4519
|
+
* caller invokes, excluding its own bookkeeping written through `tx`). See
|
|
4520
|
+
* {@link MeasurableTransactionContext} for semantics.
|
|
4521
|
+
*
|
|
4522
|
+
* @example
|
|
4523
|
+
* ```typescript
|
|
4524
|
+
* const outcome = await store.transactionWithReceipt(async (tx) => {
|
|
4525
|
+
* const alice = await tx.nodes.Person.create({ name: "Alice" });
|
|
4526
|
+
* return alice.id;
|
|
4527
|
+
* });
|
|
4528
|
+
* outcome.result; // Alice's id
|
|
4529
|
+
* outcome.receipt.writes; // { nodes: { Person: 1 }, edges: {}, total: 1 }
|
|
4530
|
+
* ```
|
|
4531
|
+
*/
|
|
4532
|
+
transactionWithReceipt<T>(this: HistoryStore<G>, fn: (tx: MeasurableHistoryTransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<TransactionOutcome<T>>;
|
|
4533
|
+
transactionWithReceipt<T>(fn: (tx: MeasurableTransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<TransactionOutcome<T>>;
|
|
4025
4534
|
/**
|
|
4026
4535
|
* Adopts a caller-owned, already-open Drizzle transaction so the graph
|
|
4027
4536
|
* store and the caller's relational writes commit or roll back as one
|
|
@@ -4064,13 +4573,24 @@ declare class Store<G extends GraphDef> {
|
|
|
4064
4573
|
* }); // one COMMIT / ROLLBACK across both layers
|
|
4065
4574
|
* ```
|
|
4066
4575
|
*
|
|
4576
|
+
* **The caller owns the connection — don't overlap writes on it.** The graph
|
|
4577
|
+
* store and your Drizzle writes share the one connection the caller's
|
|
4578
|
+
* transaction pinned. TypeGraph serializes the statements *its* collections
|
|
4579
|
+
* issue, but your raw Drizzle statements (and any graph write run alongside
|
|
4580
|
+
* them) are yours to sequence: a `Promise.all` mixing the two races two
|
|
4581
|
+
* queries on that connection — the overlap Postgres removes in `pg@9`. Await
|
|
4582
|
+
* each write before starting the next.
|
|
4583
|
+
*
|
|
4067
4584
|
* Not available when the store was created with `{ history: true }`: a
|
|
4068
4585
|
* caller-owned transaction context would let writes happen after capture has
|
|
4069
|
-
* lost its flush point
|
|
4070
|
-
* (`
|
|
4071
|
-
* {@link Store.withRecordedTransaction}
|
|
4072
|
-
*
|
|
4073
|
-
*
|
|
4586
|
+
* lost its flush point. On a {@link HistoryStore} this is a **compile error**
|
|
4587
|
+
* at the call site (the `externalTx` argument is rejected against a message
|
|
4588
|
+
* type naming {@link Store.withRecordedTransaction}); the runtime guard still
|
|
4589
|
+
* throws `ConfigurationError`
|
|
4590
|
+
* (`RECORDED_CAPTURE_REQUIRES_CALLBACK_TRANSACTION`) if the check is
|
|
4591
|
+
* suppressed. Use {@link Store.withRecordedTransaction} on a history-enabled
|
|
4592
|
+
* store, which adopts the same external transaction but flushes recorded-time
|
|
4593
|
+
* capture before the caller commits.
|
|
4074
4594
|
*
|
|
4075
4595
|
* @throws {ConfigurationError} when the store has history capture enabled
|
|
4076
4596
|
* (use {@link Store.withRecordedTransaction} instead), or when the backend
|
|
@@ -4086,7 +4606,7 @@ declare class Store<G extends GraphDef> {
|
|
|
4086
4606
|
* `createStoreWithSchema`). Rolls back the caller's transaction
|
|
4087
4607
|
* without emitting any DDL.
|
|
4088
4608
|
*/
|
|
4089
|
-
withTransaction(externalTx: AdoptedTransaction): TransactionContext<G>;
|
|
4609
|
+
withTransaction<This extends Store<G>>(this: This, externalTx: This extends HistoryStore<G> ? HistoryWithTransactionUnavailable : AdoptedTransaction): This extends HistoryStore<G> ? never : TransactionContext<G>;
|
|
4090
4610
|
/**
|
|
4091
4611
|
* Adopts a caller-owned transaction while giving recorded-time capture a
|
|
4092
4612
|
* flush point before the caller commits. Required when `history: true` is
|
|
@@ -4097,10 +4617,55 @@ declare class Store<G extends GraphDef> {
|
|
|
4097
4617
|
* session, so a graph write made through the transaction context *after* `fn`
|
|
4098
4618
|
* returns (e.g. retaining `tx` and writing once more before the caller's
|
|
4099
4619
|
* COMMIT) throws rather than committing uncaptured — the post-flush write
|
|
4100
|
-
* cannot silently diverge history from live state.
|
|
4620
|
+
* cannot silently diverge history from live state. This sealing behavior is
|
|
4621
|
+
* unchanged by the receipt return.
|
|
4622
|
+
*
|
|
4623
|
+
* Returns a {@link TransactionOutcome} — the adopted path is the only way to
|
|
4624
|
+
* get exactly-once cursors and graph writes atomically on a history store, so
|
|
4625
|
+
* it surfaces the same receipt `transactionWithReceipt` does: `receipt.writes`
|
|
4626
|
+
* for drop detection (a non-delete change that wrote nothing) and
|
|
4627
|
+
* `receipt.recorded` as the per-transaction replay anchor. Destructure
|
|
4628
|
+
* `{ result, receipt }`:
|
|
4629
|
+
*
|
|
4630
|
+
* ```typescript
|
|
4631
|
+
* const { result, receipt } = await store.withRecordedTransaction(
|
|
4632
|
+
* externalTx,
|
|
4633
|
+
* async (tx) => tx.nodes.Document.update(documentId, props),
|
|
4634
|
+
* );
|
|
4635
|
+
* ```
|
|
4636
|
+
*
|
|
4637
|
+
* `receipt.recorded` is the recorded commit instant this transaction allocated
|
|
4638
|
+
* for the store's graph at the flush point (when `fn` resolved), and is
|
|
4639
|
+
* `undefined` when nothing was captured — a read-only `fn`, or a non-history
|
|
4640
|
+
* store (where the receipt still counts write intents but there is no recorded
|
|
4641
|
+
* time). To attribute writes when `fn` invokes user code that also
|
|
4642
|
+
* bookkeeps, use `tx.measure((scoped) => ...)` and have that code write
|
|
4643
|
+
* through the `scoped` context (see {@link MeasurableTransactionContext}).
|
|
4644
|
+
*
|
|
4645
|
+
* Write your own relational tables through the **external transaction handle
|
|
4646
|
+
* you passed in** (`externalTx`) — it *is* the pinned connection. `tx.sql` is
|
|
4647
|
+
* unavailable here (it is a fail-loud guard under history capture, since raw
|
|
4648
|
+
* SQL bypasses recorded-time capture, and `HistoryTransactionContext` types it
|
|
4649
|
+
* `sql?: never`). Writing through `externalTx` is the sanctioned way to get
|
|
4650
|
+
* cross-store atomicity on a history-enabled store:
|
|
4651
|
+
*
|
|
4652
|
+
* ```typescript
|
|
4653
|
+
* // Async driver (Postgres / libsql):
|
|
4654
|
+
* await db.transaction(async (pgTx) => {
|
|
4655
|
+
* const { receipt } = await store.withRecordedTransaction(pgTx, async (tx) => {
|
|
4656
|
+
* await tx.nodes.Document.update(documentId, props); // graph write
|
|
4657
|
+
* });
|
|
4658
|
+
* await pgTx.insert(streamCursors).values(cursorRow); // your own table
|
|
4659
|
+
* }); // one COMMIT / ROLLBACK across both layers
|
|
4660
|
+
* ```
|
|
4661
|
+
*
|
|
4662
|
+
* The graph writes and your `externalTx` statements share the caller's one
|
|
4663
|
+
* pinned connection. TypeGraph serializes the statements its collections
|
|
4664
|
+
* issue; sequence your own raw statements (and don't `Promise.all` them with
|
|
4665
|
+
* graph writes) so two queries never race on that connection.
|
|
4101
4666
|
*/
|
|
4102
|
-
withRecordedTransaction<T>(this: HistoryStore<G>, externalTx: AdoptedTransaction, fn: (tx:
|
|
4103
|
-
withRecordedTransaction<T>(externalTx: AdoptedTransaction, fn: (tx:
|
|
4667
|
+
withRecordedTransaction<T>(this: HistoryStore<G>, externalTx: AdoptedTransaction, fn: (tx: MeasurableHistoryTransactionContext<G>) => Promise<T>): Promise<TransactionOutcome<T>>;
|
|
4668
|
+
withRecordedTransaction<T>(externalTx: AdoptedTransaction, fn: (tx: MeasurableTransactionContext<G>) => Promise<T>): Promise<TransactionOutcome<T>>;
|
|
4104
4669
|
/**
|
|
4105
4670
|
* Hard-deletes all data for this graph from the database.
|
|
4106
4671
|
*
|
|
@@ -4358,6 +4923,17 @@ type HistoryTransactionContext<G extends GraphDef> = Omit<TransactionContext<G>,
|
|
|
4358
4923
|
backend: HistorySafeTransactionBackend;
|
|
4359
4924
|
sql?: never;
|
|
4360
4925
|
}>;
|
|
4926
|
+
/**
|
|
4927
|
+
* The {@link HistoryTransactionContext} handed to a `withRecordedTransaction`
|
|
4928
|
+
* callback, extended with {@link ScopedMeasure}. Its `measure` scopes to a child
|
|
4929
|
+
* {@link MeasurableHistoryTransactionContext} (so nested scopes keep the
|
|
4930
|
+
* history-safe `sql?: never` / backend typing). Assignable to
|
|
4931
|
+
* {@link MeasurableTransactionContext} (and hence to {@link TransactionContext}),
|
|
4932
|
+
* so a projector helper typed against either still accepts it.
|
|
4933
|
+
*/
|
|
4934
|
+
type MeasurableHistoryTransactionContext<G extends GraphDef> = HistoryTransactionContext<G> & Readonly<{
|
|
4935
|
+
measure: ScopedMeasure<MeasurableHistoryTransactionContext<G>>;
|
|
4936
|
+
}>;
|
|
4361
4937
|
type RecordedReadStore<G extends GraphDef> = Store<G> & Readonly<{
|
|
4362
4938
|
recordedReadBound: true;
|
|
4363
4939
|
}>;
|
|
@@ -4366,6 +4942,15 @@ type HistoryStore<G extends GraphDef> = Store<G> & Readonly<{
|
|
|
4366
4942
|
historyEnabled: true;
|
|
4367
4943
|
recordedReadBound: true;
|
|
4368
4944
|
}>;
|
|
4945
|
+
/**
|
|
4946
|
+
* The `externalTx` parameter type {@link Store.withTransaction} resolves to when
|
|
4947
|
+
* called on a {@link HistoryStore}. A real {@link AdoptedTransaction} is not
|
|
4948
|
+
* assignable to this string literal, so the call is a compile error whose
|
|
4949
|
+
* message names the working alternative. `HistoryStore` cannot be excluded from
|
|
4950
|
+
* the general signature by a `this` constraint alone — it is a subtype of
|
|
4951
|
+
* `Store<G>` — so the block is expressed on the argument instead.
|
|
4952
|
+
*/
|
|
4953
|
+
type HistoryWithTransactionUnavailable = "withTransaction() is unavailable on a history-enabled store — use store.withRecordedTransaction() so recorded-time capture can flush before the caller commits";
|
|
4369
4954
|
type ExplicitRecordedReadLiveOptions = LiveStoreOptions & Readonly<{
|
|
4370
4955
|
recordedRead: NonNullable<LiveStoreOptions["recordedRead"]>;
|
|
4371
4956
|
}>;
|
|
@@ -4616,4 +5201,4 @@ declare class RecordedStoreView<G extends GraphDef> extends CoordinatePinnedView
|
|
|
4616
5201
|
get edges(): RecordedStoreViewEdgeCollections<G>;
|
|
4617
5202
|
}
|
|
4618
5203
|
|
|
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
|
|
5204
|
+
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, param 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 TransactionReceipt as bA, type TraversalDirection as bB, type TypedEdgeCollection as bC, type TypedRecordedStoreViewEdgeCollection as bD, type TypedStoreViewEdgeCollection as bE, UnionableQuery as bF, type UpdateEdgeInput as bG, type UpdateNodeInput as bH, type VectorSearchHit as bI, type VectorSearchOptions as bJ, asRecordedInstant as bK, createQueryBuilder as bL, createStore as bM, createStoreWithSchema as bN, createVerifiedStore as bO, defineSubgraphProject as bP, embedding as bQ, exists as bR, fieldRef as bS, getEmbeddingDimensions as bT, getSearchableMetadata as bU, inSubquery as bV, isEmbeddingSchema as bW, isParameterRef as bX, isSearchableSchema as bY, notExists as bZ, notInSubquery 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 StoreViewNeighborsOptions as bk, type StoreViewNodeCollection as bl, type StoreViewNodeCollections as bm, type StoreViewReachableOptions as bn, type StoreViewShortestPathOptions as bo, type StoreViewSubgraphOptions as bp, type StreamOptions as bq, type SubgraphEdgeResult as br, type SubgraphNodeResult as bs, type SubgraphOptions as bt, type SubgraphResult as bu, type SubsetEdge as bv, type SubsetNode as bw, type TemporalAlgorithmOptions as bx, type TransactionContext as by, type TransactionOutcome as bz, QueryBuilder as c, searchable as c0, 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 };
|