@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
package/dist/chunk-SPT5JMME.js
DELETED
|
@@ -1,610 +0,0 @@
|
|
|
1
|
-
import { isCanonicalIsoDate, getNodeKinds, getEdgeKinds, nowIso, validateOptionalCanonicalIsoDate } from './chunk-QBYTJSAY.js';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
var FORMAT_VERSION = "1.0";
|
|
5
|
-
var ValidityTimestampSchema = z.iso.datetime().refine((value) => isCanonicalIsoDate(value), {
|
|
6
|
-
message: "Expected canonical UTC ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ); convert with new Date(value).toISOString()."
|
|
7
|
-
});
|
|
8
|
-
var InterchangeNodeSchema = z.object({
|
|
9
|
-
kind: z.string().min(1),
|
|
10
|
-
id: z.string().min(1),
|
|
11
|
-
properties: z.record(z.string(), z.unknown()),
|
|
12
|
-
validFrom: ValidityTimestampSchema.optional(),
|
|
13
|
-
validTo: ValidityTimestampSchema.optional(),
|
|
14
|
-
meta: z.object({
|
|
15
|
-
version: z.number().int().positive().optional(),
|
|
16
|
-
createdAt: z.iso.datetime().optional(),
|
|
17
|
-
updatedAt: z.iso.datetime().optional()
|
|
18
|
-
}).optional()
|
|
19
|
-
});
|
|
20
|
-
var InterchangeEdgeSchema = z.object({
|
|
21
|
-
kind: z.string().min(1),
|
|
22
|
-
id: z.string().min(1),
|
|
23
|
-
from: z.object({
|
|
24
|
-
kind: z.string().min(1),
|
|
25
|
-
id: z.string().min(1)
|
|
26
|
-
}),
|
|
27
|
-
to: z.object({
|
|
28
|
-
kind: z.string().min(1),
|
|
29
|
-
id: z.string().min(1)
|
|
30
|
-
}),
|
|
31
|
-
properties: z.record(z.string(), z.unknown()).default({}),
|
|
32
|
-
validFrom: ValidityTimestampSchema.optional(),
|
|
33
|
-
validTo: ValidityTimestampSchema.optional(),
|
|
34
|
-
meta: z.object({
|
|
35
|
-
createdAt: z.iso.datetime().optional(),
|
|
36
|
-
updatedAt: z.iso.datetime().optional()
|
|
37
|
-
}).optional()
|
|
38
|
-
});
|
|
39
|
-
var ConflictStrategySchema = z.enum(["skip", "update", "error"]);
|
|
40
|
-
var UnknownPropertyStrategySchema = z.enum([
|
|
41
|
-
"error",
|
|
42
|
-
"strip",
|
|
43
|
-
"allow"
|
|
44
|
-
]);
|
|
45
|
-
var ImportOptionsSchema = z.object({
|
|
46
|
-
/** How to handle existing nodes/edges with the same ID */
|
|
47
|
-
onConflict: ConflictStrategySchema,
|
|
48
|
-
/** How to handle properties not in the schema */
|
|
49
|
-
onUnknownProperty: UnknownPropertyStrategySchema.default("error"),
|
|
50
|
-
/** Whether to validate that edge endpoints exist */
|
|
51
|
-
validateReferences: z.boolean().default(true),
|
|
52
|
-
/** Number of items to process in each batch */
|
|
53
|
-
batchSize: z.number().int().positive().default(100)
|
|
54
|
-
});
|
|
55
|
-
var GraphDataSourceSchema = z.discriminatedUnion("type", [
|
|
56
|
-
z.object({
|
|
57
|
-
type: z.literal("typegraph-export"),
|
|
58
|
-
graphId: z.string(),
|
|
59
|
-
schemaVersion: z.number().int().positive()
|
|
60
|
-
}),
|
|
61
|
-
z.object({
|
|
62
|
-
type: z.literal("external"),
|
|
63
|
-
description: z.string().optional()
|
|
64
|
-
})
|
|
65
|
-
]);
|
|
66
|
-
var GraphDataSchema = z.object({
|
|
67
|
-
formatVersion: z.literal(FORMAT_VERSION),
|
|
68
|
-
exportedAt: z.iso.datetime(),
|
|
69
|
-
source: GraphDataSourceSchema,
|
|
70
|
-
nodes: z.array(InterchangeNodeSchema),
|
|
71
|
-
edges: z.array(InterchangeEdgeSchema)
|
|
72
|
-
});
|
|
73
|
-
var ImportErrorSchema = z.object({
|
|
74
|
-
entityType: z.enum(["node", "edge"]),
|
|
75
|
-
kind: z.string(),
|
|
76
|
-
id: z.string(),
|
|
77
|
-
error: z.string()
|
|
78
|
-
});
|
|
79
|
-
var ImportResultSchema = z.object({
|
|
80
|
-
success: z.boolean(),
|
|
81
|
-
nodes: z.object({
|
|
82
|
-
created: z.number().int().nonnegative(),
|
|
83
|
-
updated: z.number().int().nonnegative(),
|
|
84
|
-
skipped: z.number().int().nonnegative()
|
|
85
|
-
}),
|
|
86
|
-
edges: z.object({
|
|
87
|
-
created: z.number().int().nonnegative(),
|
|
88
|
-
updated: z.number().int().nonnegative(),
|
|
89
|
-
skipped: z.number().int().nonnegative()
|
|
90
|
-
}),
|
|
91
|
-
errors: z.array(ImportErrorSchema)
|
|
92
|
-
});
|
|
93
|
-
var ExportOptionsSchema = z.object({
|
|
94
|
-
/** Filter to specific node kinds (undefined = all) */
|
|
95
|
-
nodeKinds: z.array(z.string()).optional(),
|
|
96
|
-
/** Filter to specific edge kinds (undefined = all) */
|
|
97
|
-
edgeKinds: z.array(z.string()).optional(),
|
|
98
|
-
/** Include temporal fields (validFrom, validTo) */
|
|
99
|
-
includeTemporal: z.boolean().default(false),
|
|
100
|
-
/** Include metadata (version, timestamps) */
|
|
101
|
-
includeMeta: z.boolean().default(false),
|
|
102
|
-
/** Include soft-deleted records */
|
|
103
|
-
includeDeleted: z.boolean().default(false)
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// src/interchange/export.ts
|
|
107
|
-
async function exportGraph(store, options) {
|
|
108
|
-
const options_ = {
|
|
109
|
-
nodeKinds: options?.nodeKinds,
|
|
110
|
-
edgeKinds: options?.edgeKinds,
|
|
111
|
-
includeTemporal: options?.includeTemporal ?? false,
|
|
112
|
-
includeMeta: options?.includeMeta ?? false,
|
|
113
|
-
includeDeleted: options?.includeDeleted ?? false
|
|
114
|
-
};
|
|
115
|
-
const graph = store.graph;
|
|
116
|
-
const graphId = store.graphId;
|
|
117
|
-
const backend = store.backend;
|
|
118
|
-
const nodeKindsToExport = options_.nodeKinds ?? getNodeKinds(graph);
|
|
119
|
-
const edgeKindsToExport = options_.edgeKinds ?? getEdgeKinds(graph);
|
|
120
|
-
const nodes = [];
|
|
121
|
-
for (const kind of nodeKindsToExport) {
|
|
122
|
-
const kindNodes = await exportNodesOfKind(backend, graphId, kind, options_);
|
|
123
|
-
nodes.push(...kindNodes);
|
|
124
|
-
}
|
|
125
|
-
const edges = [];
|
|
126
|
-
for (const kind of edgeKindsToExport) {
|
|
127
|
-
const kindEdges = await exportEdgesOfKind(backend, graphId, kind, options_);
|
|
128
|
-
edges.push(...kindEdges);
|
|
129
|
-
}
|
|
130
|
-
const schemaVersion = await backend.getActiveSchema(graphId);
|
|
131
|
-
return {
|
|
132
|
-
formatVersion: FORMAT_VERSION,
|
|
133
|
-
exportedAt: nowIso(),
|
|
134
|
-
source: {
|
|
135
|
-
type: "typegraph-export",
|
|
136
|
-
graphId,
|
|
137
|
-
schemaVersion: schemaVersion?.version ?? 1
|
|
138
|
-
},
|
|
139
|
-
nodes,
|
|
140
|
-
edges
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
async function exportNodesOfKind(backend, graphId, kind, options) {
|
|
144
|
-
const rows = await backend.findNodesByKind({
|
|
145
|
-
graphId,
|
|
146
|
-
kind,
|
|
147
|
-
excludeDeleted: !options.includeDeleted
|
|
148
|
-
});
|
|
149
|
-
return rows.map((row) => {
|
|
150
|
-
const node = {
|
|
151
|
-
kind: row.kind,
|
|
152
|
-
id: row.id,
|
|
153
|
-
properties: JSON.parse(row.props)
|
|
154
|
-
};
|
|
155
|
-
if (options.includeTemporal) {
|
|
156
|
-
if (row.valid_from) {
|
|
157
|
-
node.validFrom = row.valid_from;
|
|
158
|
-
}
|
|
159
|
-
if (row.valid_to) {
|
|
160
|
-
node.validTo = row.valid_to;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
if (options.includeMeta) {
|
|
164
|
-
node.meta = {
|
|
165
|
-
version: row.version,
|
|
166
|
-
createdAt: row.created_at,
|
|
167
|
-
updatedAt: row.updated_at
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
return node;
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
async function exportEdgesOfKind(backend, graphId, kind, options) {
|
|
174
|
-
const rows = await backend.findEdgesByKind({
|
|
175
|
-
graphId,
|
|
176
|
-
kind,
|
|
177
|
-
excludeDeleted: !options.includeDeleted
|
|
178
|
-
});
|
|
179
|
-
return rows.map((row) => {
|
|
180
|
-
const edge = {
|
|
181
|
-
kind: row.kind,
|
|
182
|
-
id: row.id,
|
|
183
|
-
from: {
|
|
184
|
-
kind: row.from_kind,
|
|
185
|
-
id: row.from_id
|
|
186
|
-
},
|
|
187
|
-
to: {
|
|
188
|
-
kind: row.to_kind,
|
|
189
|
-
id: row.to_id
|
|
190
|
-
},
|
|
191
|
-
properties: JSON.parse(row.props)
|
|
192
|
-
};
|
|
193
|
-
if (options.includeTemporal) {
|
|
194
|
-
if (row.valid_from) {
|
|
195
|
-
edge.validFrom = row.valid_from;
|
|
196
|
-
}
|
|
197
|
-
if (row.valid_to) {
|
|
198
|
-
edge.validTo = row.valid_to;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
if (options.includeMeta) {
|
|
202
|
-
edge.meta = {
|
|
203
|
-
createdAt: row.created_at,
|
|
204
|
-
updatedAt: row.updated_at
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
return edge;
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// src/interchange/import.ts
|
|
212
|
-
async function importGraph(store, data, options) {
|
|
213
|
-
const result = {
|
|
214
|
-
success: true,
|
|
215
|
-
nodes: { created: 0, updated: 0, skipped: 0 },
|
|
216
|
-
edges: { created: 0, updated: 0, skipped: 0 },
|
|
217
|
-
errors: []
|
|
218
|
-
};
|
|
219
|
-
const errors = [];
|
|
220
|
-
const graph = store.graph;
|
|
221
|
-
const graphId = store.graphId;
|
|
222
|
-
const backend = store.backend;
|
|
223
|
-
const nodeSchemas = buildNodeSchemaMap(graph);
|
|
224
|
-
const edgeSchemas = buildEdgeSchemaMap(graph);
|
|
225
|
-
const importedNodeIds = /* @__PURE__ */ new Set();
|
|
226
|
-
if (backend.capabilities.transactions) {
|
|
227
|
-
await backend.transaction(async (tx) => {
|
|
228
|
-
await processNodes(
|
|
229
|
-
tx,
|
|
230
|
-
graphId,
|
|
231
|
-
data.nodes,
|
|
232
|
-
nodeSchemas,
|
|
233
|
-
options,
|
|
234
|
-
result,
|
|
235
|
-
errors,
|
|
236
|
-
importedNodeIds
|
|
237
|
-
);
|
|
238
|
-
await processEdges(
|
|
239
|
-
tx,
|
|
240
|
-
graphId,
|
|
241
|
-
data.edges,
|
|
242
|
-
edgeSchemas,
|
|
243
|
-
nodeSchemas,
|
|
244
|
-
options,
|
|
245
|
-
result,
|
|
246
|
-
errors,
|
|
247
|
-
importedNodeIds
|
|
248
|
-
);
|
|
249
|
-
});
|
|
250
|
-
} else {
|
|
251
|
-
await processNodes(
|
|
252
|
-
backend,
|
|
253
|
-
graphId,
|
|
254
|
-
data.nodes,
|
|
255
|
-
nodeSchemas,
|
|
256
|
-
options,
|
|
257
|
-
result,
|
|
258
|
-
errors,
|
|
259
|
-
importedNodeIds
|
|
260
|
-
);
|
|
261
|
-
await processEdges(
|
|
262
|
-
backend,
|
|
263
|
-
graphId,
|
|
264
|
-
data.edges,
|
|
265
|
-
edgeSchemas,
|
|
266
|
-
nodeSchemas,
|
|
267
|
-
options,
|
|
268
|
-
result,
|
|
269
|
-
errors,
|
|
270
|
-
importedNodeIds
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
return {
|
|
274
|
-
...result,
|
|
275
|
-
success: errors.length === 0,
|
|
276
|
-
errors
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
function buildNodeSchemaMap(graph) {
|
|
280
|
-
const map = /* @__PURE__ */ new Map();
|
|
281
|
-
for (const kindName of getNodeKinds(graph)) {
|
|
282
|
-
const registration = graph.nodes[kindName];
|
|
283
|
-
map.set(kindName, {
|
|
284
|
-
registration,
|
|
285
|
-
schema: registration.type.schema
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
return map;
|
|
289
|
-
}
|
|
290
|
-
function buildEdgeSchemaMap(graph) {
|
|
291
|
-
const map = /* @__PURE__ */ new Map();
|
|
292
|
-
for (const kindName of getEdgeKinds(graph)) {
|
|
293
|
-
const registration = graph.edges[kindName];
|
|
294
|
-
map.set(kindName, {
|
|
295
|
-
registration,
|
|
296
|
-
schema: registration.type.schema,
|
|
297
|
-
fromKinds: new Set(registration.from.map((node) => node.kind)),
|
|
298
|
-
toKinds: new Set(registration.to.map((node) => node.kind))
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
return map;
|
|
302
|
-
}
|
|
303
|
-
async function processNodes(backend, graphId, nodes, schemas, options, result, errors, importedNodeIds) {
|
|
304
|
-
const batchSize = options.batchSize;
|
|
305
|
-
for (let index = 0; index < nodes.length; index += batchSize) {
|
|
306
|
-
const batch = nodes.slice(index, index + batchSize);
|
|
307
|
-
for (const node of batch) {
|
|
308
|
-
const importResult = await processNode(
|
|
309
|
-
backend,
|
|
310
|
-
graphId,
|
|
311
|
-
node,
|
|
312
|
-
schemas,
|
|
313
|
-
options
|
|
314
|
-
);
|
|
315
|
-
switch (importResult.status) {
|
|
316
|
-
case "created": {
|
|
317
|
-
result.nodes.created++;
|
|
318
|
-
importedNodeIds.add(makeNodeKey(node.kind, node.id));
|
|
319
|
-
break;
|
|
320
|
-
}
|
|
321
|
-
case "updated": {
|
|
322
|
-
result.nodes.updated++;
|
|
323
|
-
importedNodeIds.add(makeNodeKey(node.kind, node.id));
|
|
324
|
-
break;
|
|
325
|
-
}
|
|
326
|
-
case "skipped": {
|
|
327
|
-
result.nodes.skipped++;
|
|
328
|
-
importedNodeIds.add(makeNodeKey(node.kind, node.id));
|
|
329
|
-
break;
|
|
330
|
-
}
|
|
331
|
-
case "error": {
|
|
332
|
-
errors.push({
|
|
333
|
-
entityType: "node",
|
|
334
|
-
kind: node.kind,
|
|
335
|
-
id: node.id,
|
|
336
|
-
error: importResult.error
|
|
337
|
-
});
|
|
338
|
-
break;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
function validateValidityWindow(entity) {
|
|
345
|
-
try {
|
|
346
|
-
validateOptionalCanonicalIsoDate(entity.validFrom, "validFrom");
|
|
347
|
-
validateOptionalCanonicalIsoDate(entity.validTo, "validTo");
|
|
348
|
-
return void 0;
|
|
349
|
-
} catch (error) {
|
|
350
|
-
return error instanceof Error ? error.message : String(error);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
async function processNode(backend, graphId, node, schemas, options) {
|
|
354
|
-
const schemaEntry = schemas.get(node.kind);
|
|
355
|
-
if (!schemaEntry) {
|
|
356
|
-
return { status: "error", error: `Unknown node kind: ${node.kind}` };
|
|
357
|
-
}
|
|
358
|
-
const propsResult = validateProperties(
|
|
359
|
-
node.properties,
|
|
360
|
-
schemaEntry.schema,
|
|
361
|
-
options.onUnknownProperty
|
|
362
|
-
);
|
|
363
|
-
if (!propsResult.success) {
|
|
364
|
-
return { status: "error", error: propsResult.error };
|
|
365
|
-
}
|
|
366
|
-
const validityError = validateValidityWindow(node);
|
|
367
|
-
if (validityError !== void 0) {
|
|
368
|
-
return { status: "error", error: validityError };
|
|
369
|
-
}
|
|
370
|
-
const existing = await backend.getNode(graphId, node.kind, node.id);
|
|
371
|
-
if (existing) {
|
|
372
|
-
switch (options.onConflict) {
|
|
373
|
-
case "skip": {
|
|
374
|
-
return { status: "skipped" };
|
|
375
|
-
}
|
|
376
|
-
case "error": {
|
|
377
|
-
return {
|
|
378
|
-
status: "error",
|
|
379
|
-
error: `Node already exists: ${node.kind}:${node.id}`
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
case "update": {
|
|
383
|
-
await backend.updateNode({
|
|
384
|
-
graphId,
|
|
385
|
-
kind: node.kind,
|
|
386
|
-
id: node.id,
|
|
387
|
-
props: propsResult.data,
|
|
388
|
-
incrementVersion: true,
|
|
389
|
-
...node.validTo !== void 0 && { validTo: node.validTo }
|
|
390
|
-
});
|
|
391
|
-
return { status: "updated" };
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
await backend.insertNode({
|
|
396
|
-
graphId,
|
|
397
|
-
kind: node.kind,
|
|
398
|
-
id: node.id,
|
|
399
|
-
props: propsResult.data,
|
|
400
|
-
...node.validFrom !== void 0 && { validFrom: node.validFrom },
|
|
401
|
-
...node.validTo !== void 0 && { validTo: node.validTo }
|
|
402
|
-
});
|
|
403
|
-
return { status: "created" };
|
|
404
|
-
}
|
|
405
|
-
async function processEdges(backend, graphId, edges, edgeSchemas, nodeSchemas, options, result, errors, importedNodeIds) {
|
|
406
|
-
const batchSize = options.batchSize;
|
|
407
|
-
for (let index = 0; index < edges.length; index += batchSize) {
|
|
408
|
-
const batch = edges.slice(index, index + batchSize);
|
|
409
|
-
for (const edge of batch) {
|
|
410
|
-
const importResult = await processEdge(
|
|
411
|
-
backend,
|
|
412
|
-
graphId,
|
|
413
|
-
edge,
|
|
414
|
-
edgeSchemas,
|
|
415
|
-
nodeSchemas,
|
|
416
|
-
options,
|
|
417
|
-
importedNodeIds
|
|
418
|
-
);
|
|
419
|
-
switch (importResult.status) {
|
|
420
|
-
case "created": {
|
|
421
|
-
result.edges.created++;
|
|
422
|
-
break;
|
|
423
|
-
}
|
|
424
|
-
case "updated": {
|
|
425
|
-
result.edges.updated++;
|
|
426
|
-
break;
|
|
427
|
-
}
|
|
428
|
-
case "skipped": {
|
|
429
|
-
result.edges.skipped++;
|
|
430
|
-
break;
|
|
431
|
-
}
|
|
432
|
-
case "error": {
|
|
433
|
-
errors.push({
|
|
434
|
-
entityType: "edge",
|
|
435
|
-
kind: edge.kind,
|
|
436
|
-
id: edge.id,
|
|
437
|
-
error: importResult.error
|
|
438
|
-
});
|
|
439
|
-
break;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
async function processEdge(backend, graphId, edge, edgeSchemas, nodeSchemas, options, importedNodeIds) {
|
|
446
|
-
const schemaEntry = edgeSchemas.get(edge.kind);
|
|
447
|
-
if (!schemaEntry) {
|
|
448
|
-
return { status: "error", error: `Unknown edge kind: ${edge.kind}` };
|
|
449
|
-
}
|
|
450
|
-
if (!nodeSchemas.has(edge.from.kind)) {
|
|
451
|
-
return {
|
|
452
|
-
status: "error",
|
|
453
|
-
error: `Unknown from node kind: ${edge.from.kind}`
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
if (!nodeSchemas.has(edge.to.kind)) {
|
|
457
|
-
return { status: "error", error: `Unknown to node kind: ${edge.to.kind}` };
|
|
458
|
-
}
|
|
459
|
-
if (!schemaEntry.fromKinds.has(edge.from.kind)) {
|
|
460
|
-
return {
|
|
461
|
-
status: "error",
|
|
462
|
-
error: `Edge ${edge.kind} does not allow from kind: ${edge.from.kind}`
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
if (!schemaEntry.toKinds.has(edge.to.kind)) {
|
|
466
|
-
return {
|
|
467
|
-
status: "error",
|
|
468
|
-
error: `Edge ${edge.kind} does not allow to kind: ${edge.to.kind}`
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
if (options.validateReferences) {
|
|
472
|
-
const fromKey = makeNodeKey(edge.from.kind, edge.from.id);
|
|
473
|
-
const toKey = makeNodeKey(edge.to.kind, edge.to.id);
|
|
474
|
-
if (!importedNodeIds.has(fromKey)) {
|
|
475
|
-
const fromExists = await backend.getNode(
|
|
476
|
-
graphId,
|
|
477
|
-
edge.from.kind,
|
|
478
|
-
edge.from.id
|
|
479
|
-
);
|
|
480
|
-
if (!fromExists) {
|
|
481
|
-
return {
|
|
482
|
-
status: "error",
|
|
483
|
-
error: `From node not found: ${edge.from.kind}:${edge.from.id}`
|
|
484
|
-
};
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
if (!importedNodeIds.has(toKey)) {
|
|
488
|
-
const toExists = await backend.getNode(graphId, edge.to.kind, edge.to.id);
|
|
489
|
-
if (!toExists) {
|
|
490
|
-
return {
|
|
491
|
-
status: "error",
|
|
492
|
-
error: `To node not found: ${edge.to.kind}:${edge.to.id}`
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
const propsResult = validateProperties(
|
|
498
|
-
edge.properties,
|
|
499
|
-
schemaEntry.schema,
|
|
500
|
-
options.onUnknownProperty
|
|
501
|
-
);
|
|
502
|
-
if (!propsResult.success) {
|
|
503
|
-
return { status: "error", error: propsResult.error };
|
|
504
|
-
}
|
|
505
|
-
const validityError = validateValidityWindow(edge);
|
|
506
|
-
if (validityError !== void 0) {
|
|
507
|
-
return { status: "error", error: validityError };
|
|
508
|
-
}
|
|
509
|
-
const existing = await backend.getEdge(graphId, edge.id);
|
|
510
|
-
if (existing) {
|
|
511
|
-
switch (options.onConflict) {
|
|
512
|
-
case "skip": {
|
|
513
|
-
return { status: "skipped" };
|
|
514
|
-
}
|
|
515
|
-
case "error": {
|
|
516
|
-
return { status: "error", error: `Edge already exists: ${edge.id}` };
|
|
517
|
-
}
|
|
518
|
-
case "update": {
|
|
519
|
-
await backend.updateEdge({
|
|
520
|
-
graphId,
|
|
521
|
-
id: edge.id,
|
|
522
|
-
props: propsResult.data,
|
|
523
|
-
...edge.validTo !== void 0 && { validTo: edge.validTo }
|
|
524
|
-
});
|
|
525
|
-
return { status: "updated" };
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
await backend.insertEdge({
|
|
530
|
-
graphId,
|
|
531
|
-
id: edge.id,
|
|
532
|
-
kind: edge.kind,
|
|
533
|
-
fromKind: edge.from.kind,
|
|
534
|
-
fromId: edge.from.id,
|
|
535
|
-
toKind: edge.to.kind,
|
|
536
|
-
toId: edge.to.id,
|
|
537
|
-
props: propsResult.data,
|
|
538
|
-
...edge.validFrom !== void 0 && { validFrom: edge.validFrom },
|
|
539
|
-
...edge.validTo !== void 0 && { validTo: edge.validTo }
|
|
540
|
-
});
|
|
541
|
-
return { status: "created" };
|
|
542
|
-
}
|
|
543
|
-
function validateProperties(properties, schema, unknownStrategy) {
|
|
544
|
-
try {
|
|
545
|
-
const knownKeys = new Set(Object.keys(schema.shape));
|
|
546
|
-
const unknownKeys = Object.keys(properties).filter(
|
|
547
|
-
(key) => !knownKeys.has(key)
|
|
548
|
-
);
|
|
549
|
-
if (unknownKeys.length > 0) {
|
|
550
|
-
switch (unknownStrategy) {
|
|
551
|
-
case "error": {
|
|
552
|
-
return {
|
|
553
|
-
success: false,
|
|
554
|
-
error: `Unknown properties: ${unknownKeys.join(", ")}`
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
case "strip": {
|
|
558
|
-
const stripped = {};
|
|
559
|
-
for (const key of knownKeys) {
|
|
560
|
-
if (key in properties) {
|
|
561
|
-
stripped[key] = properties[key];
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
const result2 = schema.safeParse(stripped);
|
|
565
|
-
if (!result2.success) {
|
|
566
|
-
return {
|
|
567
|
-
success: false,
|
|
568
|
-
error: formatZodError(result2.error)
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
|
-
return {
|
|
572
|
-
success: true,
|
|
573
|
-
data: result2.data
|
|
574
|
-
};
|
|
575
|
-
}
|
|
576
|
-
case "allow": {
|
|
577
|
-
const result2 = schema.safeParse(properties);
|
|
578
|
-
if (!result2.success) {
|
|
579
|
-
return {
|
|
580
|
-
success: false,
|
|
581
|
-
error: formatZodError(result2.error)
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
return { success: true, data: properties };
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
const result = schema.safeParse(properties);
|
|
589
|
-
if (!result.success) {
|
|
590
|
-
return { success: false, error: formatZodError(result.error) };
|
|
591
|
-
}
|
|
592
|
-
return { success: true, data: result.data };
|
|
593
|
-
} catch (error) {
|
|
594
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
595
|
-
return { success: false, error: `Validation error: ${message}` };
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
function formatZodError(error) {
|
|
599
|
-
return error.issues.map((issue) => {
|
|
600
|
-
const path = issue.path.join(".");
|
|
601
|
-
return path ? `${path}: ${issue.message}` : issue.message;
|
|
602
|
-
}).join("; ");
|
|
603
|
-
}
|
|
604
|
-
function makeNodeKey(kind, id) {
|
|
605
|
-
return `${kind}:${id}`;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
export { ConflictStrategySchema, ExportOptionsSchema, FORMAT_VERSION, GraphDataSchema, GraphDataSourceSchema, ImportErrorSchema, ImportOptionsSchema, ImportResultSchema, InterchangeEdgeSchema, InterchangeNodeSchema, UnknownPropertyStrategySchema, exportGraph, importGraph };
|
|
609
|
-
//# sourceMappingURL=chunk-SPT5JMME.js.map
|
|
610
|
-
//# sourceMappingURL=chunk-SPT5JMME.js.map
|