@nicia-ai/typegraph 0.34.0 → 0.35.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-ZV5N4DBG.js → chunk-3TWF3SH4.js} +300 -58
- package/dist/chunk-3TWF3SH4.js.map +1 -0
- package/dist/chunk-4JEZZJ6S.cjs +1271 -0
- package/dist/chunk-4JEZZJ6S.cjs.map +1 -0
- package/dist/{chunk-UNNPKQUG.cjs → chunk-4TOD4LBZ.cjs} +246 -155
- package/dist/chunk-4TOD4LBZ.cjs.map +1 -0
- package/dist/{chunk-QV245VMN.js → chunk-55MZDDZV.js} +100 -6
- package/dist/chunk-55MZDDZV.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-BVTWD66D.js → chunk-5SEGFTZX.js} +3 -3
- package/dist/{chunk-BVTWD66D.js.map → chunk-5SEGFTZX.js.map} +1 -1
- package/dist/{chunk-6GNSY7AV.js → chunk-6FR2MMS6.js} +7 -7
- package/dist/chunk-6FR2MMS6.js.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-RHZWOJVA.cjs → chunk-BLZDPRXT.cjs} +52 -4
- package/dist/chunk-BLZDPRXT.cjs.map +1 -0
- package/dist/chunk-BYPOGQWK.js +25 -0
- package/dist/chunk-BYPOGQWK.js.map +1 -0
- package/dist/{chunk-6HVOHZHS.cjs → chunk-CK5BVQOW.cjs} +213 -168
- package/dist/chunk-CK5BVQOW.cjs.map +1 -0
- package/dist/{chunk-JJRCLAUN.cjs → chunk-CTTSDJLY.cjs} +116 -10
- package/dist/chunk-CTTSDJLY.cjs.map +1 -0
- package/dist/chunk-CUHM5CWJ.cjs +12 -0
- package/dist/chunk-CUHM5CWJ.cjs.map +1 -0
- package/dist/{chunk-A7SZZFAG.js → chunk-CZQ3FO2Q.js} +409 -99
- package/dist/chunk-CZQ3FO2Q.js.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-UJLOZYKT.cjs → chunk-EM3CWPND.cjs} +441 -115
- package/dist/chunk-EM3CWPND.cjs.map +1 -0
- package/dist/chunk-EMF62TZG.cjs +1176 -0
- package/dist/chunk-EMF62TZG.cjs.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-HK5SATYM.cjs → chunk-FL472AMI.cjs} +16 -109
- package/dist/chunk-FL472AMI.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-GSQ6NPH6.cjs +100 -0
- package/dist/chunk-GSQ6NPH6.cjs.map +1 -0
- package/dist/chunk-GUR2FNB5.cjs +12 -0
- package/dist/{chunk-HMFK4BXR.cjs.map → chunk-GUR2FNB5.cjs.map} +1 -1
- package/dist/{chunk-JQGIPGVL.cjs → chunk-H7YNSMA7.cjs} +43 -2
- package/dist/chunk-H7YNSMA7.cjs.map +1 -0
- package/dist/{chunk-2MRAX3UE.js → chunk-I7ZUZKFD.js} +47 -4
- package/dist/chunk-I7ZUZKFD.js.map +1 -0
- package/dist/{chunk-3BRVBQQD.cjs → chunk-J7WFGBJR.cjs} +2445 -2367
- package/dist/chunk-J7WFGBJR.cjs.map +1 -0
- package/dist/{chunk-V3QNTB7Z.js → chunk-JBTOYDMN.js} +194 -114
- package/dist/chunk-JBTOYDMN.js.map +1 -0
- package/dist/{chunk-K2TGS3EN.js → chunk-K3PPLHY7.js} +138 -89
- package/dist/chunk-K3PPLHY7.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-KMI7LYAF.js +1252 -0
- package/dist/chunk-KMI7LYAF.js.map +1 -0
- package/dist/{chunk-JIEJCTDS.cjs → chunk-LGEALRC6.cjs} +21 -4
- package/dist/chunk-LGEALRC6.cjs.map +1 -0
- package/dist/{chunk-TQOYM4LN.js → chunk-MP2JQKSG.js} +21 -5
- package/dist/chunk-MP2JQKSG.js.map +1 -0
- package/dist/{chunk-ZP5WHI4C.cjs → chunk-O7UN7OXA.cjs} +358 -116
- package/dist/chunk-O7UN7OXA.cjs.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-DEQFL35G.js → chunk-Q5TEXCTB.js} +61 -7
- package/dist/chunk-Q5TEXCTB.js.map +1 -0
- package/dist/chunk-QNKSQTKQ.js +1312 -0
- package/dist/chunk-QNKSQTKQ.js.map +1 -0
- package/dist/{chunk-ZURTTSCM.js → chunk-QOTI55H7.js} +6 -94
- package/dist/chunk-QOTI55H7.js.map +1 -0
- package/dist/{chunk-CHXTTSC6.js → chunk-QWEUYILR.js} +104 -5
- package/dist/chunk-QWEUYILR.js.map +1 -0
- package/dist/{chunk-LANHCOXB.js → chunk-RGP33ZJ5.js} +485 -83
- package/dist/chunk-RGP33ZJ5.js.map +1 -0
- package/dist/chunk-RGPG7EOJ.js +94 -0
- package/dist/chunk-RGPG7EOJ.js.map +1 -0
- package/dist/{chunk-G6SOJEDI.cjs → chunk-S55OV6PW.cjs} +15 -15
- package/dist/chunk-S55OV6PW.cjs.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-XLUNB2TZ.js → chunk-SNXVDZAJ.js} +3 -3
- package/dist/{chunk-XLUNB2TZ.js.map → chunk-SNXVDZAJ.js.map} +1 -1
- 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-WLRIWYHQ.js → chunk-UES55P7G.js} +1863 -1785
- package/dist/chunk-UES55P7G.js.map +1 -0
- 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-T6SPUYLX.cjs → chunk-VPYHY3LJ.cjs} +116 -10
- package/dist/chunk-VPYHY3LJ.cjs.map +1 -0
- package/dist/{chunk-T46GR2VY.js → chunk-VSPCZAXF.js} +3 -3
- package/dist/{chunk-T46GR2VY.js.map → chunk-VSPCZAXF.js.map} +1 -1
- 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-RY2VIWAM.js → chunk-WDBCBWC4.js} +355 -32
- package/dist/chunk-WDBCBWC4.js.map +1 -0
- package/dist/chunk-WJT7OU7E.cjs +1334 -0
- package/dist/chunk-WJT7OU7E.cjs.map +1 -0
- package/dist/{chunk-5IQIX7LU.cjs → chunk-XOX22WHL.cjs} +476 -163
- package/dist/chunk-XOX22WHL.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-6CSUAq-x.d.ts} +234 -93
- package/dist/{index-SEvUHDA6.d.cts → index-Bks_3HHK.d.cts} +234 -93
- package/dist/index.cjs +208 -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 +47 -26
- package/dist/interchange/index.d.cts +126 -12
- package/dist/interchange/index.d.ts +126 -12
- package/dist/interchange/index.js +14 -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-BSpqvAxK.d.cts} +415 -44
- package/dist/{store-view-BlgnhEYf.d.ts → store-view-CKbHFRnn.d.ts} +415 -44
- 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-DwQi8eV0.cjs';
|
|
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.cjs';
|
|
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-CDkSSYhq.cjs';
|
|
5
|
+
import { b as MaterializeIndexesOptions, M as MaterializeIndexesResult } from './materialize-indexes-B4e9360H.cjs';
|
|
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,39 @@ 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;
|
|
1199
1293
|
/** SQL schema configuration from createSqlSchema(...) for custom table names */
|
|
1200
1294
|
schema?: SqlSchema;
|
|
1201
1295
|
/** Query default behaviors. */
|
|
@@ -1255,6 +1349,55 @@ type StoreOptions = LiveStoreOptions | HistoryStoreOptions;
|
|
|
1255
1349
|
interface StoreRef<T> {
|
|
1256
1350
|
current: T;
|
|
1257
1351
|
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Summary returned by `store.transactionWithReceipt(fn)`.
|
|
1354
|
+
*/
|
|
1355
|
+
type TransactionOutcome<T> = Readonly<{
|
|
1356
|
+
result: T;
|
|
1357
|
+
receipt: TransactionReceipt;
|
|
1358
|
+
}>;
|
|
1359
|
+
/**
|
|
1360
|
+
* Transaction write summary.
|
|
1361
|
+
*
|
|
1362
|
+
* Receipt counts are completed write intents at the collection surface, not
|
|
1363
|
+
* rows affected:
|
|
1364
|
+
*
|
|
1365
|
+
* 1. Every successful completion of a write method on `tx.nodes.*` /
|
|
1366
|
+
* `tx.edges.*` counts. The authoritative method list is
|
|
1367
|
+
* {@link NodeWrites} / {@link EdgeWrites}.
|
|
1368
|
+
* 2. Bulk methods count by input length; an empty bulk call (`bulkCreate([])`)
|
|
1369
|
+
* counts 0.
|
|
1370
|
+
* 3. Single-row methods count 1 on resolve — including `delete` of an absent
|
|
1371
|
+
* id and `getOrCreate*` that found an existing row. Consumers that need
|
|
1372
|
+
* "did anything actually change" semantics apply their own per-operation
|
|
1373
|
+
* policy.
|
|
1374
|
+
* 4. A method that rejects counts 0 — even when the backend applied part of a
|
|
1375
|
+
* bulk input before failing. On SQLite a failed statement does not abort
|
|
1376
|
+
* the surrounding transaction, so a caller that catches the rejection and
|
|
1377
|
+
* commits can persist rows the receipt never counted. Do not read the
|
|
1378
|
+
* receipt as rows-affected in that scenario.
|
|
1379
|
+
* 5. A node `delete` under `cascade` / `disconnect` removes connected edges
|
|
1380
|
+
* through the backend, not the edge-collection surface; those removals do
|
|
1381
|
+
* not appear in `edges`.
|
|
1382
|
+
* 6. Rows-affected fidelity is intentionally out of scope for this first
|
|
1383
|
+
* version; a future extension could ask backends to return row counts.
|
|
1384
|
+
*/
|
|
1385
|
+
type TransactionReceipt = Readonly<{
|
|
1386
|
+
writes: Readonly<{
|
|
1387
|
+
/** Completed node write intents by node kind. */
|
|
1388
|
+
nodes: Readonly<Record<string, number>>;
|
|
1389
|
+
/** Completed edge write intents by edge kind. */
|
|
1390
|
+
edges: Readonly<Record<string, number>>;
|
|
1391
|
+
/** Sum of all node and edge write intents. */
|
|
1392
|
+
total: number;
|
|
1393
|
+
}>;
|
|
1394
|
+
/**
|
|
1395
|
+
* The recorded commit instant allocated for this store's graph by this
|
|
1396
|
+
* transaction. Undefined when history capture is off, the transaction is
|
|
1397
|
+
* read-only, or no captured writes were flushed.
|
|
1398
|
+
*/
|
|
1399
|
+
recorded?: RecordedInstant;
|
|
1400
|
+
}>;
|
|
1258
1401
|
/**
|
|
1259
1402
|
* Behavior when a get-or-create operation matches an existing record.
|
|
1260
1403
|
*/
|
|
@@ -1327,7 +1470,11 @@ type EdgeGetOrCreateByEndpointsOptions<E extends AnyEdgeType> = Readonly<{
|
|
|
1327
1470
|
* Provides ergonomic CRUD operations for a single node type.
|
|
1328
1471
|
*/
|
|
1329
1472
|
type NodeCollection<N extends NodeType, CN extends string = string> = Readonly<{
|
|
1330
|
-
/**
|
|
1473
|
+
/**
|
|
1474
|
+
* Create a new node.
|
|
1475
|
+
*
|
|
1476
|
+
* `validFrom` defaults to the operation's creation timestamp when omitted.
|
|
1477
|
+
*/
|
|
1331
1478
|
create: (props: z.input<N["schema"]>, options?: Readonly<{
|
|
1332
1479
|
id?: string;
|
|
1333
1480
|
validFrom?: string;
|
|
@@ -1374,6 +1521,8 @@ type NodeCollection<N extends NodeType, CN extends string = string> = Readonly<{
|
|
|
1374
1521
|
* Use this for dynamic dispatch (changesets, migrations, imports) where
|
|
1375
1522
|
* the data shape is determined at runtime, not compile time.
|
|
1376
1523
|
* The return type is fully typed — only the input gate is relaxed.
|
|
1524
|
+
*
|
|
1525
|
+
* `validFrom` defaults to the operation's creation timestamp when omitted.
|
|
1377
1526
|
*/
|
|
1378
1527
|
createFromRecord: (data: Record<string, unknown>, options?: Readonly<{
|
|
1379
1528
|
id?: string;
|
|
@@ -1385,6 +1534,9 @@ type NodeCollection<N extends NodeType, CN extends string = string> = Readonly<{
|
|
|
1385
1534
|
*
|
|
1386
1535
|
* If a node with the given ID exists, updates it with the provided props.
|
|
1387
1536
|
* Otherwise, creates a new node with that ID.
|
|
1537
|
+
*
|
|
1538
|
+
* `validFrom` only applies on the create branch, defaulting to the
|
|
1539
|
+
* operation's creation timestamp when omitted; it has no effect on update.
|
|
1388
1540
|
*/
|
|
1389
1541
|
upsertById: (id: string, props: z.input<N["schema"]>, options?: Readonly<{
|
|
1390
1542
|
validFrom?: string;
|
|
@@ -1396,6 +1548,9 @@ type NodeCollection<N extends NodeType, CN extends string = string> = Readonly<{
|
|
|
1396
1548
|
* Use this for dynamic dispatch (changesets, migrations, imports) where
|
|
1397
1549
|
* the data shape is determined at runtime, not compile time.
|
|
1398
1550
|
* The return type is fully typed — only the input gate is relaxed.
|
|
1551
|
+
*
|
|
1552
|
+
* `validFrom` only applies on the create branch, defaulting to the
|
|
1553
|
+
* operation's creation timestamp when omitted; it has no effect on update.
|
|
1399
1554
|
*/
|
|
1400
1555
|
upsertByIdFromRecord: (id: string, data: Record<string, unknown>, options?: Readonly<{
|
|
1401
1556
|
validFrom?: string;
|
|
@@ -1406,6 +1561,8 @@ type NodeCollection<N extends NodeType, CN extends string = string> = Readonly<{
|
|
|
1406
1561
|
*
|
|
1407
1562
|
* More efficient than calling create() multiple times.
|
|
1408
1563
|
* Use `bulkInsert` for the dedicated fast path that skips returning results.
|
|
1564
|
+
*
|
|
1565
|
+
* `validFrom` defaults to the operation's creation timestamp when omitted.
|
|
1409
1566
|
*/
|
|
1410
1567
|
bulkCreate: (items: readonly Readonly<{
|
|
1411
1568
|
props: z.input<N["schema"]>;
|
|
@@ -1418,6 +1575,9 @@ type NodeCollection<N extends NodeType, CN extends string = string> = Readonly<{
|
|
|
1418
1575
|
*
|
|
1419
1576
|
* For each item, if a node with the given ID exists, updates it.
|
|
1420
1577
|
* Otherwise, creates a new node with that ID.
|
|
1578
|
+
*
|
|
1579
|
+
* `validFrom` only applies on the create branch, defaulting to the
|
|
1580
|
+
* operation's creation timestamp when omitted; it has no effect on update.
|
|
1421
1581
|
*/
|
|
1422
1582
|
bulkUpsertById: (items: readonly Readonly<{
|
|
1423
1583
|
id: string;
|
|
@@ -1431,6 +1591,8 @@ type NodeCollection<N extends NodeType, CN extends string = string> = Readonly<{
|
|
|
1431
1591
|
* This is the dedicated fast path for bulk inserts. Unlike `bulkCreate`
|
|
1432
1592
|
* with `returnResults: false`, the intent is unambiguous: no results
|
|
1433
1593
|
* are returned and the operation is wrapped in a transaction.
|
|
1594
|
+
*
|
|
1595
|
+
* `validFrom` defaults to the operation's creation timestamp when omitted.
|
|
1434
1596
|
*/
|
|
1435
1597
|
bulkInsert: (items: readonly Readonly<{
|
|
1436
1598
|
props: z.input<N["schema"]>;
|
|
@@ -1565,6 +1727,8 @@ type EdgeCollection<E extends AnyEdgeType, From extends NodeType = NodeType, To
|
|
|
1565
1727
|
/**
|
|
1566
1728
|
* Create a new edge.
|
|
1567
1729
|
*
|
|
1730
|
+
* `validFrom` defaults to the operation's creation timestamp when omitted.
|
|
1731
|
+
*
|
|
1568
1732
|
* @param from - Source node (must be one of the allowed 'from' types)
|
|
1569
1733
|
* @param to - Target node (must be one of the allowed 'to' types)
|
|
1570
1734
|
* @param args - Edge properties (optional if schema is empty) and creation options
|
|
@@ -1644,6 +1808,8 @@ type EdgeCollection<E extends AnyEdgeType, From extends NodeType = NodeType, To
|
|
|
1644
1808
|
*
|
|
1645
1809
|
* More efficient than calling create() multiple times.
|
|
1646
1810
|
* Use `bulkInsert` for the dedicated fast path that skips returning results.
|
|
1811
|
+
*
|
|
1812
|
+
* `validFrom` defaults to the operation's creation timestamp when omitted.
|
|
1647
1813
|
*/
|
|
1648
1814
|
bulkCreate: (items: readonly Readonly<{
|
|
1649
1815
|
from: NodeRef<From>;
|
|
@@ -1658,6 +1824,9 @@ type EdgeCollection<E extends AnyEdgeType, From extends NodeType = NodeType, To
|
|
|
1658
1824
|
*
|
|
1659
1825
|
* For each item, if an edge with the given ID exists, updates it.
|
|
1660
1826
|
* Otherwise, creates a new edge with that ID.
|
|
1827
|
+
*
|
|
1828
|
+
* `validFrom` only applies on the create branch, defaulting to the
|
|
1829
|
+
* operation's creation timestamp when omitted; it has no effect on update.
|
|
1661
1830
|
*/
|
|
1662
1831
|
bulkUpsertById: (items: readonly Readonly<{
|
|
1663
1832
|
id: EdgeId<E>;
|
|
@@ -1673,6 +1842,8 @@ type EdgeCollection<E extends AnyEdgeType, From extends NodeType = NodeType, To
|
|
|
1673
1842
|
* This is the dedicated fast path for bulk inserts. Unlike `bulkCreate`
|
|
1674
1843
|
* with `returnResults: false`, the intent is unambiguous: no results
|
|
1675
1844
|
* are returned and the operation is wrapped in a transaction.
|
|
1845
|
+
*
|
|
1846
|
+
* `validFrom` defaults to the operation's creation timestamp when omitted.
|
|
1676
1847
|
*/
|
|
1677
1848
|
bulkInsert: (items: readonly Readonly<{
|
|
1678
1849
|
from: NodeRef<From>;
|
|
@@ -1902,9 +2073,10 @@ type RecordedStoreViewEdgeCollections<G extends GraphDef> = {
|
|
|
1902
2073
|
* Its type is the `AdoptedTransaction` union; cast to your concrete
|
|
1903
2074
|
* Drizzle database type at the call site.
|
|
1904
2075
|
*
|
|
1905
|
-
* When the store was created with `{ history: true }
|
|
1906
|
-
*
|
|
1907
|
-
*
|
|
2076
|
+
* When the store was created with `{ history: true }` or
|
|
2077
|
+
* `{ revisionTracking: true }`, `tx.sql` is present but replaced by a fail-loud
|
|
2078
|
+
* guard because raw SQL would bypass recorded-time capture or the revision
|
|
2079
|
+
* anchor. Use the typed `tx.nodes` / `tx.edges` collections inside
|
|
1908
2080
|
* `transaction()`, or use `store.withRecordedTransaction(externalTx, fn)` when
|
|
1909
2081
|
* the relational layer owns the transaction boundary.
|
|
1910
2082
|
*
|
|
@@ -2048,6 +2220,33 @@ declare class ExecutableAggregateQuery<G extends GraphDef, Aliases extends Alias
|
|
|
2048
2220
|
* Builds the query AST.
|
|
2049
2221
|
*/
|
|
2050
2222
|
toAst(): QueryAst;
|
|
2223
|
+
/**
|
|
2224
|
+
* Orders results by a grouped field or aggregate alias.
|
|
2225
|
+
*
|
|
2226
|
+
* `key` is one of the output names passed to `.aggregate({...})` — either
|
|
2227
|
+
* a grouped field (e.g. `genre`) or an aggregate alias (e.g. `bookCount`).
|
|
2228
|
+
* Both are ordered the same way: by referencing the SELECT-list output
|
|
2229
|
+
* column, since every `.aggregate()` field is projected with an alias.
|
|
2230
|
+
*
|
|
2231
|
+
* Chain multiple calls to sort by more than one key, in call order:
|
|
2232
|
+
* `.orderBy("genre").orderBy("bookCount", "desc")` sorts by genre first,
|
|
2233
|
+
* then by book count within each genre.
|
|
2234
|
+
*
|
|
2235
|
+
* @example
|
|
2236
|
+
* ```typescript
|
|
2237
|
+
* // Top 2 authors by book count
|
|
2238
|
+
* store.query()
|
|
2239
|
+
* .from("Author", "a")
|
|
2240
|
+
* .traverse("wrote", "e")
|
|
2241
|
+
* .to("Book", "b")
|
|
2242
|
+
* .groupByNode("a")
|
|
2243
|
+
* .aggregate({ author: field("a", "name"), bookCount: count("b") })
|
|
2244
|
+
* .orderBy("bookCount", "desc")
|
|
2245
|
+
* .limit(2)
|
|
2246
|
+
* .execute();
|
|
2247
|
+
* ```
|
|
2248
|
+
*/
|
|
2249
|
+
orderBy<K extends keyof R & string>(key: K, direction?: SortDirection): ExecutableAggregateQuery<G, Aliases, R>;
|
|
2051
2250
|
/**
|
|
2052
2251
|
* Limits the number of results.
|
|
2053
2252
|
*/
|
|
@@ -2078,6 +2277,30 @@ declare class ExecutableAggregateQuery<G extends GraphDef, Aliases extends Alias
|
|
|
2078
2277
|
execute(): Promise<readonly AggregateResult<R>[]>;
|
|
2079
2278
|
}
|
|
2080
2279
|
|
|
2280
|
+
/**
|
|
2281
|
+
* Temporal Filter Compilation
|
|
2282
|
+
*
|
|
2283
|
+
* Generates SQL clauses for temporal filtering based on valid_from/valid_to
|
|
2284
|
+
* and deleted_at timestamps. Consolidates the previously duplicated temporal
|
|
2285
|
+
* filter functions into a single, parameterized implementation.
|
|
2286
|
+
*/
|
|
2287
|
+
|
|
2288
|
+
/**
|
|
2289
|
+
* How a "current" valid-time read instant is emitted into compiled SQL:
|
|
2290
|
+
*
|
|
2291
|
+
* - `"literal"` — bound as a concrete value at compile time
|
|
2292
|
+
* ({@link currentReadInstant}). The instant is frozen into the compiled
|
|
2293
|
+
* statement, so the statement must be recompiled to observe a newer "now".
|
|
2294
|
+
* - `"placeholder"` — bound as a reserved execution-time placeholder
|
|
2295
|
+
* ({@link currentReadInstantPlaceholder}). The statement can be compiled
|
|
2296
|
+
* once and reused across executions, filling a fresh instant each call.
|
|
2297
|
+
*
|
|
2298
|
+
* Defaults to `"literal"` everywhere except the query builder's compiled
|
|
2299
|
+
* template cache, which opts into `"placeholder"` so a reused/prepared query
|
|
2300
|
+
* never freezes "now" the way a cached literal would (the #246 regression).
|
|
2301
|
+
*/
|
|
2302
|
+
type ReadInstantMode = "literal" | "placeholder";
|
|
2303
|
+
|
|
2081
2304
|
/**
|
|
2082
2305
|
* Query Compiler Module
|
|
2083
2306
|
*
|
|
@@ -2120,6 +2343,8 @@ type CompileQueryOptions = Readonly<{
|
|
|
2120
2343
|
* declare the field. Callers build it from the graph's node schemas.
|
|
2121
2344
|
*/
|
|
2122
2345
|
vectorSlots?: VectorSlotMap | undefined;
|
|
2346
|
+
/** Per-kind declared fulltext language (see buildFulltextLanguages). */
|
|
2347
|
+
fulltextLanguages?: ReadonlyMap<string, string> | undefined;
|
|
2123
2348
|
/**
|
|
2124
2349
|
* Recorded read relation to use when the AST carries `recordedAsOf`.
|
|
2125
2350
|
* Supplying a recorded timestamp without this binding is rejected so the
|
|
@@ -2127,15 +2352,40 @@ type CompileQueryOptions = Readonly<{
|
|
|
2127
2352
|
* the store was only configured for live/valid-time reads.
|
|
2128
2353
|
*/
|
|
2129
2354
|
recordedReadBinding?: RecordedReadBinding | undefined;
|
|
2355
|
+
/**
|
|
2356
|
+
* How the "current" valid-time read instant is emitted. Defaults to
|
|
2357
|
+
* `"literal"` (a value frozen at compile time). The query builder's
|
|
2358
|
+
* compiled template cache passes `"placeholder"` so the instant is a
|
|
2359
|
+
* reserved execution-time slot, letting one compiled statement be reused
|
|
2360
|
+
* across executions with a fresh "now" each call. See {@link ReadInstantMode}.
|
|
2361
|
+
*/
|
|
2362
|
+
readInstant?: ReadInstantMode | undefined;
|
|
2130
2363
|
}>;
|
|
2131
2364
|
|
|
2365
|
+
/**
|
|
2366
|
+
* PreparedQuery — a pre-validated, parameterized query.
|
|
2367
|
+
*
|
|
2368
|
+
* Created via `ExecutableQuery.prepare()`. Builds and structurally validates
|
|
2369
|
+
* the query AST once at prepare time (so a malformed query fails fast, before
|
|
2370
|
+
* the first `execute()`).
|
|
2371
|
+
*
|
|
2372
|
+
* Fast path: when the backend can compile and run raw SQL (`compileSql` +
|
|
2373
|
+
* `executeRaw`), the statement is compiled ONCE into a cached template whose
|
|
2374
|
+
* "current" read instant and user `param()` refs are reserved placeholders
|
|
2375
|
+
* (see {@link buildReadInstantTemplate}). Every `execute()` fills those
|
|
2376
|
+
* placeholders — a fresh instant plus the call's bindings — and runs the
|
|
2377
|
+
* cached SQL text directly, so a reused prepared query never recompiles and
|
|
2378
|
+
* never freezes "now" the way a cached literal instant would (the #246
|
|
2379
|
+
* regression).
|
|
2380
|
+
*
|
|
2381
|
+
* Fallback: on a backend without raw execution (custom/async), substitutes
|
|
2382
|
+
* parameter refs into the AST, compiles fresh per call, and executes via the
|
|
2383
|
+
* standard `backend.execute` path.
|
|
2384
|
+
*/
|
|
2385
|
+
|
|
2132
2386
|
type PreparedQueryConfig<R> = Readonly<{
|
|
2133
2387
|
ast: QueryAst;
|
|
2134
2388
|
unoptimizedAst: QueryAst;
|
|
2135
|
-
sqlText: string | undefined;
|
|
2136
|
-
sqlParams: readonly unknown[] | undefined;
|
|
2137
|
-
unoptimizedSqlText: string | undefined;
|
|
2138
|
-
unoptimizedSqlParams: readonly unknown[] | undefined;
|
|
2139
2389
|
backend: GraphBackend;
|
|
2140
2390
|
dialect: SqlDialect;
|
|
2141
2391
|
graphId: string;
|
|
@@ -2146,7 +2396,9 @@ type PreparedQueryConfig<R> = Readonly<{
|
|
|
2146
2396
|
schemaIntrospector: SchemaIntrospector;
|
|
2147
2397
|
}>;
|
|
2148
2398
|
/**
|
|
2149
|
-
* A pre-
|
|
2399
|
+
* A pre-validated, parameterized query — see the module doc comment above for
|
|
2400
|
+
* how a reused prepared query runs a cached SQL template with a fresh read
|
|
2401
|
+
* instant filled per call.
|
|
2150
2402
|
*
|
|
2151
2403
|
* @example
|
|
2152
2404
|
* ```typescript
|
|
@@ -2195,10 +2447,6 @@ type UnionableQueryState = Readonly<{
|
|
|
2195
2447
|
traversals?: readonly Traversal[];
|
|
2196
2448
|
selectFn?: (context: SelectContext<AliasMap, EdgeAliasMap>) => unknown;
|
|
2197
2449
|
}>;
|
|
2198
|
-
/**
|
|
2199
|
-
* A query formed by combining multiple queries with set operations.
|
|
2200
|
-
* Supports chaining: q1.union(q2).intersect(q3)
|
|
2201
|
-
*/
|
|
2202
2450
|
declare class UnionableQuery<G extends GraphDef, R> {
|
|
2203
2451
|
#private;
|
|
2204
2452
|
constructor(config: QueryBuilderConfig, state: UnionableQueryState);
|
|
@@ -2267,7 +2515,7 @@ declare class ExecutableQuery<G extends GraphDef, Aliases extends AliasMap, Edge
|
|
|
2267
2515
|
#private;
|
|
2268
2516
|
constructor(config: QueryBuilderConfig, state: QueryBuilderState, selectFunction: (context: SelectContext<Aliases, EdgeAliases, RecursiveAliases>) => R);
|
|
2269
2517
|
/**
|
|
2270
|
-
* Builds the query AST.
|
|
2518
|
+
* Builds the query AST (memoized — the instance is immutable).
|
|
2271
2519
|
*/
|
|
2272
2520
|
toAst(): QueryAst;
|
|
2273
2521
|
/**
|
|
@@ -2337,8 +2585,12 @@ declare class ExecutableQuery<G extends GraphDef, Aliases extends AliasMap, Edge
|
|
|
2337
2585
|
*/
|
|
2338
2586
|
compile(): CompiledSelectSql;
|
|
2339
2587
|
/**
|
|
2340
|
-
* Creates a prepared (pre-
|
|
2341
|
-
*
|
|
2588
|
+
* Creates a prepared (pre-validated) query that can be executed multiple
|
|
2589
|
+
* times with different parameter bindings. Builds and structurally
|
|
2590
|
+
* validates the AST once (a malformed query fails fast, here, instead of on
|
|
2591
|
+
* first use); the prepared query then compiles once into a reusable template
|
|
2592
|
+
* and fills a fresh read instant per execute() — see PreparedQuery's class
|
|
2593
|
+
* doc comment.
|
|
2342
2594
|
*
|
|
2343
2595
|
* Use `param("name")` in predicates to create parameterized slots,
|
|
2344
2596
|
* then pass values via `prepared.execute({ name: "value" })`.
|
|
@@ -2950,16 +3202,6 @@ type RebuildFulltextResult = Readonly<{
|
|
|
2950
3202
|
skippedTruncated: boolean;
|
|
2951
3203
|
}>;
|
|
2952
3204
|
|
|
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
3205
|
/**
|
|
2964
3206
|
* A fulltext search hit. `N` defaults to the generic `Node`; the
|
|
2965
3207
|
* `store.search.fulltext<K>(kind)` facade narrows it to the concrete
|
|
@@ -2994,7 +3236,36 @@ type HybridSearchHit<N = Node> = Readonly<{
|
|
|
2994
3236
|
/** Sub-result from the fulltext half, if it ranked this node. */
|
|
2995
3237
|
fulltext?: FulltextSearchHit<N>;
|
|
2996
3238
|
}>;
|
|
2997
|
-
|
|
3239
|
+
/**
|
|
3240
|
+
* Scope options shared by every facade search leg.
|
|
3241
|
+
*
|
|
3242
|
+
* `where` and `includeSubClasses` compile into the search statement's
|
|
3243
|
+
* candidate set (a subquery produced by the store's own query compiler), so
|
|
3244
|
+
* filtering happens INSIDE the engine's top-k — never by post-filtering a
|
|
3245
|
+
* ranked list. `offset` is rank-relative pagination: the engine fetches
|
|
3246
|
+
* `limit + offset` ranked candidates and discards the leading page.
|
|
3247
|
+
*/
|
|
3248
|
+
type SearchScopeOptions<N extends NodeType = NodeType> = Readonly<{
|
|
3249
|
+
/**
|
|
3250
|
+
* Predicate over the node's properties, compiled by the shared query
|
|
3251
|
+
* compiler into the candidate subquery. Requires a query-capable store.
|
|
3252
|
+
* The facade instantiates `N` to the searched kind's node type, so the
|
|
3253
|
+
* accessor is fully typed at the call site; the base instantiation
|
|
3254
|
+
* exposes the system accessors (`id`, `kind`) for standalone option
|
|
3255
|
+
* values.
|
|
3256
|
+
*/
|
|
3257
|
+
where?: (accessor: NodeAccessor<N>) => Predicate;
|
|
3258
|
+
/** Rows to skip after ranking (rank-relative pagination). */
|
|
3259
|
+
offset?: number;
|
|
3260
|
+
/**
|
|
3261
|
+
* Expand the searched kind to include its `subClassOf` descendants.
|
|
3262
|
+
* Vector legs search each declaring kind's storage and merge by score;
|
|
3263
|
+
* kinds that don't declare the embedding field are skipped (mirroring
|
|
3264
|
+
* the query builder). Requires a query-capable store.
|
|
3265
|
+
*/
|
|
3266
|
+
includeSubClasses?: boolean;
|
|
3267
|
+
}>;
|
|
3268
|
+
type FulltextSearchOptions<N extends NodeType = NodeType> = SearchScopeOptions<N> & Readonly<{
|
|
2998
3269
|
/** The user-supplied query string. */
|
|
2999
3270
|
query: string;
|
|
3000
3271
|
/** Max results. Required. */
|
|
@@ -3002,8 +3273,10 @@ type FulltextSearchOptions = Readonly<{
|
|
|
3002
3273
|
/** Query parser mode. Default: "websearch". */
|
|
3003
3274
|
mode?: FulltextQueryMode;
|
|
3004
3275
|
/**
|
|
3005
|
-
* Language override for query parsing. Default:
|
|
3006
|
-
*
|
|
3276
|
+
* Language override for query parsing. Default: the kind's
|
|
3277
|
+
* declared language (the same config rows were indexed with),
|
|
3278
|
+
* which keeps the parsed tsquery a plan-time constant on
|
|
3279
|
+
* PostgreSQL so the GIN index can serve the match.
|
|
3007
3280
|
*/
|
|
3008
3281
|
language?: string;
|
|
3009
3282
|
/** Minimum relevance score to include in results. */
|
|
@@ -3036,7 +3309,7 @@ type HybridVectorOptions = Readonly<{
|
|
|
3036
3309
|
* vector half of `HybridSearchOptions` but flattens it because the
|
|
3037
3310
|
* standalone path doesn't fuse against fulltext.
|
|
3038
3311
|
*/
|
|
3039
|
-
type VectorSearchOptions = Readonly<{
|
|
3312
|
+
type VectorSearchOptions<N extends NodeType = NodeType> = SearchScopeOptions<N> & Readonly<{
|
|
3040
3313
|
/** Field path of the embedding column on the node kind. */
|
|
3041
3314
|
fieldPath: string;
|
|
3042
3315
|
/** Query embedding to compare against. */
|
|
@@ -3073,7 +3346,7 @@ type HybridFulltextOptions = Readonly<{
|
|
|
3073
3346
|
minScore?: number;
|
|
3074
3347
|
includeSnippets?: boolean;
|
|
3075
3348
|
}>;
|
|
3076
|
-
type HybridSearchOptions = Readonly<{
|
|
3349
|
+
type HybridSearchOptions<N extends NodeType = NodeType> = SearchScopeOptions<N> & Readonly<{
|
|
3077
3350
|
vector: HybridVectorOptions;
|
|
3078
3351
|
fulltext: HybridFulltextOptions;
|
|
3079
3352
|
fusion?: HybridFusionOptions;
|
|
@@ -3105,10 +3378,17 @@ type HybridSearchOptions = Readonly<{
|
|
|
3105
3378
|
* when) the literal is statically known.
|
|
3106
3379
|
*/
|
|
3107
3380
|
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;
|
|
3381
|
+
/**
|
|
3382
|
+
* The registered `NodeType` behind a kind literal — the accessor-level
|
|
3383
|
+
* companion of {@link ResolveNode}, used to type `where` predicates.
|
|
3384
|
+
* Falls back to the base `NodeType` for dynamic (string) kinds.
|
|
3385
|
+
*/
|
|
3386
|
+
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
3387
|
type StoreSearchContext = Readonly<{
|
|
3109
3388
|
graphId: string;
|
|
3110
3389
|
backend: GraphBackend;
|
|
3111
3390
|
registry: KindRegistry;
|
|
3391
|
+
createQuery?: () => QueryBuilder<GraphDef>;
|
|
3112
3392
|
}>;
|
|
3113
3393
|
/**
|
|
3114
3394
|
* Search-related operations exposed via `store.search`.
|
|
@@ -3157,7 +3437,7 @@ declare class StoreSearch<G extends GraphDef> {
|
|
|
3157
3437
|
* configured with) and resolves the matching node IDs back to typed
|
|
3158
3438
|
* `Node` objects.
|
|
3159
3439
|
*/
|
|
3160
|
-
fulltext<K extends string>(nodeKind: K, options: FulltextSearchOptions): Promise<readonly FulltextSearchHit<ResolveNode<G, K>>[]>;
|
|
3440
|
+
fulltext<K extends string>(nodeKind: K, options: FulltextSearchOptions<ResolveNodeType<G, K>>): Promise<readonly FulltextSearchHit<ResolveNode<G, K>>[]>;
|
|
3161
3441
|
/**
|
|
3162
3442
|
* Runs a vector similarity search against nodes of the given kind.
|
|
3163
3443
|
*
|
|
@@ -3169,7 +3449,7 @@ declare class StoreSearch<G extends GraphDef> {
|
|
|
3169
3449
|
* Pure vector — no fulltext leg, no fusion. For combined
|
|
3170
3450
|
* vector+fulltext ranking, use `hybrid`.
|
|
3171
3451
|
*/
|
|
3172
|
-
vector<K extends string>(nodeKind: K, options: VectorSearchOptions): Promise<readonly VectorSearchHit<ResolveNode<G, K>>[]>;
|
|
3452
|
+
vector<K extends string>(nodeKind: K, options: VectorSearchOptions<ResolveNodeType<G, K>>): Promise<readonly VectorSearchHit<ResolveNode<G, K>>[]>;
|
|
3173
3453
|
/**
|
|
3174
3454
|
* Runs a vector + fulltext hybrid search and fuses the results with
|
|
3175
3455
|
* Reciprocal Rank Fusion.
|
|
@@ -3179,7 +3459,7 @@ declare class StoreSearch<G extends GraphDef> {
|
|
|
3179
3459
|
* over-fetch is 4× `limit` from each source — tune via `vector.k` /
|
|
3180
3460
|
* `fulltext.k` for higher-recall corpora.
|
|
3181
3461
|
*/
|
|
3182
|
-
hybrid<K extends string>(nodeKind: K, options: HybridSearchOptions): Promise<readonly HybridSearchHit<ResolveNode<G, K>>[]>;
|
|
3462
|
+
hybrid<K extends string>(nodeKind: K, options: HybridSearchOptions<ResolveNodeType<G, K>>): Promise<readonly HybridSearchHit<ResolveNode<G, K>>[]>;
|
|
3183
3463
|
/**
|
|
3184
3464
|
* Rebuilds the fulltext index from existing node data.
|
|
3185
3465
|
*
|
|
@@ -3566,6 +3846,18 @@ declare class Store<G extends GraphDef> {
|
|
|
3566
3846
|
* @internal
|
|
3567
3847
|
*/
|
|
3568
3848
|
get historyEnabled(): boolean;
|
|
3849
|
+
/**
|
|
3850
|
+
* Whether this Store advances a durable revision anchor for graph writes.
|
|
3851
|
+
*
|
|
3852
|
+
* @internal
|
|
3853
|
+
*/
|
|
3854
|
+
get revisionTrackingEnabled(): boolean;
|
|
3855
|
+
/**
|
|
3856
|
+
* SQL schema that owns the durable revision clock relation.
|
|
3857
|
+
*
|
|
3858
|
+
* @internal
|
|
3859
|
+
*/
|
|
3860
|
+
get revisionSchema(): SqlSchema;
|
|
3569
3861
|
/**
|
|
3570
3862
|
* Whether this store has a recorded read relation bound for reconstruction.
|
|
3571
3863
|
*
|
|
@@ -3813,6 +4105,24 @@ declare class Store<G extends GraphDef> {
|
|
|
3813
4105
|
* success), not the global clock.
|
|
3814
4106
|
*/
|
|
3815
4107
|
recordedNow(): Promise<RecordedInstant | undefined>;
|
|
4108
|
+
/**
|
|
4109
|
+
* Returns the durable graph revision used by graph branching. It is undefined
|
|
4110
|
+
* until the first successful tracked write, which is itself a stable initial
|
|
4111
|
+
* anchor. Unlike {@link recordedNow}, this is also available on a live Store
|
|
4112
|
+
* created with `{ revisionTracking: true }`.
|
|
4113
|
+
*
|
|
4114
|
+
* @internal
|
|
4115
|
+
*/
|
|
4116
|
+
revisionNow(): Promise<string | undefined>;
|
|
4117
|
+
/**
|
|
4118
|
+
* Returns the durable random namespace for this graph's revision clock. A
|
|
4119
|
+
* tracked base token combines it with {@link revisionNow}, preventing a
|
|
4120
|
+
* branch from one independent store from matching a coincident timestamp in
|
|
4121
|
+
* another store.
|
|
4122
|
+
*
|
|
4123
|
+
* @internal
|
|
4124
|
+
*/
|
|
4125
|
+
revisionOriginNow(): Promise<string>;
|
|
3816
4126
|
/**
|
|
3817
4127
|
* Returns a read-only {@link StoreView} pinned to an arbitrary public
|
|
3818
4128
|
* temporal mode. Use {@link Store.asOf} for the common valid-time case;
|
|
@@ -3969,9 +4279,10 @@ declare class Store<G extends GraphDef> {
|
|
|
3969
4279
|
* {@link Store.withTransaction}). See {@link TransactionContext}
|
|
3970
4280
|
* for per-backend semantics; it is `undefined` only on the
|
|
3971
4281
|
* non-transactional fallback.
|
|
3972
|
-
* When the store was created with `{ history: true }
|
|
3973
|
-
* replaced by a fail-loud guard
|
|
3974
|
-
* recorded-time capture
|
|
4282
|
+
* When the store was created with `{ history: true }` or
|
|
4283
|
+
* `{ revisionTracking: true }`, `tx.sql` is replaced by a fail-loud guard
|
|
4284
|
+
* because raw SQL would bypass recorded-time capture or revision tracking;
|
|
4285
|
+
* use the typed collections inside
|
|
3975
4286
|
* `transaction()` or {@link Store.withRecordedTransaction}.
|
|
3976
4287
|
*
|
|
3977
4288
|
* @example
|
|
@@ -3997,6 +4308,16 @@ declare class Store<G extends GraphDef> {
|
|
|
3997
4308
|
* });
|
|
3998
4309
|
* ```
|
|
3999
4310
|
*
|
|
4311
|
+
* **`tx.sql` shares the one pinned connection — await it, don't overlap it.**
|
|
4312
|
+
* TypeGraph serializes the statements *its own* collections issue, so a
|
|
4313
|
+
* `Promise.all` of graph writes is safe. A statement you issue through
|
|
4314
|
+
* `tx.sql` bypasses that queue: run it concurrently with a graph write (or
|
|
4315
|
+
* with another `tx.sql` statement) and two queries race on the one
|
|
4316
|
+
* transaction connection — the exact overlap Postgres removes in `pg@9`.
|
|
4317
|
+
* Await each `tx.sql` statement before starting the next write. TypeGraph
|
|
4318
|
+
* cannot police this: it never sees the raw handle's traffic, so it also
|
|
4319
|
+
* cannot drain a raw statement still in flight when the transaction commits.
|
|
4320
|
+
*
|
|
4000
4321
|
* **Backends without transactions.** When `backend.capabilities.transactions`
|
|
4001
4322
|
* is `false` (Cloudflare D1, `drizzle-orm/neon-http`), this method runs the
|
|
4002
4323
|
* callback against the same backend used outside `transaction()` — writes
|
|
@@ -4022,6 +4343,42 @@ declare class Store<G extends GraphDef> {
|
|
|
4022
4343
|
*/
|
|
4023
4344
|
transaction<T>(this: HistoryStore<G>, fn: (tx: HistoryTransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
4024
4345
|
transaction<T>(fn: (tx: TransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
4346
|
+
/**
|
|
4347
|
+
* Runs a transaction exactly like {@link transaction} and additionally
|
|
4348
|
+
* returns a {@link TransactionOutcome} whose receipt summarizes the
|
|
4349
|
+
* completed write intents on the transaction-scoped collection surface.
|
|
4350
|
+
*
|
|
4351
|
+
* A dedicated method (rather than an option on `transaction()`) keeps the
|
|
4352
|
+
* return type tied to static dispatch: forwarding options through wrappers
|
|
4353
|
+
* can never change what a call returns. See {@link TransactionReceipt} for
|
|
4354
|
+
* exact count semantics.
|
|
4355
|
+
*
|
|
4356
|
+
* The receipt does not count writes that bypass the `tx.nodes.*` /
|
|
4357
|
+
* `tx.edges.*` collections, such as direct backend writes, raw SQL, or
|
|
4358
|
+
* import helpers. Adopted transactions (`withTransaction` /
|
|
4359
|
+
* `withRecordedTransaction`) do not produce receipts in this version
|
|
4360
|
+
* because their commit belongs to the caller. On non-transactional
|
|
4361
|
+
* backends, the receipt is still returned, but it describes operations
|
|
4362
|
+
* that individually committed rather than one atomic commit; if the
|
|
4363
|
+
* callback rejects on such a backend, no receipt is returned even though
|
|
4364
|
+
* earlier operations committed individually.
|
|
4365
|
+
*
|
|
4366
|
+
* For stores created with `{ history: true }`, `receipt.recorded` is the
|
|
4367
|
+
* recorded commit instant this transaction allocated for the store's
|
|
4368
|
+
* graph, or `undefined` when nothing was captured.
|
|
4369
|
+
*
|
|
4370
|
+
* @example
|
|
4371
|
+
* ```typescript
|
|
4372
|
+
* const outcome = await store.transactionWithReceipt(async (tx) => {
|
|
4373
|
+
* const alice = await tx.nodes.Person.create({ name: "Alice" });
|
|
4374
|
+
* return alice.id;
|
|
4375
|
+
* });
|
|
4376
|
+
* outcome.result; // Alice's id
|
|
4377
|
+
* outcome.receipt.writes; // { nodes: { Person: 1 }, edges: {}, total: 1 }
|
|
4378
|
+
* ```
|
|
4379
|
+
*/
|
|
4380
|
+
transactionWithReceipt<T>(this: HistoryStore<G>, fn: (tx: HistoryTransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<TransactionOutcome<T>>;
|
|
4381
|
+
transactionWithReceipt<T>(fn: (tx: TransactionContext<G>) => Promise<T>, options?: TransactionOptions): Promise<TransactionOutcome<T>>;
|
|
4025
4382
|
/**
|
|
4026
4383
|
* Adopts a caller-owned, already-open Drizzle transaction so the graph
|
|
4027
4384
|
* store and the caller's relational writes commit or roll back as one
|
|
@@ -4064,6 +4421,14 @@ declare class Store<G extends GraphDef> {
|
|
|
4064
4421
|
* }); // one COMMIT / ROLLBACK across both layers
|
|
4065
4422
|
* ```
|
|
4066
4423
|
*
|
|
4424
|
+
* **The caller owns the connection — don't overlap writes on it.** The graph
|
|
4425
|
+
* store and your Drizzle writes share the one connection the caller's
|
|
4426
|
+
* transaction pinned. TypeGraph serializes the statements *its* collections
|
|
4427
|
+
* issue, but your raw Drizzle statements (and any graph write run alongside
|
|
4428
|
+
* them) are yours to sequence: a `Promise.all` mixing the two races two
|
|
4429
|
+
* queries on that connection — the overlap Postgres removes in `pg@9`. Await
|
|
4430
|
+
* each write before starting the next.
|
|
4431
|
+
*
|
|
4067
4432
|
* Not available when the store was created with `{ history: true }`: a
|
|
4068
4433
|
* caller-owned transaction context would let writes happen after capture has
|
|
4069
4434
|
* lost its flush point, so this throws `ConfigurationError`
|
|
@@ -4098,6 +4463,12 @@ declare class Store<G extends GraphDef> {
|
|
|
4098
4463
|
* returns (e.g. retaining `tx` and writing once more before the caller's
|
|
4099
4464
|
* COMMIT) throws rather than committing uncaptured — the post-flush write
|
|
4100
4465
|
* cannot silently diverge history from live state.
|
|
4466
|
+
*
|
|
4467
|
+
* Like {@link Store.withTransaction}, the graph writes and any raw `tx.sql`
|
|
4468
|
+
* statements share the caller's one pinned connection. TypeGraph serializes
|
|
4469
|
+
* the statements its collections issue; sequence your own raw statements (and
|
|
4470
|
+
* don't `Promise.all` them with graph writes) so two queries never race on
|
|
4471
|
+
* that connection.
|
|
4101
4472
|
*/
|
|
4102
4473
|
withRecordedTransaction<T>(this: HistoryStore<G>, externalTx: AdoptedTransaction, fn: (tx: HistoryTransactionContext<G>) => Promise<T>): Promise<T>;
|
|
4103
4474
|
withRecordedTransaction<T>(externalTx: AdoptedTransaction, fn: (tx: TransactionContext<G>) => Promise<T>): Promise<T>;
|
|
@@ -4616,4 +4987,4 @@ declare class RecordedStoreView<G extends GraphDef> extends CoordinatePinnedView
|
|
|
4616
4987
|
get edges(): RecordedStoreViewEdgeCollections<G>;
|
|
4617
4988
|
}
|
|
4618
4989
|
|
|
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
|
|
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 SelectContext as a$, type GraphAlgorithms as a0, type GraphEdgeCollections as a1, type GraphNodeCollections as a2, type HistorySafeBackend as a3, type HistorySafeTransactionBackend as a4, type HistoryStoreOptions as a5, type HistoryTransactionContext as a6, type HookContext as a7, type HybridFulltextOptions as a8, type HybridSearchHit as a9, type PathNode as aA, type Predicate as aB, PreparedQuery as aC, type PropsAccessor as aD, type QueryHookContext as aE, type QueryOptions as aF, type ReachableNode as aG, type ReachableOptions as aH, type RebuildFulltextOptions as aI, type RebuildFulltextResult as aJ, type ReclaimedVectorFieldEntry as aK, type RecordedInstant as aL, type RecordedReadStore as aM, RecordedStoreView as aN, type RecordedStoreViewEdgeCollection as aO, type RecordedStoreViewEdgeCollections as aP, type RecordedStoreViewNodeCollection as aQ, type RecordedStoreViewNodeCollections as aR, type RecursiveTraversalOptions as aS, type ReembedFunction as aT, type ReembedVectorFieldOptions as aU, type ReembedVectorFieldResult as aV, type SchemaIntrospection as aW, type SearchScopeOptions as aX, type SearchableMetadata as aY, type SearchableOptions as aZ, type SearchableSchema as a_, type HybridSearchOptions as aa, type HybridVectorOptions as ab, type IfExistsMode as ac, type InitialQueryBuilder as ad, type KindIntrospection as ae, type LiveStoreOptions as af, type MaterializeRemovalsEntry as ag, type MaterializeRemovalsOptions as ah, type MaterializeRemovalsResult as ai, type NeighborsOptions as aj, type NoRecordedCoordinate as ak, type NodeAccessor as al, type NodeAlias as am, type NodeBulkFindByIndexOptions as an, type NodeCollection as ao, type NodeCurrentReads as ap, type NodeGetOrCreateByConstraintOptions as aq, type NodeGetOrCreateByConstraintResult as ar, type NodeIdentifier as as, type NodeRef as at, type NodeTemporalReads as au, type NodeWrites as av, type OntologyIntrospection as aw, type OperationHookContext as ax, type PaginateOptions as ay, type PaginatedResult as az, type EdgeAliasMap as b, type SelectableEdge as b0, type SelectableNode as b1, type ShortestPathOptions as b2, type ShortestPathResult as b3, type StoreHooks as b4, type StoreOptions as b5, type StoreProjection as b6, type StoreRef as b7, StoreSearch as b8, StoreView as b9, UnionableQuery as bA, type UpdateEdgeInput as bB, type UpdateNodeInput as bC, type VectorSearchHit as bD, type VectorSearchOptions as bE, asRecordedInstant as bF, createQueryBuilder as bG, createStore as bH, createStoreWithSchema as bI, createVerifiedStore as bJ, defineSubgraphProject as bK, embedding as bL, exists as bM, fieldRef as bN, getEmbeddingDimensions as bO, getSearchableMetadata as bP, inSubquery as bQ, isEmbeddingSchema as bR, isParameterRef as bS, isSearchableSchema as bT, notExists as bU, notInSubquery as bV, param as bW, searchable as bX, type StoreViewCanReachOptions as ba, type StoreViewCoordinate as bb, type StoreViewDegreeOptions as bc, type StoreViewEdgeCollection as bd, type StoreViewEdgeCollections as be, type StoreViewNeighborsOptions as bf, type StoreViewNodeCollection as bg, type StoreViewNodeCollections as bh, type StoreViewReachableOptions as bi, type StoreViewShortestPathOptions as bj, type StoreViewSubgraphOptions as bk, type StreamOptions as bl, type SubgraphEdgeResult as bm, type SubgraphNodeResult as bn, type SubgraphOptions as bo, type SubgraphResult as bp, type SubsetEdge as bq, type SubsetNode as br, type TemporalAlgorithmOptions as bs, type TransactionContext as bt, type TransactionOutcome as bu, type TransactionReceipt as bv, type TraversalDirection as bw, type TypedEdgeCollection as bx, type TypedRecordedStoreViewEdgeCollection as by, type TypedStoreViewEdgeCollection as bz, QueryBuilder as c, type EmptyRecursiveAliasMap as d, type AggregateResult as e, type AlgorithmCyclePolicy as f, type AnyEdge as g, type AnyNode as h, type BatchResults as i, type BatchableQuery as j, type CreateEdgeInput as k, type CreateNodeInput as l, type DegreeOptions as m, type DynamicEdgeAccessor as n, type DynamicEdgeCollection as o, type DynamicEdgeType as p, type DynamicFieldBuilder as q, type DynamicNodeAccessor as r, type DynamicNodeCollection as s, type DynamicNodeType as t, type DynamicSelectableEdge as u, type DynamicSelectableNode as v, type Edge as w, type EdgeAccessor as x, type EdgeBatchReads as y, type EdgeCollection as z };
|