@nicia-ai/typegraph 0.33.0 → 0.35.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/README.md +20 -0
- package/dist/backend/postgres/index.cjs +30 -26
- package/dist/backend/postgres/index.d.cts +39 -7
- package/dist/backend/postgres/index.d.ts +39 -7
- package/dist/backend/postgres/index.js +17 -13
- package/dist/backend/postgres/pglite.cjs +22 -18
- package/dist/backend/postgres/pglite.cjs.map +1 -1
- package/dist/backend/postgres/pglite.d.cts +4 -4
- package/dist/backend/postgres/pglite.d.ts +4 -4
- package/dist/backend/postgres/pglite.js +17 -13
- package/dist/backend/postgres/pglite.js.map +1 -1
- package/dist/backend/sqlite/index.cjs +26 -23
- package/dist/backend/sqlite/index.d.cts +8 -8
- package/dist/backend/sqlite/index.d.ts +8 -8
- package/dist/backend/sqlite/index.js +14 -11
- package/dist/backend/sqlite/libsql.cjs +21 -17
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +13 -6
- package/dist/backend/sqlite/libsql.d.ts +13 -6
- package/dist/backend/sqlite/libsql.js +17 -13
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +102 -18
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +95 -5
- package/dist/backend/sqlite/local.d.ts +95 -5
- package/dist/backend/sqlite/local.js +96 -13
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/{chunk-JHOBXD7O.js → chunk-3TWF3SH4.js} +332 -64
- package/dist/chunk-3TWF3SH4.js.map +1 -0
- package/dist/chunk-4JEZZJ6S.cjs +1271 -0
- package/dist/chunk-4JEZZJ6S.cjs.map +1 -0
- package/dist/{chunk-I4W7MKVG.cjs → chunk-4TOD4LBZ.cjs} +249 -294
- package/dist/chunk-4TOD4LBZ.cjs.map +1 -0
- package/dist/chunk-55MZDDZV.js +239 -0
- package/dist/chunk-55MZDDZV.js.map +1 -0
- package/dist/{chunk-LM2IC4ZJ.cjs → chunk-5A6FNS6N.cjs} +75 -19
- package/dist/chunk-5A6FNS6N.cjs.map +1 -0
- package/dist/{chunk-FDN43KXV.cjs → chunk-5AQIKK56.cjs} +65 -24
- package/dist/chunk-5AQIKK56.cjs.map +1 -0
- package/dist/{chunk-IZ4PCL47.js → chunk-5SEGFTZX.js} +4 -66
- package/dist/chunk-5SEGFTZX.js.map +1 -0
- package/dist/{chunk-CWFPJ3RC.js → chunk-6FR2MMS6.js} +7 -7
- package/dist/chunk-6FR2MMS6.js.map +1 -0
- package/dist/chunk-7YSP4V4R.cjs +69 -0
- package/dist/chunk-7YSP4V4R.cjs.map +1 -0
- package/dist/chunk-A42GCBGX.cjs +28 -0
- package/dist/chunk-A42GCBGX.cjs.map +1 -0
- package/dist/chunk-ACSVZPK7.cjs +21 -0
- package/dist/chunk-ACSVZPK7.cjs.map +1 -0
- package/dist/{chunk-OIE2UPVG.cjs → chunk-BLZDPRXT.cjs} +52 -21
- package/dist/chunk-BLZDPRXT.cjs.map +1 -0
- package/dist/chunk-BYPOGQWK.js +25 -0
- package/dist/chunk-BYPOGQWK.js.map +1 -0
- package/dist/{chunk-NG5N7R45.cjs → chunk-CK5BVQOW.cjs} +325 -213
- package/dist/chunk-CK5BVQOW.cjs.map +1 -0
- package/dist/chunk-CTTSDJLY.cjs +261 -0
- package/dist/chunk-CTTSDJLY.cjs.map +1 -0
- package/dist/chunk-CUHM5CWJ.cjs +12 -0
- package/dist/chunk-CUHM5CWJ.cjs.map +1 -0
- package/dist/chunk-CZQ3FO2Q.js +2320 -0
- package/dist/chunk-CZQ3FO2Q.js.map +1 -0
- package/dist/{chunk-CFNT3ITG.cjs → chunk-D7ZEOS56.cjs} +25 -52
- package/dist/chunk-D7ZEOS56.cjs.map +1 -0
- package/dist/chunk-DFVLCOP6.js +10 -0
- package/dist/chunk-DFVLCOP6.js.map +1 -0
- package/dist/chunk-DI74SMXS.cjs +29 -0
- package/dist/chunk-DI74SMXS.cjs.map +1 -0
- package/dist/{chunk-KY5SDVA7.cjs → chunk-EM3CWPND.cjs} +442 -113
- package/dist/chunk-EM3CWPND.cjs.map +1 -0
- package/dist/chunk-EMF62TZG.cjs +1176 -0
- package/dist/chunk-EMF62TZG.cjs.map +1 -0
- package/dist/chunk-EOLERH7Y.cjs +40 -0
- package/dist/chunk-EOLERH7Y.cjs.map +1 -0
- package/dist/{chunk-3QRBXYT5.cjs → chunk-FACJJWGF.cjs} +24 -6
- package/dist/chunk-FACJJWGF.cjs.map +1 -0
- package/dist/{chunk-KTIEB7VH.cjs → chunk-FL472AMI.cjs} +49 -165
- package/dist/chunk-FL472AMI.cjs.map +1 -0
- package/dist/{chunk-4RBAJVEC.cjs → chunk-FN35DLCN.cjs} +31 -9
- package/dist/chunk-FN35DLCN.cjs.map +1 -0
- package/dist/{chunk-C4C4Q7A6.js → chunk-FPIZFYHE.js} +12 -35
- package/dist/chunk-FPIZFYHE.js.map +1 -0
- package/dist/{chunk-XKNAK27R.js → chunk-FRV5Q5IO.js} +64 -8
- package/dist/chunk-FRV5Q5IO.js.map +1 -0
- package/dist/{chunk-K5P5OZXS.js → chunk-G6Q5UM7U.js} +2 -2
- package/dist/{chunk-K5P5OZXS.js.map → chunk-G6Q5UM7U.js.map} +1 -1
- package/dist/chunk-GSQ6NPH6.cjs +100 -0
- package/dist/chunk-GSQ6NPH6.cjs.map +1 -0
- package/dist/chunk-GUR2FNB5.cjs +12 -0
- package/dist/{chunk-6ZR4QC3O.cjs.map → chunk-GUR2FNB5.cjs.map} +1 -1
- package/dist/{chunk-ZFWNO3GE.cjs → chunk-H7YNSMA7.cjs} +107 -2
- package/dist/chunk-H7YNSMA7.cjs.map +1 -0
- package/dist/{chunk-GYVBEZAO.js → chunk-I7ZUZKFD.js} +47 -19
- package/dist/chunk-I7ZUZKFD.js.map +1 -0
- package/dist/chunk-ITE4IXAK.js +25 -0
- package/dist/chunk-ITE4IXAK.js.map +1 -0
- package/dist/{chunk-D3EWZ67S.cjs → chunk-J7WFGBJR.cjs} +3372 -4970
- package/dist/chunk-J7WFGBJR.cjs.map +1 -0
- package/dist/{chunk-PYD3UCDU.js → chunk-JBTOYDMN.js} +202 -251
- package/dist/chunk-JBTOYDMN.js.map +1 -0
- package/dist/{chunk-XVUJY72M.js → chunk-K3PPLHY7.js} +234 -118
- package/dist/chunk-K3PPLHY7.js.map +1 -0
- package/dist/{chunk-454I6GDF.js → chunk-KBGQIPRQ.js} +102 -3
- package/dist/chunk-KBGQIPRQ.js.map +1 -0
- package/dist/chunk-KMI7LYAF.js +1252 -0
- package/dist/chunk-KMI7LYAF.js.map +1 -0
- package/dist/{chunk-JIEJCTDS.cjs → chunk-LGEALRC6.cjs} +21 -4
- package/dist/chunk-LGEALRC6.cjs.map +1 -0
- package/dist/{chunk-TQOYM4LN.js → chunk-MP2JQKSG.js} +21 -5
- package/dist/chunk-MP2JQKSG.js.map +1 -0
- package/dist/{chunk-3642VBVC.cjs → chunk-O7UN7OXA.cjs} +389 -121
- package/dist/chunk-O7UN7OXA.cjs.map +1 -0
- package/dist/chunk-OHMP6N2J.js +47 -0
- package/dist/chunk-OHMP6N2J.js.map +1 -0
- package/dist/{chunk-6NRFUHMS.js → chunk-OR5ZA5WP.js} +135 -24
- package/dist/chunk-OR5ZA5WP.js.map +1 -0
- package/dist/{chunk-PRMKPFN5.js → chunk-Q5TEXCTB.js} +61 -6
- package/dist/chunk-Q5TEXCTB.js.map +1 -0
- package/dist/chunk-QNKSQTKQ.js +1312 -0
- package/dist/chunk-QNKSQTKQ.js.map +1 -0
- package/dist/{chunk-YCV72E6L.js → chunk-QOTI55H7.js} +7 -116
- package/dist/chunk-QOTI55H7.js.map +1 -0
- package/dist/{chunk-QBYTJSAY.js → chunk-QWEUYILR.js} +99 -34
- package/dist/chunk-QWEUYILR.js.map +1 -0
- package/dist/{chunk-OS6KS3HV.js → chunk-RGP33ZJ5.js} +485 -82
- package/dist/chunk-RGP33ZJ5.js.map +1 -0
- package/dist/chunk-RGPG7EOJ.js +94 -0
- package/dist/chunk-RGPG7EOJ.js.map +1 -0
- package/dist/{chunk-WWVV44DY.cjs → chunk-S55OV6PW.cjs} +15 -15
- package/dist/chunk-S55OV6PW.cjs.map +1 -0
- package/dist/{chunk-3E7SNSIA.cjs → chunk-SJDMVITW.cjs} +4 -4
- package/dist/{chunk-3E7SNSIA.cjs.map → chunk-SJDMVITW.cjs.map} +1 -1
- package/dist/{chunk-XLUNB2TZ.js → chunk-SNXVDZAJ.js} +3 -3
- package/dist/{chunk-XLUNB2TZ.js.map → chunk-SNXVDZAJ.js.map} +1 -1
- package/dist/{chunk-CEF2QOTO.js → chunk-T2WUSPDA.js} +49 -8
- package/dist/chunk-T2WUSPDA.js.map +1 -0
- package/dist/{chunk-YW7GHMF4.cjs → chunk-TCOCYN2P.cjs} +75 -20
- package/dist/chunk-TCOCYN2P.cjs.map +1 -0
- package/dist/{chunk-FLRCVI2G.cjs → chunk-TDXIBCGY.cjs} +2 -2
- package/dist/{chunk-FLRCVI2G.cjs.map → chunk-TDXIBCGY.cjs.map} +1 -1
- package/dist/chunk-TEDRJXOG.cjs +32 -0
- package/dist/chunk-TEDRJXOG.cjs.map +1 -0
- package/dist/{chunk-WLP6TKFB.js → chunk-UES55P7G.js} +2809 -4398
- package/dist/chunk-UES55P7G.js.map +1 -0
- package/dist/{chunk-EF3Z645U.cjs → chunk-UMDVATGY.cjs} +6 -72
- package/dist/chunk-UMDVATGY.cjs.map +1 -0
- package/dist/chunk-UR7W5YQK.js +18 -0
- package/dist/chunk-UR7W5YQK.js.map +1 -0
- package/dist/chunk-UT3S4SEN.js +31 -0
- package/dist/chunk-UT3S4SEN.js.map +1 -0
- package/dist/{chunk-3IR2GEMJ.cjs → chunk-UUT7UN2N.cjs} +149 -38
- package/dist/chunk-UUT7UN2N.cjs.map +1 -0
- package/dist/{chunk-PIHXFF73.js → chunk-UZV3AZKF.js} +21 -3
- package/dist/chunk-UZV3AZKF.js.map +1 -0
- package/dist/{chunk-DJYRRDHA.js → chunk-VHMPG6UL.js} +29 -7
- package/dist/chunk-VHMPG6UL.js.map +1 -0
- package/dist/{chunk-MBLXCV2Y.cjs → chunk-VPYHY3LJ.cjs} +111 -43
- package/dist/chunk-VPYHY3LJ.cjs.map +1 -0
- package/dist/{chunk-WYTUF3QO.js → chunk-VSPCZAXF.js} +3 -3
- package/dist/{chunk-WYTUF3QO.js.map → chunk-VSPCZAXF.js.map} +1 -1
- package/dist/chunk-W63OVYY4.js +29 -0
- package/dist/chunk-W63OVYY4.js.map +1 -0
- package/dist/{chunk-UPDMJEW6.js → chunk-WDBCBWC4.js} +356 -30
- package/dist/chunk-WDBCBWC4.js.map +1 -0
- package/dist/chunk-WJT7OU7E.cjs +1334 -0
- package/dist/chunk-WJT7OU7E.cjs.map +1 -0
- package/dist/chunk-XOX22WHL.cjs +2383 -0
- package/dist/chunk-XOX22WHL.cjs.map +1 -0
- package/dist/{ddl-CVnHJcar.d.ts → ddl-C2rZ-Aen.d.ts} +4 -4
- package/dist/{ddl-Dxt_fBHr.d.cts → ddl-CZz7a0E8.d.cts} +4 -4
- package/dist/{extension-types-YGFJPrzK.d.cts → extension-types-ixRpJVUp.d.cts} +24 -1
- package/dist/{extension-types-YGFJPrzK.d.ts → extension-types-ixRpJVUp.d.ts} +24 -1
- package/dist/{types-DGylBhWo.d.ts → fulltext-strategy-B57yvC5Q.d.ts} +2558 -2125
- package/dist/{types-C_UnQOQp.d.cts → fulltext-strategy-CDkSSYhq.d.cts} +2558 -2125
- package/dist/graph-extension/index.cjs +21 -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 +6 -4
- package/dist/graph-merge/index.cjs +408 -169
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +63 -33
- package/dist/graph-merge/index.d.ts +63 -33
- package/dist/graph-merge/index.js +286 -47
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-DGX6D9j1.d.ts → index-6CSUAq-x.d.ts} +234 -93
- package/dist/{index-SEvUHDA6.d.cts → index-Bks_3HHK.d.cts} +234 -93
- package/dist/index.cjs +240 -211
- 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 +35 -27
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +28 -27
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +10 -9
- package/dist/interchange/index.cjs +47 -17
- package/dist/interchange/index.d.cts +126 -12
- package/dist/interchange/index.d.ts +126 -12
- package/dist/interchange/index.js +14 -4
- package/dist/{manager-BYl_zyZR.d.cts → manager-DwQi8eV0.d.cts} +9 -2
- package/dist/{manager-C0_r0ALf.d.ts → manager-ejUCB52T.d.ts} +9 -2
- package/dist/{materialize-indexes-D20xNluI.d.cts → materialize-indexes-B4e9360H.d.cts} +20 -4
- package/dist/{materialize-indexes-CAkIYFV-.d.ts → materialize-indexes-te9TPMMJ.d.ts} +20 -4
- package/dist/{postgres-_9psmVGm.d.cts → postgres-CfEqsRMp.d.cts} +152 -1
- package/dist/{postgres-MzBPkYzq.d.ts → postgres-DQ5R6rzV.d.ts} +152 -1
- package/dist/profiler/index.cjs +11 -11
- package/dist/profiler/index.d.cts +7 -7
- package/dist/profiler/index.d.ts +7 -7
- package/dist/profiler/index.js +4 -4
- package/dist/provenance/index.cjs +590 -0
- package/dist/provenance/index.cjs.map +1 -0
- package/dist/provenance/index.d.cts +73 -0
- package/dist/provenance/index.d.ts +73 -0
- package/dist/provenance/index.js +588 -0
- package/dist/provenance/index.js.map +1 -0
- package/dist/schema/index.cjs +55 -38
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +57 -57
- package/dist/schema/index.d.ts +57 -57
- package/dist/schema/index.js +30 -13
- package/dist/schema/index.js.map +1 -1
- package/dist/{sqlite-gm44dShb.d.ts → sqlite-D7zBinNR.d.cts} +92 -1
- package/dist/{sqlite-BfksSb45.d.cts → sqlite-DvQndLky.d.ts} +92 -1
- package/dist/{store-view-FfE5_7eo.d.ts → store-view-BSpqvAxK.d.cts} +445 -46
- package/dist/{store-view-9jQ2rPum.d.cts → store-view-CKbHFRnn.d.ts} +445 -46
- package/dist/{types-B6mhrcLv.d.cts → types-Bv9DcS_E.d.cts} +2 -2
- package/dist/{types-CdWxK-nD.d.ts → types-CoxuV7EJ.d.ts} +2 -2
- package/dist/{where-Bpp2ul_z.d.cts → where-7RKFOsXt.d.ts} +2 -2
- package/dist/{where-BsEXraKW.d.ts → where-DdMIXOtH.d.cts} +2 -2
- package/package.json +21 -14
- package/dist/chunk-2YMGNYXY.js +0 -40
- package/dist/chunk-2YMGNYXY.js.map +0 -1
- package/dist/chunk-3642VBVC.cjs.map +0 -1
- package/dist/chunk-3EUKJEQ3.js +0 -77
- package/dist/chunk-3EUKJEQ3.js.map +0 -1
- package/dist/chunk-3IR2GEMJ.cjs.map +0 -1
- package/dist/chunk-3QRBXYT5.cjs.map +0 -1
- package/dist/chunk-454I6GDF.js.map +0 -1
- package/dist/chunk-4RBAJVEC.cjs.map +0 -1
- package/dist/chunk-6NRFUHMS.js.map +0 -1
- package/dist/chunk-6ZR4QC3O.cjs +0 -12
- package/dist/chunk-73KASJGO.cjs +0 -52
- package/dist/chunk-73KASJGO.cjs.map +0 -1
- package/dist/chunk-BF3ZDEUE.cjs +0 -773
- package/dist/chunk-BF3ZDEUE.cjs.map +0 -1
- package/dist/chunk-C4C4Q7A6.js.map +0 -1
- package/dist/chunk-CEF2QOTO.js.map +0 -1
- package/dist/chunk-CFNT3ITG.cjs.map +0 -1
- package/dist/chunk-CWFPJ3RC.js.map +0 -1
- package/dist/chunk-D3EWZ67S.cjs.map +0 -1
- package/dist/chunk-DJYRRDHA.js.map +0 -1
- package/dist/chunk-EF3Z645U.cjs.map +0 -1
- package/dist/chunk-FDN43KXV.cjs.map +0 -1
- package/dist/chunk-GYVBEZAO.js.map +0 -1
- package/dist/chunk-HTGDWIDE.cjs +0 -89
- package/dist/chunk-HTGDWIDE.cjs.map +0 -1
- package/dist/chunk-I4W7MKVG.cjs.map +0 -1
- package/dist/chunk-IZ4PCL47.js.map +0 -1
- package/dist/chunk-JHOBXD7O.js.map +0 -1
- package/dist/chunk-JIEJCTDS.cjs.map +0 -1
- package/dist/chunk-KTIEB7VH.cjs.map +0 -1
- package/dist/chunk-KY5SDVA7.cjs.map +0 -1
- package/dist/chunk-LM2IC4ZJ.cjs.map +0 -1
- package/dist/chunk-MBLXCV2Y.cjs.map +0 -1
- package/dist/chunk-NG5N7R45.cjs.map +0 -1
- package/dist/chunk-OIE2UPVG.cjs.map +0 -1
- package/dist/chunk-OS6KS3HV.js.map +0 -1
- package/dist/chunk-PIHXFF73.js.map +0 -1
- package/dist/chunk-PRMKPFN5.js.map +0 -1
- package/dist/chunk-PYD3UCDU.js.map +0 -1
- package/dist/chunk-QBYTJSAY.js.map +0 -1
- package/dist/chunk-SPT5JMME.js +0 -610
- package/dist/chunk-SPT5JMME.js.map +0 -1
- package/dist/chunk-SST7XDY6.cjs +0 -624
- package/dist/chunk-SST7XDY6.cjs.map +0 -1
- package/dist/chunk-TQOYM4LN.js.map +0 -1
- package/dist/chunk-UPDMJEW6.js.map +0 -1
- package/dist/chunk-WLP6TKFB.js.map +0 -1
- package/dist/chunk-WWVV44DY.cjs.map +0 -1
- package/dist/chunk-XKNAK27R.js.map +0 -1
- package/dist/chunk-XVUJY72M.js.map +0 -1
- package/dist/chunk-YCV72E6L.js.map +0 -1
- package/dist/chunk-YW7GHMF4.cjs.map +0 -1
- package/dist/chunk-ZFWNO3GE.cjs.map +0 -1
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
3
|
+
var chunkACSVZPK7_cjs = require('./chunk-ACSVZPK7.cjs');
|
|
4
|
+
var chunkVPYHY3LJ_cjs = require('./chunk-VPYHY3LJ.cjs');
|
|
5
|
+
var chunkUUT7UN2N_cjs = require('./chunk-UUT7UN2N.cjs');
|
|
6
|
+
var chunkTEDRJXOG_cjs = require('./chunk-TEDRJXOG.cjs');
|
|
7
|
+
var chunkFL472AMI_cjs = require('./chunk-FL472AMI.cjs');
|
|
8
|
+
var chunkGSQ6NPH6_cjs = require('./chunk-GSQ6NPH6.cjs');
|
|
9
|
+
var chunkBLZDPRXT_cjs = require('./chunk-BLZDPRXT.cjs');
|
|
10
|
+
var chunkH7YNSMA7_cjs = require('./chunk-H7YNSMA7.cjs');
|
|
11
|
+
var chunkDI74SMXS_cjs = require('./chunk-DI74SMXS.cjs');
|
|
12
|
+
var chunkLGEALRC6_cjs = require('./chunk-LGEALRC6.cjs');
|
|
11
13
|
var zod = require('zod');
|
|
12
14
|
|
|
13
15
|
// src/core/node.ts
|
|
14
16
|
function validateSchemaKeys(schema, name) {
|
|
15
|
-
|
|
17
|
+
chunkGSQ6NPH6_cjs.assertSchemaKeysAreFree(
|
|
16
18
|
"Node",
|
|
17
19
|
name,
|
|
18
20
|
Object.keys(schema.shape),
|
|
19
|
-
|
|
21
|
+
chunkGSQ6NPH6_cjs.RESERVED_NODE_KEYS
|
|
20
22
|
);
|
|
21
23
|
}
|
|
22
24
|
function defineNode(name, options) {
|
|
23
25
|
validateSchemaKeys(options.schema, name);
|
|
24
26
|
if (options.annotations !== void 0) {
|
|
25
|
-
|
|
27
|
+
chunkFL472AMI_cjs.assertJsonValue(options.annotations, "annotations", `Node "${name}"`);
|
|
26
28
|
}
|
|
27
29
|
return Object.freeze({
|
|
28
|
-
[
|
|
30
|
+
[chunkVPYHY3LJ_cjs.NODE_TYPE_BRAND]: true,
|
|
29
31
|
kind: name,
|
|
30
32
|
schema: options.schema,
|
|
31
33
|
description: options.description,
|
|
@@ -34,21 +36,21 @@ function defineNode(name, options) {
|
|
|
34
36
|
}
|
|
35
37
|
var EMPTY_SCHEMA = zod.z.object({});
|
|
36
38
|
function validateSchemaKeys2(schema, name) {
|
|
37
|
-
|
|
39
|
+
chunkGSQ6NPH6_cjs.assertSchemaKeysAreFree(
|
|
38
40
|
"Edge",
|
|
39
41
|
name,
|
|
40
42
|
Object.keys(schema.shape),
|
|
41
|
-
|
|
43
|
+
chunkGSQ6NPH6_cjs.RESERVED_EDGE_KEYS
|
|
42
44
|
);
|
|
43
45
|
}
|
|
44
46
|
function defineEdge(name, options) {
|
|
45
47
|
const schema = options?.schema ?? EMPTY_SCHEMA;
|
|
46
48
|
validateSchemaKeys2(schema, name);
|
|
47
49
|
if (options?.annotations !== void 0) {
|
|
48
|
-
|
|
50
|
+
chunkFL472AMI_cjs.assertJsonValue(options.annotations, "annotations", `Edge "${name}"`);
|
|
49
51
|
}
|
|
50
52
|
return Object.freeze({
|
|
51
|
-
[
|
|
53
|
+
[chunkVPYHY3LJ_cjs.EDGE_TYPE_BRAND]: true,
|
|
52
54
|
kind: name,
|
|
53
55
|
schema,
|
|
54
56
|
description: options?.description,
|
|
@@ -85,7 +87,7 @@ function createMetaEdge(name, properties) {
|
|
|
85
87
|
}
|
|
86
88
|
});
|
|
87
89
|
}
|
|
88
|
-
var subClassOfMetaEdge = createMetaEdge(
|
|
90
|
+
var subClassOfMetaEdge = createMetaEdge(chunkFL472AMI_cjs.META_EDGE_SUB_CLASS_OF, {
|
|
89
91
|
transitive: true,
|
|
90
92
|
inference: "subsumption",
|
|
91
93
|
description: "Type inheritance (Podcast subClassOf Media)"
|
|
@@ -97,9 +99,9 @@ function subClassOf(child, parent) {
|
|
|
97
99
|
to: parent
|
|
98
100
|
};
|
|
99
101
|
}
|
|
100
|
-
var broaderMetaEdge = createMetaEdge(
|
|
102
|
+
var broaderMetaEdge = createMetaEdge(chunkFL472AMI_cjs.META_EDGE_BROADER, {
|
|
101
103
|
transitive: true,
|
|
102
|
-
inverse:
|
|
104
|
+
inverse: chunkFL472AMI_cjs.META_EDGE_NARROWER,
|
|
103
105
|
inference: "hierarchy",
|
|
104
106
|
description: "Broader concept (ML broader AI)"
|
|
105
107
|
});
|
|
@@ -110,9 +112,9 @@ function broader(narrowerConcept, broaderConcept) {
|
|
|
110
112
|
to: broaderConcept
|
|
111
113
|
};
|
|
112
114
|
}
|
|
113
|
-
var narrowerMetaEdge = createMetaEdge(
|
|
115
|
+
var narrowerMetaEdge = createMetaEdge(chunkFL472AMI_cjs.META_EDGE_NARROWER, {
|
|
114
116
|
transitive: true,
|
|
115
|
-
inverse:
|
|
117
|
+
inverse: chunkFL472AMI_cjs.META_EDGE_BROADER,
|
|
116
118
|
inference: "hierarchy",
|
|
117
119
|
description: "Narrower concept (AI narrower ML)"
|
|
118
120
|
});
|
|
@@ -123,7 +125,7 @@ function narrower(broaderConcept, narrowerConcept) {
|
|
|
123
125
|
to: narrowerConcept
|
|
124
126
|
};
|
|
125
127
|
}
|
|
126
|
-
var relatedToMetaEdge = createMetaEdge(
|
|
128
|
+
var relatedToMetaEdge = createMetaEdge(chunkFL472AMI_cjs.META_EDGE_RELATED_TO, {
|
|
127
129
|
symmetric: true,
|
|
128
130
|
inference: "association",
|
|
129
131
|
description: "Non-hierarchical association"
|
|
@@ -135,7 +137,7 @@ function relatedTo(conceptA, conceptB) {
|
|
|
135
137
|
to: conceptB
|
|
136
138
|
};
|
|
137
139
|
}
|
|
138
|
-
var equivalentToMetaEdge = createMetaEdge(
|
|
140
|
+
var equivalentToMetaEdge = createMetaEdge(chunkFL472AMI_cjs.META_EDGE_EQUIVALENT_TO, {
|
|
139
141
|
symmetric: true,
|
|
140
142
|
transitive: true,
|
|
141
143
|
inference: "substitution",
|
|
@@ -148,7 +150,7 @@ function equivalentTo(kindA, kindBOrIri) {
|
|
|
148
150
|
to: kindBOrIri
|
|
149
151
|
};
|
|
150
152
|
}
|
|
151
|
-
var sameAsMetaEdge = createMetaEdge(
|
|
153
|
+
var sameAsMetaEdge = createMetaEdge(chunkFL472AMI_cjs.META_EDGE_SAME_AS, {
|
|
152
154
|
symmetric: true,
|
|
153
155
|
transitive: true,
|
|
154
156
|
inference: "substitution",
|
|
@@ -161,7 +163,7 @@ function sameAs(kindA, kindBOrIri) {
|
|
|
161
163
|
to: kindBOrIri
|
|
162
164
|
};
|
|
163
165
|
}
|
|
164
|
-
var differentFromMetaEdge = createMetaEdge(
|
|
166
|
+
var differentFromMetaEdge = createMetaEdge(chunkFL472AMI_cjs.META_EDGE_DIFFERENT_FROM, {
|
|
165
167
|
symmetric: true,
|
|
166
168
|
inference: "constraint",
|
|
167
169
|
description: "Explicitly different individuals"
|
|
@@ -173,7 +175,7 @@ function differentFrom(kindA, kindB) {
|
|
|
173
175
|
to: kindB
|
|
174
176
|
};
|
|
175
177
|
}
|
|
176
|
-
var disjointWithMetaEdge = createMetaEdge(
|
|
178
|
+
var disjointWithMetaEdge = createMetaEdge(chunkFL472AMI_cjs.META_EDGE_DISJOINT_WITH, {
|
|
177
179
|
symmetric: true,
|
|
178
180
|
inference: "constraint",
|
|
179
181
|
description: "Mutually exclusive types"
|
|
@@ -185,9 +187,9 @@ function disjointWith(kindA, kindB) {
|
|
|
185
187
|
to: kindB
|
|
186
188
|
};
|
|
187
189
|
}
|
|
188
|
-
var partOfMetaEdge = createMetaEdge(
|
|
190
|
+
var partOfMetaEdge = createMetaEdge(chunkFL472AMI_cjs.META_EDGE_PART_OF, {
|
|
189
191
|
transitive: true,
|
|
190
|
-
inverse:
|
|
192
|
+
inverse: chunkFL472AMI_cjs.META_EDGE_HAS_PART,
|
|
191
193
|
inference: "composition",
|
|
192
194
|
description: "X is part of Y"
|
|
193
195
|
});
|
|
@@ -198,9 +200,9 @@ function partOf(part, whole) {
|
|
|
198
200
|
to: whole
|
|
199
201
|
};
|
|
200
202
|
}
|
|
201
|
-
var hasPartMetaEdge = createMetaEdge(
|
|
203
|
+
var hasPartMetaEdge = createMetaEdge(chunkFL472AMI_cjs.META_EDGE_HAS_PART, {
|
|
202
204
|
transitive: true,
|
|
203
|
-
inverse:
|
|
205
|
+
inverse: chunkFL472AMI_cjs.META_EDGE_PART_OF,
|
|
204
206
|
inference: "composition",
|
|
205
207
|
description: "Y has part X"
|
|
206
208
|
});
|
|
@@ -211,12 +213,12 @@ function hasPart(whole, part) {
|
|
|
211
213
|
to: part
|
|
212
214
|
};
|
|
213
215
|
}
|
|
214
|
-
var inverseOfMetaEdge = createMetaEdge(
|
|
216
|
+
var inverseOfMetaEdge = createMetaEdge(chunkFL472AMI_cjs.META_EDGE_INVERSE_OF, {
|
|
215
217
|
symmetric: true,
|
|
216
218
|
inference: "none",
|
|
217
219
|
description: "Edge A is inverse of edge B"
|
|
218
220
|
});
|
|
219
|
-
var impliesMetaEdge = createMetaEdge(
|
|
221
|
+
var impliesMetaEdge = createMetaEdge(chunkFL472AMI_cjs.META_EDGE_IMPLIES, {
|
|
220
222
|
transitive: true,
|
|
221
223
|
inference: "none",
|
|
222
224
|
description: "Edge A implies edge B exists"
|
|
@@ -346,25 +348,11 @@ function diffNodes(before, after) {
|
|
|
346
348
|
}
|
|
347
349
|
function diffNodeDef(name, before, after) {
|
|
348
350
|
const changes = [];
|
|
349
|
-
if (!
|
|
350
|
-
const
|
|
351
|
-
const afterProps = after.properties.properties ?? {};
|
|
352
|
-
const beforeRequired = new Set(before.properties.required);
|
|
353
|
-
const afterRequired = new Set(after.properties.required);
|
|
354
|
-
const addedProps = Object.keys(afterProps).filter(
|
|
355
|
-
(p) => !(p in beforeProps)
|
|
356
|
-
);
|
|
357
|
-
const removedProps = Object.keys(beforeProps).filter(
|
|
358
|
-
(p) => !(p in afterProps)
|
|
359
|
-
);
|
|
360
|
-
const newRequired = [...afterRequired].filter(
|
|
361
|
-
(p) => !beforeRequired.has(p)
|
|
362
|
-
);
|
|
363
|
-
const { severity, details } = computePropertyChangeSeverity(
|
|
351
|
+
if (!chunkACSVZPK7_cjs.canonicalEqual(before.properties, after.properties)) {
|
|
352
|
+
const { severity, details } = classifyPropertyChanges(
|
|
364
353
|
name,
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
newRequired
|
|
354
|
+
before.properties,
|
|
355
|
+
after.properties
|
|
368
356
|
);
|
|
369
357
|
changes.push({
|
|
370
358
|
type: "modified",
|
|
@@ -385,7 +373,7 @@ function diffNodeDef(name, before, after) {
|
|
|
385
373
|
after
|
|
386
374
|
});
|
|
387
375
|
}
|
|
388
|
-
if (!
|
|
376
|
+
if (!chunkACSVZPK7_cjs.canonicalEqual(before.uniqueConstraints, after.uniqueConstraints)) {
|
|
389
377
|
changes.push({
|
|
390
378
|
type: "modified",
|
|
391
379
|
kind: name,
|
|
@@ -407,29 +395,103 @@ function diffNodeDef(name, before, after) {
|
|
|
407
395
|
}
|
|
408
396
|
return changes;
|
|
409
397
|
}
|
|
410
|
-
function
|
|
411
|
-
if (
|
|
398
|
+
function propertyTypeSignature(schema) {
|
|
399
|
+
if (schema.type !== void 0) return JSON.stringify(schema.type);
|
|
400
|
+
if (schema.const !== void 0) return "const";
|
|
401
|
+
if (schema.enum !== void 0) return "enum";
|
|
402
|
+
if (schema.anyOf !== void 0) return "anyOf";
|
|
403
|
+
if (schema.oneOf !== void 0) return "oneOf";
|
|
404
|
+
if (schema.allOf !== void 0) return "allOf";
|
|
405
|
+
return "unknown";
|
|
406
|
+
}
|
|
407
|
+
var NON_CONSTRAINING_KEYWORDS = /* @__PURE__ */ new Set([
|
|
408
|
+
"description",
|
|
409
|
+
"title",
|
|
410
|
+
"default",
|
|
411
|
+
"$schema"
|
|
412
|
+
]);
|
|
413
|
+
function stripSchemaMetadata(schema) {
|
|
414
|
+
const stripped = {};
|
|
415
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
416
|
+
if (!NON_CONSTRAINING_KEYWORDS.has(key)) stripped[key] = value;
|
|
417
|
+
}
|
|
418
|
+
return stripped;
|
|
419
|
+
}
|
|
420
|
+
function isObjectSchema(schema) {
|
|
421
|
+
return schema.type === "object" || schema.properties !== void 0;
|
|
422
|
+
}
|
|
423
|
+
function isBreakingPropertyChange(before, after) {
|
|
424
|
+
if (chunkACSVZPK7_cjs.canonicalEqual(stripSchemaMetadata(before), stripSchemaMetadata(after))) {
|
|
425
|
+
return false;
|
|
426
|
+
}
|
|
427
|
+
if (propertyTypeSignature(before) !== propertyTypeSignature(after)) {
|
|
428
|
+
return true;
|
|
429
|
+
}
|
|
430
|
+
if (isObjectSchema(before) && isObjectSchema(after)) {
|
|
431
|
+
return isBreakingObjectSchemaChange(before, after);
|
|
432
|
+
}
|
|
433
|
+
return true;
|
|
434
|
+
}
|
|
435
|
+
function isBreakingObjectSchemaChange(before, after) {
|
|
436
|
+
const beforeProps = before.properties ?? {};
|
|
437
|
+
const afterProps = after.properties ?? {};
|
|
438
|
+
const beforeRequired = new Set(before.required);
|
|
439
|
+
const afterRequired = new Set(after.required);
|
|
440
|
+
for (const key of Object.keys(beforeProps)) {
|
|
441
|
+
if (!(key in afterProps)) return true;
|
|
442
|
+
}
|
|
443
|
+
for (const key of afterRequired) {
|
|
444
|
+
if (!beforeRequired.has(key)) return true;
|
|
445
|
+
}
|
|
446
|
+
for (const [key, beforeChild] of Object.entries(beforeProps)) {
|
|
447
|
+
const afterChild = afterProps[key];
|
|
448
|
+
if (afterChild === void 0) continue;
|
|
449
|
+
if (isBreakingPropertyChange(beforeChild, afterChild)) return true;
|
|
450
|
+
}
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
function classifyPropertyChanges(kind, before, after) {
|
|
454
|
+
const beforeProps = before.properties ?? {};
|
|
455
|
+
const afterProps = after.properties ?? {};
|
|
456
|
+
const beforeRequired = new Set(before.required);
|
|
457
|
+
const afterRequired = new Set(after.required);
|
|
458
|
+
const removed = Object.keys(beforeProps).filter((p) => !(p in afterProps));
|
|
459
|
+
const added = Object.keys(afterProps).filter((p) => !(p in beforeProps));
|
|
460
|
+
const newRequired = [...afterRequired].filter((p) => !beforeRequired.has(p));
|
|
461
|
+
const breakingProps = [];
|
|
462
|
+
for (const [property, beforeProperty] of Object.entries(beforeProps)) {
|
|
463
|
+
const afterProperty = afterProps[property];
|
|
464
|
+
if (afterProperty === void 0) continue;
|
|
465
|
+
if (chunkACSVZPK7_cjs.canonicalEqual(beforeProperty, afterProperty)) continue;
|
|
466
|
+
if (isBreakingPropertyChange(beforeProperty, afterProperty)) {
|
|
467
|
+
breakingProps.push(property);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
if (removed.length > 0) {
|
|
471
|
+
return {
|
|
472
|
+
severity: "breaking",
|
|
473
|
+
details: `Properties removed from "${kind}": ${removed.join(", ")}`
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
if (breakingProps.length > 0) {
|
|
412
477
|
return {
|
|
413
478
|
severity: "breaking",
|
|
414
|
-
details: `
|
|
479
|
+
details: `Property schemas changed incompatibly in "${kind}": ${breakingProps.join(", ")}`
|
|
415
480
|
};
|
|
416
481
|
}
|
|
417
482
|
if (newRequired.length > 0) {
|
|
418
483
|
return {
|
|
419
484
|
severity: "breaking",
|
|
420
|
-
details: `New required properties in "${
|
|
485
|
+
details: `New required properties in "${kind}": ${newRequired.join(", ")}`
|
|
421
486
|
};
|
|
422
487
|
}
|
|
423
|
-
if (
|
|
488
|
+
if (added.length > 0) {
|
|
424
489
|
return {
|
|
425
490
|
severity: "safe",
|
|
426
|
-
details: `Properties added to "${
|
|
491
|
+
details: `Properties added to "${kind}": ${added.join(", ")}`
|
|
427
492
|
};
|
|
428
493
|
}
|
|
429
|
-
return {
|
|
430
|
-
severity: "safe",
|
|
431
|
-
details: `Properties changed in "${name}"`
|
|
432
|
-
};
|
|
494
|
+
return { severity: "safe", details: `Properties changed in "${kind}"` };
|
|
433
495
|
}
|
|
434
496
|
function diffEdges(before, after) {
|
|
435
497
|
const changes = [];
|
|
@@ -469,7 +531,7 @@ function diffEdges(before, after) {
|
|
|
469
531
|
}
|
|
470
532
|
function diffEdgeDef(name, before, after) {
|
|
471
533
|
const changes = [];
|
|
472
|
-
if (!
|
|
534
|
+
if (!chunkACSVZPK7_cjs.canonicalEqual(before.fromKinds, after.fromKinds)) {
|
|
473
535
|
changes.push({
|
|
474
536
|
type: "modified",
|
|
475
537
|
kind: name,
|
|
@@ -479,7 +541,7 @@ function diffEdgeDef(name, before, after) {
|
|
|
479
541
|
after
|
|
480
542
|
});
|
|
481
543
|
}
|
|
482
|
-
if (!
|
|
544
|
+
if (!chunkACSVZPK7_cjs.canonicalEqual(before.toKinds, after.toKinds)) {
|
|
483
545
|
changes.push({
|
|
484
546
|
type: "modified",
|
|
485
547
|
kind: name,
|
|
@@ -499,12 +561,17 @@ function diffEdgeDef(name, before, after) {
|
|
|
499
561
|
after
|
|
500
562
|
});
|
|
501
563
|
}
|
|
502
|
-
if (!
|
|
564
|
+
if (!chunkACSVZPK7_cjs.canonicalEqual(before.properties, after.properties)) {
|
|
565
|
+
const { severity, details } = classifyPropertyChanges(
|
|
566
|
+
name,
|
|
567
|
+
before.properties,
|
|
568
|
+
after.properties
|
|
569
|
+
);
|
|
503
570
|
changes.push({
|
|
504
571
|
type: "modified",
|
|
505
572
|
kind: name,
|
|
506
|
-
severity
|
|
507
|
-
details
|
|
573
|
+
severity,
|
|
574
|
+
details,
|
|
508
575
|
before,
|
|
509
576
|
after
|
|
510
577
|
});
|
|
@@ -524,7 +591,7 @@ function diffEdgeDef(name, before, after) {
|
|
|
524
591
|
function annotationsChanged(before, after) {
|
|
525
592
|
if (before === void 0 && after === void 0) return false;
|
|
526
593
|
if (before === void 0 || after === void 0) return true;
|
|
527
|
-
return !
|
|
594
|
+
return !chunkACSVZPK7_cjs.canonicalEqual(before, after);
|
|
528
595
|
}
|
|
529
596
|
function diffOntology(before, after) {
|
|
530
597
|
const changes = [];
|
|
@@ -623,7 +690,7 @@ function diffIndexes(before, after) {
|
|
|
623
690
|
for (const [name, beforeIndex] of beforeByName) {
|
|
624
691
|
const afterIndex = afterByName.get(name);
|
|
625
692
|
if (!afterIndex) continue;
|
|
626
|
-
if (!
|
|
693
|
+
if (!chunkACSVZPK7_cjs.canonicalEqual(beforeIndex, afterIndex)) {
|
|
627
694
|
changes.push({
|
|
628
695
|
type: "modified",
|
|
629
696
|
name,
|
|
@@ -653,7 +720,7 @@ function diffExtension(before, after) {
|
|
|
653
720
|
details: "Graph extension document was removed"
|
|
654
721
|
};
|
|
655
722
|
}
|
|
656
|
-
if (
|
|
723
|
+
if (chunkACSVZPK7_cjs.canonicalEqual(before, after)) return void 0;
|
|
657
724
|
return {
|
|
658
725
|
type: "modified",
|
|
659
726
|
severity: "safe",
|
|
@@ -805,7 +872,7 @@ var KindRegistry = class {
|
|
|
805
872
|
* Checks if child is a subclass of parent (directly or transitively).
|
|
806
873
|
*/
|
|
807
874
|
isSubClassOf(child, parent) {
|
|
808
|
-
return
|
|
875
|
+
return chunkFL472AMI_cjs.isReachable(this.subClassAncestors, child, parent);
|
|
809
876
|
}
|
|
810
877
|
/**
|
|
811
878
|
* Expands a kind to include all its subclasses.
|
|
@@ -832,13 +899,13 @@ var KindRegistry = class {
|
|
|
832
899
|
* Checks if narrowerConcept is narrower than broaderConcept.
|
|
833
900
|
*/
|
|
834
901
|
isNarrowerThan(narrowerConcept, broaderConcept) {
|
|
835
|
-
return
|
|
902
|
+
return chunkFL472AMI_cjs.isReachable(this.broaderClosure, narrowerConcept, broaderConcept);
|
|
836
903
|
}
|
|
837
904
|
/**
|
|
838
905
|
* Checks if broaderConcept is broader than narrowerConcept.
|
|
839
906
|
*/
|
|
840
907
|
isBroaderThan(broaderConcept, narrowerConcept) {
|
|
841
|
-
return
|
|
908
|
+
return chunkFL472AMI_cjs.isReachable(this.narrowerClosure, broaderConcept, narrowerConcept);
|
|
842
909
|
}
|
|
843
910
|
/**
|
|
844
911
|
* Expands to include all narrower concepts.
|
|
@@ -902,7 +969,7 @@ var KindRegistry = class {
|
|
|
902
969
|
* Checks if part is part of whole (directly or transitively).
|
|
903
970
|
*/
|
|
904
971
|
isPartOf(part, whole) {
|
|
905
|
-
return
|
|
972
|
+
return chunkFL472AMI_cjs.isReachable(this.partOfClosure, part, whole);
|
|
906
973
|
}
|
|
907
974
|
/**
|
|
908
975
|
* Gets all wholes that contain this part.
|
|
@@ -960,6 +1027,17 @@ var KindRegistry = class {
|
|
|
960
1027
|
if (concreteKind === targetKind) return true;
|
|
961
1028
|
return this.isSubClassOf(concreteKind, targetKind);
|
|
962
1029
|
}
|
|
1030
|
+
/**
|
|
1031
|
+
* Checks if a concrete kind is assignable to at least one of the given
|
|
1032
|
+
* target kinds. Shared by every "is this kind usable where one of these
|
|
1033
|
+
* kinds is expected" check (edge endpoint validation, ontology relation
|
|
1034
|
+
* endpoint compatibility) so they can't independently drift.
|
|
1035
|
+
*/
|
|
1036
|
+
isAssignableToAny(concreteKind, targetKinds) {
|
|
1037
|
+
return targetKinds.some(
|
|
1038
|
+
(targetKind) => this.isAssignableTo(concreteKind, targetKind)
|
|
1039
|
+
);
|
|
1040
|
+
}
|
|
963
1041
|
/**
|
|
964
1042
|
* Validates that a kind exists in the registry.
|
|
965
1043
|
*/
|
|
@@ -1013,57 +1091,57 @@ function computeClosuresFromOntology(ontology) {
|
|
|
1013
1091
|
const fromName = getKindName(relation.from);
|
|
1014
1092
|
const toName = getKindName(relation.to);
|
|
1015
1093
|
switch (relation.metaEdge.name) {
|
|
1016
|
-
case
|
|
1094
|
+
case chunkFL472AMI_cjs.META_EDGE_SUB_CLASS_OF: {
|
|
1017
1095
|
subClassRelations.push([fromName, toName]);
|
|
1018
1096
|
break;
|
|
1019
1097
|
}
|
|
1020
|
-
case
|
|
1098
|
+
case chunkFL472AMI_cjs.META_EDGE_BROADER: {
|
|
1021
1099
|
broaderRelations.push([fromName, toName]);
|
|
1022
1100
|
break;
|
|
1023
1101
|
}
|
|
1024
|
-
case
|
|
1102
|
+
case chunkFL472AMI_cjs.META_EDGE_NARROWER: {
|
|
1025
1103
|
broaderRelations.push([toName, fromName]);
|
|
1026
1104
|
break;
|
|
1027
1105
|
}
|
|
1028
|
-
case
|
|
1029
|
-
case
|
|
1106
|
+
case chunkFL472AMI_cjs.META_EDGE_EQUIVALENT_TO:
|
|
1107
|
+
case chunkFL472AMI_cjs.META_EDGE_SAME_AS: {
|
|
1030
1108
|
equivalentRelations.push([fromName, toName]);
|
|
1031
1109
|
break;
|
|
1032
1110
|
}
|
|
1033
|
-
case
|
|
1111
|
+
case chunkFL472AMI_cjs.META_EDGE_DISJOINT_WITH: {
|
|
1034
1112
|
disjointRelations.push([fromName, toName]);
|
|
1035
1113
|
break;
|
|
1036
1114
|
}
|
|
1037
|
-
case
|
|
1115
|
+
case chunkFL472AMI_cjs.META_EDGE_PART_OF: {
|
|
1038
1116
|
partOfRelations.push([fromName, toName]);
|
|
1039
1117
|
break;
|
|
1040
1118
|
}
|
|
1041
|
-
case
|
|
1119
|
+
case chunkFL472AMI_cjs.META_EDGE_HAS_PART: {
|
|
1042
1120
|
partOfRelations.push([toName, fromName]);
|
|
1043
1121
|
break;
|
|
1044
1122
|
}
|
|
1045
|
-
case
|
|
1123
|
+
case chunkFL472AMI_cjs.META_EDGE_INVERSE_OF: {
|
|
1046
1124
|
inverseOfRelations.push([fromName, toName]);
|
|
1047
1125
|
break;
|
|
1048
1126
|
}
|
|
1049
|
-
case
|
|
1127
|
+
case chunkFL472AMI_cjs.META_EDGE_IMPLIES: {
|
|
1050
1128
|
impliesRelations.push([fromName, toName]);
|
|
1051
1129
|
break;
|
|
1052
1130
|
}
|
|
1053
1131
|
}
|
|
1054
1132
|
}
|
|
1055
|
-
const subClassAncestors =
|
|
1056
|
-
const subClassDescendants =
|
|
1057
|
-
const broaderClosure =
|
|
1058
|
-
const narrowerClosure =
|
|
1133
|
+
const subClassAncestors = chunkFL472AMI_cjs.computeTransitiveClosure(subClassRelations);
|
|
1134
|
+
const subClassDescendants = chunkFL472AMI_cjs.invertClosure(subClassAncestors);
|
|
1135
|
+
const broaderClosure = chunkFL472AMI_cjs.computeTransitiveClosure(broaderRelations);
|
|
1136
|
+
const narrowerClosure = chunkFL472AMI_cjs.invertClosure(broaderClosure);
|
|
1059
1137
|
const equivalenceSets = computeEquivalenceSets(equivalentRelations);
|
|
1060
1138
|
const iriToKind = computeIriMapping(equivalentRelations);
|
|
1061
1139
|
const disjointPairs = computeDisjointPairs(disjointRelations);
|
|
1062
|
-
const partOfClosure =
|
|
1063
|
-
const hasPartClosure =
|
|
1140
|
+
const partOfClosure = chunkFL472AMI_cjs.computeTransitiveClosure(partOfRelations);
|
|
1141
|
+
const hasPartClosure = chunkFL472AMI_cjs.invertClosure(partOfClosure);
|
|
1064
1142
|
const edgeInverses = computeEdgeInverses(inverseOfRelations);
|
|
1065
|
-
const edgeImplicationsClosure =
|
|
1066
|
-
const edgeImplyingClosure =
|
|
1143
|
+
const edgeImplicationsClosure = chunkFL472AMI_cjs.computeTransitiveClosure(impliesRelations);
|
|
1144
|
+
const edgeImplyingClosure = chunkFL472AMI_cjs.invertClosure(edgeImplicationsClosure);
|
|
1067
1145
|
return {
|
|
1068
1146
|
subClassAncestors,
|
|
1069
1147
|
subClassDescendants,
|
|
@@ -1167,7 +1245,7 @@ function serializeSchema(graph, version) {
|
|
|
1167
1245
|
return {
|
|
1168
1246
|
graphId: graph.id,
|
|
1169
1247
|
version,
|
|
1170
|
-
generatedAt:
|
|
1248
|
+
generatedAt: chunkBLZDPRXT_cjs.nowIso(),
|
|
1171
1249
|
nodes,
|
|
1172
1250
|
edges,
|
|
1173
1251
|
ontology,
|
|
@@ -1198,7 +1276,7 @@ function serializeDeprecatedKinds(set) {
|
|
|
1198
1276
|
function canonicalExtension(document) {
|
|
1199
1277
|
if (document === void 0) return void 0;
|
|
1200
1278
|
if (document.version === void 0) return document;
|
|
1201
|
-
if (document.version !==
|
|
1279
|
+
if (document.version !== chunkFL472AMI_cjs.LEGACY_GRAPH_EXTENSION_VERSION) return document;
|
|
1202
1280
|
const { version: _omit, ...rest } = document;
|
|
1203
1281
|
return rest;
|
|
1204
1282
|
}
|
|
@@ -1247,6 +1325,16 @@ function serializeNodeIndexDeclaration(declaration) {
|
|
|
1247
1325
|
unique: declaration.unique,
|
|
1248
1326
|
scope: declaration.scope,
|
|
1249
1327
|
where: declaration.where,
|
|
1328
|
+
// `method: "btree"` is canonicalized by absence, like `origin` below.
|
|
1329
|
+
...declaration.method === void 0 ? {} : { method: declaration.method },
|
|
1330
|
+
// `keySystemColumns: []` is canonicalized by absence, same rule. Checked
|
|
1331
|
+
// against length, not just `undefined` — `NodeIndexDeclaration` is
|
|
1332
|
+
// exported and `defineGraph` accepts pre-built declarations directly
|
|
1333
|
+
// (bypassing `defineNodeIndex`'s own canonicalization and the
|
|
1334
|
+
// `nodeIndexDeclarationZod` parse boundary, which rejects an explicit
|
|
1335
|
+
// `[]` via `.min(1)`), so an in-memory declaration can still carry a
|
|
1336
|
+
// present-but-empty array that must canonicalize to absent here.
|
|
1337
|
+
...declaration.keySystemColumns === void 0 || declaration.keySystemColumns.length === 0 ? {} : { keySystemColumns: declaration.keySystemColumns },
|
|
1250
1338
|
// `origin: "compile-time"` is the default and is omitted from the
|
|
1251
1339
|
// canonical form (absence == compile-time). Only `runtime` is
|
|
1252
1340
|
// emitted explicitly so the restart loader can route the declaration
|
|
@@ -1267,12 +1355,14 @@ function serializeEdgeIndexDeclaration(declaration) {
|
|
|
1267
1355
|
unique: declaration.unique,
|
|
1268
1356
|
scope: declaration.scope,
|
|
1269
1357
|
where: declaration.where,
|
|
1358
|
+
// `method: "btree"` is canonicalized by absence, like `origin`.
|
|
1359
|
+
...declaration.method === void 0 ? {} : { method: declaration.method },
|
|
1270
1360
|
...declaration.origin === "runtime" ? { origin: "runtime" } : {}
|
|
1271
1361
|
};
|
|
1272
1362
|
}
|
|
1273
1363
|
function serializeNodes(graph) {
|
|
1274
1364
|
const result = {};
|
|
1275
|
-
for (const kindName of
|
|
1365
|
+
for (const kindName of chunkVPYHY3LJ_cjs.getNodeKinds(graph)) {
|
|
1276
1366
|
const registration = graph.nodes[kindName];
|
|
1277
1367
|
if (registration === void 0) continue;
|
|
1278
1368
|
result[kindName] = serializeNodeDef(registration);
|
|
@@ -1340,7 +1430,7 @@ function deserializeWherePredicate(serialized) {
|
|
|
1340
1430
|
}
|
|
1341
1431
|
function serializeEdges(graph) {
|
|
1342
1432
|
const result = {};
|
|
1343
|
-
for (const kindName of
|
|
1433
|
+
for (const kindName of chunkVPYHY3LJ_cjs.getEdgeKinds(graph)) {
|
|
1344
1434
|
const registration = graph.edges[kindName];
|
|
1345
1435
|
if (registration === void 0) continue;
|
|
1346
1436
|
result[kindName] = serializeEdgeDef(registration);
|
|
@@ -1442,11 +1532,7 @@ function mapToRecord(map) {
|
|
|
1442
1532
|
return result;
|
|
1443
1533
|
}
|
|
1444
1534
|
function mapToSimpleRecord(map) {
|
|
1445
|
-
|
|
1446
|
-
for (const [key, value] of map) {
|
|
1447
|
-
result[key] = value;
|
|
1448
|
-
}
|
|
1449
|
-
return result;
|
|
1535
|
+
return Object.fromEntries(map);
|
|
1450
1536
|
}
|
|
1451
1537
|
var SCHEMA_PROPERTIES_CACHE = /* @__PURE__ */ new WeakMap();
|
|
1452
1538
|
function serializeSchemaProperties(schema) {
|
|
@@ -1488,8 +1574,8 @@ async function computeSchemaHash(schema) {
|
|
|
1488
1574
|
...schema.extension === void 0 ? {} : { extension: schema.extension },
|
|
1489
1575
|
...schema.deprecatedKinds === void 0 ? {} : { deprecatedKinds: schema.deprecatedKinds }
|
|
1490
1576
|
};
|
|
1491
|
-
const json = JSON.stringify(hashable,
|
|
1492
|
-
return
|
|
1577
|
+
const json = JSON.stringify(hashable, chunkACSVZPK7_cjs.sortedReplacer);
|
|
1578
|
+
return chunkTEDRJXOG_cjs.sha256Hex(json);
|
|
1493
1579
|
}
|
|
1494
1580
|
var COMPILE_NODE_CACHE = /* @__PURE__ */ new Map();
|
|
1495
1581
|
var COMPILE_EDGE_SCHEMA_CACHE = /* @__PURE__ */ new WeakMap();
|
|
@@ -1537,7 +1623,7 @@ function compileNode(kindName, document) {
|
|
|
1537
1623
|
const schema = buildObjectSchema(document.properties);
|
|
1538
1624
|
const type = defineNode(
|
|
1539
1625
|
kindName,
|
|
1540
|
-
|
|
1626
|
+
chunkDI74SMXS_cjs.compactUndefined({
|
|
1541
1627
|
schema,
|
|
1542
1628
|
description: document.description,
|
|
1543
1629
|
annotations: document.annotations
|
|
@@ -1561,7 +1647,7 @@ function compileEdge(kindName, document, nodeTypeByName) {
|
|
|
1561
1647
|
(name) => nodeTypeByName.get(name) ?? name
|
|
1562
1648
|
);
|
|
1563
1649
|
return Object.freeze(
|
|
1564
|
-
|
|
1650
|
+
chunkDI74SMXS_cjs.compactUndefined({
|
|
1565
1651
|
kindName,
|
|
1566
1652
|
schema,
|
|
1567
1653
|
description: document.description,
|
|
@@ -1605,7 +1691,7 @@ function compileProperty(property) {
|
|
|
1605
1691
|
}
|
|
1606
1692
|
function compileStringProperty(property) {
|
|
1607
1693
|
if (property.searchable !== void 0) {
|
|
1608
|
-
return applyStringRefinements(
|
|
1694
|
+
return applyStringRefinements(chunkH7YNSMA7_cjs.searchable(property.searchable), property);
|
|
1609
1695
|
}
|
|
1610
1696
|
if (property.format === void 0) {
|
|
1611
1697
|
return applyStringRefinements(zod.z.string(), property);
|
|
@@ -1655,7 +1741,7 @@ function compileEnumProperty(property) {
|
|
|
1655
1741
|
}
|
|
1656
1742
|
function compileArrayProperty(property) {
|
|
1657
1743
|
if (property.embedding !== void 0) {
|
|
1658
|
-
return
|
|
1744
|
+
return chunkH7YNSMA7_cjs.embedding(property.embedding.dimensions);
|
|
1659
1745
|
}
|
|
1660
1746
|
const inner = compilePropertyForArrayItem(property.items);
|
|
1661
1747
|
return zod.z.array(inner);
|
|
@@ -1695,7 +1781,7 @@ function makeWherePredicate(field, op) {
|
|
|
1695
1781
|
};
|
|
1696
1782
|
}
|
|
1697
1783
|
var META_EDGE_BY_NAME = Object.fromEntries(
|
|
1698
|
-
|
|
1784
|
+
chunkFL472AMI_cjs.ALL_META_EDGE_NAMES.map((name) => [name, core[`${name}MetaEdge`]])
|
|
1699
1785
|
);
|
|
1700
1786
|
function compileOntologyRelation(relation, nodeTypeByName) {
|
|
1701
1787
|
const metaEdge = META_EDGE_BY_NAME[relation.metaEdge];
|
|
@@ -1731,10 +1817,10 @@ function extensionKindNames(document) {
|
|
|
1731
1817
|
function mergeGraphExtension(graph, document) {
|
|
1732
1818
|
const existingDocument = graph.extension ?? Object.freeze({});
|
|
1733
1819
|
const unionDocument = unionDocuments(existingDocument, document);
|
|
1734
|
-
if (graph.extension !== void 0 &&
|
|
1820
|
+
if (graph.extension !== void 0 && chunkACSVZPK7_cjs.canonicalEqual(unionDocument, existingDocument)) {
|
|
1735
1821
|
return graph;
|
|
1736
1822
|
}
|
|
1737
|
-
const validatedUnion =
|
|
1823
|
+
const validatedUnion = chunkFL472AMI_cjs.unwrap(chunkFL472AMI_cjs.validateGraphExtension(unionDocument));
|
|
1738
1824
|
const compiled = compileGraphExtension(validatedUnion);
|
|
1739
1825
|
const { nodes: runtimeNodeNames, edges: runtimeEdgeNames } = extensionKindNames(existingDocument);
|
|
1740
1826
|
const nodeKinds = /* @__PURE__ */ new Map();
|
|
@@ -1786,7 +1872,7 @@ function mergeGraphExtension(graph, document) {
|
|
|
1786
1872
|
});
|
|
1787
1873
|
const type = defineEdge(
|
|
1788
1874
|
edge.kindName,
|
|
1789
|
-
|
|
1875
|
+
chunkDI74SMXS_cjs.compactUndefined({
|
|
1790
1876
|
schema: edge.schema,
|
|
1791
1877
|
description: edge.description,
|
|
1792
1878
|
annotations: edge.annotations,
|
|
@@ -1836,7 +1922,7 @@ function deriveGraphExtensionVectorIndexes(compiledNodes) {
|
|
|
1836
1922
|
...compiled.unique.length === 0 ? {} : { unique: [...compiled.unique] }
|
|
1837
1923
|
};
|
|
1838
1924
|
}
|
|
1839
|
-
return
|
|
1925
|
+
return chunkVPYHY3LJ_cjs.autoDeriveVectorIndexes(registrations).map(
|
|
1840
1926
|
(index) => Object.freeze({ ...index, origin: "runtime" })
|
|
1841
1927
|
);
|
|
1842
1928
|
}
|
|
@@ -1854,7 +1940,7 @@ function mergeIndexesWithGraphExtension(existing, runtimeIndexes, graphId) {
|
|
|
1854
1940
|
const runtimeRelational = runtimeIndexes.filter(
|
|
1855
1941
|
(index) => index.entity !== "vector"
|
|
1856
1942
|
);
|
|
1857
|
-
const vectorMerged =
|
|
1943
|
+
const vectorMerged = chunkVPYHY3LJ_cjs.mergeVectorIndexes(compileTimeIndexes, runtimeVectors);
|
|
1858
1944
|
const merged = [...vectorMerged, ...runtimeRelational];
|
|
1859
1945
|
assertUniqueIndexNames(merged, graphId);
|
|
1860
1946
|
return merged;
|
|
@@ -1866,7 +1952,7 @@ function assertUniqueIndexNames(indexes, graphId) {
|
|
|
1866
1952
|
seen.add(index.name);
|
|
1867
1953
|
continue;
|
|
1868
1954
|
}
|
|
1869
|
-
throw new
|
|
1955
|
+
throw new chunkLGEALRC6_cjs.ConfigurationError(
|
|
1870
1956
|
`Duplicate index name "${index.name}" after merging graph extension into graph "${graphId}". Index names must be unique within a graph.`,
|
|
1871
1957
|
{ graphId, indexName: index.name, code: "DUPLICATE_INDEX_NAME" },
|
|
1872
1958
|
{
|
|
@@ -1882,12 +1968,12 @@ function compileGraphExtensionRelationalIndexes(documents, nodeKinds, mergedEdge
|
|
|
1882
1968
|
if (document.entity === "node") {
|
|
1883
1969
|
const node = nodeKinds.get(document.kind);
|
|
1884
1970
|
if (node === void 0) {
|
|
1885
|
-
throw new
|
|
1971
|
+
throw new chunkLGEALRC6_cjs.KindNotFoundError(document.kind, "node", {
|
|
1886
1972
|
graphId,
|
|
1887
1973
|
suggestion: "Declare the kind under `nodes` in this graph extension, or remove the index from `indexes`."
|
|
1888
1974
|
});
|
|
1889
1975
|
}
|
|
1890
|
-
const declaration2 =
|
|
1976
|
+
const declaration2 = chunkUUT7UN2N_cjs.defineNodeIndex(
|
|
1891
1977
|
node,
|
|
1892
1978
|
toNodeIndexConfig(document)
|
|
1893
1979
|
);
|
|
@@ -1896,12 +1982,12 @@ function compileGraphExtensionRelationalIndexes(documents, nodeKinds, mergedEdge
|
|
|
1896
1982
|
}
|
|
1897
1983
|
const edgeRegistration = mergedEdges[document.kind];
|
|
1898
1984
|
if (edgeRegistration === void 0) {
|
|
1899
|
-
throw new
|
|
1985
|
+
throw new chunkLGEALRC6_cjs.KindNotFoundError(document.kind, "edge", {
|
|
1900
1986
|
graphId,
|
|
1901
1987
|
suggestion: "Declare the edge under `edges` in this graph extension, or remove the index from `indexes`."
|
|
1902
1988
|
});
|
|
1903
1989
|
}
|
|
1904
|
-
const declaration =
|
|
1990
|
+
const declaration = chunkUUT7UN2N_cjs.defineEdgeIndex(
|
|
1905
1991
|
edgeRegistration.type,
|
|
1906
1992
|
toEdgeIndexConfig(document)
|
|
1907
1993
|
);
|
|
@@ -1913,7 +1999,7 @@ function buildWhereCallback(where) {
|
|
|
1913
1999
|
return (props) => {
|
|
1914
2000
|
const builder = props[where.field];
|
|
1915
2001
|
if (builder === void 0) {
|
|
1916
|
-
throw new
|
|
2002
|
+
throw new chunkLGEALRC6_cjs.ConfigurationError(
|
|
1917
2003
|
`Graph-extension index \`where\` references unknown field "${where.field}".`,
|
|
1918
2004
|
{ field: where.field, code: "EXTENSION_INDEX_WHERE_UNKNOWN_FIELD" }
|
|
1919
2005
|
);
|
|
@@ -1922,7 +2008,7 @@ function buildWhereCallback(where) {
|
|
|
1922
2008
|
};
|
|
1923
2009
|
}
|
|
1924
2010
|
function toNodeIndexConfig(document) {
|
|
1925
|
-
return
|
|
2011
|
+
return chunkDI74SMXS_cjs.compactUndefined({
|
|
1926
2012
|
fields: document.fields,
|
|
1927
2013
|
coveringFields: document.coveringFields,
|
|
1928
2014
|
unique: document.unique,
|
|
@@ -1932,7 +2018,7 @@ function toNodeIndexConfig(document) {
|
|
|
1932
2018
|
});
|
|
1933
2019
|
}
|
|
1934
2020
|
function toEdgeIndexConfig(document) {
|
|
1935
|
-
return
|
|
2021
|
+
return chunkDI74SMXS_cjs.compactUndefined({
|
|
1936
2022
|
fields: document.fields,
|
|
1937
2023
|
coveringFields: document.coveringFields,
|
|
1938
2024
|
unique: document.unique,
|
|
@@ -1988,14 +2074,14 @@ function isEmptyExtension(extension) {
|
|
|
1988
2074
|
}
|
|
1989
2075
|
function assertNoCollision(kindName, entity, collides, graphId) {
|
|
1990
2076
|
if (!collides) return;
|
|
1991
|
-
throw new
|
|
2077
|
+
throw new chunkFL472AMI_cjs.KindCollisionError(kindName, entity, graphId);
|
|
1992
2078
|
}
|
|
1993
2079
|
function resolveEndpoints(entries, nodeKinds, context) {
|
|
1994
2080
|
return entries.map((entry) => {
|
|
1995
2081
|
if (typeof entry !== "string") return entry;
|
|
1996
2082
|
const resolved = nodeKinds.get(entry);
|
|
1997
2083
|
if (resolved === void 0) {
|
|
1998
|
-
throw new
|
|
2084
|
+
throw new chunkFL472AMI_cjs.GraphExtensionUnresolvedEndpointError(
|
|
1999
2085
|
context.edgeKind,
|
|
2000
2086
|
context.side,
|
|
2001
2087
|
entry,
|
|
@@ -2010,6 +2096,94 @@ function resolveOntologyEndpoints(relation, nodeKinds) {
|
|
|
2010
2096
|
const to = typeof relation.to === "string" ? nodeKinds.get(relation.to) ?? relation.to : relation.to;
|
|
2011
2097
|
return { ...relation, from, to };
|
|
2012
2098
|
}
|
|
2099
|
+
|
|
2100
|
+
// src/registry/validate-implies.ts
|
|
2101
|
+
function validateImpliesEndpointCompatibility(edgeEndpoints, registry) {
|
|
2102
|
+
for (const [impliedEdgeKind, impliedEndpoints] of edgeEndpoints) {
|
|
2103
|
+
for (const implyingEdgeKind of registry.expandImplyingEdges(
|
|
2104
|
+
impliedEdgeKind
|
|
2105
|
+
)) {
|
|
2106
|
+
if (implyingEdgeKind === impliedEdgeKind) continue;
|
|
2107
|
+
const implyingEndpoints = edgeEndpoints.get(implyingEdgeKind);
|
|
2108
|
+
if (!implyingEndpoints) continue;
|
|
2109
|
+
assertEndpointCompatible(
|
|
2110
|
+
"from",
|
|
2111
|
+
implyingEdgeKind,
|
|
2112
|
+
implyingEndpoints.from,
|
|
2113
|
+
impliedEdgeKind,
|
|
2114
|
+
impliedEndpoints.from,
|
|
2115
|
+
registry
|
|
2116
|
+
);
|
|
2117
|
+
assertEndpointCompatible(
|
|
2118
|
+
"to",
|
|
2119
|
+
implyingEdgeKind,
|
|
2120
|
+
implyingEndpoints.to,
|
|
2121
|
+
impliedEdgeKind,
|
|
2122
|
+
impliedEndpoints.to,
|
|
2123
|
+
registry
|
|
2124
|
+
);
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
function assertEndpointCompatible(side, implyingEdgeKind, implyingKinds, impliedEdgeKind, impliedKinds, registry) {
|
|
2129
|
+
const incompatibleKinds = implyingKinds.filter(
|
|
2130
|
+
(kind) => !registry.isAssignableToAny(kind, impliedKinds)
|
|
2131
|
+
);
|
|
2132
|
+
if (incompatibleKinds.length === 0) return;
|
|
2133
|
+
throw new chunkLGEALRC6_cjs.ConfigurationError(
|
|
2134
|
+
`implies("${implyingEdgeKind}", "${impliedEdgeKind}") is endpoint-incompatible: ${side} kind(s) [${incompatibleKinds.join(", ")}] declared on "${implyingEdgeKind}" cannot be assigned to any of "${impliedEdgeKind}"'s ${side} kind(s) [${impliedKinds.join(", ")}].`,
|
|
2135
|
+
{
|
|
2136
|
+
metaEdge: chunkFL472AMI_cjs.META_EDGE_IMPLIES,
|
|
2137
|
+
implyingEdge: implyingEdgeKind,
|
|
2138
|
+
impliedEdge: impliedEdgeKind,
|
|
2139
|
+
endpoint: side,
|
|
2140
|
+
incompatibleKinds,
|
|
2141
|
+
allowedKinds: impliedKinds
|
|
2142
|
+
},
|
|
2143
|
+
{
|
|
2144
|
+
suggestion: `Add a subClassOf relation from each of [${incompatibleKinds.join(", ")}] to one of "${impliedEdgeKind}"'s ${side} kind(s) [${impliedKinds.join(", ")}], narrow "${implyingEdgeKind}"'s ${side} declaration to exclude [${incompatibleKinds.join(", ")}], or remove implies("${implyingEdgeKind}", "${impliedEdgeKind}").`
|
|
2145
|
+
}
|
|
2146
|
+
);
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
// src/registry/builders.ts
|
|
2150
|
+
function buildKindRegistry(graph) {
|
|
2151
|
+
const nodeTypes = extractNodeTypes(graph);
|
|
2152
|
+
const edgeTypes = extractEdgeTypes(graph);
|
|
2153
|
+
const closures = graph.ontology.length > 0 ? computeClosuresFromOntology(graph.ontology) : createEmptyClosures();
|
|
2154
|
+
const registry = new KindRegistry(nodeTypes, edgeTypes, closures);
|
|
2155
|
+
validateImpliesEndpointCompatibility(
|
|
2156
|
+
buildEdgeEndpointKinds(graph.edges),
|
|
2157
|
+
registry
|
|
2158
|
+
);
|
|
2159
|
+
return registry;
|
|
2160
|
+
}
|
|
2161
|
+
function buildEdgeEndpointKinds(edges) {
|
|
2162
|
+
const result = /* @__PURE__ */ new Map();
|
|
2163
|
+
for (const [kind, registration] of Object.entries(edges)) {
|
|
2164
|
+
result.set(kind, {
|
|
2165
|
+
from: registration.from.map((node) => node.kind),
|
|
2166
|
+
to: registration.to.map((node) => node.kind)
|
|
2167
|
+
});
|
|
2168
|
+
}
|
|
2169
|
+
return result;
|
|
2170
|
+
}
|
|
2171
|
+
function extractNodeTypes(graph) {
|
|
2172
|
+
const result = /* @__PURE__ */ new Map();
|
|
2173
|
+
for (const typeName of chunkVPYHY3LJ_cjs.getNodeKinds(graph)) {
|
|
2174
|
+
const registration = graph.nodes[typeName];
|
|
2175
|
+
result.set(typeName, registration.type);
|
|
2176
|
+
}
|
|
2177
|
+
return result;
|
|
2178
|
+
}
|
|
2179
|
+
function extractEdgeTypes(graph) {
|
|
2180
|
+
const result = /* @__PURE__ */ new Map();
|
|
2181
|
+
for (const typeName of chunkVPYHY3LJ_cjs.getEdgeKinds(graph)) {
|
|
2182
|
+
const registration = graph.edges[typeName];
|
|
2183
|
+
result.set(typeName, registration.type);
|
|
2184
|
+
}
|
|
2185
|
+
return result;
|
|
2186
|
+
}
|
|
2013
2187
|
var deleteBehaviorZod = zod.z.enum(["restrict", "cascade", "disconnect"]);
|
|
2014
2188
|
var cardinalityZod = zod.z.enum(["many", "one", "unique", "oneActive"]);
|
|
2015
2189
|
var endpointExistenceZod = zod.z.enum(["notDeleted", "currentlyValid", "ever"]);
|
|
@@ -2059,6 +2233,12 @@ var systemColumnNameZod = zod.z.enum([
|
|
|
2059
2233
|
"updated_at",
|
|
2060
2234
|
"version"
|
|
2061
2235
|
]);
|
|
2236
|
+
var nodeSystemColumnNameZod = systemColumnNameZod.exclude([
|
|
2237
|
+
"from_kind",
|
|
2238
|
+
"from_id",
|
|
2239
|
+
"to_kind",
|
|
2240
|
+
"to_id"
|
|
2241
|
+
]);
|
|
2062
2242
|
var indexWhereOperandZod = zod.z.discriminatedUnion("__type", [
|
|
2063
2243
|
zod.z.object({
|
|
2064
2244
|
__type: zod.z.literal("index_operand_system"),
|
|
@@ -2135,7 +2315,13 @@ var indexDeclarationCommonShape = {
|
|
|
2135
2315
|
var nodeIndexDeclarationZod = zod.z.object({
|
|
2136
2316
|
entity: zod.z.literal("node"),
|
|
2137
2317
|
kind: zod.z.string(),
|
|
2138
|
-
...indexDeclarationCommonShape
|
|
2318
|
+
...indexDeclarationCommonShape,
|
|
2319
|
+
// Node-only; canonicalized by absence like `method`, so absent/optional
|
|
2320
|
+
// here matches `defineNodeIndex` only emitting it when non-empty.
|
|
2321
|
+
// `.min(1)` rejects an explicit `[]` at the boundary rather than
|
|
2322
|
+
// silently accepting a present-but-empty array that would have to be
|
|
2323
|
+
// canonicalized away again downstream (see `serializeNodeIndexDeclaration`).
|
|
2324
|
+
keySystemColumns: zod.z.array(nodeSystemColumnNameZod).min(1).optional()
|
|
2139
2325
|
}).loose();
|
|
2140
2326
|
var edgeIndexDeclarationZod = zod.z.object({
|
|
2141
2327
|
entity: zod.z.literal("edge"),
|
|
@@ -2340,7 +2526,7 @@ function parseSerializedSchema(json) {
|
|
|
2340
2526
|
try {
|
|
2341
2527
|
parsed = JSON.parse(json);
|
|
2342
2528
|
} catch {
|
|
2343
|
-
throw new
|
|
2529
|
+
throw new chunkLGEALRC6_cjs.DatabaseOperationError(
|
|
2344
2530
|
"Stored schema document is not valid JSON",
|
|
2345
2531
|
{ operation: "select", entity: "schema" }
|
|
2346
2532
|
);
|
|
@@ -2348,12 +2534,12 @@ function parseSerializedSchema(json) {
|
|
|
2348
2534
|
const result = serializedSchemaZod.safeParse(parsed);
|
|
2349
2535
|
if (!result.success) {
|
|
2350
2536
|
const issues = result.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ");
|
|
2351
|
-
throw new
|
|
2537
|
+
throw new chunkLGEALRC6_cjs.DatabaseOperationError(
|
|
2352
2538
|
`Stored schema document is malformed: ${issues}`,
|
|
2353
2539
|
{ operation: "select", entity: "schema" }
|
|
2354
2540
|
);
|
|
2355
2541
|
}
|
|
2356
|
-
const validated =
|
|
2542
|
+
const validated = chunkDI74SMXS_cjs.freezeDeep(result.data);
|
|
2357
2543
|
if (PARSE_CACHE.size >= PARSE_CACHE_LIMIT) {
|
|
2358
2544
|
const oldest = PARSE_CACHE.keys().next().value;
|
|
2359
2545
|
if (oldest !== void 0) PARSE_CACHE.delete(oldest);
|
|
@@ -2365,7 +2551,7 @@ async function loadActiveSchemaWithBootstrap(backend, graphId) {
|
|
|
2365
2551
|
try {
|
|
2366
2552
|
return await backend.getActiveSchema(graphId);
|
|
2367
2553
|
} catch (error) {
|
|
2368
|
-
if (backend.bootstrapTables &&
|
|
2554
|
+
if (backend.bootstrapTables && chunkBLZDPRXT_cjs.isMissingTableError(error)) {
|
|
2369
2555
|
await backend.bootstrapTables();
|
|
2370
2556
|
return await backend.getActiveSchema(graphId);
|
|
2371
2557
|
}
|
|
@@ -2459,7 +2645,7 @@ async function ensureSchema(backend, graph, options) {
|
|
|
2459
2645
|
}
|
|
2460
2646
|
const actions = getMigrationActions(diff);
|
|
2461
2647
|
if (throwOnBreaking) {
|
|
2462
|
-
throw new
|
|
2648
|
+
throw new chunkLGEALRC6_cjs.MigrationError(
|
|
2463
2649
|
`Schema migration required: ${diff.summary}. ${actions.length} migration action(s) needed. Use getSchemaChanges() to review, then migrateSchema() to apply.`,
|
|
2464
2650
|
{
|
|
2465
2651
|
graphId: graph.id,
|
|
@@ -2495,7 +2681,7 @@ async function loadAndVerifyGraph(backend, graph) {
|
|
|
2495
2681
|
function schemaBehindError(graphId, fromVersion, diff) {
|
|
2496
2682
|
const actions = getMigrationActions(diff);
|
|
2497
2683
|
const qualifier = isBackwardsCompatible(diff) ? "safe auto-migration" : "breaking change";
|
|
2498
|
-
return new
|
|
2684
|
+
return new chunkLGEALRC6_cjs.MigrationError(
|
|
2499
2685
|
`Schema verification failed for graph "${graphId}": ${diff.summary} (${qualifier}). ${actions.length} migration action(s) needed. The least-privilege runtime cannot migrate \u2014 run createStoreWithSchema(graph, adminBackend) under a privileged role (after any generated migration SQL, if you manage DDL externally) before attaching with createStore() / createVerifiedStore().`,
|
|
2500
2686
|
{
|
|
2501
2687
|
graphId,
|
|
@@ -2513,7 +2699,7 @@ async function readActiveSchemaPure(backend, graphId) {
|
|
|
2513
2699
|
try {
|
|
2514
2700
|
activeRow = await backend.getActiveSchema(graphId);
|
|
2515
2701
|
} catch (error) {
|
|
2516
|
-
if (
|
|
2702
|
+
if (chunkBLZDPRXT_cjs.isMissingTableError(error)) {
|
|
2517
2703
|
throw schemaNotInitializedError(graphId, error);
|
|
2518
2704
|
}
|
|
2519
2705
|
throw error;
|
|
@@ -2524,7 +2710,7 @@ async function readActiveSchemaPure(backend, graphId) {
|
|
|
2524
2710
|
return activeRow;
|
|
2525
2711
|
}
|
|
2526
2712
|
function schemaNotInitializedError(graphId, cause) {
|
|
2527
|
-
return new
|
|
2713
|
+
return new chunkLGEALRC6_cjs.ConfigurationError(
|
|
2528
2714
|
`Cannot verify graph "${graphId}": no schema has been initialized. Run createStoreWithSchema(graph, adminBackend) once under a privileged role (which commits the schema_versions row and materializes contribution markers) before attaching with createStore() / createVerifiedStore(). Generated migration SQL creates the tables but does not initialize the schema row.`,
|
|
2529
2715
|
{ graphId },
|
|
2530
2716
|
{
|
|
@@ -2534,6 +2720,7 @@ function schemaNotInitializedError(graphId, cause) {
|
|
|
2534
2720
|
);
|
|
2535
2721
|
}
|
|
2536
2722
|
async function initializeSchema(backend, graph) {
|
|
2723
|
+
buildKindRegistry(graph);
|
|
2537
2724
|
const schema = serializeSchema(graph, 1);
|
|
2538
2725
|
const hash = await computeSchemaHash(schema);
|
|
2539
2726
|
return backend.commitSchemaVersion({
|
|
@@ -2553,6 +2740,7 @@ async function migrateSchema(backend, graph, currentVersion) {
|
|
|
2553
2740
|
return committed.version;
|
|
2554
2741
|
}
|
|
2555
2742
|
async function commitNewSchemaVersion(backend, graph, currentVersion) {
|
|
2743
|
+
buildKindRegistry(graph);
|
|
2556
2744
|
const newVersion = currentVersion + 1;
|
|
2557
2745
|
const schema = serializeSchema(graph, newVersion);
|
|
2558
2746
|
const hash = await computeSchemaHash(schema);
|
|
@@ -2567,7 +2755,7 @@ async function commitNewSchemaVersion(backend, graph, currentVersion) {
|
|
|
2567
2755
|
async function rollbackSchema(backend, graphId, targetVersion) {
|
|
2568
2756
|
const activeRow = await backend.getActiveSchema(graphId);
|
|
2569
2757
|
if (activeRow === void 0) {
|
|
2570
|
-
throw new
|
|
2758
|
+
throw new chunkLGEALRC6_cjs.MigrationError(
|
|
2571
2759
|
`Cannot rollback graph "${graphId}": no active schema version exists.`,
|
|
2572
2760
|
{ graphId, fromVersion: 0, toVersion: targetVersion }
|
|
2573
2761
|
);
|
|
@@ -2595,92 +2783,18 @@ async function getSchemaChanges(backend, graph) {
|
|
|
2595
2783
|
return computeSchemaDiff(storedSchema, currentSchema);
|
|
2596
2784
|
}
|
|
2597
2785
|
|
|
2598
|
-
// src/errors/validation.ts
|
|
2599
|
-
function zodIssuesToValidationIssues(error) {
|
|
2600
|
-
return error.issues.map((issue) => ({
|
|
2601
|
-
path: issue.path.join("."),
|
|
2602
|
-
message: issue.message,
|
|
2603
|
-
code: issue.code
|
|
2604
|
-
}));
|
|
2605
|
-
}
|
|
2606
|
-
function buildLocationString(context) {
|
|
2607
|
-
if (context.id) {
|
|
2608
|
-
return `${context.kind}/${context.id}`;
|
|
2609
|
-
}
|
|
2610
|
-
return `new ${context.kind}`;
|
|
2611
|
-
}
|
|
2612
|
-
function validateProps(schema, props, context) {
|
|
2613
|
-
const result = schema.safeParse(props);
|
|
2614
|
-
if (result.success) {
|
|
2615
|
-
return result.data;
|
|
2616
|
-
}
|
|
2617
|
-
const issues = zodIssuesToValidationIssues(result.error);
|
|
2618
|
-
const location = buildLocationString(context);
|
|
2619
|
-
throw new chunkJIEJCTDS_cjs.ValidationError(
|
|
2620
|
-
`Invalid ${context.entityType} props for ${location}: ${result.error.message}`,
|
|
2621
|
-
{
|
|
2622
|
-
entityType: context.entityType,
|
|
2623
|
-
kind: context.kind,
|
|
2624
|
-
operation: context.operation,
|
|
2625
|
-
...context.id !== void 0 && { id: context.id },
|
|
2626
|
-
issues
|
|
2627
|
-
},
|
|
2628
|
-
{ cause: result.error }
|
|
2629
|
-
);
|
|
2630
|
-
}
|
|
2631
|
-
function validateNodeProps(schema, props, context) {
|
|
2632
|
-
return validateProps(schema, props, {
|
|
2633
|
-
entityType: "node",
|
|
2634
|
-
...context
|
|
2635
|
-
});
|
|
2636
|
-
}
|
|
2637
|
-
function validateEdgeProps(schema, props, context) {
|
|
2638
|
-
return validateProps(schema, props, {
|
|
2639
|
-
entityType: "edge",
|
|
2640
|
-
...context
|
|
2641
|
-
});
|
|
2642
|
-
}
|
|
2643
|
-
function wrapZodError(error, context) {
|
|
2644
|
-
const issues = zodIssuesToValidationIssues(error);
|
|
2645
|
-
const location = buildLocationString(context);
|
|
2646
|
-
return new chunkJIEJCTDS_cjs.ValidationError(
|
|
2647
|
-
`Validation failed for ${context.entityType} ${location}: ${error.message}`,
|
|
2648
|
-
{
|
|
2649
|
-
entityType: context.entityType,
|
|
2650
|
-
kind: context.kind,
|
|
2651
|
-
operation: context.operation,
|
|
2652
|
-
...context.id !== void 0 && { id: context.id },
|
|
2653
|
-
issues
|
|
2654
|
-
},
|
|
2655
|
-
{ cause: error }
|
|
2656
|
-
);
|
|
2657
|
-
}
|
|
2658
|
-
function createValidationError(message, issues, context) {
|
|
2659
|
-
return new chunkJIEJCTDS_cjs.ValidationError(message, {
|
|
2660
|
-
...context?.entityType !== void 0 && {
|
|
2661
|
-
entityType: context.entityType
|
|
2662
|
-
},
|
|
2663
|
-
...context?.kind !== void 0 && { kind: context.kind },
|
|
2664
|
-
...context?.operation !== void 0 && { operation: context.operation },
|
|
2665
|
-
...context?.id !== void 0 && { id: context.id },
|
|
2666
|
-
issues
|
|
2667
|
-
});
|
|
2668
|
-
}
|
|
2669
|
-
|
|
2670
2786
|
exports.KindRegistry = KindRegistry;
|
|
2671
2787
|
exports.META_EDGE_BRAND = META_EDGE_BRAND;
|
|
2672
2788
|
exports.applyDeprecatedKinds = applyDeprecatedKinds;
|
|
2673
2789
|
exports.assertSchemaCurrent = assertSchemaCurrent;
|
|
2674
2790
|
exports.broader = broader;
|
|
2675
2791
|
exports.buildGraphExtensionOntologyKeySet = buildGraphExtensionOntologyKeySet;
|
|
2792
|
+
exports.buildKindRegistry = buildKindRegistry;
|
|
2676
2793
|
exports.commitNewSchemaVersion = commitNewSchemaVersion;
|
|
2677
2794
|
exports.compileTimeOntologyKey = compileTimeOntologyKey;
|
|
2678
|
-
exports.computeClosuresFromOntology = computeClosuresFromOntology;
|
|
2679
2795
|
exports.computeSchemaDiff = computeSchemaDiff;
|
|
2680
2796
|
exports.computeSchemaHash = computeSchemaHash;
|
|
2681
2797
|
exports.core = core;
|
|
2682
|
-
exports.createEmptyClosures = createEmptyClosures;
|
|
2683
|
-
exports.createValidationError = createValidationError;
|
|
2684
2798
|
exports.defineEdge = defineEdge;
|
|
2685
2799
|
exports.defineNode = defineNode;
|
|
2686
2800
|
exports.deserializeWherePredicate = deserializeWherePredicate;
|
|
@@ -2711,12 +2825,10 @@ exports.partOf = partOf;
|
|
|
2711
2825
|
exports.relatedTo = relatedTo;
|
|
2712
2826
|
exports.rollbackSchema = rollbackSchema;
|
|
2713
2827
|
exports.sameAs = sameAs;
|
|
2828
|
+
exports.serializeIndexDeclaration = serializeIndexDeclaration;
|
|
2714
2829
|
exports.serializeSchema = serializeSchema;
|
|
2715
2830
|
exports.serializeSchemaProperties = serializeSchemaProperties;
|
|
2716
2831
|
exports.subClassOf = subClassOf;
|
|
2717
|
-
exports.
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
exports.wrapZodError = wrapZodError;
|
|
2721
|
-
//# sourceMappingURL=chunk-NG5N7R45.cjs.map
|
|
2722
|
-
//# sourceMappingURL=chunk-NG5N7R45.cjs.map
|
|
2832
|
+
exports.validateImpliesEndpointCompatibility = validateImpliesEndpointCompatibility;
|
|
2833
|
+
//# sourceMappingURL=chunk-CK5BVQOW.cjs.map
|
|
2834
|
+
//# sourceMappingURL=chunk-CK5BVQOW.cjs.map
|