@nicia-ai/typegraph 0.35.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/backend/postgres/index.cjs +24 -24
- package/dist/backend/postgres/index.d.cts +6 -6
- package/dist/backend/postgres/index.d.ts +6 -6
- package/dist/backend/postgres/index.js +11 -11
- package/dist/backend/postgres/pglite.cjs +16 -16
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +11 -11
- package/dist/backend/sqlite/index.cjs +22 -21
- package/dist/backend/sqlite/index.d.cts +11 -9
- package/dist/backend/sqlite/index.d.ts +11 -9
- package/dist/backend/sqlite/index.js +10 -9
- package/dist/backend/sqlite/libsql.cjs +15 -14
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +3 -3
- package/dist/backend/sqlite/libsql.d.ts +3 -3
- package/dist/backend/sqlite/libsql.js +11 -10
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +30 -23
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +18 -11
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-TCOCYN2P.cjs → chunk-27SSDCEP.cjs} +14 -14
- package/dist/{chunk-TCOCYN2P.cjs.map → chunk-27SSDCEP.cjs.map} +1 -1
- package/dist/{chunk-5AQIKK56.cjs → chunk-2N6EOBTH.cjs} +16 -16
- package/dist/{chunk-5AQIKK56.cjs.map → chunk-2N6EOBTH.cjs.map} +1 -1
- package/dist/{chunk-FN35DLCN.cjs → chunk-3C2RYI6L.cjs} +13 -107
- package/dist/chunk-3C2RYI6L.cjs.map +1 -0
- package/dist/{chunk-4JEZZJ6S.cjs → chunk-3DS7Z4T4.cjs} +39 -39
- package/dist/{chunk-4JEZZJ6S.cjs.map → chunk-3DS7Z4T4.cjs.map} +1 -1
- package/dist/{chunk-BLZDPRXT.cjs → chunk-3GH67G4Z.cjs} +5 -5
- package/dist/{chunk-BLZDPRXT.cjs.map → chunk-3GH67G4Z.cjs.map} +1 -1
- package/dist/{chunk-K3PPLHY7.js → chunk-3RWZPJKV.js} +24 -9
- package/dist/chunk-3RWZPJKV.js.map +1 -0
- package/dist/{chunk-QWEUYILR.js → chunk-3SLPDKHQ.js} +4 -4
- package/dist/chunk-3SLPDKHQ.js.map +1 -0
- package/dist/{chunk-5A6FNS6N.cjs → chunk-3XXGYU62.cjs} +11 -11
- package/dist/{chunk-5A6FNS6N.cjs.map → chunk-3XXGYU62.cjs.map} +1 -1
- package/dist/{chunk-JBTOYDMN.js → chunk-44TA22QT.js} +58 -11
- package/dist/chunk-44TA22QT.js.map +1 -0
- package/dist/{chunk-UES55P7G.js → chunk-552KNYQJ.js} +2652 -409
- package/dist/chunk-552KNYQJ.js.map +1 -0
- package/dist/{chunk-VPYHY3LJ.cjs → chunk-5KEQ74YU.cjs} +14 -14
- package/dist/chunk-5KEQ74YU.cjs.map +1 -0
- package/dist/{chunk-Q5TEXCTB.js → chunk-5KPNWT6X.js} +3 -3
- package/dist/{chunk-Q5TEXCTB.js.map → chunk-5KPNWT6X.js.map} +1 -1
- package/dist/{chunk-MP2JQKSG.js → chunk-5PNMDJ7J.js} +108 -5
- package/dist/chunk-5PNMDJ7J.js.map +1 -0
- package/dist/{chunk-AW4A3P5A.cjs → chunk-5VQM6VWP.cjs} +2 -2
- package/dist/{chunk-AW4A3P5A.cjs.map → chunk-5VQM6VWP.cjs.map} +1 -1
- package/dist/{chunk-A3W7QG7K.js → chunk-5WWVZMVX.js} +2 -2
- package/dist/{chunk-A3W7QG7K.js.map → chunk-5WWVZMVX.js.map} +1 -1
- package/dist/{chunk-FACJJWGF.cjs → chunk-6EEO3OVU.cjs} +7 -7
- package/dist/{chunk-FACJJWGF.cjs.map → chunk-6EEO3OVU.cjs.map} +1 -1
- package/dist/{chunk-LGEALRC6.cjs → chunk-BVRDGYXQ.cjs} +113 -4
- package/dist/chunk-BVRDGYXQ.cjs.map +1 -0
- package/dist/{chunk-GSQ6NPH6.cjs → chunk-DEFQM7JU.cjs} +7 -7
- package/dist/{chunk-GSQ6NPH6.cjs.map → chunk-DEFQM7JU.cjs.map} +1 -1
- package/dist/{chunk-EM3CWPND.cjs → chunk-DIQ3AV5W.cjs} +574 -268
- package/dist/chunk-DIQ3AV5W.cjs.map +1 -0
- package/dist/{chunk-FPIZFYHE.js → chunk-EXU3RASM.js} +74 -15
- package/dist/chunk-EXU3RASM.js.map +1 -0
- package/dist/{chunk-H7YNSMA7.cjs → chunk-HAHNRASW.cjs} +20 -2
- package/dist/chunk-HAHNRASW.cjs.map +1 -0
- package/dist/{chunk-FL472AMI.cjs → chunk-IP3CGGPA.cjs} +8 -8
- package/dist/{chunk-FL472AMI.cjs.map → chunk-IP3CGGPA.cjs.map} +1 -1
- package/dist/{chunk-4TOD4LBZ.cjs → chunk-IPSVVTWT.cjs} +94 -35
- package/dist/chunk-IPSVVTWT.cjs.map +1 -0
- package/dist/{chunk-RGP33ZJ5.js → chunk-IXGYRP2P.js} +184 -92
- package/dist/chunk-IXGYRP2P.js.map +1 -0
- package/dist/{chunk-3TWF3SH4.js → chunk-J4IUSYFF.js} +251 -121
- package/dist/chunk-J4IUSYFF.js.map +1 -0
- package/dist/{chunk-O7UN7OXA.cjs → chunk-JBNOGRKW.cjs} +318 -188
- package/dist/chunk-JBNOGRKW.cjs.map +1 -0
- package/dist/{chunk-WDBCBWC4.js → chunk-K3Q3LJY3.js} +520 -221
- package/dist/chunk-K3Q3LJY3.js.map +1 -0
- package/dist/{chunk-OR5ZA5WP.js → chunk-K5UBVGJN.js} +4 -4
- package/dist/{chunk-OR5ZA5WP.js.map → chunk-K5UBVGJN.js.map} +1 -1
- package/dist/{chunk-UZV3AZKF.js → chunk-KQJ54OG5.js} +3 -3
- package/dist/{chunk-UZV3AZKF.js.map → chunk-KQJ54OG5.js.map} +1 -1
- package/dist/{chunk-QOTI55H7.js → chunk-L7HQ2OSI.js} +4 -4
- package/dist/{chunk-QOTI55H7.js.map → chunk-L7HQ2OSI.js.map} +1 -1
- package/dist/{chunk-55MZDDZV.js → chunk-M6VES7V6.js} +4 -4
- package/dist/{chunk-55MZDDZV.js.map → chunk-M6VES7V6.js.map} +1 -1
- package/dist/{chunk-J7WFGBJR.cjs → chunk-NBP2WTJW.cjs} +3249 -1006
- package/dist/chunk-NBP2WTJW.cjs.map +1 -0
- package/dist/{chunk-CK5BVQOW.cjs → chunk-NUIG3BCV.cjs} +100 -85
- package/dist/chunk-NUIG3BCV.cjs.map +1 -0
- package/dist/{chunk-EMF62TZG.cjs → chunk-NXQFATMF.cjs} +269 -177
- package/dist/chunk-NXQFATMF.cjs.map +1 -0
- package/dist/{chunk-KBGQIPRQ.js → chunk-PC2UBAUB.js} +20 -3
- package/dist/chunk-PC2UBAUB.js.map +1 -0
- package/dist/chunk-QARBLBXT.cjs +219 -0
- package/dist/chunk-QARBLBXT.cjs.map +1 -0
- package/dist/{chunk-6FR2MMS6.js → chunk-QERAIDRJ.js} +45 -4
- package/dist/chunk-QERAIDRJ.js.map +1 -0
- package/dist/chunk-QSXTWU4U.cjs +12 -0
- package/dist/{chunk-GUR2FNB5.cjs.map → chunk-QSXTWU4U.cjs.map} +1 -1
- package/dist/{chunk-QNKSQTKQ.js → chunk-RCVLFTCT.js} +49 -19
- package/dist/chunk-RCVLFTCT.js.map +1 -0
- package/dist/{chunk-VSPCZAXF.js → chunk-RRSNR3TP.js} +3 -3
- package/dist/{chunk-VSPCZAXF.js.map → chunk-RRSNR3TP.js.map} +1 -1
- package/dist/{chunk-WJT7OU7E.cjs → chunk-TGOMW4MB.cjs} +129 -98
- package/dist/chunk-TGOMW4MB.cjs.map +1 -0
- package/dist/{chunk-KMI7LYAF.js → chunk-TKT2XHED.js} +8 -8
- package/dist/{chunk-KMI7LYAF.js.map → chunk-TKT2XHED.js.map} +1 -1
- package/dist/{chunk-RGPG7EOJ.js → chunk-TPF25IG6.js} +3 -3
- package/dist/{chunk-RGPG7EOJ.js.map → chunk-TPF25IG6.js.map} +1 -1
- package/dist/{chunk-5SEGFTZX.js → chunk-UGZUAYAR.js} +3 -3
- package/dist/{chunk-5SEGFTZX.js.map → chunk-UGZUAYAR.js.map} +1 -1
- package/dist/{chunk-VHMPG6UL.js → chunk-UXLSNRYL.js} +11 -105
- package/dist/chunk-UXLSNRYL.js.map +1 -0
- package/dist/{chunk-FRV5Q5IO.js → chunk-UYQMBBWJ.js} +3 -3
- package/dist/{chunk-FRV5Q5IO.js.map → chunk-UYQMBBWJ.js.map} +1 -1
- package/dist/{chunk-UUT7UN2N.cjs → chunk-VGDDG3XJ.cjs} +7 -7
- package/dist/{chunk-UUT7UN2N.cjs.map → chunk-VGDDG3XJ.cjs.map} +1 -1
- package/dist/{chunk-CZQ3FO2Q.js → chunk-VKGKDOKR.js} +56 -21
- package/dist/chunk-VKGKDOKR.js.map +1 -0
- package/dist/{chunk-CTTSDJLY.cjs → chunk-VL2V6PEN.cjs} +11 -11
- package/dist/{chunk-CTTSDJLY.cjs.map → chunk-VL2V6PEN.cjs.map} +1 -1
- package/dist/{chunk-XOX22WHL.cjs → chunk-WOJMKB3N.cjs} +125 -90
- package/dist/chunk-WOJMKB3N.cjs.map +1 -0
- package/dist/{chunk-UMDVATGY.cjs → chunk-WWFHO375.cjs} +6 -6
- package/dist/{chunk-UMDVATGY.cjs.map → chunk-WWFHO375.cjs.map} +1 -1
- package/dist/{chunk-I7ZUZKFD.js → chunk-XGPUQ56G.js} +3 -3
- package/dist/{chunk-I7ZUZKFD.js.map → chunk-XGPUQ56G.js.map} +1 -1
- package/dist/{chunk-D7ZEOS56.cjs → chunk-XGU7DZDA.cjs} +74 -14
- package/dist/chunk-XGU7DZDA.cjs.map +1 -0
- package/dist/{chunk-S55OV6PW.cjs → chunk-XPCZADMT.cjs} +54 -11
- package/dist/chunk-XPCZADMT.cjs.map +1 -0
- package/dist/{chunk-T2WUSPDA.js → chunk-XWV4JT34.js} +3 -3
- package/dist/{chunk-T2WUSPDA.js.map → chunk-XWV4JT34.js.map} +1 -1
- package/dist/chunk-YTSN73ND.js +212 -0
- package/dist/chunk-YTSN73ND.js.map +1 -0
- package/dist/{ddl-CZz7a0E8.d.cts → ddl-BD-ZfKeX.d.cts} +3 -3
- package/dist/{ddl-C2rZ-Aen.d.ts → ddl-CS0KUVwB.d.ts} +3 -3
- package/dist/{extension-types-ixRpJVUp.d.cts → extension-types-BM2ACfYO.d.cts} +6 -1
- package/dist/{extension-types-ixRpJVUp.d.ts → extension-types-BM2ACfYO.d.ts} +6 -1
- package/dist/{fulltext-strategy-CDkSSYhq.d.cts → fulltext-strategy-C27vXaeB.d.cts} +127 -8
- package/dist/{fulltext-strategy-B57yvC5Q.d.ts → fulltext-strategy-DebsMrqg.d.ts} +127 -8
- package/dist/graph-extension/index.cjs +19 -19
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-extension/index.js +4 -4
- package/dist/graph-merge/index.cjs +88 -88
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +6 -6
- package/dist/graph-merge/index.d.ts +6 -6
- package/dist/graph-merge/index.js +19 -19
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-Bks_3HHK.d.cts → index-BPM59vsg.d.cts} +119 -7
- package/dist/{index-6CSUAq-x.d.ts → index-BeacbPoe.d.ts} +119 -7
- package/dist/index.cjs +230 -185
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +53 -40
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +30 -21
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +8 -7
- package/dist/interchange/index.cjs +208 -30
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +25 -8
- package/dist/interchange/index.d.ts +25 -8
- package/dist/interchange/index.js +191 -11
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-DwQi8eV0.d.cts → manager-D00_NXvT.d.ts} +11 -2
- package/dist/{manager-ejUCB52T.d.ts → manager-nU1vTJLy.d.cts} +11 -2
- package/dist/{materialize-indexes-B4e9360H.d.cts → materialize-indexes-CuR3gAZb.d.cts} +8 -2
- package/dist/{materialize-indexes-te9TPMMJ.d.ts → materialize-indexes-zK2J_flP.d.ts} +8 -2
- package/dist/{postgres-DQ5R6rzV.d.ts → postgres-IaBA4RgE.d.ts} +1 -1
- package/dist/{postgres-CfEqsRMp.d.cts → postgres-YrYmPlaU.d.cts} +1 -1
- package/dist/profiler/index.cjs +3 -3
- package/dist/profiler/index.d.cts +7 -7
- package/dist/profiler/index.d.ts +7 -7
- package/dist/profiler/index.js +2 -2
- package/dist/provenance/index.cjs +32 -33
- package/dist/provenance/index.cjs.map +1 -1
- package/dist/provenance/index.d.cts +5 -5
- package/dist/provenance/index.d.ts +5 -5
- package/dist/provenance/index.js +5 -6
- package/dist/provenance/index.js.map +1 -1
- package/dist/schema/index.cjs +35 -35
- package/dist/schema/index.d.cts +7 -7
- package/dist/schema/index.d.ts +7 -7
- package/dist/schema/index.js +11 -11
- package/dist/{sqlite-DvQndLky.d.ts → sqlite-BUOHPx7p.d.ts} +1 -1
- package/dist/{sqlite-D7zBinNR.d.cts → sqlite-Pp8O19WE.d.cts} +1 -1
- package/dist/{store-view-CKbHFRnn.d.ts → store-view-ANL6mTph.d.ts} +457 -57
- package/dist/{store-view-BSpqvAxK.d.cts → store-view-X96Rd00T.d.cts} +457 -57
- package/dist/{types-Bv9DcS_E.d.cts → types-r-Zyq2Hz.d.cts} +2 -2
- package/dist/{types-CoxuV7EJ.d.ts → types-wsvuBgPK.d.ts} +2 -2
- package/dist/where-CJOpJj3a.d.ts +36 -0
- package/dist/where-K3uBP33l.d.cts +36 -0
- package/package.json +1 -1
- package/dist/chunk-3TWF3SH4.js.map +0 -1
- package/dist/chunk-4TOD4LBZ.cjs.map +0 -1
- package/dist/chunk-6FR2MMS6.js.map +0 -1
- package/dist/chunk-CK5BVQOW.cjs.map +0 -1
- package/dist/chunk-CZQ3FO2Q.js.map +0 -1
- package/dist/chunk-D7ZEOS56.cjs.map +0 -1
- package/dist/chunk-EM3CWPND.cjs.map +0 -1
- package/dist/chunk-EMF62TZG.cjs.map +0 -1
- package/dist/chunk-EOLERH7Y.cjs +0 -40
- package/dist/chunk-EOLERH7Y.cjs.map +0 -1
- package/dist/chunk-FN35DLCN.cjs.map +0 -1
- package/dist/chunk-FPIZFYHE.js.map +0 -1
- package/dist/chunk-GUR2FNB5.cjs +0 -12
- package/dist/chunk-H7YNSMA7.cjs.map +0 -1
- package/dist/chunk-J7WFGBJR.cjs.map +0 -1
- package/dist/chunk-JBTOYDMN.js.map +0 -1
- package/dist/chunk-K3PPLHY7.js.map +0 -1
- package/dist/chunk-KBGQIPRQ.js.map +0 -1
- package/dist/chunk-LGEALRC6.cjs.map +0 -1
- package/dist/chunk-MP2JQKSG.js.map +0 -1
- package/dist/chunk-O7UN7OXA.cjs.map +0 -1
- package/dist/chunk-QNKSQTKQ.js.map +0 -1
- package/dist/chunk-QWEUYILR.js.map +0 -1
- package/dist/chunk-RGP33ZJ5.js.map +0 -1
- package/dist/chunk-S55OV6PW.cjs.map +0 -1
- package/dist/chunk-UES55P7G.js.map +0 -1
- package/dist/chunk-UT3S4SEN.js +0 -31
- package/dist/chunk-UT3S4SEN.js.map +0 -1
- package/dist/chunk-VHMPG6UL.js.map +0 -1
- package/dist/chunk-VPYHY3LJ.cjs.map +0 -1
- package/dist/chunk-WDBCBWC4.js.map +0 -1
- package/dist/chunk-WJT7OU7E.cjs.map +0 -1
- package/dist/chunk-XOX22WHL.cjs.map +0 -1
- package/dist/where-7RKFOsXt.d.ts +0 -11
- package/dist/where-DdMIXOtH.d.cts +0 -11
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
3
|
+
var chunk5KEQ74YU_cjs = require('./chunk-5KEQ74YU.cjs');
|
|
4
|
+
var chunkACSVZPK7_cjs = require('./chunk-ACSVZPK7.cjs');
|
|
5
|
+
var chunkXGU7DZDA_cjs = require('./chunk-XGU7DZDA.cjs');
|
|
6
|
+
var chunkDEFQM7JU_cjs = require('./chunk-DEFQM7JU.cjs');
|
|
7
|
+
var chunkWOJMKB3N_cjs = require('./chunk-WOJMKB3N.cjs');
|
|
8
|
+
var chunkIPSVVTWT_cjs = require('./chunk-IPSVVTWT.cjs');
|
|
9
|
+
var chunk3GH67G4Z_cjs = require('./chunk-3GH67G4Z.cjs');
|
|
10
|
+
var chunkBVRDGYXQ_cjs = require('./chunk-BVRDGYXQ.cjs');
|
|
11
11
|
var chunkTDXIBCGY_cjs = require('./chunk-TDXIBCGY.cjs');
|
|
12
12
|
var drizzleOrm = require('drizzle-orm');
|
|
13
13
|
|
|
@@ -16,8 +16,8 @@ function nullToUndefined(value) {
|
|
|
16
16
|
return value === null ? void 0 : value;
|
|
17
17
|
}
|
|
18
18
|
function rowToNode(row) {
|
|
19
|
-
const rawProps =
|
|
20
|
-
const props =
|
|
19
|
+
const rawProps = chunkIPSVVTWT_cjs.rowPropsToObject(row.props);
|
|
20
|
+
const props = chunkDEFQM7JU_cjs.filterReservedKeys(rawProps, chunkDEFQM7JU_cjs.RESERVED_NODE_KEYS);
|
|
21
21
|
return {
|
|
22
22
|
kind: row.kind,
|
|
23
23
|
id: row.id,
|
|
@@ -36,8 +36,8 @@ function rowToNodeMeta(row) {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
function rowToEdge(row) {
|
|
39
|
-
const rawProps =
|
|
40
|
-
const props =
|
|
39
|
+
const rawProps = chunkIPSVVTWT_cjs.rowPropsToObject(row.props);
|
|
40
|
+
const props = chunkDEFQM7JU_cjs.filterReservedKeys(rawProps, chunkDEFQM7JU_cjs.RESERVED_EDGE_KEYS);
|
|
41
41
|
return {
|
|
42
42
|
id: row.id,
|
|
43
43
|
kind: row.kind,
|
|
@@ -62,11 +62,11 @@ function rowToEdgeMeta(row) {
|
|
|
62
62
|
// src/store/operations/write-transaction.ts
|
|
63
63
|
function runInWriteTransaction(ctx, backend, fn) {
|
|
64
64
|
const ownsWriteLock = "transaction" in backend && backend.capabilities.transactions;
|
|
65
|
-
return
|
|
66
|
-
const lock = ctx.historyEnabled || ctx.revisionTrackingEnabled ? await
|
|
65
|
+
return chunkIPSVVTWT_cjs.runOptionallyInTransaction(backend, async (target) => {
|
|
66
|
+
const lock = ctx.historyEnabled || ctx.revisionTrackingEnabled ? await chunkWOJMKB3N_cjs.lockRecordedGraphWrite(target, ctx.graphId) : chunkWOJMKB3N_cjs.uncapturedGraphWriteLock();
|
|
67
67
|
const result = await fn(target, lock);
|
|
68
68
|
if (ctx.revisionTrackingEnabled && !ctx.historyEnabled) {
|
|
69
|
-
await
|
|
69
|
+
await chunkWOJMKB3N_cjs.advanceRevisionClock(
|
|
70
70
|
target,
|
|
71
71
|
ctx.revisionSchema,
|
|
72
72
|
ctx.graphId,
|
|
@@ -89,7 +89,7 @@ async function checkDisjointnessConstraint(ctx, kind, id) {
|
|
|
89
89
|
for (const disjointKind of disjointKinds) {
|
|
90
90
|
const existing = await ctx.backend.getNode(ctx.graphId, disjointKind, id);
|
|
91
91
|
if (existing && !existing.deleted_at) {
|
|
92
|
-
const error =
|
|
92
|
+
const error = chunkWOJMKB3N_cjs.checkDisjointness(id, kind, [disjointKind], ctx.registry);
|
|
93
93
|
if (error) throw error;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -106,7 +106,7 @@ async function checkCardinalityConstraint(ctx, edgeKind, cardinality, fromKind,
|
|
|
106
106
|
fromKind,
|
|
107
107
|
fromId
|
|
108
108
|
});
|
|
109
|
-
const error =
|
|
109
|
+
const error = chunkWOJMKB3N_cjs.checkCardinality(
|
|
110
110
|
edgeKind,
|
|
111
111
|
fromKind,
|
|
112
112
|
fromId,
|
|
@@ -126,7 +126,7 @@ async function checkCardinalityConstraint(ctx, edgeKind, cardinality, fromKind,
|
|
|
126
126
|
toKind,
|
|
127
127
|
toId
|
|
128
128
|
});
|
|
129
|
-
const error =
|
|
129
|
+
const error = chunkWOJMKB3N_cjs.checkUniqueEdge(
|
|
130
130
|
edgeKind,
|
|
131
131
|
fromKind,
|
|
132
132
|
fromId,
|
|
@@ -148,7 +148,7 @@ async function checkCardinalityConstraint(ctx, edgeKind, cardinality, fromKind,
|
|
|
148
148
|
fromId,
|
|
149
149
|
activeOnly: true
|
|
150
150
|
});
|
|
151
|
-
const error =
|
|
151
|
+
const error = chunkWOJMKB3N_cjs.checkCardinality(
|
|
152
152
|
edgeKind,
|
|
153
153
|
fromKind,
|
|
154
154
|
fromId,
|
|
@@ -165,7 +165,7 @@ async function checkCardinalityConstraint(ctx, edgeKind, cardinality, fromKind,
|
|
|
165
165
|
// src/store/operations/node-operations.ts
|
|
166
166
|
function getNodeRegistration(graph, kind) {
|
|
167
167
|
const registration = graph.nodes[kind];
|
|
168
|
-
if (registration === void 0) throw new
|
|
168
|
+
if (registration === void 0) throw new chunkBVRDGYXQ_cjs.KindNotFoundError(kind, "node");
|
|
169
169
|
return registration;
|
|
170
170
|
}
|
|
171
171
|
var CACHE_KEY_SEPARATOR = "\0";
|
|
@@ -176,7 +176,7 @@ function buildUniqueCacheKey(graphId, nodeKind, constraintName, key) {
|
|
|
176
176
|
return `${graphId}${CACHE_KEY_SEPARATOR}${nodeKind}${CACHE_KEY_SEPARATOR}${constraintName}${CACHE_KEY_SEPARATOR}${key}`;
|
|
177
177
|
}
|
|
178
178
|
function createNodeAlreadyExistsError(kind, id) {
|
|
179
|
-
return new
|
|
179
|
+
return new chunkBVRDGYXQ_cjs.ValidationError(
|
|
180
180
|
`Node already exists: ${kind}/${id}`,
|
|
181
181
|
{
|
|
182
182
|
entityType: "node",
|
|
@@ -217,7 +217,7 @@ function resolveConstraint(graph, kind, constraintName) {
|
|
|
217
217
|
(candidate) => candidate.name === constraintName
|
|
218
218
|
);
|
|
219
219
|
if (constraint === void 0) {
|
|
220
|
-
throw new
|
|
220
|
+
throw new chunkBVRDGYXQ_cjs.NodeConstraintNotFoundError(constraintName, kind);
|
|
221
221
|
}
|
|
222
222
|
return constraint;
|
|
223
223
|
}
|
|
@@ -278,8 +278,8 @@ function createNodeBatchValidationBackend(graphId, registry, backend) {
|
|
|
278
278
|
}
|
|
279
279
|
function registerPendingUniqueEntries(kind, id, props, constraints) {
|
|
280
280
|
for (const constraint of constraints) {
|
|
281
|
-
if (!
|
|
282
|
-
const key =
|
|
281
|
+
if (!chunkWOJMKB3N_cjs.checkWherePredicate(constraint, props)) continue;
|
|
282
|
+
const key = chunkWOJMKB3N_cjs.computeUniqueKey(
|
|
283
283
|
props,
|
|
284
284
|
constraint.fields,
|
|
285
285
|
constraint.collation
|
|
@@ -292,7 +292,7 @@ function createNodeBatchValidationBackend(graphId, registry, backend) {
|
|
|
292
292
|
);
|
|
293
293
|
pendingUniqueOwners.set(concreteEntryKey, id);
|
|
294
294
|
if (constraint.scope !== "kind") {
|
|
295
|
-
const kindsToCheck =
|
|
295
|
+
const kindsToCheck = chunkWOJMKB3N_cjs.getKindsForUniquenessCheck(
|
|
296
296
|
kind,
|
|
297
297
|
constraint.scope,
|
|
298
298
|
registry
|
|
@@ -311,12 +311,12 @@ function createNodeBatchValidationBackend(graphId, registry, backend) {
|
|
|
311
311
|
}
|
|
312
312
|
function registerAppliedNodeUpdate(kind, id, oldProps, newProps, constraints) {
|
|
313
313
|
for (const constraint of constraints) {
|
|
314
|
-
const oldApplies =
|
|
315
|
-
const newApplies =
|
|
316
|
-
const oldKey = oldApplies ?
|
|
317
|
-
const newKey = newApplies ?
|
|
314
|
+
const oldApplies = chunkWOJMKB3N_cjs.checkWherePredicate(constraint, oldProps);
|
|
315
|
+
const newApplies = chunkWOJMKB3N_cjs.checkWherePredicate(constraint, newProps);
|
|
316
|
+
const oldKey = oldApplies ? chunkWOJMKB3N_cjs.computeUniqueKey(oldProps, constraint.fields, constraint.collation) : void 0;
|
|
317
|
+
const newKey = newApplies ? chunkWOJMKB3N_cjs.computeUniqueKey(newProps, constraint.fields, constraint.collation) : void 0;
|
|
318
318
|
if (oldKey === newKey) continue;
|
|
319
|
-
const kindsToCheck =
|
|
319
|
+
const kindsToCheck = chunkWOJMKB3N_cjs.getKindsForUniquenessCheck(
|
|
320
320
|
kind,
|
|
321
321
|
constraint.scope,
|
|
322
322
|
registry
|
|
@@ -356,7 +356,7 @@ function createNodeBatchValidationBackend(graphId, registry, backend) {
|
|
|
356
356
|
if (uniqueCache.has(cacheKey)) return;
|
|
357
357
|
uniqueCache.set(cacheKey, row);
|
|
358
358
|
}
|
|
359
|
-
const validationBackend =
|
|
359
|
+
const validationBackend = chunkIPSVVTWT_cjs.createBackendOverlay(backend, {
|
|
360
360
|
getNode: getNodeCached,
|
|
361
361
|
checkUnique: checkUniqueCached
|
|
362
362
|
});
|
|
@@ -373,7 +373,7 @@ function draftNodeCreate(ctx, input, id, options) {
|
|
|
373
373
|
const kind = input.kind;
|
|
374
374
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
375
375
|
const nodeKind = registration.type;
|
|
376
|
-
const validatedProps = options?.propsPreValidated === true ? input.props :
|
|
376
|
+
const validatedProps = options?.propsPreValidated === true ? input.props : chunk5KEQ74YU_cjs.validateNodeProps(nodeKind.schema, input.props, {
|
|
377
377
|
kind,
|
|
378
378
|
operation: "create"
|
|
379
379
|
});
|
|
@@ -383,8 +383,8 @@ function draftNodeCreate(ctx, input, id, options) {
|
|
|
383
383
|
nodeKind,
|
|
384
384
|
uniqueConstraints: registration.unique ?? [],
|
|
385
385
|
validatedProps,
|
|
386
|
-
validFrom:
|
|
387
|
-
validTo:
|
|
386
|
+
validFrom: chunk3GH67G4Z_cjs.validateOptionalCanonicalIsoDate(input.validFrom, "validFrom"),
|
|
387
|
+
validTo: chunk3GH67G4Z_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo")
|
|
388
388
|
};
|
|
389
389
|
}
|
|
390
390
|
async function finishNodeCreatePreparation(ctx, draft, backend) {
|
|
@@ -399,8 +399,8 @@ async function finishNodeCreatePreparation(ctx, draft, backend) {
|
|
|
399
399
|
backend
|
|
400
400
|
};
|
|
401
401
|
await checkDisjointnessConstraint(constraintContext, kind, id);
|
|
402
|
-
await
|
|
403
|
-
|
|
402
|
+
await chunkWOJMKB3N_cjs.checkUniquenessConstraints(
|
|
403
|
+
chunkWOJMKB3N_cjs.createUniquenessContext(ctx.graphId, ctx.registry, backend),
|
|
404
404
|
kind,
|
|
405
405
|
id,
|
|
406
406
|
validatedProps,
|
|
@@ -430,8 +430,8 @@ async function validateAndPrepareNodeCreate(ctx, input, id, backend, options) {
|
|
|
430
430
|
);
|
|
431
431
|
}
|
|
432
432
|
async function finalizeNodeCreateBatch(ctx, preparedCreates, backend, lock) {
|
|
433
|
-
await
|
|
434
|
-
|
|
433
|
+
await chunkWOJMKB3N_cjs.applyNodeInsertSideEffectsBatch(
|
|
434
|
+
chunkWOJMKB3N_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
435
435
|
preparedCreates.map((prepared) => ({
|
|
436
436
|
kind: prepared.kind,
|
|
437
437
|
id: prepared.id,
|
|
@@ -443,8 +443,8 @@ async function finalizeNodeCreateBatch(ctx, preparedCreates, backend, lock) {
|
|
|
443
443
|
);
|
|
444
444
|
}
|
|
445
445
|
async function finalizeNodeCreate(ctx, prepared, backend, lock) {
|
|
446
|
-
await
|
|
447
|
-
|
|
446
|
+
await chunkWOJMKB3N_cjs.applyNodeInsertSideEffects(
|
|
447
|
+
chunkWOJMKB3N_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
448
448
|
{
|
|
449
449
|
kind: prepared.kind,
|
|
450
450
|
id: prepared.id,
|
|
@@ -455,21 +455,51 @@ async function finalizeNodeCreate(ctx, prepared, backend, lock) {
|
|
|
455
455
|
backend
|
|
456
456
|
);
|
|
457
457
|
}
|
|
458
|
+
function computeNodeUpdate(ctx, kind, id, existingProps, inputProps) {
|
|
459
|
+
const registration = getNodeRegistration(ctx.graph, kind);
|
|
460
|
+
const validatedProps = chunk5KEQ74YU_cjs.validateNodeProps(
|
|
461
|
+
registration.type.schema,
|
|
462
|
+
{ ...existingProps, ...inputProps },
|
|
463
|
+
{ kind, operation: "update", id }
|
|
464
|
+
);
|
|
465
|
+
return { registration, validatedProps };
|
|
466
|
+
}
|
|
467
|
+
function resolveNodeUpdateProps(ctx, existing, inputProps) {
|
|
468
|
+
const existingProps = chunkIPSVVTWT_cjs.rowPropsToObject(existing.props);
|
|
469
|
+
const { registration, validatedProps } = computeNodeUpdate(
|
|
470
|
+
ctx,
|
|
471
|
+
existing.kind,
|
|
472
|
+
existing.id,
|
|
473
|
+
existingProps,
|
|
474
|
+
inputProps
|
|
475
|
+
);
|
|
476
|
+
return { registration, existingProps, validatedProps };
|
|
477
|
+
}
|
|
478
|
+
function nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps) {
|
|
479
|
+
const { validatedProps } = computeNodeUpdate(
|
|
480
|
+
ctx,
|
|
481
|
+
kind,
|
|
482
|
+
id,
|
|
483
|
+
existingProps,
|
|
484
|
+
inputProps
|
|
485
|
+
);
|
|
486
|
+
return {
|
|
487
|
+
validatedProps,
|
|
488
|
+
unchanged: chunkACSVZPK7_cjs.canonicalEqual(validatedProps, existingProps)
|
|
489
|
+
};
|
|
490
|
+
}
|
|
458
491
|
async function performNodeUpdate(ctx, input, backend, lock, options) {
|
|
459
492
|
const { kind, id } = input;
|
|
460
|
-
const registration = getNodeRegistration(ctx.graph, kind);
|
|
461
493
|
const existing = await backend.getNode(ctx.graphId, kind, id);
|
|
462
|
-
if (!existing) throw new
|
|
463
|
-
const
|
|
464
|
-
|
|
494
|
+
if (!existing) throw new chunkBVRDGYXQ_cjs.NodeNotFoundError(kind, id);
|
|
495
|
+
const { registration, validatedProps } = resolveNodeUpdateProps(
|
|
496
|
+
ctx,
|
|
497
|
+
existing,
|
|
498
|
+
input.props
|
|
499
|
+
);
|
|
465
500
|
const nodeKind = registration.type;
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
operation: "update",
|
|
469
|
-
id
|
|
470
|
-
});
|
|
471
|
-
const validTo = chunkBLZDPRXT_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
|
|
472
|
-
const writeContext = chunkXOX22WHL_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock);
|
|
501
|
+
const validTo = chunk3GH67G4Z_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
|
|
502
|
+
const writeContext = chunkWOJMKB3N_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock);
|
|
473
503
|
const shared = {
|
|
474
504
|
schema: nodeKind.schema,
|
|
475
505
|
validatedProps,
|
|
@@ -477,15 +507,15 @@ async function performNodeUpdate(ctx, input, backend, lock, options) {
|
|
|
477
507
|
...validTo !== void 0 && { validTo }
|
|
478
508
|
};
|
|
479
509
|
if (options?.clearDeleted) {
|
|
480
|
-
const row2 = await
|
|
510
|
+
const row2 = await chunkWOJMKB3N_cjs.applyNodeUpdate(
|
|
481
511
|
writeContext,
|
|
482
512
|
{ ...shared, existing, clearDeleted: true },
|
|
483
513
|
backend
|
|
484
514
|
);
|
|
485
515
|
return rowToNode(row2);
|
|
486
516
|
}
|
|
487
|
-
if (!
|
|
488
|
-
const row = await
|
|
517
|
+
if (!chunkIPSVVTWT_cjs.isLiveNodeRow(existing)) throw new chunkBVRDGYXQ_cjs.NodeNotFoundError(kind, id);
|
|
518
|
+
const row = await chunkWOJMKB3N_cjs.applyNodeUpdate(
|
|
489
519
|
writeContext,
|
|
490
520
|
{ ...shared, existing },
|
|
491
521
|
backend
|
|
@@ -513,13 +543,13 @@ async function primeBatchValidationCaches(ctx, drafts, backend, seams) {
|
|
|
513
543
|
const groups = /* @__PURE__ */ new Map();
|
|
514
544
|
for (const draft of drafts) {
|
|
515
545
|
for (const constraint of draft.uniqueConstraints) {
|
|
516
|
-
if (!
|
|
517
|
-
const key =
|
|
546
|
+
if (!chunkWOJMKB3N_cjs.checkWherePredicate(constraint, draft.validatedProps)) continue;
|
|
547
|
+
const key = chunkWOJMKB3N_cjs.computeUniqueKey(
|
|
518
548
|
draft.validatedProps,
|
|
519
549
|
constraint.fields,
|
|
520
550
|
constraint.collation
|
|
521
551
|
);
|
|
522
|
-
const kindsToCheck =
|
|
552
|
+
const kindsToCheck = chunkWOJMKB3N_cjs.getKindsForUniquenessCheck(
|
|
523
553
|
draft.kind,
|
|
524
554
|
constraint.scope,
|
|
525
555
|
ctx.registry
|
|
@@ -565,7 +595,7 @@ async function prepareBatchCreates(ctx, inputs, backend, options) {
|
|
|
565
595
|
seedUniqueRow
|
|
566
596
|
} = createNodeBatchValidationBackend(ctx.graphId, ctx.registry, backend);
|
|
567
597
|
const drafts = inputs.map(
|
|
568
|
-
(input) => draftNodeCreate(ctx, input, input.id ??
|
|
598
|
+
(input) => draftNodeCreate(ctx, input, input.id ?? chunkWOJMKB3N_cjs.generateId(), options)
|
|
569
599
|
);
|
|
570
600
|
await primeBatchValidationCaches(ctx, drafts, backend, {
|
|
571
601
|
seedNodeRow,
|
|
@@ -641,7 +671,7 @@ async function batchCheckUniqueAcrossKinds(backend, graphId, constraintName, uni
|
|
|
641
671
|
}
|
|
642
672
|
async function executeNodeCreateInternal(ctx, input, backend, options) {
|
|
643
673
|
const kind = input.kind;
|
|
644
|
-
const id = input.id ??
|
|
674
|
+
const id = input.id ?? chunkWOJMKB3N_cjs.generateId();
|
|
645
675
|
const opContext = ctx.createOperationContext("create", "node", kind, id);
|
|
646
676
|
const shouldReturnRow = options?.returnRow ?? true;
|
|
647
677
|
return runHookedWriteOperation(
|
|
@@ -660,8 +690,8 @@ async function executeNodeCreateInternal(ctx, input, backend, options) {
|
|
|
660
690
|
if (shouldReturnRow) {
|
|
661
691
|
row = await target.insertNode(prepared.insertParams);
|
|
662
692
|
} else {
|
|
663
|
-
await
|
|
664
|
-
|
|
693
|
+
await chunkWOJMKB3N_cjs.runInsertNoReturn(
|
|
694
|
+
chunkWOJMKB3N_cjs.nodeInsertDispatch(target),
|
|
665
695
|
prepared.insertParams
|
|
666
696
|
);
|
|
667
697
|
}
|
|
@@ -677,7 +707,7 @@ async function executeNodeCreate(ctx, input, backend, options) {
|
|
|
677
707
|
...options
|
|
678
708
|
});
|
|
679
709
|
if (!result) {
|
|
680
|
-
throw new
|
|
710
|
+
throw new chunkBVRDGYXQ_cjs.DatabaseOperationError(
|
|
681
711
|
"Node create failed: expected created node row",
|
|
682
712
|
{ operation: "insert", entity: "node" }
|
|
683
713
|
);
|
|
@@ -692,7 +722,7 @@ async function executeNodeCreateNoReturnBatch(ctx, inputs, backend) {
|
|
|
692
722
|
inputs,
|
|
693
723
|
target
|
|
694
724
|
);
|
|
695
|
-
await
|
|
725
|
+
await chunkWOJMKB3N_cjs.runInsertBatch(chunkWOJMKB3N_cjs.nodeInsertDispatch(target), batchInsertParams);
|
|
696
726
|
await finalizeNodeCreateBatch(ctx, preparedCreates, target, lock);
|
|
697
727
|
});
|
|
698
728
|
}
|
|
@@ -705,8 +735,8 @@ async function executeNodeCreateBatch(ctx, inputs, backend, options) {
|
|
|
705
735
|
target,
|
|
706
736
|
options
|
|
707
737
|
);
|
|
708
|
-
const rows = await
|
|
709
|
-
|
|
738
|
+
const rows = await chunkWOJMKB3N_cjs.runInsertBatchReturning(
|
|
739
|
+
chunkWOJMKB3N_cjs.nodeInsertDispatch(target),
|
|
710
740
|
batchInsertParams
|
|
711
741
|
);
|
|
712
742
|
await finalizeNodeCreateBatch(ctx, preparedCreates, target, lock);
|
|
@@ -745,9 +775,9 @@ async function executeNodeDelete(ctx, kind, id, backend) {
|
|
|
745
775
|
async (target, lock) => {
|
|
746
776
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
747
777
|
const preflight = await target.getNode(ctx.graphId, kind, id);
|
|
748
|
-
if (!preflight || !
|
|
749
|
-
await
|
|
750
|
-
|
|
778
|
+
if (!preflight || !chunkIPSVVTWT_cjs.isLiveNodeRow(preflight)) return;
|
|
779
|
+
await chunkWOJMKB3N_cjs.applyNodeSoftDelete(
|
|
780
|
+
chunkWOJMKB3N_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
751
781
|
{
|
|
752
782
|
existing: preflight,
|
|
753
783
|
schema: registration.type.schema,
|
|
@@ -769,8 +799,8 @@ async function executeNodeHardDelete(ctx, kind, id, backend) {
|
|
|
769
799
|
backend,
|
|
770
800
|
async (target, lock) => {
|
|
771
801
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
772
|
-
await
|
|
773
|
-
|
|
802
|
+
await chunkWOJMKB3N_cjs.applyNodeHardDelete(
|
|
803
|
+
chunkWOJMKB3N_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
774
804
|
{
|
|
775
805
|
kind,
|
|
776
806
|
id,
|
|
@@ -786,12 +816,12 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
786
816
|
const ifExists = options?.ifExists ?? "return";
|
|
787
817
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
788
818
|
const nodeKind = registration.type;
|
|
789
|
-
const validatedProps =
|
|
819
|
+
const validatedProps = chunk5KEQ74YU_cjs.validateNodeProps(nodeKind.schema, props, {
|
|
790
820
|
kind,
|
|
791
821
|
operation: "create"
|
|
792
822
|
});
|
|
793
823
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
794
|
-
if (!
|
|
824
|
+
if (!chunkWOJMKB3N_cjs.checkWherePredicate(constraint, validatedProps)) {
|
|
795
825
|
const node = await executeNodeCreate(
|
|
796
826
|
ctx,
|
|
797
827
|
{ kind, props: validatedProps },
|
|
@@ -800,12 +830,12 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
800
830
|
);
|
|
801
831
|
return { node, action: "created" };
|
|
802
832
|
}
|
|
803
|
-
const key =
|
|
833
|
+
const key = chunkWOJMKB3N_cjs.computeUniqueKey(
|
|
804
834
|
validatedProps,
|
|
805
835
|
constraint.fields,
|
|
806
836
|
constraint.collation
|
|
807
837
|
);
|
|
808
|
-
const kindsToCheck =
|
|
838
|
+
const kindsToCheck = chunkWOJMKB3N_cjs.getKindsForUniquenessCheck(
|
|
809
839
|
kind,
|
|
810
840
|
constraint.scope,
|
|
811
841
|
ctx.registry
|
|
@@ -862,25 +892,25 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
862
892
|
try {
|
|
863
893
|
return await attempt();
|
|
864
894
|
} catch (error) {
|
|
865
|
-
if (!(error instanceof
|
|
895
|
+
if (!(error instanceof chunkBVRDGYXQ_cjs.UniquenessError)) throw error;
|
|
866
896
|
return attempt();
|
|
867
897
|
}
|
|
868
898
|
}
|
|
869
899
|
async function executeNodeFindByConstraint(ctx, kind, constraintName, props, backend) {
|
|
870
900
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
871
901
|
const nodeKind = registration.type;
|
|
872
|
-
const validatedProps =
|
|
902
|
+
const validatedProps = chunk5KEQ74YU_cjs.validateNodeProps(nodeKind.schema, props, {
|
|
873
903
|
kind,
|
|
874
904
|
operation: "create"
|
|
875
905
|
});
|
|
876
906
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
877
|
-
if (!
|
|
878
|
-
const key =
|
|
907
|
+
if (!chunkWOJMKB3N_cjs.checkWherePredicate(constraint, validatedProps)) return void 0;
|
|
908
|
+
const key = chunkWOJMKB3N_cjs.computeUniqueKey(
|
|
879
909
|
validatedProps,
|
|
880
910
|
constraint.fields,
|
|
881
911
|
constraint.collation
|
|
882
912
|
);
|
|
883
|
-
const kindsToCheck =
|
|
913
|
+
const kindsToCheck = chunkWOJMKB3N_cjs.getKindsForUniquenessCheck(
|
|
884
914
|
kind,
|
|
885
915
|
constraint.scope,
|
|
886
916
|
ctx.registry
|
|
@@ -906,12 +936,12 @@ async function executeNodeFindByConstraint(ctx, kind, constraintName, props, bac
|
|
|
906
936
|
function validateAndComputeKeys(nodeKind, kind, constraint, items) {
|
|
907
937
|
const validated = [];
|
|
908
938
|
for (const item of items) {
|
|
909
|
-
const validatedProps =
|
|
939
|
+
const validatedProps = chunk5KEQ74YU_cjs.validateNodeProps(nodeKind.schema, item.props, {
|
|
910
940
|
kind,
|
|
911
941
|
operation: "create"
|
|
912
942
|
});
|
|
913
|
-
const applies =
|
|
914
|
-
const key = applies ?
|
|
943
|
+
const applies = chunkWOJMKB3N_cjs.checkWherePredicate(constraint, validatedProps);
|
|
944
|
+
const key = applies ? chunkWOJMKB3N_cjs.computeUniqueKey(
|
|
915
945
|
validatedProps,
|
|
916
946
|
constraint.fields,
|
|
917
947
|
constraint.collation
|
|
@@ -934,7 +964,7 @@ async function executeNodeBulkFindByConstraint(ctx, kind, constraintName, items,
|
|
|
934
964
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
935
965
|
const validated = validateAndComputeKeys(nodeKind, kind, constraint, items);
|
|
936
966
|
const uniqueKeys = collectUniqueKeys(validated);
|
|
937
|
-
const kindsToCheck =
|
|
967
|
+
const kindsToCheck = chunkWOJMKB3N_cjs.getKindsForUniquenessCheck(
|
|
938
968
|
kind,
|
|
939
969
|
constraint.scope,
|
|
940
970
|
ctx.registry
|
|
@@ -984,10 +1014,10 @@ function resolveNodeIndex(graph, kind, indexName) {
|
|
|
984
1014
|
(candidate) => candidate.entity === "node" && candidate.kind === kind && candidate.name === indexName
|
|
985
1015
|
);
|
|
986
1016
|
if (declaration?.entity !== "node") {
|
|
987
|
-
throw new
|
|
1017
|
+
throw new chunkBVRDGYXQ_cjs.NodeIndexNotFoundError(indexName, kind);
|
|
988
1018
|
}
|
|
989
1019
|
if (declaration.method !== void 0) {
|
|
990
|
-
throw new
|
|
1020
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
991
1021
|
`bulkFindByIndex cannot probe index "${indexName}" (method "${declaration.method}"): only btree indexes serve equality probes.`,
|
|
992
1022
|
{ indexName, kind, method: declaration.method }
|
|
993
1023
|
);
|
|
@@ -1025,7 +1055,7 @@ function validateIndexProbeValue(value, valueType, pointer, kind) {
|
|
|
1025
1055
|
}
|
|
1026
1056
|
}
|
|
1027
1057
|
function indexProbeTypeError(pointer, kind, expected, value) {
|
|
1028
|
-
return new
|
|
1058
|
+
return new chunkBVRDGYXQ_cjs.ValidationError(
|
|
1029
1059
|
`Index probe value for "${pointer}" on node kind "${kind}" has an incompatible type`,
|
|
1030
1060
|
{
|
|
1031
1061
|
entityType: "node",
|
|
@@ -1059,7 +1089,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1059
1089
|
if (items.length === 0) return [];
|
|
1060
1090
|
const index = resolveNodeIndex(ctx.graph, kind, indexName);
|
|
1061
1091
|
if (index.fields.length === 0) {
|
|
1062
|
-
throw new
|
|
1092
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
1063
1093
|
`bulkFindByIndex requires an index with at least one prop-based field on index "${indexName}" (node kind "${kind}")`,
|
|
1064
1094
|
{ indexName, kind },
|
|
1065
1095
|
{
|
|
@@ -1068,7 +1098,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1068
1098
|
);
|
|
1069
1099
|
}
|
|
1070
1100
|
if (index.fieldValueTypes.includes("date")) {
|
|
1071
|
-
throw new
|
|
1101
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
1072
1102
|
`bulkFindByIndex does not support date-typed key fields on index "${indexName}" (node kind "${kind}")`,
|
|
1073
1103
|
{ indexName, kind },
|
|
1074
1104
|
{
|
|
@@ -1078,7 +1108,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1078
1108
|
}
|
|
1079
1109
|
const limitPerInput = options?.limitPerInput;
|
|
1080
1110
|
if (limitPerInput !== void 0 && (!Number.isInteger(limitPerInput) || limitPerInput <= 0)) {
|
|
1081
|
-
throw new
|
|
1111
|
+
throw new chunkBVRDGYXQ_cjs.ValidationError(
|
|
1082
1112
|
"bulkFindByIndex limitPerInput must be a positive integer",
|
|
1083
1113
|
{
|
|
1084
1114
|
entityType: "node",
|
|
@@ -1093,7 +1123,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1093
1123
|
}
|
|
1094
1124
|
);
|
|
1095
1125
|
}
|
|
1096
|
-
const adapter =
|
|
1126
|
+
const adapter = chunkXGU7DZDA_cjs.getDialect(backend.dialect);
|
|
1097
1127
|
const probes = items.map(
|
|
1098
1128
|
(item) => index.fields.map((pointer, position) => {
|
|
1099
1129
|
const value = chunkTDXIBCGY_cjs.resolveJsonPointer(item.props, pointer);
|
|
@@ -1120,13 +1150,13 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1120
1150
|
}
|
|
1121
1151
|
groupToInputs[existing]?.push(inputIndex);
|
|
1122
1152
|
}
|
|
1123
|
-
const schema = backend.tableNames ?
|
|
1153
|
+
const schema = backend.tableNames ? chunkWOJMKB3N_cjs.createSqlSchema(backend.tableNames) : chunkWOJMKB3N_cjs.DEFAULT_SQL_SCHEMA;
|
|
1124
1154
|
const compileContext = {
|
|
1125
1155
|
dialect: backend.dialect,
|
|
1126
1156
|
propsColumn: drizzleOrm.sql.raw(`"props"`),
|
|
1127
1157
|
systemColumn: (column) => drizzleOrm.sql.raw(`"${column}"`)
|
|
1128
1158
|
};
|
|
1129
|
-
const fieldKeys =
|
|
1159
|
+
const fieldKeys = chunkXGU7DZDA_cjs.compileNodeIndexFieldKeys(index, compileContext);
|
|
1130
1160
|
const groupPredicates = groupProbes.map(
|
|
1131
1161
|
(probe) => drizzleOrm.sql`(${drizzleOrm.sql.join(
|
|
1132
1162
|
fieldKeys.map((fieldKey, position) => {
|
|
@@ -1152,7 +1182,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1152
1182
|
drizzleOrm.sql`"deleted_at" IS NULL`
|
|
1153
1183
|
];
|
|
1154
1184
|
if (index.where !== void 0) {
|
|
1155
|
-
conditions.push(
|
|
1185
|
+
conditions.push(chunkXGU7DZDA_cjs.compileIndexWhere(compileContext, index.where));
|
|
1156
1186
|
}
|
|
1157
1187
|
conditions.push(drizzleOrm.sql`(${drizzleOrm.sql.join(groupPredicates, drizzleOrm.sql` OR `)})`);
|
|
1158
1188
|
const whereClause = drizzleOrm.sql.join(conditions, drizzleOrm.sql` AND `);
|
|
@@ -1160,7 +1190,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1160
1190
|
const capInSql = limitPerInput !== void 0 && backend.capabilities.windowFunctions;
|
|
1161
1191
|
const query = capInSql ? drizzleOrm.sql`SELECT "id", probe_idx FROM (SELECT "id", probe_idx, ROW_NUMBER() OVER (PARTITION BY probe_idx ORDER BY "id") AS probe_rank FROM (${probedSelect}) AS probed) AS ranked WHERE probe_rank <= ${limitPerInput} ORDER BY probe_idx, "id"` : drizzleOrm.sql`${probedSelect} ORDER BY probe_idx, "id"`;
|
|
1162
1192
|
const rawMatches = await backend.execute(
|
|
1163
|
-
|
|
1193
|
+
chunkIPSVVTWT_cjs.asCompiledRowsSql(query)
|
|
1164
1194
|
);
|
|
1165
1195
|
const matches = limitPerInput !== void 0 && !capInSql ? capMatchesPerGroup(rawMatches, limitPerInput) : rawMatches;
|
|
1166
1196
|
const nodesById = await hydrateNodesById(
|
|
@@ -1193,7 +1223,7 @@ function capMatchesPerGroup(matches, limitPerInput) {
|
|
|
1193
1223
|
return capped;
|
|
1194
1224
|
}
|
|
1195
1225
|
async function hydrateNodesById(backend, graphId, kind, ids) {
|
|
1196
|
-
const rowsById = await
|
|
1226
|
+
const rowsById = await chunkWOJMKB3N_cjs.getNodeRowsByIds(backend, graphId, kind, ids);
|
|
1197
1227
|
const nodesById = /* @__PURE__ */ new Map();
|
|
1198
1228
|
for (const [id, row] of rowsById) {
|
|
1199
1229
|
if (row.deleted_at !== void 0) continue;
|
|
@@ -1209,7 +1239,7 @@ async function executeNodeBulkGetOrCreateByConstraint(ctx, kind, constraintName,
|
|
|
1209
1239
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
1210
1240
|
const validated = validateAndComputeKeys(nodeKind, kind, constraint, items);
|
|
1211
1241
|
const uniqueKeys = collectUniqueKeys(validated);
|
|
1212
|
-
const kindsToCheck =
|
|
1242
|
+
const kindsToCheck = chunkWOJMKB3N_cjs.getKindsForUniquenessCheck(
|
|
1213
1243
|
kind,
|
|
1214
1244
|
constraint.scope,
|
|
1215
1245
|
ctx.registry
|
|
@@ -1323,6 +1353,7 @@ exports.executeNodeGetOrCreateByConstraint = executeNodeGetOrCreateByConstraint;
|
|
|
1323
1353
|
exports.executeNodeHardDelete = executeNodeHardDelete;
|
|
1324
1354
|
exports.executeNodeUpdate = executeNodeUpdate;
|
|
1325
1355
|
exports.executeNodeUpsertUpdate = executeNodeUpsertUpdate;
|
|
1356
|
+
exports.nodeUpsertDirtyCheck = nodeUpsertDirtyCheck;
|
|
1326
1357
|
exports.primeBatchValidationCaches = primeBatchValidationCaches;
|
|
1327
1358
|
exports.rowToEdge = rowToEdge;
|
|
1328
1359
|
exports.rowToEdgeMeta = rowToEdgeMeta;
|
|
@@ -1330,5 +1361,5 @@ exports.rowToNode = rowToNode;
|
|
|
1330
1361
|
exports.rowToNodeMeta = rowToNodeMeta;
|
|
1331
1362
|
exports.runHookedWriteOperation = runHookedWriteOperation;
|
|
1332
1363
|
exports.runInWriteTransaction = runInWriteTransaction;
|
|
1333
|
-
//# sourceMappingURL=chunk-
|
|
1334
|
-
//# sourceMappingURL=chunk-
|
|
1364
|
+
//# sourceMappingURL=chunk-TGOMW4MB.cjs.map
|
|
1365
|
+
//# sourceMappingURL=chunk-TGOMW4MB.cjs.map
|