@nicia-ai/typegraph 0.47.0 → 0.48.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/drizzle/indexes.d.cts +1 -1
- package/dist/backend/drizzle/indexes.d.ts +1 -1
- package/dist/backend/index.cjs +27 -19
- package/dist/backend/index.d.cts +37 -55
- package/dist/backend/index.d.ts +37 -55
- package/dist/backend/index.js +4 -4
- package/dist/backend/postgres/index.cjs +7 -7
- package/dist/backend/postgres/index.d.cts +21 -7
- package/dist/backend/postgres/index.d.ts +21 -7
- package/dist/backend/postgres/index.js +6 -6
- package/dist/backend/postgres/pglite-store.cjs +17 -17
- package/dist/backend/postgres/pglite-store.d.cts +8 -8
- package/dist/backend/postgres/pglite-store.d.ts +8 -8
- package/dist/backend/postgres/pglite-store.js +14 -14
- package/dist/backend/postgres/pglite.cjs +8 -8
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +7 -7
- package/dist/backend/sqlite/index.cjs +7 -7
- package/dist/backend/sqlite/index.d.cts +20 -7
- package/dist/backend/sqlite/index.d.ts +20 -7
- package/dist/backend/sqlite/index.js +6 -6
- package/dist/backend/sqlite/libsql.cjs +8 -8
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +6 -6
- package/dist/backend/sqlite/local-store.cjs +18 -18
- package/dist/backend/sqlite/local-store.d.cts +8 -8
- package/dist/backend/sqlite/local-store.d.ts +8 -8
- package/dist/backend/sqlite/local-store.js +15 -15
- package/dist/backend/sqlite/local.cjs +9 -9
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +7 -7
- package/dist/{chunk-EMIB2RXD.cjs → chunk-2HIYYMWY.cjs} +99 -96
- package/dist/chunk-2HIYYMWY.cjs.map +1 -0
- package/dist/{chunk-6KFLYYOC.cjs → chunk-2QGYQBS2.cjs} +5 -5
- package/dist/{chunk-6KFLYYOC.cjs.map → chunk-2QGYQBS2.cjs.map} +1 -1
- package/dist/{chunk-5FT3TLPK.js → chunk-2SYZXD54.js} +16 -13
- package/dist/chunk-2SYZXD54.js.map +1 -0
- package/dist/{chunk-XYBQI6LE.js → chunk-2TYSSBU5.js} +6 -6
- package/dist/{chunk-XYBQI6LE.js.map → chunk-2TYSSBU5.js.map} +1 -1
- package/dist/{chunk-6JVZSOHQ.cjs → chunk-3FPR224C.cjs} +26 -26
- package/dist/{chunk-6JVZSOHQ.cjs.map → chunk-3FPR224C.cjs.map} +1 -1
- package/dist/{chunk-MFZR4QKM.cjs → chunk-3KOY4FH3.cjs} +181 -4
- package/dist/chunk-3KOY4FH3.cjs.map +1 -0
- package/dist/{chunk-6FWSNSRE.js → chunk-4WMMBDS5.js} +4 -4
- package/dist/chunk-4WMMBDS5.js.map +1 -0
- package/dist/{chunk-NG2RB5WL.js → chunk-5K2BKEBD.js} +18 -3
- package/dist/chunk-5K2BKEBD.js.map +1 -0
- package/dist/chunk-5PRKMB24.cjs +124 -0
- package/dist/chunk-5PRKMB24.cjs.map +1 -0
- package/dist/chunk-6LN7FIVU.js +107 -0
- package/dist/chunk-6LN7FIVU.js.map +1 -0
- package/dist/{chunk-I4G3SQPF.cjs → chunk-7XUYFFR4.cjs} +7 -7
- package/dist/chunk-7XUYFFR4.cjs.map +1 -0
- package/dist/{chunk-KH7XW7VV.js → chunk-ACGSAMD3.js} +24 -27
- package/dist/chunk-ACGSAMD3.js.map +1 -0
- package/dist/{chunk-QS3NQZVC.js → chunk-AX6JGVTZ.js} +16 -11
- package/dist/chunk-AX6JGVTZ.js.map +1 -0
- package/dist/{chunk-DJZTXBWY.js → chunk-BRRP76WO.js} +71 -30
- package/dist/chunk-BRRP76WO.js.map +1 -0
- package/dist/{chunk-5UMTUOM5.js → chunk-CT3ZKTOF.js} +5 -4
- package/dist/chunk-CT3ZKTOF.js.map +1 -0
- package/dist/{chunk-XY5OMOJD.js → chunk-DZAICA5J.js} +3 -3
- package/dist/{chunk-XY5OMOJD.js.map → chunk-DZAICA5J.js.map} +1 -1
- package/dist/{chunk-OIFSOPSR.cjs → chunk-EZEEWCFJ.cjs} +38 -156
- package/dist/chunk-EZEEWCFJ.cjs.map +1 -0
- package/dist/{chunk-AMMWA76F.cjs → chunk-FA2AFWLP.cjs} +6 -6
- package/dist/{chunk-AMMWA76F.cjs.map → chunk-FA2AFWLP.cjs.map} +1 -1
- package/dist/{chunk-FNOMT74T.js → chunk-I4GAZH5Z.js} +180 -5
- package/dist/chunk-I4GAZH5Z.js.map +1 -0
- package/dist/{chunk-WGX7JH7E.cjs → chunk-JB6T4GLL.cjs} +106 -134
- package/dist/chunk-JB6T4GLL.cjs.map +1 -0
- package/dist/{chunk-MX4DHSQP.cjs → chunk-JFRT7S3B.cjs} +92 -98
- package/dist/chunk-JFRT7S3B.cjs.map +1 -0
- package/dist/{chunk-SE6EGQSD.js → chunk-KF6K7TGH.js} +38 -66
- package/dist/chunk-KF6K7TGH.js.map +1 -0
- package/dist/{chunk-ZHNXLS3C.js → chunk-NACVVDWB.js} +208 -8
- package/dist/chunk-NACVVDWB.js.map +1 -0
- package/dist/{chunk-M35DF33T.js → chunk-OD4SSY2U.js} +29 -16
- package/dist/chunk-OD4SSY2U.js.map +1 -0
- package/dist/{chunk-U5EDAVOJ.cjs → chunk-OTUPEF2W.cjs} +54 -49
- package/dist/chunk-OTUPEF2W.cjs.map +1 -0
- package/dist/{chunk-BCQ76AXA.cjs → chunk-PFBRJBUL.cjs} +107 -94
- package/dist/chunk-PFBRJBUL.cjs.map +1 -0
- package/dist/{chunk-AVGUJWVX.js → chunk-S5TERQVW.js} +15 -132
- package/dist/chunk-S5TERQVW.js.map +1 -0
- package/dist/chunk-SIT26LAZ.cjs +614 -0
- package/dist/chunk-SIT26LAZ.cjs.map +1 -0
- package/dist/{chunk-BR7SHKGM.cjs → chunk-SR725PWF.cjs} +548 -507
- package/dist/chunk-SR725PWF.cjs.map +1 -0
- package/dist/{chunk-5FBRVORR.cjs → chunk-TKZXMWQF.cjs} +8 -7
- package/dist/chunk-TKZXMWQF.cjs.map +1 -0
- package/dist/{chunk-425IZOQ5.cjs → chunk-TQHGE7UC.cjs} +20 -2
- package/dist/chunk-TQHGE7UC.cjs.map +1 -0
- package/dist/{chunk-GYUJZARH.cjs → chunk-TUNPBZY3.cjs} +4 -4
- package/dist/{chunk-GYUJZARH.cjs.map → chunk-TUNPBZY3.cjs.map} +1 -1
- package/dist/chunk-UGHG7PGX.js +592 -0
- package/dist/chunk-UGHG7PGX.js.map +1 -0
- package/dist/{chunk-KABFHAL7.cjs → chunk-UMGZDVOA.cjs} +213 -12
- package/dist/chunk-UMGZDVOA.cjs.map +1 -0
- package/dist/{chunk-UPAJHMW3.cjs → chunk-WCCATHMB.cjs} +54 -57
- package/dist/chunk-WCCATHMB.cjs.map +1 -0
- package/dist/{chunk-LEWHMOUY.js → chunk-YIURNGXI.js} +4 -4
- package/dist/{chunk-LEWHMOUY.js.map → chunk-YIURNGXI.js.map} +1 -1
- package/dist/{chunk-EP4RUYD6.js → chunk-YVF2EM7B.js} +3 -3
- package/dist/{chunk-EP4RUYD6.js.map → chunk-YVF2EM7B.js.map} +1 -1
- package/dist/{chunk-NNQ6A3RM.js → chunk-ZFMCDJGB.js} +7 -12
- package/dist/chunk-ZFMCDJGB.js.map +1 -0
- package/dist/core/index.cjs +6 -6
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +2 -2
- package/dist/ddl-BL1NZLMY.d.cts +78 -0
- package/dist/ddl-D_oW-EVO.d.ts +78 -0
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-merge/index.cjs +334 -191
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +65 -15
- package/dist/graph-merge/index.d.ts +65 -15
- package/dist/graph-merge/index.js +174 -32
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-CHTv4XMZ.d.cts → index-COs_z6nV.d.cts} +2 -2
- package/dist/{index-CzoJ3MUw.d.ts → index-D7d1u2gr.d.ts} +2 -2
- package/dist/index.cjs +90 -86
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +13 -13
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/interchange/index.cjs +38 -38
- package/dist/interchange/index.d.cts +7 -7
- package/dist/interchange/index.d.ts +7 -7
- package/dist/interchange/index.js +10 -10
- package/dist/{manager-DlY1vlla.d.cts → manager-CYaff3n3.d.cts} +2 -2
- package/dist/{manager-B6sOQzcQ.d.ts → manager-D9eRT_ns.d.ts} +2 -2
- package/dist/{materialize-indexes-DQL4xcpf.d.ts → materialize-indexes-DJ3ykH59.d.ts} +1 -1
- package/dist/{materialize-indexes-sskhp-c_.d.cts → materialize-indexes-DTtAnvfY.d.cts} +1 -1
- package/dist/{postgres-BXy_nyMs.d.cts → postgres-CcL4bAHS.d.ts} +1 -1
- package/dist/{postgres-B6YOUcaK.d.ts → postgres-DMj39MEu.d.cts} +1 -1
- package/dist/profiler/index.d.cts +9 -9
- package/dist/profiler/index.d.ts +9 -9
- package/dist/provenance/index.cjs +25 -26
- package/dist/provenance/index.cjs.map +1 -1
- package/dist/provenance/index.d.cts +7 -7
- package/dist/provenance/index.d.ts +7 -7
- package/dist/provenance/index.js +9 -10
- package/dist/provenance/index.js.map +1 -1
- package/dist/repair-validity-windows-BFNZvd_H.d.cts +166 -0
- package/dist/repair-validity-windows-DlUSqwCg.d.ts +166 -0
- package/dist/schema/index.cjs +35 -35
- package/dist/schema/index.d.cts +6 -6
- package/dist/schema/index.d.ts +6 -6
- package/dist/schema/index.js +8 -8
- package/dist/{searchable-D9gMiwcS.d.ts → searchable-DHJMh_nj.d.cts} +1 -1
- package/dist/{searchable-0Cn_lY8U.d.cts → searchable-bpE1bBfc.d.ts} +1 -1
- package/dist/{sqlite-DioSxaPe.d.cts → sqlite-D7Oz0SQh.d.ts} +1 -1
- package/dist/{sqlite-ClXuBYAj.d.ts → sqlite-YppHrNFb.d.cts} +1 -1
- package/dist/{store-5j-w5onJ.d.ts → store-JUVvtmR4.d.cts} +113 -26
- package/dist/{store-CFedKGU5.d.cts → store-UzrGvZOo.d.ts} +113 -26
- package/dist/{temporal-CjO9FH1l.d.ts → temporal-5GqpYCk2.d.cts} +1 -1
- package/dist/{temporal-Ce1pG0S1.d.cts → temporal-CbnLzTmM.d.ts} +1 -1
- package/dist/{types-DKkMJZjR.d.cts → types-BqFZTQmV.d.cts} +29 -4
- package/dist/{types-DKkMJZjR.d.ts → types-BqFZTQmV.d.ts} +29 -4
- package/dist/{types-BrdOFu48.d.ts → types-Bx74kaTt.d.ts} +1 -1
- package/dist/{types-oj_OGAaZ.d.cts → types-CXAhpW-c.d.cts} +1 -1
- package/dist/{where-D1wKCJ4Q.d.cts → where-DI_Fqz-X.d.cts} +1 -1
- package/dist/{where-C8w2627G.d.ts → where-O-k2wgYm.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-3HGRTCDU.cjs +0 -269
- package/dist/chunk-3HGRTCDU.cjs.map +0 -1
- package/dist/chunk-425IZOQ5.cjs.map +0 -1
- package/dist/chunk-5FBRVORR.cjs.map +0 -1
- package/dist/chunk-5FT3TLPK.js.map +0 -1
- package/dist/chunk-5UMTUOM5.js.map +0 -1
- package/dist/chunk-6FWSNSRE.js.map +0 -1
- package/dist/chunk-AVGUJWVX.js.map +0 -1
- package/dist/chunk-BCQ76AXA.cjs.map +0 -1
- package/dist/chunk-BR7SHKGM.cjs.map +0 -1
- package/dist/chunk-DJZTXBWY.js.map +0 -1
- package/dist/chunk-EMIB2RXD.cjs.map +0 -1
- package/dist/chunk-FNOMT74T.js.map +0 -1
- package/dist/chunk-I4G3SQPF.cjs.map +0 -1
- package/dist/chunk-JR6SX5RH.cjs +0 -268
- package/dist/chunk-JR6SX5RH.cjs.map +0 -1
- package/dist/chunk-KABFHAL7.cjs.map +0 -1
- package/dist/chunk-KH7XW7VV.js.map +0 -1
- package/dist/chunk-M35DF33T.js.map +0 -1
- package/dist/chunk-MFZR4QKM.cjs.map +0 -1
- package/dist/chunk-MX4DHSQP.cjs.map +0 -1
- package/dist/chunk-NAZ2RA4L.js +0 -254
- package/dist/chunk-NAZ2RA4L.js.map +0 -1
- package/dist/chunk-NG2RB5WL.js.map +0 -1
- package/dist/chunk-NNQ6A3RM.js.map +0 -1
- package/dist/chunk-OIFSOPSR.cjs.map +0 -1
- package/dist/chunk-QS3NQZVC.js.map +0 -1
- package/dist/chunk-SE6EGQSD.js.map +0 -1
- package/dist/chunk-SHSSRCFR.js +0 -246
- package/dist/chunk-SHSSRCFR.js.map +0 -1
- package/dist/chunk-U5EDAVOJ.cjs.map +0 -1
- package/dist/chunk-UPAJHMW3.cjs.map +0 -1
- package/dist/chunk-WGX7JH7E.cjs.map +0 -1
- package/dist/chunk-ZHNXLS3C.js.map +0 -1
- package/dist/ddl-CprnMXJ-.d.ts +0 -38
- package/dist/ddl-DJA7Lci5.d.cts +0 -38
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkEZEEWCFJ_cjs = require('./chunk-EZEEWCFJ.cjs');
|
|
4
|
+
var chunkSIT26LAZ_cjs = require('./chunk-SIT26LAZ.cjs');
|
|
5
|
+
var chunk5PRKMB24_cjs = require('./chunk-5PRKMB24.cjs');
|
|
6
|
+
var chunkTQHGE7UC_cjs = require('./chunk-TQHGE7UC.cjs');
|
|
7
7
|
var chunkL3LQNR34_cjs = require('./chunk-L3LQNR34.cjs');
|
|
8
8
|
var chunkEDN4Y4ZG_cjs = require('./chunk-EDN4Y4ZG.cjs');
|
|
9
9
|
var chunkMRDBBHIZ_cjs = require('./chunk-MRDBBHIZ.cjs');
|
|
@@ -81,14 +81,9 @@ function createValidationError(message, issues, context) {
|
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
// src/utils/tuple-key.ts
|
|
85
|
-
function encodeTupleKey(values) {
|
|
86
|
-
return JSON.stringify(values);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
84
|
// src/identity/row-codec.ts
|
|
90
85
|
function toCanonicalIdentityTimestamp(value) {
|
|
91
|
-
const canonical =
|
|
86
|
+
const canonical = chunkTQHGE7UC_cjs.canonicalizeDatabaseTimestamp(value);
|
|
92
87
|
if (canonical === void 0) {
|
|
93
88
|
throw new chunkMRDBBHIZ_cjs.ConfigurationError(
|
|
94
89
|
"Identity relation returned a timestamp that is not a representable instant.",
|
|
@@ -135,11 +130,11 @@ function toTransferAssertion(row) {
|
|
|
135
130
|
|
|
136
131
|
// src/identity/reference.ts
|
|
137
132
|
function identityReferenceKey(ref) {
|
|
138
|
-
return encodeTupleKey([ref.kind, ref.id]);
|
|
133
|
+
return chunkEZEEWCFJ_cjs.encodeTupleKey([ref.kind, ref.id]);
|
|
139
134
|
}
|
|
140
135
|
function compareIdentityReferences(left, right) {
|
|
141
|
-
const kindOrder =
|
|
142
|
-
return kindOrder === 0 ?
|
|
136
|
+
const kindOrder = chunkEZEEWCFJ_cjs.compareCodePoints(left.kind, right.kind);
|
|
137
|
+
return kindOrder === 0 ? chunkEZEEWCFJ_cjs.compareCodePoints(left.id, right.id) : kindOrder;
|
|
143
138
|
}
|
|
144
139
|
function normalizeIdentityPair(first, second) {
|
|
145
140
|
return compareIdentityReferences(first, second) <= 0 ? [first, second] : [second, first];
|
|
@@ -174,7 +169,7 @@ function spanningDifferentAssertion(assertions, first, second) {
|
|
|
174
169
|
// src/identity/sql-target.ts
|
|
175
170
|
var MAX_REFERENCE_CHUNK_SIZE = 200;
|
|
176
171
|
function identityChunkSize(target, input) {
|
|
177
|
-
const parameterLimit =
|
|
172
|
+
const parameterLimit = chunkEZEEWCFJ_cjs.recordedBindParamBudget(target);
|
|
178
173
|
const chunkSize = Math.floor(
|
|
179
174
|
(parameterLimit - input.fixedParameters) / input.parametersPerItem
|
|
180
175
|
);
|
|
@@ -220,7 +215,7 @@ async function executeIdentityStatement(target, statement) {
|
|
|
220
215
|
try {
|
|
221
216
|
await target.executeStatement(chunkEDN4Y4ZG_cjs.asCompiledStatementSql(statement));
|
|
222
217
|
} catch (error) {
|
|
223
|
-
if (!
|
|
218
|
+
if (!chunkSIT26LAZ_cjs.isSqliteStaleSnapshotError(error)) throw error;
|
|
224
219
|
throw identityWriterSlotError(error);
|
|
225
220
|
}
|
|
226
221
|
}
|
|
@@ -253,7 +248,7 @@ function normalizePair(first, second) {
|
|
|
253
248
|
return normalizeIdentityPair(first, second);
|
|
254
249
|
}
|
|
255
250
|
function clampValidTo(timestamp, validFrom) {
|
|
256
|
-
return
|
|
251
|
+
return chunkEZEEWCFJ_cjs.compareCodePoints(timestamp, validFrom) < 0 ? validFrom : timestamp;
|
|
257
252
|
}
|
|
258
253
|
function publicAssertion(row) {
|
|
259
254
|
return {
|
|
@@ -290,10 +285,10 @@ async function lockIdentityEnablementNodes(target, schema) {
|
|
|
290
285
|
);
|
|
291
286
|
}
|
|
292
287
|
async function loadNodeSnapshot(target, schema, graphId, coordinate) {
|
|
293
|
-
const sqlCoordinate =
|
|
288
|
+
const sqlCoordinate = chunkEZEEWCFJ_cjs.identitySqlCoordinate(coordinate, chunkTQHGE7UC_cjs.nowIso());
|
|
294
289
|
const rows = await target.execute(
|
|
295
290
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(
|
|
296
|
-
|
|
291
|
+
chunkEZEEWCFJ_cjs.identityNodeSnapshotSource(schema, graphId, sqlCoordinate)
|
|
297
292
|
)
|
|
298
293
|
);
|
|
299
294
|
return rows.map((row) => ({
|
|
@@ -319,7 +314,7 @@ async function loadCurrentStructuralClasses(target, schema, graphId, references)
|
|
|
319
314
|
});
|
|
320
315
|
if (uniqueReferences.length > chunkSize) {
|
|
321
316
|
const combined = /* @__PURE__ */ new Map();
|
|
322
|
-
for (const refChunk of
|
|
317
|
+
for (const refChunk of chunkSIT26LAZ_cjs.chunk(uniqueReferences, chunkSize)) {
|
|
323
318
|
const classes2 = await loadCurrentStructuralClasses(
|
|
324
319
|
target,
|
|
325
320
|
schema,
|
|
@@ -373,8 +368,8 @@ async function loadCurrentStructuralClasses(target, schema, graphId, references)
|
|
|
373
368
|
);
|
|
374
369
|
}
|
|
375
370
|
async function loadCurrentVisibleMembers(target, schema, graphId, ref) {
|
|
376
|
-
const now =
|
|
377
|
-
const coordinate =
|
|
371
|
+
const now = chunkTQHGE7UC_cjs.nowIso();
|
|
372
|
+
const coordinate = chunkEZEEWCFJ_cjs.identitySqlCoordinate(void 0, now);
|
|
378
373
|
const rows = await target.execute(
|
|
379
374
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
380
375
|
WITH anchor AS (
|
|
@@ -400,7 +395,7 @@ async function loadCurrentVisibleMembers(target, schema, graphId, ref) {
|
|
|
400
395
|
WHERE n.graph_id = ${graphId}
|
|
401
396
|
AND n.kind = m.kind
|
|
402
397
|
AND n.id = m.id
|
|
403
|
-
AND ${
|
|
398
|
+
AND ${chunkEZEEWCFJ_cjs.identityNodeVisibilitySql(coordinate, "n")}
|
|
404
399
|
`)
|
|
405
400
|
);
|
|
406
401
|
const members = rows.map((row) => ({ kind: row.kind, id: row.id })).toSorted((left, right) => compareReferences(left, right));
|
|
@@ -435,7 +430,7 @@ async function loadHistoricalClasses(target, schema, graphId, references, coordi
|
|
|
435
430
|
});
|
|
436
431
|
if (uniqueReferences.length > chunkSize) {
|
|
437
432
|
const combined = /* @__PURE__ */ new Map();
|
|
438
|
-
for (const refChunk of
|
|
433
|
+
for (const refChunk of chunkSIT26LAZ_cjs.chunk(uniqueReferences, chunkSize)) {
|
|
439
434
|
const classes = await loadHistoricalClasses(
|
|
440
435
|
target,
|
|
441
436
|
schema,
|
|
@@ -448,13 +443,13 @@ async function loadHistoricalClasses(target, schema, graphId, references, coordi
|
|
|
448
443
|
}
|
|
449
444
|
return combined;
|
|
450
445
|
}
|
|
451
|
-
const currentInstant =
|
|
452
|
-
const sqlCoordinate =
|
|
446
|
+
const currentInstant = chunkTQHGE7UC_cjs.nowIso();
|
|
447
|
+
const sqlCoordinate = chunkEZEEWCFJ_cjs.identitySqlCoordinate(coordinate, currentInstant);
|
|
453
448
|
const seeds = chunkEDN4Y4ZG_cjs.sql.join(
|
|
454
449
|
uniqueReferences.map((ref) => chunkEDN4Y4ZG_cjs.sql`(${ref.kind}, ${ref.id})`),
|
|
455
450
|
chunkEDN4Y4ZG_cjs.sql`, `
|
|
456
451
|
);
|
|
457
|
-
const reconstruction =
|
|
452
|
+
const reconstruction = chunkEZEEWCFJ_cjs.historicalIdentityReconstructionCtes({
|
|
458
453
|
schema,
|
|
459
454
|
graphId,
|
|
460
455
|
coordinate: sqlCoordinate,
|
|
@@ -467,7 +462,7 @@ async function loadHistoricalClasses(target, schema, graphId, references, coordi
|
|
|
467
462
|
${reconstruction}
|
|
468
463
|
SELECT member.seed_kind, member.seed_id,
|
|
469
464
|
member.kind AS member_kind, member.id AS member_id,
|
|
470
|
-
CASE WHEN ${
|
|
465
|
+
CASE WHEN ${chunkEZEEWCFJ_cjs.identityNodeVisibilitySql(sqlCoordinate, "n")}
|
|
471
466
|
THEN 1 ELSE 0 END AS is_visible
|
|
472
467
|
FROM identity_members member
|
|
473
468
|
JOIN node_snapshot n ON n.kind = member.kind AND n.id = member.id
|
|
@@ -518,10 +513,10 @@ function visibleMembersAtCoordinate(ctx, ref) {
|
|
|
518
513
|
);
|
|
519
514
|
}
|
|
520
515
|
async function loadAssertions(target, schema, graphId, coordinate, currentInstant) {
|
|
521
|
-
const source =
|
|
516
|
+
const source = chunkEZEEWCFJ_cjs.identityAssertionSnapshotSource(
|
|
522
517
|
schema,
|
|
523
518
|
graphId,
|
|
524
|
-
|
|
519
|
+
chunkEZEEWCFJ_cjs.identitySqlCoordinate(coordinate, currentInstant),
|
|
525
520
|
void 0
|
|
526
521
|
);
|
|
527
522
|
const rows = await target.execute(
|
|
@@ -547,7 +542,7 @@ async function loadAssertionsTouching(target, schema, graphId, references, coord
|
|
|
547
542
|
});
|
|
548
543
|
if (references.length > chunkSize) {
|
|
549
544
|
const byId = /* @__PURE__ */ new Map();
|
|
550
|
-
for (const refChunk of
|
|
545
|
+
for (const refChunk of chunkSIT26LAZ_cjs.chunk(references, chunkSize)) {
|
|
551
546
|
const assertions = await loadAssertionsTouching(
|
|
552
547
|
target,
|
|
553
548
|
schema,
|
|
@@ -560,10 +555,10 @@ async function loadAssertionsTouching(target, schema, graphId, references, coord
|
|
|
560
555
|
}
|
|
561
556
|
return [...byId.values()];
|
|
562
557
|
}
|
|
563
|
-
const source =
|
|
558
|
+
const source = chunkEZEEWCFJ_cjs.identityAssertionSnapshotSource(
|
|
564
559
|
schema,
|
|
565
560
|
graphId,
|
|
566
|
-
|
|
561
|
+
chunkEZEEWCFJ_cjs.identitySqlCoordinate(coordinate, chunkTQHGE7UC_cjs.nowIso()),
|
|
567
562
|
relation
|
|
568
563
|
);
|
|
569
564
|
const aMatches = referenceCondition(
|
|
@@ -578,7 +573,7 @@ async function loadAssertionsTouching(target, schema, graphId, references, coord
|
|
|
578
573
|
);
|
|
579
574
|
const rows = await target.execute(
|
|
580
575
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
581
|
-
SELECT ${
|
|
576
|
+
SELECT ${chunkEZEEWCFJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
582
577
|
FROM (${source}) identity_assertions
|
|
583
578
|
WHERE ${aMatches} OR ${bMatches}
|
|
584
579
|
`)
|
|
@@ -702,7 +697,7 @@ async function withWriteTransactionSession(target, ctx, fn) {
|
|
|
702
697
|
try {
|
|
703
698
|
const result = await fn();
|
|
704
699
|
if (session.wrote && ctx.revisionTrackingEnabled && !ctx.historyEnabled) {
|
|
705
|
-
await
|
|
700
|
+
await chunkEZEEWCFJ_cjs.advanceRevisionClock(target, ctx.revisionSchema, ctx.graphId, true);
|
|
706
701
|
}
|
|
707
702
|
return result;
|
|
708
703
|
} finally {
|
|
@@ -764,19 +759,19 @@ function runInWriteTransaction(ctx, backend, fn, options) {
|
|
|
764
759
|
const refusal = fenceReason === void 0 ? void 0 : graphWriteFenceRefusal(ctx, backend, fenceReason);
|
|
765
760
|
if (refusal !== void 0) return Promise.reject(refusal);
|
|
766
761
|
const needsGraphWriteLock = ctx.historyEnabled || ctx.revisionTrackingEnabled || fenceReason !== void 0;
|
|
767
|
-
return
|
|
762
|
+
return chunk5PRKMB24_cjs.runOptionallyInTransaction(backend, async (target) => {
|
|
768
763
|
await lockSchemaVersionForStoreWrite(ctx, target);
|
|
769
764
|
const session = needsGraphWriteLock ? writeTransactionSessions.get(target) : void 0;
|
|
770
765
|
const held = heldGraphWriteLocks.get(target) ?? /* @__PURE__ */ new Set();
|
|
771
766
|
heldGraphWriteLocks.set(target, held);
|
|
772
767
|
const acquiresLock = needsGraphWriteLock && session?.lock === void 0 && !held.has(ctx.graphId);
|
|
773
768
|
if (acquiresLock) held.add(ctx.graphId);
|
|
774
|
-
const lock = acquiresLock ? await
|
|
769
|
+
const lock = acquiresLock ? await chunkEZEEWCFJ_cjs.lockRecordedGraphWrite(target, ctx.graphId).catch(
|
|
775
770
|
(error) => {
|
|
776
771
|
held.delete(ctx.graphId);
|
|
777
772
|
throw error;
|
|
778
773
|
}
|
|
779
|
-
) : session?.lock ??
|
|
774
|
+
) : session?.lock ?? chunkEZEEWCFJ_cjs.uncapturedGraphWriteLock();
|
|
780
775
|
if (session !== void 0) session.lock = lock;
|
|
781
776
|
const result = await (acquiresLock ? fn(target, lock).finally(() => held.delete(ctx.graphId)) : fn(target, lock));
|
|
782
777
|
if (session !== void 0) {
|
|
@@ -784,7 +779,7 @@ function runInWriteTransaction(ctx, backend, fn, options) {
|
|
|
784
779
|
return result;
|
|
785
780
|
}
|
|
786
781
|
if (ctx.revisionTrackingEnabled && !ctx.historyEnabled && (options?.didWrite?.(result) ?? true)) {
|
|
787
|
-
await
|
|
782
|
+
await chunkEZEEWCFJ_cjs.advanceRevisionClock(
|
|
788
783
|
target,
|
|
789
784
|
ctx.revisionSchema,
|
|
790
785
|
ctx.graphId,
|
|
@@ -903,7 +898,7 @@ function identityActiveKinds(registry) {
|
|
|
903
898
|
return new Set(registry.nodeKinds.keys());
|
|
904
899
|
}
|
|
905
900
|
async function loadSnapshot(target, schema, graphId, coordinate, allowedKinds, sameIdAcrossKinds = "fold") {
|
|
906
|
-
const currentInstant =
|
|
901
|
+
const currentInstant = chunkTQHGE7UC_cjs.nowIso();
|
|
907
902
|
const [nodes, assertions] = await Promise.all([
|
|
908
903
|
loadNodeSnapshot(target, schema, graphId, coordinate),
|
|
909
904
|
loadAssertions(target, schema, graphId, coordinate, currentInstant)
|
|
@@ -1116,7 +1111,7 @@ async function loadLiveReferences(target, schema, graphId, references) {
|
|
|
1116
1111
|
});
|
|
1117
1112
|
if (references.length > chunkSize) {
|
|
1118
1113
|
const byKey = /* @__PURE__ */ new Map();
|
|
1119
|
-
for (const refChunk of
|
|
1114
|
+
for (const refChunk of chunkSIT26LAZ_cjs.chunk(references, chunkSize)) {
|
|
1120
1115
|
const live = await loadLiveReferences(target, schema, graphId, refChunk);
|
|
1121
1116
|
for (const ref of live) byKey.set(refKey(ref), ref);
|
|
1122
1117
|
}
|
|
@@ -1154,7 +1149,7 @@ async function requireStructuralEndpoints(target, schema, graphId, references) {
|
|
|
1154
1149
|
parametersPerItem: 2
|
|
1155
1150
|
});
|
|
1156
1151
|
const presentKeys = /* @__PURE__ */ new Set();
|
|
1157
|
-
for (const refChunk of
|
|
1152
|
+
for (const refChunk of chunkSIT26LAZ_cjs.chunk(unique, chunkSize)) {
|
|
1158
1153
|
const matches = referenceCondition(chunkEDN4Y4ZG_cjs.sql`kind`, chunkEDN4Y4ZG_cjs.sql`id`, refChunk);
|
|
1159
1154
|
const rows = await target.execute(
|
|
1160
1155
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
@@ -1176,14 +1171,14 @@ async function requireStructuralEndpoints(target, schema, graphId, references) {
|
|
|
1176
1171
|
// src/identity/separation.ts
|
|
1177
1172
|
var MAX_SEPARATION_INSERT_CHUNK_SIZE = 100;
|
|
1178
1173
|
function identityClassKey(ref) {
|
|
1179
|
-
return encodeTupleKey([ref.kind, ref.id]);
|
|
1174
|
+
return chunkEZEEWCFJ_cjs.encodeTupleKey([ref.kind, ref.id]);
|
|
1180
1175
|
}
|
|
1181
1176
|
var PAIR_KEY_SEPARATOR = "\0";
|
|
1182
1177
|
function pairKey(pair) {
|
|
1183
1178
|
return `${pair.low}${PAIR_KEY_SEPARATOR}${pair.high}`;
|
|
1184
1179
|
}
|
|
1185
1180
|
function orderedPair(first, second) {
|
|
1186
|
-
return
|
|
1181
|
+
return chunkEZEEWCFJ_cjs.compareCodePoints(first, second) <= 0 ? { low: first, high: second } : { low: second, high: first };
|
|
1187
1182
|
}
|
|
1188
1183
|
function buildSeparationProjection(assertions, classKeyOf) {
|
|
1189
1184
|
const pairs = /* @__PURE__ */ new Map();
|
|
@@ -1219,7 +1214,7 @@ async function deleteSeparationForClassKeys(target, schema, graphId, classKeys)
|
|
|
1219
1214
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
1220
1215
|
parametersPerItem: 2
|
|
1221
1216
|
});
|
|
1222
|
-
for (const keyChunk of
|
|
1217
|
+
for (const keyChunk of chunkSIT26LAZ_cjs.chunk(unique, chunkSize)) {
|
|
1223
1218
|
const keyList = chunkEDN4Y4ZG_cjs.sql.join(
|
|
1224
1219
|
keyChunk.map((key) => chunkEDN4Y4ZG_cjs.sql`${key}`),
|
|
1225
1220
|
chunkEDN4Y4ZG_cjs.sql`, `
|
|
@@ -1286,7 +1281,7 @@ async function probeSeparationPair(target, schema, graphId, pair) {
|
|
|
1286
1281
|
pairSeparated: countOf(row, "pair_rows") > 0
|
|
1287
1282
|
};
|
|
1288
1283
|
} catch (error) {
|
|
1289
|
-
if (!
|
|
1284
|
+
if (!chunkSIT26LAZ_cjs.isMissingTableError(error)) throw error;
|
|
1290
1285
|
throw separationUnreadableError(graphId, schema, error);
|
|
1291
1286
|
}
|
|
1292
1287
|
}
|
|
@@ -1347,7 +1342,7 @@ async function hasLiveDifferentAssertions(target, schema, graphId, registry) {
|
|
|
1347
1342
|
if (!await probeAnyLiveDifferent(target, schema, graphId)) return false;
|
|
1348
1343
|
const activeKinds = [...identityActiveKinds(registry)];
|
|
1349
1344
|
if (activeKinds.length === 0) return false;
|
|
1350
|
-
const kindChunks =
|
|
1345
|
+
const kindChunks = chunkSIT26LAZ_cjs.chunk(activeKinds, owedProbeChunkSize(target));
|
|
1351
1346
|
for (const first of kindChunks) {
|
|
1352
1347
|
for (const second of kindChunks) {
|
|
1353
1348
|
if (await probeOwedSeparation(target, schema, graphId, [first, second])) {
|
|
@@ -1403,10 +1398,10 @@ function owedProbeChunkSize(target) {
|
|
|
1403
1398
|
});
|
|
1404
1399
|
}
|
|
1405
1400
|
function liveDifferentSource(schema, graphId) {
|
|
1406
|
-
return
|
|
1401
|
+
return chunkEZEEWCFJ_cjs.identityAssertionSnapshotSource(
|
|
1407
1402
|
schema,
|
|
1408
1403
|
graphId,
|
|
1409
|
-
|
|
1404
|
+
chunkEZEEWCFJ_cjs.identitySqlCoordinate(void 0, chunkTQHGE7UC_cjs.nowIso()),
|
|
1410
1405
|
"different"
|
|
1411
1406
|
);
|
|
1412
1407
|
}
|
|
@@ -1435,7 +1430,7 @@ async function insertSeparationRows(target, schema, graphId, projection) {
|
|
|
1435
1430
|
maxItems: MAX_SEPARATION_INSERT_CHUNK_SIZE,
|
|
1436
1431
|
parametersPerItem: 3
|
|
1437
1432
|
});
|
|
1438
|
-
for (const pairChunk of
|
|
1433
|
+
for (const pairChunk of chunkSIT26LAZ_cjs.chunk(projection.pairs, chunkSize)) {
|
|
1439
1434
|
const values = pairChunk.map(
|
|
1440
1435
|
(pair) => chunkEDN4Y4ZG_cjs.sql`(${graphId}, ${pair.low}, ${pair.high})`
|
|
1441
1436
|
);
|
|
@@ -1503,9 +1498,9 @@ function hasExplicitIdentityValidityWindow(window) {
|
|
|
1503
1498
|
return window?.validFrom !== void 0 || window?.validTo !== void 0;
|
|
1504
1499
|
}
|
|
1505
1500
|
function resolveIdentityValidityWindow(window, operationInstant) {
|
|
1506
|
-
const validFrom =
|
|
1507
|
-
const validTo =
|
|
1508
|
-
if (
|
|
1501
|
+
const validFrom = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(window?.validFrom, "validFrom") ?? operationInstant;
|
|
1502
|
+
const validTo = chunkTQHGE7UC_cjs.validateOptionalCanonicalIsoDate(window?.validTo, "validTo");
|
|
1503
|
+
if (chunkEZEEWCFJ_cjs.compareCodePoints(validFrom, operationInstant) > 0) {
|
|
1509
1504
|
throw new chunkMRDBBHIZ_cjs.IdentityValidityWindowError({
|
|
1510
1505
|
reason: "future-valid-from",
|
|
1511
1506
|
validFrom,
|
|
@@ -1513,7 +1508,7 @@ function resolveIdentityValidityWindow(window, operationInstant) {
|
|
|
1513
1508
|
operationInstant
|
|
1514
1509
|
});
|
|
1515
1510
|
}
|
|
1516
|
-
if (validTo !== void 0 &&
|
|
1511
|
+
if (validTo !== void 0 && chunkEZEEWCFJ_cjs.compareCodePoints(validTo, operationInstant) > 0) {
|
|
1517
1512
|
throw new chunkMRDBBHIZ_cjs.IdentityValidityWindowError({
|
|
1518
1513
|
reason: "future-valid-to",
|
|
1519
1514
|
validFrom,
|
|
@@ -1521,7 +1516,7 @@ function resolveIdentityValidityWindow(window, operationInstant) {
|
|
|
1521
1516
|
operationInstant
|
|
1522
1517
|
});
|
|
1523
1518
|
}
|
|
1524
|
-
if (validTo !== void 0 &&
|
|
1519
|
+
if (validTo !== void 0 && chunkEZEEWCFJ_cjs.compareCodePoints(validTo, validFrom) < 0) {
|
|
1525
1520
|
throw new chunkMRDBBHIZ_cjs.IdentityValidityWindowError({
|
|
1526
1521
|
reason: "inverted",
|
|
1527
1522
|
validFrom,
|
|
@@ -1595,7 +1590,7 @@ async function validateCurrentRelation(ctx, target, relation, operation, a, b) {
|
|
|
1595
1590
|
async function currentAssertionForPair(target, schema, graphId, relation, a, b) {
|
|
1596
1591
|
const rows = await target.execute(
|
|
1597
1592
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
1598
|
-
SELECT ${
|
|
1593
|
+
SELECT ${chunkEZEEWCFJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
1599
1594
|
FROM ${schema.identityAssertionsTable}
|
|
1600
1595
|
WHERE graph_id = ${graphId}
|
|
1601
1596
|
AND rel = ${relation}
|
|
@@ -1614,7 +1609,7 @@ async function assertionForExactWindow(target, schema, graphId, relation, a, b,
|
|
|
1614
1609
|
const validToMatch = window.validTo === void 0 ? chunkEDN4Y4ZG_cjs.sql`valid_to IS NULL` : chunkEDN4Y4ZG_cjs.sql`valid_to = ${window.validTo}`;
|
|
1615
1610
|
const rows = await target.execute(
|
|
1616
1611
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
1617
|
-
SELECT ${
|
|
1612
|
+
SELECT ${chunkEZEEWCFJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
1618
1613
|
FROM ${schema.identityAssertionsTable}
|
|
1619
1614
|
WHERE graph_id = ${graphId}
|
|
1620
1615
|
AND rel = ${relation}
|
|
@@ -1646,7 +1641,7 @@ async function insertAssertion(target, schema, graphId, relation, a, b, operatio
|
|
|
1646
1641
|
function buildAssertionRow(graphId, relation, a, b, timestamp, options) {
|
|
1647
1642
|
return {
|
|
1648
1643
|
graph_id: graphId,
|
|
1649
|
-
id: options?.id ??
|
|
1644
|
+
id: options?.id ?? chunkEZEEWCFJ_cjs.generateId(),
|
|
1650
1645
|
rel: relation,
|
|
1651
1646
|
a_kind: a.kind,
|
|
1652
1647
|
a_id: a.id,
|
|
@@ -1663,7 +1658,7 @@ function buildAssertionRow(graphId, relation, a, b, timestamp, options) {
|
|
|
1663
1658
|
}
|
|
1664
1659
|
function canonicalEndpointTimestamp(value) {
|
|
1665
1660
|
if (value === void 0 || value === null) return void 0;
|
|
1666
|
-
return
|
|
1661
|
+
return chunkTQHGE7UC_cjs.canonicalizeDatabaseTimestamp(value);
|
|
1667
1662
|
}
|
|
1668
1663
|
async function requireEndpointsCoverIdentityWindow(target, graphId, references, window) {
|
|
1669
1664
|
for (const ref of references) {
|
|
@@ -1724,7 +1719,7 @@ async function loadIdentityWindowLedger(target, schema, graphId, requests, opera
|
|
|
1724
1719
|
parametersPerItem: 2
|
|
1725
1720
|
});
|
|
1726
1721
|
const rows = [];
|
|
1727
|
-
for (const referenceChunk of
|
|
1722
|
+
for (const referenceChunk of chunkSIT26LAZ_cjs.chunk(references, seedChunkSize)) {
|
|
1728
1723
|
const seedRows = chunkEDN4Y4ZG_cjs.sql.join(
|
|
1729
1724
|
referenceChunk.map(
|
|
1730
1725
|
(reference) => chunkEDN4Y4ZG_cjs.sql`(${reference.kind}, ${reference.id})`
|
|
@@ -1803,7 +1798,7 @@ async function loadIdentityWindowLedger(target, schema, graphId, requests, opera
|
|
|
1803
1798
|
WHERE assertion.graph_id = ${graphId}
|
|
1804
1799
|
AND ${windowOverlapSql("assertion", lowerBoundary, upperBoundary)}
|
|
1805
1800
|
)
|
|
1806
|
-
SELECT 'assertion' AS row_type, ${
|
|
1801
|
+
SELECT 'assertion' AS row_type, ${chunkEZEEWCFJ_cjs.IDENTITY_ASSERTION_COLUMNS},
|
|
1807
1802
|
NULL AS node_kind, NULL AS node_id,
|
|
1808
1803
|
NULL AS node_created_at, NULL AS node_deleted_at
|
|
1809
1804
|
FROM selected_assertions
|
|
@@ -1994,7 +1989,7 @@ async function insertAssertionRows(target, schema, rows) {
|
|
|
1994
1989
|
maxItems: MAX_ASSERTION_INSERT_CHUNK_SIZE,
|
|
1995
1990
|
parametersPerItem: 14
|
|
1996
1991
|
});
|
|
1997
|
-
for (const rowChunk of
|
|
1992
|
+
for (const rowChunk of chunkSIT26LAZ_cjs.chunk(rows, chunkSize)) {
|
|
1998
1993
|
const values = rowChunk.map(
|
|
1999
1994
|
(row) => chunkEDN4Y4ZG_cjs.sql`
|
|
2000
1995
|
(
|
|
@@ -2011,7 +2006,7 @@ async function insertAssertionRows(target, schema, rows) {
|
|
|
2011
2006
|
await executeIdentityStatement(
|
|
2012
2007
|
target,
|
|
2013
2008
|
chunkEDN4Y4ZG_cjs.sql`
|
|
2014
|
-
INSERT INTO ${schema.identityAssertionsTable} (${
|
|
2009
|
+
INSERT INTO ${schema.identityAssertionsTable} (${chunkEZEEWCFJ_cjs.IDENTITY_ASSERTION_COLUMNS}) VALUES ${chunkEDN4Y4ZG_cjs.sql.join(values, chunkEDN4Y4ZG_cjs.sql`, `)}
|
|
2015
2010
|
`
|
|
2016
2011
|
);
|
|
2017
2012
|
}
|
|
@@ -2025,14 +2020,14 @@ async function loadAssertionsByIds(target, schema, graphId, ids) {
|
|
|
2025
2020
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
2026
2021
|
parametersPerItem: 1
|
|
2027
2022
|
});
|
|
2028
|
-
for (const idChunk of
|
|
2023
|
+
for (const idChunk of chunkSIT26LAZ_cjs.chunk(uniqueIds, chunkSize)) {
|
|
2029
2024
|
const idList = chunkEDN4Y4ZG_cjs.sql.join(
|
|
2030
2025
|
idChunk.map((id) => chunkEDN4Y4ZG_cjs.sql`${id}`),
|
|
2031
2026
|
chunkEDN4Y4ZG_cjs.sql`, `
|
|
2032
2027
|
);
|
|
2033
2028
|
const rows = await target.execute(
|
|
2034
2029
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
2035
|
-
SELECT ${
|
|
2030
|
+
SELECT ${chunkEZEEWCFJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
2036
2031
|
FROM ${schema.identityAssertionsTable}
|
|
2037
2032
|
WHERE graph_id = ${graphId} AND id IN (${idList})
|
|
2038
2033
|
`)
|
|
@@ -2054,7 +2049,7 @@ async function loadCurrentClassAnchors(target, schema, graphId, references) {
|
|
|
2054
2049
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
2055
2050
|
parametersPerItem: 2
|
|
2056
2051
|
});
|
|
2057
|
-
for (const refChunk of
|
|
2052
|
+
for (const refChunk of chunkSIT26LAZ_cjs.chunk(uniqueReferences, chunkSize)) {
|
|
2058
2053
|
const seedRows = chunkEDN4Y4ZG_cjs.sql.join(
|
|
2059
2054
|
refChunk.map((ref) => chunkEDN4Y4ZG_cjs.sql`(${ref.kind}, ${ref.id})`),
|
|
2060
2055
|
chunkEDN4Y4ZG_cjs.sql`, `
|
|
@@ -2188,7 +2183,7 @@ async function insertClosureComponents(target, schema, graphId, components) {
|
|
|
2188
2183
|
maxItems: MAX_CLOSURE_INSERT_CHUNK_SIZE,
|
|
2189
2184
|
parametersPerItem: 5
|
|
2190
2185
|
});
|
|
2191
|
-
for (const valueChunk of
|
|
2186
|
+
for (const valueChunk of chunkSIT26LAZ_cjs.chunk(values, chunkSize)) {
|
|
2192
2187
|
await executeIdentityStatement(
|
|
2193
2188
|
target,
|
|
2194
2189
|
chunkEDN4Y4ZG_cjs.sql`
|
|
@@ -2233,7 +2228,7 @@ async function replaceAffectedClosure(target, schema, graphId, references, sameI
|
|
|
2233
2228
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
2234
2229
|
parametersPerItem: 2
|
|
2235
2230
|
});
|
|
2236
|
-
for (const affectedChunk of
|
|
2231
|
+
for (const affectedChunk of chunkSIT26LAZ_cjs.chunk(affected, chunkSize)) {
|
|
2237
2232
|
const matches = referenceCondition(
|
|
2238
2233
|
chunkEDN4Y4ZG_cjs.sql`member_kind`,
|
|
2239
2234
|
chunkEDN4Y4ZG_cjs.sql`member_id`,
|
|
@@ -2438,7 +2433,7 @@ async function assertPair(ctx, target, relation, firstInput, secondInput, touch,
|
|
|
2438
2433
|
|
|
2439
2434
|
// src/identity/assertion-key.ts
|
|
2440
2435
|
function identityAssertionSemanticKey(relation, a, b) {
|
|
2441
|
-
return encodeTupleKey([relation, a.kind, a.id, b.kind, b.id]);
|
|
2436
|
+
return chunkEZEEWCFJ_cjs.encodeTupleKey([relation, a.kind, a.id, b.kind, b.id]);
|
|
2442
2437
|
}
|
|
2443
2438
|
|
|
2444
2439
|
// src/identity/service-facade.ts
|
|
@@ -2535,7 +2530,7 @@ async function bulkAssertPairs(ctx, target, relation, pairs, touch) {
|
|
|
2535
2530
|
const createdRows = [];
|
|
2536
2531
|
const results = [];
|
|
2537
2532
|
const closureReferences = [];
|
|
2538
|
-
const timestamp =
|
|
2533
|
+
const timestamp = chunkTQHGE7UC_cjs.nowIso();
|
|
2539
2534
|
const operation = relation === "same" ? "assertSame" : "assertDifferent";
|
|
2540
2535
|
for (const [a, b] of normalizedPairs) {
|
|
2541
2536
|
const semanticKey = assertionSemanticKey(relation, a, b);
|
|
@@ -2666,7 +2661,7 @@ async function bulkAssertWindowedPairs(ctx, target, relation, pairs, touch, oper
|
|
|
2666
2661
|
async function findCurrentAssertionById(target, schema, graphId, id) {
|
|
2667
2662
|
const rows = await target.execute(
|
|
2668
2663
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
2669
|
-
SELECT ${
|
|
2664
|
+
SELECT ${chunkEZEEWCFJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
2670
2665
|
FROM ${schema.identityAssertionsTable}
|
|
2671
2666
|
WHERE graph_id = ${graphId}
|
|
2672
2667
|
AND id = ${id}
|
|
@@ -2685,7 +2680,7 @@ async function retractById(ctx, target, id, touch) {
|
|
|
2685
2680
|
id
|
|
2686
2681
|
);
|
|
2687
2682
|
if (existing === void 0) return void 0;
|
|
2688
|
-
const now =
|
|
2683
|
+
const now = chunkTQHGE7UC_cjs.nowIso();
|
|
2689
2684
|
const validTo = clampValidTo(now, existing.valid_from);
|
|
2690
2685
|
const ended = { ...existing, valid_to: validTo, updated_at: now };
|
|
2691
2686
|
await executeIdentityStatement(
|
|
@@ -2710,14 +2705,14 @@ async function retractCurrentAssertions(ctx, target, ids, touch, resolveValidTo)
|
|
|
2710
2705
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
2711
2706
|
parametersPerItem: 1
|
|
2712
2707
|
});
|
|
2713
|
-
for (const idChunk of
|
|
2708
|
+
for (const idChunk of chunkSIT26LAZ_cjs.chunk(uniqueIds, readChunkSize)) {
|
|
2714
2709
|
const placeholders = chunkEDN4Y4ZG_cjs.sql.join(
|
|
2715
2710
|
idChunk.map((id) => chunkEDN4Y4ZG_cjs.sql`${id}`),
|
|
2716
2711
|
chunkEDN4Y4ZG_cjs.sql`, `
|
|
2717
2712
|
);
|
|
2718
2713
|
const rows = await target.execute(
|
|
2719
2714
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
2720
|
-
SELECT ${
|
|
2715
|
+
SELECT ${chunkEZEEWCFJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
2721
2716
|
FROM ${ctx.schema.identityAssertionsTable}
|
|
2722
2717
|
WHERE graph_id = ${ctx.graphId}
|
|
2723
2718
|
AND id IN (${placeholders})
|
|
@@ -2728,7 +2723,7 @@ async function retractCurrentAssertions(ctx, target, ids, touch, resolveValidTo)
|
|
|
2728
2723
|
current.push(...rows.map((row) => normalizeIdentityAssertionRow(row)));
|
|
2729
2724
|
}
|
|
2730
2725
|
if (current.length === 0) return [];
|
|
2731
|
-
const operationInstant =
|
|
2726
|
+
const operationInstant = chunkTQHGE7UC_cjs.nowIso();
|
|
2732
2727
|
const byValidTo = /* @__PURE__ */ new Map();
|
|
2733
2728
|
const endedById = /* @__PURE__ */ new Map();
|
|
2734
2729
|
for (const row of current) {
|
|
@@ -2744,7 +2739,7 @@ async function retractCurrentAssertions(ctx, target, ids, touch, resolveValidTo)
|
|
|
2744
2739
|
parametersPerItem: 1
|
|
2745
2740
|
});
|
|
2746
2741
|
for (const [validTo, ids2] of byValidTo) {
|
|
2747
|
-
for (const idChunk of
|
|
2742
|
+
for (const idChunk of chunkSIT26LAZ_cjs.chunk(ids2, updateChunkSize)) {
|
|
2748
2743
|
const placeholders = chunkEDN4Y4ZG_cjs.sql.join(
|
|
2749
2744
|
idChunk.map((id) => chunkEDN4Y4ZG_cjs.sql`${id}`),
|
|
2750
2745
|
chunkEDN4Y4ZG_cjs.sql`, `
|
|
@@ -2829,7 +2824,7 @@ async function runIdentityMutation(ctx, fn) {
|
|
|
2829
2824
|
ctx.backend,
|
|
2830
2825
|
async (target) => {
|
|
2831
2826
|
await lockIdentityGraph(target, ctx.graphId);
|
|
2832
|
-
return
|
|
2827
|
+
return chunkEZEEWCFJ_cjs.withRecordedIdentityMutationTarget(
|
|
2833
2828
|
target,
|
|
2834
2829
|
(rawTarget, touch) => fn(
|
|
2835
2830
|
rawTarget,
|
|
@@ -2954,7 +2949,7 @@ function createIdentityReadFacade(ctx) {
|
|
|
2954
2949
|
);
|
|
2955
2950
|
return assertions.filter(
|
|
2956
2951
|
(assertion) => assertion.a_kind === ref.kind && assertion.a_id === ref.id || assertion.b_kind === ref.kind && assertion.b_id === ref.id
|
|
2957
|
-
).toSorted((left, right) =>
|
|
2952
|
+
).toSorted((left, right) => chunkEZEEWCFJ_cjs.compareCodePoints(left.id, right.id)).map((assertion) => publicAssertion(assertion));
|
|
2958
2953
|
}
|
|
2959
2954
|
};
|
|
2960
2955
|
}
|
|
@@ -2979,7 +2974,7 @@ function createIdentityFacade(ctx) {
|
|
|
2979
2974
|
...createIdentityReadFacade(ctx),
|
|
2980
2975
|
assertSame(a, b, window) {
|
|
2981
2976
|
return runIdentityMutation(ctx, (target, touch) => {
|
|
2982
|
-
const operationInstant =
|
|
2977
|
+
const operationInstant = chunkTQHGE7UC_cjs.nowIso();
|
|
2983
2978
|
return assertPair(
|
|
2984
2979
|
ctx,
|
|
2985
2980
|
target,
|
|
@@ -2994,7 +2989,7 @@ function createIdentityFacade(ctx) {
|
|
|
2994
2989
|
},
|
|
2995
2990
|
assertDifferent(a, b, window) {
|
|
2996
2991
|
return runIdentityMutation(ctx, (target, touch) => {
|
|
2997
|
-
const operationInstant =
|
|
2992
|
+
const operationInstant = chunkTQHGE7UC_cjs.nowIso();
|
|
2998
2993
|
return assertPair(
|
|
2999
2994
|
ctx,
|
|
3000
2995
|
target,
|
|
@@ -3018,7 +3013,7 @@ function createIdentityFacade(ctx) {
|
|
|
3018
3013
|
"same",
|
|
3019
3014
|
pairs,
|
|
3020
3015
|
touch,
|
|
3021
|
-
|
|
3016
|
+
chunkTQHGE7UC_cjs.nowIso()
|
|
3022
3017
|
);
|
|
3023
3018
|
});
|
|
3024
3019
|
},
|
|
@@ -3033,7 +3028,7 @@ function createIdentityFacade(ctx) {
|
|
|
3033
3028
|
"different",
|
|
3034
3029
|
pairs,
|
|
3035
3030
|
touch,
|
|
3036
|
-
|
|
3031
|
+
chunkTQHGE7UC_cjs.nowIso()
|
|
3037
3032
|
);
|
|
3038
3033
|
});
|
|
3039
3034
|
},
|
|
@@ -3270,8 +3265,8 @@ function rethrowTaggedWithAssertion(error, assertionId, progress) {
|
|
|
3270
3265
|
async function importIdentityAssertionsIntoTarget(ctx, target, assertions, mode, ignoredAssertionIds = /* @__PURE__ */ new Set()) {
|
|
3271
3266
|
let created = 0;
|
|
3272
3267
|
let skipped = 0;
|
|
3273
|
-
await
|
|
3274
|
-
const operationInstant =
|
|
3268
|
+
await chunkEZEEWCFJ_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget, touch) => {
|
|
3269
|
+
const operationInstant = chunkTQHGE7UC_cjs.nowIso();
|
|
3275
3270
|
const normalized = assertions.map((assertion) => ({
|
|
3276
3271
|
assertion,
|
|
3277
3272
|
...validateTransferShape(ctx, assertion, mode, operationInstant)
|
|
@@ -3520,7 +3515,7 @@ async function rebuildIdentityClosureForContext(ctx) {
|
|
|
3520
3515
|
requireAtomicIdentityBackend(ctx.backend, ctx.graphId);
|
|
3521
3516
|
async function rebuildAtTarget(target) {
|
|
3522
3517
|
await lockIdentityGraph(target, ctx.graphId);
|
|
3523
|
-
await
|
|
3518
|
+
await chunkEZEEWCFJ_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget) => {
|
|
3524
3519
|
const activeKinds = identityActiveKinds(ctx.registry);
|
|
3525
3520
|
const snapshot = await loadSnapshot(
|
|
3526
3521
|
rawTarget,
|
|
@@ -3712,7 +3707,7 @@ async function assertAffectedIdentityClassesConsistent(ctx, target, seeds) {
|
|
|
3712
3707
|
await lockIdentityGraph(target, ctx.graphId);
|
|
3713
3708
|
const observed = await findAffectedClassInconsistency(ctx, target, seeds);
|
|
3714
3709
|
if (observed === void 0) return;
|
|
3715
|
-
await
|
|
3710
|
+
await chunkEZEEWCFJ_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget) => {
|
|
3716
3711
|
await replaceClosure(
|
|
3717
3712
|
rawTarget,
|
|
3718
3713
|
ctx.schema,
|
|
@@ -3735,14 +3730,14 @@ async function deleteAssertionsTouchingKinds(target, schema, graphId, kinds, tou
|
|
|
3735
3730
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
3736
3731
|
parametersPerItem: 2
|
|
3737
3732
|
});
|
|
3738
|
-
for (const kindChunk of
|
|
3733
|
+
for (const kindChunk of chunkSIT26LAZ_cjs.chunk(removedKinds, kindChunkSize)) {
|
|
3739
3734
|
const kindList2 = chunkEDN4Y4ZG_cjs.sql.join(
|
|
3740
3735
|
kindChunk.map((kind) => chunkEDN4Y4ZG_cjs.sql`${kind}`),
|
|
3741
3736
|
chunkEDN4Y4ZG_cjs.sql`, `
|
|
3742
3737
|
);
|
|
3743
3738
|
const rows = await target.execute(
|
|
3744
3739
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
3745
|
-
SELECT ${
|
|
3740
|
+
SELECT ${chunkEZEEWCFJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
3746
3741
|
FROM ${schema.identityAssertionsTable}
|
|
3747
3742
|
WHERE graph_id = ${graphId}
|
|
3748
3743
|
AND (a_kind IN (${kindList2}) OR b_kind IN (${kindList2}))
|
|
@@ -3759,7 +3754,7 @@ async function deleteAssertionsTouchingKinds(target, schema, graphId, kinds, tou
|
|
|
3759
3754
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
3760
3755
|
parametersPerItem: 1
|
|
3761
3756
|
});
|
|
3762
|
-
for (const idChunk of
|
|
3757
|
+
for (const idChunk of chunkSIT26LAZ_cjs.chunk(ids, idChunkSize)) {
|
|
3763
3758
|
const idList = chunkEDN4Y4ZG_cjs.sql.join(
|
|
3764
3759
|
idChunk.map((id) => chunkEDN4Y4ZG_cjs.sql`${id}`),
|
|
3765
3760
|
chunkEDN4Y4ZG_cjs.sql`, `
|
|
@@ -3783,7 +3778,7 @@ async function hasAssertionsTouchingKinds(target, schema, graphId, kinds) {
|
|
|
3783
3778
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
3784
3779
|
parametersPerItem: 2
|
|
3785
3780
|
});
|
|
3786
|
-
for (const kindChunk of
|
|
3781
|
+
for (const kindChunk of chunkSIT26LAZ_cjs.chunk(probedKinds, kindChunkSize)) {
|
|
3787
3782
|
const kindList2 = chunkEDN4Y4ZG_cjs.sql.join(
|
|
3788
3783
|
kindChunk.map((kind) => chunkEDN4Y4ZG_cjs.sql`${kind}`),
|
|
3789
3784
|
chunkEDN4Y4ZG_cjs.sql`, `
|
|
@@ -3853,7 +3848,7 @@ async function liveNodeKindsSharingIds(ctx, target, ids) {
|
|
|
3853
3848
|
maxItems: MAX_REFERENCE_CHUNK_SIZE,
|
|
3854
3849
|
parametersPerItem: 1
|
|
3855
3850
|
});
|
|
3856
|
-
for (const idChunk of
|
|
3851
|
+
for (const idChunk of chunkSIT26LAZ_cjs.chunk(uniqueIds, chunkSize)) {
|
|
3857
3852
|
const idList = chunkEDN4Y4ZG_cjs.sql.join(
|
|
3858
3853
|
idChunk.map((id) => chunkEDN4Y4ZG_cjs.sql`${id}`),
|
|
3859
3854
|
chunkEDN4Y4ZG_cjs.sql`, `
|
|
@@ -3879,7 +3874,7 @@ async function liveNodeKindsSharingIds(ctx, target, ids) {
|
|
|
3879
3874
|
async function foldIdentityForCreatedNodes(ctx, target, references) {
|
|
3880
3875
|
if (references.length === 0 || ctx.sameIdAcrossKinds === "ignore") return;
|
|
3881
3876
|
await lockIdentityGraph(target, ctx.graphId);
|
|
3882
|
-
await
|
|
3877
|
+
await chunkEZEEWCFJ_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget) => {
|
|
3883
3878
|
const liveKindsById = await liveNodeKindsSharingIds(
|
|
3884
3879
|
ctx,
|
|
3885
3880
|
rawTarget,
|
|
@@ -3947,7 +3942,7 @@ async function readNodeDeletionInstant(target, schema, graphId, ref) {
|
|
|
3947
3942
|
async function requireNodeValidityEndCompatible(ctx, target, ref, validTo) {
|
|
3948
3943
|
const rows = await target.execute(
|
|
3949
3944
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
3950
|
-
SELECT ${
|
|
3945
|
+
SELECT ${chunkEZEEWCFJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
3951
3946
|
FROM ${ctx.schema.identityAssertionsTable}
|
|
3952
3947
|
WHERE graph_id = ${ctx.graphId}
|
|
3953
3948
|
AND deleted_at IS NULL
|
|
@@ -3974,7 +3969,7 @@ async function requireNodeValidityEndCompatible(ctx, target, ref, validTo) {
|
|
|
3974
3969
|
}
|
|
3975
3970
|
async function detachIdentityForNode(ctx, target, ref, mode) {
|
|
3976
3971
|
await lockIdentityGraph(target, ctx.graphId);
|
|
3977
|
-
await
|
|
3972
|
+
await chunkEZEEWCFJ_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget, touch) => {
|
|
3978
3973
|
const touchesNode = chunkEDN4Y4ZG_cjs.sql`
|
|
3979
3974
|
(
|
|
3980
3975
|
(a_kind = ${ref.kind} AND a_id = ${ref.id})
|
|
@@ -3984,7 +3979,7 @@ async function detachIdentityForNode(ctx, target, ref, mode) {
|
|
|
3984
3979
|
const scope = mode === "hard" ? chunkEDN4Y4ZG_cjs.sql`` : chunkEDN4Y4ZG_cjs.sql`AND valid_to IS NULL AND deleted_at IS NULL`;
|
|
3985
3980
|
const rows = await rawTarget.execute(
|
|
3986
3981
|
chunkEDN4Y4ZG_cjs.asCompiledRowsSql(chunkEDN4Y4ZG_cjs.sql`
|
|
3987
|
-
SELECT ${
|
|
3982
|
+
SELECT ${chunkEZEEWCFJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
3988
3983
|
FROM ${ctx.schema.identityAssertionsTable}
|
|
3989
3984
|
WHERE graph_id = ${ctx.graphId}
|
|
3990
3985
|
${scope}
|
|
@@ -3999,7 +3994,7 @@ async function detachIdentityForNode(ctx, target, ref, mode) {
|
|
|
3999
3994
|
)) {
|
|
4000
3995
|
return;
|
|
4001
3996
|
}
|
|
4002
|
-
const now =
|
|
3997
|
+
const now = chunkTQHGE7UC_cjs.nowIso();
|
|
4003
3998
|
const cascadeInstant = mode === "hard" || rows.length === 0 ? now : await readNodeDeletionInstant(
|
|
4004
3999
|
rawTarget,
|
|
4005
4000
|
ctx.schema,
|
|
@@ -4059,7 +4054,6 @@ exports.createIdentityReadFacade = createIdentityReadFacade;
|
|
|
4059
4054
|
exports.createValidationError = createValidationError;
|
|
4060
4055
|
exports.deleteAssertionsTouchingKinds = deleteAssertionsTouchingKinds;
|
|
4061
4056
|
exports.detachIdentityForNode = detachIdentityForNode;
|
|
4062
|
-
exports.encodeTupleKey = encodeTupleKey;
|
|
4063
4057
|
exports.foldIdentityForCreatedNodes = foldIdentityForCreatedNodes;
|
|
4064
4058
|
exports.forceWriteTransactionRevision = forceWriteTransactionRevision;
|
|
4065
4059
|
exports.hasAssertionsTouchingKinds = hasAssertionsTouchingKinds;
|
|
@@ -4091,5 +4085,5 @@ exports.validateNodeProps = validateNodeProps;
|
|
|
4091
4085
|
exports.validateProps = validateProps;
|
|
4092
4086
|
exports.withWriteTransactionSession = withWriteTransactionSession;
|
|
4093
4087
|
exports.wrapZodError = wrapZodError;
|
|
4094
|
-
//# sourceMappingURL=chunk-
|
|
4095
|
-
//# sourceMappingURL=chunk-
|
|
4088
|
+
//# sourceMappingURL=chunk-JFRT7S3B.cjs.map
|
|
4089
|
+
//# sourceMappingURL=chunk-JFRT7S3B.cjs.map
|