@nicia-ai/typegraph 0.65.0 → 0.66.1
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/CHANGELOG.md +33 -0
- package/dist/{atomic-mutation-program-BznZQ06C.d.ts → atomic-mutation-program-BhP75Qn0.d.ts} +1 -1
- package/dist/{atomic-mutation-program-Bfu5z-je.d.cts → atomic-mutation-program-DMdmc4s0.d.cts} +1 -1
- package/dist/backend/drizzle/engine/index.cjs +13 -13
- package/dist/backend/drizzle/engine/index.d.cts +9 -9
- package/dist/backend/drizzle/engine/index.d.ts +9 -9
- package/dist/backend/drizzle/engine/index.js +8 -8
- package/dist/backend/drizzle/indexes.d.cts +1 -1
- package/dist/backend/drizzle/indexes.d.ts +1 -1
- package/dist/backend/index.cjs +91 -91
- package/dist/backend/index.d.cts +7 -7
- package/dist/backend/index.d.ts +7 -7
- package/dist/backend/index.js +8 -8
- package/dist/backend/postgres/index.cjs +23 -23
- package/dist/backend/postgres/index.d.cts +8 -8
- package/dist/backend/postgres/index.d.ts +8 -8
- package/dist/backend/postgres/index.js +8 -8
- package/dist/backend/postgres/pglite-store.cjs +1 -1
- package/dist/backend/postgres/pglite-store.d.cts +6 -6
- package/dist/backend/postgres/pglite-store.d.ts +6 -6
- package/dist/backend/postgres/pglite-store.js +1 -1
- package/dist/backend/postgres/pglite.cjs +10 -10
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +9 -9
- package/dist/backend/sqlite/index.cjs +21 -21
- package/dist/backend/sqlite/index.d.cts +7 -7
- package/dist/backend/sqlite/index.d.ts +7 -7
- package/dist/backend/sqlite/index.js +8 -8
- package/dist/backend/sqlite/libsql.cjs +14 -14
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +8 -8
- package/dist/backend/sqlite/local-store.cjs +1 -1
- package/dist/backend/sqlite/local-store.d.cts +6 -6
- package/dist/backend/sqlite/local-store.d.ts +6 -6
- package/dist/backend/sqlite/local-store.js +1 -1
- package/dist/backend/sqlite/local.cjs +10 -10
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +9 -9
- package/dist/{chunk-PFXNQFFY.js → chunk-2DJKHZQ4.js} +75 -8
- package/dist/chunk-2DJKHZQ4.js.map +1 -0
- package/dist/{chunk-337ONI2I.js → chunk-3SUZXB5X.js} +146 -80
- package/dist/chunk-3SUZXB5X.js.map +1 -0
- package/dist/{chunk-4VTCIEK3.js → chunk-4TQOIBWH.js} +3 -3
- package/dist/{chunk-4VTCIEK3.js.map → chunk-4TQOIBWH.js.map} +1 -1
- package/dist/{chunk-JRWKRBI5.cjs → chunk-5JOCIMQ3.cjs} +6 -6
- package/dist/{chunk-JRWKRBI5.cjs.map → chunk-5JOCIMQ3.cjs.map} +1 -1
- package/dist/{chunk-BWQA3POT.cjs → chunk-6B3LQUYG.cjs} +206 -138
- package/dist/chunk-6B3LQUYG.cjs.map +1 -0
- package/dist/{chunk-RQPCUHIH.js → chunk-6ECNYQDW.js} +3 -3
- package/dist/{chunk-RQPCUHIH.js.map → chunk-6ECNYQDW.js.map} +1 -1
- package/dist/{chunk-OLB75LRQ.js → chunk-6GKKAQMW.js} +5 -5
- package/dist/{chunk-OLB75LRQ.js.map → chunk-6GKKAQMW.js.map} +1 -1
- package/dist/{chunk-OC5ROP7V.cjs → chunk-6JRVV2SS.cjs} +8 -2
- package/dist/chunk-6JRVV2SS.cjs.map +1 -0
- package/dist/{chunk-DSX3P4S5.cjs → chunk-76OB5RSH.cjs} +6 -6
- package/dist/{chunk-DSX3P4S5.cjs.map → chunk-76OB5RSH.cjs.map} +1 -1
- package/dist/{chunk-DHRLOQLQ.cjs → chunk-7LQTDGV5.cjs} +11 -11
- package/dist/{chunk-DHRLOQLQ.cjs.map → chunk-7LQTDGV5.cjs.map} +1 -1
- package/dist/{chunk-Q25QYSOH.js → chunk-7YJHUY4T.js} +9 -9
- package/dist/{chunk-Q25QYSOH.js.map → chunk-7YJHUY4T.js.map} +1 -1
- package/dist/{chunk-JERQGJKG.cjs → chunk-ANMCKLZQ.cjs} +18 -18
- package/dist/{chunk-JERQGJKG.cjs.map → chunk-ANMCKLZQ.cjs.map} +1 -1
- package/dist/{chunk-BBOMNH44.js → chunk-BABP4D5B.js} +3 -3
- package/dist/{chunk-BBOMNH44.js.map → chunk-BABP4D5B.js.map} +1 -1
- package/dist/{chunk-EVGZ2TRQ.js → chunk-BE75G3M5.js} +3 -3
- package/dist/{chunk-EVGZ2TRQ.js.map → chunk-BE75G3M5.js.map} +1 -1
- package/dist/{chunk-FXGZT3WO.cjs → chunk-BX42F7IJ.cjs} +41 -41
- package/dist/{chunk-FXGZT3WO.cjs.map → chunk-BX42F7IJ.cjs.map} +1 -1
- package/dist/{chunk-G6T23JU7.js → chunk-CDKNGCE7.js} +3 -3
- package/dist/{chunk-G6T23JU7.js.map → chunk-CDKNGCE7.js.map} +1 -1
- package/dist/{chunk-BNTJ5YFO.cjs → chunk-EACDHXJL.cjs} +4 -4
- package/dist/{chunk-BNTJ5YFO.cjs.map → chunk-EACDHXJL.cjs.map} +1 -1
- package/dist/{chunk-SNDJUTMB.cjs → chunk-EBQX7MYL.cjs} +72 -72
- package/dist/{chunk-SNDJUTMB.cjs.map → chunk-EBQX7MYL.cjs.map} +1 -1
- package/dist/{chunk-GKSAEUX6.js → chunk-FXOFJ4FS.js} +7 -7
- package/dist/{chunk-GKSAEUX6.js.map → chunk-FXOFJ4FS.js.map} +1 -1
- package/dist/{chunk-ZOWRACZQ.cjs → chunk-G7OKJDMG.cjs} +5 -5
- package/dist/{chunk-ZOWRACZQ.cjs.map → chunk-G7OKJDMG.cjs.map} +1 -1
- package/dist/{chunk-MKJPBSID.cjs → chunk-I7SBZJI2.cjs} +4 -4
- package/dist/{chunk-MKJPBSID.cjs.map → chunk-I7SBZJI2.cjs.map} +1 -1
- package/dist/{chunk-H346QK3V.cjs → chunk-K7YACILO.cjs} +9 -9
- package/dist/{chunk-H346QK3V.cjs.map → chunk-K7YACILO.cjs.map} +1 -1
- package/dist/{chunk-3KWF25MF.cjs → chunk-MN325MG4.cjs} +313 -246
- package/dist/chunk-MN325MG4.cjs.map +1 -0
- package/dist/{chunk-KDNRACRG.cjs → chunk-MRUOOAIQ.cjs} +4 -4
- package/dist/{chunk-KDNRACRG.cjs.map → chunk-MRUOOAIQ.cjs.map} +1 -1
- package/dist/{chunk-HTSJTWUT.js → chunk-OF63ZHSD.js} +4 -4
- package/dist/{chunk-HTSJTWUT.js.map → chunk-OF63ZHSD.js.map} +1 -1
- package/dist/{chunk-NGA3THGU.cjs → chunk-QR7W37HG.cjs} +14 -14
- package/dist/{chunk-NGA3THGU.cjs.map → chunk-QR7W37HG.cjs.map} +1 -1
- package/dist/{chunk-QFEO4M5W.js → chunk-RTPMG6LQ.js} +11 -11
- package/dist/{chunk-QFEO4M5W.js.map → chunk-RTPMG6LQ.js.map} +1 -1
- package/dist/{chunk-PFD4NUYV.js → chunk-SSDHR2C2.js} +3 -3
- package/dist/{chunk-PFD4NUYV.js.map → chunk-SSDHR2C2.js.map} +1 -1
- package/dist/{chunk-THK3SCQA.js → chunk-SYXTWPX6.js} +5 -5
- package/dist/{chunk-THK3SCQA.js.map → chunk-SYXTWPX6.js.map} +1 -1
- package/dist/{chunk-XSLQYGNR.cjs → chunk-T3VU3YRQ.cjs} +69 -69
- package/dist/{chunk-XSLQYGNR.cjs.map → chunk-T3VU3YRQ.cjs.map} +1 -1
- package/dist/{chunk-MIBWA6HX.js → chunk-TR7QTODF.js} +213 -33
- package/dist/chunk-TR7QTODF.js.map +1 -0
- package/dist/{chunk-AD3NLSV5.js → chunk-TU22BFMP.js} +8 -2
- package/dist/chunk-TU22BFMP.js.map +1 -0
- package/dist/{chunk-WTMSUIRO.js → chunk-UFKYMQJ5.js} +3 -3
- package/dist/{chunk-WTMSUIRO.js.map → chunk-UFKYMQJ5.js.map} +1 -1
- package/dist/{chunk-35LDKSMM.cjs → chunk-VNJMM2QQ.cjs} +30 -30
- package/dist/{chunk-35LDKSMM.cjs.map → chunk-VNJMM2QQ.cjs.map} +1 -1
- package/dist/{chunk-53ZEBIMD.js → chunk-WB55URNM.js} +6 -6
- package/dist/{chunk-53ZEBIMD.js.map → chunk-WB55URNM.js.map} +1 -1
- package/dist/{chunk-L2GBVYRU.cjs → chunk-WWSYGZED.cjs} +11 -11
- package/dist/{chunk-L2GBVYRU.cjs.map → chunk-WWSYGZED.cjs.map} +1 -1
- package/dist/{chunk-D2JPOFRZ.cjs → chunk-WY3IFEKV.cjs} +191 -191
- package/dist/{chunk-D2JPOFRZ.cjs.map → chunk-WY3IFEKV.cjs.map} +1 -1
- package/dist/{chunk-3RSFLZ7A.cjs → chunk-Y4X6ODVY.cjs} +943 -763
- package/dist/chunk-Y4X6ODVY.cjs.map +1 -0
- package/dist/{chunk-VZRXXABW.js → chunk-YHMXF7OZ.js} +5 -5
- package/dist/{chunk-VZRXXABW.js.map → chunk-YHMXF7OZ.js.map} +1 -1
- package/dist/{chunk-VROJKWZ7.js → chunk-ZONDBN6H.js} +5 -5
- package/dist/{chunk-VROJKWZ7.js.map → chunk-ZONDBN6H.js.map} +1 -1
- package/dist/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/{ddl-DvW9aobX.d.ts → ddl-2q7xLM1X.d.ts} +3 -3
- package/dist/{ddl-BjuXbPfw.d.cts → ddl-D_09BfbN.d.cts} +3 -3
- package/dist/graph-extension/index.d.cts +2 -2
- package/dist/graph-extension/index.d.ts +2 -2
- package/dist/graph-merge/index.cjs +156 -156
- package/dist/graph-merge/index.d.cts +7 -7
- package/dist/graph-merge/index.d.ts +7 -7
- package/dist/graph-merge/index.js +14 -14
- package/dist/{graph-templates-1vMqlPsu.d.cts → graph-templates-B5Q7oYAA.d.cts} +2 -2
- package/dist/{graph-templates-Y52w16dH.d.ts → graph-templates-D9N-Z9kw.d.ts} +2 -2
- package/dist/index.cjs +99 -99
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +18 -18
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/{ingestion-import-target-CCKeXZbW.d.ts → ingestion-import-target-B8EU6ug2.d.ts} +1 -1
- package/dist/{ingestion-import-target-774QRgkF.d.cts → ingestion-import-target-C5sHNFJF.d.cts} +1 -1
- package/dist/interchange/index.cjs +34 -34
- package/dist/interchange/index.d.cts +7 -7
- package/dist/interchange/index.d.ts +7 -7
- package/dist/interchange/index.js +11 -11
- package/dist/{local-store-impl-DFKS7QTV.js → local-store-impl-ERPNYOCL.js} +18 -18
- package/dist/{local-store-impl-DFKS7QTV.js.map → local-store-impl-ERPNYOCL.js.map} +1 -1
- package/dist/{local-store-impl-3E4VLFCI.cjs → local-store-impl-OUINMCYI.cjs} +22 -22
- package/dist/{local-store-impl-3E4VLFCI.cjs.map → local-store-impl-OUINMCYI.cjs.map} +1 -1
- package/dist/{pglite-store-impl-N63GGBU2.js → pglite-store-impl-DUJBQZS5.js} +18 -18
- package/dist/{pglite-store-impl-N63GGBU2.js.map → pglite-store-impl-DUJBQZS5.js.map} +1 -1
- package/dist/{pglite-store-impl-T75O3LVQ.cjs → pglite-store-impl-Z3SOOP75.cjs} +22 -22
- package/dist/{pglite-store-impl-T75O3LVQ.cjs.map → pglite-store-impl-Z3SOOP75.cjs.map} +1 -1
- package/dist/{postgres-C9gitL71.d.ts → postgres-BbTYW3b_.d.ts} +3 -3
- package/dist/{postgres-BONrXHb4.d.cts → postgres-DOBXcZVg.d.cts} +1 -1
- package/dist/{postgres-DAFRdnTr.d.ts → postgres-DhZixg92.d.ts} +1 -1
- package/dist/{postgres-2FYdVYCm.d.cts → postgres-Dp3MpyJt.d.cts} +3 -3
- package/dist/{profile-CAD65CqS.d.ts → profile-Ch5SSewK.d.ts} +8 -8
- package/dist/{profile-Bmcg07Ki.d.cts → profile-DppApFgt.d.cts} +8 -8
- package/dist/profiler/index.d.cts +8 -8
- package/dist/profiler/index.d.ts +8 -8
- package/dist/provenance/index.cjs +22 -22
- package/dist/provenance/index.d.cts +6 -6
- package/dist/provenance/index.d.ts +6 -6
- package/dist/provenance/index.js +6 -6
- package/dist/{repair-validity-windows-CinP91t7.d.cts → repair-validity-windows-CpP_GpIx.d.cts} +1 -1
- package/dist/{repair-validity-windows-BJz4nffP.d.ts → repair-validity-windows-lfe275bY.d.ts} +1 -1
- package/dist/{resolve-DgOSlXx_.d.ts → resolve-CoYqHqno.d.cts} +7 -2
- package/dist/{resolve-DQXSEN_A.d.cts → resolve-DV0Iposp.d.ts} +7 -2
- package/dist/schema/index.cjs +37 -37
- package/dist/schema/index.d.cts +7 -7
- package/dist/schema/index.d.ts +7 -7
- package/dist/schema/index.js +7 -7
- package/dist/{searchable-DMdCwkXO.d.cts → searchable-C7Xt6g45.d.cts} +1 -1
- package/dist/{searchable-BPRF0Bah.d.ts → searchable-KKXrPet3.d.ts} +1 -1
- package/dist/{sqlite-DgbYa-1Y.d.cts → sqlite-BkQM9ZeI.d.cts} +1 -1
- package/dist/{sqlite-Co_uIpfs.d.cts → sqlite-BpRtjC36.d.cts} +3 -3
- package/dist/{sqlite-DcDAAYow.d.ts → sqlite-CH0Zq0Qv.d.ts} +3 -3
- package/dist/{sqlite-UlG5prJQ.d.ts → sqlite-CcCSeXGg.d.ts} +1 -1
- package/dist/{store-HxoFyQMu.d.cts → store-3nfPQK5j.d.cts} +30 -7
- package/dist/{store-C9T1c9Az.d.ts → store-C8ZPl7OW.d.ts} +30 -7
- package/dist/{types-CRCyg1fJ.d.cts → types-BynPp5kU.d.cts} +18 -2
- package/dist/{types-CRCyg1fJ.d.ts → types-BynPp5kU.d.ts} +18 -2
- package/dist/{types-Dg_prBqC.d.ts → types-C9YwrkSe.d.ts} +1 -1
- package/dist/{types-B5AUesS1.d.cts → types-JG-4CG6P.d.cts} +1 -1
- package/dist/{where-gRyc3jj_.d.cts → where-D1gBDqQ_.d.cts} +1 -1
- package/dist/{where-D-NDKMPw.d.ts → where-D2GqMFp-.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-337ONI2I.js.map +0 -1
- package/dist/chunk-3KWF25MF.cjs.map +0 -1
- package/dist/chunk-3RSFLZ7A.cjs.map +0 -1
- package/dist/chunk-AD3NLSV5.js.map +0 -1
- package/dist/chunk-BWQA3POT.cjs.map +0 -1
- package/dist/chunk-MIBWA6HX.js.map +0 -1
- package/dist/chunk-OC5ROP7V.cjs.map +0 -1
- package/dist/chunk-PFXNQFFY.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunk5JOCIMQ3_cjs = require('./chunk-5JOCIMQ3.cjs');
|
|
4
|
+
var chunk7LQTDGV5_cjs = require('./chunk-7LQTDGV5.cjs');
|
|
5
|
+
var chunk6JRVV2SS_cjs = require('./chunk-6JRVV2SS.cjs');
|
|
6
6
|
var chunkL4L4AV6F_cjs = require('./chunk-L4L4AV6F.cjs');
|
|
7
7
|
var chunkXPSPDFKO_cjs = require('./chunk-XPSPDFKO.cjs');
|
|
8
8
|
var chunkBXHAPCQG_cjs = require('./chunk-BXHAPCQG.cjs');
|
|
@@ -100,6 +100,78 @@ function transactionNodeOperationHookRunner(transaction) {
|
|
|
100
100
|
}
|
|
101
101
|
return runtime.runNodeOperationHooks;
|
|
102
102
|
}
|
|
103
|
+
|
|
104
|
+
// src/errors/validation.ts
|
|
105
|
+
function zodIssuesToValidationIssues(error) {
|
|
106
|
+
return error.issues.map((issue) => ({
|
|
107
|
+
path: issue.path.join("."),
|
|
108
|
+
message: issue.message,
|
|
109
|
+
code: issue.code
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
function buildLocationString(context) {
|
|
113
|
+
if (context.id) {
|
|
114
|
+
return `${context.kind}/${context.id}`;
|
|
115
|
+
}
|
|
116
|
+
return `new ${context.kind}`;
|
|
117
|
+
}
|
|
118
|
+
function validateProps(schema, props, context) {
|
|
119
|
+
const result = schema.safeParse(props);
|
|
120
|
+
if (result.success) {
|
|
121
|
+
return result.data;
|
|
122
|
+
}
|
|
123
|
+
const issues = zodIssuesToValidationIssues(result.error);
|
|
124
|
+
const location = buildLocationString(context);
|
|
125
|
+
throw new chunk7XYPLAPL_cjs.ValidationError(
|
|
126
|
+
`Invalid ${context.entityType} props for ${location}: ${result.error.message}`,
|
|
127
|
+
{
|
|
128
|
+
entityType: context.entityType,
|
|
129
|
+
kind: context.kind,
|
|
130
|
+
operation: context.operation,
|
|
131
|
+
...context.id !== void 0 && { id: context.id },
|
|
132
|
+
issues
|
|
133
|
+
},
|
|
134
|
+
{ cause: result.error }
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
function validateNodeProps(schema, props, context) {
|
|
138
|
+
return validateProps(schema, props, {
|
|
139
|
+
entityType: "node",
|
|
140
|
+
...context
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function validateEdgeProps(schema, props, context) {
|
|
144
|
+
return validateProps(schema, props, {
|
|
145
|
+
entityType: "edge",
|
|
146
|
+
...context
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function wrapZodError(error, context) {
|
|
150
|
+
const issues = zodIssuesToValidationIssues(error);
|
|
151
|
+
const location = buildLocationString(context);
|
|
152
|
+
return new chunk7XYPLAPL_cjs.ValidationError(
|
|
153
|
+
`Validation failed for ${context.entityType} ${location}: ${error.message}`,
|
|
154
|
+
{
|
|
155
|
+
entityType: context.entityType,
|
|
156
|
+
kind: context.kind,
|
|
157
|
+
operation: context.operation,
|
|
158
|
+
...context.id !== void 0 && { id: context.id },
|
|
159
|
+
issues
|
|
160
|
+
},
|
|
161
|
+
{ cause: error }
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
function createValidationError(message, issues, context) {
|
|
165
|
+
return new chunk7XYPLAPL_cjs.ValidationError(message, {
|
|
166
|
+
...context?.entityType !== void 0 && {
|
|
167
|
+
entityType: context.entityType
|
|
168
|
+
},
|
|
169
|
+
...context?.kind !== void 0 && { kind: context.kind },
|
|
170
|
+
...context?.operation !== void 0 && { operation: context.operation },
|
|
171
|
+
...context?.id !== void 0 && { id: context.id },
|
|
172
|
+
issues
|
|
173
|
+
});
|
|
174
|
+
}
|
|
103
175
|
function generateId() {
|
|
104
176
|
return nanoid.nanoid();
|
|
105
177
|
}
|
|
@@ -119,7 +191,7 @@ function requireRecordedSchema(target) {
|
|
|
119
191
|
}
|
|
120
192
|
);
|
|
121
193
|
}
|
|
122
|
-
return
|
|
194
|
+
return chunk6JRVV2SS_cjs.createSqlSchema(target.tableNames);
|
|
123
195
|
}
|
|
124
196
|
function requireCaptureStatements(target) {
|
|
125
197
|
if (target.executeStatement === void 0) {
|
|
@@ -159,12 +231,12 @@ async function assertRecordedCaptureTransactionIsolation(target, options) {
|
|
|
159
231
|
if (!RECORDED_ISOLATION_REQUIRES_POSTGRES_CHECK[target.dialect]) return;
|
|
160
232
|
if (options?.accessMode === "read_only") return;
|
|
161
233
|
if (target.fenceSql === void 0) {
|
|
162
|
-
|
|
234
|
+
chunk6JRVV2SS_cjs.refuseFenceSqlSessionFactUnavailable(target.dialect);
|
|
163
235
|
}
|
|
164
236
|
const rows = await target.execute(
|
|
165
|
-
chunkXPSPDFKO_cjs.asCompiledRowsSql(
|
|
237
|
+
chunkXPSPDFKO_cjs.asCompiledRowsSql(chunk6JRVV2SS_cjs.resolveFenceStatements(target.fenceSql).isolationFact())
|
|
166
238
|
);
|
|
167
|
-
const isolationLevel =
|
|
239
|
+
const isolationLevel = chunk6JRVV2SS_cjs.normalizeGraphCommandIsolation(
|
|
168
240
|
rows[0]?.transaction_isolation
|
|
169
241
|
);
|
|
170
242
|
if (isolationLevel === "read_committed") return;
|
|
@@ -230,19 +302,19 @@ function rawWriteGuards(target, prefix) {
|
|
|
230
302
|
}
|
|
231
303
|
function assertCapturableBackend(backend) {
|
|
232
304
|
if (!backend.capabilities.execution.interactiveTransactions) {
|
|
233
|
-
const verdict =
|
|
305
|
+
const verdict = chunk5JOCIMQ3_cjs.resolveBatchWriteVerdict(backend, { needs: "history" });
|
|
234
306
|
throw new chunk7XYPLAPL_cjs.ConfigurationError(
|
|
235
|
-
"history: true requires a backend with transaction support." +
|
|
307
|
+
"history: true requires a backend with transaction support." + chunk5JOCIMQ3_cjs.batchRefusalSuffix(verdict),
|
|
236
308
|
{
|
|
237
309
|
dialect: backend.dialect,
|
|
238
|
-
...
|
|
310
|
+
...chunk5JOCIMQ3_cjs.batchRefusalDetails(verdict)
|
|
239
311
|
},
|
|
240
312
|
{
|
|
241
313
|
suggestion: "Use a transactional SQLite/PostgreSQL backend or disable recorded-time capture for this store."
|
|
242
314
|
}
|
|
243
315
|
);
|
|
244
316
|
}
|
|
245
|
-
if (!
|
|
317
|
+
if (!chunk7LQTDGV5_cjs.statementExecutionVerdict(backend).supported) {
|
|
246
318
|
throw new chunk7XYPLAPL_cjs.ConfigurationError(
|
|
247
319
|
"history: true requires a backend that supports executeStatement.",
|
|
248
320
|
{ dialect: backend.dialect },
|
|
@@ -272,19 +344,19 @@ function assertCapturableBackend(backend) {
|
|
|
272
344
|
}
|
|
273
345
|
function assertRevisionTrackableBackend(backend) {
|
|
274
346
|
if (!backend.capabilities.execution.interactiveTransactions) {
|
|
275
|
-
const verdict =
|
|
347
|
+
const verdict = chunk5JOCIMQ3_cjs.resolveBatchWriteVerdict(backend, { needs: "history" });
|
|
276
348
|
throw new chunk7XYPLAPL_cjs.ConfigurationError(
|
|
277
|
-
"revisionTracking: true requires a backend with transaction support." +
|
|
349
|
+
"revisionTracking: true requires a backend with transaction support." + chunk5JOCIMQ3_cjs.batchRefusalSuffix(verdict),
|
|
278
350
|
{
|
|
279
351
|
dialect: backend.dialect,
|
|
280
|
-
...
|
|
352
|
+
...chunk5JOCIMQ3_cjs.batchRefusalDetails(verdict)
|
|
281
353
|
},
|
|
282
354
|
{
|
|
283
355
|
suggestion: "Use a transactional SQLite/PostgreSQL backend or leave revision tracking disabled."
|
|
284
356
|
}
|
|
285
357
|
);
|
|
286
358
|
}
|
|
287
|
-
if (!
|
|
359
|
+
if (!chunk7LQTDGV5_cjs.statementExecutionVerdict(backend).supported) {
|
|
288
360
|
throw new chunk7XYPLAPL_cjs.ConfigurationError(
|
|
289
361
|
"revisionTracking: true requires a backend that supports executeStatement.",
|
|
290
362
|
{ dialect: backend.dialect },
|
|
@@ -302,7 +374,7 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
302
374
|
}
|
|
303
375
|
);
|
|
304
376
|
}
|
|
305
|
-
if (!
|
|
377
|
+
if (!chunk7LQTDGV5_cjs.recordedRevisionOriginsVerdict(backend).supported) {
|
|
306
378
|
throw new chunk7XYPLAPL_cjs.ConfigurationError(
|
|
307
379
|
"revisionTracking: true requires a backend that can bootstrap revision origins.",
|
|
308
380
|
{ dialect: backend.dialect },
|
|
@@ -317,13 +389,13 @@ function assertRevisionTrackableBackend(backend) {
|
|
|
317
389
|
var RECORDED_MIN_REVISION = 0;
|
|
318
390
|
var RECORDED_MIN_TIME = "1970-01-01T00:00:00.000Z";
|
|
319
391
|
var RECORDED_CLOCK_ADVISORY_LOCK_NAMESPACE = "typegraph:recorded-clock";
|
|
320
|
-
|
|
392
|
+
chunk6JRVV2SS_cjs.resolveFenceStatements(chunk5JOCIMQ3_cjs.postgresFenceSql);
|
|
321
393
|
var UNCOORDINATED_GRAPH_WRITE_LOCK = Object.freeze({
|
|
322
394
|
coordination: void 0
|
|
323
395
|
});
|
|
324
396
|
function acquiredGraphWriteLock(target, graphId, isolation) {
|
|
325
397
|
return Object.freeze({
|
|
326
|
-
coordination:
|
|
398
|
+
coordination: chunk6JRVV2SS_cjs.mintGraphCommandCoordination(
|
|
327
399
|
target.commands,
|
|
328
400
|
graphId,
|
|
329
401
|
isolation
|
|
@@ -352,16 +424,16 @@ async function acquireRecordedGraphWriteLock(target, fenceSql, graphId) {
|
|
|
352
424
|
const rows = await target.execute(
|
|
353
425
|
chunkXPSPDFKO_cjs.asCompiledRowsSql(
|
|
354
426
|
fenceSql.acquireKeyedWithIsolation(
|
|
355
|
-
|
|
427
|
+
chunk5JOCIMQ3_cjs.RECORDED_GRAPH_WRITE_ADVISORY_LOCK_NAMESPACE,
|
|
356
428
|
graphId
|
|
357
429
|
)
|
|
358
430
|
)
|
|
359
431
|
);
|
|
360
|
-
return
|
|
432
|
+
return chunk6JRVV2SS_cjs.normalizeGraphCommandIsolation(rows[0]?.transaction_isolation);
|
|
361
433
|
}
|
|
362
434
|
async function lockRecordedGraphWrite(target, graphId, memo) {
|
|
363
|
-
const plan =
|
|
364
|
-
const fence =
|
|
435
|
+
const plan = chunk6JRVV2SS_cjs.resolveWriteFencePlan(target);
|
|
436
|
+
const fence = chunk6JRVV2SS_cjs.requireWriteFence(plan, "recorded graph write", "keyed");
|
|
365
437
|
switch (fence.kind) {
|
|
366
438
|
case "engine-serialized":
|
|
367
439
|
case "caller-serialized": {
|
|
@@ -476,7 +548,7 @@ async function ensureRevisionOriginsRelation(target, verdict) {
|
|
|
476
548
|
);
|
|
477
549
|
}
|
|
478
550
|
if (ENSURED_ORIGINS_RELATIONS.has(target)) return;
|
|
479
|
-
const { ensureRevisionOriginsTable: ensureTable } =
|
|
551
|
+
const { ensureRevisionOriginsTable: ensureTable } = chunk6JRVV2SS_cjs.recordedRevisionOriginsMembers(target, verdict);
|
|
480
552
|
await ensureTable();
|
|
481
553
|
ENSURED_ORIGINS_RELATIONS.add(target);
|
|
482
554
|
}
|
|
@@ -533,8 +605,8 @@ async function assertRecordedClockAdvanced(target, schema, graphId, revision) {
|
|
|
533
605
|
);
|
|
534
606
|
}
|
|
535
607
|
async function lockRecordedClock(target, schema, graphId, ownsWriteLock) {
|
|
536
|
-
const plan =
|
|
537
|
-
const fence =
|
|
608
|
+
const plan = chunk6JRVV2SS_cjs.resolveWriteFencePlan(target);
|
|
609
|
+
const fence = chunk6JRVV2SS_cjs.requireWriteFence(plan, "recorded clock allocation", "keyed");
|
|
538
610
|
switch (fence.kind) {
|
|
539
611
|
case "lock":
|
|
540
612
|
case "row": {
|
|
@@ -765,7 +837,7 @@ function identityAssertionSnapshotSource(schema, graphId, coordinate, relation)
|
|
|
765
837
|
`;
|
|
766
838
|
}
|
|
767
839
|
function historicalIdentityReconstructionCtes(input) {
|
|
768
|
-
|
|
840
|
+
chunk6JRVV2SS_cjs.assertRecursiveTraversal(
|
|
769
841
|
input.recursiveTraversal,
|
|
770
842
|
"historical identity class read"
|
|
771
843
|
);
|
|
@@ -825,7 +897,7 @@ var IDENTITY_PEER_CLASS_COLUMNS = chunkXPSPDFKO_cjs.sql.raw(
|
|
|
825
897
|
["seed_kind", "seed_id", "kind", "id"].join(", ")
|
|
826
898
|
);
|
|
827
899
|
function historicalIdentityPeerClassQuery(input) {
|
|
828
|
-
|
|
900
|
+
chunk6JRVV2SS_cjs.assertRecursiveTraversal(
|
|
829
901
|
input.recursiveTraversal,
|
|
830
902
|
"historical identity expansion"
|
|
831
903
|
);
|
|
@@ -864,10 +936,10 @@ async function getRowsByIds(ids, policy) {
|
|
|
864
936
|
|
|
865
937
|
// src/store/edge-fetch.ts
|
|
866
938
|
async function getEdgeRowsByIds(backend, verdict, graphId, ids) {
|
|
867
|
-
const bound =
|
|
939
|
+
const bound = chunk6JRVV2SS_cjs.bindExtraIfReachable(
|
|
868
940
|
backend,
|
|
869
941
|
verdict.extras.getEdges,
|
|
870
|
-
|
|
942
|
+
chunk6JRVV2SS_cjs.BATCH_POINT_READ.id
|
|
871
943
|
);
|
|
872
944
|
return getRowsByIds(ids, {
|
|
873
945
|
batch: bound === void 0 ? void 0 : ((batchIds) => bound.getEdges(graphId, batchIds)),
|
|
@@ -877,10 +949,10 @@ async function getEdgeRowsByIds(backend, verdict, graphId, ids) {
|
|
|
877
949
|
|
|
878
950
|
// src/store/node-fetch.ts
|
|
879
951
|
async function getNodeRowsByIds(backend, verdict, graphId, kind, ids) {
|
|
880
|
-
const bound =
|
|
952
|
+
const bound = chunk6JRVV2SS_cjs.bindExtraIfReachable(
|
|
881
953
|
backend,
|
|
882
954
|
verdict.extras.getNodes,
|
|
883
|
-
|
|
955
|
+
chunk6JRVV2SS_cjs.BATCH_POINT_READ.id
|
|
884
956
|
);
|
|
885
957
|
return getRowsByIds(ids, {
|
|
886
958
|
batch: bound === void 0 ? void 0 : ((batchIds) => bound.getNodes(graphId, kind, batchIds)),
|
|
@@ -984,7 +1056,7 @@ function recordedCommonCells() {
|
|
|
984
1056
|
graph_id: (row) => chunkXPSPDFKO_cjs.sql`${row.graph_id}`,
|
|
985
1057
|
id: (row) => chunkXPSPDFKO_cjs.sql`${row.id}`,
|
|
986
1058
|
kind: (row) => chunkXPSPDFKO_cjs.sql`${row.kind}`,
|
|
987
|
-
props: (row) => chunkXPSPDFKO_cjs.sql`${
|
|
1059
|
+
props: (row) => chunkXPSPDFKO_cjs.sql`${chunk6JRVV2SS_cjs.rowPropsToJsonText(row.props)}`,
|
|
988
1060
|
valid_from: (row) => chunkXPSPDFKO_cjs.sql`${sqlNull(row.valid_from)}`,
|
|
989
1061
|
valid_to: (row) => chunkXPSPDFKO_cjs.sql`${sqlNull(row.valid_to)}`,
|
|
990
1062
|
created_at: (row) => chunkXPSPDFKO_cjs.sql`${row.created_at}`,
|
|
@@ -1120,7 +1192,7 @@ async function closeOpenReturning(target, table, graphId, ids, recordedRevision,
|
|
|
1120
1192
|
WHERE graph_id = ${graphId}
|
|
1121
1193
|
${kindFilter}
|
|
1122
1194
|
AND recorded_to = ${chunkL4L4AV6F_cjs.RECORDED_MAX_REVISION}
|
|
1123
|
-
AND id IN (${
|
|
1195
|
+
AND id IN (${chunk5JOCIMQ3_cjs.sqlValueList(ids)})
|
|
1124
1196
|
RETURNING id, deleted_at
|
|
1125
1197
|
`)
|
|
1126
1198
|
);
|
|
@@ -1164,7 +1236,7 @@ function recordedInsertsFor(afterById, closed) {
|
|
|
1164
1236
|
async function flushNodes(target, batchPointRead, schema, graphId, entities, recordedRevision) {
|
|
1165
1237
|
const chunkSize = recordedNodeChunkSize(target);
|
|
1166
1238
|
for (const [kind, group] of groupNodesByKind(entities)) {
|
|
1167
|
-
for (const entityChunk of
|
|
1239
|
+
for (const entityChunk of chunk5JOCIMQ3_cjs.chunk(group, chunkSize)) {
|
|
1168
1240
|
const ids = entityChunk.map((entity) => entity.id);
|
|
1169
1241
|
const closed = await closeOpenReturning(
|
|
1170
1242
|
target,
|
|
@@ -1189,7 +1261,7 @@ async function flushNodes(target, batchPointRead, schema, graphId, entities, rec
|
|
|
1189
1261
|
}
|
|
1190
1262
|
async function flushEdges(target, batchPointRead, schema, graphId, entities, recordedRevision) {
|
|
1191
1263
|
const chunkSize = recordedEdgeChunkSize(target);
|
|
1192
|
-
for (const entityChunk of
|
|
1264
|
+
for (const entityChunk of chunk5JOCIMQ3_cjs.chunk(entities, chunkSize)) {
|
|
1193
1265
|
const ids = entityChunk.map((entity) => entity.id);
|
|
1194
1266
|
const closed = await closeOpenReturning(
|
|
1195
1267
|
target,
|
|
@@ -1217,7 +1289,7 @@ async function getIdentityAssertionRowsByIds(target, schema, graphId, ids) {
|
|
|
1217
1289
|
SELECT ${IDENTITY_ASSERTION_COLUMNS}
|
|
1218
1290
|
FROM ${schema.identityAssertionsTable}
|
|
1219
1291
|
WHERE graph_id = ${graphId}
|
|
1220
|
-
AND id IN (${
|
|
1292
|
+
AND id IN (${chunk5JOCIMQ3_cjs.sqlValueList(ids)})
|
|
1221
1293
|
`)
|
|
1222
1294
|
);
|
|
1223
1295
|
return new Map(rows.map((row) => [row.id, row]));
|
|
@@ -1225,7 +1297,7 @@ async function getIdentityAssertionRowsByIds(target, schema, graphId, ids) {
|
|
|
1225
1297
|
async function flushIdentityAssertions(target, schema, graphId, entities, recordedRevision) {
|
|
1226
1298
|
if (entities.length === 0) return;
|
|
1227
1299
|
const chunkSize = recordedIdentityAssertionChunkSize(target);
|
|
1228
|
-
for (const entityChunk of
|
|
1300
|
+
for (const entityChunk of chunk5JOCIMQ3_cjs.chunk(entities, chunkSize)) {
|
|
1229
1301
|
const ids = entityChunk.map((entity) => entity.id);
|
|
1230
1302
|
const closed = await closeOpenReturning(
|
|
1231
1303
|
target,
|
|
@@ -1421,6 +1493,18 @@ function buildRecordedWriteMembers(target, sink, hooks = {}) {
|
|
|
1421
1493
|
sink.touchNode(params.graphId, params.kind, params.id, row);
|
|
1422
1494
|
return row;
|
|
1423
1495
|
},
|
|
1496
|
+
...target.upsertHeterogeneousNodes === void 0 ? {} : {
|
|
1497
|
+
async upsertHeterogeneousNodes(params) {
|
|
1498
|
+
await hooks.beforeOne?.(params.schemaFence.graphId);
|
|
1499
|
+
const rows = await chunkBXHAPCQG_cjs.requireDefined(target.upsertHeterogeneousNodes)(
|
|
1500
|
+
params
|
|
1501
|
+
);
|
|
1502
|
+
for (const row of rows) {
|
|
1503
|
+
sink.touchNode(row.graph_id, row.kind, row.id, row);
|
|
1504
|
+
}
|
|
1505
|
+
return rows;
|
|
1506
|
+
}
|
|
1507
|
+
},
|
|
1424
1508
|
...target.updateResolvedNodesBatch === void 0 ? {} : {
|
|
1425
1509
|
async updateResolvedNodesBatch(params) {
|
|
1426
1510
|
if (params.entries.length === 0) return [];
|
|
@@ -1562,7 +1646,7 @@ function buildRecordedCommandsPort(target, sink, hooks = {}) {
|
|
|
1562
1646
|
execute: async (command, context) => {
|
|
1563
1647
|
await hooks.beforeOne?.(command.plan.params.graphId);
|
|
1564
1648
|
const result = await target.commands.execute(command, context);
|
|
1565
|
-
|
|
1649
|
+
chunk6JRVV2SS_cjs.assertCommandResultMatchesCommand(command, result);
|
|
1566
1650
|
if (result.outcome === "created") {
|
|
1567
1651
|
if (result.entity === "node") {
|
|
1568
1652
|
sink.touchNode(
|
|
@@ -1598,7 +1682,7 @@ function createMutationWitness() {
|
|
|
1598
1682
|
};
|
|
1599
1683
|
return {
|
|
1600
1684
|
wrap(target) {
|
|
1601
|
-
return
|
|
1685
|
+
return chunk6JRVV2SS_cjs.deriveBackend(target, {
|
|
1602
1686
|
...buildRecordedWriteMembers(target, sink),
|
|
1603
1687
|
commands: buildRecordedCommandsPort(target, sink)
|
|
1604
1688
|
});
|
|
@@ -1764,12 +1848,12 @@ function resolveLineage(store) {
|
|
|
1764
1848
|
|
|
1765
1849
|
// src/store/recorded-capture/schema-version.ts
|
|
1766
1850
|
async function readColumnTypes(backend, table) {
|
|
1767
|
-
const catalog =
|
|
1851
|
+
const catalog = chunk7LQTDGV5_cjs.requireCatalog(backend, "assertCurrentRecordedSchema");
|
|
1768
1852
|
const columns = await catalog.columnTypes(table);
|
|
1769
1853
|
return new Map(columns.map((column) => [column.name, column]));
|
|
1770
1854
|
}
|
|
1771
1855
|
function isCompatibleColumnKind(kind, actual) {
|
|
1772
|
-
const allowed = kind === "revision" ?
|
|
1856
|
+
const allowed = kind === "revision" ? chunk7LQTDGV5_cjs.REVISION_COLUMN_KINDS : chunk7LQTDGV5_cjs.WALL_TIME_COLUMN_KINDS;
|
|
1773
1857
|
return allowed.includes(actual);
|
|
1774
1858
|
}
|
|
1775
1859
|
function requiredRecordedColumns(schema, includeIdentity) {
|
|
@@ -1951,7 +2035,7 @@ function createRecordedCaptureSession() {
|
|
|
1951
2035
|
if (touched.size === 0 && forcedGraphRevisions.size === 0)
|
|
1952
2036
|
return /* @__PURE__ */ new Map();
|
|
1953
2037
|
const recordedByGraph = /* @__PURE__ */ new Map();
|
|
1954
|
-
const byGraph =
|
|
2038
|
+
const byGraph = chunk5JOCIMQ3_cjs.groupBy(touched.values(), (entity) => entity.graphId);
|
|
1955
2039
|
for (const graphId of forcedGraphRevisions) {
|
|
1956
2040
|
if (!byGraph.has(graphId)) byGraph.set(graphId, []);
|
|
1957
2041
|
}
|
|
@@ -2005,7 +2089,7 @@ function createRecordedCaptureSession() {
|
|
|
2005
2089
|
var recordedTransactionBindings = /* @__PURE__ */ new WeakMap();
|
|
2006
2090
|
var recordedRevisionBindings = /* @__PURE__ */ new WeakMap();
|
|
2007
2091
|
function inheritRecordedTransactionBindings(source, derived, assertScopeOpen) {
|
|
2008
|
-
if (!
|
|
2092
|
+
if (!chunk6JRVV2SS_cjs.isBackendDerivedFrom(derived, source)) {
|
|
2009
2093
|
throw new TypeError("Capture bindings require a derived backend.");
|
|
2010
2094
|
}
|
|
2011
2095
|
const binding = recordedTransactionBindings.get(source);
|
|
@@ -2028,7 +2112,7 @@ async function runRecordedTransactionSavepoint(target, statementExecution, savep
|
|
|
2028
2112
|
const binding = recordedTransactionBindings.get(target);
|
|
2029
2113
|
binding?.assertOpen();
|
|
2030
2114
|
const rawTarget = binding?.target ?? target;
|
|
2031
|
-
const { executeStatement: executeStatement2 } =
|
|
2115
|
+
const { executeStatement: executeStatement2 } = chunk6JRVV2SS_cjs.statementExecutionMembers(
|
|
2032
2116
|
rawTarget,
|
|
2033
2117
|
statementExecution
|
|
2034
2118
|
);
|
|
@@ -2116,6 +2200,23 @@ function registerRecordedIdentityMutationWitness(overlay, target, sink) {
|
|
|
2116
2200
|
recordedTransactionBindings.set(overlay, binding);
|
|
2117
2201
|
recordedTransactionBindings.set(target, binding);
|
|
2118
2202
|
}
|
|
2203
|
+
async function withRecordedNodeMutationTarget(target, graphId, run) {
|
|
2204
|
+
const binding = recordedTransactionBindings.get(target);
|
|
2205
|
+
if (binding === void 0) return run(target);
|
|
2206
|
+
binding.assertOpen();
|
|
2207
|
+
if (binding.capture !== void 0) {
|
|
2208
|
+
await lockRecordedGraphWrite(
|
|
2209
|
+
binding.target,
|
|
2210
|
+
graphId,
|
|
2211
|
+
binding.capture.graphLocks
|
|
2212
|
+
);
|
|
2213
|
+
}
|
|
2214
|
+
const rows = await run(binding.target);
|
|
2215
|
+
for (const row of rows) {
|
|
2216
|
+
binding.sink.touchNode(row.graph_id, row.kind, row.id, row);
|
|
2217
|
+
}
|
|
2218
|
+
return rows;
|
|
2219
|
+
}
|
|
2119
2220
|
function createRecordedTransactionBackend(target, session, schema) {
|
|
2120
2221
|
const graphLocks = createRecordedGraphLockMemo();
|
|
2121
2222
|
async function lockGraph(graphId) {
|
|
@@ -2145,7 +2246,7 @@ function createRecordedTransactionBackend(target, session, schema) {
|
|
|
2145
2246
|
},
|
|
2146
2247
|
connectedEdgeIdsForHardDelete: (params) => queryConnectedEdgeIds(target, schema, params)
|
|
2147
2248
|
};
|
|
2148
|
-
const overlay =
|
|
2249
|
+
const overlay = chunk6JRVV2SS_cjs.deriveBackend(target, {
|
|
2149
2250
|
...rawWriteGuards(target, "tx.backend"),
|
|
2150
2251
|
...buildRecordedWriteMembers(target, sink, hooks),
|
|
2151
2252
|
commands: buildRecordedCommandsPort(target, sink, hooks)
|
|
@@ -2169,7 +2270,7 @@ function createRecordedTransactionScope(target, batchPointRead, schema, ownsWrit
|
|
|
2169
2270
|
return {
|
|
2170
2271
|
backend: createRecordedTransactionBackend(target, session, resolvedSchema),
|
|
2171
2272
|
async flush() {
|
|
2172
|
-
return
|
|
2273
|
+
return chunk6JRVV2SS_cjs.withRecordedRelationsPrecondition(
|
|
2173
2274
|
session.flush(target, batchPointRead, resolvedSchema, ownsWriteLock),
|
|
2174
2275
|
{ dialect: target.dialect, surface: "capture-flush" }
|
|
2175
2276
|
);
|
|
@@ -2193,10 +2294,10 @@ async function runCapturedAutocommit(backend, schema, batchPointRead, fn, option
|
|
|
2193
2294
|
}
|
|
2194
2295
|
function createRecordedBackend(backend, schema) {
|
|
2195
2296
|
assertCapturableBackend(backend);
|
|
2196
|
-
const batchPointRead =
|
|
2297
|
+
const batchPointRead = chunk7LQTDGV5_cjs.batchPointReadVerdict(backend);
|
|
2197
2298
|
const capture = (fn) => runCapturedAutocommit(backend, schema, batchPointRead, fn);
|
|
2198
|
-
const projectedBackend =
|
|
2199
|
-
return
|
|
2299
|
+
const projectedBackend = chunk6JRVV2SS_cjs.projectGraphBackend(backend);
|
|
2300
|
+
return chunk6JRVV2SS_cjs.deriveBackend(projectedBackend, {
|
|
2200
2301
|
...rawWriteGuards(backend, "backend"),
|
|
2201
2302
|
async insertNode(params) {
|
|
2202
2303
|
return capture((target) => target.insertNode(params));
|
|
@@ -2231,7 +2332,7 @@ function createRecordedBackend(backend, schema) {
|
|
|
2231
2332
|
commands: {
|
|
2232
2333
|
session: "root",
|
|
2233
2334
|
execute: async (command, context) => {
|
|
2234
|
-
|
|
2335
|
+
chunk6JRVV2SS_cjs.assertGraphCommandExecutionContext(context);
|
|
2235
2336
|
if (context.session !== "root") {
|
|
2236
2337
|
throw new chunk7XYPLAPL_cjs.CompilerInvariantError(
|
|
2237
2338
|
"A recorded root command received a transaction execution context.",
|
|
@@ -2239,7 +2340,7 @@ function createRecordedBackend(backend, schema) {
|
|
|
2239
2340
|
);
|
|
2240
2341
|
}
|
|
2241
2342
|
const result = await capture(
|
|
2242
|
-
(target) =>
|
|
2343
|
+
(target) => chunk6JRVV2SS_cjs.executeAuthoritativeGraphCommand(target.commands, command)
|
|
2243
2344
|
);
|
|
2244
2345
|
return result;
|
|
2245
2346
|
}
|
|
@@ -2268,6 +2369,20 @@ function createRecordedBackend(backend, schema) {
|
|
|
2268
2369
|
async updateNode(params) {
|
|
2269
2370
|
return capture((target) => target.updateNode(params));
|
|
2270
2371
|
},
|
|
2372
|
+
...backend.upsertHeterogeneousNodes === void 0 ? {} : {
|
|
2373
|
+
async upsertHeterogeneousNodes(params) {
|
|
2374
|
+
return capture((target) => {
|
|
2375
|
+
const upsert = target.upsertHeterogeneousNodes;
|
|
2376
|
+
if (upsert === void 0) {
|
|
2377
|
+
throw new chunk7XYPLAPL_cjs.ConfigurationError(
|
|
2378
|
+
"Recorded heterogeneous node upsert capability disappeared inside a transaction.",
|
|
2379
|
+
{ operation: "upsertHeterogeneousNodes" }
|
|
2380
|
+
);
|
|
2381
|
+
}
|
|
2382
|
+
return upsert(params);
|
|
2383
|
+
});
|
|
2384
|
+
}
|
|
2385
|
+
},
|
|
2271
2386
|
...backend.updateResolvedNodesBatch === void 0 ? {} : {
|
|
2272
2387
|
async updateResolvedNodesBatch(params) {
|
|
2273
2388
|
return capture((target) => {
|
|
@@ -2392,78 +2507,6 @@ function createRecordedBackend(backend, schema) {
|
|
|
2392
2507
|
});
|
|
2393
2508
|
}
|
|
2394
2509
|
|
|
2395
|
-
// src/errors/validation.ts
|
|
2396
|
-
function zodIssuesToValidationIssues(error) {
|
|
2397
|
-
return error.issues.map((issue) => ({
|
|
2398
|
-
path: issue.path.join("."),
|
|
2399
|
-
message: issue.message,
|
|
2400
|
-
code: issue.code
|
|
2401
|
-
}));
|
|
2402
|
-
}
|
|
2403
|
-
function buildLocationString(context) {
|
|
2404
|
-
if (context.id) {
|
|
2405
|
-
return `${context.kind}/${context.id}`;
|
|
2406
|
-
}
|
|
2407
|
-
return `new ${context.kind}`;
|
|
2408
|
-
}
|
|
2409
|
-
function validateProps(schema, props, context) {
|
|
2410
|
-
const result = schema.safeParse(props);
|
|
2411
|
-
if (result.success) {
|
|
2412
|
-
return result.data;
|
|
2413
|
-
}
|
|
2414
|
-
const issues = zodIssuesToValidationIssues(result.error);
|
|
2415
|
-
const location = buildLocationString(context);
|
|
2416
|
-
throw new chunk7XYPLAPL_cjs.ValidationError(
|
|
2417
|
-
`Invalid ${context.entityType} props for ${location}: ${result.error.message}`,
|
|
2418
|
-
{
|
|
2419
|
-
entityType: context.entityType,
|
|
2420
|
-
kind: context.kind,
|
|
2421
|
-
operation: context.operation,
|
|
2422
|
-
...context.id !== void 0 && { id: context.id },
|
|
2423
|
-
issues
|
|
2424
|
-
},
|
|
2425
|
-
{ cause: result.error }
|
|
2426
|
-
);
|
|
2427
|
-
}
|
|
2428
|
-
function validateNodeProps(schema, props, context) {
|
|
2429
|
-
return validateProps(schema, props, {
|
|
2430
|
-
entityType: "node",
|
|
2431
|
-
...context
|
|
2432
|
-
});
|
|
2433
|
-
}
|
|
2434
|
-
function validateEdgeProps(schema, props, context) {
|
|
2435
|
-
return validateProps(schema, props, {
|
|
2436
|
-
entityType: "edge",
|
|
2437
|
-
...context
|
|
2438
|
-
});
|
|
2439
|
-
}
|
|
2440
|
-
function wrapZodError(error, context) {
|
|
2441
|
-
const issues = zodIssuesToValidationIssues(error);
|
|
2442
|
-
const location = buildLocationString(context);
|
|
2443
|
-
return new chunk7XYPLAPL_cjs.ValidationError(
|
|
2444
|
-
`Validation failed for ${context.entityType} ${location}: ${error.message}`,
|
|
2445
|
-
{
|
|
2446
|
-
entityType: context.entityType,
|
|
2447
|
-
kind: context.kind,
|
|
2448
|
-
operation: context.operation,
|
|
2449
|
-
...context.id !== void 0 && { id: context.id },
|
|
2450
|
-
issues
|
|
2451
|
-
},
|
|
2452
|
-
{ cause: error }
|
|
2453
|
-
);
|
|
2454
|
-
}
|
|
2455
|
-
function createValidationError(message, issues, context) {
|
|
2456
|
-
return new chunk7XYPLAPL_cjs.ValidationError(message, {
|
|
2457
|
-
...context?.entityType !== void 0 && {
|
|
2458
|
-
entityType: context.entityType
|
|
2459
|
-
},
|
|
2460
|
-
...context?.kind !== void 0 && { kind: context.kind },
|
|
2461
|
-
...context?.operation !== void 0 && { operation: context.operation },
|
|
2462
|
-
...context?.id !== void 0 && { id: context.id },
|
|
2463
|
-
issues
|
|
2464
|
-
});
|
|
2465
|
-
}
|
|
2466
|
-
|
|
2467
2510
|
// src/store/operations/write-transaction.ts
|
|
2468
2511
|
var writeTransactionSessions = /* @__PURE__ */ new WeakMap();
|
|
2469
2512
|
var leasedSchemaFences = /* @__PURE__ */ new WeakMap();
|
|
@@ -2485,7 +2528,7 @@ function memoizeLeasedSchemaFence(ctx, target) {
|
|
|
2485
2528
|
}
|
|
2486
2529
|
async function withTransactionSchemaFenceLease(ctx, target, fn) {
|
|
2487
2530
|
const expectedVersion = ctx.schemaVersion;
|
|
2488
|
-
if (expectedVersion === void 0 || !
|
|
2531
|
+
if (expectedVersion === void 0 || !chunk6JRVV2SS_cjs.isFirstPartyFactory(target)) {
|
|
2489
2532
|
return fn();
|
|
2490
2533
|
}
|
|
2491
2534
|
leasedSchemaFences.set(target, /* @__PURE__ */ new Map());
|
|
@@ -2495,16 +2538,39 @@ async function withTransactionSchemaFenceLease(ctx, target, fn) {
|
|
|
2495
2538
|
leasedSchemaFences.delete(target);
|
|
2496
2539
|
}
|
|
2497
2540
|
}
|
|
2541
|
+
async function withPreAcquiredTransactionSchemaFenceLease(ctx, targets, fn) {
|
|
2542
|
+
const expectedVersion = ctx.schemaVersion;
|
|
2543
|
+
if (expectedVersion === void 0) return fn();
|
|
2544
|
+
const leases = /* @__PURE__ */ new Map([
|
|
2545
|
+
[schemaFenceLeaseKey(ctx.graphId, expectedVersion), Promise.resolve()]
|
|
2546
|
+
]);
|
|
2547
|
+
const uniqueTargets = [...new Set(targets)];
|
|
2548
|
+
const previousLeases = /* @__PURE__ */ new Map();
|
|
2549
|
+
for (const target of uniqueTargets) {
|
|
2550
|
+
previousLeases.set(target, leasedSchemaFences.get(target));
|
|
2551
|
+
leasedSchemaFences.set(target, leases);
|
|
2552
|
+
}
|
|
2553
|
+
try {
|
|
2554
|
+
return await fn();
|
|
2555
|
+
} finally {
|
|
2556
|
+
for (const target of uniqueTargets) {
|
|
2557
|
+
if (leasedSchemaFences.get(target) !== leases) continue;
|
|
2558
|
+
const previous = previousLeases.get(target);
|
|
2559
|
+
if (previous === void 0) leasedSchemaFences.delete(target);
|
|
2560
|
+
else leasedSchemaFences.set(target, previous);
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2498
2564
|
function hasPendingWriteTransactionRevision(target) {
|
|
2499
2565
|
return writeTransactionSessions.get(target)?.wrote === true;
|
|
2500
2566
|
}
|
|
2501
2567
|
async function ensureEngineSerializedWriterSlot(target, schema, statementExecution) {
|
|
2502
|
-
const { executeStatement: executeStatement2 } =
|
|
2568
|
+
const { executeStatement: executeStatement2 } = chunk6JRVV2SS_cjs.statementExecutionMembers(
|
|
2503
2569
|
recordedTransactionControlTarget(target),
|
|
2504
2570
|
statementExecution
|
|
2505
2571
|
);
|
|
2506
2572
|
await executeStatement2(
|
|
2507
|
-
|
|
2573
|
+
chunk5JOCIMQ3_cjs.engineSerializedWriterSlotStatement(schema.nodesTable)
|
|
2508
2574
|
);
|
|
2509
2575
|
}
|
|
2510
2576
|
function forceWriteTransactionRevision(target) {
|
|
@@ -2528,7 +2594,7 @@ function adoptedConstraintWriterSlotError(ctx, cause) {
|
|
|
2528
2594
|
);
|
|
2529
2595
|
}
|
|
2530
2596
|
async function ensureAdoptedConstraintWriterSlot(ctx, target, transactionMode, fenceReason) {
|
|
2531
|
-
if (fenceReason === void 0 || transactionMode !== "existing" || writeTransactionSessions.has(target) ||
|
|
2597
|
+
if (fenceReason === void 0 || transactionMode !== "existing" || writeTransactionSessions.has(target) || chunk6JRVV2SS_cjs.resolveWriteFencePlan(target).kind !== "engine-serialized") {
|
|
2532
2598
|
return;
|
|
2533
2599
|
}
|
|
2534
2600
|
const statementExecution = ctx.statementExecution;
|
|
@@ -2552,7 +2618,7 @@ async function ensureAdoptedConstraintWriterSlot(ctx, target, transactionMode, f
|
|
|
2552
2618
|
statementExecution
|
|
2553
2619
|
);
|
|
2554
2620
|
} catch (error) {
|
|
2555
|
-
if (!
|
|
2621
|
+
if (!chunk6JRVV2SS_cjs.isSqliteStaleSnapshotError(error)) throw error;
|
|
2556
2622
|
throw adoptedConstraintWriterSlotError(ctx, error);
|
|
2557
2623
|
}
|
|
2558
2624
|
}
|
|
@@ -2633,7 +2699,7 @@ function resolveWriteTransactionMode(backend) {
|
|
|
2633
2699
|
return backend.capabilities.execution.interactiveTransactions ? "opened" : "none";
|
|
2634
2700
|
}
|
|
2635
2701
|
function requiresOptimisticRetryUnit(backend) {
|
|
2636
|
-
return
|
|
2702
|
+
return chunk5JOCIMQ3_cjs.isOptimisticRetryTier(backend) && resolveWriteTransactionMode(backend) === "opened";
|
|
2637
2703
|
}
|
|
2638
2704
|
var CONSTRAINT_FENCE_ADVICE = {
|
|
2639
2705
|
edgeCardinality: 'declare the edge `cardinality: "many"` and enforce the limit in application code',
|
|
@@ -2646,16 +2712,16 @@ function constraintFenceRefusal(ctx, backend, reason) {
|
|
|
2646
2712
|
if (!("transaction" in backend) || backend.capabilities.execution.interactiveTransactions) {
|
|
2647
2713
|
return void 0;
|
|
2648
2714
|
}
|
|
2649
|
-
const verdict =
|
|
2715
|
+
const verdict = chunk5JOCIMQ3_cjs.resolveBatchWriteVerdict(backend, {
|
|
2650
2716
|
needs: "constraint-needs-probe"
|
|
2651
2717
|
});
|
|
2652
2718
|
return new chunk7XYPLAPL_cjs.ConfigurationError(
|
|
2653
|
-
"This backend cannot fence a constrained write: enforcing a declared constraint requires a transaction \u2014 to scope the per-graph write lock to, and to commit a reservation row together with the row it gates \u2014 and this backend has no transactions." +
|
|
2719
|
+
"This backend cannot fence a constrained write: enforcing a declared constraint requires a transaction \u2014 to scope the per-graph write lock to, and to commit a reservation row together with the row it gates \u2014 and this backend has no transactions." + chunk5JOCIMQ3_cjs.batchRefusalSuffix(verdict),
|
|
2654
2720
|
{
|
|
2655
2721
|
code: "CONSTRAINT_WRITE_FENCE_UNSUPPORTED",
|
|
2656
2722
|
graphId: ctx.graphId,
|
|
2657
2723
|
constraint: reason,
|
|
2658
|
-
...
|
|
2724
|
+
...chunk5JOCIMQ3_cjs.batchRefusalDetails(verdict)
|
|
2659
2725
|
},
|
|
2660
2726
|
{
|
|
2661
2727
|
suggestion: `Use a transactional backend, or ${CONSTRAINT_FENCE_ADVICE[reason]}. Unconstrained writes need no fence and keep working on this backend.`
|
|
@@ -2669,10 +2735,10 @@ function runInWriteTransaction(ctx, backend, fn, options) {
|
|
|
2669
2735
|
if (refusal !== void 0) return Promise.reject(refusal);
|
|
2670
2736
|
const attempt = () => runInWriteTransactionAttempt(ctx, backend, fn, options, transactionMode);
|
|
2671
2737
|
if (!requiresOptimisticRetryUnit(backend)) return attempt();
|
|
2672
|
-
return
|
|
2738
|
+
return chunk5JOCIMQ3_cjs.runRetriedUnit(
|
|
2673
2739
|
{
|
|
2674
2740
|
operation: "runInWriteTransaction",
|
|
2675
|
-
attempts:
|
|
2741
|
+
attempts: chunk5JOCIMQ3_cjs.OPTIMISTIC_RETRY_ATTEMPTS,
|
|
2676
2742
|
target: backend
|
|
2677
2743
|
},
|
|
2678
2744
|
attempt
|
|
@@ -2682,7 +2748,7 @@ function runInWriteTransactionAttempt(ctx, backend, fn, options, transactionMode
|
|
|
2682
2748
|
const ownsWriteLock = transactionMode === "opened";
|
|
2683
2749
|
const fenceReason = options?.fencesConstraintProbe;
|
|
2684
2750
|
const needsGraphWriteLock = ctx.historyEnabled || ctx.revisionTrackingEnabled || fenceReason !== void 0;
|
|
2685
|
-
return
|
|
2751
|
+
return chunk6JRVV2SS_cjs.runOptionallyInTransaction(backend, async (target) => {
|
|
2686
2752
|
await ensureAdoptedConstraintWriterSlot(
|
|
2687
2753
|
ctx,
|
|
2688
2754
|
target,
|
|
@@ -2695,7 +2761,7 @@ function runInWriteTransactionAttempt(ctx, backend, fn, options, transactionMode
|
|
|
2695
2761
|
const acquiresLock = needsGraphWriteLock && session?.lock === void 0 && !held.has(ctx.graphId);
|
|
2696
2762
|
if (acquiresLock) held.add(ctx.graphId);
|
|
2697
2763
|
const expectedSchemaVersion = ctx.schemaVersion;
|
|
2698
|
-
const combinedSchemaGraphFence = !options?.schemaFenceInFirstWrite && expectedSchemaVersion !== void 0 && acquiresLock && !("transaction" in target) ? {
|
|
2764
|
+
const combinedSchemaGraphFence = !options?.schemaFenceInFirstWrite && expectedSchemaVersion !== void 0 && acquiresLock && !("transaction" in target) && !hasLeasedSchemaFence(ctx, target) ? {
|
|
2699
2765
|
acquire: target.lockSchemaVersionAndGraphWrite,
|
|
2700
2766
|
params: {
|
|
2701
2767
|
graphId: ctx.graphId,
|
|
@@ -2822,10 +2888,12 @@ exports.uncapturedGraphWriteLock = uncapturedGraphWriteLock;
|
|
|
2822
2888
|
exports.validateEdgeProps = validateEdgeProps;
|
|
2823
2889
|
exports.validateNodeProps = validateNodeProps;
|
|
2824
2890
|
exports.validateProps = validateProps;
|
|
2891
|
+
exports.withPreAcquiredTransactionSchemaFenceLease = withPreAcquiredTransactionSchemaFenceLease;
|
|
2825
2892
|
exports.withRecordedFlushObserver = withRecordedFlushObserver;
|
|
2826
2893
|
exports.withRecordedIdentityMutationTarget = withRecordedIdentityMutationTarget;
|
|
2894
|
+
exports.withRecordedNodeMutationTarget = withRecordedNodeMutationTarget;
|
|
2827
2895
|
exports.withTransactionSchemaFenceLease = withTransactionSchemaFenceLease;
|
|
2828
2896
|
exports.withWriteTransactionSession = withWriteTransactionSession;
|
|
2829
2897
|
exports.wrapZodError = wrapZodError;
|
|
2830
|
-
//# sourceMappingURL=chunk-
|
|
2831
|
-
//# sourceMappingURL=chunk-
|
|
2898
|
+
//# sourceMappingURL=chunk-6B3LQUYG.cjs.map
|
|
2899
|
+
//# sourceMappingURL=chunk-6B3LQUYG.cjs.map
|