@nicia-ai/typegraph 0.36.0 → 0.37.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/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-HW3LW7DH.cjs → chunk-3DS7Z4T4.cjs} +39 -39
- package/dist/{chunk-HW3LW7DH.cjs.map → chunk-3DS7Z4T4.cjs.map} +1 -1
- package/dist/{chunk-RSSQKPSZ.cjs → chunk-3GH67G4Z.cjs} +5 -5
- package/dist/{chunk-RSSQKPSZ.cjs.map → chunk-3GH67G4Z.cjs.map} +1 -1
- package/dist/{chunk-M75SUBFG.js → chunk-3RWZPJKV.js} +24 -9
- package/dist/chunk-3RWZPJKV.js.map +1 -0
- package/dist/{chunk-SKCOUWAX.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-IU46OHVW.js → chunk-44TA22QT.js} +58 -11
- package/dist/chunk-44TA22QT.js.map +1 -0
- package/dist/{chunk-7BQLPXK6.cjs → chunk-5AVRFNP4.cjs} +2955 -898
- package/dist/chunk-5AVRFNP4.cjs.map +1 -0
- package/dist/{chunk-2THZ3TQI.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-WI7ISNQF.js → chunk-5PNMDJ7J.js} +94 -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-DIK74MXX.cjs → chunk-BVRDGYXQ.cjs} +97 -4
- package/dist/chunk-BVRDGYXQ.cjs.map +1 -0
- package/dist/{chunk-4BCU6VFZ.cjs → chunk-DEFQM7JU.cjs} +7 -7
- package/dist/{chunk-4BCU6VFZ.cjs.map → chunk-DEFQM7JU.cjs.map} +1 -1
- package/dist/{chunk-456Z2U7Y.cjs → chunk-DIQ3AV5W.cjs} +574 -268
- package/dist/chunk-DIQ3AV5W.cjs.map +1 -0
- package/dist/{chunk-JFMEONLG.cjs → chunk-EJYMTO3K.cjs} +332 -188
- package/dist/chunk-EJYMTO3K.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-5DIPR3L3.js → chunk-GA4TT3DH.js} +2338 -281
- package/dist/chunk-GA4TT3DH.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-J3LEGNQB.cjs → chunk-IP3CGGPA.cjs} +8 -8
- package/dist/{chunk-J3LEGNQB.cjs.map → chunk-IP3CGGPA.cjs.map} +1 -1
- package/dist/{chunk-X4JBT642.cjs → chunk-IPSVVTWT.cjs} +94 -35
- package/dist/chunk-IPSVVTWT.cjs.map +1 -0
- package/dist/{chunk-VQEXF5D4.js → chunk-IXGYRP2P.js} +184 -92
- package/dist/chunk-IXGYRP2P.js.map +1 -0
- package/dist/{chunk-4GX2JJXS.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-SXGE7ITL.js → chunk-L7HQ2OSI.js} +4 -4
- package/dist/{chunk-SXGE7ITL.js.map → chunk-L7HQ2OSI.js.map} +1 -1
- package/dist/{chunk-RAXU3RMB.js → chunk-M6VES7V6.js} +4 -4
- package/dist/{chunk-RAXU3RMB.js.map → chunk-M6VES7V6.js.map} +1 -1
- package/dist/{chunk-PWGX5DF5.cjs → chunk-NUIG3BCV.cjs} +100 -85
- package/dist/chunk-NUIG3BCV.cjs.map +1 -0
- package/dist/{chunk-ZAMFOJ5P.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-4BMPGT35.cjs.map → chunk-QSXTWU4U.cjs.map} +1 -1
- package/dist/{chunk-DN5VP4JC.js → chunk-RCVLFTCT.js} +9 -10
- package/dist/chunk-RCVLFTCT.js.map +1 -0
- package/dist/{chunk-ZIGXMKQQ.js → chunk-RRSNR3TP.js} +3 -3
- package/dist/{chunk-ZIGXMKQQ.js.map → chunk-RRSNR3TP.js.map} +1 -1
- package/dist/{chunk-4CAXEB2F.cjs → chunk-TGOMW4MB.cjs} +91 -92
- package/dist/chunk-TGOMW4MB.cjs.map +1 -0
- package/dist/{chunk-PZKNKG5M.js → chunk-TKT2XHED.js} +8 -8
- package/dist/{chunk-PZKNKG5M.js.map → chunk-TKT2XHED.js.map} +1 -1
- package/dist/{chunk-S5F7ZLP2.js → chunk-TPF25IG6.js} +3 -3
- package/dist/{chunk-S5F7ZLP2.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-BJVEU3ZL.js → chunk-UV3WP5WZ.js} +265 -121
- package/dist/chunk-UV3WP5WZ.js.map +1 -0
- 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-5VTR2F2K.js → chunk-VKGKDOKR.js} +12 -10
- package/dist/chunk-VKGKDOKR.js.map +1 -0
- package/dist/{chunk-5W4L6DLF.cjs → chunk-VL2V6PEN.cjs} +11 -11
- package/dist/{chunk-5W4L6DLF.cjs.map → chunk-VL2V6PEN.cjs.map} +1 -1
- package/dist/{chunk-ZUNQ5BEP.cjs → chunk-WOJMKB3N.cjs} +82 -80
- 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-JFUPDJXD.js → chunk-XGPUQ56G.js} +3 -3
- package/dist/{chunk-JFUPDJXD.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.ts → extension-types-BM2ACfYO.d.cts} +6 -1
- package/dist/{extension-types-ixRpJVUp.d.cts → 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.d.cts +6 -6
- package/dist/graph-merge/index.d.ts +6 -6
- package/dist/graph-merge/index.js +19 -19
- package/dist/{index-BLtQWKRj.d.cts → index-BPM59vsg.d.cts} +52 -7
- package/dist/{index-BFvdmBPV.d.ts → index-BeacbPoe.d.ts} +52 -7
- package/dist/index.cjs +224 -187
- 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 +207 -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 +190 -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-CfEqsRMp.d.cts → postgres-IaBA4RgE.d.ts} +1 -1
- package/dist/{postgres-DQ5R6rzV.d.ts → 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-DplHC3Nt.d.ts → store-view-ANL6mTph.d.ts} +213 -27
- package/dist/{store-view-9KDOpZzF.d.cts → store-view-X96Rd00T.d.cts} +213 -27
- 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-2THZ3TQI.cjs.map +0 -1
- package/dist/chunk-456Z2U7Y.cjs.map +0 -1
- package/dist/chunk-4BMPGT35.cjs +0 -12
- package/dist/chunk-4CAXEB2F.cjs.map +0 -1
- package/dist/chunk-4GX2JJXS.js.map +0 -1
- package/dist/chunk-5DIPR3L3.js.map +0 -1
- package/dist/chunk-5VTR2F2K.js.map +0 -1
- package/dist/chunk-6FR2MMS6.js.map +0 -1
- package/dist/chunk-7BQLPXK6.cjs.map +0 -1
- package/dist/chunk-BJVEU3ZL.js.map +0 -1
- package/dist/chunk-D7ZEOS56.cjs.map +0 -1
- package/dist/chunk-DIK74MXX.cjs.map +0 -1
- package/dist/chunk-DN5VP4JC.js.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-H7YNSMA7.cjs.map +0 -1
- package/dist/chunk-IU46OHVW.js.map +0 -1
- package/dist/chunk-JFMEONLG.cjs.map +0 -1
- package/dist/chunk-KBGQIPRQ.js.map +0 -1
- package/dist/chunk-M75SUBFG.js.map +0 -1
- package/dist/chunk-PWGX5DF5.cjs.map +0 -1
- package/dist/chunk-S55OV6PW.cjs.map +0 -1
- package/dist/chunk-SKCOUWAX.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-VQEXF5D4.js.map +0 -1
- package/dist/chunk-WI7ISNQF.js.map +0 -1
- package/dist/chunk-X4JBT642.cjs.map +0 -1
- package/dist/chunk-ZAMFOJ5P.cjs.map +0 -1
- package/dist/chunk-ZUNQ5BEP.cjs.map +0 -1
- package/dist/where-7RKFOsXt.d.ts +0 -11
- package/dist/where-DdMIXOtH.d.cts +0 -11
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5KEQ74YU_cjs = require('./chunk-5KEQ74YU.cjs');
|
|
4
4
|
var chunkACSVZPK7_cjs = require('./chunk-ACSVZPK7.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var chunkDIK74MXX_cjs = require('./chunk-DIK74MXX.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');
|
|
12
11
|
var chunkTDXIBCGY_cjs = require('./chunk-TDXIBCGY.cjs');
|
|
13
12
|
var drizzleOrm = require('drizzle-orm');
|
|
14
13
|
|
|
@@ -17,8 +16,8 @@ function nullToUndefined(value) {
|
|
|
17
16
|
return value === null ? void 0 : value;
|
|
18
17
|
}
|
|
19
18
|
function rowToNode(row) {
|
|
20
|
-
const rawProps =
|
|
21
|
-
const props =
|
|
19
|
+
const rawProps = chunkIPSVVTWT_cjs.rowPropsToObject(row.props);
|
|
20
|
+
const props = chunkDEFQM7JU_cjs.filterReservedKeys(rawProps, chunkDEFQM7JU_cjs.RESERVED_NODE_KEYS);
|
|
22
21
|
return {
|
|
23
22
|
kind: row.kind,
|
|
24
23
|
id: row.id,
|
|
@@ -37,8 +36,8 @@ function rowToNodeMeta(row) {
|
|
|
37
36
|
};
|
|
38
37
|
}
|
|
39
38
|
function rowToEdge(row) {
|
|
40
|
-
const rawProps =
|
|
41
|
-
const props =
|
|
39
|
+
const rawProps = chunkIPSVVTWT_cjs.rowPropsToObject(row.props);
|
|
40
|
+
const props = chunkDEFQM7JU_cjs.filterReservedKeys(rawProps, chunkDEFQM7JU_cjs.RESERVED_EDGE_KEYS);
|
|
42
41
|
return {
|
|
43
42
|
id: row.id,
|
|
44
43
|
kind: row.kind,
|
|
@@ -63,11 +62,11 @@ function rowToEdgeMeta(row) {
|
|
|
63
62
|
// src/store/operations/write-transaction.ts
|
|
64
63
|
function runInWriteTransaction(ctx, backend, fn) {
|
|
65
64
|
const ownsWriteLock = "transaction" in backend && backend.capabilities.transactions;
|
|
66
|
-
return
|
|
67
|
-
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();
|
|
68
67
|
const result = await fn(target, lock);
|
|
69
68
|
if (ctx.revisionTrackingEnabled && !ctx.historyEnabled) {
|
|
70
|
-
await
|
|
69
|
+
await chunkWOJMKB3N_cjs.advanceRevisionClock(
|
|
71
70
|
target,
|
|
72
71
|
ctx.revisionSchema,
|
|
73
72
|
ctx.graphId,
|
|
@@ -90,7 +89,7 @@ async function checkDisjointnessConstraint(ctx, kind, id) {
|
|
|
90
89
|
for (const disjointKind of disjointKinds) {
|
|
91
90
|
const existing = await ctx.backend.getNode(ctx.graphId, disjointKind, id);
|
|
92
91
|
if (existing && !existing.deleted_at) {
|
|
93
|
-
const error =
|
|
92
|
+
const error = chunkWOJMKB3N_cjs.checkDisjointness(id, kind, [disjointKind], ctx.registry);
|
|
94
93
|
if (error) throw error;
|
|
95
94
|
}
|
|
96
95
|
}
|
|
@@ -107,7 +106,7 @@ async function checkCardinalityConstraint(ctx, edgeKind, cardinality, fromKind,
|
|
|
107
106
|
fromKind,
|
|
108
107
|
fromId
|
|
109
108
|
});
|
|
110
|
-
const error =
|
|
109
|
+
const error = chunkWOJMKB3N_cjs.checkCardinality(
|
|
111
110
|
edgeKind,
|
|
112
111
|
fromKind,
|
|
113
112
|
fromId,
|
|
@@ -127,7 +126,7 @@ async function checkCardinalityConstraint(ctx, edgeKind, cardinality, fromKind,
|
|
|
127
126
|
toKind,
|
|
128
127
|
toId
|
|
129
128
|
});
|
|
130
|
-
const error =
|
|
129
|
+
const error = chunkWOJMKB3N_cjs.checkUniqueEdge(
|
|
131
130
|
edgeKind,
|
|
132
131
|
fromKind,
|
|
133
132
|
fromId,
|
|
@@ -149,7 +148,7 @@ async function checkCardinalityConstraint(ctx, edgeKind, cardinality, fromKind,
|
|
|
149
148
|
fromId,
|
|
150
149
|
activeOnly: true
|
|
151
150
|
});
|
|
152
|
-
const error =
|
|
151
|
+
const error = chunkWOJMKB3N_cjs.checkCardinality(
|
|
153
152
|
edgeKind,
|
|
154
153
|
fromKind,
|
|
155
154
|
fromId,
|
|
@@ -166,7 +165,7 @@ async function checkCardinalityConstraint(ctx, edgeKind, cardinality, fromKind,
|
|
|
166
165
|
// src/store/operations/node-operations.ts
|
|
167
166
|
function getNodeRegistration(graph, kind) {
|
|
168
167
|
const registration = graph.nodes[kind];
|
|
169
|
-
if (registration === void 0) throw new
|
|
168
|
+
if (registration === void 0) throw new chunkBVRDGYXQ_cjs.KindNotFoundError(kind, "node");
|
|
170
169
|
return registration;
|
|
171
170
|
}
|
|
172
171
|
var CACHE_KEY_SEPARATOR = "\0";
|
|
@@ -177,7 +176,7 @@ function buildUniqueCacheKey(graphId, nodeKind, constraintName, key) {
|
|
|
177
176
|
return `${graphId}${CACHE_KEY_SEPARATOR}${nodeKind}${CACHE_KEY_SEPARATOR}${constraintName}${CACHE_KEY_SEPARATOR}${key}`;
|
|
178
177
|
}
|
|
179
178
|
function createNodeAlreadyExistsError(kind, id) {
|
|
180
|
-
return new
|
|
179
|
+
return new chunkBVRDGYXQ_cjs.ValidationError(
|
|
181
180
|
`Node already exists: ${kind}/${id}`,
|
|
182
181
|
{
|
|
183
182
|
entityType: "node",
|
|
@@ -218,7 +217,7 @@ function resolveConstraint(graph, kind, constraintName) {
|
|
|
218
217
|
(candidate) => candidate.name === constraintName
|
|
219
218
|
);
|
|
220
219
|
if (constraint === void 0) {
|
|
221
|
-
throw new
|
|
220
|
+
throw new chunkBVRDGYXQ_cjs.NodeConstraintNotFoundError(constraintName, kind);
|
|
222
221
|
}
|
|
223
222
|
return constraint;
|
|
224
223
|
}
|
|
@@ -279,8 +278,8 @@ function createNodeBatchValidationBackend(graphId, registry, backend) {
|
|
|
279
278
|
}
|
|
280
279
|
function registerPendingUniqueEntries(kind, id, props, constraints) {
|
|
281
280
|
for (const constraint of constraints) {
|
|
282
|
-
if (!
|
|
283
|
-
const key =
|
|
281
|
+
if (!chunkWOJMKB3N_cjs.checkWherePredicate(constraint, props)) continue;
|
|
282
|
+
const key = chunkWOJMKB3N_cjs.computeUniqueKey(
|
|
284
283
|
props,
|
|
285
284
|
constraint.fields,
|
|
286
285
|
constraint.collation
|
|
@@ -293,7 +292,7 @@ function createNodeBatchValidationBackend(graphId, registry, backend) {
|
|
|
293
292
|
);
|
|
294
293
|
pendingUniqueOwners.set(concreteEntryKey, id);
|
|
295
294
|
if (constraint.scope !== "kind") {
|
|
296
|
-
const kindsToCheck =
|
|
295
|
+
const kindsToCheck = chunkWOJMKB3N_cjs.getKindsForUniquenessCheck(
|
|
297
296
|
kind,
|
|
298
297
|
constraint.scope,
|
|
299
298
|
registry
|
|
@@ -312,12 +311,12 @@ function createNodeBatchValidationBackend(graphId, registry, backend) {
|
|
|
312
311
|
}
|
|
313
312
|
function registerAppliedNodeUpdate(kind, id, oldProps, newProps, constraints) {
|
|
314
313
|
for (const constraint of constraints) {
|
|
315
|
-
const oldApplies =
|
|
316
|
-
const newApplies =
|
|
317
|
-
const oldKey = oldApplies ?
|
|
318
|
-
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;
|
|
319
318
|
if (oldKey === newKey) continue;
|
|
320
|
-
const kindsToCheck =
|
|
319
|
+
const kindsToCheck = chunkWOJMKB3N_cjs.getKindsForUniquenessCheck(
|
|
321
320
|
kind,
|
|
322
321
|
constraint.scope,
|
|
323
322
|
registry
|
|
@@ -357,7 +356,7 @@ function createNodeBatchValidationBackend(graphId, registry, backend) {
|
|
|
357
356
|
if (uniqueCache.has(cacheKey)) return;
|
|
358
357
|
uniqueCache.set(cacheKey, row);
|
|
359
358
|
}
|
|
360
|
-
const validationBackend =
|
|
359
|
+
const validationBackend = chunkIPSVVTWT_cjs.createBackendOverlay(backend, {
|
|
361
360
|
getNode: getNodeCached,
|
|
362
361
|
checkUnique: checkUniqueCached
|
|
363
362
|
});
|
|
@@ -374,7 +373,7 @@ function draftNodeCreate(ctx, input, id, options) {
|
|
|
374
373
|
const kind = input.kind;
|
|
375
374
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
376
375
|
const nodeKind = registration.type;
|
|
377
|
-
const validatedProps = options?.propsPreValidated === true ? input.props :
|
|
376
|
+
const validatedProps = options?.propsPreValidated === true ? input.props : chunk5KEQ74YU_cjs.validateNodeProps(nodeKind.schema, input.props, {
|
|
378
377
|
kind,
|
|
379
378
|
operation: "create"
|
|
380
379
|
});
|
|
@@ -384,8 +383,8 @@ function draftNodeCreate(ctx, input, id, options) {
|
|
|
384
383
|
nodeKind,
|
|
385
384
|
uniqueConstraints: registration.unique ?? [],
|
|
386
385
|
validatedProps,
|
|
387
|
-
validFrom:
|
|
388
|
-
validTo:
|
|
386
|
+
validFrom: chunk3GH67G4Z_cjs.validateOptionalCanonicalIsoDate(input.validFrom, "validFrom"),
|
|
387
|
+
validTo: chunk3GH67G4Z_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo")
|
|
389
388
|
};
|
|
390
389
|
}
|
|
391
390
|
async function finishNodeCreatePreparation(ctx, draft, backend) {
|
|
@@ -400,8 +399,8 @@ async function finishNodeCreatePreparation(ctx, draft, backend) {
|
|
|
400
399
|
backend
|
|
401
400
|
};
|
|
402
401
|
await checkDisjointnessConstraint(constraintContext, kind, id);
|
|
403
|
-
await
|
|
404
|
-
|
|
402
|
+
await chunkWOJMKB3N_cjs.checkUniquenessConstraints(
|
|
403
|
+
chunkWOJMKB3N_cjs.createUniquenessContext(ctx.graphId, ctx.registry, backend),
|
|
405
404
|
kind,
|
|
406
405
|
id,
|
|
407
406
|
validatedProps,
|
|
@@ -431,8 +430,8 @@ async function validateAndPrepareNodeCreate(ctx, input, id, backend, options) {
|
|
|
431
430
|
);
|
|
432
431
|
}
|
|
433
432
|
async function finalizeNodeCreateBatch(ctx, preparedCreates, backend, lock) {
|
|
434
|
-
await
|
|
435
|
-
|
|
433
|
+
await chunkWOJMKB3N_cjs.applyNodeInsertSideEffectsBatch(
|
|
434
|
+
chunkWOJMKB3N_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
436
435
|
preparedCreates.map((prepared) => ({
|
|
437
436
|
kind: prepared.kind,
|
|
438
437
|
id: prepared.id,
|
|
@@ -444,8 +443,8 @@ async function finalizeNodeCreateBatch(ctx, preparedCreates, backend, lock) {
|
|
|
444
443
|
);
|
|
445
444
|
}
|
|
446
445
|
async function finalizeNodeCreate(ctx, prepared, backend, lock) {
|
|
447
|
-
await
|
|
448
|
-
|
|
446
|
+
await chunkWOJMKB3N_cjs.applyNodeInsertSideEffects(
|
|
447
|
+
chunkWOJMKB3N_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
449
448
|
{
|
|
450
449
|
kind: prepared.kind,
|
|
451
450
|
id: prepared.id,
|
|
@@ -458,7 +457,7 @@ async function finalizeNodeCreate(ctx, prepared, backend, lock) {
|
|
|
458
457
|
}
|
|
459
458
|
function computeNodeUpdate(ctx, kind, id, existingProps, inputProps) {
|
|
460
459
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
461
|
-
const validatedProps =
|
|
460
|
+
const validatedProps = chunk5KEQ74YU_cjs.validateNodeProps(
|
|
462
461
|
registration.type.schema,
|
|
463
462
|
{ ...existingProps, ...inputProps },
|
|
464
463
|
{ kind, operation: "update", id }
|
|
@@ -466,7 +465,7 @@ function computeNodeUpdate(ctx, kind, id, existingProps, inputProps) {
|
|
|
466
465
|
return { registration, validatedProps };
|
|
467
466
|
}
|
|
468
467
|
function resolveNodeUpdateProps(ctx, existing, inputProps) {
|
|
469
|
-
const existingProps =
|
|
468
|
+
const existingProps = chunkIPSVVTWT_cjs.rowPropsToObject(existing.props);
|
|
470
469
|
const { registration, validatedProps } = computeNodeUpdate(
|
|
471
470
|
ctx,
|
|
472
471
|
existing.kind,
|
|
@@ -492,15 +491,15 @@ function nodeUpsertDirtyCheck(ctx, kind, id, existingProps, inputProps) {
|
|
|
492
491
|
async function performNodeUpdate(ctx, input, backend, lock, options) {
|
|
493
492
|
const { kind, id } = input;
|
|
494
493
|
const existing = await backend.getNode(ctx.graphId, kind, id);
|
|
495
|
-
if (!existing) throw new
|
|
494
|
+
if (!existing) throw new chunkBVRDGYXQ_cjs.NodeNotFoundError(kind, id);
|
|
496
495
|
const { registration, validatedProps } = resolveNodeUpdateProps(
|
|
497
496
|
ctx,
|
|
498
497
|
existing,
|
|
499
498
|
input.props
|
|
500
499
|
);
|
|
501
500
|
const nodeKind = registration.type;
|
|
502
|
-
const validTo =
|
|
503
|
-
const writeContext =
|
|
501
|
+
const validTo = chunk3GH67G4Z_cjs.validateOptionalCanonicalIsoDate(input.validTo, "validTo");
|
|
502
|
+
const writeContext = chunkWOJMKB3N_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock);
|
|
504
503
|
const shared = {
|
|
505
504
|
schema: nodeKind.schema,
|
|
506
505
|
validatedProps,
|
|
@@ -508,15 +507,15 @@ async function performNodeUpdate(ctx, input, backend, lock, options) {
|
|
|
508
507
|
...validTo !== void 0 && { validTo }
|
|
509
508
|
};
|
|
510
509
|
if (options?.clearDeleted) {
|
|
511
|
-
const row2 = await
|
|
510
|
+
const row2 = await chunkWOJMKB3N_cjs.applyNodeUpdate(
|
|
512
511
|
writeContext,
|
|
513
512
|
{ ...shared, existing, clearDeleted: true },
|
|
514
513
|
backend
|
|
515
514
|
);
|
|
516
515
|
return rowToNode(row2);
|
|
517
516
|
}
|
|
518
|
-
if (!
|
|
519
|
-
const row = await
|
|
517
|
+
if (!chunkIPSVVTWT_cjs.isLiveNodeRow(existing)) throw new chunkBVRDGYXQ_cjs.NodeNotFoundError(kind, id);
|
|
518
|
+
const row = await chunkWOJMKB3N_cjs.applyNodeUpdate(
|
|
520
519
|
writeContext,
|
|
521
520
|
{ ...shared, existing },
|
|
522
521
|
backend
|
|
@@ -544,13 +543,13 @@ async function primeBatchValidationCaches(ctx, drafts, backend, seams) {
|
|
|
544
543
|
const groups = /* @__PURE__ */ new Map();
|
|
545
544
|
for (const draft of drafts) {
|
|
546
545
|
for (const constraint of draft.uniqueConstraints) {
|
|
547
|
-
if (!
|
|
548
|
-
const key =
|
|
546
|
+
if (!chunkWOJMKB3N_cjs.checkWherePredicate(constraint, draft.validatedProps)) continue;
|
|
547
|
+
const key = chunkWOJMKB3N_cjs.computeUniqueKey(
|
|
549
548
|
draft.validatedProps,
|
|
550
549
|
constraint.fields,
|
|
551
550
|
constraint.collation
|
|
552
551
|
);
|
|
553
|
-
const kindsToCheck =
|
|
552
|
+
const kindsToCheck = chunkWOJMKB3N_cjs.getKindsForUniquenessCheck(
|
|
554
553
|
draft.kind,
|
|
555
554
|
constraint.scope,
|
|
556
555
|
ctx.registry
|
|
@@ -596,7 +595,7 @@ async function prepareBatchCreates(ctx, inputs, backend, options) {
|
|
|
596
595
|
seedUniqueRow
|
|
597
596
|
} = createNodeBatchValidationBackend(ctx.graphId, ctx.registry, backend);
|
|
598
597
|
const drafts = inputs.map(
|
|
599
|
-
(input) => draftNodeCreate(ctx, input, input.id ??
|
|
598
|
+
(input) => draftNodeCreate(ctx, input, input.id ?? chunkWOJMKB3N_cjs.generateId(), options)
|
|
600
599
|
);
|
|
601
600
|
await primeBatchValidationCaches(ctx, drafts, backend, {
|
|
602
601
|
seedNodeRow,
|
|
@@ -672,7 +671,7 @@ async function batchCheckUniqueAcrossKinds(backend, graphId, constraintName, uni
|
|
|
672
671
|
}
|
|
673
672
|
async function executeNodeCreateInternal(ctx, input, backend, options) {
|
|
674
673
|
const kind = input.kind;
|
|
675
|
-
const id = input.id ??
|
|
674
|
+
const id = input.id ?? chunkWOJMKB3N_cjs.generateId();
|
|
676
675
|
const opContext = ctx.createOperationContext("create", "node", kind, id);
|
|
677
676
|
const shouldReturnRow = options?.returnRow ?? true;
|
|
678
677
|
return runHookedWriteOperation(
|
|
@@ -691,8 +690,8 @@ async function executeNodeCreateInternal(ctx, input, backend, options) {
|
|
|
691
690
|
if (shouldReturnRow) {
|
|
692
691
|
row = await target.insertNode(prepared.insertParams);
|
|
693
692
|
} else {
|
|
694
|
-
await
|
|
695
|
-
|
|
693
|
+
await chunkWOJMKB3N_cjs.runInsertNoReturn(
|
|
694
|
+
chunkWOJMKB3N_cjs.nodeInsertDispatch(target),
|
|
696
695
|
prepared.insertParams
|
|
697
696
|
);
|
|
698
697
|
}
|
|
@@ -708,7 +707,7 @@ async function executeNodeCreate(ctx, input, backend, options) {
|
|
|
708
707
|
...options
|
|
709
708
|
});
|
|
710
709
|
if (!result) {
|
|
711
|
-
throw new
|
|
710
|
+
throw new chunkBVRDGYXQ_cjs.DatabaseOperationError(
|
|
712
711
|
"Node create failed: expected created node row",
|
|
713
712
|
{ operation: "insert", entity: "node" }
|
|
714
713
|
);
|
|
@@ -723,7 +722,7 @@ async function executeNodeCreateNoReturnBatch(ctx, inputs, backend) {
|
|
|
723
722
|
inputs,
|
|
724
723
|
target
|
|
725
724
|
);
|
|
726
|
-
await
|
|
725
|
+
await chunkWOJMKB3N_cjs.runInsertBatch(chunkWOJMKB3N_cjs.nodeInsertDispatch(target), batchInsertParams);
|
|
727
726
|
await finalizeNodeCreateBatch(ctx, preparedCreates, target, lock);
|
|
728
727
|
});
|
|
729
728
|
}
|
|
@@ -736,8 +735,8 @@ async function executeNodeCreateBatch(ctx, inputs, backend, options) {
|
|
|
736
735
|
target,
|
|
737
736
|
options
|
|
738
737
|
);
|
|
739
|
-
const rows = await
|
|
740
|
-
|
|
738
|
+
const rows = await chunkWOJMKB3N_cjs.runInsertBatchReturning(
|
|
739
|
+
chunkWOJMKB3N_cjs.nodeInsertDispatch(target),
|
|
741
740
|
batchInsertParams
|
|
742
741
|
);
|
|
743
742
|
await finalizeNodeCreateBatch(ctx, preparedCreates, target, lock);
|
|
@@ -776,9 +775,9 @@ async function executeNodeDelete(ctx, kind, id, backend) {
|
|
|
776
775
|
async (target, lock) => {
|
|
777
776
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
778
777
|
const preflight = await target.getNode(ctx.graphId, kind, id);
|
|
779
|
-
if (!preflight || !
|
|
780
|
-
await
|
|
781
|
-
|
|
778
|
+
if (!preflight || !chunkIPSVVTWT_cjs.isLiveNodeRow(preflight)) return;
|
|
779
|
+
await chunkWOJMKB3N_cjs.applyNodeSoftDelete(
|
|
780
|
+
chunkWOJMKB3N_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
782
781
|
{
|
|
783
782
|
existing: preflight,
|
|
784
783
|
schema: registration.type.schema,
|
|
@@ -800,8 +799,8 @@ async function executeNodeHardDelete(ctx, kind, id, backend) {
|
|
|
800
799
|
backend,
|
|
801
800
|
async (target, lock) => {
|
|
802
801
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
803
|
-
await
|
|
804
|
-
|
|
802
|
+
await chunkWOJMKB3N_cjs.applyNodeHardDelete(
|
|
803
|
+
chunkWOJMKB3N_cjs.createNodeWriteContext(ctx.graphId, ctx.registry, lock),
|
|
805
804
|
{
|
|
806
805
|
kind,
|
|
807
806
|
id,
|
|
@@ -817,12 +816,12 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
817
816
|
const ifExists = options?.ifExists ?? "return";
|
|
818
817
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
819
818
|
const nodeKind = registration.type;
|
|
820
|
-
const validatedProps =
|
|
819
|
+
const validatedProps = chunk5KEQ74YU_cjs.validateNodeProps(nodeKind.schema, props, {
|
|
821
820
|
kind,
|
|
822
821
|
operation: "create"
|
|
823
822
|
});
|
|
824
823
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
825
|
-
if (!
|
|
824
|
+
if (!chunkWOJMKB3N_cjs.checkWherePredicate(constraint, validatedProps)) {
|
|
826
825
|
const node = await executeNodeCreate(
|
|
827
826
|
ctx,
|
|
828
827
|
{ kind, props: validatedProps },
|
|
@@ -831,12 +830,12 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
831
830
|
);
|
|
832
831
|
return { node, action: "created" };
|
|
833
832
|
}
|
|
834
|
-
const key =
|
|
833
|
+
const key = chunkWOJMKB3N_cjs.computeUniqueKey(
|
|
835
834
|
validatedProps,
|
|
836
835
|
constraint.fields,
|
|
837
836
|
constraint.collation
|
|
838
837
|
);
|
|
839
|
-
const kindsToCheck =
|
|
838
|
+
const kindsToCheck = chunkWOJMKB3N_cjs.getKindsForUniquenessCheck(
|
|
840
839
|
kind,
|
|
841
840
|
constraint.scope,
|
|
842
841
|
ctx.registry
|
|
@@ -893,25 +892,25 @@ async function executeNodeGetOrCreateByConstraint(ctx, kind, constraintName, pro
|
|
|
893
892
|
try {
|
|
894
893
|
return await attempt();
|
|
895
894
|
} catch (error) {
|
|
896
|
-
if (!(error instanceof
|
|
895
|
+
if (!(error instanceof chunkBVRDGYXQ_cjs.UniquenessError)) throw error;
|
|
897
896
|
return attempt();
|
|
898
897
|
}
|
|
899
898
|
}
|
|
900
899
|
async function executeNodeFindByConstraint(ctx, kind, constraintName, props, backend) {
|
|
901
900
|
const registration = getNodeRegistration(ctx.graph, kind);
|
|
902
901
|
const nodeKind = registration.type;
|
|
903
|
-
const validatedProps =
|
|
902
|
+
const validatedProps = chunk5KEQ74YU_cjs.validateNodeProps(nodeKind.schema, props, {
|
|
904
903
|
kind,
|
|
905
904
|
operation: "create"
|
|
906
905
|
});
|
|
907
906
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
908
|
-
if (!
|
|
909
|
-
const key =
|
|
907
|
+
if (!chunkWOJMKB3N_cjs.checkWherePredicate(constraint, validatedProps)) return void 0;
|
|
908
|
+
const key = chunkWOJMKB3N_cjs.computeUniqueKey(
|
|
910
909
|
validatedProps,
|
|
911
910
|
constraint.fields,
|
|
912
911
|
constraint.collation
|
|
913
912
|
);
|
|
914
|
-
const kindsToCheck =
|
|
913
|
+
const kindsToCheck = chunkWOJMKB3N_cjs.getKindsForUniquenessCheck(
|
|
915
914
|
kind,
|
|
916
915
|
constraint.scope,
|
|
917
916
|
ctx.registry
|
|
@@ -937,12 +936,12 @@ async function executeNodeFindByConstraint(ctx, kind, constraintName, props, bac
|
|
|
937
936
|
function validateAndComputeKeys(nodeKind, kind, constraint, items) {
|
|
938
937
|
const validated = [];
|
|
939
938
|
for (const item of items) {
|
|
940
|
-
const validatedProps =
|
|
939
|
+
const validatedProps = chunk5KEQ74YU_cjs.validateNodeProps(nodeKind.schema, item.props, {
|
|
941
940
|
kind,
|
|
942
941
|
operation: "create"
|
|
943
942
|
});
|
|
944
|
-
const applies =
|
|
945
|
-
const key = applies ?
|
|
943
|
+
const applies = chunkWOJMKB3N_cjs.checkWherePredicate(constraint, validatedProps);
|
|
944
|
+
const key = applies ? chunkWOJMKB3N_cjs.computeUniqueKey(
|
|
946
945
|
validatedProps,
|
|
947
946
|
constraint.fields,
|
|
948
947
|
constraint.collation
|
|
@@ -965,7 +964,7 @@ async function executeNodeBulkFindByConstraint(ctx, kind, constraintName, items,
|
|
|
965
964
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
966
965
|
const validated = validateAndComputeKeys(nodeKind, kind, constraint, items);
|
|
967
966
|
const uniqueKeys = collectUniqueKeys(validated);
|
|
968
|
-
const kindsToCheck =
|
|
967
|
+
const kindsToCheck = chunkWOJMKB3N_cjs.getKindsForUniquenessCheck(
|
|
969
968
|
kind,
|
|
970
969
|
constraint.scope,
|
|
971
970
|
ctx.registry
|
|
@@ -1015,10 +1014,10 @@ function resolveNodeIndex(graph, kind, indexName) {
|
|
|
1015
1014
|
(candidate) => candidate.entity === "node" && candidate.kind === kind && candidate.name === indexName
|
|
1016
1015
|
);
|
|
1017
1016
|
if (declaration?.entity !== "node") {
|
|
1018
|
-
throw new
|
|
1017
|
+
throw new chunkBVRDGYXQ_cjs.NodeIndexNotFoundError(indexName, kind);
|
|
1019
1018
|
}
|
|
1020
1019
|
if (declaration.method !== void 0) {
|
|
1021
|
-
throw new
|
|
1020
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
1022
1021
|
`bulkFindByIndex cannot probe index "${indexName}" (method "${declaration.method}"): only btree indexes serve equality probes.`,
|
|
1023
1022
|
{ indexName, kind, method: declaration.method }
|
|
1024
1023
|
);
|
|
@@ -1056,7 +1055,7 @@ function validateIndexProbeValue(value, valueType, pointer, kind) {
|
|
|
1056
1055
|
}
|
|
1057
1056
|
}
|
|
1058
1057
|
function indexProbeTypeError(pointer, kind, expected, value) {
|
|
1059
|
-
return new
|
|
1058
|
+
return new chunkBVRDGYXQ_cjs.ValidationError(
|
|
1060
1059
|
`Index probe value for "${pointer}" on node kind "${kind}" has an incompatible type`,
|
|
1061
1060
|
{
|
|
1062
1061
|
entityType: "node",
|
|
@@ -1090,7 +1089,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1090
1089
|
if (items.length === 0) return [];
|
|
1091
1090
|
const index = resolveNodeIndex(ctx.graph, kind, indexName);
|
|
1092
1091
|
if (index.fields.length === 0) {
|
|
1093
|
-
throw new
|
|
1092
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
1094
1093
|
`bulkFindByIndex requires an index with at least one prop-based field on index "${indexName}" (node kind "${kind}")`,
|
|
1095
1094
|
{ indexName, kind },
|
|
1096
1095
|
{
|
|
@@ -1099,7 +1098,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1099
1098
|
);
|
|
1100
1099
|
}
|
|
1101
1100
|
if (index.fieldValueTypes.includes("date")) {
|
|
1102
|
-
throw new
|
|
1101
|
+
throw new chunkBVRDGYXQ_cjs.ConfigurationError(
|
|
1103
1102
|
`bulkFindByIndex does not support date-typed key fields on index "${indexName}" (node kind "${kind}")`,
|
|
1104
1103
|
{ indexName, kind },
|
|
1105
1104
|
{
|
|
@@ -1109,7 +1108,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1109
1108
|
}
|
|
1110
1109
|
const limitPerInput = options?.limitPerInput;
|
|
1111
1110
|
if (limitPerInput !== void 0 && (!Number.isInteger(limitPerInput) || limitPerInput <= 0)) {
|
|
1112
|
-
throw new
|
|
1111
|
+
throw new chunkBVRDGYXQ_cjs.ValidationError(
|
|
1113
1112
|
"bulkFindByIndex limitPerInput must be a positive integer",
|
|
1114
1113
|
{
|
|
1115
1114
|
entityType: "node",
|
|
@@ -1124,7 +1123,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1124
1123
|
}
|
|
1125
1124
|
);
|
|
1126
1125
|
}
|
|
1127
|
-
const adapter =
|
|
1126
|
+
const adapter = chunkXGU7DZDA_cjs.getDialect(backend.dialect);
|
|
1128
1127
|
const probes = items.map(
|
|
1129
1128
|
(item) => index.fields.map((pointer, position) => {
|
|
1130
1129
|
const value = chunkTDXIBCGY_cjs.resolveJsonPointer(item.props, pointer);
|
|
@@ -1151,13 +1150,13 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1151
1150
|
}
|
|
1152
1151
|
groupToInputs[existing]?.push(inputIndex);
|
|
1153
1152
|
}
|
|
1154
|
-
const schema = backend.tableNames ?
|
|
1153
|
+
const schema = backend.tableNames ? chunkWOJMKB3N_cjs.createSqlSchema(backend.tableNames) : chunkWOJMKB3N_cjs.DEFAULT_SQL_SCHEMA;
|
|
1155
1154
|
const compileContext = {
|
|
1156
1155
|
dialect: backend.dialect,
|
|
1157
1156
|
propsColumn: drizzleOrm.sql.raw(`"props"`),
|
|
1158
1157
|
systemColumn: (column) => drizzleOrm.sql.raw(`"${column}"`)
|
|
1159
1158
|
};
|
|
1160
|
-
const fieldKeys =
|
|
1159
|
+
const fieldKeys = chunkXGU7DZDA_cjs.compileNodeIndexFieldKeys(index, compileContext);
|
|
1161
1160
|
const groupPredicates = groupProbes.map(
|
|
1162
1161
|
(probe) => drizzleOrm.sql`(${drizzleOrm.sql.join(
|
|
1163
1162
|
fieldKeys.map((fieldKey, position) => {
|
|
@@ -1183,7 +1182,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1183
1182
|
drizzleOrm.sql`"deleted_at" IS NULL`
|
|
1184
1183
|
];
|
|
1185
1184
|
if (index.where !== void 0) {
|
|
1186
|
-
conditions.push(
|
|
1185
|
+
conditions.push(chunkXGU7DZDA_cjs.compileIndexWhere(compileContext, index.where));
|
|
1187
1186
|
}
|
|
1188
1187
|
conditions.push(drizzleOrm.sql`(${drizzleOrm.sql.join(groupPredicates, drizzleOrm.sql` OR `)})`);
|
|
1189
1188
|
const whereClause = drizzleOrm.sql.join(conditions, drizzleOrm.sql` AND `);
|
|
@@ -1191,7 +1190,7 @@ async function executeNodeBulkFindByIndex(ctx, kind, indexName, items, backend,
|
|
|
1191
1190
|
const capInSql = limitPerInput !== void 0 && backend.capabilities.windowFunctions;
|
|
1192
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"`;
|
|
1193
1192
|
const rawMatches = await backend.execute(
|
|
1194
|
-
|
|
1193
|
+
chunkIPSVVTWT_cjs.asCompiledRowsSql(query)
|
|
1195
1194
|
);
|
|
1196
1195
|
const matches = limitPerInput !== void 0 && !capInSql ? capMatchesPerGroup(rawMatches, limitPerInput) : rawMatches;
|
|
1197
1196
|
const nodesById = await hydrateNodesById(
|
|
@@ -1224,7 +1223,7 @@ function capMatchesPerGroup(matches, limitPerInput) {
|
|
|
1224
1223
|
return capped;
|
|
1225
1224
|
}
|
|
1226
1225
|
async function hydrateNodesById(backend, graphId, kind, ids) {
|
|
1227
|
-
const rowsById = await
|
|
1226
|
+
const rowsById = await chunkWOJMKB3N_cjs.getNodeRowsByIds(backend, graphId, kind, ids);
|
|
1228
1227
|
const nodesById = /* @__PURE__ */ new Map();
|
|
1229
1228
|
for (const [id, row] of rowsById) {
|
|
1230
1229
|
if (row.deleted_at !== void 0) continue;
|
|
@@ -1240,7 +1239,7 @@ async function executeNodeBulkGetOrCreateByConstraint(ctx, kind, constraintName,
|
|
|
1240
1239
|
const constraint = resolveConstraint(ctx.graph, kind, constraintName);
|
|
1241
1240
|
const validated = validateAndComputeKeys(nodeKind, kind, constraint, items);
|
|
1242
1241
|
const uniqueKeys = collectUniqueKeys(validated);
|
|
1243
|
-
const kindsToCheck =
|
|
1242
|
+
const kindsToCheck = chunkWOJMKB3N_cjs.getKindsForUniquenessCheck(
|
|
1244
1243
|
kind,
|
|
1245
1244
|
constraint.scope,
|
|
1246
1245
|
ctx.registry
|
|
@@ -1362,5 +1361,5 @@ exports.rowToNode = rowToNode;
|
|
|
1362
1361
|
exports.rowToNodeMeta = rowToNodeMeta;
|
|
1363
1362
|
exports.runHookedWriteOperation = runHookedWriteOperation;
|
|
1364
1363
|
exports.runInWriteTransaction = runInWriteTransaction;
|
|
1365
|
-
//# sourceMappingURL=chunk-
|
|
1366
|
-
//# sourceMappingURL=chunk-
|
|
1364
|
+
//# sourceMappingURL=chunk-TGOMW4MB.cjs.map
|
|
1365
|
+
//# sourceMappingURL=chunk-TGOMW4MB.cjs.map
|