@nicia-ai/typegraph 0.46.0 → 0.46.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/dist/backend/index.cjs +5 -5
- package/dist/backend/index.js +2 -2
- package/dist/backend/postgres/pglite-store.cjs +8 -8
- package/dist/backend/postgres/pglite-store.d.cts +2 -2
- package/dist/backend/postgres/pglite-store.d.ts +2 -2
- package/dist/backend/postgres/pglite-store.js +7 -7
- package/dist/backend/sqlite/local-store.cjs +8 -8
- package/dist/backend/sqlite/local-store.d.cts +2 -2
- package/dist/backend/sqlite/local-store.d.ts +2 -2
- package/dist/backend/sqlite/local-store.js +7 -7
- package/dist/{chunk-CNV4TXJG.js → chunk-2Z2Z3ZD6.js} +3 -3
- package/dist/{chunk-CNV4TXJG.js.map → chunk-2Z2Z3ZD6.js.map} +1 -1
- package/dist/{chunk-N3257XE6.cjs → chunk-65E3XWGF.cjs} +21 -21
- package/dist/{chunk-N3257XE6.cjs.map → chunk-65E3XWGF.cjs.map} +1 -1
- package/dist/{chunk-ONU3HIED.cjs → chunk-CMWHLBVN.cjs} +29 -29
- package/dist/{chunk-ONU3HIED.cjs.map → chunk-CMWHLBVN.cjs.map} +1 -1
- package/dist/{chunk-XNLIZYRZ.cjs → chunk-DTVWX77L.cjs} +56 -56
- package/dist/{chunk-XNLIZYRZ.cjs.map → chunk-DTVWX77L.cjs.map} +1 -1
- package/dist/{chunk-JIVMTW7W.js → chunk-GF3KXUTW.js} +4 -4
- package/dist/{chunk-JIVMTW7W.js.map → chunk-GF3KXUTW.js.map} +1 -1
- package/dist/{chunk-QWX5YA3K.js → chunk-L65OU2U3.js} +11 -9
- package/dist/chunk-L65OU2U3.js.map +1 -0
- package/dist/{chunk-QLRESYPU.js → chunk-LGHCOKTT.js} +5 -5
- package/dist/{chunk-QLRESYPU.js.map → chunk-LGHCOKTT.js.map} +1 -1
- package/dist/{chunk-WEVQJ5LH.js → chunk-M3WP7RQZ.js} +2 -2
- package/dist/chunk-M3WP7RQZ.js.map +1 -0
- package/dist/{chunk-Q7Q4WSLJ.cjs → chunk-MCLYU6BN.cjs} +6 -2
- package/dist/chunk-MCLYU6BN.cjs.map +1 -0
- package/dist/{chunk-RJS7DECT.js → chunk-MZLPX2R7.js} +3 -3
- package/dist/{chunk-RJS7DECT.js.map → chunk-MZLPX2R7.js.map} +1 -1
- package/dist/{chunk-NQ6BRJBE.js → chunk-NLI2AVEF.js} +3 -3
- package/dist/{chunk-NQ6BRJBE.js.map → chunk-NLI2AVEF.js.map} +1 -1
- package/dist/{chunk-XMQSEJCF.cjs → chunk-PF6F5NLJ.cjs} +20 -20
- package/dist/{chunk-XMQSEJCF.cjs.map → chunk-PF6F5NLJ.cjs.map} +1 -1
- package/dist/{chunk-XDF2UPEQ.cjs → chunk-PNTCATDE.cjs} +431 -421
- package/dist/chunk-PNTCATDE.cjs.map +1 -0
- package/dist/{chunk-7GT72YHH.cjs → chunk-PT7RIRIZ.cjs} +66 -64
- package/dist/chunk-PT7RIRIZ.cjs.map +1 -0
- package/dist/{chunk-TTAITEPJ.cjs → chunk-Q3G6A4I3.cjs} +2 -2
- package/dist/chunk-Q3G6A4I3.cjs.map +1 -0
- package/dist/{chunk-7Z5OR7KO.js → chunk-S6PW7VV5.js} +19 -9
- package/dist/chunk-S6PW7VV5.js.map +1 -0
- package/dist/{chunk-XQSCL77R.cjs → chunk-VLT6PEWR.cjs} +4 -4
- package/dist/{chunk-XQSCL77R.cjs.map → chunk-VLT6PEWR.cjs.map} +1 -1
- package/dist/{chunk-OH5E5KIO.js → chunk-WQZLUGVR.js} +6 -6
- package/dist/{chunk-OH5E5KIO.js.map → chunk-WQZLUGVR.js.map} +1 -1
- package/dist/{chunk-DLNROMQ7.js → chunk-XL7SLCXS.js} +6 -3
- package/dist/chunk-XL7SLCXS.js.map +1 -0
- package/dist/{chunk-XNSI2FJO.cjs → chunk-YBQOHKHN.cjs} +8 -8
- package/dist/{chunk-XNSI2FJO.cjs.map → chunk-YBQOHKHN.cjs.map} +1 -1
- package/dist/core/index.cjs +5 -5
- package/dist/core/index.js +1 -1
- package/dist/graph-merge/index.cjs +149 -149
- package/dist/graph-merge/index.d.cts +1 -1
- package/dist/graph-merge/index.d.ts +1 -1
- package/dist/graph-merge/index.js +8 -8
- package/dist/index.cjs +79 -79
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -9
- package/dist/interchange/index.cjs +34 -34
- package/dist/interchange/index.d.cts +1 -1
- package/dist/interchange/index.d.ts +1 -1
- package/dist/interchange/index.js +7 -7
- package/dist/profiler/index.d.cts +1 -1
- package/dist/profiler/index.d.ts +1 -1
- package/dist/provenance/index.cjs +16 -16
- package/dist/provenance/index.d.cts +1 -1
- package/dist/provenance/index.d.ts +1 -1
- package/dist/provenance/index.js +3 -3
- package/dist/schema/index.cjs +32 -32
- package/dist/schema/index.js +5 -5
- package/dist/{store-RwTJx8LX.d.cts → store-B0h6x7wo.d.cts} +12 -3
- package/dist/{store-DawaWWjJ.d.ts → store-ClQ-MZQS.d.ts} +12 -3
- package/package.json +3 -3
- package/dist/chunk-7GT72YHH.cjs.map +0 -1
- package/dist/chunk-7Z5OR7KO.js.map +0 -1
- package/dist/chunk-DLNROMQ7.js.map +0 -1
- package/dist/chunk-Q7Q4WSLJ.cjs.map +0 -1
- package/dist/chunk-QWX5YA3K.js.map +0 -1
- package/dist/chunk-TTAITEPJ.cjs.map +0 -1
- package/dist/chunk-WEVQJ5LH.js.map +0 -1
- package/dist/chunk-XDF2UPEQ.cjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPF6F5NLJ_cjs = require('./chunk-PF6F5NLJ.cjs');
|
|
4
4
|
var chunkBSFJMMV3_cjs = require('./chunk-BSFJMMV3.cjs');
|
|
5
5
|
var chunkXBYVV3MP_cjs = require('./chunk-XBYVV3MP.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkMCLYU6BN_cjs = require('./chunk-MCLYU6BN.cjs');
|
|
7
7
|
var chunk4UGOKMI5_cjs = require('./chunk-4UGOKMI5.cjs');
|
|
8
8
|
var chunkVCRRKBLN_cjs = require('./chunk-VCRRKBLN.cjs');
|
|
9
9
|
var chunkNI72YOJB_cjs = require('./chunk-NI72YOJB.cjs');
|
|
@@ -88,7 +88,7 @@ function encodeTupleKey(values) {
|
|
|
88
88
|
|
|
89
89
|
// src/identity/row-codec.ts
|
|
90
90
|
function toCanonicalIdentityTimestamp(value) {
|
|
91
|
-
const canonical =
|
|
91
|
+
const canonical = chunkMCLYU6BN_cjs.canonicalizeDatabaseTimestamp(value);
|
|
92
92
|
if (canonical === void 0) {
|
|
93
93
|
throw new chunkNI72YOJB_cjs.ConfigurationError(
|
|
94
94
|
"Identity relation returned a timestamp that is not a representable instant.",
|
|
@@ -138,8 +138,8 @@ function identityReferenceKey(ref) {
|
|
|
138
138
|
return encodeTupleKey([ref.kind, ref.id]);
|
|
139
139
|
}
|
|
140
140
|
function compareIdentityReferences(left, right) {
|
|
141
|
-
const kindOrder =
|
|
142
|
-
return kindOrder === 0 ?
|
|
141
|
+
const kindOrder = chunkPF6F5NLJ_cjs.compareCodePoints(left.kind, right.kind);
|
|
142
|
+
return kindOrder === 0 ? chunkPF6F5NLJ_cjs.compareCodePoints(left.id, right.id) : kindOrder;
|
|
143
143
|
}
|
|
144
144
|
function normalizeIdentityPair(first, second) {
|
|
145
145
|
return compareIdentityReferences(first, second) <= 0 ? [first, second] : [second, first];
|
|
@@ -174,7 +174,7 @@ function spanningDifferentAssertion(assertions, first, second) {
|
|
|
174
174
|
// src/identity/sql-target.ts
|
|
175
175
|
var MAX_REFERENCE_CHUNK_SIZE = 200;
|
|
176
176
|
function identityChunkSize(target, input) {
|
|
177
|
-
const parameterLimit =
|
|
177
|
+
const parameterLimit = chunkPF6F5NLJ_cjs.recordedBindParamBudget(target);
|
|
178
178
|
const chunkSize = Math.floor(
|
|
179
179
|
(parameterLimit - input.fixedParameters) / input.parametersPerItem
|
|
180
180
|
);
|
|
@@ -253,7 +253,7 @@ function normalizePair(first, second) {
|
|
|
253
253
|
return normalizeIdentityPair(first, second);
|
|
254
254
|
}
|
|
255
255
|
function clampValidTo(timestamp, validFrom) {
|
|
256
|
-
return
|
|
256
|
+
return chunkPF6F5NLJ_cjs.compareCodePoints(timestamp, validFrom) < 0 ? validFrom : timestamp;
|
|
257
257
|
}
|
|
258
258
|
function publicAssertion(row) {
|
|
259
259
|
return {
|
|
@@ -290,10 +290,10 @@ async function lockIdentityEnablementNodes(target, schema) {
|
|
|
290
290
|
);
|
|
291
291
|
}
|
|
292
292
|
async function loadNodeSnapshot(target, schema, graphId, coordinate) {
|
|
293
|
-
const sqlCoordinate =
|
|
293
|
+
const sqlCoordinate = chunkPF6F5NLJ_cjs.identitySqlCoordinate(coordinate, chunkMCLYU6BN_cjs.nowIso());
|
|
294
294
|
const rows = await target.execute(
|
|
295
295
|
chunkVCRRKBLN_cjs.asCompiledRowsSql(
|
|
296
|
-
|
|
296
|
+
chunkPF6F5NLJ_cjs.identityNodeSnapshotSource(schema, graphId, sqlCoordinate)
|
|
297
297
|
)
|
|
298
298
|
);
|
|
299
299
|
return rows.map((row) => ({
|
|
@@ -373,8 +373,8 @@ async function loadCurrentStructuralClasses(target, schema, graphId, references)
|
|
|
373
373
|
);
|
|
374
374
|
}
|
|
375
375
|
async function loadCurrentVisibleMembers(target, schema, graphId, ref) {
|
|
376
|
-
const now =
|
|
377
|
-
const coordinate =
|
|
376
|
+
const now = chunkMCLYU6BN_cjs.nowIso();
|
|
377
|
+
const coordinate = chunkPF6F5NLJ_cjs.identitySqlCoordinate(void 0, now);
|
|
378
378
|
const rows = await target.execute(
|
|
379
379
|
chunkVCRRKBLN_cjs.asCompiledRowsSql(chunkVCRRKBLN_cjs.sql`
|
|
380
380
|
WITH anchor AS (
|
|
@@ -400,7 +400,7 @@ async function loadCurrentVisibleMembers(target, schema, graphId, ref) {
|
|
|
400
400
|
WHERE n.graph_id = ${graphId}
|
|
401
401
|
AND n.kind = m.kind
|
|
402
402
|
AND n.id = m.id
|
|
403
|
-
AND ${
|
|
403
|
+
AND ${chunkPF6F5NLJ_cjs.identityNodeVisibilitySql(coordinate, "n")}
|
|
404
404
|
`)
|
|
405
405
|
);
|
|
406
406
|
const members = rows.map((row) => ({ kind: row.kind, id: row.id })).toSorted((left, right) => compareReferences(left, right));
|
|
@@ -448,13 +448,13 @@ async function loadHistoricalClasses(target, schema, graphId, references, coordi
|
|
|
448
448
|
}
|
|
449
449
|
return combined;
|
|
450
450
|
}
|
|
451
|
-
const currentInstant =
|
|
452
|
-
const sqlCoordinate =
|
|
451
|
+
const currentInstant = chunkMCLYU6BN_cjs.nowIso();
|
|
452
|
+
const sqlCoordinate = chunkPF6F5NLJ_cjs.identitySqlCoordinate(coordinate, currentInstant);
|
|
453
453
|
const seeds = chunkVCRRKBLN_cjs.sql.join(
|
|
454
454
|
uniqueReferences.map((ref) => chunkVCRRKBLN_cjs.sql`(${ref.kind}, ${ref.id})`),
|
|
455
455
|
chunkVCRRKBLN_cjs.sql`, `
|
|
456
456
|
);
|
|
457
|
-
const reconstruction =
|
|
457
|
+
const reconstruction = chunkPF6F5NLJ_cjs.historicalIdentityReconstructionCtes({
|
|
458
458
|
schema,
|
|
459
459
|
graphId,
|
|
460
460
|
coordinate: sqlCoordinate,
|
|
@@ -467,7 +467,7 @@ async function loadHistoricalClasses(target, schema, graphId, references, coordi
|
|
|
467
467
|
${reconstruction}
|
|
468
468
|
SELECT member.seed_kind, member.seed_id,
|
|
469
469
|
member.kind AS member_kind, member.id AS member_id,
|
|
470
|
-
CASE WHEN ${
|
|
470
|
+
CASE WHEN ${chunkPF6F5NLJ_cjs.identityNodeVisibilitySql(sqlCoordinate, "n")}
|
|
471
471
|
THEN 1 ELSE 0 END AS is_visible
|
|
472
472
|
FROM identity_members member
|
|
473
473
|
JOIN node_snapshot n ON n.kind = member.kind AND n.id = member.id
|
|
@@ -518,10 +518,10 @@ function visibleMembersAtCoordinate(ctx, ref) {
|
|
|
518
518
|
);
|
|
519
519
|
}
|
|
520
520
|
async function loadAssertions(target, schema, graphId, coordinate, currentInstant) {
|
|
521
|
-
const source =
|
|
521
|
+
const source = chunkPF6F5NLJ_cjs.identityAssertionSnapshotSource(
|
|
522
522
|
schema,
|
|
523
523
|
graphId,
|
|
524
|
-
|
|
524
|
+
chunkPF6F5NLJ_cjs.identitySqlCoordinate(coordinate, currentInstant),
|
|
525
525
|
void 0
|
|
526
526
|
);
|
|
527
527
|
const rows = await target.execute(
|
|
@@ -560,10 +560,10 @@ async function loadAssertionsTouching(target, schema, graphId, references, coord
|
|
|
560
560
|
}
|
|
561
561
|
return [...byId.values()];
|
|
562
562
|
}
|
|
563
|
-
const source =
|
|
563
|
+
const source = chunkPF6F5NLJ_cjs.identityAssertionSnapshotSource(
|
|
564
564
|
schema,
|
|
565
565
|
graphId,
|
|
566
|
-
|
|
566
|
+
chunkPF6F5NLJ_cjs.identitySqlCoordinate(coordinate, chunkMCLYU6BN_cjs.nowIso()),
|
|
567
567
|
relation
|
|
568
568
|
);
|
|
569
569
|
const aMatches = referenceCondition(
|
|
@@ -578,7 +578,7 @@ async function loadAssertionsTouching(target, schema, graphId, references, coord
|
|
|
578
578
|
);
|
|
579
579
|
const rows = await target.execute(
|
|
580
580
|
chunkVCRRKBLN_cjs.asCompiledRowsSql(chunkVCRRKBLN_cjs.sql`
|
|
581
|
-
SELECT ${
|
|
581
|
+
SELECT ${chunkPF6F5NLJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
582
582
|
FROM (${source}) identity_assertions
|
|
583
583
|
WHERE ${aMatches} OR ${bMatches}
|
|
584
584
|
`)
|
|
@@ -696,7 +696,7 @@ async function withWriteTransactionSession(target, ctx, fn) {
|
|
|
696
696
|
try {
|
|
697
697
|
const result = await fn();
|
|
698
698
|
if (session.wrote && ctx.revisionTrackingEnabled && !ctx.historyEnabled) {
|
|
699
|
-
await
|
|
699
|
+
await chunkPF6F5NLJ_cjs.advanceRevisionClock(target, ctx.revisionSchema, ctx.graphId, true);
|
|
700
700
|
}
|
|
701
701
|
return result;
|
|
702
702
|
} finally {
|
|
@@ -765,12 +765,12 @@ function runInWriteTransaction(ctx, backend, fn, options) {
|
|
|
765
765
|
heldGraphWriteLocks.set(target, held);
|
|
766
766
|
const acquiresLock = needsGraphWriteLock && session?.lock === void 0 && !held.has(ctx.graphId);
|
|
767
767
|
if (acquiresLock) held.add(ctx.graphId);
|
|
768
|
-
const lock = acquiresLock ? await
|
|
768
|
+
const lock = acquiresLock ? await chunkPF6F5NLJ_cjs.lockRecordedGraphWrite(target, ctx.graphId).catch(
|
|
769
769
|
(error) => {
|
|
770
770
|
held.delete(ctx.graphId);
|
|
771
771
|
throw error;
|
|
772
772
|
}
|
|
773
|
-
) : session?.lock ??
|
|
773
|
+
) : session?.lock ?? chunkPF6F5NLJ_cjs.uncapturedGraphWriteLock();
|
|
774
774
|
if (session !== void 0) session.lock = lock;
|
|
775
775
|
const result = await (acquiresLock ? fn(target, lock).finally(() => held.delete(ctx.graphId)) : fn(target, lock));
|
|
776
776
|
if (session !== void 0) {
|
|
@@ -778,7 +778,7 @@ function runInWriteTransaction(ctx, backend, fn, options) {
|
|
|
778
778
|
return result;
|
|
779
779
|
}
|
|
780
780
|
if (ctx.revisionTrackingEnabled && !ctx.historyEnabled && (options?.didWrite?.(result) ?? true)) {
|
|
781
|
-
await
|
|
781
|
+
await chunkPF6F5NLJ_cjs.advanceRevisionClock(
|
|
782
782
|
target,
|
|
783
783
|
ctx.revisionSchema,
|
|
784
784
|
ctx.graphId,
|
|
@@ -897,7 +897,7 @@ function identityActiveKinds(registry) {
|
|
|
897
897
|
return new Set(registry.nodeKinds.keys());
|
|
898
898
|
}
|
|
899
899
|
async function loadSnapshot(target, schema, graphId, coordinate, allowedKinds, sameIdAcrossKinds = "fold") {
|
|
900
|
-
const currentInstant =
|
|
900
|
+
const currentInstant = chunkMCLYU6BN_cjs.nowIso();
|
|
901
901
|
const [nodes, assertions] = await Promise.all([
|
|
902
902
|
loadNodeSnapshot(target, schema, graphId, coordinate),
|
|
903
903
|
loadAssertions(target, schema, graphId, coordinate, currentInstant)
|
|
@@ -1177,7 +1177,7 @@ function pairKey(pair) {
|
|
|
1177
1177
|
return `${pair.low}${PAIR_KEY_SEPARATOR}${pair.high}`;
|
|
1178
1178
|
}
|
|
1179
1179
|
function orderedPair(first, second) {
|
|
1180
|
-
return
|
|
1180
|
+
return chunkPF6F5NLJ_cjs.compareCodePoints(first, second) <= 0 ? { low: first, high: second } : { low: second, high: first };
|
|
1181
1181
|
}
|
|
1182
1182
|
function buildSeparationProjection(assertions, classKeyOf) {
|
|
1183
1183
|
const pairs = /* @__PURE__ */ new Map();
|
|
@@ -1397,10 +1397,10 @@ function owedProbeChunkSize(target) {
|
|
|
1397
1397
|
});
|
|
1398
1398
|
}
|
|
1399
1399
|
function liveDifferentSource(schema, graphId) {
|
|
1400
|
-
return
|
|
1400
|
+
return chunkPF6F5NLJ_cjs.identityAssertionSnapshotSource(
|
|
1401
1401
|
schema,
|
|
1402
1402
|
graphId,
|
|
1403
|
-
|
|
1403
|
+
chunkPF6F5NLJ_cjs.identitySqlCoordinate(void 0, chunkMCLYU6BN_cjs.nowIso()),
|
|
1404
1404
|
"different"
|
|
1405
1405
|
);
|
|
1406
1406
|
}
|
|
@@ -1544,7 +1544,7 @@ async function validateCurrentRelation(ctx, target, relation, operation, a, b) {
|
|
|
1544
1544
|
async function currentAssertionForPair(target, schema, graphId, relation, a, b) {
|
|
1545
1545
|
const rows = await target.execute(
|
|
1546
1546
|
chunkVCRRKBLN_cjs.asCompiledRowsSql(chunkVCRRKBLN_cjs.sql`
|
|
1547
|
-
SELECT ${
|
|
1547
|
+
SELECT ${chunkPF6F5NLJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
1548
1548
|
FROM ${schema.identityAssertionsTable}
|
|
1549
1549
|
WHERE graph_id = ${graphId}
|
|
1550
1550
|
AND rel = ${relation}
|
|
@@ -1568,7 +1568,7 @@ async function insertAssertion(target, schema, graphId, relation, a, b, timestam
|
|
|
1568
1568
|
function buildAssertionRow(graphId, relation, a, b, timestamp, preserved) {
|
|
1569
1569
|
return {
|
|
1570
1570
|
graph_id: graphId,
|
|
1571
|
-
id: preserved?.id ??
|
|
1571
|
+
id: preserved?.id ?? chunkPF6F5NLJ_cjs.generateId(),
|
|
1572
1572
|
rel: relation,
|
|
1573
1573
|
a_kind: a.kind,
|
|
1574
1574
|
a_id: a.id,
|
|
@@ -1610,7 +1610,7 @@ async function insertAssertionRows(target, schema, rows) {
|
|
|
1610
1610
|
await executeIdentityStatement(
|
|
1611
1611
|
target,
|
|
1612
1612
|
chunkVCRRKBLN_cjs.sql`
|
|
1613
|
-
INSERT INTO ${schema.identityAssertionsTable} (${
|
|
1613
|
+
INSERT INTO ${schema.identityAssertionsTable} (${chunkPF6F5NLJ_cjs.IDENTITY_ASSERTION_COLUMNS}) VALUES ${chunkVCRRKBLN_cjs.sql.join(values, chunkVCRRKBLN_cjs.sql`, `)}
|
|
1614
1614
|
`
|
|
1615
1615
|
);
|
|
1616
1616
|
}
|
|
@@ -1631,7 +1631,7 @@ async function loadAssertionsByIds(target, schema, graphId, ids) {
|
|
|
1631
1631
|
);
|
|
1632
1632
|
const rows = await target.execute(
|
|
1633
1633
|
chunkVCRRKBLN_cjs.asCompiledRowsSql(chunkVCRRKBLN_cjs.sql`
|
|
1634
|
-
SELECT ${
|
|
1634
|
+
SELECT ${chunkPF6F5NLJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
1635
1635
|
FROM ${schema.identityAssertionsTable}
|
|
1636
1636
|
WHERE graph_id = ${graphId} AND id IN (${idList})
|
|
1637
1637
|
`)
|
|
@@ -1940,7 +1940,7 @@ async function assertPair(ctx, target, relation, firstInput, secondInput, touch)
|
|
|
1940
1940
|
relation,
|
|
1941
1941
|
a,
|
|
1942
1942
|
b,
|
|
1943
|
-
|
|
1943
|
+
chunkMCLYU6BN_cjs.nowIso(),
|
|
1944
1944
|
touch
|
|
1945
1945
|
);
|
|
1946
1946
|
if (relation === "same") {
|
|
@@ -2053,7 +2053,7 @@ async function bulkAssertPairs(ctx, target, relation, pairs, touch) {
|
|
|
2053
2053
|
const createdRows = [];
|
|
2054
2054
|
const results = [];
|
|
2055
2055
|
const closureReferences = [];
|
|
2056
|
-
const timestamp =
|
|
2056
|
+
const timestamp = chunkMCLYU6BN_cjs.nowIso();
|
|
2057
2057
|
const operation = relation === "same" ? "assertSame" : "assertDifferent";
|
|
2058
2058
|
for (const [a, b] of normalizedPairs) {
|
|
2059
2059
|
const semanticKey = assertionSemanticKey(relation, a, b);
|
|
@@ -2150,7 +2150,7 @@ async function bulkAssertPairs(ctx, target, relation, pairs, touch) {
|
|
|
2150
2150
|
async function findCurrentAssertionById(target, schema, graphId, id) {
|
|
2151
2151
|
const rows = await target.execute(
|
|
2152
2152
|
chunkVCRRKBLN_cjs.asCompiledRowsSql(chunkVCRRKBLN_cjs.sql`
|
|
2153
|
-
SELECT ${
|
|
2153
|
+
SELECT ${chunkPF6F5NLJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
2154
2154
|
FROM ${schema.identityAssertionsTable}
|
|
2155
2155
|
WHERE graph_id = ${graphId}
|
|
2156
2156
|
AND id = ${id}
|
|
@@ -2169,7 +2169,7 @@ async function retractById(ctx, target, id, touch) {
|
|
|
2169
2169
|
id
|
|
2170
2170
|
);
|
|
2171
2171
|
if (existing === void 0) return void 0;
|
|
2172
|
-
const now =
|
|
2172
|
+
const now = chunkMCLYU6BN_cjs.nowIso();
|
|
2173
2173
|
const validTo = clampValidTo(now, existing.valid_from);
|
|
2174
2174
|
const ended = { ...existing, valid_to: validTo, updated_at: now };
|
|
2175
2175
|
await executeIdentityStatement(
|
|
@@ -2201,7 +2201,7 @@ async function retractByIds(ctx, target, ids, touch) {
|
|
|
2201
2201
|
);
|
|
2202
2202
|
const rows = await target.execute(
|
|
2203
2203
|
chunkVCRRKBLN_cjs.asCompiledRowsSql(chunkVCRRKBLN_cjs.sql`
|
|
2204
|
-
SELECT ${
|
|
2204
|
+
SELECT ${chunkPF6F5NLJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
2205
2205
|
FROM ${ctx.schema.identityAssertionsTable}
|
|
2206
2206
|
WHERE graph_id = ${ctx.graphId}
|
|
2207
2207
|
AND id IN (${placeholders})
|
|
@@ -2212,7 +2212,7 @@ async function retractByIds(ctx, target, ids, touch) {
|
|
|
2212
2212
|
current.push(...rows.map((row) => normalizeIdentityAssertionRow(row)));
|
|
2213
2213
|
}
|
|
2214
2214
|
if (current.length === 0) return [];
|
|
2215
|
-
const now =
|
|
2215
|
+
const now = chunkMCLYU6BN_cjs.nowIso();
|
|
2216
2216
|
const byValidTo = /* @__PURE__ */ new Map();
|
|
2217
2217
|
const endedById = /* @__PURE__ */ new Map();
|
|
2218
2218
|
for (const row of current) {
|
|
@@ -2275,7 +2275,7 @@ async function runIdentityMutation(ctx, fn) {
|
|
|
2275
2275
|
ctx.backend,
|
|
2276
2276
|
async (target) => {
|
|
2277
2277
|
await lockIdentityGraph(target, ctx.graphId);
|
|
2278
|
-
return
|
|
2278
|
+
return chunkPF6F5NLJ_cjs.withRecordedIdentityMutationTarget(
|
|
2279
2279
|
target,
|
|
2280
2280
|
(rawTarget, touch) => fn(
|
|
2281
2281
|
rawTarget,
|
|
@@ -2400,7 +2400,7 @@ function createIdentityReadFacade(ctx) {
|
|
|
2400
2400
|
);
|
|
2401
2401
|
return assertions.filter(
|
|
2402
2402
|
(assertion) => assertion.a_kind === ref.kind && assertion.a_id === ref.id || assertion.b_kind === ref.kind && assertion.b_id === ref.id
|
|
2403
|
-
).toSorted((left, right) =>
|
|
2403
|
+
).toSorted((left, right) => chunkPF6F5NLJ_cjs.compareCodePoints(left.id, right.id)).map((assertion) => publicAssertion(assertion));
|
|
2404
2404
|
}
|
|
2405
2405
|
};
|
|
2406
2406
|
}
|
|
@@ -2604,8 +2604,8 @@ function validateTransferShape(ctx, assertion, mode) {
|
|
|
2604
2604
|
}
|
|
2605
2605
|
);
|
|
2606
2606
|
}
|
|
2607
|
-
const now =
|
|
2608
|
-
if (assertion.validTo === void 0 &&
|
|
2607
|
+
const now = chunkMCLYU6BN_cjs.nowIso();
|
|
2608
|
+
if (assertion.validTo === void 0 && chunkPF6F5NLJ_cjs.compareCodePoints(assertion.validFrom, now) > 0) {
|
|
2609
2609
|
throw transferShapeError(
|
|
2610
2610
|
assertion,
|
|
2611
2611
|
"Identity import cannot contain future-dated open assertions.",
|
|
@@ -2615,7 +2615,7 @@ function validateTransferShape(ctx, assertion, mode) {
|
|
|
2615
2615
|
}
|
|
2616
2616
|
);
|
|
2617
2617
|
}
|
|
2618
|
-
if (assertion.validTo !== void 0 &&
|
|
2618
|
+
if (assertion.validTo !== void 0 && chunkPF6F5NLJ_cjs.compareCodePoints(assertion.validTo, assertion.validFrom) < 0) {
|
|
2619
2619
|
throw transferShapeError(
|
|
2620
2620
|
assertion,
|
|
2621
2621
|
"Identity assertion validity window is empty.",
|
|
@@ -2648,7 +2648,7 @@ function validateTransferShape(ctx, assertion, mode) {
|
|
|
2648
2648
|
);
|
|
2649
2649
|
}
|
|
2650
2650
|
}
|
|
2651
|
-
if (assertion.validTo !== void 0 &&
|
|
2651
|
+
if (assertion.validTo !== void 0 && chunkPF6F5NLJ_cjs.compareCodePoints(assertion.validTo, now) > 0) {
|
|
2652
2652
|
throw transferShapeError(
|
|
2653
2653
|
assertion,
|
|
2654
2654
|
"Identity import cannot contain assertions that end in the future.",
|
|
@@ -2684,7 +2684,7 @@ function rethrowTaggedWithAssertion(error, assertionId, progress) {
|
|
|
2684
2684
|
async function importIdentityAssertionsIntoTarget(ctx, target, assertions, mode) {
|
|
2685
2685
|
let created = 0;
|
|
2686
2686
|
let skipped = 0;
|
|
2687
|
-
await
|
|
2687
|
+
await chunkPF6F5NLJ_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget, touch) => {
|
|
2688
2688
|
const normalized = assertions.map((assertion) => ({
|
|
2689
2689
|
assertion,
|
|
2690
2690
|
endpoints: validateTransferShape(ctx, assertion, mode)
|
|
@@ -2812,7 +2812,7 @@ async function importIdentityAssertionsIntoTarget(ctx, target, assertions, mode)
|
|
|
2812
2812
|
assertion.relation,
|
|
2813
2813
|
a,
|
|
2814
2814
|
b,
|
|
2815
|
-
|
|
2815
|
+
chunkMCLYU6BN_cjs.nowIso(),
|
|
2816
2816
|
touch,
|
|
2817
2817
|
{ id: assertion.id, validFrom: assertion.validFrom }
|
|
2818
2818
|
);
|
|
@@ -2888,7 +2888,7 @@ async function rebuildIdentityClosureForContext(ctx) {
|
|
|
2888
2888
|
requireAtomicIdentityBackend(ctx.backend, ctx.graphId);
|
|
2889
2889
|
async function rebuildAtTarget(target) {
|
|
2890
2890
|
await lockIdentityGraph(target, ctx.graphId);
|
|
2891
|
-
await
|
|
2891
|
+
await chunkPF6F5NLJ_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget) => {
|
|
2892
2892
|
const activeKinds = identityActiveKinds(ctx.registry);
|
|
2893
2893
|
const snapshot = await loadSnapshot(
|
|
2894
2894
|
rawTarget,
|
|
@@ -3080,7 +3080,7 @@ async function assertAffectedIdentityClassesConsistent(ctx, target, seeds) {
|
|
|
3080
3080
|
await lockIdentityGraph(target, ctx.graphId);
|
|
3081
3081
|
const observed = await findAffectedClassInconsistency(ctx, target, seeds);
|
|
3082
3082
|
if (observed === void 0) return;
|
|
3083
|
-
await
|
|
3083
|
+
await chunkPF6F5NLJ_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget) => {
|
|
3084
3084
|
await replaceClosure(
|
|
3085
3085
|
rawTarget,
|
|
3086
3086
|
ctx.schema,
|
|
@@ -3110,7 +3110,7 @@ async function deleteAssertionsTouchingKinds(target, schema, graphId, kinds, tou
|
|
|
3110
3110
|
);
|
|
3111
3111
|
const rows = await target.execute(
|
|
3112
3112
|
chunkVCRRKBLN_cjs.asCompiledRowsSql(chunkVCRRKBLN_cjs.sql`
|
|
3113
|
-
SELECT ${
|
|
3113
|
+
SELECT ${chunkPF6F5NLJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
3114
3114
|
FROM ${schema.identityAssertionsTable}
|
|
3115
3115
|
WHERE graph_id = ${graphId}
|
|
3116
3116
|
AND (a_kind IN (${kindList2}) OR b_kind IN (${kindList2}))
|
|
@@ -3247,7 +3247,7 @@ async function liveNodeKindsSharingIds(ctx, target, ids) {
|
|
|
3247
3247
|
async function foldIdentityForCreatedNodes(ctx, target, references) {
|
|
3248
3248
|
if (references.length === 0 || ctx.sameIdAcrossKinds === "ignore") return;
|
|
3249
3249
|
await lockIdentityGraph(target, ctx.graphId);
|
|
3250
|
-
await
|
|
3250
|
+
await chunkPF6F5NLJ_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget) => {
|
|
3251
3251
|
const liveKindsById = await liveNodeKindsSharingIds(
|
|
3252
3252
|
ctx,
|
|
3253
3253
|
rawTarget,
|
|
@@ -3314,7 +3314,7 @@ async function readNodeDeletionInstant(target, schema, graphId, ref) {
|
|
|
3314
3314
|
}
|
|
3315
3315
|
async function detachIdentityForNode(ctx, target, ref, mode) {
|
|
3316
3316
|
await lockIdentityGraph(target, ctx.graphId);
|
|
3317
|
-
await
|
|
3317
|
+
await chunkPF6F5NLJ_cjs.withRecordedIdentityMutationTarget(target, async (rawTarget, touch) => {
|
|
3318
3318
|
const touchesNode = chunkVCRRKBLN_cjs.sql`
|
|
3319
3319
|
(
|
|
3320
3320
|
(a_kind = ${ref.kind} AND a_id = ${ref.id})
|
|
@@ -3324,7 +3324,7 @@ async function detachIdentityForNode(ctx, target, ref, mode) {
|
|
|
3324
3324
|
const scope = mode === "hard" ? chunkVCRRKBLN_cjs.sql`` : chunkVCRRKBLN_cjs.sql`AND valid_to IS NULL AND deleted_at IS NULL`;
|
|
3325
3325
|
const rows = await rawTarget.execute(
|
|
3326
3326
|
chunkVCRRKBLN_cjs.asCompiledRowsSql(chunkVCRRKBLN_cjs.sql`
|
|
3327
|
-
SELECT ${
|
|
3327
|
+
SELECT ${chunkPF6F5NLJ_cjs.IDENTITY_ASSERTION_COLUMNS}
|
|
3328
3328
|
FROM ${ctx.schema.identityAssertionsTable}
|
|
3329
3329
|
WHERE graph_id = ${ctx.graphId}
|
|
3330
3330
|
${scope}
|
|
@@ -3339,7 +3339,7 @@ async function detachIdentityForNode(ctx, target, ref, mode) {
|
|
|
3339
3339
|
)) {
|
|
3340
3340
|
return;
|
|
3341
3341
|
}
|
|
3342
|
-
const now =
|
|
3342
|
+
const now = chunkMCLYU6BN_cjs.nowIso();
|
|
3343
3343
|
const cascadeInstant = mode === "hard" || rows.length === 0 ? now : await readNodeDeletionInstant(
|
|
3344
3344
|
rawTarget,
|
|
3345
3345
|
ctx.schema,
|
|
@@ -3428,5 +3428,5 @@ exports.validateNodeProps = validateNodeProps;
|
|
|
3428
3428
|
exports.validateProps = validateProps;
|
|
3429
3429
|
exports.withWriteTransactionSession = withWriteTransactionSession;
|
|
3430
3430
|
exports.wrapZodError = wrapZodError;
|
|
3431
|
-
//# sourceMappingURL=chunk-
|
|
3432
|
-
//# sourceMappingURL=chunk-
|
|
3431
|
+
//# sourceMappingURL=chunk-DTVWX77L.cjs.map
|
|
3432
|
+
//# sourceMappingURL=chunk-DTVWX77L.cjs.map
|