@nicia-ai/typegraph 0.35.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/postgres/index.cjs +24 -24
- package/dist/backend/postgres/index.d.cts +6 -6
- package/dist/backend/postgres/index.d.ts +6 -6
- package/dist/backend/postgres/index.js +11 -11
- package/dist/backend/postgres/pglite.cjs +16 -16
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +11 -11
- package/dist/backend/sqlite/index.cjs +22 -21
- package/dist/backend/sqlite/index.d.cts +11 -9
- package/dist/backend/sqlite/index.d.ts +11 -9
- package/dist/backend/sqlite/index.js +10 -9
- package/dist/backend/sqlite/libsql.cjs +15 -14
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +11 -10
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +30 -23
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +18 -11
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-TCOCYN2P.cjs → chunk-27SSDCEP.cjs} +14 -14
- package/dist/{chunk-TCOCYN2P.cjs.map → chunk-27SSDCEP.cjs.map} +1 -1
- package/dist/{chunk-5AQIKK56.cjs → chunk-2N6EOBTH.cjs} +16 -16
- package/dist/{chunk-5AQIKK56.cjs.map → chunk-2N6EOBTH.cjs.map} +1 -1
- package/dist/{chunk-FN35DLCN.cjs → chunk-3C2RYI6L.cjs} +13 -107
- package/dist/chunk-3C2RYI6L.cjs.map +1 -0
- package/dist/{chunk-4JEZZJ6S.cjs → chunk-3DS7Z4T4.cjs} +39 -39
- package/dist/{chunk-4JEZZJ6S.cjs.map → chunk-3DS7Z4T4.cjs.map} +1 -1
- package/dist/{chunk-BLZDPRXT.cjs → chunk-3GH67G4Z.cjs} +5 -5
- package/dist/{chunk-BLZDPRXT.cjs.map → chunk-3GH67G4Z.cjs.map} +1 -1
- package/dist/{chunk-K3PPLHY7.js → chunk-3RWZPJKV.js} +24 -9
- package/dist/chunk-3RWZPJKV.js.map +1 -0
- package/dist/{chunk-QWEUYILR.js → chunk-3SLPDKHQ.js} +4 -4
- package/dist/chunk-3SLPDKHQ.js.map +1 -0
- package/dist/{chunk-5A6FNS6N.cjs → chunk-3XXGYU62.cjs} +11 -11
- package/dist/{chunk-5A6FNS6N.cjs.map → chunk-3XXGYU62.cjs.map} +1 -1
- package/dist/{chunk-JBTOYDMN.js → chunk-44TA22QT.js} +58 -11
- package/dist/chunk-44TA22QT.js.map +1 -0
- package/dist/{chunk-UES55P7G.js → chunk-552KNYQJ.js} +2652 -409
- package/dist/chunk-552KNYQJ.js.map +1 -0
- package/dist/{chunk-VPYHY3LJ.cjs → chunk-5KEQ74YU.cjs} +14 -14
- package/dist/chunk-5KEQ74YU.cjs.map +1 -0
- package/dist/{chunk-Q5TEXCTB.js → chunk-5KPNWT6X.js} +3 -3
- package/dist/{chunk-Q5TEXCTB.js.map → chunk-5KPNWT6X.js.map} +1 -1
- package/dist/{chunk-MP2JQKSG.js → chunk-5PNMDJ7J.js} +108 -5
- package/dist/chunk-5PNMDJ7J.js.map +1 -0
- package/dist/{chunk-AW4A3P5A.cjs → chunk-5VQM6VWP.cjs} +2 -2
- package/dist/{chunk-AW4A3P5A.cjs.map → chunk-5VQM6VWP.cjs.map} +1 -1
- package/dist/{chunk-A3W7QG7K.js → chunk-5WWVZMVX.js} +2 -2
- package/dist/{chunk-A3W7QG7K.js.map → chunk-5WWVZMVX.js.map} +1 -1
- package/dist/{chunk-FACJJWGF.cjs → chunk-6EEO3OVU.cjs} +7 -7
- package/dist/{chunk-FACJJWGF.cjs.map → chunk-6EEO3OVU.cjs.map} +1 -1
- package/dist/{chunk-LGEALRC6.cjs → chunk-BVRDGYXQ.cjs} +113 -4
- package/dist/chunk-BVRDGYXQ.cjs.map +1 -0
- package/dist/{chunk-GSQ6NPH6.cjs → chunk-DEFQM7JU.cjs} +7 -7
- package/dist/{chunk-GSQ6NPH6.cjs.map → chunk-DEFQM7JU.cjs.map} +1 -1
- package/dist/{chunk-EM3CWPND.cjs → chunk-DIQ3AV5W.cjs} +574 -268
- package/dist/chunk-DIQ3AV5W.cjs.map +1 -0
- package/dist/{chunk-FPIZFYHE.js → chunk-EXU3RASM.js} +74 -15
- package/dist/chunk-EXU3RASM.js.map +1 -0
- package/dist/{chunk-H7YNSMA7.cjs → chunk-HAHNRASW.cjs} +20 -2
- package/dist/chunk-HAHNRASW.cjs.map +1 -0
- package/dist/{chunk-FL472AMI.cjs → chunk-IP3CGGPA.cjs} +8 -8
- package/dist/{chunk-FL472AMI.cjs.map → chunk-IP3CGGPA.cjs.map} +1 -1
- package/dist/{chunk-4TOD4LBZ.cjs → chunk-IPSVVTWT.cjs} +94 -35
- package/dist/chunk-IPSVVTWT.cjs.map +1 -0
- package/dist/{chunk-RGP33ZJ5.js → chunk-IXGYRP2P.js} +184 -92
- package/dist/chunk-IXGYRP2P.js.map +1 -0
- package/dist/{chunk-3TWF3SH4.js → chunk-J4IUSYFF.js} +251 -121
- package/dist/chunk-J4IUSYFF.js.map +1 -0
- package/dist/{chunk-O7UN7OXA.cjs → chunk-JBNOGRKW.cjs} +318 -188
- package/dist/chunk-JBNOGRKW.cjs.map +1 -0
- package/dist/{chunk-WDBCBWC4.js → chunk-K3Q3LJY3.js} +520 -221
- package/dist/chunk-K3Q3LJY3.js.map +1 -0
- package/dist/{chunk-OR5ZA5WP.js → chunk-K5UBVGJN.js} +4 -4
- package/dist/{chunk-OR5ZA5WP.js.map → chunk-K5UBVGJN.js.map} +1 -1
- package/dist/{chunk-UZV3AZKF.js → chunk-KQJ54OG5.js} +3 -3
- package/dist/{chunk-UZV3AZKF.js.map → chunk-KQJ54OG5.js.map} +1 -1
- package/dist/{chunk-QOTI55H7.js → chunk-L7HQ2OSI.js} +4 -4
- package/dist/{chunk-QOTI55H7.js.map → chunk-L7HQ2OSI.js.map} +1 -1
- package/dist/{chunk-55MZDDZV.js → chunk-M6VES7V6.js} +4 -4
- package/dist/{chunk-55MZDDZV.js.map → chunk-M6VES7V6.js.map} +1 -1
- package/dist/{chunk-J7WFGBJR.cjs → chunk-NBP2WTJW.cjs} +3249 -1006
- package/dist/chunk-NBP2WTJW.cjs.map +1 -0
- package/dist/{chunk-CK5BVQOW.cjs → chunk-NUIG3BCV.cjs} +100 -85
- package/dist/chunk-NUIG3BCV.cjs.map +1 -0
- package/dist/{chunk-EMF62TZG.cjs → chunk-NXQFATMF.cjs} +269 -177
- package/dist/chunk-NXQFATMF.cjs.map +1 -0
- package/dist/{chunk-KBGQIPRQ.js → chunk-PC2UBAUB.js} +20 -3
- package/dist/chunk-PC2UBAUB.js.map +1 -0
- package/dist/chunk-QARBLBXT.cjs +219 -0
- package/dist/chunk-QARBLBXT.cjs.map +1 -0
- package/dist/{chunk-6FR2MMS6.js → chunk-QERAIDRJ.js} +45 -4
- package/dist/chunk-QERAIDRJ.js.map +1 -0
- package/dist/chunk-QSXTWU4U.cjs +12 -0
- package/dist/{chunk-GUR2FNB5.cjs.map → chunk-QSXTWU4U.cjs.map} +1 -1
- package/dist/{chunk-QNKSQTKQ.js → chunk-RCVLFTCT.js} +49 -19
- package/dist/chunk-RCVLFTCT.js.map +1 -0
- package/dist/{chunk-VSPCZAXF.js → chunk-RRSNR3TP.js} +3 -3
- package/dist/{chunk-VSPCZAXF.js.map → chunk-RRSNR3TP.js.map} +1 -1
- package/dist/{chunk-WJT7OU7E.cjs → chunk-TGOMW4MB.cjs} +129 -98
- package/dist/chunk-TGOMW4MB.cjs.map +1 -0
- package/dist/{chunk-KMI7LYAF.js → chunk-TKT2XHED.js} +8 -8
- package/dist/{chunk-KMI7LYAF.js.map → chunk-TKT2XHED.js.map} +1 -1
- package/dist/{chunk-RGPG7EOJ.js → chunk-TPF25IG6.js} +3 -3
- package/dist/{chunk-RGPG7EOJ.js.map → chunk-TPF25IG6.js.map} +1 -1
- package/dist/{chunk-5SEGFTZX.js → chunk-UGZUAYAR.js} +3 -3
- package/dist/{chunk-5SEGFTZX.js.map → chunk-UGZUAYAR.js.map} +1 -1
- package/dist/{chunk-VHMPG6UL.js → chunk-UXLSNRYL.js} +11 -105
- package/dist/chunk-UXLSNRYL.js.map +1 -0
- package/dist/{chunk-FRV5Q5IO.js → chunk-UYQMBBWJ.js} +3 -3
- package/dist/{chunk-FRV5Q5IO.js.map → chunk-UYQMBBWJ.js.map} +1 -1
- package/dist/{chunk-UUT7UN2N.cjs → chunk-VGDDG3XJ.cjs} +7 -7
- package/dist/{chunk-UUT7UN2N.cjs.map → chunk-VGDDG3XJ.cjs.map} +1 -1
- package/dist/{chunk-CZQ3FO2Q.js → chunk-VKGKDOKR.js} +56 -21
- package/dist/chunk-VKGKDOKR.js.map +1 -0
- package/dist/{chunk-CTTSDJLY.cjs → chunk-VL2V6PEN.cjs} +11 -11
- package/dist/{chunk-CTTSDJLY.cjs.map → chunk-VL2V6PEN.cjs.map} +1 -1
- package/dist/{chunk-XOX22WHL.cjs → chunk-WOJMKB3N.cjs} +125 -90
- package/dist/chunk-WOJMKB3N.cjs.map +1 -0
- package/dist/{chunk-UMDVATGY.cjs → chunk-WWFHO375.cjs} +6 -6
- package/dist/{chunk-UMDVATGY.cjs.map → chunk-WWFHO375.cjs.map} +1 -1
- package/dist/{chunk-I7ZUZKFD.js → chunk-XGPUQ56G.js} +3 -3
- package/dist/{chunk-I7ZUZKFD.js.map → chunk-XGPUQ56G.js.map} +1 -1
- package/dist/{chunk-D7ZEOS56.cjs → chunk-XGU7DZDA.cjs} +74 -14
- package/dist/chunk-XGU7DZDA.cjs.map +1 -0
- package/dist/{chunk-S55OV6PW.cjs → chunk-XPCZADMT.cjs} +54 -11
- package/dist/chunk-XPCZADMT.cjs.map +1 -0
- package/dist/{chunk-T2WUSPDA.js → chunk-XWV4JT34.js} +3 -3
- package/dist/{chunk-T2WUSPDA.js.map → chunk-XWV4JT34.js.map} +1 -1
- package/dist/chunk-YTSN73ND.js +212 -0
- package/dist/chunk-YTSN73ND.js.map +1 -0
- package/dist/{ddl-CZz7a0E8.d.cts → ddl-BD-ZfKeX.d.cts} +3 -3
- package/dist/{ddl-C2rZ-Aen.d.ts → ddl-CS0KUVwB.d.ts} +3 -3
- package/dist/{extension-types-ixRpJVUp.d.cts → extension-types-BM2ACfYO.d.cts} +6 -1
- package/dist/{extension-types-ixRpJVUp.d.ts → extension-types-BM2ACfYO.d.ts} +6 -1
- package/dist/{fulltext-strategy-CDkSSYhq.d.cts → fulltext-strategy-C27vXaeB.d.cts} +127 -8
- package/dist/{fulltext-strategy-B57yvC5Q.d.ts → fulltext-strategy-DebsMrqg.d.ts} +127 -8
- package/dist/graph-extension/index.cjs +19 -19
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-extension/index.js +4 -4
- package/dist/graph-merge/index.cjs +88 -88
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +6 -6
- package/dist/graph-merge/index.d.ts +6 -6
- package/dist/graph-merge/index.js +19 -19
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-Bks_3HHK.d.cts → index-BPM59vsg.d.cts} +119 -7
- package/dist/{index-6CSUAq-x.d.ts → index-BeacbPoe.d.ts} +119 -7
- package/dist/index.cjs +230 -185
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +53 -40
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +30 -21
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +8 -7
- package/dist/interchange/index.cjs +208 -30
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +25 -8
- package/dist/interchange/index.d.ts +25 -8
- package/dist/interchange/index.js +191 -11
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-DwQi8eV0.d.cts → manager-D00_NXvT.d.ts} +11 -2
- package/dist/{manager-ejUCB52T.d.ts → manager-nU1vTJLy.d.cts} +11 -2
- package/dist/{materialize-indexes-B4e9360H.d.cts → materialize-indexes-CuR3gAZb.d.cts} +8 -2
- package/dist/{materialize-indexes-te9TPMMJ.d.ts → materialize-indexes-zK2J_flP.d.ts} +8 -2
- package/dist/{postgres-DQ5R6rzV.d.ts → postgres-IaBA4RgE.d.ts} +1 -1
- package/dist/{postgres-CfEqsRMp.d.cts → postgres-YrYmPlaU.d.cts} +1 -1
- package/dist/profiler/index.cjs +3 -3
- package/dist/profiler/index.d.cts +7 -7
- package/dist/profiler/index.d.ts +7 -7
- package/dist/profiler/index.js +2 -2
- package/dist/provenance/index.cjs +32 -33
- package/dist/provenance/index.cjs.map +1 -1
- package/dist/provenance/index.d.cts +5 -5
- package/dist/provenance/index.d.ts +5 -5
- package/dist/provenance/index.js +5 -6
- package/dist/provenance/index.js.map +1 -1
- package/dist/schema/index.cjs +35 -35
- package/dist/schema/index.d.cts +7 -7
- package/dist/schema/index.d.ts +7 -7
- package/dist/schema/index.js +11 -11
- package/dist/{sqlite-DvQndLky.d.ts → sqlite-BUOHPx7p.d.ts} +1 -1
- package/dist/{sqlite-D7zBinNR.d.cts → sqlite-Pp8O19WE.d.cts} +1 -1
- package/dist/{store-view-CKbHFRnn.d.ts → store-view-ANL6mTph.d.ts} +457 -57
- package/dist/{store-view-BSpqvAxK.d.cts → store-view-X96Rd00T.d.cts} +457 -57
- package/dist/{types-Bv9DcS_E.d.cts → types-r-Zyq2Hz.d.cts} +2 -2
- package/dist/{types-CoxuV7EJ.d.ts → types-wsvuBgPK.d.ts} +2 -2
- package/dist/where-CJOpJj3a.d.ts +36 -0
- package/dist/where-K3uBP33l.d.cts +36 -0
- package/package.json +1 -1
- package/dist/chunk-3TWF3SH4.js.map +0 -1
- package/dist/chunk-4TOD4LBZ.cjs.map +0 -1
- package/dist/chunk-6FR2MMS6.js.map +0 -1
- package/dist/chunk-CK5BVQOW.cjs.map +0 -1
- package/dist/chunk-CZQ3FO2Q.js.map +0 -1
- package/dist/chunk-D7ZEOS56.cjs.map +0 -1
- package/dist/chunk-EM3CWPND.cjs.map +0 -1
- package/dist/chunk-EMF62TZG.cjs.map +0 -1
- package/dist/chunk-EOLERH7Y.cjs +0 -40
- package/dist/chunk-EOLERH7Y.cjs.map +0 -1
- package/dist/chunk-FN35DLCN.cjs.map +0 -1
- package/dist/chunk-FPIZFYHE.js.map +0 -1
- package/dist/chunk-GUR2FNB5.cjs +0 -12
- package/dist/chunk-H7YNSMA7.cjs.map +0 -1
- package/dist/chunk-J7WFGBJR.cjs.map +0 -1
- package/dist/chunk-JBTOYDMN.js.map +0 -1
- package/dist/chunk-K3PPLHY7.js.map +0 -1
- package/dist/chunk-KBGQIPRQ.js.map +0 -1
- package/dist/chunk-LGEALRC6.cjs.map +0 -1
- package/dist/chunk-MP2JQKSG.js.map +0 -1
- package/dist/chunk-O7UN7OXA.cjs.map +0 -1
- package/dist/chunk-QNKSQTKQ.js.map +0 -1
- package/dist/chunk-QWEUYILR.js.map +0 -1
- package/dist/chunk-RGP33ZJ5.js.map +0 -1
- package/dist/chunk-S55OV6PW.cjs.map +0 -1
- package/dist/chunk-UES55P7G.js.map +0 -1
- package/dist/chunk-UT3S4SEN.js +0 -31
- package/dist/chunk-UT3S4SEN.js.map +0 -1
- package/dist/chunk-VHMPG6UL.js.map +0 -1
- package/dist/chunk-VPYHY3LJ.cjs.map +0 -1
- package/dist/chunk-WDBCBWC4.js.map +0 -1
- package/dist/chunk-WJT7OU7E.cjs.map +0 -1
- package/dist/chunk-XOX22WHL.cjs.map +0 -1
- package/dist/where-7RKFOsXt.d.ts +0 -11
- package/dist/where-DdMIXOtH.d.cts +0 -11
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var chunkBLZDPRXT_cjs = require('./chunk-BLZDPRXT.cjs');
|
|
3
|
+
var chunkIPSVVTWT_cjs = require('./chunk-IPSVVTWT.cjs');
|
|
4
|
+
var chunk3GH67G4Z_cjs = require('./chunk-3GH67G4Z.cjs');
|
|
6
5
|
var chunk7YSP4V4R_cjs = require('./chunk-7YSP4V4R.cjs');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
6
|
+
var chunkHAHNRASW_cjs = require('./chunk-HAHNRASW.cjs');
|
|
7
|
+
var chunkBVRDGYXQ_cjs = require('./chunk-BVRDGYXQ.cjs');
|
|
9
8
|
var drizzleOrm = require('drizzle-orm');
|
|
10
9
|
var nanoid = require('nanoid');
|
|
11
10
|
|
|
12
11
|
// src/core/temporal.ts
|
|
13
12
|
var RECORDED_MAX = "9999-12-31T23:59:59.999Z";
|
|
14
13
|
function assertValidRecordedInstant(value, path) {
|
|
15
|
-
|
|
14
|
+
chunk3GH67G4Z_cjs.validateCanonicalIsoDate(value, path);
|
|
16
15
|
if (value >= RECORDED_MAX) {
|
|
17
|
-
throw new
|
|
16
|
+
throw new chunkBVRDGYXQ_cjs.ValidationError(
|
|
18
17
|
`${path} must be before the recorded-time open sentinel ${RECORDED_MAX}.`,
|
|
19
18
|
{
|
|
20
19
|
issues: [
|
|
@@ -36,7 +35,7 @@ function asRecordedInstant(value) {
|
|
|
36
35
|
}
|
|
37
36
|
function resolveReadCoordinate(mode, asOf, suggestion) {
|
|
38
37
|
if (mode !== "asOf" && asOf !== void 0) {
|
|
39
|
-
throw new
|
|
38
|
+
throw new chunkBVRDGYXQ_cjs.ValidationError(
|
|
40
39
|
`Temporal mode "${mode}" does not take an asOf timestamp.`,
|
|
41
40
|
{
|
|
42
41
|
issues: [
|
|
@@ -67,7 +66,7 @@ function withRecordedCoordinate(coordinate, recordedAsOf) {
|
|
|
67
66
|
}
|
|
68
67
|
function assertValidAsOf(mode, asOf, options) {
|
|
69
68
|
if (mode === "asOf" && asOf === void 0) {
|
|
70
|
-
throw new
|
|
69
|
+
throw new chunkBVRDGYXQ_cjs.ValidationError(
|
|
71
70
|
'Temporal mode "asOf" requires a timestamp',
|
|
72
71
|
{
|
|
73
72
|
issues: [
|
|
@@ -80,7 +79,7 @@ function assertValidAsOf(mode, asOf, options) {
|
|
|
80
79
|
);
|
|
81
80
|
}
|
|
82
81
|
if (asOf !== void 0) {
|
|
83
|
-
|
|
82
|
+
chunk3GH67G4Z_cjs.validateCanonicalIsoDate(asOf, "asOf");
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
function describeCoordinate(coordinate) {
|
|
@@ -145,15 +144,15 @@ function resolveTableNames(names) {
|
|
|
145
144
|
var VALID_IDENTIFIER_PATTERN = /^[a-z_][a-z0-9_$]*$/i;
|
|
146
145
|
function validateTableName(name, label) {
|
|
147
146
|
if (!name || name.length === 0) {
|
|
148
|
-
throw new
|
|
147
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(`${label} table name cannot be empty`);
|
|
149
148
|
}
|
|
150
149
|
if (name.length > chunk7YSP4V4R_cjs.MAX_PG_IDENTIFIER_LENGTH) {
|
|
151
|
-
throw new
|
|
150
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
152
151
|
`${label} table name exceeds maximum length of ${chunk7YSP4V4R_cjs.MAX_PG_IDENTIFIER_LENGTH} characters`
|
|
153
152
|
);
|
|
154
153
|
}
|
|
155
154
|
if (!VALID_IDENTIFIER_PATTERN.test(name)) {
|
|
156
|
-
throw new
|
|
155
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
157
156
|
`${label} table name "${name}" is not a valid SQL identifier. Table names must start with a letter or underscore and contain only letters, digits, underscores, or dollar signs.`
|
|
158
157
|
);
|
|
159
158
|
}
|
|
@@ -169,7 +168,7 @@ function isSqlSchema(schema) {
|
|
|
169
168
|
}
|
|
170
169
|
function requireSqlSchema(schema, surface = "SqlSchema") {
|
|
171
170
|
if (isSqlSchema(schema)) return schema;
|
|
172
|
-
throw new
|
|
171
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
173
172
|
`${surface} must be created with createSqlSchema(...).`,
|
|
174
173
|
{ code: "INVALID_SQL_SCHEMA", surface },
|
|
175
174
|
{
|
|
@@ -215,7 +214,7 @@ function recordedRelation(options) {
|
|
|
215
214
|
function requireExternalRecordedReadSource(source) {
|
|
216
215
|
if (source === void 0) return void 0;
|
|
217
216
|
if (isExternalRecordedReadSource(source)) return source;
|
|
218
|
-
throw new
|
|
217
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
219
218
|
"recordedRead must be created with recordedRelation({ schema }).",
|
|
220
219
|
{ code: "INVALID_RECORDED_READ_SOURCE" },
|
|
221
220
|
{
|
|
@@ -239,7 +238,7 @@ function createRecordedReadBinding(schema) {
|
|
|
239
238
|
function requireRecordedReadBinding(binding, surface) {
|
|
240
239
|
if (isRecordedReadBinding(binding)) return binding;
|
|
241
240
|
if (binding !== void 0) {
|
|
242
|
-
throw new
|
|
241
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
243
242
|
"Recorded-time reads require a recorded read relation created by TypeGraph.",
|
|
244
243
|
{ code: "INVALID_RECORDED_READ_BINDING", surface },
|
|
245
244
|
{
|
|
@@ -247,7 +246,7 @@ function requireRecordedReadBinding(binding, surface) {
|
|
|
247
246
|
}
|
|
248
247
|
);
|
|
249
248
|
}
|
|
250
|
-
throw new
|
|
249
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
251
250
|
"Recorded-time reads require a recorded read relation.",
|
|
252
251
|
{ code: "RECORDED_READ_REQUIRES_BINDING", surface },
|
|
253
252
|
{
|
|
@@ -297,7 +296,7 @@ function generateId() {
|
|
|
297
296
|
}
|
|
298
297
|
function requireRecordedSchema(target) {
|
|
299
298
|
if (target.tableNames === void 0) {
|
|
300
|
-
throw new
|
|
299
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
301
300
|
"Recorded-time capture requires the backend to expose tableNames.",
|
|
302
301
|
{ dialect: target.dialect },
|
|
303
302
|
{
|
|
@@ -309,7 +308,7 @@ function requireRecordedSchema(target) {
|
|
|
309
308
|
}
|
|
310
309
|
function requireCaptureStatements(target) {
|
|
311
310
|
if (target.executeStatement === void 0) {
|
|
312
|
-
throw new
|
|
311
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
313
312
|
"Recorded-time capture requires backend.executeStatement support on the transaction backend.",
|
|
314
313
|
{ dialect: target.dialect },
|
|
315
314
|
{
|
|
@@ -320,10 +319,10 @@ function requireCaptureStatements(target) {
|
|
|
320
319
|
}
|
|
321
320
|
async function executeStatement(target, query) {
|
|
322
321
|
requireCaptureStatements(target);
|
|
323
|
-
await target.executeStatement(
|
|
322
|
+
await target.executeStatement(chunkIPSVVTWT_cjs.asCompiledStatementSql(query));
|
|
324
323
|
}
|
|
325
324
|
function unsupportedPostgresIsolationError(isolationLevel) {
|
|
326
|
-
return new
|
|
325
|
+
return new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
327
326
|
"Recorded-time capture on PostgreSQL requires read_committed isolation.",
|
|
328
327
|
{ isolationLevel: isolationLevel ?? "unknown" },
|
|
329
328
|
{
|
|
@@ -336,6 +335,7 @@ function isSupportedRecordedIsolationLevel(isolationLevel) {
|
|
|
336
335
|
}
|
|
337
336
|
function assertRequestedRecordedIsolation(backend, options) {
|
|
338
337
|
if (backend.dialect !== "postgres") return;
|
|
338
|
+
if (options?.accessMode === "read_only") return;
|
|
339
339
|
const isolationLevel = options?.isolationLevel;
|
|
340
340
|
if (isSupportedRecordedIsolationLevel(isolationLevel)) return;
|
|
341
341
|
throw unsupportedPostgresIsolationError(isolationLevel);
|
|
@@ -344,10 +344,11 @@ function normalizeIsolationLevel(value) {
|
|
|
344
344
|
if (typeof value !== "string") return void 0;
|
|
345
345
|
return value.replaceAll(" ", "_").toLowerCase();
|
|
346
346
|
}
|
|
347
|
-
async function assertRecordedCaptureTransactionIsolation(target) {
|
|
347
|
+
async function assertRecordedCaptureTransactionIsolation(target, options) {
|
|
348
348
|
if (target.dialect !== "postgres") return;
|
|
349
|
+
if (options?.accessMode === "read_only") return;
|
|
349
350
|
const rows = await target.execute(
|
|
350
|
-
|
|
351
|
+
chunkIPSVVTWT_cjs.asCompiledRowsSql(drizzleOrm.sql`
|
|
351
352
|
SELECT current_setting('transaction_isolation') AS transaction_isolation
|
|
352
353
|
`)
|
|
353
354
|
);
|
|
@@ -357,28 +358,35 @@ async function assertRecordedCaptureTransactionIsolation(target) {
|
|
|
357
358
|
if (isSupportedRecordedIsolationLevel(isolationLevel)) return;
|
|
358
359
|
throw unsupportedPostgresIsolationError(isolationLevel);
|
|
359
360
|
}
|
|
360
|
-
function recordedCaptureRequiresCallbackTransactionError(details) {
|
|
361
|
-
return new
|
|
361
|
+
function recordedCaptureRequiresCallbackTransactionError(details = {}) {
|
|
362
|
+
return new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
362
363
|
"withTransaction() has no recorded-time capture flush point when history is enabled.",
|
|
363
|
-
|
|
364
|
+
{
|
|
365
|
+
...details,
|
|
366
|
+
code: "RECORDED_CAPTURE_REQUIRES_CALLBACK_TRANSACTION"
|
|
367
|
+
},
|
|
364
368
|
{
|
|
365
369
|
suggestion: "Use store.withRecordedTransaction(externalTx, async (tx) => ...) so TypeGraph can flush capture before the caller commits."
|
|
366
370
|
}
|
|
367
371
|
);
|
|
368
372
|
}
|
|
369
373
|
function historyUnsafeRawWriteError(surface) {
|
|
370
|
-
return new
|
|
374
|
+
return new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
371
375
|
`${surface} is not available when history capture is enabled because raw SQL writes bypass recorded-time capture.`,
|
|
372
|
-
{
|
|
376
|
+
{
|
|
377
|
+
code: "RECORDED_CAPTURE_RAW_SQL_DISABLED"
|
|
378
|
+
},
|
|
373
379
|
{
|
|
374
380
|
suggestion: "Run graph writes through store.nodes/store.edges (or tx.nodes/tx.edges inside a transaction), or perform raw relational writes outside a history-enabled TypeGraph store."
|
|
375
381
|
}
|
|
376
382
|
);
|
|
377
383
|
}
|
|
378
384
|
function revisionTrackingUnsafeRawWriteError(surface) {
|
|
379
|
-
return new
|
|
385
|
+
return new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
380
386
|
`${surface} is not available when revision tracking is enabled because raw SQL writes bypass the revision anchor.`,
|
|
381
|
-
{
|
|
387
|
+
{
|
|
388
|
+
code: "REVISION_TRACKING_RAW_SQL_DISABLED"
|
|
389
|
+
},
|
|
382
390
|
{
|
|
383
391
|
suggestion: "Run graph writes through store.nodes/store.edges (or tx.nodes/tx.edges inside a transaction), so TypeGraph can advance the revision anchor."
|
|
384
392
|
}
|
|
@@ -455,7 +463,7 @@ function rawWriteGuards(target, prefix) {
|
|
|
455
463
|
}
|
|
456
464
|
function assertCapturableBackend(backend) {
|
|
457
465
|
if (!backend.capabilities.transactions) {
|
|
458
|
-
throw new
|
|
466
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
459
467
|
"history: true requires a backend with transaction support.",
|
|
460
468
|
{ dialect: backend.dialect },
|
|
461
469
|
{
|
|
@@ -464,7 +472,7 @@ function assertCapturableBackend(backend) {
|
|
|
464
472
|
);
|
|
465
473
|
}
|
|
466
474
|
if (backend.executeStatement === void 0) {
|
|
467
|
-
throw new
|
|
475
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
468
476
|
"history: true requires a backend that supports executeStatement.",
|
|
469
477
|
{ dialect: backend.dialect },
|
|
470
478
|
{
|
|
@@ -473,7 +481,7 @@ function assertCapturableBackend(backend) {
|
|
|
473
481
|
);
|
|
474
482
|
}
|
|
475
483
|
if (backend.capabilities.returning === false) {
|
|
476
|
-
throw new
|
|
484
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
477
485
|
"history: true requires a backend that supports UPDATE \u2026 RETURNING.",
|
|
478
486
|
{ dialect: backend.dialect },
|
|
479
487
|
{
|
|
@@ -482,7 +490,7 @@ function assertCapturableBackend(backend) {
|
|
|
482
490
|
);
|
|
483
491
|
}
|
|
484
492
|
if (backend.tableNames === void 0) {
|
|
485
|
-
throw new
|
|
493
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
486
494
|
"history: true requires a backend that exposes tableNames.",
|
|
487
495
|
{ dialect: backend.dialect },
|
|
488
496
|
{
|
|
@@ -493,7 +501,7 @@ function assertCapturableBackend(backend) {
|
|
|
493
501
|
}
|
|
494
502
|
function assertRevisionTrackableBackend(backend) {
|
|
495
503
|
if (!backend.capabilities.transactions) {
|
|
496
|
-
throw new
|
|
504
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
497
505
|
"revisionTracking: true requires a backend with transaction support.",
|
|
498
506
|
{ dialect: backend.dialect },
|
|
499
507
|
{
|
|
@@ -502,7 +510,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
502
510
|
);
|
|
503
511
|
}
|
|
504
512
|
if (backend.executeStatement === void 0) {
|
|
505
|
-
throw new
|
|
513
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
506
514
|
"revisionTracking: true requires a backend that supports executeStatement.",
|
|
507
515
|
{ dialect: backend.dialect },
|
|
508
516
|
{
|
|
@@ -511,7 +519,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
511
519
|
);
|
|
512
520
|
}
|
|
513
521
|
if (backend.tableNames === void 0) {
|
|
514
|
-
throw new
|
|
522
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
515
523
|
"revisionTracking: true requires a backend that exposes tableNames.",
|
|
516
524
|
{ dialect: backend.dialect },
|
|
517
525
|
{
|
|
@@ -520,7 +528,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
520
528
|
);
|
|
521
529
|
}
|
|
522
530
|
if (backend.ensureRevisionOriginsTable === void 0) {
|
|
523
|
-
throw new
|
|
531
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
524
532
|
"revisionTracking: true requires a backend that can bootstrap revision origins.",
|
|
525
533
|
{ dialect: backend.dialect },
|
|
526
534
|
{
|
|
@@ -568,7 +576,7 @@ function registerRecordedGraphLockMemo(backend, memo) {
|
|
|
568
576
|
}
|
|
569
577
|
async function acquireRecordedGraphWriteLock(target, graphId) {
|
|
570
578
|
await target.execute(
|
|
571
|
-
|
|
579
|
+
chunkIPSVVTWT_cjs.asCompiledRowsSql(recordedGraphWriteAdvisoryLockSql(graphId))
|
|
572
580
|
);
|
|
573
581
|
}
|
|
574
582
|
async function lockRecordedGraphWrite(target, graphId, memo) {
|
|
@@ -592,7 +600,7 @@ async function lockRecordedGraphWrite(target, graphId, memo) {
|
|
|
592
600
|
return graphWriteLockEvidence();
|
|
593
601
|
}
|
|
594
602
|
function failInvalidClockTimestamp(value) {
|
|
595
|
-
throw new
|
|
603
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
596
604
|
"Recorded clock row contained an invalid timestamp",
|
|
597
605
|
{ value }
|
|
598
606
|
);
|
|
@@ -631,12 +639,12 @@ function toCanonicalIso(value) {
|
|
|
631
639
|
return failInvalidClockTimestamp(value);
|
|
632
640
|
}
|
|
633
641
|
function nextRecordedCommitTime(previous) {
|
|
634
|
-
const wallTime = Date.parse(
|
|
642
|
+
const wallTime = Date.parse(chunk3GH67G4Z_cjs.nowIso());
|
|
635
643
|
return previous === void 0 ? wallTime : Math.max(wallTime, Date.parse(previous) + 1);
|
|
636
644
|
}
|
|
637
645
|
async function readRecordedClock(target, schema, graphId) {
|
|
638
646
|
const rows = await target.execute(
|
|
639
|
-
|
|
647
|
+
chunkIPSVVTWT_cjs.asCompiledRowsSql(drizzleOrm.sql`
|
|
640
648
|
SELECT recorded_at
|
|
641
649
|
FROM ${schema.recordedClockTable}
|
|
642
650
|
WHERE graph_id = ${graphId}
|
|
@@ -647,7 +655,7 @@ async function readRecordedClock(target, schema, graphId) {
|
|
|
647
655
|
}
|
|
648
656
|
async function readRevisionOrigin(target, schema, graphId) {
|
|
649
657
|
const rows = await target.execute(
|
|
650
|
-
|
|
658
|
+
chunkIPSVVTWT_cjs.asCompiledRowsSql(drizzleOrm.sql`
|
|
651
659
|
SELECT origin
|
|
652
660
|
FROM ${schema.revisionOriginsTable}
|
|
653
661
|
WHERE graph_id = ${graphId}
|
|
@@ -656,7 +664,7 @@ async function readRevisionOrigin(target, schema, graphId) {
|
|
|
656
664
|
const first = rows[0];
|
|
657
665
|
if (first === void 0) return void 0;
|
|
658
666
|
if (typeof first.origin !== "string" || first.origin.length === 0) {
|
|
659
|
-
throw new
|
|
667
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
660
668
|
"Revision origin row contained an invalid origin",
|
|
661
669
|
{ graphId, origin: first.origin }
|
|
662
670
|
);
|
|
@@ -666,7 +674,7 @@ async function readRevisionOrigin(target, schema, graphId) {
|
|
|
666
674
|
async function ensureRevisionOrigin(target, schema, graphId) {
|
|
667
675
|
const ensureTable = target.ensureRevisionOriginsTable;
|
|
668
676
|
if (ensureTable === void 0) {
|
|
669
|
-
throw new
|
|
677
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
670
678
|
"Revision tracking requires a backend that can bootstrap revision origins.",
|
|
671
679
|
{ dialect: target.dialect },
|
|
672
680
|
{
|
|
@@ -687,7 +695,7 @@ async function ensureRevisionOrigin(target, schema, graphId) {
|
|
|
687
695
|
);
|
|
688
696
|
const origin = await readRevisionOrigin(target, schema, graphId);
|
|
689
697
|
if (origin !== void 0) return origin;
|
|
690
|
-
throw new
|
|
698
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
691
699
|
"Revision origin was not persisted after initialization.",
|
|
692
700
|
{ graphId, dialect: target.dialect }
|
|
693
701
|
);
|
|
@@ -705,7 +713,7 @@ async function writeRecordedClock(target, schema, graphId, recordedAt) {
|
|
|
705
713
|
async function lockRecordedClock(target, schema, graphId, ownsWriteLock) {
|
|
706
714
|
if (target.dialect === "postgres") {
|
|
707
715
|
await target.execute(
|
|
708
|
-
|
|
716
|
+
chunkIPSVVTWT_cjs.asCompiledRowsSql(recordedClockAdvisoryLockSql(graphId))
|
|
709
717
|
);
|
|
710
718
|
return;
|
|
711
719
|
}
|
|
@@ -724,7 +732,7 @@ async function allocateRecordedCommit(target, schema, graphId, ownsWriteLock, pr
|
|
|
724
732
|
const previous = previousRevision ?? await readRecordedClock(target, schema, graphId);
|
|
725
733
|
const recordedCommitTime = nextRecordedCommitTime(previous);
|
|
726
734
|
if (!Number.isFinite(recordedCommitTime) || recordedCommitTime >= RECORDED_MAX_TIME) {
|
|
727
|
-
throw new
|
|
735
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
728
736
|
`Recorded commit clock reached the open sentinel ${RECORDED_MAX}`,
|
|
729
737
|
{ graphId, recordedCommitTime },
|
|
730
738
|
{
|
|
@@ -873,7 +881,7 @@ var RECORDED_BIND_PARAM_BUDGET = 900;
|
|
|
873
881
|
function recordedBindParamBudget(target) {
|
|
874
882
|
const budget = target.capabilities.maxBindParameters ?? RECORDED_BIND_PARAM_BUDGET;
|
|
875
883
|
if (!Number.isSafeInteger(budget) || budget < 1) {
|
|
876
|
-
throw new
|
|
884
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
877
885
|
`backend capabilities.maxBindParameters must be a positive integer, got: ${String(budget)}`,
|
|
878
886
|
{
|
|
879
887
|
code: "INVALID_BACKEND_CAPABILITY",
|
|
@@ -894,7 +902,7 @@ function recordedCommonCells() {
|
|
|
894
902
|
graph_id: (row) => drizzleOrm.sql`${row.graph_id}`,
|
|
895
903
|
id: (row) => drizzleOrm.sql`${row.id}`,
|
|
896
904
|
kind: (row) => drizzleOrm.sql`${row.kind}`,
|
|
897
|
-
props: (row) => drizzleOrm.sql`${
|
|
905
|
+
props: (row) => drizzleOrm.sql`${chunkIPSVVTWT_cjs.rowPropsToJsonText(row.props)}`,
|
|
898
906
|
valid_from: (row) => drizzleOrm.sql`${chunk7YSP4V4R_cjs.sqlNull(row.valid_from)}`,
|
|
899
907
|
valid_to: (row) => drizzleOrm.sql`${chunk7YSP4V4R_cjs.sqlNull(row.valid_to)}`,
|
|
900
908
|
created_at: (row) => drizzleOrm.sql`${row.created_at}`,
|
|
@@ -987,20 +995,20 @@ function entityKey(entity) {
|
|
|
987
995
|
async function closeOpenReturning(target, table, graphId, ids, recordedCommit, kind) {
|
|
988
996
|
const kindFilter = kind === void 0 ? drizzleOrm.sql`` : drizzleOrm.sql`AND kind = ${kind}`;
|
|
989
997
|
const rows = await target.execute(
|
|
990
|
-
|
|
998
|
+
chunkIPSVVTWT_cjs.asCompiledRowsSql(drizzleOrm.sql`
|
|
991
999
|
UPDATE ${table}
|
|
992
1000
|
SET recorded_to = ${recordedCommit}
|
|
993
1001
|
WHERE graph_id = ${graphId}
|
|
994
1002
|
${kindFilter}
|
|
995
1003
|
AND recorded_to = ${RECORDED_MAX}
|
|
996
|
-
AND id IN (${
|
|
1004
|
+
AND id IN (${chunkIPSVVTWT_cjs.sqlValueList(ids)})
|
|
997
1005
|
RETURNING id, deleted_at
|
|
998
1006
|
`)
|
|
999
1007
|
);
|
|
1000
|
-
return new Map(rows.map((row) => [row.id,
|
|
1008
|
+
return new Map(rows.map((row) => [row.id, chunkIPSVVTWT_cjs.isPresent(row.deleted_at)]));
|
|
1001
1009
|
}
|
|
1002
1010
|
function recordedOp(hadOpenRow, priorRowWasTombstone, after) {
|
|
1003
|
-
if (
|
|
1011
|
+
if (chunkIPSVVTWT_cjs.isPresent(after.deleted_at)) return "delete";
|
|
1004
1012
|
if (!hadOpenRow || priorRowWasTombstone) return "create";
|
|
1005
1013
|
return "update";
|
|
1006
1014
|
}
|
|
@@ -1037,7 +1045,7 @@ function recordedInsertsFor(afterById, closed) {
|
|
|
1037
1045
|
async function flushNodes(target, schema, graphId, entities, recordedCommit) {
|
|
1038
1046
|
const chunkSize = recordedNodeChunkSize(target);
|
|
1039
1047
|
for (const [kind, group] of groupNodesByKind(entities)) {
|
|
1040
|
-
for (const entityChunk of
|
|
1048
|
+
for (const entityChunk of chunkIPSVVTWT_cjs.chunk(group, chunkSize)) {
|
|
1041
1049
|
const ids = entityChunk.map((entity) => entity.id);
|
|
1042
1050
|
const closed = await closeOpenReturning(
|
|
1043
1051
|
target,
|
|
@@ -1062,7 +1070,7 @@ async function flushNodes(target, schema, graphId, entities, recordedCommit) {
|
|
|
1062
1070
|
}
|
|
1063
1071
|
async function flushEdges(target, schema, graphId, entities, recordedCommit) {
|
|
1064
1072
|
const chunkSize = recordedEdgeChunkSize(target);
|
|
1065
|
-
for (const entityChunk of
|
|
1073
|
+
for (const entityChunk of chunkIPSVVTWT_cjs.chunk(entities, chunkSize)) {
|
|
1066
1074
|
const ids = entityChunk.map((entity) => entity.id);
|
|
1067
1075
|
const closed = await closeOpenReturning(
|
|
1068
1076
|
target,
|
|
@@ -1141,7 +1149,7 @@ async function closeRecordedHardDeletedKind(target, schema, graphId, removal, ow
|
|
|
1141
1149
|
}
|
|
1142
1150
|
async function queryConnectedEdgeIds(target, schema, params) {
|
|
1143
1151
|
const rows = await target.execute(
|
|
1144
|
-
|
|
1152
|
+
chunkIPSVVTWT_cjs.asCompiledRowsSql(drizzleOrm.sql`
|
|
1145
1153
|
SELECT id
|
|
1146
1154
|
FROM ${schema.edgesTable}
|
|
1147
1155
|
WHERE graph_id = ${params.graphId}
|
|
@@ -1188,22 +1196,32 @@ function edgeParamsIdentityKey(params) {
|
|
|
1188
1196
|
function edgeRowIdentityKey(row) {
|
|
1189
1197
|
return edgeIdentityKey(row.graph_id, row.id);
|
|
1190
1198
|
}
|
|
1199
|
+
function recordedCaptureSealedError(details) {
|
|
1200
|
+
return new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
1201
|
+
"Recorded-time capture session is sealed: a graph write happened after the transaction's capture was flushed.",
|
|
1202
|
+
details,
|
|
1203
|
+
{
|
|
1204
|
+
suggestion: "Perform all writes inside the withRecordedTransaction callback; do not reuse the transaction context after it returns."
|
|
1205
|
+
}
|
|
1206
|
+
);
|
|
1207
|
+
}
|
|
1191
1208
|
function createRecordedCaptureSession() {
|
|
1192
1209
|
const touched = /* @__PURE__ */ new Map();
|
|
1193
1210
|
let sealed = false;
|
|
1194
1211
|
function touch(entity) {
|
|
1195
1212
|
if (sealed) {
|
|
1196
|
-
throw
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
}
|
|
1202
|
-
);
|
|
1213
|
+
throw recordedCaptureSealedError({
|
|
1214
|
+
entity: entity.entity,
|
|
1215
|
+
graphId: entity.graphId,
|
|
1216
|
+
id: entity.id
|
|
1217
|
+
});
|
|
1203
1218
|
}
|
|
1204
1219
|
touched.set(entityKey(entity), entity);
|
|
1205
1220
|
}
|
|
1206
1221
|
return {
|
|
1222
|
+
assertOpen() {
|
|
1223
|
+
if (sealed) throw recordedCaptureSealedError({});
|
|
1224
|
+
},
|
|
1207
1225
|
touchNode(graphId, kind, id, afterImage) {
|
|
1208
1226
|
touch({ entity: "node", graphId, kind, id, afterImage });
|
|
1209
1227
|
},
|
|
@@ -1212,7 +1230,7 @@ function createRecordedCaptureSession() {
|
|
|
1212
1230
|
},
|
|
1213
1231
|
async flush(target, schema, ownsWriteLock) {
|
|
1214
1232
|
if (sealed) {
|
|
1215
|
-
throw new
|
|
1233
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
1216
1234
|
"Recorded-time capture session was already flushed.",
|
|
1217
1235
|
{},
|
|
1218
1236
|
{
|
|
@@ -1223,7 +1241,7 @@ function createRecordedCaptureSession() {
|
|
|
1223
1241
|
sealed = true;
|
|
1224
1242
|
if (touched.size === 0) return /* @__PURE__ */ new Map();
|
|
1225
1243
|
const recordedByGraph = /* @__PURE__ */ new Map();
|
|
1226
|
-
const byGraph =
|
|
1244
|
+
const byGraph = chunkIPSVVTWT_cjs.groupBy(touched.values(), (entity) => entity.graphId);
|
|
1227
1245
|
for (const [graphId, entities] of byGraph) {
|
|
1228
1246
|
const recordedCommit = await allocateRecordedCommit(
|
|
1229
1247
|
target,
|
|
@@ -1261,9 +1279,10 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1261
1279
|
await lockRecordedGraphWrite(target, graphId, graphLocks);
|
|
1262
1280
|
}
|
|
1263
1281
|
}
|
|
1264
|
-
const overlay =
|
|
1282
|
+
const overlay = chunkIPSVVTWT_cjs.createBackendOverlay(target, {
|
|
1265
1283
|
...rawWriteGuards(target, "tx.backend"),
|
|
1266
1284
|
async insertNode(params) {
|
|
1285
|
+
session.assertOpen();
|
|
1267
1286
|
await lockGraph(params.graphId);
|
|
1268
1287
|
const row = await target.insertNode(params);
|
|
1269
1288
|
session.touchNode(params.graphId, params.kind, params.id, row);
|
|
@@ -1271,6 +1290,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1271
1290
|
},
|
|
1272
1291
|
...target.insertNodeNoReturn === void 0 ? {} : {
|
|
1273
1292
|
async insertNodeNoReturn(params) {
|
|
1293
|
+
session.assertOpen();
|
|
1274
1294
|
await lockGraph(params.graphId);
|
|
1275
1295
|
await runInsertNoReturn(nodeDispatch, params);
|
|
1276
1296
|
session.touchNode(params.graphId, params.kind, params.id);
|
|
@@ -1278,6 +1298,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1278
1298
|
},
|
|
1279
1299
|
...target.insertNodesBatch === void 0 ? {} : {
|
|
1280
1300
|
async insertNodesBatch(params) {
|
|
1301
|
+
session.assertOpen();
|
|
1281
1302
|
await lockGraphs(params);
|
|
1282
1303
|
await runInsertBatch(nodeDispatch, params);
|
|
1283
1304
|
for (const node of params) {
|
|
@@ -1287,6 +1308,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1287
1308
|
},
|
|
1288
1309
|
...target.insertNodesBatchReturning === void 0 ? {} : {
|
|
1289
1310
|
async insertNodesBatchReturning(params) {
|
|
1311
|
+
session.assertOpen();
|
|
1290
1312
|
await lockGraphs(params);
|
|
1291
1313
|
const rows = await runInsertBatchReturning(nodeDispatch, params);
|
|
1292
1314
|
const rowsByIdentity = new Map(
|
|
@@ -1304,17 +1326,20 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1304
1326
|
}
|
|
1305
1327
|
},
|
|
1306
1328
|
async updateNode(params) {
|
|
1329
|
+
session.assertOpen();
|
|
1307
1330
|
await lockGraph(params.graphId);
|
|
1308
1331
|
const row = await target.updateNode(params);
|
|
1309
1332
|
session.touchNode(params.graphId, params.kind, params.id, row);
|
|
1310
1333
|
return row;
|
|
1311
1334
|
},
|
|
1312
1335
|
async deleteNode(params) {
|
|
1336
|
+
session.assertOpen();
|
|
1313
1337
|
await lockGraph(params.graphId);
|
|
1314
1338
|
await target.deleteNode(params);
|
|
1315
1339
|
session.touchNode(params.graphId, params.kind, params.id);
|
|
1316
1340
|
},
|
|
1317
1341
|
async hardDeleteNode(params) {
|
|
1342
|
+
session.assertOpen();
|
|
1318
1343
|
await lockGraph(params.graphId);
|
|
1319
1344
|
const connectedEdgeIds = await queryConnectedEdgeIds(
|
|
1320
1345
|
target,
|
|
@@ -1328,6 +1353,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1328
1353
|
}
|
|
1329
1354
|
},
|
|
1330
1355
|
async insertEdge(params) {
|
|
1356
|
+
session.assertOpen();
|
|
1331
1357
|
await lockGraph(params.graphId);
|
|
1332
1358
|
const row = await target.insertEdge(params);
|
|
1333
1359
|
session.touchEdge(params.graphId, params.id, row);
|
|
@@ -1335,6 +1361,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1335
1361
|
},
|
|
1336
1362
|
...target.insertEdgeNoReturn === void 0 ? {} : {
|
|
1337
1363
|
async insertEdgeNoReturn(params) {
|
|
1364
|
+
session.assertOpen();
|
|
1338
1365
|
await lockGraph(params.graphId);
|
|
1339
1366
|
await runInsertNoReturn(edgeDispatch, params);
|
|
1340
1367
|
session.touchEdge(params.graphId, params.id);
|
|
@@ -1342,6 +1369,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1342
1369
|
},
|
|
1343
1370
|
...target.insertEdgesBatch === void 0 ? {} : {
|
|
1344
1371
|
async insertEdgesBatch(params) {
|
|
1372
|
+
session.assertOpen();
|
|
1345
1373
|
await lockGraphs(params);
|
|
1346
1374
|
await runInsertBatch(edgeDispatch, params);
|
|
1347
1375
|
for (const edge of params) {
|
|
@@ -1351,6 +1379,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1351
1379
|
},
|
|
1352
1380
|
...target.insertEdgesBatchReturning === void 0 ? {} : {
|
|
1353
1381
|
async insertEdgesBatchReturning(params) {
|
|
1382
|
+
session.assertOpen();
|
|
1354
1383
|
await lockGraphs(params);
|
|
1355
1384
|
const rows = await runInsertBatchReturning(edgeDispatch, params);
|
|
1356
1385
|
const rowsByIdentity = new Map(
|
|
@@ -1367,23 +1396,27 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1367
1396
|
}
|
|
1368
1397
|
},
|
|
1369
1398
|
async updateEdge(params) {
|
|
1399
|
+
session.assertOpen();
|
|
1370
1400
|
await lockGraph(params.graphId);
|
|
1371
1401
|
const row = await target.updateEdge(params);
|
|
1372
1402
|
session.touchEdge(params.graphId, params.id, row);
|
|
1373
1403
|
return row;
|
|
1374
1404
|
},
|
|
1375
1405
|
async deleteEdge(params) {
|
|
1406
|
+
session.assertOpen();
|
|
1376
1407
|
await lockGraph(params.graphId);
|
|
1377
1408
|
await target.deleteEdge(params);
|
|
1378
1409
|
session.touchEdge(params.graphId, params.id);
|
|
1379
1410
|
},
|
|
1380
1411
|
async hardDeleteEdge(params) {
|
|
1412
|
+
session.assertOpen();
|
|
1381
1413
|
await lockGraph(params.graphId);
|
|
1382
1414
|
await target.hardDeleteEdge(params);
|
|
1383
1415
|
session.touchEdge(params.graphId, params.id);
|
|
1384
1416
|
},
|
|
1385
1417
|
...target.deleteEdgesBatch === void 0 ? {} : {
|
|
1386
1418
|
async deleteEdgesBatch(params) {
|
|
1419
|
+
session.assertOpen();
|
|
1387
1420
|
await lockGraph(params.graphId);
|
|
1388
1421
|
await target.deleteEdgesBatch(params);
|
|
1389
1422
|
for (const id of params.ids) {
|
|
@@ -1393,6 +1426,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
1393
1426
|
},
|
|
1394
1427
|
...target.hardDeleteEdgesBatch === void 0 ? {} : {
|
|
1395
1428
|
async hardDeleteEdgesBatch(params) {
|
|
1429
|
+
session.assertOpen();
|
|
1396
1430
|
await lockGraph(params.graphId);
|
|
1397
1431
|
await target.hardDeleteEdgesBatch(params);
|
|
1398
1432
|
for (const id of params.ids) {
|
|
@@ -1411,7 +1445,7 @@ function createRecordedTransactionScope(target, schema, ownsWriteLock = false) {
|
|
|
1411
1445
|
return {
|
|
1412
1446
|
backend: createRecordedTransactionBackend(target, session, resolvedSchema),
|
|
1413
1447
|
async flush() {
|
|
1414
|
-
return
|
|
1448
|
+
return chunk3GH67G4Z_cjs.withRecordedRelationsPrecondition(
|
|
1415
1449
|
session.flush(target, resolvedSchema, ownsWriteLock),
|
|
1416
1450
|
{ dialect: target.dialect, surface: "capture-flush" }
|
|
1417
1451
|
);
|
|
@@ -1431,7 +1465,7 @@ async function runCapturedAutocommit(backend, schema, fn, options) {
|
|
|
1431
1465
|
function createRecordedBackend(backend, schema) {
|
|
1432
1466
|
assertCapturableBackend(backend);
|
|
1433
1467
|
const capture = (fn) => runCapturedAutocommit(backend, schema, fn);
|
|
1434
|
-
return
|
|
1468
|
+
return chunkIPSVVTWT_cjs.createBackendOverlay(backend, {
|
|
1435
1469
|
...rawWriteGuards(backend, "backend"),
|
|
1436
1470
|
async insertNode(params) {
|
|
1437
1471
|
return capture((target) => target.insertNode(params));
|
|
@@ -1514,8 +1548,9 @@ function createRecordedBackend(backend, schema) {
|
|
|
1514
1548
|
const backendOptions = stripRecordedFlushObserver(options);
|
|
1515
1549
|
assertRequestedRecordedIsolation(backend, backendOptions);
|
|
1516
1550
|
return backend.transaction(async (target) => {
|
|
1517
|
-
await assertRecordedCaptureTransactionIsolation(target);
|
|
1518
|
-
const
|
|
1551
|
+
await assertRecordedCaptureTransactionIsolation(target, backendOptions);
|
|
1552
|
+
const readOnly = backendOptions?.accessMode === "read_only";
|
|
1553
|
+
const scope = createRecordedTransactionScope(target, schema, !readOnly);
|
|
1519
1554
|
const result = await fn(scope.backend, createHistoryUnsafeSqlRef());
|
|
1520
1555
|
const instants = await scope.flush();
|
|
1521
1556
|
observer?.(instants);
|
|
@@ -1537,7 +1572,7 @@ var embeddingFieldsCache = /* @__PURE__ */ new WeakMap();
|
|
|
1537
1572
|
function getEmbeddingFields(schema) {
|
|
1538
1573
|
const cached = embeddingFieldsCache.get(schema);
|
|
1539
1574
|
if (cached) return cached;
|
|
1540
|
-
const fields =
|
|
1575
|
+
const fields = chunkHAHNRASW_cjs.resolveEmbeddingFields(schema);
|
|
1541
1576
|
embeddingFieldsCache.set(schema, fields);
|
|
1542
1577
|
return fields;
|
|
1543
1578
|
}
|
|
@@ -1666,10 +1701,10 @@ function isValidEmbeddingValue(value) {
|
|
|
1666
1701
|
// src/store/fulltext-sync.ts
|
|
1667
1702
|
var FIELD_SEPARATOR = "\n";
|
|
1668
1703
|
function resolveCombinedLanguage(fields) {
|
|
1669
|
-
return fields[0]?.metadata.language ??
|
|
1704
|
+
return fields[0]?.metadata.language ?? chunkHAHNRASW_cjs.DEFAULT_SEARCHABLE_LANGUAGE;
|
|
1670
1705
|
}
|
|
1671
1706
|
function computeFulltextContent(schema, props) {
|
|
1672
|
-
const searchableFields =
|
|
1707
|
+
const searchableFields = chunkHAHNRASW_cjs.getSearchableFields(schema);
|
|
1673
1708
|
if (searchableFields.length === 0) return void 0;
|
|
1674
1709
|
const parts = [];
|
|
1675
1710
|
for (const field of searchableFields) {
|
|
@@ -1700,7 +1735,7 @@ async function syncFulltext(ctx, schema, props) {
|
|
|
1700
1735
|
});
|
|
1701
1736
|
return;
|
|
1702
1737
|
}
|
|
1703
|
-
if (
|
|
1738
|
+
if (chunkHAHNRASW_cjs.getSearchableFields(schema).length === 0) return;
|
|
1704
1739
|
await backend.deleteFulltext({
|
|
1705
1740
|
graphId: ctx.graphId,
|
|
1706
1741
|
nodeKind: ctx.nodeKind,
|
|
@@ -1714,7 +1749,7 @@ async function syncFulltextBatchForKind(args, schema, items) {
|
|
|
1714
1749
|
}
|
|
1715
1750
|
const rows = [];
|
|
1716
1751
|
const emptyContentIds = [];
|
|
1717
|
-
const hasSearchableFields =
|
|
1752
|
+
const hasSearchableFields = chunkHAHNRASW_cjs.getSearchableFields(schema).length > 0;
|
|
1718
1753
|
for (const item of items) {
|
|
1719
1754
|
const computed = computeFulltextContent(schema, item.props);
|
|
1720
1755
|
if (computed !== void 0) {
|
|
@@ -1761,7 +1796,7 @@ async function deleteNodeFulltext(ctx, schema) {
|
|
|
1761
1796
|
if (!backend.deleteFulltext) {
|
|
1762
1797
|
return;
|
|
1763
1798
|
}
|
|
1764
|
-
if (
|
|
1799
|
+
if (chunkHAHNRASW_cjs.getSearchableFields(schema).length === 0) {
|
|
1765
1800
|
return;
|
|
1766
1801
|
}
|
|
1767
1802
|
await backend.deleteFulltext({
|
|
@@ -1823,7 +1858,7 @@ function evaluatePredicate(predicate, props) {
|
|
|
1823
1858
|
if (pred.op === "isNull") {
|
|
1824
1859
|
return value === null || value === void 0;
|
|
1825
1860
|
}
|
|
1826
|
-
return
|
|
1861
|
+
return chunkIPSVVTWT_cjs.isPresent(value);
|
|
1827
1862
|
}
|
|
1828
1863
|
function getKindsForUniquenessCheck(baseKind, scope, registry) {
|
|
1829
1864
|
if (scope === "kind") {
|
|
@@ -1852,7 +1887,7 @@ function checkCardinality(edgeKind, fromKind, fromId, cardinality, existingEdgeC
|
|
|
1852
1887
|
}
|
|
1853
1888
|
case "one": {
|
|
1854
1889
|
if (existingEdgeCount > 0) {
|
|
1855
|
-
return new
|
|
1890
|
+
return new chunkBVRDGYXQ_cjs.CardinalityError({
|
|
1856
1891
|
edgeKind,
|
|
1857
1892
|
fromKind,
|
|
1858
1893
|
fromId,
|
|
@@ -1867,7 +1902,7 @@ function checkCardinality(edgeKind, fromKind, fromId, cardinality, existingEdgeC
|
|
|
1867
1902
|
}
|
|
1868
1903
|
case "oneActive": {
|
|
1869
1904
|
if (hasActiveEdge) {
|
|
1870
|
-
return new
|
|
1905
|
+
return new chunkBVRDGYXQ_cjs.CardinalityError({
|
|
1871
1906
|
edgeKind,
|
|
1872
1907
|
fromKind,
|
|
1873
1908
|
fromId,
|
|
@@ -1881,7 +1916,7 @@ function checkCardinality(edgeKind, fromKind, fromId, cardinality, existingEdgeC
|
|
|
1881
1916
|
}
|
|
1882
1917
|
function checkUniqueEdge(edgeKind, fromKind, fromId, _toKind, _toId, existingCount) {
|
|
1883
1918
|
if (existingCount > 0) {
|
|
1884
|
-
return new
|
|
1919
|
+
return new chunkBVRDGYXQ_cjs.CardinalityError({
|
|
1885
1920
|
edgeKind,
|
|
1886
1921
|
fromKind,
|
|
1887
1922
|
fromId,
|
|
@@ -1894,7 +1929,7 @@ function checkUniqueEdge(edgeKind, fromKind, fromId, _toKind, _toId, existingCou
|
|
|
1894
1929
|
function validateEdgeEndpoints(edgeKind, fromKind, toKind, registration, registry) {
|
|
1895
1930
|
const validFromKinds = registration.from.map((node) => node.kind);
|
|
1896
1931
|
if (!registry.isAssignableToAny(fromKind, validFromKinds)) {
|
|
1897
|
-
return new
|
|
1932
|
+
return new chunkBVRDGYXQ_cjs.EndpointError({
|
|
1898
1933
|
edgeKind,
|
|
1899
1934
|
endpoint: "from",
|
|
1900
1935
|
actualKind: fromKind,
|
|
@@ -1903,7 +1938,7 @@ function validateEdgeEndpoints(edgeKind, fromKind, toKind, registration, registr
|
|
|
1903
1938
|
}
|
|
1904
1939
|
const validToKinds = registration.to.map((node) => node.kind);
|
|
1905
1940
|
if (!registry.isAssignableToAny(toKind, validToKinds)) {
|
|
1906
|
-
return new
|
|
1941
|
+
return new chunkBVRDGYXQ_cjs.EndpointError({
|
|
1907
1942
|
edgeKind,
|
|
1908
1943
|
endpoint: "to",
|
|
1909
1944
|
actualKind: toKind,
|
|
@@ -1915,7 +1950,7 @@ function validateEdgeEndpoints(edgeKind, fromKind, toKind, registration, registr
|
|
|
1915
1950
|
function checkDisjointness(nodeId, nodeKind, existingKinds, registry) {
|
|
1916
1951
|
for (const existingKind of existingKinds) {
|
|
1917
1952
|
if (registry.areDisjoint(nodeKind, existingKind)) {
|
|
1918
|
-
return new
|
|
1953
|
+
return new chunkBVRDGYXQ_cjs.DisjointError({
|
|
1919
1954
|
nodeId,
|
|
1920
1955
|
attemptedKind: nodeKind,
|
|
1921
1956
|
conflictingKind: existingKind
|
|
@@ -1952,7 +1987,7 @@ async function checkUniquenessConstraints(ctx, kind, id, props, constraints) {
|
|
|
1952
1987
|
key
|
|
1953
1988
|
});
|
|
1954
1989
|
if (existing && existing.node_id !== id) {
|
|
1955
|
-
throw new
|
|
1990
|
+
throw new chunkBVRDGYXQ_cjs.UniquenessError({
|
|
1956
1991
|
constraintName: constraint.name,
|
|
1957
1992
|
kind: kindToCheck,
|
|
1958
1993
|
existingId: existing.node_id,
|
|
@@ -2058,7 +2093,7 @@ async function updateUniquenessEntries(ctx, kind, id, oldProps, newProps, constr
|
|
|
2058
2093
|
key: newKey
|
|
2059
2094
|
});
|
|
2060
2095
|
if (existing && existing.node_id !== id) {
|
|
2061
|
-
throw new
|
|
2096
|
+
throw new chunkBVRDGYXQ_cjs.UniquenessError({
|
|
2062
2097
|
constraintName: constraint.name,
|
|
2063
2098
|
kind: kindToCheck,
|
|
2064
2099
|
existingId: existing.node_id,
|
|
@@ -2115,7 +2150,7 @@ async function enforceNodeDeleteBehavior(ctx, args, backend, policy) {
|
|
|
2115
2150
|
if (connectedEdges.length === 0) return;
|
|
2116
2151
|
switch (behavior) {
|
|
2117
2152
|
case "restrict": {
|
|
2118
|
-
throw new
|
|
2153
|
+
throw new chunkBVRDGYXQ_cjs.RestrictedDeleteError({
|
|
2119
2154
|
nodeKind: args.kind,
|
|
2120
2155
|
nodeId: args.id,
|
|
2121
2156
|
edgeCount: connectedEdges.length,
|
|
@@ -2188,7 +2223,7 @@ async function applyNodeInsertSideEffectsBatch(ctx, items, backend) {
|
|
|
2188
2223
|
);
|
|
2189
2224
|
}
|
|
2190
2225
|
function parseRowProps(row) {
|
|
2191
|
-
return
|
|
2226
|
+
return chunkIPSVVTWT_cjs.rowPropsToObject(row.props);
|
|
2192
2227
|
}
|
|
2193
2228
|
async function applyNodeUpdate(ctx, args, backend) {
|
|
2194
2229
|
const { kind, id } = args.existing;
|
|
@@ -2379,5 +2414,5 @@ exports.validateEdgeEndpoints = validateEdgeEndpoints;
|
|
|
2379
2414
|
exports.vectorSlotKey = vectorSlotKey;
|
|
2380
2415
|
exports.withRecordedCoordinate = withRecordedCoordinate;
|
|
2381
2416
|
exports.withRecordedFlushObserver = withRecordedFlushObserver;
|
|
2382
|
-
//# sourceMappingURL=chunk-
|
|
2383
|
-
//# sourceMappingURL=chunk-
|
|
2417
|
+
//# sourceMappingURL=chunk-WOJMKB3N.cjs.map
|
|
2418
|
+
//# sourceMappingURL=chunk-WOJMKB3N.cjs.map
|