@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/system-fields.ts","../src/indexes/define-index.ts"],"names":["createSchemaIntrospector","getNodeScopeColumns","jsonPointer","normalizeJsonPointer","parseJsonPointer","resolveFieldTypeInfoAtJsonPoint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C","file":"chunk-UUT7UN2N.cjs","sourcesContent":["export const NODE_META_KEYS = [\n \"version\",\n \"validFrom\",\n \"validTo\",\n \"createdAt\",\n \"updatedAt\",\n \"deletedAt\",\n] as const;\n\nexport const EDGE_META_KEYS = [\n \"validFrom\",\n \"validTo\",\n \"createdAt\",\n \"updatedAt\",\n \"deletedAt\",\n] as const;\n","import { type z } from \"zod\";\n\nimport {\n IDENTIFIER_COMPONENT_MAX_LENGTH,\n MAX_PG_IDENTIFIER_LENGTH,\n TRUNCATED_IDENTIFIER_MAX_LENGTH,\n} from \"../constants\";\nimport {\n type AnyEdgeType,\n type KindEntity,\n type NodeType,\n} from \"../core/types\";\nimport { type ValueType } from \"../query/ast\";\nimport { resolveFieldTypeInfoAtJsonPointer } from \"../query/field-type-info\";\nimport {\n type JsonPointer,\n jsonPointer,\n type JsonPointerInput,\n type JsonPointerSegment,\n normalizeJsonPointer,\n parseJsonPointer,\n} from \"../query/json-pointer\";\nimport {\n createSchemaIntrospector,\n type FieldTypeInfo,\n} from \"../query/schema-introspector\";\nimport { EDGE_META_KEYS, NODE_META_KEYS } from \"../system-fields\";\nimport { fnv1aBase36 } from \"../utils/hash\";\nimport { getNodeScopeColumns } from \"./compiler\";\nimport {\n type EdgeIndexConfig,\n type EdgeIndexDeclaration,\n type EdgeIndexDirection,\n type EdgeIndexWhereBuilder,\n type IndexFieldInput,\n type IndexScope,\n type IndexWhereExpression,\n type IndexWhereFieldBuilder,\n type IndexWhereLiteral,\n type IndexWhereOp,\n type IndexWhereOperand,\n type NodeIndexConfig,\n type NodeIndexDeclaration,\n type NodeIndexWhereBuilder,\n type RelationalIndexMethod,\n type SystemColumnName,\n} from \"./types\";\n\n// `keySystemColumns` on a node index must fail closed: reject anything that\n// isn't a known node-valid column, not just the known edge-only ones. A\n// caller whose array escapes TypeScript's literal-union checking (`any`-typed\n// data, a value round-tripped through JSON) could otherwise pass a typo'd or\n// otherwise-invalid column that silently reaches SQL DDL generation instead\n// of failing here with a clear error. Derived from the single source of\n// truth (`createSystemColumnMapForNode`, hoisted — see below) rather than a\n// second hand-maintained list, so it can't drift from it.\nconst NODE_KEY_SYSTEM_COLUMNS: ReadonlySet<SystemColumnName> = new Set(\n [...createSystemColumnMapForNode().values()].map((entry) => entry.column),\n);\n\n// ============================================================\n// Public API\n// ============================================================\n\nexport function defineNodeIndex<N extends NodeType>(\n node: N,\n config: NodeIndexConfig<N>,\n): NodeIndexDeclaration {\n const scope = config.scope ?? \"graphAndKind\";\n const unique = config.unique ?? false;\n const keySystemColumns = normalizeKeySystemColumnsOrThrow(\n config.keySystemColumns ?? [],\n scope,\n unique,\n );\n\n const schemaIntrospector = createSchemaIntrospector(\n new Map([[node.kind, { schema: node.schema }]]),\n );\n\n const { pointers: fields, valueTypes: fieldValueTypes } =\n normalizeNodeIndexFieldsOrThrow(\n node,\n config.fields ?? [],\n schemaIntrospector,\n \"fields\",\n // GIN containment indexes exist precisely for array/object fields,\n // which the btree guard otherwise rejects.\n { allowJsonFields: config.method === \"gin\" },\n );\n\n const { pointers: coveringFields, valueTypes: coveringFieldValueTypes } =\n normalizeNodeIndexFieldsOrThrow(\n node,\n config.coveringFields ?? [],\n schemaIntrospector,\n \"coveringFields\",\n {},\n );\n assertNoOverlap(fields, coveringFields, \"fields\", \"coveringFields\");\n\n if (\n fields.length === 0 &&\n coveringFields.length === 0 &&\n keySystemColumns.length === 0\n ) {\n throw new Error(\n \"Index must declare at least one of fields, coveringFields, or keySystemColumns\",\n );\n }\n\n const where = normalizeWhereInput(config.where, () =>\n createNodeWhereBuilder(node, schemaIntrospector),\n );\n\n const method = resolveAdvancedIndexMethod(config.method, {\n fieldCount: fields.length,\n fieldValueType: fieldValueTypes[0],\n coveringFieldCount: coveringFields.length,\n keySystemColumnCount: keySystemColumns.length,\n unique,\n hasWhere: where !== undefined,\n });\n\n const defaultName = generateDefaultIndexName({\n kind: \"node\",\n kindName: node.kind,\n unique,\n scope,\n direction: \"none\",\n fields,\n coveringFields,\n keySystemColumns,\n });\n const name =\n config.name ??\n (method === undefined ? defaultName : `${defaultName}_${method}`);\n\n // `origin` is intentionally omitted: `\"compile-time\"` is the default\n // and is canonicalized by absence so the serialized form stays\n // byte-identical for legacy graphs. `method` and `keySystemColumns`\n // follow the same rule (absence == \"btree\" / no system key columns).\n return {\n entity: \"node\",\n kind: node.kind,\n name,\n fields,\n fieldValueTypes,\n coveringFields,\n coveringFieldValueTypes,\n unique,\n scope,\n where,\n ...(method === undefined ? {} : { method }),\n ...(keySystemColumns.length === 0 ? {} : { keySystemColumns }),\n };\n}\n\n/**\n * Validates `keySystemColumns`: must be node system columns (not\n * edge-only `from_kind`/`from_id`/`to_kind`/`to_id`), must not repeat\n * each other, must not repeat a column `scope` already prefixes the key\n * with, and must not combine `\"id\"` with `unique` (every node's `id` is\n * already unique per row, so that combination can never enforce a\n * meaningful constraint across the index's other key columns).\n */\nfunction normalizeKeySystemColumnsOrThrow(\n columns: readonly SystemColumnName[],\n scope: IndexScope,\n unique: boolean,\n): readonly SystemColumnName[] {\n if (columns.length === 0) return [];\n\n for (const column of columns) {\n if (!NODE_KEY_SYSTEM_COLUMNS.has(column)) {\n throw new Error(\n `Node index keySystemColumns does not support \"${column}\" (edge-only system column)`,\n );\n }\n }\n assertUnique(columns, \"keySystemColumns\");\n\n const scopeColumns = new Set(getNodeScopeColumns(scope));\n for (const column of columns) {\n if (scopeColumns.has(column)) {\n throw new Error(\n `Node index keySystemColumns must not repeat a column already implied by scope \"${scope}\": \"${column}\"`,\n );\n }\n }\n\n if (unique && columns.includes(\"id\")) {\n throw new Error(\n `unique node indexes cannot include keySystemColumns: [\"id\"]; id is already unique per node, so including it defeats uniqueness across the prop fields`,\n );\n }\n\n // Return a fresh array: the declaration must own an immutable snapshot, not\n // a reference to the caller's array. Otherwise a post-call mutation of the\n // original `config.keySystemColumns` bypasses these checks and desyncs the\n // already-computed name/hash from the compiled index keys.\n return [...columns];\n}\n\nexport function defineEdgeIndex<E extends AnyEdgeType>(\n edge: E,\n config: EdgeIndexConfig<E>,\n): EdgeIndexDeclaration {\n const scope = config.scope ?? \"graphAndKind\";\n const unique = config.unique ?? false;\n const direction = config.direction ?? \"none\";\n\n const schemaIntrospector = createSchemaIntrospector(\n new Map(),\n new Map([[edge.kind, { schema: edge.schema }]]),\n );\n\n const { pointers: fields, valueTypes: fieldValueTypes } =\n normalizeEdgeIndexFieldsOrThrow(\n edge,\n config.fields,\n schemaIntrospector,\n \"fields\",\n { allowEmpty: false, allowJsonFields: config.method === \"gin\" },\n );\n\n const { pointers: coveringFields, valueTypes: coveringFieldValueTypes } =\n normalizeEdgeIndexFieldsOrThrow(\n edge,\n config.coveringFields ?? [],\n schemaIntrospector,\n \"coveringFields\",\n { allowEmpty: true },\n );\n assertNoOverlap(fields, coveringFields, \"fields\", \"coveringFields\");\n\n const where = normalizeWhereInput(config.where, () =>\n createEdgeWhereBuilder(edge, schemaIntrospector),\n );\n\n const method = resolveAdvancedIndexMethod(config.method, {\n fieldCount: fields.length,\n fieldValueType: fieldValueTypes[0],\n coveringFieldCount: coveringFields.length,\n keySystemColumnCount: 0,\n unique,\n hasWhere: where !== undefined,\n });\n\n const defaultName = generateDefaultIndexName({\n kind: \"edge\",\n kindName: edge.kind,\n unique,\n scope,\n direction,\n fields,\n coveringFields,\n });\n const name =\n config.name ??\n (method === undefined ? defaultName : `${defaultName}_${method}`);\n\n return {\n entity: \"edge\",\n kind: edge.kind,\n name,\n fields,\n fieldValueTypes,\n coveringFields,\n coveringFieldValueTypes,\n unique,\n scope,\n direction,\n where,\n ...(method === undefined ? {} : { method }),\n };\n}\n\n/**\n * Validates and canonicalizes a declaration's index method. `\"btree\"` (or\n * absent) canonicalizes to `undefined` so serialized declarations and\n * materialization signatures from before `method` existed stay\n * byte-identical. GIN-family methods index one expression and have no\n * ordered key columns, so multi-field, covering, unique, and partial\n * variants are rejected at declaration time rather than failing as\n * confusing DDL errors at materialization time.\n */\nfunction resolveAdvancedIndexMethod(\n method: RelationalIndexMethod | undefined,\n details: Readonly<{\n fieldCount: number;\n fieldValueType: ValueType | undefined;\n coveringFieldCount: number;\n keySystemColumnCount: number;\n unique: boolean;\n hasWhere: boolean;\n }>,\n): Exclude<RelationalIndexMethod, \"btree\"> | undefined {\n const resolved = method ?? \"btree\";\n if (resolved === \"btree\") return undefined;\n if (details.fieldCount !== 1) {\n throw new Error(\n `Index method \"${resolved}\" requires exactly one field (a GIN indexes one expression), got ${details.fieldCount}`,\n );\n }\n // Enforce the field-type contract the methods advertise: gin serves the\n // array containment predicates, trigram serves the string substring /\n // case-insensitive predicates. Anything else (including unresolvable\n // field types) would materialize an index no documented predicate can\n // ever use, so it is rejected here rather than silently costing write\n // amplification for nothing.\n if (resolved === \"gin\" && details.fieldValueType !== \"array\") {\n throw new Error(\n details.fieldValueType === \"string\" ?\n 'Index method \"gin\" serves array containment; for substring or case-insensitive matching on a string field use method: \"trigram\"'\n : `Index method \"gin\" requires an array field (it serves the array containment predicates), got field type \"${details.fieldValueType ?? \"unresolved\"}\"`,\n );\n }\n if (resolved === \"trigram\" && details.fieldValueType !== \"string\") {\n throw new Error(\n details.fieldValueType === \"array\" ?\n 'Index method \"trigram\" serves substring matching on string fields; for array containment use method: \"gin\"'\n : `Index method \"trigram\" requires a string field (it serves substring and case-insensitive matches), got field type \"${details.fieldValueType ?? \"unresolved\"}\"`,\n );\n }\n const extraKeyColumns: readonly [string, number][] = [\n [\"coveringFields\", details.coveringFieldCount],\n [\"keySystemColumns\", details.keySystemColumnCount],\n ];\n for (const [label, count] of extraKeyColumns) {\n if (count > 0) {\n throw new Error(\n `Index method \"${resolved}\" does not support ${label} (GIN indexes cannot serve index-only scans over extra columns)`,\n );\n }\n }\n if (details.unique) {\n throw new Error(\n `Index method \"${resolved}\" does not support unique (GIN indexes cannot enforce uniqueness)`,\n );\n }\n if (details.hasWhere) {\n throw new Error(\n `Index method \"${resolved}\" does not support a partial where clause`,\n );\n }\n return resolved;\n}\n\n// ============================================================\n// WHERE Builder\n// ============================================================\n\n/**\n * The WHERE builder currently only supports top-level fields.\n * Nested field access (e.g., `where.metadata.priority.gt(5)`) is not supported.\n * Use top-level field predicates like `where.status.eq(\"active\")`.\n *\n * For complex nested predicates, use `andWhere()`, `orWhere()`, and `notWhere()`\n * to compose multiple top-level conditions.\n */\n\nfunction normalizeWhereInput<Builder>(\n input:\n | ((where: Builder) => IndexWhereExpression)\n | IndexWhereExpression\n | undefined,\n createBuilder: () => Builder,\n): IndexWhereExpression | undefined {\n if (input === undefined) {\n return undefined;\n }\n\n if (typeof input === \"function\") {\n return input(createBuilder());\n }\n\n return input;\n}\n\ntype NodeShape = Readonly<Record<string, z.ZodType>>;\ntype EdgeShape = Readonly<Record<string, z.ZodType>>;\n\nfunction createNodeWhereBuilder<N extends NodeType>(\n node: N,\n schemaIntrospector: ReturnType<typeof createSchemaIntrospector>,\n): NodeIndexWhereBuilder<N> {\n const shape = getSchemaShape(node.schema);\n const system = createSystemColumnMapForNode();\n\n function getOperand(key: string): IndexWhereOperand {\n const systemColumn = system.get(key);\n if (systemColumn) {\n return {\n __type: \"index_operand_system\",\n column: systemColumn.column,\n valueType: systemColumn.valueType,\n };\n }\n\n if (!(key in shape)) {\n throw new Error(\n `Unknown field \"${key}\" in node index WHERE clause for \"${node.kind}\"`,\n );\n }\n\n const info = schemaIntrospector.getFieldTypeInfo(node.kind, key);\n const valueType = info?.valueType;\n\n return {\n __type: \"index_operand_prop\",\n field: key,\n valueType,\n };\n }\n\n return createWhereProxy<NodeIndexWhereBuilder<N>>((key) => getOperand(key));\n}\n\nfunction createEdgeWhereBuilder<E extends AnyEdgeType>(\n edge: E,\n schemaIntrospector: ReturnType<typeof createSchemaIntrospector>,\n): EdgeIndexWhereBuilder<E> {\n const shape = getSchemaShape(edge.schema);\n const system = createSystemColumnMapForEdge();\n\n function getOperand(key: string): IndexWhereOperand {\n const systemColumn = system.get(key);\n if (systemColumn) {\n return {\n __type: \"index_operand_system\",\n column: systemColumn.column,\n valueType: systemColumn.valueType,\n };\n }\n\n if (!(key in shape)) {\n throw new Error(\n `Unknown field \"${key}\" in edge index WHERE clause for \"${edge.kind}\"`,\n );\n }\n\n const info = schemaIntrospector.getEdgeFieldTypeInfo(edge.kind, key);\n const valueType = info?.valueType;\n\n return {\n __type: \"index_operand_prop\",\n field: key,\n valueType,\n };\n }\n\n return createWhereProxy<EdgeIndexWhereBuilder<E>>((key) => getOperand(key));\n}\n\nfunction createWhereProxy<TBuilder extends object>(\n getOperand: (key: string) => IndexWhereOperand,\n): TBuilder {\n return new Proxy(Object.create(null) as TBuilder, {\n get: (_target, property: string | symbol) => {\n if (typeof property !== \"string\") return;\n if (property === \"then\") return;\n if (property === \"toJSON\") return;\n\n const operand = getOperand(property);\n return createIndexWhereFieldBuilder(operand);\n },\n });\n}\n\nfunction createIndexWhereFieldBuilder<T>(\n operand: IndexWhereOperand,\n): IndexWhereFieldBuilder<T> {\n function isNull(): IndexWhereExpression {\n return { __type: \"index_where_null_check\", operand, op: \"isNull\" };\n }\n\n function isNotNull(): IndexWhereExpression {\n return { __type: \"index_where_null_check\", operand, op: \"isNotNull\" };\n }\n\n function comparison(op: IndexWhereOp, value: unknown): IndexWhereExpression {\n return {\n __type: \"index_where_comparison\",\n left: operand,\n op,\n right: toLiteralOrThrow(value, operand.valueType),\n };\n }\n\n function listComparison(\n op: IndexWhereOp,\n values: readonly unknown[],\n ): IndexWhereExpression {\n const literals = values.map((value) =>\n toLiteralOrThrow(value, operand.valueType),\n );\n return {\n __type: \"index_where_comparison\",\n left: operand,\n op,\n right: literals,\n };\n }\n\n return {\n eq: (value) => comparison(\"eq\", value),\n neq: (value) => comparison(\"neq\", value),\n gt: (value) => comparison(\"gt\", value),\n gte: (value) => comparison(\"gte\", value),\n lt: (value) => comparison(\"lt\", value),\n lte: (value) => comparison(\"lte\", value),\n in: (values) => listComparison(\"in\", values),\n notIn: (values) => listComparison(\"notIn\", values),\n isNull,\n isNotNull,\n };\n}\n\nfunction toLiteralOrThrow(\n value: unknown,\n preferredType: ValueType | undefined,\n): IndexWhereLiteral {\n if (value instanceof Date) {\n return {\n __type: \"index_where_literal\",\n value: value.toISOString(),\n valueType: \"date\",\n };\n }\n\n if (\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\"\n ) {\n const valueType = inferValueType(value, preferredType);\n return { __type: \"index_where_literal\", value, valueType };\n }\n\n throw new Error(\n `Unsupported literal value type in index WHERE clause: ${String(value)}`,\n );\n}\n\nfunction inferValueType(\n value: string | number | boolean,\n preferredType: ValueType | undefined,\n): ValueType {\n if (preferredType === \"date\" && typeof value === \"string\") {\n return \"date\";\n }\n if (preferredType === \"number\" && typeof value === \"string\") {\n return \"number\";\n }\n if (preferredType === \"boolean\" && typeof value === \"string\") {\n return \"boolean\";\n }\n\n if (typeof value === \"string\") return \"string\";\n if (typeof value === \"number\") return \"number\";\n return \"boolean\";\n}\n\nfunction toSystemColumnName(metaKey: string): SystemColumnName {\n const snake = metaKey.replaceAll(/([A-Z])/g, \"_$1\").toLowerCase();\n\n switch (snake) {\n case \"deleted_at\":\n case \"valid_from\":\n case \"valid_to\":\n case \"created_at\":\n case \"updated_at\": {\n return snake;\n }\n default: {\n throw new Error(`Unsupported system meta key: ${metaKey}`);\n }\n }\n}\n\nfunction createSystemColumnMapForNode(): Map<\n string,\n Readonly<{ column: SystemColumnName; valueType: ValueType | undefined }>\n> {\n const entries: (readonly [\n string,\n Readonly<{ column: SystemColumnName; valueType: ValueType | undefined }>,\n ])[] = [\n [\"graphId\", { column: \"graph_id\", valueType: \"string\" }],\n [\"kind\", { column: \"kind\", valueType: \"string\" }],\n [\"id\", { column: \"id\", valueType: \"string\" }],\n ];\n\n for (const key of NODE_META_KEYS) {\n if (key === \"version\") {\n entries.push([key, { column: \"version\", valueType: \"number\" }]);\n continue;\n }\n entries.push([key, { column: toSystemColumnName(key), valueType: \"date\" }]);\n }\n\n return new Map(entries);\n}\n\nfunction createSystemColumnMapForEdge(): Map<\n string,\n Readonly<{ column: SystemColumnName; valueType: ValueType | undefined }>\n> {\n const entries: (readonly [\n string,\n Readonly<{ column: SystemColumnName; valueType: ValueType | undefined }>,\n ])[] = [\n [\"graphId\", { column: \"graph_id\", valueType: \"string\" }],\n [\"kind\", { column: \"kind\", valueType: \"string\" }],\n [\"id\", { column: \"id\", valueType: \"string\" }],\n [\"fromKind\", { column: \"from_kind\", valueType: \"string\" }],\n [\"fromId\", { column: \"from_id\", valueType: \"string\" }],\n [\"toKind\", { column: \"to_kind\", valueType: \"string\" }],\n [\"toId\", { column: \"to_id\", valueType: \"string\" }],\n ];\n\n for (const key of EDGE_META_KEYS) {\n entries.push([key, { column: toSystemColumnName(key), valueType: \"date\" }]);\n }\n\n return new Map(entries);\n}\n\nfunction getSchemaShape(schema: z.ZodType): NodeShape | EdgeShape {\n if (schema.type !== \"object\") {\n throw new Error(\"Index definitions require an object schema\");\n }\n\n const def = schema.def as { shape?: Record<string, z.ZodType> };\n const shape = def.shape;\n if (!shape) {\n throw new Error(\"Index definitions require a resolvable object shape\");\n }\n\n return shape;\n}\n\n// ============================================================\n// Validation\n// ============================================================\n\nfunction assertNonEmpty(values: readonly unknown[], label: string): void {\n if (values.length === 0) {\n throw new Error(`Index ${label} must not be empty`);\n }\n}\n\nfunction assertUnique(values: readonly string[], label: string): void {\n const set = new Set<string>();\n for (const value of values) {\n if (set.has(value)) {\n throw new Error(`Index ${label} contains duplicate value: ${value}`);\n }\n set.add(value);\n }\n}\n\nfunction assertNoOverlap(\n a: readonly string[],\n b: readonly string[],\n aLabel: string,\n bLabel: string,\n): void {\n const set = new Set(a);\n for (const value of b) {\n if (set.has(value)) {\n throw new Error(`Index ${bLabel} must not overlap ${aLabel}: ${value}`);\n }\n }\n}\n\nfunction assertIndexableValueType(\n valueType: ValueType,\n context: string,\n options: Readonly<{ allowJsonFields: boolean }>,\n): void {\n if (valueType === \"embedding\") {\n throw new Error(\n `Cannot create props index for embedding field (${context}); embedding() fields are indexed automatically in the vector strategy's per-(kind, field) storage`,\n );\n }\n\n if (\n (valueType === \"array\" || valueType === \"object\") &&\n !options.allowJsonFields\n ) {\n throw new Error(\n `Cannot create btree props index for ${valueType} field (${context}); use method: \"gin\" instead`,\n );\n }\n}\n\ntype NormalizedIndexFields = Readonly<{\n pointers: readonly JsonPointer[];\n valueTypes: readonly (ValueType | undefined)[];\n}>;\n\nfunction normalizeNodeIndexFieldsOrThrow<N extends NodeType>(\n node: N,\n inputs: readonly IndexFieldInput<z.infer<N[\"schema\"]>>[],\n schemaIntrospector: ReturnType<typeof createSchemaIntrospector>,\n label: string,\n options: Readonly<{ allowJsonFields?: boolean }>,\n): NormalizedIndexFields {\n // Node `fields`/`coveringFields` are both optional (an index can be keyed\n // by `keySystemColumns` alone), so unlike the edge equivalent below, an\n // empty input is always valid here — `defineNodeIndex` enforces that at\n // least one of `fields`/`coveringFields`/`keySystemColumns` is non-empty.\n if (inputs.length === 0) {\n return { pointers: [], valueTypes: [] };\n }\n\n const pointers: JsonPointer[] = [];\n const valueTypes: (ValueType | undefined)[] = [];\n\n for (const input of inputs) {\n const pointer = normalizeIndexFieldPointer(input);\n const info = resolveNodeFieldTypeInfoOrThrow(\n node.kind,\n pointer,\n schemaIntrospector,\n );\n assertIndexableValueType(info.valueType, `node \"${node.kind}\" ${pointer}`, {\n allowJsonFields: options.allowJsonFields ?? false,\n });\n pointers.push(pointer);\n valueTypes.push(info.valueType);\n }\n\n assertUnique(pointers, label);\n\n return { pointers, valueTypes };\n}\n\nfunction normalizeEdgeIndexFieldsOrThrow<E extends AnyEdgeType>(\n edge: E,\n inputs: readonly IndexFieldInput<z.infer<E[\"schema\"]>>[],\n schemaIntrospector: ReturnType<typeof createSchemaIntrospector>,\n label: string,\n options: Readonly<{ allowEmpty: boolean; allowJsonFields?: boolean }>,\n): NormalizedIndexFields {\n if (inputs.length === 0 && options.allowEmpty) {\n return { pointers: [], valueTypes: [] };\n }\n assertNonEmpty(inputs, label);\n\n const pointers: JsonPointer[] = [];\n const valueTypes: (ValueType | undefined)[] = [];\n\n for (const input of inputs) {\n const pointer = normalizeIndexFieldPointer(input);\n const info = resolveEdgeFieldTypeInfoOrThrow(\n edge.kind,\n pointer,\n schemaIntrospector,\n );\n assertIndexableValueType(info.valueType, `edge \"${edge.kind}\" ${pointer}`, {\n allowJsonFields: options.allowJsonFields ?? false,\n });\n pointers.push(pointer);\n valueTypes.push(info.valueType);\n }\n\n assertUnique(pointers, label);\n\n return { pointers, valueTypes };\n}\n\nfunction normalizeIndexFieldPointer<T>(input: IndexFieldInput<T>): JsonPointer {\n if (Array.isArray(input)) {\n if (input.length === 0) {\n throw new Error(\"Index field JSON pointer must not be empty\");\n }\n return jsonPointer(input as readonly JsonPointerSegment[]);\n }\n\n if (typeof input === \"string\") {\n if (input.startsWith(\"/\")) {\n const pointer = normalizeJsonPointer(\n input as JsonPointerInput<Record<string, unknown>>,\n );\n if (pointer === \"\") {\n throw new Error(\"Index field JSON pointer must not be empty\");\n }\n return pointer;\n }\n return jsonPointer([input]);\n }\n\n throw new Error(`Unsupported index field input: ${String(input)}`);\n}\n\nfunction resolveNodeFieldTypeInfoOrThrow(\n nodeKind: string,\n pointer: JsonPointer,\n schemaIntrospector: ReturnType<typeof createSchemaIntrospector>,\n): FieldTypeInfo {\n const segments = parseJsonPointer(pointer);\n const [first, ...rest] = segments;\n if (!first) {\n throw new Error(\"Index field JSON pointer must not be empty\");\n }\n\n const rootInfo = schemaIntrospector.getFieldTypeInfo(nodeKind, first);\n if (!rootInfo) {\n throw new Error(\n `Unknown field \"${first}\" for node \"${nodeKind}\" in index definition`,\n );\n }\n\n if (rest.length === 0) {\n return rootInfo;\n }\n\n const resolved = resolveFieldTypeInfoAtJsonPointer(\n rootInfo,\n jsonPointer(rest),\n );\n if (!resolved) {\n throw new Error(\n `Unknown JSON pointer \"${pointer}\" for node \"${nodeKind}\" in index definition`,\n );\n }\n\n return resolved;\n}\n\nfunction resolveEdgeFieldTypeInfoOrThrow(\n edgeKind: string,\n pointer: JsonPointer,\n schemaIntrospector: ReturnType<typeof createSchemaIntrospector>,\n): FieldTypeInfo {\n const segments = parseJsonPointer(pointer);\n const [first, ...rest] = segments;\n if (!first) {\n throw new Error(\"Index field JSON pointer must not be empty\");\n }\n\n const rootInfo = schemaIntrospector.getEdgeFieldTypeInfo(edgeKind, first);\n if (!rootInfo) {\n throw new Error(\n `Unknown field \"${first}\" for edge \"${edgeKind}\" in index definition`,\n );\n }\n\n if (rest.length === 0) {\n return rootInfo;\n }\n\n const resolved = resolveFieldTypeInfoAtJsonPointer(\n rootInfo,\n jsonPointer(rest),\n );\n if (!resolved) {\n throw new Error(\n `Unknown JSON pointer \"${pointer}\" for edge \"${edgeKind}\" in index definition`,\n );\n }\n\n return resolved;\n}\n\n// ============================================================\n// Default Name Generation\n// ============================================================\n\ntype DefaultNameParts = Readonly<{\n kind: KindEntity;\n kindName: string;\n unique: boolean;\n scope: IndexScope;\n direction: EdgeIndexDirection;\n fields: readonly string[];\n coveringFields: readonly string[];\n /**\n * Node-only, defaults to `[]` for edges. Folded into the hash/name only\n * when non-empty so indexes that don't use it keep byte-identical\n * default names to before this field existed.\n */\n keySystemColumns?: readonly string[];\n}>;\n\nfunction generateDefaultIndexName(parts: DefaultNameParts): string {\n const keySystemColumns = parts.keySystemColumns ?? [];\n const hash = fnv1aBase36(\n JSON.stringify({\n kind: parts.kind,\n kindName: parts.kindName,\n unique: parts.unique,\n scope: parts.scope,\n direction: parts.direction,\n fields: parts.fields,\n covering: parts.coveringFields,\n ...(keySystemColumns.length > 0 ? { keySystemColumns } : {}),\n }),\n );\n\n const nameParts = [\n \"idx\",\n \"tg\",\n parts.kind,\n sanitizeIdentifierComponent(parts.kindName),\n parts.fields.length > 0 ?\n sanitizeIdentifierComponent(parts.fields.join(\"_\"))\n : undefined,\n parts.coveringFields.length > 0 ?\n `cov_${sanitizeIdentifierComponent(parts.coveringFields.join(\"_\"))}`\n : undefined,\n keySystemColumns.length > 0 ?\n `sys_${sanitizeIdentifierComponent(keySystemColumns.join(\"_\"))}`\n : undefined,\n parts.direction === \"none\" ? undefined : parts.direction,\n parts.unique ? \"uniq\" : undefined,\n parts.scope === \"graphAndKind\" ?\n undefined\n : sanitizeIdentifierComponent(parts.scope),\n hash,\n ].filter((part) => part !== undefined);\n\n const joined = nameParts.join(\"_\");\n return joined.length <= MAX_PG_IDENTIFIER_LENGTH ?\n joined\n : `${joined.slice(0, TRUNCATED_IDENTIFIER_MAX_LENGTH)}_${hash}`;\n}\n\nfunction sanitizeIdentifierComponent(value: string): string {\n return value\n .toLowerCase()\n .replaceAll(/[^a-z0-9_]+/g, \"_\")\n .replaceAll(/^_+|_+$/g, \"\")\n .slice(0, IDENTIFIER_COMPONENT_MAX_LENGTH);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { compileNodeIndexKeys, compileEdgeIndexKeys, compileIndexWhere, getDialect } from './chunk-
|
|
1
|
+
import { compileNodeIndexKeys, compileEdgeIndexKeys, compileIndexWhere, getDialect } from './chunk-FPIZFYHE.js';
|
|
2
2
|
import { sql } from 'drizzle-orm';
|
|
3
3
|
import { CasingCache } from 'drizzle-orm/casing';
|
|
4
4
|
|
|
@@ -17,6 +17,9 @@ function generateEdgeIndexDDL(index, dialect, options = {}) {
|
|
|
17
17
|
return generateTableIndexDDL(index, dialect, tableName, options);
|
|
18
18
|
}
|
|
19
19
|
function generateTableIndexDDL(index, dialect, tableName, options) {
|
|
20
|
+
if (index.method !== void 0) {
|
|
21
|
+
return generateGinFamilyIndexDDL(index, dialect, tableName, options);
|
|
22
|
+
}
|
|
20
23
|
const ifNotExists = options.ifNotExists ?? true;
|
|
21
24
|
const propsColumn = sql.raw('"props"');
|
|
22
25
|
const systemColumn = (column) => sql.raw(quoteIdentifier(column));
|
|
@@ -39,6 +42,21 @@ function generateTableIndexDDL(index, dialect, tableName, options) {
|
|
|
39
42
|
const whereClause = whereSql ? ` WHERE ${whereSql}` : "";
|
|
40
43
|
return `CREATE ${unique}INDEX ${concurrent}${ifNotExistsSql}${quoteIdentifier(index.name)} ON ${quoteIdentifier(tableName)} (${keySql})${whereClause};`;
|
|
41
44
|
}
|
|
45
|
+
function generateGinFamilyIndexDDL(index, dialect, tableName, options) {
|
|
46
|
+
if (dialect !== "postgres") {
|
|
47
|
+
throw new Error(
|
|
48
|
+
`Index "${index.name}" declares method "${index.method}", which requires PostgreSQL. materializeIndexes() reports such declarations as skipped on SQLite instead of calling this.`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
const adapter = getDialect(dialect);
|
|
52
|
+
const propsColumn = sql.raw('"props"');
|
|
53
|
+
const pointer = index.fields[0];
|
|
54
|
+
const expression = index.method === "gin" ? adapter.jsonExtract(propsColumn, pointer) : adapter.jsonExtractText(propsColumn, pointer);
|
|
55
|
+
const operatorClass = index.method === "gin" ? "jsonb_path_ops" : "gin_trgm_ops";
|
|
56
|
+
const concurrent = options.concurrent === true ? "CONCURRENTLY " : "";
|
|
57
|
+
const ifNotExistsSql = options.ifNotExists ?? true ? "IF NOT EXISTS " : "";
|
|
58
|
+
return `CREATE INDEX ${concurrent}${ifNotExistsSql}${quoteIdentifier(index.name)} ON ${quoteIdentifier(tableName)} USING GIN ((${sqlToInlineString(expression, dialect)}) ${operatorClass});`;
|
|
59
|
+
}
|
|
42
60
|
function quoteIdentifier(identifier) {
|
|
43
61
|
return `"${identifier.replaceAll('"', '""')}"`;
|
|
44
62
|
}
|
|
@@ -86,5 +104,5 @@ function escapeStringLiteral(value) {
|
|
|
86
104
|
}
|
|
87
105
|
|
|
88
106
|
export { generateEdgeIndexDDL, generateIndexDDL, generateNodeIndexDDL };
|
|
89
|
-
//# sourceMappingURL=chunk-
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
107
|
+
//# sourceMappingURL=chunk-UZV3AZKF.js.map
|
|
108
|
+
//# sourceMappingURL=chunk-UZV3AZKF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/indexes/ddl.ts"],"names":[],"m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SQL, sql } from \"drizzle-orm\";\nimport { CasingCache } from \"drizzle-orm/casing\";\n\nimport { getDialect } from \"../query/dialect\";\nimport { type SqlDialect } from \"../query/dialect/types\";\nimport {\n compileEdgeIndexKeys,\n compileIndexWhere,\n compileNodeIndexKeys,\n type IndexCompilationContext,\n} from \"./compiler\";\nimport {\n type EdgeIndexDeclaration,\n type NodeIndexDeclaration,\n type RelationalIndexDeclaration,\n type SystemColumnName,\n} from \"./types\";\n\nexport type GenerateIndexDdlOptions = Readonly<{\n nodesTableName?: string | undefined;\n edgesTableName?: string | undefined;\n ifNotExists?: boolean | undefined;\n /**\n * Emit `CREATE INDEX CONCURRENTLY` (Postgres only). Required for\n * `store.materializeIndexes()` so live tables don't take an\n * `AccessExclusiveLock`. Ignored on SQLite (no equivalent; SQLite is\n * single-writer regardless). When true on Postgres, the resulting\n * statement cannot be executed inside a transaction.\n */\n concurrent?: boolean | undefined;\n}>;\n\n/**\n * Generate `CREATE INDEX` DDL for a single relational index declaration.\n *\n * Vector index declarations (`entity: \"vector\"`) are NOT handled here —\n * they go through `backend.createVectorIndex` instead because the DDL\n * is dialect-specific (`USING hnsw (...) WITH (m=..., ef_construction=...)`\n * on Postgres) and operates on the strategy's per-`(kind, field)` embedding\n * tables, not `typegraph_nodes` / `typegraph_edges`. Callers narrow to the\n * relational subset before calling this function.\n */\nexport function generateIndexDDL(\n index: RelationalIndexDeclaration,\n dialect: SqlDialect,\n options: GenerateIndexDdlOptions = {},\n): string {\n if (index.entity === \"node\") {\n return generateNodeIndexDDL(index, dialect, options);\n }\n return generateEdgeIndexDDL(index, dialect, options);\n}\n\nexport function generateNodeIndexDDL(\n index: NodeIndexDeclaration,\n dialect: SqlDialect,\n options: GenerateIndexDdlOptions = {},\n): string {\n const tableName = options.nodesTableName ?? \"typegraph_nodes\";\n return generateTableIndexDDL(index, dialect, tableName, options);\n}\n\nexport function generateEdgeIndexDDL(\n index: EdgeIndexDeclaration,\n dialect: SqlDialect,\n options: GenerateIndexDdlOptions = {},\n): string {\n const tableName = options.edgesTableName ?? \"typegraph_edges\";\n return generateTableIndexDDL(index, dialect, tableName, options);\n}\n\nfunction generateTableIndexDDL(\n index: RelationalIndexDeclaration,\n dialect: SqlDialect,\n tableName: string,\n options: GenerateIndexDdlOptions,\n): string {\n if (index.method !== undefined) {\n return generateGinFamilyIndexDDL(index, dialect, tableName, options);\n }\n const ifNotExists = options.ifNotExists ?? true;\n const propsColumn = sql.raw('\"props\"');\n const systemColumn = (column: SystemColumnName): SQL =>\n sql.raw(quoteIdentifier(column));\n\n const keys =\n index.entity === \"node\" ?\n compileNodeIndexKeys(index, dialect, propsColumn, systemColumn).keys\n : compileEdgeIndexKeys(index, dialect, propsColumn, systemColumn).keys;\n\n const whereSql =\n index.where ?\n sqlToInlineString(\n compileIndexWhere(\n {\n dialect,\n propsColumn,\n systemColumn,\n } satisfies IndexCompilationContext,\n index.where,\n ),\n dialect,\n )\n : undefined;\n\n const keySql = keys.map((k) => sqlToInlineString(k, dialect)).join(\", \");\n const unique = index.unique ? \"UNIQUE \" : \"\";\n const concurrent =\n options.concurrent === true && dialect === \"postgres\" ?\n \"CONCURRENTLY \"\n : \"\";\n const ifNotExistsSql = ifNotExists ? \"IF NOT EXISTS \" : \"\";\n\n const whereClause = whereSql ? ` WHERE ${whereSql}` : \"\";\n\n return `CREATE ${unique}INDEX ${concurrent}${ifNotExistsSql}${quoteIdentifier(index.name)} ON ${quoteIdentifier(tableName)} (${keySql})${whereClause};`;\n}\n\n/**\n * DDL for the GIN-family methods (`\"gin\"` / `\"trigram\"`) — a PostgreSQL\n * expression GIN over the declaration's single field.\n *\n * The indexed expression is built from the SAME dialect extraction the\n * query compiler emits for the field (`jsonExtract` → `\"props\" #> ARRAY[…]`\n * for containment, `jsonExtractText` → `#>>` for text), because Postgres\n * matches expression indexes structurally: `(props #> ARRAY['tags']) @> $1`\n * and `(props #>> ARRAY['name']) ILIKE $1 ESCAPE '\\'` both hit their GIN\n * (verified against parameterized prepared statements). No scope prefix\n * columns, uniqueness, or partial clause: a GIN indexes one expression, and\n * the query's `graph_id` / `kind` equality filters apply as residual\n * conditions over the candidate rows.\n */\nfunction generateGinFamilyIndexDDL(\n index: RelationalIndexDeclaration,\n dialect: SqlDialect,\n tableName: string,\n options: GenerateIndexDdlOptions,\n): string {\n if (dialect !== \"postgres\") {\n throw new Error(\n `Index \"${index.name}\" declares method \"${index.method}\", which ` +\n \"requires PostgreSQL. materializeIndexes() reports such \" +\n \"declarations as skipped on SQLite instead of calling this.\",\n );\n }\n const adapter = getDialect(dialect);\n const propsColumn = sql.raw('\"props\"');\n const pointer = index.fields[0]!;\n const expression =\n index.method === \"gin\" ?\n adapter.jsonExtract(propsColumn, pointer)\n : adapter.jsonExtractText(propsColumn, pointer);\n const operatorClass =\n index.method === \"gin\" ? \"jsonb_path_ops\" : \"gin_trgm_ops\";\n const concurrent = options.concurrent === true ? \"CONCURRENTLY \" : \"\";\n const ifNotExistsSql = (options.ifNotExists ?? true) ? \"IF NOT EXISTS \" : \"\";\n return `CREATE INDEX ${concurrent}${ifNotExistsSql}${quoteIdentifier(index.name)} ON ${quoteIdentifier(tableName)} USING GIN ((${sqlToInlineString(expression, dialect)}) ${operatorClass});`;\n}\n\nfunction quoteIdentifier(identifier: string): string {\n return `\"${identifier.replaceAll('\"', '\"\"')}\"`;\n}\n\nfunction sqlToInlineString(object: SQL, dialect: SqlDialect): string {\n const query = object.toQuery({\n casing: new CasingCache(),\n escapeName: (name) => name,\n escapeParam: (_number, value) => inlineParam(value, dialect),\n escapeString: (value) => escapeStringLiteral(value),\n inlineParams: true,\n invokeSource: \"indexes\",\n });\n\n if (query.params.length > 0) {\n throw new Error(\n \"Index DDL generation produced parameters; expected fully inlined SQL\",\n );\n }\n\n return query.sql;\n}\n\nfunction inlineParam(value: unknown, dialect: SqlDialect): string {\n if (value === null || value === undefined) {\n return \"NULL\";\n }\n if (value instanceof Date) {\n return escapeStringLiteral(value.toISOString());\n }\n\n if (typeof value === \"string\") {\n return escapeStringLiteral(value);\n }\n if (typeof value === \"number\") {\n return value.toString();\n }\n if (typeof value === \"boolean\") {\n return getDialect(dialect).booleanLiteralString(value);\n }\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n\n throw new TypeError(\n \"Index DDL generation received an unsupported SQL parameter value\",\n );\n}\n\nfunction escapeStringLiteral(value: string): string {\n return `'${value.replaceAll(\"'\", \"''\")}'`;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildSqliteNodeIndexBuilders, buildSqliteEdgeIndexBuilders } from './chunk-
|
|
1
|
+
import { buildSqliteNodeIndexBuilders, buildSqliteEdgeIndexBuilders } from './chunk-6FR2MMS6.js';
|
|
2
2
|
import { sql } from 'drizzle-orm';
|
|
3
3
|
import { sqliteTable, text, integer, primaryKey, index, uniqueIndex } from 'drizzle-orm/sqlite-core';
|
|
4
4
|
|
|
@@ -9,6 +9,7 @@ var DEFAULT_TABLE_NAMES = {
|
|
|
9
9
|
recordedNodes: "typegraph_recorded_nodes",
|
|
10
10
|
recordedEdges: "typegraph_recorded_edges",
|
|
11
11
|
recordedClock: "typegraph_recorded_clock",
|
|
12
|
+
revisionOrigins: "typegraph_revision_origins",
|
|
12
13
|
uniques: "typegraph_node_uniques",
|
|
13
14
|
schemaVersions: "typegraph_schema_versions",
|
|
14
15
|
fulltext: "typegraph_node_fulltext",
|
|
@@ -69,7 +70,13 @@ function createSqliteTables(names = {}, options = {}) {
|
|
|
69
70
|
primaryKey({ columns: [t.graphId, t.id] }),
|
|
70
71
|
index(`${n.edges}_kind_idx`).on(t.graphId, t.kind),
|
|
71
72
|
// Directional traversal index (outgoing): supports endpoint lookups
|
|
72
|
-
// and extra filtering by edge kind / target kind.
|
|
73
|
+
// and extra filtering by edge kind / target kind. Includes every
|
|
74
|
+
// system column the compiled query's soft-delete/temporal-validity
|
|
75
|
+
// predicate touches (deleted_at, valid_from, valid_to), trailed by
|
|
76
|
+
// to_id — the compiled traversal join reads `n.id = e.to_id` for an
|
|
77
|
+
// outgoing traversal (standard-builders.ts), so without to_id here
|
|
78
|
+
// the join still fetches the edge's heap row for that one column
|
|
79
|
+
// even with the seek/predicate columns covered.
|
|
73
80
|
index(`${n.edges}_from_idx`).on(
|
|
74
81
|
t.graphId,
|
|
75
82
|
t.fromKind,
|
|
@@ -77,9 +84,13 @@ function createSqliteTables(names = {}, options = {}) {
|
|
|
77
84
|
t.kind,
|
|
78
85
|
t.toKind,
|
|
79
86
|
t.deletedAt,
|
|
80
|
-
t.
|
|
87
|
+
t.validFrom,
|
|
88
|
+
t.validTo,
|
|
89
|
+
t.toId
|
|
81
90
|
),
|
|
82
|
-
// Directional traversal index (incoming): mirrors from_idx for
|
|
91
|
+
// Directional traversal index (incoming): mirrors from_idx for
|
|
92
|
+
// reverse traversals, trailed by from_id for the same reason
|
|
93
|
+
// (`n.id = e.from_id` for an incoming traversal).
|
|
83
94
|
index(`${n.edges}_to_idx`).on(
|
|
84
95
|
t.graphId,
|
|
85
96
|
t.toKind,
|
|
@@ -87,7 +98,9 @@ function createSqliteTables(names = {}, options = {}) {
|
|
|
87
98
|
t.kind,
|
|
88
99
|
t.fromKind,
|
|
89
100
|
t.deletedAt,
|
|
90
|
-
t.
|
|
101
|
+
t.validFrom,
|
|
102
|
+
t.validTo,
|
|
103
|
+
t.fromId
|
|
91
104
|
),
|
|
92
105
|
index(`${n.edges}_kind_created_idx`).on(
|
|
93
106
|
t.graphId,
|
|
@@ -212,6 +225,14 @@ function createSqliteTables(names = {}, options = {}) {
|
|
|
212
225
|
},
|
|
213
226
|
(t) => [primaryKey({ columns: [t.graphId] })]
|
|
214
227
|
);
|
|
228
|
+
const revisionOrigins = sqliteTable(
|
|
229
|
+
n.revisionOrigins,
|
|
230
|
+
{
|
|
231
|
+
graphId: text("graph_id").notNull(),
|
|
232
|
+
origin: text("origin").notNull()
|
|
233
|
+
},
|
|
234
|
+
(t) => [primaryKey({ columns: [t.graphId] })]
|
|
235
|
+
);
|
|
215
236
|
const uniques2 = sqliteTable(
|
|
216
237
|
n.uniques,
|
|
217
238
|
{
|
|
@@ -315,6 +336,7 @@ function createSqliteTables(names = {}, options = {}) {
|
|
|
315
336
|
recordedNodes: recordedNodes2,
|
|
316
337
|
recordedEdges: recordedEdges2,
|
|
317
338
|
recordedClock: recordedClock2,
|
|
339
|
+
revisionOrigins,
|
|
318
340
|
uniques: uniques2,
|
|
319
341
|
schemaVersions: schemaVersions2,
|
|
320
342
|
indexMaterializations,
|
|
@@ -341,5 +363,5 @@ var {
|
|
|
341
363
|
} = tables;
|
|
342
364
|
|
|
343
365
|
export { LEGACY_EMBEDDINGS_TABLE_NAME, createSqliteTables, edges, nodes, recordedClock, recordedEdges, recordedNodes, schemaVersions, tables, uniques };
|
|
344
|
-
//# sourceMappingURL=chunk-
|
|
345
|
-
//# sourceMappingURL=chunk-
|
|
366
|
+
//# sourceMappingURL=chunk-VHMPG6UL.js.map
|
|
367
|
+
//# sourceMappingURL=chunk-VHMPG6UL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/backend/drizzle/schema/sqlite.ts"],"names":["nodes","edges","recordedNodes","recordedEdges","recordedClock","uniques","schemaVersions"],"mappings":";;;;AA6DO,IAAM,4BAAA,GAA+B;AAY5C,IAAM,mBAAA,GAAwC;AAAA,EAC5C,KAAA,EAAO,iBAAA;AAAA,EACP,KAAA,EAAO,iBAAA;AAAA,EACP,aAAA,EAAe,0BAAA;AAAA,EACf,aAAA,EAAe,0BAAA;AAAA,EACf,aAAA,EAAe,0BAAA;AAAA,EACf,eAAA,EAAiB,4BAAA;AAAA,EACjB,OAAA,EAAS,wBAAA;AAAA,EACT,cAAA,EAAgB,2BAAA;AAAA,EAChB,QAAA,EAAU,yBAAA;AAAA,EACV,qBAAA,EAAuB,kCAAA;AAAA,EACvB,4BAAA,EAA8B,yCAAA;AAAA,EAC9B,YAAA,EAAc,yBAAA;AAAA,EACd,qBAAA,EAAuB;AACzB,CAAA;AAM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W,IAAA,CAAK,YAAY,CAAA,CAAE,OAAA,EAAQ;AAAA,MACtC,SAAA,EAAW,IAAA,CAAK,WAAW,CAAA,CAAE,OAAA,EAAQ;AAAA,MACrC,cAAA,EAAgB,KAAK,iBAAiB,CAAA;AAAA,MACtC,eAAA,EAAiB,IAAA,CAAK,mBAAmB,CAAA,CAAE,OAAA,EAAQ;AAAA,MACnD,SAAA,EAAW,KAAK,YAAY;AAAA,KAC9B;AAAA,IACA,CAAC,CAAA,KAAM;AAAA,MACL,UAAA,CAAW;AAAA,QACT,OAAA,EAAS,CAAC,CAAA,CAAE,OAAA,EAAS,EAAE,WAAA,EAAa,CAAA,CAAE,KAAA,EAAO,CAAA,CAAE,SAAS;AAAA,OACzD;AAAA;AACH,GACF;AAEA,EAAA,OAAO;AAAA,IACL,KAAA,EAAAN,MAAAA;AAAA,IACA,KAAA,EAAAC,MAAAA;AAAA,IACA,aAAA,EAAAC,cAAAA;AAAA,IACA,aAAA,EAAAC,cAAAA;AAAA,IACA,aAAA,EAAAC,cAAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA,EAAAC,QAAAA;AAAA,IACA,cAAA,EAAAC,eAAAA;AAAA,IACA,qBAAA;AAAA,IACA,4BAAA;AAAA,IACA,YAAA;AAAA,IACA,qBAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,mBAAmB,CAAA,CAAE;AAAA,GACvB;AACF;AAKO,IAAM,SAAS,kBAAA;AAKf,IAAM;AAAA,EACX,KAAA;AAAA,EACA,KAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAA,GAAI","file":"chunk-VHMPG6UL.js","sourcesContent":["/**\n * Drizzle SQLite schema for TypeGraph.\n *\n * Provides table definitions that can be customized via the factory function.\n * Users import these tables into their Drizzle schema and use drizzle-kit\n * for migrations.\n *\n * @example\n * ```typescript\n * // Default table names\n * import { tables } from \"@nicia-ai/typegraph/sqlite\";\n *\n * // Custom table names\n * import { createSqliteTables } from \"@nicia-ai/typegraph/sqlite\";\n * const tables = createSqliteTables({\n * nodes: \"myapp_nodes\",\n * edges: \"myapp_edges\",\n * });\n * ```\n */\nimport { sql } from \"drizzle-orm\";\nimport {\n index,\n integer,\n primaryKey,\n sqliteTable,\n text,\n uniqueIndex,\n} from \"drizzle-orm/sqlite-core\";\n\nimport {\n buildSqliteEdgeIndexBuilders,\n buildSqliteNodeIndexBuilders,\n} from \"../../../indexes/drizzle\";\nimport { type IndexDeclaration } from \"../../../indexes/types\";\n\n/**\n * Table name configuration.\n */\nexport type SqliteTableNames = Readonly<{\n nodes: string;\n edges: string;\n recordedNodes: string;\n recordedEdges: string;\n recordedClock: string;\n revisionOrigins: string;\n uniques: string;\n schemaVersions: string;\n fulltext: string;\n indexMaterializations: string;\n contributionMaterializations: string;\n kindRemovals: string;\n reconciliationMarkers: string;\n}>;\n\n/**\n * Physical name of the legacy single shared embeddings table, dropped in\n * the cross-backend vector cutover (the clean cut of #157). Strategies now\n * own per-`(nodeKind, fieldPath)` typed storage. Retained only so the\n * one-time migration utility can address and drain the old table.\n */\nexport const LEGACY_EMBEDDINGS_TABLE_NAME = \"typegraph_node_embeddings\";\n\nexport type CreateSqliteTablesOptions = Readonly<{\n /**\n * Additional TypeGraph indexes to include in the Drizzle schema.\n *\n * These become first-class Drizzle indexes, so drizzle-kit migrations will\n * pick them up automatically.\n */\n indexes?: readonly IndexDeclaration[] | undefined;\n}>;\n\nconst DEFAULT_TABLE_NAMES: SqliteTableNames = {\n nodes: \"typegraph_nodes\",\n edges: \"typegraph_edges\",\n recordedNodes: \"typegraph_recorded_nodes\",\n recordedEdges: \"typegraph_recorded_edges\",\n recordedClock: \"typegraph_recorded_clock\",\n revisionOrigins: \"typegraph_revision_origins\",\n uniques: \"typegraph_node_uniques\",\n schemaVersions: \"typegraph_schema_versions\",\n fulltext: \"typegraph_node_fulltext\",\n indexMaterializations: \"typegraph_index_materializations\",\n contributionMaterializations: \"typegraph_contribution_materializations\",\n kindRemovals: \"typegraph_kind_removals\",\n reconciliationMarkers: \"typegraph_reconciliation_markers\",\n};\n\n/**\n * Creates SQLite table definitions with customizable table names.\n * Index names are derived from table names.\n */\nexport function createSqliteTables(\n names: Partial<SqliteTableNames> = {},\n options: CreateSqliteTablesOptions = {},\n) {\n const n: SqliteTableNames = { ...DEFAULT_TABLE_NAMES, ...names };\n const indexes = options.indexes ?? [];\n\n const nodes = sqliteTable(\n n.nodes,\n {\n graphId: text(\"graph_id\").notNull(),\n kind: text(\"kind\").notNull(),\n id: text(\"id\").notNull(),\n props: text(\"props\").notNull(),\n version: integer(\"version\").notNull().default(1),\n validFrom: text(\"valid_from\"),\n validTo: text(\"valid_to\"),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n deletedAt: text(\"deleted_at\"),\n },\n (t) => [\n primaryKey({ columns: [t.graphId, t.kind, t.id] }),\n index(`${n.nodes}_kind_idx`).on(t.graphId, t.kind),\n index(`${n.nodes}_kind_created_idx`).on(\n t.graphId,\n t.kind,\n t.deletedAt,\n t.createdAt,\n ),\n index(`${n.nodes}_deleted_idx`).on(t.graphId, t.deletedAt),\n index(`${n.nodes}_valid_idx`).on(t.graphId, t.validFrom, t.validTo),\n ...buildSqliteNodeIndexBuilders(t, indexes),\n ],\n );\n\n const edges = sqliteTable(\n n.edges,\n {\n graphId: text(\"graph_id\").notNull(),\n id: text(\"id\").notNull(),\n kind: text(\"kind\").notNull(),\n fromKind: text(\"from_kind\").notNull(),\n fromId: text(\"from_id\").notNull(),\n toKind: text(\"to_kind\").notNull(),\n toId: text(\"to_id\").notNull(),\n props: text(\"props\").notNull(),\n validFrom: text(\"valid_from\"),\n validTo: text(\"valid_to\"),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n deletedAt: text(\"deleted_at\"),\n },\n (t) => [\n primaryKey({ columns: [t.graphId, t.id] }),\n index(`${n.edges}_kind_idx`).on(t.graphId, t.kind),\n // Directional traversal index (outgoing): supports endpoint lookups\n // and extra filtering by edge kind / target kind. Includes every\n // system column the compiled query's soft-delete/temporal-validity\n // predicate touches (deleted_at, valid_from, valid_to), trailed by\n // to_id — the compiled traversal join reads `n.id = e.to_id` for an\n // outgoing traversal (standard-builders.ts), so without to_id here\n // the join still fetches the edge's heap row for that one column\n // even with the seek/predicate columns covered.\n index(`${n.edges}_from_idx`).on(\n t.graphId,\n t.fromKind,\n t.fromId,\n t.kind,\n t.toKind,\n t.deletedAt,\n t.validFrom,\n t.validTo,\n t.toId,\n ),\n // Directional traversal index (incoming): mirrors from_idx for\n // reverse traversals, trailed by from_id for the same reason\n // (`n.id = e.from_id` for an incoming traversal).\n index(`${n.edges}_to_idx`).on(\n t.graphId,\n t.toKind,\n t.toId,\n t.kind,\n t.fromKind,\n t.deletedAt,\n t.validFrom,\n t.validTo,\n t.fromId,\n ),\n index(`${n.edges}_kind_created_idx`).on(\n t.graphId,\n t.kind,\n t.deletedAt,\n t.createdAt,\n ),\n index(`${n.edges}_deleted_idx`).on(t.graphId, t.deletedAt),\n index(`${n.edges}_valid_idx`).on(t.graphId, t.validFrom, t.validTo),\n index(`${n.edges}_cardinality_idx`).on(\n t.graphId,\n t.kind,\n t.fromKind,\n t.fromId,\n t.validTo,\n ),\n ...buildSqliteEdgeIndexBuilders(t, indexes),\n ],\n );\n\n const recordedNodes = sqliteTable(\n n.recordedNodes,\n {\n historyId: text(\"history_id\").notNull(),\n graphId: text(\"graph_id\").notNull(),\n kind: text(\"kind\").notNull(),\n id: text(\"id\").notNull(),\n props: text(\"props\").notNull(),\n version: integer(\"version\").notNull(),\n validFrom: text(\"valid_from\"),\n validTo: text(\"valid_to\"),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n deletedAt: text(\"deleted_at\"),\n recordedFrom: text(\"recorded_from\").notNull(),\n recordedTo: text(\"recorded_to\").notNull(),\n op: text(\"op\").notNull(),\n schemaVersion: integer(\"schema_version\"),\n txId: text(\"tx_id\"),\n meta: text(\"meta\"),\n },\n (t) => [\n primaryKey({ columns: [t.historyId] }),\n index(`${n.recordedNodes}_entity_idx`).on(\n t.graphId,\n t.kind,\n t.id,\n t.recordedFrom,\n t.recordedTo,\n ),\n index(`${n.recordedNodes}_open_idx`).on(t.graphId, t.recordedTo),\n index(`${n.recordedNodes}_valid_idx`).on(\n t.graphId,\n t.validFrom,\n t.validTo,\n ),\n ],\n );\n\n const recordedEdges = sqliteTable(\n n.recordedEdges,\n {\n historyId: text(\"history_id\").notNull(),\n graphId: text(\"graph_id\").notNull(),\n id: text(\"id\").notNull(),\n kind: text(\"kind\").notNull(),\n fromKind: text(\"from_kind\").notNull(),\n fromId: text(\"from_id\").notNull(),\n toKind: text(\"to_kind\").notNull(),\n toId: text(\"to_id\").notNull(),\n props: text(\"props\").notNull(),\n validFrom: text(\"valid_from\"),\n validTo: text(\"valid_to\"),\n createdAt: text(\"created_at\").notNull(),\n updatedAt: text(\"updated_at\").notNull(),\n deletedAt: text(\"deleted_at\"),\n recordedFrom: text(\"recorded_from\").notNull(),\n recordedTo: text(\"recorded_to\").notNull(),\n op: text(\"op\").notNull(),\n schemaVersion: integer(\"schema_version\"),\n txId: text(\"tx_id\"),\n meta: text(\"meta\"),\n },\n (t) => [\n primaryKey({ columns: [t.historyId] }),\n index(`${n.recordedEdges}_entity_idx`).on(\n t.graphId,\n t.kind,\n t.id,\n t.recordedFrom,\n t.recordedTo,\n ),\n index(`${n.recordedEdges}_open_idx`).on(t.graphId, t.recordedTo),\n index(`${n.recordedEdges}_from_idx`).on(\n t.graphId,\n t.fromKind,\n t.fromId,\n t.kind,\n t.toKind,\n t.recordedFrom,\n t.recordedTo,\n ),\n index(`${n.recordedEdges}_to_idx`).on(\n t.graphId,\n t.toKind,\n t.toId,\n t.kind,\n t.fromKind,\n t.recordedFrom,\n t.recordedTo,\n ),\n index(`${n.recordedEdges}_valid_idx`).on(\n t.graphId,\n t.validFrom,\n t.validTo,\n ),\n ],\n );\n\n const recordedClock = sqliteTable(\n n.recordedClock,\n {\n graphId: text(\"graph_id\").notNull(),\n recordedAt: text(\"recorded_at\").notNull(),\n },\n (t) => [primaryKey({ columns: [t.graphId] })],\n );\n\n const revisionOrigins = sqliteTable(\n n.revisionOrigins,\n {\n graphId: text(\"graph_id\").notNull(),\n origin: text(\"origin\").notNull(),\n },\n (t) => [primaryKey({ columns: [t.graphId] })],\n );\n\n const uniques = sqliteTable(\n n.uniques,\n {\n graphId: text(\"graph_id\").notNull(),\n nodeKind: text(\"node_kind\").notNull(),\n constraintName: text(\"constraint_name\").notNull(),\n key: text(\"key\").notNull(),\n nodeId: text(\"node_id\").notNull(),\n concreteKind: text(\"concrete_kind\").notNull(),\n deletedAt: text(\"deleted_at\"),\n },\n (t) => [\n primaryKey({\n columns: [t.graphId, t.nodeKind, t.constraintName, t.key],\n }),\n index(`${n.uniques}_node_idx`).on(t.graphId, t.concreteKind, t.nodeId),\n ],\n );\n\n const schemaVersions = sqliteTable(\n n.schemaVersions,\n {\n graphId: text(\"graph_id\").notNull(),\n version: integer(\"version\").notNull(),\n schemaHash: text(\"schema_hash\").notNull(),\n schemaDoc: text(\"schema_doc\").notNull(),\n createdAt: text(\"created_at\").notNull(),\n isActive: integer(\"is_active\", { mode: \"boolean\" })\n .notNull()\n .default(false),\n },\n (t) => [\n primaryKey({ columns: [t.graphId, t.version] }),\n index(`${n.schemaVersions}_active_idx`).on(t.graphId, t.isActive),\n // Partial unique index enforcing the \"at most one active version\n // per graph\" invariant at the storage layer. Defense in depth\n // against buggy backend implementations or out-of-band writes.\n // Forces the deactivate-then-activate ordering used by\n // `commitSchemaVersion` and `setActiveVersion`.\n uniqueIndex(`${n.schemaVersions}_one_active_per_graph_idx`)\n .on(t.graphId)\n .where(sql`${t.isActive} = 1`),\n ],\n );\n\n /**\n * Per-deployment record of which declared indexes have been\n * materialized against this database. Owned and written by\n * `store.materializeIndexes()`. Keyed on `index_name` because SQL\n * index names are physical, database-global identifiers — `graphId`\n * is provenance, not identity.\n */\n const indexMaterializations = sqliteTable(\n n.indexMaterializations,\n {\n indexName: text(\"index_name\").notNull(),\n graphId: text(\"graph_id\").notNull(),\n entity: text(\"entity\").notNull(),\n kind: text(\"kind\").notNull(),\n signature: text(\"signature\").notNull(),\n schemaVersion: integer(\"schema_version\").notNull(),\n materializedAt: text(\"materialized_at\"),\n lastAttemptedAt: text(\"last_attempted_at\").notNull(),\n lastError: text(\"last_error\"),\n },\n (t) => [primaryKey({ columns: [t.indexName] })],\n );\n\n /**\n * Per-deployment record of extension kinds removed via\n * `store.removeKinds()` whose data has not yet been cleaned up by\n * `store.materializeRemovals()`. Keyed on `(graph_id, kind_name,\n * entity, schema_version)` — each remove operation is its own row.\n * `entity` separates a node and an edge that share a kind name; the\n * `schema_version` discriminator keeps a re-add-then-re-remove cycle\n * (Foo removed at v=N, re-added, then removed again at v=N+2) from\n * collapsing onto the prior row, where the COALESCE-on-failure rule\n * would preserve the earlier `removed_at` and silently skip the new\n * pending cleanup. `removed_at` is null until the data-cleanup pass\n * succeeds; the pending set is \"rows where removed_at IS NULL\".\n */\n const kindRemovals = sqliteTable(\n n.kindRemovals,\n {\n graphId: text(\"graph_id\").notNull(),\n kindName: text(\"kind_name\").notNull(),\n entity: text(\"entity\").notNull(),\n schemaVersion: integer(\"schema_version\").notNull(),\n removedAt: text(\"removed_at\"),\n lastAttemptedAt: text(\"last_attempted_at\").notNull(),\n lastError: text(\"last_error\"),\n },\n (t) => [\n primaryKey({\n columns: [t.graphId, t.kindName, t.entity, t.schemaVersion],\n }),\n ],\n );\n\n /**\n * Per-deployment high-water mark for the `materializeRemovals`\n * reconciliation walk. One row per `graph_id` carrying the schema\n * version up to which the historical \"did every removal land in\n * `kindRemovals`?\" walk has been verified. Lets subsequent calls\n * skip already-checked transitions instead of re-walking from\n * version 1 every time.\n */\n const reconciliationMarkers = sqliteTable(\n n.reconciliationMarkers,\n {\n graphId: text(\"graph_id\").notNull(),\n reconciledToVersion: integer(\"reconciled_to_version\").notNull(),\n },\n (t) => [primaryKey({ columns: [t.graphId] })],\n );\n\n /**\n * Per-deployment durable marker that a strategy-owned table\n * contribution (#129 — the FTS5 virtual table today) has been\n * materialized against this database (#135). Replaces the in-memory\n * per-backend `fulltextEnsured` latch with a queryable database fact.\n * Keyed on `(graph_id, logical_name, owner, table_name)`; `signature`\n * stays out of the key so same-identity drift is a loud error, not a\n * silent re-materialize. Same COALESCE-on-failure preservation rule\n * as `indexMaterializations`.\n */\n const contributionMaterializations = sqliteTable(\n n.contributionMaterializations,\n {\n graphId: text(\"graph_id\").notNull(),\n logicalName: text(\"logical_name\").notNull(),\n owner: text(\"owner\").notNull(),\n tableName: text(\"table_name\").notNull(),\n signature: text(\"signature\").notNull(),\n materializedAt: text(\"materialized_at\"),\n lastAttemptedAt: text(\"last_attempted_at\").notNull(),\n lastError: text(\"last_error\"),\n },\n (t) => [\n primaryKey({\n columns: [t.graphId, t.logicalName, t.owner, t.tableName],\n }),\n ],\n );\n\n return {\n nodes,\n edges,\n recordedNodes,\n recordedEdges,\n recordedClock,\n revisionOrigins,\n uniques,\n schemaVersions,\n indexMaterializations,\n contributionMaterializations,\n kindRemovals,\n reconciliationMarkers,\n /**\n * The fulltext storage is a FTS5 virtual table which Drizzle cannot\n * represent. DDL is emitted as raw SQL and operations query it via\n * `sql.raw()`.\n */\n fulltextTableName: n.fulltext,\n } as const;\n}\n\n/**\n * Default tables with standard TypeGraph table names.\n */\nexport const tables = createSqliteTables();\n\n/**\n * Convenience exports for default tables.\n */\nexport const {\n nodes,\n edges,\n recordedNodes,\n recordedEdges,\n recordedClock,\n uniques,\n schemaVersions,\n} = tables;\n\n/**\n * Type representing the tables object returned by createSqliteTables.\n */\nexport type SqliteTables = ReturnType<typeof createSqliteTables>;\n"]}
|
|
@@ -1,11 +1,38 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkH7YNSMA7_cjs = require('./chunk-H7YNSMA7.cjs');
|
|
4
|
+
var chunkLGEALRC6_cjs = require('./chunk-LGEALRC6.cjs');
|
|
5
5
|
|
|
6
6
|
// src/core/types.ts
|
|
7
7
|
var NODE_TYPE_BRAND = "__nodeType";
|
|
8
8
|
var EDGE_TYPE_BRAND = "__edgeType";
|
|
9
|
+
function assertNonEmptyId(value, path) {
|
|
10
|
+
if (value.length > 0) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
throw new chunkLGEALRC6_cjs.ValidationError(
|
|
14
|
+
`${path} must be a non-empty string.`,
|
|
15
|
+
{
|
|
16
|
+
issues: [
|
|
17
|
+
{
|
|
18
|
+
path,
|
|
19
|
+
message: "Expected a non-empty string."
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
suggestion: "Use a persisted node or edge id value, or let TypeGraph generate an id on create."
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
function asNodeId(value) {
|
|
29
|
+
assertNonEmptyId(value, "asNodeId");
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
function asEdgeId(value) {
|
|
33
|
+
assertNonEmptyId(value, "asEdgeId");
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
9
36
|
function isNodeType(value) {
|
|
10
37
|
return typeof value === "object" && value !== null && NODE_TYPE_BRAND in value && value[NODE_TYPE_BRAND] === true;
|
|
11
38
|
}
|
|
@@ -73,14 +100,14 @@ function readObjectShape(schema) {
|
|
|
73
100
|
}
|
|
74
101
|
function readEmbeddingIndex(schema) {
|
|
75
102
|
for (const candidate of unwrapChain(schema)) {
|
|
76
|
-
const config =
|
|
103
|
+
const config = chunkH7YNSMA7_cjs.getEmbeddingIndex(candidate);
|
|
77
104
|
if (config !== void 0) return config;
|
|
78
105
|
}
|
|
79
106
|
return void 0;
|
|
80
107
|
}
|
|
81
108
|
function readEmbeddingDimensions(schema) {
|
|
82
109
|
for (const candidate of unwrapChain(schema)) {
|
|
83
|
-
if (
|
|
110
|
+
if (chunkH7YNSMA7_cjs.isEmbeddingSchema(candidate)) {
|
|
84
111
|
return candidate._embeddingDimensions;
|
|
85
112
|
}
|
|
86
113
|
}
|
|
@@ -109,7 +136,7 @@ function validateConstraintNarrowing(name, edgeType, registration) {
|
|
|
109
136
|
const builtInFromNames = new Set(edgeType.from.map((node) => node.kind));
|
|
110
137
|
for (const fromNode of registration.from) {
|
|
111
138
|
if (!builtInFromNames.has(fromNode.kind)) {
|
|
112
|
-
throw new
|
|
139
|
+
throw new chunkLGEALRC6_cjs.ConfigurationError(
|
|
113
140
|
`Edge "${name}" registration has 'from' kind "${fromNode.kind}" not in edge's built-in domain: [${[...builtInFromNames].join(", ")}]`,
|
|
114
141
|
{
|
|
115
142
|
edgeName: name,
|
|
@@ -125,7 +152,7 @@ function validateConstraintNarrowing(name, edgeType, registration) {
|
|
|
125
152
|
const builtInToNames = new Set(edgeType.to.map((node) => node.kind));
|
|
126
153
|
for (const toNode of registration.to) {
|
|
127
154
|
if (!builtInToNames.has(toNode.kind)) {
|
|
128
|
-
throw new
|
|
155
|
+
throw new chunkLGEALRC6_cjs.ConfigurationError(
|
|
129
156
|
`Edge "${name}" registration has 'to' kind "${toNode.kind}" not in edge's built-in range: [${[...builtInToNames].join(", ")}]`,
|
|
130
157
|
{
|
|
131
158
|
edgeName: name,
|
|
@@ -201,7 +228,7 @@ function normalizeIndexes(inputs, nodes, edges) {
|
|
|
201
228
|
assertKindRegistered(declaration, edgeKinds, "edge");
|
|
202
229
|
}
|
|
203
230
|
if (seenNames.has(declaration.name)) {
|
|
204
|
-
throw new
|
|
231
|
+
throw new chunkLGEALRC6_cjs.ConfigurationError(
|
|
205
232
|
`Duplicate index name "${declaration.name}" in defineGraph({ indexes }). Index names must be unique within a graph.`,
|
|
206
233
|
{ indexName: declaration.name },
|
|
207
234
|
{
|
|
@@ -224,7 +251,7 @@ function assertKindRegistered(declaration, registeredKinds, entity) {
|
|
|
224
251
|
if (registeredKinds.has(declaration.kind)) return;
|
|
225
252
|
const slot = entity === "node" ? "nodes" : "edges";
|
|
226
253
|
const suggestion = entity === "node" ? `Add { ${declaration.kind}: { type: ${declaration.kind} } } to defineGraph({ nodes }) or remove the index from "indexes".` : `Register the edge in defineGraph({ edges }) or remove the index from "indexes".`;
|
|
227
|
-
throw new
|
|
254
|
+
throw new chunkLGEALRC6_cjs.ConfigurationError(
|
|
228
255
|
`Index "${declaration.name}" references ${entity} kind "${declaration.kind}" which is not registered in this graph's "${slot}".`,
|
|
229
256
|
{
|
|
230
257
|
indexName: declaration.name,
|
|
@@ -247,55 +274,96 @@ function isKnownKind(graph, name) {
|
|
|
247
274
|
return Object.hasOwn(graph.nodes, name) || Object.hasOwn(graph.edges, name);
|
|
248
275
|
}
|
|
249
276
|
|
|
250
|
-
// src/
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
{
|
|
262
|
-
issues: [
|
|
263
|
-
{
|
|
264
|
-
path: fieldName,
|
|
265
|
-
message: `Expected canonical UTC ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ), got: "${value}"`
|
|
266
|
-
}
|
|
267
|
-
]
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
suggestion: `Use a fixed-width UTC datetime like "2024-01-15T10:30:00.000Z" (e.g. new Date(value).toISOString()).`
|
|
271
|
-
}
|
|
272
|
-
);
|
|
277
|
+
// src/errors/validation.ts
|
|
278
|
+
function zodIssuesToValidationIssues(error) {
|
|
279
|
+
return error.issues.map((issue) => ({
|
|
280
|
+
path: issue.path.join("."),
|
|
281
|
+
message: issue.message,
|
|
282
|
+
code: issue.code
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
function buildLocationString(context) {
|
|
286
|
+
if (context.id) {
|
|
287
|
+
return `${context.kind}/${context.id}`;
|
|
273
288
|
}
|
|
274
|
-
return
|
|
289
|
+
return `new ${context.kind}`;
|
|
275
290
|
}
|
|
276
|
-
function
|
|
277
|
-
|
|
278
|
-
|
|
291
|
+
function validateProps(schema, props, context) {
|
|
292
|
+
const result = schema.safeParse(props);
|
|
293
|
+
if (result.success) {
|
|
294
|
+
return result.data;
|
|
295
|
+
}
|
|
296
|
+
const issues = zodIssuesToValidationIssues(result.error);
|
|
297
|
+
const location = buildLocationString(context);
|
|
298
|
+
throw new chunkLGEALRC6_cjs.ValidationError(
|
|
299
|
+
`Invalid ${context.entityType} props for ${location}: ${result.error.message}`,
|
|
300
|
+
{
|
|
301
|
+
entityType: context.entityType,
|
|
302
|
+
kind: context.kind,
|
|
303
|
+
operation: context.operation,
|
|
304
|
+
...context.id !== void 0 && { id: context.id },
|
|
305
|
+
issues
|
|
306
|
+
},
|
|
307
|
+
{ cause: result.error }
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
function validateNodeProps(schema, props, context) {
|
|
311
|
+
return validateProps(schema, props, {
|
|
312
|
+
entityType: "node",
|
|
313
|
+
...context
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
function validateEdgeProps(schema, props, context) {
|
|
317
|
+
return validateProps(schema, props, {
|
|
318
|
+
entityType: "edge",
|
|
319
|
+
...context
|
|
320
|
+
});
|
|
279
321
|
}
|
|
280
|
-
function
|
|
281
|
-
|
|
322
|
+
function wrapZodError(error, context) {
|
|
323
|
+
const issues = zodIssuesToValidationIssues(error);
|
|
324
|
+
const location = buildLocationString(context);
|
|
325
|
+
return new chunkLGEALRC6_cjs.ValidationError(
|
|
326
|
+
`Validation failed for ${context.entityType} ${location}: ${error.message}`,
|
|
327
|
+
{
|
|
328
|
+
entityType: context.entityType,
|
|
329
|
+
kind: context.kind,
|
|
330
|
+
operation: context.operation,
|
|
331
|
+
...context.id !== void 0 && { id: context.id },
|
|
332
|
+
issues
|
|
333
|
+
},
|
|
334
|
+
{ cause: error }
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
function createValidationError(message, issues, context) {
|
|
338
|
+
return new chunkLGEALRC6_cjs.ValidationError(message, {
|
|
339
|
+
...context?.entityType !== void 0 && {
|
|
340
|
+
entityType: context.entityType
|
|
341
|
+
},
|
|
342
|
+
...context?.kind !== void 0 && { kind: context.kind },
|
|
343
|
+
...context?.operation !== void 0 && { operation: context.operation },
|
|
344
|
+
...context?.id !== void 0 && { id: context.id },
|
|
345
|
+
issues
|
|
346
|
+
});
|
|
282
347
|
}
|
|
283
348
|
|
|
284
349
|
exports.EDGE_TYPE_BRAND = EDGE_TYPE_BRAND;
|
|
285
350
|
exports.NODE_TYPE_BRAND = NODE_TYPE_BRAND;
|
|
351
|
+
exports.asEdgeId = asEdgeId;
|
|
352
|
+
exports.asNodeId = asNodeId;
|
|
286
353
|
exports.autoDeriveVectorIndexes = autoDeriveVectorIndexes;
|
|
354
|
+
exports.createValidationError = createValidationError;
|
|
287
355
|
exports.defineGraph = defineGraph;
|
|
288
356
|
exports.getEdgeKinds = getEdgeKinds;
|
|
289
357
|
exports.getNodeKinds = getNodeKinds;
|
|
290
|
-
exports.isCanonicalIsoDate = isCanonicalIsoDate;
|
|
291
358
|
exports.isEdgeType = isEdgeType;
|
|
292
359
|
exports.isEdgeTypeWithEndpoints = isEdgeTypeWithEndpoints;
|
|
293
360
|
exports.isGraphDef = isGraphDef;
|
|
294
361
|
exports.isKnownKind = isKnownKind;
|
|
295
362
|
exports.isNodeType = isNodeType;
|
|
296
363
|
exports.mergeVectorIndexes = mergeVectorIndexes;
|
|
297
|
-
exports.
|
|
298
|
-
exports.
|
|
299
|
-
exports.
|
|
300
|
-
|
|
301
|
-
//# sourceMappingURL=chunk-
|
|
364
|
+
exports.validateEdgeProps = validateEdgeProps;
|
|
365
|
+
exports.validateNodeProps = validateNodeProps;
|
|
366
|
+
exports.validateProps = validateProps;
|
|
367
|
+
exports.wrapZodError = wrapZodError;
|
|
368
|
+
//# sourceMappingURL=chunk-VPYHY3LJ.cjs.map
|
|
369
|
+
//# sourceMappingURL=chunk-VPYHY3LJ.cjs.map
|