@nicia-ai/typegraph 0.32.0 → 0.34.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 +51 -0
- package/dist/backend/postgres/index.cjs +36 -19
- package/dist/backend/postgres/index.d.cts +6 -6
- package/dist/backend/postgres/index.d.ts +6 -6
- package/dist/backend/postgres/index.js +14 -9
- package/dist/backend/postgres/pglite.cjs +18 -13
- package/dist/backend/postgres/pglite.cjs.map +1 -1
- package/dist/backend/postgres/pglite.d.cts +3 -3
- package/dist/backend/postgres/pglite.d.ts +3 -3
- package/dist/backend/postgres/pglite.js +14 -9
- package/dist/backend/postgres/pglite.js.map +1 -1
- package/dist/backend/sqlite/index.cjs +34 -17
- package/dist/backend/sqlite/index.d.cts +7 -7
- package/dist/backend/sqlite/index.d.ts +7 -7
- package/dist/backend/sqlite/index.js +13 -8
- package/dist/backend/sqlite/libsql.cjs +19 -14
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +12 -5
- package/dist/backend/sqlite/libsql.d.ts +12 -5
- package/dist/backend/sqlite/libsql.js +15 -10
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +19 -14
- package/dist/backend/sqlite/local.cjs.map +1 -1
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +14 -9
- package/dist/backend/sqlite/local.js.map +1 -1
- package/dist/chunk-2EBMPJBO.js +16 -0
- package/dist/chunk-2EBMPJBO.js.map +1 -0
- package/dist/{chunk-CFNT3ITG.cjs → chunk-2JXB3NYJ.cjs} +15 -35
- package/dist/chunk-2JXB3NYJ.cjs.map +1 -0
- package/dist/chunk-2MRAX3UE.js +105 -0
- package/dist/chunk-2MRAX3UE.js.map +1 -0
- package/dist/{chunk-2LAT5BIK.cjs → chunk-3BRVBQQD.cjs} +2328 -3131
- package/dist/chunk-3BRVBQQD.cjs.map +1 -0
- package/dist/chunk-3E7SNSIA.cjs +55 -0
- package/dist/chunk-3E7SNSIA.cjs.map +1 -0
- package/dist/{chunk-FDN43KXV.cjs → chunk-3Z6TW3CT.cjs} +20 -19
- package/dist/chunk-3Z6TW3CT.cjs.map +1 -0
- package/dist/{chunk-IJORSAC3.js → chunk-4DIBPQNJ.js} +6 -4
- package/dist/chunk-4DIBPQNJ.js.map +1 -0
- package/dist/chunk-4S2FXGBJ.js +9 -0
- package/dist/chunk-4S2FXGBJ.js.map +1 -0
- package/dist/chunk-5IQIX7LU.cjs +2070 -0
- package/dist/chunk-5IQIX7LU.cjs.map +1 -0
- package/dist/{chunk-CWFPJ3RC.js → chunk-6GNSY7AV.js} +3 -3
- package/dist/{chunk-CWFPJ3RC.js.map → chunk-6GNSY7AV.js.map} +1 -1
- package/dist/{chunk-LAZGHOZW.cjs → chunk-6HVOHZHS.cjs} +184 -117
- package/dist/chunk-6HVOHZHS.cjs.map +1 -0
- package/dist/chunk-6SCVW4AS.js +20 -0
- package/dist/chunk-6SCVW4AS.js.map +1 -0
- package/dist/chunk-A7SZZFAG.js +2010 -0
- package/dist/chunk-A7SZZFAG.js.map +1 -0
- package/dist/chunk-ACSVZPK7.cjs +21 -0
- package/dist/chunk-ACSVZPK7.cjs.map +1 -0
- package/dist/{chunk-MXE2U3EX.js → chunk-BVTWD66D.js} +4 -115
- package/dist/chunk-BVTWD66D.js.map +1 -0
- package/dist/{chunk-W4ZX2GCP.js → chunk-CHXTTSC6.js} +5 -39
- package/dist/chunk-CHXTTSC6.js.map +1 -0
- package/dist/{chunk-XQFAJVYW.js → chunk-CYX2JTDG.js} +124 -5
- package/dist/chunk-CYX2JTDG.js.map +1 -0
- package/dist/{chunk-PRMKPFN5.js → chunk-DEQFL35G.js} +4 -3
- package/dist/chunk-DEQFL35G.js.map +1 -0
- package/dist/chunk-DI74SMXS.cjs +29 -0
- package/dist/chunk-DI74SMXS.cjs.map +1 -0
- package/dist/{chunk-WWVV44DY.cjs → chunk-G6SOJEDI.cjs} +11 -11
- package/dist/{chunk-WWVV44DY.cjs.map → chunk-G6SOJEDI.cjs.map} +1 -1
- package/dist/{chunk-LM2IC4ZJ.cjs → chunk-GQANNXXT.cjs} +15 -14
- package/dist/chunk-GQANNXXT.cjs.map +1 -0
- package/dist/chunk-GZCNZ7QW.js +24 -0
- package/dist/chunk-GZCNZ7QW.js.map +1 -0
- package/dist/{chunk-KTIEB7VH.cjs → chunk-HK5SATYM.cjs} +35 -58
- package/dist/chunk-HK5SATYM.cjs.map +1 -0
- package/dist/chunk-HMFK4BXR.cjs +12 -0
- package/dist/{chunk-6ZR4QC3O.cjs.map → chunk-HMFK4BXR.cjs.map} +1 -1
- package/dist/chunk-ITE4IXAK.js +25 -0
- package/dist/chunk-ITE4IXAK.js.map +1 -0
- package/dist/chunk-JJRCLAUN.cjs +155 -0
- package/dist/chunk-JJRCLAUN.cjs.map +1 -0
- package/dist/{chunk-ZFWNO3GE.cjs → chunk-JQGIPGVL.cjs} +66 -2
- package/dist/chunk-JQGIPGVL.cjs.map +1 -0
- package/dist/{chunk-2BVHPOIG.js → chunk-K2TGS3EN.js} +105 -38
- package/dist/chunk-K2TGS3EN.js.map +1 -0
- package/dist/chunk-K34OPSJK.js +29 -0
- package/dist/chunk-K34OPSJK.js.map +1 -0
- package/dist/{chunk-YW7GHMF4.cjs → chunk-KGC4LY5T.cjs} +18 -17
- package/dist/chunk-KGC4LY5T.cjs.map +1 -0
- package/dist/{chunk-SB65GJNY.cjs → chunk-KNHYNQQ3.cjs} +111 -72
- package/dist/chunk-KNHYNQQ3.cjs.map +1 -0
- package/dist/{chunk-C4C4Q7A6.js → chunk-KUTNI6SI.js} +6 -21
- package/dist/chunk-KUTNI6SI.js.map +1 -0
- package/dist/{chunk-NDM5PXEH.js → chunk-LANHCOXB.js} +44 -11
- package/dist/chunk-LANHCOXB.js.map +1 -0
- package/dist/chunk-N6WTUSBV.cjs +23 -0
- package/dist/chunk-N6WTUSBV.cjs.map +1 -0
- package/dist/{chunk-73KASJGO.cjs → chunk-NAUA4PW5.cjs} +4 -28
- package/dist/chunk-NAUA4PW5.cjs.map +1 -0
- package/dist/chunk-QV245VMN.js +145 -0
- package/dist/chunk-QV245VMN.js.map +1 -0
- package/dist/{chunk-CEF2QOTO.js → chunk-RBV7YCQD.js} +4 -3
- package/dist/chunk-RBV7YCQD.js.map +1 -0
- package/dist/chunk-RHZWOJVA.cjs +109 -0
- package/dist/chunk-RHZWOJVA.cjs.map +1 -0
- package/dist/{chunk-6RMLO5O4.cjs → chunk-RRKQAKD6.cjs} +13 -11
- package/dist/chunk-RRKQAKD6.cjs.map +1 -0
- package/dist/{chunk-TUA3MEJJ.js → chunk-RY2VIWAM.js} +612 -564
- package/dist/chunk-RY2VIWAM.js.map +1 -0
- package/dist/{chunk-PIHXFF73.js → chunk-SHLY4MCM.js} +3 -3
- package/dist/{chunk-PIHXFF73.js.map → chunk-SHLY4MCM.js.map} +1 -1
- package/dist/{chunk-HFBRAOF7.js → chunk-T2DWPQNE.js} +103 -64
- package/dist/chunk-T2DWPQNE.js.map +1 -0
- package/dist/{chunk-WYTUF3QO.js → chunk-T46GR2VY.js} +3 -3
- package/dist/{chunk-WYTUF3QO.js.map → chunk-T46GR2VY.js.map} +1 -1
- package/dist/{chunk-EEYV6UOE.cjs → chunk-T6SPUYLX.cjs} +5 -43
- package/dist/chunk-T6SPUYLX.cjs.map +1 -0
- package/dist/{chunk-3QRBXYT5.cjs → chunk-TGJE22RM.cjs} +6 -6
- package/dist/{chunk-3QRBXYT5.cjs.map → chunk-TGJE22RM.cjs.map} +1 -1
- package/dist/{chunk-YL4F3CMD.cjs → chunk-TOTPVGOG.cjs} +105 -72
- package/dist/chunk-TOTPVGOG.cjs.map +1 -0
- package/dist/{chunk-3HQDMOBK.cjs → chunk-UJLOZYKT.cjs} +680 -636
- package/dist/chunk-UJLOZYKT.cjs.map +1 -0
- package/dist/chunk-UNNPKQUG.cjs +1390 -0
- package/dist/chunk-UNNPKQUG.cjs.map +1 -0
- package/dist/chunk-UR7W5YQK.js +18 -0
- package/dist/chunk-UR7W5YQK.js.map +1 -0
- package/dist/chunk-V3QNTB7Z.js +1351 -0
- package/dist/chunk-V3QNTB7Z.js.map +1 -0
- package/dist/{chunk-XKNAK27R.js → chunk-VCGO4V26.js} +4 -3
- package/dist/chunk-VCGO4V26.js.map +1 -0
- package/dist/{chunk-YQGLVWB2.cjs → chunk-WL2SG7ZV.cjs} +6 -122
- package/dist/chunk-WL2SG7ZV.cjs.map +1 -0
- package/dist/{chunk-WNORITK6.js → chunk-WLRIWYHQ.js} +2041 -2834
- package/dist/chunk-WLRIWYHQ.js.map +1 -0
- package/dist/{chunk-JKRKIEVA.cjs → chunk-WVC2Q2FD.cjs} +128 -6
- package/dist/chunk-WVC2Q2FD.cjs.map +1 -0
- package/dist/chunk-XLUNB2TZ.js +53 -0
- package/dist/chunk-XLUNB2TZ.js.map +1 -0
- package/dist/chunk-XXVEULWX.js +39 -0
- package/dist/chunk-XXVEULWX.js.map +1 -0
- package/dist/chunk-YAZE7QZR.cjs +32 -0
- package/dist/chunk-YAZE7QZR.cjs.map +1 -0
- package/dist/chunk-YC6PWTHY.cjs +44 -0
- package/dist/chunk-YC6PWTHY.cjs.map +1 -0
- package/dist/chunk-Z5HBYM7U.cjs +11 -0
- package/dist/chunk-Z5HBYM7U.cjs.map +1 -0
- package/dist/{chunk-454I6GDF.js → chunk-Z5XBMDXU.js} +63 -3
- package/dist/chunk-Z5XBMDXU.js.map +1 -0
- package/dist/{chunk-CAMMC3E4.cjs → chunk-ZP5WHI4C.cjs} +109 -81
- package/dist/chunk-ZP5WHI4C.cjs.map +1 -0
- package/dist/{chunk-YCV72E6L.js → chunk-ZURTTSCM.js} +4 -25
- package/dist/chunk-ZURTTSCM.js.map +1 -0
- package/dist/{chunk-7WW3WL6E.js → chunk-ZV5N4DBG.js} +49 -21
- package/dist/chunk-ZV5N4DBG.js.map +1 -0
- package/dist/chunk-ZY4GXIVN.cjs +32 -0
- package/dist/chunk-ZY4GXIVN.cjs.map +1 -0
- package/dist/{ddl-C8e8zDAE.d.ts → ddl-BrmPg61z.d.ts} +3 -3
- package/dist/{ddl-CwyG4HoQ.d.cts → ddl-j1-sH6lE.d.cts} +3 -3
- package/dist/{extension-types-D1k0inWU.d.cts → extension-types-YGFJPrzK.d.cts} +1 -1
- package/dist/{extension-types-D1k0inWU.d.ts → extension-types-YGFJPrzK.d.ts} +1 -1
- package/dist/graph-extension/index.cjs +18 -17
- package/dist/graph-extension/index.d.cts +4 -4
- package/dist/graph-extension/index.d.ts +4 -4
- package/dist/graph-extension/index.js +3 -2
- package/dist/graph-merge/index.cjs +295 -146
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +6 -6
- package/dist/graph-merge/index.d.ts +6 -6
- package/dist/graph-merge/index.js +173 -24
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-BEK0VtNB.d.ts → index-DGX6D9j1.d.ts} +2 -2
- package/dist/{index-C8sSTErx.d.cts → index-SEvUHDA6.d.cts} +2 -2
- package/dist/index.cjs +206 -172
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -55
- package/dist/index.d.ts +25 -55
- package/dist/index.js +32 -22
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +28 -25
- package/dist/indexes/index.d.cts +5 -5
- package/dist/indexes/index.d.ts +5 -5
- package/dist/indexes/index.js +10 -7
- package/dist/interchange/index.cjs +25 -16
- package/dist/interchange/index.d.cts +5 -5
- package/dist/interchange/index.d.ts +5 -5
- package/dist/interchange/index.js +12 -3
- package/dist/{manager-8htmuGr-.d.ts → manager-BZUeN_BU.d.ts} +2 -2
- package/dist/{manager-aVgxbGt-.d.cts → manager-ms9cKdc6.d.cts} +2 -2
- package/dist/{materialize-indexes-CAGhqPHQ.d.ts → materialize-indexes-CAkIYFV-.d.ts} +1 -1
- package/dist/{materialize-indexes-DEYkU-wr.d.cts → materialize-indexes-D20xNluI.d.cts} +1 -1
- package/dist/{postgres-Dhom7iiX.d.ts → postgres-BhpxGMC5.d.cts} +2651 -596
- package/dist/{postgres-jgXmD45C.d.cts → postgres-CWHLwNl1.d.ts} +2651 -596
- package/dist/profiler/index.cjs +5 -4
- package/dist/profiler/index.cjs.map +1 -1
- package/dist/profiler/index.d.cts +7 -7
- package/dist/profiler/index.d.ts +7 -7
- package/dist/profiler/index.js +3 -2
- package/dist/profiler/index.js.map +1 -1
- package/dist/provenance/index.cjs +591 -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 +589 -0
- package/dist/provenance/index.js.map +1 -0
- package/dist/schema/index.cjs +37 -32
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +7 -7
- package/dist/schema/index.d.ts +7 -7
- package/dist/schema/index.js +14 -9
- package/dist/schema/index.js.map +1 -1
- package/dist/{sqlite-DcQ_BCUW.d.cts → sqlite-CGu5SLsw.d.ts} +2726 -455
- package/dist/{sqlite-BfLsCEqO.d.ts → sqlite-XrDxNaa7.d.cts} +2726 -455
- package/dist/{store-view-pBOUrQte.d.ts → store-view-BlgnhEYf.d.ts} +467 -131
- package/dist/{store-view-lTcb_cnp.d.cts → store-view-D09po4H6.d.cts} +467 -131
- package/dist/{types-DGDiXAYc.d.ts → types-B1TbZJYS.d.ts} +2 -2
- package/dist/{types-Dk8r09KY.d.ts → types-D1Sqeyxy.d.ts} +161 -26
- package/dist/{types-5RQwzWXx.d.cts → types-DiE1AO7p.d.cts} +2 -2
- package/dist/{types-Dvmn-eal.d.cts → types-DkNnF-7K.d.cts} +161 -26
- package/dist/{where-Cx_glEEB.d.cts → where-DKjuofPr.d.cts} +2 -2
- package/dist/{where-CHZFELX0.d.ts → where-DrUIIWHb.d.ts} +2 -2
- package/package.json +8 -2
- package/dist/chunk-2BVHPOIG.js.map +0 -1
- package/dist/chunk-2LAT5BIK.cjs.map +0 -1
- package/dist/chunk-2YMGNYXY.js +0 -40
- package/dist/chunk-2YMGNYXY.js.map +0 -1
- package/dist/chunk-3HQDMOBK.cjs.map +0 -1
- package/dist/chunk-454I6GDF.js.map +0 -1
- package/dist/chunk-6G35I3VW.cjs +0 -40
- package/dist/chunk-6G35I3VW.cjs.map +0 -1
- package/dist/chunk-6RMLO5O4.cjs.map +0 -1
- package/dist/chunk-6ZR4QC3O.cjs +0 -12
- package/dist/chunk-73KASJGO.cjs.map +0 -1
- package/dist/chunk-7WW3WL6E.js.map +0 -1
- package/dist/chunk-C4C4Q7A6.js.map +0 -1
- package/dist/chunk-CAMMC3E4.cjs.map +0 -1
- package/dist/chunk-CEF2QOTO.js.map +0 -1
- package/dist/chunk-CFNT3ITG.cjs.map +0 -1
- package/dist/chunk-EEYV6UOE.cjs.map +0 -1
- package/dist/chunk-FDN43KXV.cjs.map +0 -1
- package/dist/chunk-HFBRAOF7.js.map +0 -1
- package/dist/chunk-IJORSAC3.js.map +0 -1
- package/dist/chunk-JKRKIEVA.cjs.map +0 -1
- package/dist/chunk-KTIEB7VH.cjs.map +0 -1
- package/dist/chunk-LAZGHOZW.cjs.map +0 -1
- package/dist/chunk-LM2IC4ZJ.cjs.map +0 -1
- package/dist/chunk-M6OC455F.js +0 -65
- package/dist/chunk-M6OC455F.js.map +0 -1
- package/dist/chunk-MXE2U3EX.js.map +0 -1
- package/dist/chunk-NDM5PXEH.js.map +0 -1
- package/dist/chunk-PRMKPFN5.js.map +0 -1
- package/dist/chunk-RP7YITHX.cjs +0 -70
- package/dist/chunk-RP7YITHX.cjs.map +0 -1
- package/dist/chunk-SAJSMR2B.js +0 -35
- package/dist/chunk-SAJSMR2B.js.map +0 -1
- package/dist/chunk-SB65GJNY.cjs.map +0 -1
- package/dist/chunk-TUA3MEJJ.js.map +0 -1
- package/dist/chunk-W4ZX2GCP.js.map +0 -1
- package/dist/chunk-WNORITK6.js.map +0 -1
- package/dist/chunk-XKNAK27R.js.map +0 -1
- package/dist/chunk-XQFAJVYW.js.map +0 -1
- package/dist/chunk-YCV72E6L.js.map +0 -1
- package/dist/chunk-YL4F3CMD.cjs.map +0 -1
- package/dist/chunk-YQGLVWB2.cjs.map +0 -1
- package/dist/chunk-YW7GHMF4.cjs.map +0 -1
- package/dist/chunk-ZFWNO3GE.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,26 +1,36 @@
|
|
|
1
|
-
export { sqliteVecStrategy } from './chunk-
|
|
2
|
-
export { libsqlVectorStrategy } from './chunk-
|
|
3
|
-
export { pgvectorStrategy } from './chunk-
|
|
1
|
+
export { sqliteVecStrategy } from './chunk-VCGO4V26.js';
|
|
2
|
+
export { libsqlVectorStrategy } from './chunk-RBV7YCQD.js';
|
|
3
|
+
export { pgvectorStrategy } from './chunk-DEQFL35G.js';
|
|
4
|
+
import { LEGACY_EMBEDDINGS_TABLE_NAME } from './chunk-CYX2JTDG.js';
|
|
4
5
|
export { andWhere, notWhere, orWhere } from './chunk-A3W7QG7K.js';
|
|
5
|
-
|
|
6
|
-
export {
|
|
6
|
+
import './chunk-6GNSY7AV.js';
|
|
7
|
+
export { defineGraphExtension } from './chunk-T46GR2VY.js';
|
|
8
|
+
export { ExecutableAggregateQuery, ExecutableQuery, MAX_EXPLICIT_RECURSIVE_DEPTH, MAX_RECURSIVE_DEPTH, PreparedQuery, QueryBuilder, RecordedStoreView, StoreSearch, StoreView, UnionableQuery, avg, composeFragments, count, countDistinct, countDistinctEdges, countEdges, createFragment, createQueryBuilder, createStore, createStoreWithSchema, createVerifiedStore, defineSubgraphProject, field, having, havingEq, havingGt, havingGte, havingLt, havingLte, limitFragment, max, min, offsetFragment, orderByFragment, sum } from './chunk-WLRIWYHQ.js';
|
|
7
9
|
import './chunk-3EUKJEQ3.js';
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
import
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
import
|
|
18
|
-
import './chunk-
|
|
19
|
-
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
export {
|
|
23
|
-
|
|
10
|
+
import './chunk-QV245VMN.js';
|
|
11
|
+
import './chunk-6SCVW4AS.js';
|
|
12
|
+
import { META_EDGE_BRAND } from './chunk-K2TGS3EN.js';
|
|
13
|
+
export { broader, core, defineEdge, defineNode, differentFrom, disjointWith, equivalentTo, hasPart, implies, inverseOf, isMetaEdge, narrower, partOf, relatedTo, sameAs, subClassOf } from './chunk-K2TGS3EN.js';
|
|
14
|
+
import './chunk-UR7W5YQK.js';
|
|
15
|
+
export { defineGraph, getEdgeKinds, getNodeKinds, isEdgeType, isEdgeTypeWithEndpoints, isGraphDef, isNodeType } from './chunk-CHXTTSC6.js';
|
|
16
|
+
import './chunk-SHLY4MCM.js';
|
|
17
|
+
export { buildVectorCapabilities, fts5Strategy, tsvectorStrategy } from './chunk-KUTNI6SI.js';
|
|
18
|
+
export { defineEdgeIndex, defineNodeIndex } from './chunk-4DIBPQNJ.js';
|
|
19
|
+
import './chunk-K34OPSJK.js';
|
|
20
|
+
import './chunk-BVTWD66D.js';
|
|
21
|
+
export { CURRENT_GRAPH_EXTENSION_VERSION, GraphExtensionError, GraphExtensionUnresolvedEndpointError, GraphExtensionValidationError, GraphExtensionVersionUnsupportedError, IncompatibleChangeError, KindCollisionError, KindHasReferentsError, LEGACY_GRAPH_EXTENSION_VERSION, RemoveCompileTimeKindError, computeTransitiveClosure, invertClosure, isReachable, validateGraphExtension } from './chunk-ZURTTSCM.js';
|
|
22
|
+
import './chunk-4S2FXGBJ.js';
|
|
23
|
+
import { asCompiledRowsSql } from './chunk-A7SZZFAG.js';
|
|
24
|
+
export { DEFAULT_SQL_SCHEMA, asCompiledRowsSql, asCompiledSelectSql, asCompiledStatementSql, asRecordedInstant, createSqlSchema, generateId, recordedRelation } from './chunk-A7SZZFAG.js';
|
|
25
|
+
export { exists, fieldRef, inSubquery, isParameterRef, notExists, notInSubquery, param } from './chunk-V3QNTB7Z.js';
|
|
26
|
+
import './chunk-XXVEULWX.js';
|
|
27
|
+
import { isMissingTableError } from './chunk-2MRAX3UE.js';
|
|
28
|
+
import { quotedTableName } from './chunk-GZCNZ7QW.js';
|
|
29
|
+
import './chunk-2EBMPJBO.js';
|
|
30
|
+
import { DEFAULT_EMBEDDING_INDEX_TYPE, DEFAULT_EMBEDDING_METRIC } from './chunk-Z5XBMDXU.js';
|
|
31
|
+
export { DEFAULT_SEARCHABLE_LANGUAGE, embedding, getEmbeddingDimensions, getSearchableMetadata, isEmbeddingSchema, isSearchableSchema, searchable } from './chunk-Z5XBMDXU.js';
|
|
32
|
+
import './chunk-XLUNB2TZ.js';
|
|
33
|
+
import './chunk-ITE4IXAK.js';
|
|
24
34
|
import { EmbeddingDimensionChangedError } from './chunk-TQOYM4LN.js';
|
|
25
35
|
export { BackendDisposedError, CardinalityError, CompilerInvariantError, ConfigurationError, DatabaseOperationError, DisjointError, EagerMaterializationError, EdgeNotFoundError, EmbeddingDimensionChangedError, EndpointError, EndpointNotFoundError, KindNotFoundError, MigrationError, NodeConstraintNotFoundError, NodeIndexNotFoundError, NodeNotFoundError, RestrictedDeleteError, SchemaContentConflictError, SchemaMismatchError, StaleVersionError, StoreNotInitializedError, TypeGraphError, UniquenessError, UnsupportedPredicateError, ValidationError, VersionConflictError, getErrorSuggestion, isConstraintError, isSystemError, isTypeGraphError, isUserRecoverable } from './chunk-TQOYM4LN.js';
|
|
26
36
|
export { MAX_JSON_POINTER_DEPTH, joinJsonPointers, jsonPointer, normalizeJsonPointer, parseJsonPointer } from './chunk-K5P5OZXS.js';
|
|
@@ -191,7 +201,7 @@ async function readLegacyBatch(backend, params) {
|
|
|
191
201
|
ORDER BY "graph_id" ASC, "node_kind" ASC, "node_id" ASC, "field_path" ASC
|
|
192
202
|
LIMIT ${params.batchSize}
|
|
193
203
|
`;
|
|
194
|
-
return backend.execute(query);
|
|
204
|
+
return backend.execute(asCompiledRowsSql(query));
|
|
195
205
|
}
|
|
196
206
|
function keysetAfterCondition(after) {
|
|
197
207
|
return sql`
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/meta-edge.ts","../src/core/external-ref.ts","../src/backend/migrate-vectors.ts"],"names":["embedding"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CO,SAAS,QAAA,CACd,IAAA,EACA,OAAA,GAA2B,EAAC,EACf;AACb,EAAA,MAAM,UAAA,GAAiC;AAAA,IACrC,UAAA,EAAY,QAAQ,UAAA,IAAc,KAAA;AAAA,IAClC,SAAA,EAAW,QAAQ,SAAA,IAAa,KAAA;AAAA,IAChC,SAAA,EAAW,QAAQ,SAAA,IAAa,KAAA;AAAA,IAChC,SAAS,OAAA,CAAQ,OAAA;AAAA,IACjB,SAAA,EAAW,QAAQ,SAAA,IAAa,MAAA;AAAA,IAChC,aAAa,OAAA,CAAQ;AAAA,GACvB;AAEA,EAAA,OAAO,OAAO,MAAA,CAAO;AAAA,IACnB,CAAC,eAAe,GAAG,IAAA;AAAA,IACnB,IAAA;AAAA,IACA;AAAA,GACD,CAAA;AACH;AC/CO,IAAM,sBAAA,GAAyB,mBAAA;AA6E/B,SAAS,YAA8B,KAAA,EAAgC;AAC5E,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,CAAM,WAAW,CAAA,EAAG;AACnD,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,0DAAA,EAA6D,OAAO,KAAA,KAAU,QAAA,GAAW,IAAI,KAAK,CAAA,CAAA,CAAA,GAAM,OAAO,KAAK,CAAA;AAAA,KACtH;AAAA,EACF;AAEA,EAAA,MAAM,MAAA,GAAS,EAAE,MAAA,CAAO;AAAA,IACtB,KAAA,EAAO,CAAA,CAAE,OAAA,CAAQ,KAAK,CAAA;AAAA,IACtB,IAAI,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,CA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A,MAAW,CAAC,KAAA,EAAO,KAAK,CAAA,IAAK,MAAA,CAAO,SAAQ,EAAG;AAC7C,IAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,MAAA,CAAO,QAAA,CAAS,KAAK,CAAA,EAAG;AACxD,MAAA,MAAM,IAAI,SAAA;AAAA,QACR,wBAAwB,GAAA,CAAI,SAAS,CAAA,CAAA,EAAI,GAAA,CAAI,UAAU,CAAA,QAAA,EAC3C,GAAA,CAAI,QAAQ,CAAA,OAAA,EAAU,IAAI,OAAO,CAAA,kCAAA,EACzB,KAAK,CAAA,EAAA,EAAK,MAAA,CAAO,KAAK,CAAC,CAAA,CAAA;AAAA,OAC7C;AAAA,IACF;AAAA,EACF;AACA,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["import {\n type InferenceType,\n META_EDGE_BRAND,\n type MetaEdge,\n type MetaEdgeProperties,\n} from \"../ontology/types\";\n\n// ============================================================\n// Meta-Edge Factory Options\n// ============================================================\n\n/**\n * Options for creating a meta-edge.\n */\nexport type MetaEdgeOptions = Readonly<{\n /** Whether the relationship is transitive (A→B, B→C implies A→C) */\n transitive?: boolean;\n /** Whether the relationship is symmetric (A→B implies B→A) */\n symmetric?: boolean;\n /** Whether the relationship is reflexive (A→A is always true) */\n reflexive?: boolean;\n /** Name of the inverse meta-edge */\n inverse?: string;\n /** How this meta-edge affects queries and validation */\n inference?: InferenceType;\n /** Optional description */\n description?: string;\n}>;\n\n// ============================================================\n// Meta-Edge Factory\n// ============================================================\n\n/**\n * Creates a custom meta-edge definition.\n *\n * @example\n * ```typescript\n * // Custom meta-edge for regulatory relationships\n * const regulatedBy = metaEdge(\"regulatedBy\", {\n * description: \"Type X is regulated by authority type Y\",\n * transitive: false,\n * symmetric: false,\n * });\n * ```\n */\nexport function metaEdge<K extends string>(\n name: K,\n options: MetaEdgeOptions = {},\n): MetaEdge<K> {\n const properties: MetaEdgeProperties = {\n transitive: options.transitive ?? false,\n symmetric: options.symmetric ?? false,\n reflexive: options.reflexive ?? false,\n inverse: options.inverse,\n inference: options.inference ?? \"none\",\n description: options.description,\n };\n\n return Object.freeze({\n [META_EDGE_BRAND]: true as const,\n name,\n properties,\n });\n}\n","/**\n * External reference type for hybrid overlay patterns.\n *\n * Creates a Zod-compatible schema for referencing entities in external\n * data sources (e.g., existing application tables) from TypeGraph nodes.\n */\nimport { z } from \"zod\";\n\n// ============================================================\n// External Reference Metadata Symbol\n// ============================================================\n\n/**\n * Symbol key for storing external table name on the schema.\n * This allows the schema introspector to detect external reference types\n * and extract source information.\n */\nexport const EXTERNAL_REF_TABLE_KEY = \"_externalRefTable\" as const;\n\n// ============================================================\n// External Reference Value Type\n// ============================================================\n\n/**\n * The shape of an external reference value.\n * Contains the source table identifier and the ID of the referenced record.\n */\nexport type ExternalRefValue<T extends string = string> = Readonly<{\n table: T;\n id: string;\n}>;\n\n// ============================================================\n// External Reference Schema Type\n// ============================================================\n\n/**\n * A Zod schema for external references with attached table metadata.\n */\nexport type ExternalRefSchema<T extends string = string> = z.ZodType<\n ExternalRefValue<T>\n> &\n Readonly<{\n [EXTERNAL_REF_TABLE_KEY]: T;\n }>;\n\n// ============================================================\n// External Reference Factory\n// ============================================================\n\n/**\n * Creates a Zod schema for referencing external data sources.\n *\n * Use this when building a hybrid overlay where TypeGraph stores\n * graph relationships and metadata while your existing tables\n * remain the source of truth for entity data.\n *\n * @param table - The identifier for the external table/source (e.g., \"users\", \"documents\")\n * @returns A Zod schema that validates external reference objects\n *\n * @example\n * ```typescript\n * import { defineNode, externalRef, embedding } from \"@nicia-ai/typegraph\";\n *\n * // Reference documents from your existing application database\n * const Document = defineNode(\"Document\", {\n * schema: z.object({\n * source: externalRef(\"documents\"),\n * embedding: embedding(1536).optional(),\n * extractedTopics: z.array(z.string()).optional(),\n * }),\n * });\n *\n * // Create a node referencing an external document\n * await store.nodes.Document.create({\n * source: { table: \"documents\", id: \"doc_abc123\" },\n * embedding: await generateEmbedding(docContent),\n * });\n *\n * // Query and hydrate with external data\n * const results = await store\n * .query()\n * .from(\"Document\", \"d\")\n * .whereNode(\"d\", (d) => d.embedding.similarTo(query, 10))\n * .select((ctx) => ctx.d.source)\n * .execute();\n *\n * // Fetch full data from your app database\n * const externalIds = results.map((r) => r.id);\n * const fullDocs = await appDb.query.documents.findMany({\n * where: inArray(documents.id, externalIds),\n * });\n * ```\n */\nexport function externalRef<T extends string>(table: T): ExternalRefSchema<T> {\n if (typeof table !== \"string\" || table.length === 0) {\n throw new Error(\n `External reference table must be a non-empty string, got: ${typeof table === \"string\" ? `\"${table}\"` : typeof table}`,\n );\n }\n\n const schema = z.object({\n table: z.literal(table),\n id: z.string().min(1, \"External reference ID must be non-empty\"),\n });\n\n // Attach table metadata for introspection\n return Object.assign(schema, {\n [EXTERNAL_REF_TABLE_KEY]: table,\n });\n}\n\n// ============================================================\n// Type Guards\n// ============================================================\n\n/**\n * Checks if a value is an external reference schema.\n */\nexport function isExternalRefSchema(\n value: unknown,\n): value is ExternalRefSchema {\n return (\n typeof value === \"object\" &&\n value !== null &&\n EXTERNAL_REF_TABLE_KEY in value &&\n typeof (value as Record<string, unknown>)[EXTERNAL_REF_TABLE_KEY] ===\n \"string\"\n );\n}\n\n/**\n * Gets the table name from an external reference schema.\n * Returns undefined if the schema is not an external reference schema.\n */\nexport function getExternalRefTable(schema: z.ZodType): string | undefined {\n if (isExternalRefSchema(schema)) {\n return schema[EXTERNAL_REF_TABLE_KEY];\n }\n return undefined;\n}\n\n// ============================================================\n// Helper for creating reference values\n// ============================================================\n\n/**\n * Helper function to create a typed external reference value.\n * Useful when you want to avoid repeating the table name.\n *\n * @example\n * ```typescript\n * const docRef = createExternalRef(\"documents\");\n *\n * await store.nodes.Document.create({\n * source: docRef(\"doc_123\"),\n * embedding: [...],\n * });\n * ```\n */\nexport function createExternalRef<T extends string>(\n table: T,\n): (id: string) => ExternalRefValue<T> {\n return (id: string) => ({ table, id });\n}\n","/**\n * One-time offline migration: legacy shared embeddings table → per-field\n * strategy storage.\n *\n * ## What this is for\n *\n * The cross-backend vector cutover (#157) dropped the single shared\n * `typegraph_node_embeddings` table. Each\n * `VectorStrategy` now OWNS one typed, fixed-dimension structure per\n * `(nodeKind, fieldPath)` — the only layout that can be ANN-indexed on\n * libSQL and sqlite-vec, not just pgvector.\n *\n * Deployments that wrote embeddings under the old shared table before\n * upgrading still hold those rows. This utility drains them into the new\n * per-field storage **once**, during the upgrade, so existing embedded\n * data survives the cutover without re-embedding from source.\n *\n * It is an explicitly-run, offline step — not wired into `materializeIndexes`\n * or any boot path. Run it once after deploying the new version and before\n * (or alongside) the first `materializeIndexes()`, then drop the legacy\n * table at your leisure.\n *\n * ## How it works\n *\n * - Skips cleanly (returns a zero summary) when the legacy table is absent —\n * a fresh install, or a re-run after the table was dropped.\n * - Reads rows in keyset-paginated batches (never the whole table at once),\n * decoding the engine-native embedding column to a numeric array at the SQL\n * level: sqlite-vec stored a `vec_f32` blob (`vec_to_json` decodes it);\n * pgvector stored a native `vector` (`::text` yields a `[…]` literal).\n * - Re-inserts each row through `backend.upsertEmbedding`, which routes the\n * active strategy's `buildUpsert` and idempotently provisions the per-field\n * storage (the same `(nodeKind, fieldPath)` slot a fresh store write uses).\n * The migration stays graph-agnostic and execution-correct on both the\n * sync (better-sqlite3) and async (libsql / Postgres) backends — it does\n * not re-implement the backend's statement-execution glue.\n *\n * Idempotent and resumable: a partial run followed by a full run converges\n * to the same per-field tables, because every write is an upsert keyed by\n * `(graph_id, node_id)` in the strategy's owned storage.\n */\nimport { type SQL, sql } from \"drizzle-orm\";\n\nimport {\n DEFAULT_EMBEDDING_INDEX_TYPE,\n DEFAULT_EMBEDDING_METRIC,\n type EmbeddingIndexType,\n type EmbeddingMetric,\n} from \"../core/embedding\";\nimport { EmbeddingDimensionChangedError } from \"../errors\";\nimport { isMissingTableError } from \"../utils/sql-errors\";\nimport { quotedTableName } from \"./drizzle/operations/shared\";\nimport { LEGACY_EMBEDDINGS_TABLE_NAME } from \"./drizzle/schema/sqlite\";\nimport { type GraphBackend } from \"./types\";\n\n/**\n * Default rows read per round-trip. Large enough to amortize round-trip\n * latency, small enough to bound peak memory regardless of table size.\n */\nconst DEFAULT_BATCH_SIZE = 500;\n\n/**\n * Metric / index type applied to a migrated field when no\n * {@link MigrateLegacyEmbeddingsOptions.resolveSlotConfig} is supplied (or\n * it returns `undefined`). Matches the defaults `embedding()` and\n * `resolveEmbeddingFields` apply, so a migrated field lands in storage shaped\n * identically to one written fresh through the store. Migrated data is only\n * ever brute-forceable until `materializeIndexes()` builds the ANN index, so\n * the index-type default governs only which ANN structure the per-field\n * storage DDL provisions, not the migration's correctness.\n */\nconst DEFAULT_SLOT_METRIC: EmbeddingMetric = DEFAULT_EMBEDDING_METRIC;\nconst DEFAULT_SLOT_INDEX_TYPE: EmbeddingIndexType =\n DEFAULT_EMBEDDING_INDEX_TYPE;\n\n/**\n * The resolved storage config for one `(nodeKind, fieldPath)` slot that the\n * legacy table did not record. The legacy shared table stored only the\n * vector and its dimension count — not the metric or index type — so a\n * caller that wants migrated fields to match a specific graph's `embedding()`\n * declarations supplies this resolver.\n */\nexport type LegacyEmbeddingSlotConfig = Readonly<{\n metric: EmbeddingMetric;\n indexType: EmbeddingIndexType;\n}>;\n\n/**\n * Options for {@link migrateLegacyEmbeddings}.\n */\nexport type MigrateLegacyEmbeddingsOptions = Readonly<{\n /**\n * The backend to migrate, wired with the destination `VectorStrategy`\n * (i.e. the post-cutover backend). Its `vectorStrategy` owns the per-field\n * storage rows are written into and its `upsertEmbedding` performs the\n * writes.\n */\n backend: GraphBackend;\n\n /**\n * Restrict the migration to a single graph. When omitted, every graph's\n * rows in the legacy table are migrated (the table is graph-scoped by its\n * `graph_id` column).\n */\n graphId?: string;\n\n /**\n * Resolves the metric / index type for a `(nodeKind, fieldPath)` slot the\n * legacy table didn't persist. Return `undefined` to fall back to the\n * cosine / hnsw defaults. Supply this (typically reading the graph's\n * `embedding()` declarations) when migrated fields must match a specific\n * metric — e.g. an `l2` field, which scores incorrectly under the cosine\n * default.\n */\n resolveSlotConfig?: (\n nodeKind: string,\n fieldPath: string,\n ) => LegacyEmbeddingSlotConfig | undefined;\n\n /** Rows read per round-trip. Defaults to {@link DEFAULT_BATCH_SIZE}. */\n batchSize?: number;\n\n /**\n * Physical name of the legacy table to drain. Defaults to\n * {@link LEGACY_EMBEDDINGS_TABLE_NAME}. Override only for a non-default\n * deployment that renamed the embeddings table.\n */\n legacyTableName?: string;\n}>;\n\n/**\n * Summary of a {@link migrateLegacyEmbeddings} run.\n */\nexport type MigrateLegacyEmbeddingsResult = Readonly<{\n /** Total embedding rows re-inserted into per-field storage. */\n migrated: number;\n /**\n * Per-`(nodeKind, fieldPath)` counts, keyed `\"<nodeKind>.<fieldPath>\"`\n * (the strategy's logical-slot key form). Empty when the legacy table was\n * absent or held no rows for the requested scope.\n */\n perField: Readonly<Record<string, number>>;\n /**\n * Rows skipped because their vector length didn't match the per-field\n * table's fixed dimension. The legacy shared column allowed mixed\n * dimensions for one `(nodeKind, fieldPath)` (e.g. an unmigrated model\n * change); the first migrated row fixes the typed table's dimension and\n * any differently-sized rows for that slot are skipped rather than aborting\n * the whole migration. Keyed `\"<nodeKind>.<fieldPath>\"`. Non-empty here\n * means those fields need a deliberate re-embed at a single dimension.\n */\n skippedDimensionMismatch: Readonly<Record<string, number>>;\n /**\n * Rows skipped because their legacy embedding could not be decoded into a\n * finite-number array — a corrupt value (e.g. a pgvector `vector` column\n * permits `NaN`/`Infinity`, which is not valid JSON). Keyed\n * `\"<nodeKind>.<fieldPath>\"`. Skipping + reporting keeps one bad row from\n * aborting the whole migration; non-empty here means those rows need manual\n * repair.\n */\n skippedDecodeError: Readonly<Record<string, number>>;\n /**\n * Whether the legacy table existed. `false` means the run was a clean\n * no-op (fresh install, or already-dropped table on a re-run).\n */\n legacyTablePresent: boolean;\n}>;\n\n/**\n * A single legacy embedding row, with the engine-native vector already\n * decoded to a JSON array string by the dialect-specific SELECT. The\n * legacy `dimensions` column is intentionally not read: the decoded array's\n * length is the authoritative fixed dimension for the destination slot, and\n * relying on it sidesteps the per-driver string/number coercion the legacy\n * integer column would otherwise need.\n */\ntype LegacyEmbeddingRow = Readonly<{\n graph_id: string;\n node_kind: string;\n node_id: string;\n field_path: string;\n /** JSON array text, e.g. `\"[0.1,0.2,0.3]\"` — decoded per dialect. */\n embedding_json: string;\n}>;\n\n/**\n * Re-inserts every embedding from the legacy shared\n * `typegraph_node_embeddings` table into the active\n * `backend.vectorStrategy`'s per-`(nodeKind, fieldPath)` storage.\n *\n * One-time, explicitly-run upgrade step for the shared-table → per-field\n * cutover (#157). Idempotent, batched, and a clean no-op when the legacy\n * table is absent. See the module doc comment for the full contract.\n *\n * @throws Error when the backend exposes no `vectorStrategy` /\n * `upsertEmbedding` (nothing to migrate *into*) — a configuration\n * error the caller must fix by wiring the destination strategy\n * before migrating.\n */\nexport async function migrateLegacyEmbeddings(\n options: MigrateLegacyEmbeddingsOptions,\n): Promise<MigrateLegacyEmbeddingsResult> {\n const {\n backend,\n graphId,\n resolveSlotConfig,\n batchSize = DEFAULT_BATCH_SIZE,\n legacyTableName = LEGACY_EMBEDDINGS_TABLE_NAME,\n } = options;\n\n if (\n backend.vectorStrategy === undefined ||\n backend.upsertEmbedding === undefined\n ) {\n throw new Error(\n \"migrateLegacyEmbeddings requires a backend wired with a vectorStrategy \" +\n \"(the destination per-field storage). Pass the post-cutover backend.\",\n );\n }\n if (!Number.isInteger(batchSize) || batchSize <= 0) {\n throw new RangeError(\n `batchSize must be a positive integer, got: ${batchSize}`,\n );\n }\n const upsertEmbedding = backend.upsertEmbedding;\n\n const perField: Record<string, number> = {};\n const skippedDimensionMismatch: Record<string, number> = {};\n const skippedDecodeError: Record<string, number> = {};\n let migrated = 0;\n\n let cursor: LegacyRowCursor | undefined;\n for (;;) {\n let batch: readonly LegacyEmbeddingRow[];\n try {\n batch = await readLegacyBatch(backend, {\n legacyTableName,\n graphId,\n batchSize,\n after: cursor,\n });\n } catch (error) {\n // A missing legacy table is the expected \"nothing to migrate\" path on\n // the first read — surface it as a clean no-op, not a failure.\n if (cursor === undefined && isMissingTableError(error)) {\n return {\n migrated: 0,\n perField: {},\n skippedDimensionMismatch: {},\n skippedDecodeError: {},\n legacyTablePresent: false,\n };\n }\n throw error;\n }\n\n if (batch.length === 0) break;\n\n for (const row of batch) {\n const slotKey = `${row.node_kind}.${row.field_path}`;\n\n let embedding: readonly number[];\n try {\n embedding = decodeEmbeddingJson(row);\n } catch {\n // A corrupt legacy value (e.g. a pgvector `vector` column permits\n // NaN/Infinity, which is not valid JSON) is skipped + reported rather\n // than aborting the whole migration on one bad row.\n skippedDecodeError[slotKey] = (skippedDecodeError[slotKey] ?? 0) + 1;\n continue;\n }\n const config = resolveSlotConfig?.(row.node_kind, row.field_path);\n\n try {\n await upsertEmbedding({\n graphId: row.graph_id,\n nodeKind: row.node_kind,\n nodeId: row.node_id,\n fieldPath: row.field_path,\n embedding,\n // The decoded length is the authoritative fixed dimension — the\n // strategy provisions its column type (e.g. `F32_BLOB(N)`) from it.\n dimensions: embedding.length,\n metric: config?.metric ?? DEFAULT_SLOT_METRIC,\n indexType: config?.indexType ?? DEFAULT_SLOT_INDEX_TYPE,\n });\n } catch (error) {\n // The legacy shared column allowed mixed dimensions for one\n // (nodeKind, fieldPath); the per-field table is fixed at the first\n // migrated row's dimension, so a differently-sized row is skipped and\n // reported rather than aborting the whole migration.\n if (error instanceof EmbeddingDimensionChangedError) {\n skippedDimensionMismatch[slotKey] =\n (skippedDimensionMismatch[slotKey] ?? 0) + 1;\n continue;\n }\n throw error;\n }\n\n migrated += 1;\n perField[slotKey] = (perField[slotKey] ?? 0) + 1;\n }\n\n if (batch.length < batchSize) break;\n const last = batch.at(-1)!;\n cursor = {\n graphId: last.graph_id,\n nodeKind: last.node_kind,\n nodeId: last.node_id,\n fieldPath: last.field_path,\n };\n }\n\n return {\n migrated,\n perField,\n skippedDimensionMismatch,\n skippedDecodeError,\n legacyTablePresent: true,\n };\n}\n\n/**\n * Composite keyset cursor over the legacy table's primary key\n * `(graph_id, node_kind, node_id, field_path)`. Stable under concurrent\n * writes and immune to OFFSET drift, so a batched walk reads every row once.\n */\ntype LegacyRowCursor = Readonly<{\n graphId: string;\n nodeKind: string;\n nodeId: string;\n fieldPath: string;\n}>;\n\ntype ReadLegacyBatchParams = Readonly<{\n legacyTableName: string;\n graphId: string | undefined;\n batchSize: number;\n after: LegacyRowCursor | undefined;\n}>;\n\n/**\n * Reads one keyset-paginated batch of legacy rows, ordered by the primary\n * key, with the engine-native embedding column decoded to a JSON array\n * string by the dialect.\n */\nasync function readLegacyBatch(\n backend: GraphBackend,\n params: ReadLegacyBatchParams,\n): Promise<readonly LegacyEmbeddingRow[]> {\n const table = quotedTableName(params.legacyTableName);\n const embeddingJson = legacyEmbeddingDecodeExpression(backend);\n\n const conditions: SQL[] = [];\n if (params.graphId !== undefined) {\n conditions.push(sql`\"graph_id\" = ${params.graphId}`);\n }\n if (params.after !== undefined) {\n conditions.push(keysetAfterCondition(params.after));\n }\n\n const whereClause =\n conditions.length === 0 ?\n sql``\n : sql` WHERE ${sql.join(conditions, sql` AND `)}`;\n\n const query = sql`\n SELECT\n \"graph_id\" AS graph_id,\n \"node_kind\" AS node_kind,\n \"node_id\" AS node_id,\n \"field_path\" AS field_path,\n ${embeddingJson} AS embedding_json\n FROM ${table}${whereClause}\n ORDER BY \"graph_id\" ASC, \"node_kind\" ASC, \"node_id\" ASC, \"field_path\" ASC\n LIMIT ${params.batchSize}\n `;\n\n return backend.execute<LegacyEmbeddingRow>(query);\n}\n\n/**\n * The strict `>` comparison over the composite primary key, expressed as\n * the standard lexicographic OR-chain so it works on every dialect (SQLite\n * supports row-value comparison, but Postgres + SQLite both accept this\n * portable form).\n */\nfunction keysetAfterCondition(after: LegacyRowCursor): SQL {\n return sql`\n (\n \"graph_id\" > ${after.graphId}\n OR (\"graph_id\" = ${after.graphId} AND \"node_kind\" > ${after.nodeKind})\n OR (\"graph_id\" = ${after.graphId} AND \"node_kind\" = ${after.nodeKind} AND \"node_id\" > ${after.nodeId})\n OR (\n \"graph_id\" = ${after.graphId}\n AND \"node_kind\" = ${after.nodeKind}\n AND \"node_id\" = ${after.nodeId}\n AND \"field_path\" > ${after.fieldPath}\n )\n )\n `;\n}\n\n/**\n * The SQL expression that decodes the legacy engine-native embedding column\n * into a JSON array string `embedding_json`. The single dialect branch in\n * this whole module: the legacy storage formats are genuinely engine-\n * specific, and there is no longer a strategy abstraction over the *legacy*\n * table to delegate to.\n */\nfunction legacyEmbeddingDecodeExpression(backend: GraphBackend): SQL {\n switch (backend.dialect) {\n case \"sqlite\": {\n // Legacy SQLite embeddings were written via `vec_f32('[…]')`\n // (sqlite-vec binary). `vec_to_json` is its inverse, yielding the\n // JSON array text. Requires sqlite-vec on the connection — which the\n // legacy write path also required, so any deployment with legacy rows\n // has it loaded.\n return sql`vec_to_json(\"embedding\")`;\n }\n case \"postgres\": {\n // pgvector's native `vector` casts to its `[…]` text literal, which is\n // valid JSON for `JSON.parse`.\n return sql`\"embedding\"::text`;\n }\n default: {\n const _exhaustive: never = backend.dialect;\n throw new Error(\n `migrateLegacyEmbeddings does not support dialect: ${String(_exhaustive)}`,\n );\n }\n }\n}\n\n/**\n * Parses a decoded `embedding_json` array, asserting it is a non-empty array\n * of finite numbers. A bad decode (wrong type, NaN) names the offending row\n * loudly instead of writing a corrupt vector into per-field storage.\n */\nfunction decodeEmbeddingJson(row: LegacyEmbeddingRow): readonly number[] {\n let parsed: unknown;\n try {\n parsed = JSON.parse(row.embedding_json) as unknown;\n } catch (error) {\n throw new Error(\n `Failed to decode legacy embedding for ${row.node_kind}.${row.field_path} ` +\n `(graph ${row.graph_id}, node ${row.node_id}): not valid JSON.`,\n { cause: error },\n );\n }\n if (!Array.isArray(parsed) || parsed.length === 0) {\n throw new Error(\n `Legacy embedding for ${row.node_kind}.${row.field_path} ` +\n `(graph ${row.graph_id}, node ${row.node_id}) decoded to a non-array ` +\n `or empty value.`,\n );\n }\n for (const [index, value] of parsed.entries()) {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n throw new TypeError(\n `Legacy embedding for ${row.node_kind}.${row.field_path} ` +\n `(graph ${row.graph_id}, node ${row.node_id}) has a non-finite ` +\n `value at index ${index}: ${String(value)}.`,\n );\n }\n }\n return parsed as readonly number[];\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/meta-edge.ts","../src/core/external-ref.ts","../src/backend/migrate-vectors.ts"],"names":["embedding"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CO,SAAS,QAAA,CACd,IAAA,EACA,OAAA,GAA2B,EAAC,EACf;AACb,EAAA,MAAM,UAAA,GAAiC;AAAA,IACrC,UAAA,EAAY,QAAQ,UAAA,IAAc,KAAA;AAAA,IAClC,SAAA,EAAW,QAAQ,SAAA,IAAa,KAAA;AAAA,IAChC,SAAA,EAAW,QAAQ,SAAA,IAAa,KAAA;AAAA,IAChC,SAAS,OAAA,CAAQ,OAAA;AAAA,IACjB,SAAA,EAAW,QAAQ,SAAA,IAAa,MAAA;AAAA,IAChC,aAAa,OAAA,CAAQ;AAAA,GACvB;AAEA,EAAA,OAAO,OAAO,MAAA,CAAO;AAAA,IACnB,CAAC,eAAe,GAAG,IAAA;AAAA,IACnB,IAAA;AAAA,IACA;AAAA,GACD,CAAA;AACH;AC/CO,IAAM,sBAAA,GAAyB,mBAAA;AA6E/B,SAAS,YAA8B,KAAA,EAAgC;AAC5E,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,CAAM,WAAW,CAAA,EAAG;AACnD,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,0DAAA,EAA6D,OAAO,KAAA,KAAU,QAAA,GAAW,IAAI,KAAK,CAAA,CAAA,CAAA,GAAM,OAAO,KAAK,CAAA;AAAA,KACtH;AAAA,EACF;AAEA,EAAA,MAAM,MAAA,GAAS,EAAE,MAAA,CAAO;AAAA,IACtB,KAAA,EA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AA,QAAA,EAC3C,GAAA,CAAI,QAAQ,CAAA,OAAA,EAAU,GAAA,CAAI,OAAO,CAAA,wCAAA;AAAA,KAE/C;AAAA,EACF;AACA,EAAA,KAAA,MAAW,CAAC,KAAA,EAAO,KAAK,CAAA,IAAK,MAAA,CAAO,SAAQ,EAAG;AAC7C,IAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,CAAC,MAAA,CAAO,QAAA,CAAS,KAAK,CAAA,EAAG;AACxD,MAAA,MAAM,IAAI,SAAA;AAAA,QACR,wBAAwB,GAAA,CAAI,SAAS,CAAA,CAAA,EAAI,GAAA,CAAI,UAAU,CAAA,QAAA,EAC3C,GAAA,CAAI,QAAQ,CAAA,OAAA,EAAU,IAAI,OAAO,CAAA,kCAAA,EACzB,KAAK,CAAA,EAAA,EAAK,MAAA,CAAO,KAAK,CAAC,CAAA,CAAA;AAAA,OAC7C;AAAA,IACF;AAAA,EACF;AACA,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["import {\n type InferenceType,\n META_EDGE_BRAND,\n type MetaEdge,\n type MetaEdgeProperties,\n} from \"../ontology/types\";\n\n// ============================================================\n// Meta-Edge Factory Options\n// ============================================================\n\n/**\n * Options for creating a meta-edge.\n */\nexport type MetaEdgeOptions = Readonly<{\n /** Whether the relationship is transitive (A→B, B→C implies A→C) */\n transitive?: boolean;\n /** Whether the relationship is symmetric (A→B implies B→A) */\n symmetric?: boolean;\n /** Whether the relationship is reflexive (A→A is always true) */\n reflexive?: boolean;\n /** Name of the inverse meta-edge */\n inverse?: string;\n /** How this meta-edge affects queries and validation */\n inference?: InferenceType;\n /** Optional description */\n description?: string;\n}>;\n\n// ============================================================\n// Meta-Edge Factory\n// ============================================================\n\n/**\n * Creates a custom meta-edge definition.\n *\n * @example\n * ```typescript\n * // Custom meta-edge for regulatory relationships\n * const regulatedBy = metaEdge(\"regulatedBy\", {\n * description: \"Type X is regulated by authority type Y\",\n * transitive: false,\n * symmetric: false,\n * });\n * ```\n */\nexport function metaEdge<K extends string>(\n name: K,\n options: MetaEdgeOptions = {},\n): MetaEdge<K> {\n const properties: MetaEdgeProperties = {\n transitive: options.transitive ?? false,\n symmetric: options.symmetric ?? false,\n reflexive: options.reflexive ?? false,\n inverse: options.inverse,\n inference: options.inference ?? \"none\",\n description: options.description,\n };\n\n return Object.freeze({\n [META_EDGE_BRAND]: true as const,\n name,\n properties,\n });\n}\n","/**\n * External reference type for hybrid overlay patterns.\n *\n * Creates a Zod-compatible schema for referencing entities in external\n * data sources (e.g., existing application tables) from TypeGraph nodes.\n */\nimport { z } from \"zod\";\n\n// ============================================================\n// External Reference Metadata Symbol\n// ============================================================\n\n/**\n * Symbol key for storing external table name on the schema.\n * This allows the schema introspector to detect external reference types\n * and extract source information.\n */\nexport const EXTERNAL_REF_TABLE_KEY = \"_externalRefTable\" as const;\n\n// ============================================================\n// External Reference Value Type\n// ============================================================\n\n/**\n * The shape of an external reference value.\n * Contains the source table identifier and the ID of the referenced record.\n */\nexport type ExternalRefValue<T extends string = string> = Readonly<{\n table: T;\n id: string;\n}>;\n\n// ============================================================\n// External Reference Schema Type\n// ============================================================\n\n/**\n * A Zod schema for external references with attached table metadata.\n */\nexport type ExternalRefSchema<T extends string = string> = z.ZodType<\n ExternalRefValue<T>\n> &\n Readonly<{\n [EXTERNAL_REF_TABLE_KEY]: T;\n }>;\n\n// ============================================================\n// External Reference Factory\n// ============================================================\n\n/**\n * Creates a Zod schema for referencing external data sources.\n *\n * Use this when building a hybrid overlay where TypeGraph stores\n * graph relationships and metadata while your existing tables\n * remain the source of truth for entity data.\n *\n * @param table - The identifier for the external table/source (e.g., \"users\", \"documents\")\n * @returns A Zod schema that validates external reference objects\n *\n * @example\n * ```typescript\n * import { defineNode, externalRef, embedding } from \"@nicia-ai/typegraph\";\n *\n * // Reference documents from your existing application database\n * const Document = defineNode(\"Document\", {\n * schema: z.object({\n * source: externalRef(\"documents\"),\n * embedding: embedding(1536).optional(),\n * extractedTopics: z.array(z.string()).optional(),\n * }),\n * });\n *\n * // Create a node referencing an external document\n * await store.nodes.Document.create({\n * source: { table: \"documents\", id: \"doc_abc123\" },\n * embedding: await generateEmbedding(docContent),\n * });\n *\n * // Query and hydrate with external data\n * const results = await store\n * .query()\n * .from(\"Document\", \"d\")\n * .whereNode(\"d\", (d) => d.embedding.similarTo(query, 10))\n * .select((ctx) => ctx.d.source)\n * .execute();\n *\n * // Fetch full data from your app database\n * const externalIds = results.map((r) => r.id);\n * const fullDocs = await appDb.query.documents.findMany({\n * where: inArray(documents.id, externalIds),\n * });\n * ```\n */\nexport function externalRef<T extends string>(table: T): ExternalRefSchema<T> {\n if (typeof table !== \"string\" || table.length === 0) {\n throw new Error(\n `External reference table must be a non-empty string, got: ${typeof table === \"string\" ? `\"${table}\"` : typeof table}`,\n );\n }\n\n const schema = z.object({\n table: z.literal(table),\n id: z.string().min(1, \"External reference ID must be non-empty\"),\n });\n\n // Attach table metadata for introspection\n return Object.assign(schema, {\n [EXTERNAL_REF_TABLE_KEY]: table,\n });\n}\n\n// ============================================================\n// Type Guards\n// ============================================================\n\n/**\n * Checks if a value is an external reference schema.\n */\nexport function isExternalRefSchema(\n value: unknown,\n): value is ExternalRefSchema {\n return (\n typeof value === \"object\" &&\n value !== null &&\n EXTERNAL_REF_TABLE_KEY in value &&\n typeof (value as Record<string, unknown>)[EXTERNAL_REF_TABLE_KEY] ===\n \"string\"\n );\n}\n\n/**\n * Gets the table name from an external reference schema.\n * Returns undefined if the schema is not an external reference schema.\n */\nexport function getExternalRefTable(schema: z.ZodType): string | undefined {\n if (isExternalRefSchema(schema)) {\n return schema[EXTERNAL_REF_TABLE_KEY];\n }\n return undefined;\n}\n\n// ============================================================\n// Helper for creating reference values\n// ============================================================\n\n/**\n * Helper function to create a typed external reference value.\n * Useful when you want to avoid repeating the table name.\n *\n * @example\n * ```typescript\n * const docRef = createExternalRef(\"documents\");\n *\n * await store.nodes.Document.create({\n * source: docRef(\"doc_123\"),\n * embedding: [...],\n * });\n * ```\n */\nexport function createExternalRef<T extends string>(\n table: T,\n): (id: string) => ExternalRefValue<T> {\n return (id: string) => ({ table, id });\n}\n","/**\n * One-time offline migration: legacy shared embeddings table → per-field\n * strategy storage.\n *\n * ## What this is for\n *\n * The cross-backend vector cutover (#157) dropped the single shared\n * `typegraph_node_embeddings` table. Each\n * `VectorStrategy` now OWNS one typed, fixed-dimension structure per\n * `(nodeKind, fieldPath)` — the only layout that can be ANN-indexed on\n * libSQL and sqlite-vec, not just pgvector.\n *\n * Deployments that wrote embeddings under the old shared table before\n * upgrading still hold those rows. This utility drains them into the new\n * per-field storage **once**, during the upgrade, so existing embedded\n * data survives the cutover without re-embedding from source.\n *\n * It is an explicitly-run, offline step — not wired into `materializeIndexes`\n * or any boot path. Run it once after deploying the new version and before\n * (or alongside) the first `materializeIndexes()`, then drop the legacy\n * table at your leisure.\n *\n * ## How it works\n *\n * - Skips cleanly (returns a zero summary) when the legacy table is absent —\n * a fresh install, or a re-run after the table was dropped.\n * - Reads rows in keyset-paginated batches (never the whole table at once),\n * decoding the engine-native embedding column to a numeric array at the SQL\n * level: sqlite-vec stored a `vec_f32` blob (`vec_to_json` decodes it);\n * pgvector stored a native `vector` (`::text` yields a `[…]` literal).\n * - Re-inserts each row through `backend.upsertEmbedding`, which routes the\n * active strategy's `buildUpsert` and idempotently provisions the per-field\n * storage (the same `(nodeKind, fieldPath)` slot a fresh store write uses).\n * The migration stays graph-agnostic and execution-correct on both the\n * sync (better-sqlite3) and async (libsql / Postgres) backends — it does\n * not re-implement the backend's statement-execution glue.\n *\n * Idempotent and resumable: a partial run followed by a full run converges\n * to the same per-field tables, because every write is an upsert keyed by\n * `(graph_id, node_id)` in the strategy's owned storage.\n */\nimport { type SQL, sql } from \"drizzle-orm\";\n\nimport {\n DEFAULT_EMBEDDING_INDEX_TYPE,\n DEFAULT_EMBEDDING_METRIC,\n type EmbeddingIndexType,\n type EmbeddingMetric,\n} from \"../core/embedding\";\nimport { EmbeddingDimensionChangedError } from \"../errors\";\nimport { asCompiledRowsSql } from \"../query/sql-intent\";\nimport { isMissingTableError } from \"../utils/sql-errors\";\nimport { quotedTableName } from \"./drizzle/operations/shared\";\nimport { LEGACY_EMBEDDINGS_TABLE_NAME } from \"./drizzle/schema/sqlite\";\nimport { type GraphBackend } from \"./types\";\n\n/**\n * Default rows read per round-trip. Large enough to amortize round-trip\n * latency, small enough to bound peak memory regardless of table size.\n */\nconst DEFAULT_BATCH_SIZE = 500;\n\n/**\n * Metric / index type applied to a migrated field when no\n * {@link MigrateLegacyEmbeddingsOptions.resolveSlotConfig} is supplied (or\n * it returns `undefined`). Matches the defaults `embedding()` and\n * `resolveEmbeddingFields` apply, so a migrated field lands in storage shaped\n * identically to one written fresh through the store. Migrated data is only\n * ever brute-forceable until `materializeIndexes()` builds the ANN index, so\n * the index-type default governs only which ANN structure the per-field\n * storage DDL provisions, not the migration's correctness.\n */\nconst DEFAULT_SLOT_METRIC: EmbeddingMetric = DEFAULT_EMBEDDING_METRIC;\nconst DEFAULT_SLOT_INDEX_TYPE: EmbeddingIndexType =\n DEFAULT_EMBEDDING_INDEX_TYPE;\n\n/**\n * The resolved storage config for one `(nodeKind, fieldPath)` slot that the\n * legacy table did not record. The legacy shared table stored only the\n * vector and its dimension count — not the metric or index type — so a\n * caller that wants migrated fields to match a specific graph's `embedding()`\n * declarations supplies this resolver.\n */\nexport type LegacyEmbeddingSlotConfig = Readonly<{\n metric: EmbeddingMetric;\n indexType: EmbeddingIndexType;\n}>;\n\n/**\n * Options for {@link migrateLegacyEmbeddings}.\n */\nexport type MigrateLegacyEmbeddingsOptions = Readonly<{\n /**\n * The backend to migrate, wired with the destination `VectorStrategy`\n * (i.e. the post-cutover backend). Its `vectorStrategy` owns the per-field\n * storage rows are written into and its `upsertEmbedding` performs the\n * writes.\n */\n backend: GraphBackend;\n\n /**\n * Restrict the migration to a single graph. When omitted, every graph's\n * rows in the legacy table are migrated (the table is graph-scoped by its\n * `graph_id` column).\n */\n graphId?: string;\n\n /**\n * Resolves the metric / index type for a `(nodeKind, fieldPath)` slot the\n * legacy table didn't persist. Return `undefined` to fall back to the\n * cosine / hnsw defaults. Supply this (typically reading the graph's\n * `embedding()` declarations) when migrated fields must match a specific\n * metric — e.g. an `l2` field, which scores incorrectly under the cosine\n * default.\n */\n resolveSlotConfig?: (\n nodeKind: string,\n fieldPath: string,\n ) => LegacyEmbeddingSlotConfig | undefined;\n\n /** Rows read per round-trip. Defaults to {@link DEFAULT_BATCH_SIZE}. */\n batchSize?: number;\n\n /**\n * Physical name of the legacy table to drain. Defaults to\n * {@link LEGACY_EMBEDDINGS_TABLE_NAME}. Override only for a non-default\n * deployment that renamed the embeddings table.\n */\n legacyTableName?: string;\n}>;\n\n/**\n * Summary of a {@link migrateLegacyEmbeddings} run.\n */\nexport type MigrateLegacyEmbeddingsResult = Readonly<{\n /** Total embedding rows re-inserted into per-field storage. */\n migrated: number;\n /**\n * Per-`(nodeKind, fieldPath)` counts, keyed `\"<nodeKind>.<fieldPath>\"`\n * (the strategy's logical-slot key form). Empty when the legacy table was\n * absent or held no rows for the requested scope.\n */\n perField: Readonly<Record<string, number>>;\n /**\n * Rows skipped because their vector length didn't match the per-field\n * table's fixed dimension. The legacy shared column allowed mixed\n * dimensions for one `(nodeKind, fieldPath)` (e.g. an unmigrated model\n * change); the first migrated row fixes the typed table's dimension and\n * any differently-sized rows for that slot are skipped rather than aborting\n * the whole migration. Keyed `\"<nodeKind>.<fieldPath>\"`. Non-empty here\n * means those fields need a deliberate re-embed at a single dimension.\n */\n skippedDimensionMismatch: Readonly<Record<string, number>>;\n /**\n * Rows skipped because their legacy embedding could not be decoded into a\n * finite-number array — a corrupt value (e.g. a pgvector `vector` column\n * permits `NaN`/`Infinity`, which is not valid JSON). Keyed\n * `\"<nodeKind>.<fieldPath>\"`. Skipping + reporting keeps one bad row from\n * aborting the whole migration; non-empty here means those rows need manual\n * repair.\n */\n skippedDecodeError: Readonly<Record<string, number>>;\n /**\n * Whether the legacy table existed. `false` means the run was a clean\n * no-op (fresh install, or already-dropped table on a re-run).\n */\n legacyTablePresent: boolean;\n}>;\n\n/**\n * A single legacy embedding row, with the engine-native vector already\n * decoded to a JSON array string by the dialect-specific SELECT. The\n * legacy `dimensions` column is intentionally not read: the decoded array's\n * length is the authoritative fixed dimension for the destination slot, and\n * relying on it sidesteps the per-driver string/number coercion the legacy\n * integer column would otherwise need.\n */\ntype LegacyEmbeddingRow = Readonly<{\n graph_id: string;\n node_kind: string;\n node_id: string;\n field_path: string;\n /** JSON array text, e.g. `\"[0.1,0.2,0.3]\"` — decoded per dialect. */\n embedding_json: string;\n}>;\n\n/**\n * Re-inserts every embedding from the legacy shared\n * `typegraph_node_embeddings` table into the active\n * `backend.vectorStrategy`'s per-`(nodeKind, fieldPath)` storage.\n *\n * One-time, explicitly-run upgrade step for the shared-table → per-field\n * cutover (#157). Idempotent, batched, and a clean no-op when the legacy\n * table is absent. See the module doc comment for the full contract.\n *\n * @throws Error when the backend exposes no `vectorStrategy` /\n * `upsertEmbedding` (nothing to migrate *into*) — a configuration\n * error the caller must fix by wiring the destination strategy\n * before migrating.\n */\nexport async function migrateLegacyEmbeddings(\n options: MigrateLegacyEmbeddingsOptions,\n): Promise<MigrateLegacyEmbeddingsResult> {\n const {\n backend,\n graphId,\n resolveSlotConfig,\n batchSize = DEFAULT_BATCH_SIZE,\n legacyTableName = LEGACY_EMBEDDINGS_TABLE_NAME,\n } = options;\n\n if (\n backend.vectorStrategy === undefined ||\n backend.upsertEmbedding === undefined\n ) {\n throw new Error(\n \"migrateLegacyEmbeddings requires a backend wired with a vectorStrategy \" +\n \"(the destination per-field storage). Pass the post-cutover backend.\",\n );\n }\n if (!Number.isInteger(batchSize) || batchSize <= 0) {\n throw new RangeError(\n `batchSize must be a positive integer, got: ${batchSize}`,\n );\n }\n const upsertEmbedding = backend.upsertEmbedding;\n\n const perField: Record<string, number> = {};\n const skippedDimensionMismatch: Record<string, number> = {};\n const skippedDecodeError: Record<string, number> = {};\n let migrated = 0;\n\n let cursor: LegacyRowCursor | undefined;\n for (;;) {\n let batch: readonly LegacyEmbeddingRow[];\n try {\n batch = await readLegacyBatch(backend, {\n legacyTableName,\n graphId,\n batchSize,\n after: cursor,\n });\n } catch (error) {\n // A missing legacy table is the expected \"nothing to migrate\" path on\n // the first read — surface it as a clean no-op, not a failure.\n if (cursor === undefined && isMissingTableError(error)) {\n return {\n migrated: 0,\n perField: {},\n skippedDimensionMismatch: {},\n skippedDecodeError: {},\n legacyTablePresent: false,\n };\n }\n throw error;\n }\n\n if (batch.length === 0) break;\n\n for (const row of batch) {\n const slotKey = `${row.node_kind}.${row.field_path}`;\n\n let embedding: readonly number[];\n try {\n embedding = decodeEmbeddingJson(row);\n } catch {\n // A corrupt legacy value (e.g. a pgvector `vector` column permits\n // NaN/Infinity, which is not valid JSON) is skipped + reported rather\n // than aborting the whole migration on one bad row.\n skippedDecodeError[slotKey] = (skippedDecodeError[slotKey] ?? 0) + 1;\n continue;\n }\n const config = resolveSlotConfig?.(row.node_kind, row.field_path);\n\n try {\n await upsertEmbedding({\n graphId: row.graph_id,\n nodeKind: row.node_kind,\n nodeId: row.node_id,\n fieldPath: row.field_path,\n embedding,\n // The decoded length is the authoritative fixed dimension — the\n // strategy provisions its column type (e.g. `F32_BLOB(N)`) from it.\n dimensions: embedding.length,\n metric: config?.metric ?? DEFAULT_SLOT_METRIC,\n indexType: config?.indexType ?? DEFAULT_SLOT_INDEX_TYPE,\n });\n } catch (error) {\n // The legacy shared column allowed mixed dimensions for one\n // (nodeKind, fieldPath); the per-field table is fixed at the first\n // migrated row's dimension, so a differently-sized row is skipped and\n // reported rather than aborting the whole migration.\n if (error instanceof EmbeddingDimensionChangedError) {\n skippedDimensionMismatch[slotKey] =\n (skippedDimensionMismatch[slotKey] ?? 0) + 1;\n continue;\n }\n throw error;\n }\n\n migrated += 1;\n perField[slotKey] = (perField[slotKey] ?? 0) + 1;\n }\n\n if (batch.length < batchSize) break;\n const last = batch.at(-1)!;\n cursor = {\n graphId: last.graph_id,\n nodeKind: last.node_kind,\n nodeId: last.node_id,\n fieldPath: last.field_path,\n };\n }\n\n return {\n migrated,\n perField,\n skippedDimensionMismatch,\n skippedDecodeError,\n legacyTablePresent: true,\n };\n}\n\n/**\n * Composite keyset cursor over the legacy table's primary key\n * `(graph_id, node_kind, node_id, field_path)`. Stable under concurrent\n * writes and immune to OFFSET drift, so a batched walk reads every row once.\n */\ntype LegacyRowCursor = Readonly<{\n graphId: string;\n nodeKind: string;\n nodeId: string;\n fieldPath: string;\n}>;\n\ntype ReadLegacyBatchParams = Readonly<{\n legacyTableName: string;\n graphId: string | undefined;\n batchSize: number;\n after: LegacyRowCursor | undefined;\n}>;\n\n/**\n * Reads one keyset-paginated batch of legacy rows, ordered by the primary\n * key, with the engine-native embedding column decoded to a JSON array\n * string by the dialect.\n */\nasync function readLegacyBatch(\n backend: GraphBackend,\n params: ReadLegacyBatchParams,\n): Promise<readonly LegacyEmbeddingRow[]> {\n const table = quotedTableName(params.legacyTableName);\n const embeddingJson = legacyEmbeddingDecodeExpression(backend);\n\n const conditions: SQL[] = [];\n if (params.graphId !== undefined) {\n conditions.push(sql`\"graph_id\" = ${params.graphId}`);\n }\n if (params.after !== undefined) {\n conditions.push(keysetAfterCondition(params.after));\n }\n\n const whereClause =\n conditions.length === 0 ?\n sql``\n : sql` WHERE ${sql.join(conditions, sql` AND `)}`;\n\n const query = sql`\n SELECT\n \"graph_id\" AS graph_id,\n \"node_kind\" AS node_kind,\n \"node_id\" AS node_id,\n \"field_path\" AS field_path,\n ${embeddingJson} AS embedding_json\n FROM ${table}${whereClause}\n ORDER BY \"graph_id\" ASC, \"node_kind\" ASC, \"node_id\" ASC, \"field_path\" ASC\n LIMIT ${params.batchSize}\n `;\n\n return backend.execute<LegacyEmbeddingRow>(asCompiledRowsSql(query));\n}\n\n/**\n * The strict `>` comparison over the composite primary key, expressed as\n * the standard lexicographic OR-chain so it works on every dialect (SQLite\n * supports row-value comparison, but Postgres + SQLite both accept this\n * portable form).\n */\nfunction keysetAfterCondition(after: LegacyRowCursor): SQL {\n return sql`\n (\n \"graph_id\" > ${after.graphId}\n OR (\"graph_id\" = ${after.graphId} AND \"node_kind\" > ${after.nodeKind})\n OR (\"graph_id\" = ${after.graphId} AND \"node_kind\" = ${after.nodeKind} AND \"node_id\" > ${after.nodeId})\n OR (\n \"graph_id\" = ${after.graphId}\n AND \"node_kind\" = ${after.nodeKind}\n AND \"node_id\" = ${after.nodeId}\n AND \"field_path\" > ${after.fieldPath}\n )\n )\n `;\n}\n\n/**\n * The SQL expression that decodes the legacy engine-native embedding column\n * into a JSON array string `embedding_json`. The single dialect branch in\n * this whole module: the legacy storage formats are genuinely engine-\n * specific, and there is no longer a strategy abstraction over the *legacy*\n * table to delegate to.\n */\nfunction legacyEmbeddingDecodeExpression(backend: GraphBackend): SQL {\n switch (backend.dialect) {\n case \"sqlite\": {\n // Legacy SQLite embeddings were written via `vec_f32('[…]')`\n // (sqlite-vec binary). `vec_to_json` is its inverse, yielding the\n // JSON array text. Requires sqlite-vec on the connection — which the\n // legacy write path also required, so any deployment with legacy rows\n // has it loaded.\n return sql`vec_to_json(\"embedding\")`;\n }\n case \"postgres\": {\n // pgvector's native `vector` casts to its `[…]` text literal, which is\n // valid JSON for `JSON.parse`.\n return sql`\"embedding\"::text`;\n }\n default: {\n const _exhaustive: never = backend.dialect;\n throw new Error(\n `migrateLegacyEmbeddings does not support dialect: ${String(_exhaustive)}`,\n );\n }\n }\n}\n\n/**\n * Parses a decoded `embedding_json` array, asserting it is a non-empty array\n * of finite numbers. A bad decode (wrong type, NaN) names the offending row\n * loudly instead of writing a corrupt vector into per-field storage.\n */\nfunction decodeEmbeddingJson(row: LegacyEmbeddingRow): readonly number[] {\n let parsed: unknown;\n try {\n parsed = JSON.parse(row.embedding_json) as unknown;\n } catch (error) {\n throw new Error(\n `Failed to decode legacy embedding for ${row.node_kind}.${row.field_path} ` +\n `(graph ${row.graph_id}, node ${row.node_id}): not valid JSON.`,\n { cause: error },\n );\n }\n if (!Array.isArray(parsed) || parsed.length === 0) {\n throw new Error(\n `Legacy embedding for ${row.node_kind}.${row.field_path} ` +\n `(graph ${row.graph_id}, node ${row.node_id}) decoded to a non-array ` +\n `or empty value.`,\n );\n }\n for (const [index, value] of parsed.entries()) {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n throw new TypeError(\n `Legacy embedding for ${row.node_kind}.${row.field_path} ` +\n `(graph ${row.graph_id}, node ${row.node_id}) has a non-finite ` +\n `value at index ${index}: ${String(value)}.`,\n );\n }\n }\n return parsed as readonly number[];\n}\n"]}
|
package/dist/indexes/index.cjs
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkAW4A3P5A_cjs = require('../chunk-AW4A3P5A.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
require('../chunk-
|
|
7
|
-
require('../chunk-
|
|
8
|
-
|
|
9
|
-
require('../chunk-
|
|
10
|
-
require('../chunk-
|
|
4
|
+
var chunkG6SOJEDI_cjs = require('../chunk-G6SOJEDI.cjs');
|
|
5
|
+
var chunkTGJE22RM_cjs = require('../chunk-TGJE22RM.cjs');
|
|
6
|
+
require('../chunk-2JXB3NYJ.cjs');
|
|
7
|
+
var chunkRRKQAKD6_cjs = require('../chunk-RRKQAKD6.cjs');
|
|
8
|
+
require('../chunk-ZY4GXIVN.cjs');
|
|
9
|
+
require('../chunk-WL2SG7ZV.cjs');
|
|
10
|
+
require('../chunk-YAZE7QZR.cjs');
|
|
11
|
+
require('../chunk-NAUA4PW5.cjs');
|
|
12
|
+
require('../chunk-JQGIPGVL.cjs');
|
|
13
|
+
require('../chunk-3E7SNSIA.cjs');
|
|
11
14
|
require('../chunk-FLRCVI2G.cjs');
|
|
12
15
|
|
|
13
16
|
|
|
@@ -32,41 +35,41 @@ Object.defineProperty(exports, "toDeclaredIndexes", {
|
|
|
32
35
|
enumerable: true,
|
|
33
36
|
get: function () { return chunkAW4A3P5A_cjs.toDeclaredIndexes; }
|
|
34
37
|
});
|
|
35
|
-
Object.defineProperty(exports, "
|
|
38
|
+
Object.defineProperty(exports, "buildPostgresEdgeIndexBuilders", {
|
|
36
39
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunkG6SOJEDI_cjs.buildPostgresEdgeIndexBuilders; }
|
|
38
41
|
});
|
|
39
|
-
Object.defineProperty(exports, "
|
|
42
|
+
Object.defineProperty(exports, "buildPostgresNodeIndexBuilders", {
|
|
40
43
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunkG6SOJEDI_cjs.buildPostgresNodeIndexBuilders; }
|
|
42
45
|
});
|
|
43
|
-
Object.defineProperty(exports, "
|
|
46
|
+
Object.defineProperty(exports, "buildSqliteEdgeIndexBuilders", {
|
|
44
47
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunkG6SOJEDI_cjs.buildSqliteEdgeIndexBuilders; }
|
|
46
49
|
});
|
|
47
|
-
Object.defineProperty(exports, "
|
|
50
|
+
Object.defineProperty(exports, "buildSqliteNodeIndexBuilders", {
|
|
48
51
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunkG6SOJEDI_cjs.buildSqliteNodeIndexBuilders; }
|
|
50
53
|
});
|
|
51
|
-
Object.defineProperty(exports, "
|
|
54
|
+
Object.defineProperty(exports, "generateEdgeIndexDDL", {
|
|
52
55
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunkTGJE22RM_cjs.generateEdgeIndexDDL; }
|
|
54
57
|
});
|
|
55
|
-
Object.defineProperty(exports, "
|
|
58
|
+
Object.defineProperty(exports, "generateIndexDDL", {
|
|
56
59
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
60
|
+
get: function () { return chunkTGJE22RM_cjs.generateIndexDDL; }
|
|
58
61
|
});
|
|
59
|
-
Object.defineProperty(exports, "
|
|
62
|
+
Object.defineProperty(exports, "generateNodeIndexDDL", {
|
|
60
63
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunkTGJE22RM_cjs.generateNodeIndexDDL; }
|
|
62
65
|
});
|
|
63
|
-
Object.defineProperty(exports, "
|
|
66
|
+
Object.defineProperty(exports, "defineEdgeIndex", {
|
|
64
67
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
68
|
+
get: function () { return chunkRRKQAKD6_cjs.defineEdgeIndex; }
|
|
66
69
|
});
|
|
67
|
-
Object.defineProperty(exports, "
|
|
70
|
+
Object.defineProperty(exports, "defineNodeIndex", {
|
|
68
71
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
72
|
+
get: function () { return chunkRRKQAKD6_cjs.defineNodeIndex; }
|
|
70
73
|
});
|
|
71
74
|
//# sourceMappingURL=index.cjs.map
|
|
72
75
|
//# sourceMappingURL=index.cjs.map
|
package/dist/indexes/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { c as EdgeIndexDeclaration, p as SqlDialect, R as RelationalIndexDeclaration, d as NodeIndexDeclaration, I as IndexDeclaration } from '../types-
|
|
2
|
-
export { E as EdgeIndexConfig, q as EdgeIndexDirection, r as EdgeIndexWhereBuilder, s as IndexOrigin, t as IndexScope, e as IndexWhereExpression, u as IndexWhereFieldBuilder, v as IndexWhereInput, N as NodeIndexConfig, w as NodeIndexWhereBuilder, x as SystemColumnName, y as VectorIndexDeclaration, z as VectorIndexImplementation, C as VectorIndexMetric, D as VectorIndexParams } from '../types-
|
|
3
|
-
export { a as andWhere, d as defineEdgeIndex, b as defineNodeIndex, n as notWhere, o as orWhere } from '../where-
|
|
1
|
+
import { c as EdgeIndexDeclaration, p as SqlDialect, R as RelationalIndexDeclaration, d as NodeIndexDeclaration, I as IndexDeclaration } from '../types-DkNnF-7K.cjs';
|
|
2
|
+
export { E as EdgeIndexConfig, q as EdgeIndexDirection, r as EdgeIndexWhereBuilder, s as IndexOrigin, t as IndexScope, e as IndexWhereExpression, u as IndexWhereFieldBuilder, v as IndexWhereInput, N as NodeIndexConfig, w as NodeIndexWhereBuilder, x as SystemColumnName, y as VectorIndexDeclaration, z as VectorIndexImplementation, C as VectorIndexMetric, D as VectorIndexParams } from '../types-DkNnF-7K.cjs';
|
|
3
|
+
export { a as andWhere, d as defineEdgeIndex, b as defineNodeIndex, n as notWhere, o as orWhere } from '../where-DKjuofPr.cjs';
|
|
4
4
|
import { SQLWrapper } from 'drizzle-orm';
|
|
5
5
|
import { IndexBuilder } from 'drizzle-orm/pg-core';
|
|
6
6
|
import { IndexBuilder as IndexBuilder$1 } from 'drizzle-orm/sqlite-core';
|
|
7
|
-
import { D as DeclaredIndex } from '../types-
|
|
7
|
+
import { D as DeclaredIndex } from '../types-DiE1AO7p.cjs';
|
|
8
8
|
import 'zod';
|
|
9
|
-
import '../extension-types-
|
|
9
|
+
import '../extension-types-YGFJPrzK.cjs';
|
|
10
10
|
|
|
11
11
|
type GenerateIndexDdlOptions = Readonly<{
|
|
12
12
|
nodesTableName?: string | undefined;
|
package/dist/indexes/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { c as EdgeIndexDeclaration, p as SqlDialect, R as RelationalIndexDeclaration, d as NodeIndexDeclaration, I as IndexDeclaration } from '../types-
|
|
2
|
-
export { E as EdgeIndexConfig, q as EdgeIndexDirection, r as EdgeIndexWhereBuilder, s as IndexOrigin, t as IndexScope, e as IndexWhereExpression, u as IndexWhereFieldBuilder, v as IndexWhereInput, N as NodeIndexConfig, w as NodeIndexWhereBuilder, x as SystemColumnName, y as VectorIndexDeclaration, z as VectorIndexImplementation, C as VectorIndexMetric, D as VectorIndexParams } from '../types-
|
|
3
|
-
export { a as andWhere, d as defineEdgeIndex, b as defineNodeIndex, n as notWhere, o as orWhere } from '../where-
|
|
1
|
+
import { c as EdgeIndexDeclaration, p as SqlDialect, R as RelationalIndexDeclaration, d as NodeIndexDeclaration, I as IndexDeclaration } from '../types-D1Sqeyxy.js';
|
|
2
|
+
export { E as EdgeIndexConfig, q as EdgeIndexDirection, r as EdgeIndexWhereBuilder, s as IndexOrigin, t as IndexScope, e as IndexWhereExpression, u as IndexWhereFieldBuilder, v as IndexWhereInput, N as NodeIndexConfig, w as NodeIndexWhereBuilder, x as SystemColumnName, y as VectorIndexDeclaration, z as VectorIndexImplementation, C as VectorIndexMetric, D as VectorIndexParams } from '../types-D1Sqeyxy.js';
|
|
3
|
+
export { a as andWhere, d as defineEdgeIndex, b as defineNodeIndex, n as notWhere, o as orWhere } from '../where-DrUIIWHb.js';
|
|
4
4
|
import { SQLWrapper } from 'drizzle-orm';
|
|
5
5
|
import { IndexBuilder } from 'drizzle-orm/pg-core';
|
|
6
6
|
import { IndexBuilder as IndexBuilder$1 } from 'drizzle-orm/sqlite-core';
|
|
7
|
-
import { D as DeclaredIndex } from '../types-
|
|
7
|
+
import { D as DeclaredIndex } from '../types-B1TbZJYS.js';
|
|
8
8
|
import 'zod';
|
|
9
|
-
import '../extension-types-
|
|
9
|
+
import '../extension-types-YGFJPrzK.js';
|
|
10
10
|
|
|
11
11
|
type GenerateIndexDdlOptions = Readonly<{
|
|
12
12
|
nodesTableName?: string | undefined;
|
package/dist/indexes/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export { andWhere, notWhere, orWhere, toDeclaredIndex, toDeclaredIndexes } from '../chunk-A3W7QG7K.js';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
import '../chunk-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import '../chunk-
|
|
8
|
-
import '../chunk-
|
|
2
|
+
export { buildPostgresEdgeIndexBuilders, buildPostgresNodeIndexBuilders, buildSqliteEdgeIndexBuilders, buildSqliteNodeIndexBuilders } from '../chunk-6GNSY7AV.js';
|
|
3
|
+
export { generateEdgeIndexDDL, generateIndexDDL, generateNodeIndexDDL } from '../chunk-SHLY4MCM.js';
|
|
4
|
+
import '../chunk-KUTNI6SI.js';
|
|
5
|
+
export { defineEdgeIndex, defineNodeIndex } from '../chunk-4DIBPQNJ.js';
|
|
6
|
+
import '../chunk-K34OPSJK.js';
|
|
7
|
+
import '../chunk-BVTWD66D.js';
|
|
8
|
+
import '../chunk-GZCNZ7QW.js';
|
|
9
|
+
import '../chunk-2EBMPJBO.js';
|
|
10
|
+
import '../chunk-Z5XBMDXU.js';
|
|
11
|
+
import '../chunk-XLUNB2TZ.js';
|
|
9
12
|
import '../chunk-K5P5OZXS.js';
|
|
10
13
|
//# sourceMappingURL=index.js.map
|
|
11
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,63 +1,72 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var chunkKNHYNQQ3_cjs = require('../chunk-KNHYNQQ3.cjs');
|
|
4
|
+
require('../chunk-N6WTUSBV.cjs');
|
|
5
|
+
require('../chunk-T6SPUYLX.cjs');
|
|
6
|
+
require('../chunk-5IQIX7LU.cjs');
|
|
7
|
+
require('../chunk-UNNPKQUG.cjs');
|
|
8
|
+
require('../chunk-YC6PWTHY.cjs');
|
|
9
|
+
require('../chunk-RHZWOJVA.cjs');
|
|
10
|
+
require('../chunk-YAZE7QZR.cjs');
|
|
11
|
+
require('../chunk-NAUA4PW5.cjs');
|
|
12
|
+
require('../chunk-JQGIPGVL.cjs');
|
|
13
|
+
require('../chunk-3E7SNSIA.cjs');
|
|
6
14
|
require('../chunk-JIEJCTDS.cjs');
|
|
15
|
+
require('../chunk-FLRCVI2G.cjs');
|
|
7
16
|
|
|
8
17
|
|
|
9
18
|
|
|
10
19
|
Object.defineProperty(exports, "ConflictStrategySchema", {
|
|
11
20
|
enumerable: true,
|
|
12
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkKNHYNQQ3_cjs.ConflictStrategySchema; }
|
|
13
22
|
});
|
|
14
23
|
Object.defineProperty(exports, "ExportOptionsSchema", {
|
|
15
24
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkKNHYNQQ3_cjs.ExportOptionsSchema; }
|
|
17
26
|
});
|
|
18
27
|
Object.defineProperty(exports, "FORMAT_VERSION", {
|
|
19
28
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkKNHYNQQ3_cjs.FORMAT_VERSION; }
|
|
21
30
|
});
|
|
22
31
|
Object.defineProperty(exports, "GraphDataSchema", {
|
|
23
32
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkKNHYNQQ3_cjs.GraphDataSchema; }
|
|
25
34
|
});
|
|
26
35
|
Object.defineProperty(exports, "GraphDataSourceSchema", {
|
|
27
36
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkKNHYNQQ3_cjs.GraphDataSourceSchema; }
|
|
29
38
|
});
|
|
30
39
|
Object.defineProperty(exports, "ImportErrorSchema", {
|
|
31
40
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkKNHYNQQ3_cjs.ImportErrorSchema; }
|
|
33
42
|
});
|
|
34
43
|
Object.defineProperty(exports, "ImportOptionsSchema", {
|
|
35
44
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkKNHYNQQ3_cjs.ImportOptionsSchema; }
|
|
37
46
|
});
|
|
38
47
|
Object.defineProperty(exports, "ImportResultSchema", {
|
|
39
48
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkKNHYNQQ3_cjs.ImportResultSchema; }
|
|
41
50
|
});
|
|
42
51
|
Object.defineProperty(exports, "InterchangeEdgeSchema", {
|
|
43
52
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkKNHYNQQ3_cjs.InterchangeEdgeSchema; }
|
|
45
54
|
});
|
|
46
55
|
Object.defineProperty(exports, "InterchangeNodeSchema", {
|
|
47
56
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkKNHYNQQ3_cjs.InterchangeNodeSchema; }
|
|
49
58
|
});
|
|
50
59
|
Object.defineProperty(exports, "UnknownPropertyStrategySchema", {
|
|
51
60
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunkKNHYNQQ3_cjs.UnknownPropertyStrategySchema; }
|
|
53
62
|
});
|
|
54
63
|
Object.defineProperty(exports, "exportGraph", {
|
|
55
64
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
65
|
+
get: function () { return chunkKNHYNQQ3_cjs.exportGraph; }
|
|
57
66
|
});
|
|
58
67
|
Object.defineProperty(exports, "importGraph", {
|
|
59
68
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
69
|
+
get: function () { return chunkKNHYNQQ3_cjs.importGraph; }
|
|
61
70
|
});
|
|
62
71
|
//# sourceMappingURL=index.cjs.map
|
|
63
72
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GraphDef } from '../manager-
|
|
3
|
-
import { S as Store } from '../store-view-
|
|
4
|
-
import '../extension-types-
|
|
5
|
-
import '../types-
|
|
2
|
+
import { G as GraphDef } from '../manager-ms9cKdc6.cjs';
|
|
3
|
+
import { S as Store } from '../store-view-D09po4H6.cjs';
|
|
4
|
+
import '../extension-types-YGFJPrzK.cjs';
|
|
5
|
+
import '../types-DkNnF-7K.cjs';
|
|
6
6
|
import 'drizzle-orm';
|
|
7
7
|
import 'drizzle-orm/pg-core';
|
|
8
8
|
import 'drizzle-orm/sqlite-core';
|
|
9
|
-
import '../materialize-indexes-
|
|
9
|
+
import '../materialize-indexes-D20xNluI.cjs';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Graph interchange format types.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GraphDef } from '../manager-
|
|
3
|
-
import { S as Store } from '../store-view-
|
|
4
|
-
import '../extension-types-
|
|
5
|
-
import '../types-
|
|
2
|
+
import { G as GraphDef } from '../manager-BZUeN_BU.js';
|
|
3
|
+
import { S as Store } from '../store-view-BlgnhEYf.js';
|
|
4
|
+
import '../extension-types-YGFJPrzK.js';
|
|
5
|
+
import '../types-D1Sqeyxy.js';
|
|
6
6
|
import 'drizzle-orm';
|
|
7
7
|
import 'drizzle-orm/pg-core';
|
|
8
8
|
import 'drizzle-orm/sqlite-core';
|
|
9
|
-
import '../materialize-indexes-
|
|
9
|
+
import '../materialize-indexes-CAkIYFV-.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Graph interchange format types.
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
export { ConflictStrategySchema, ExportOptionsSchema, FORMAT_VERSION, GraphDataSchema, GraphDataSourceSchema, ImportErrorSchema, ImportOptionsSchema, ImportResultSchema, InterchangeEdgeSchema, InterchangeNodeSchema, UnknownPropertyStrategySchema, exportGraph, importGraph } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { ConflictStrategySchema, ExportOptionsSchema, FORMAT_VERSION, GraphDataSchema, GraphDataSourceSchema, ImportErrorSchema, ImportOptionsSchema, ImportResultSchema, InterchangeEdgeSchema, InterchangeNodeSchema, UnknownPropertyStrategySchema, exportGraph, importGraph } from '../chunk-T2DWPQNE.js';
|
|
2
|
+
import '../chunk-6SCVW4AS.js';
|
|
3
|
+
import '../chunk-CHXTTSC6.js';
|
|
4
|
+
import '../chunk-A7SZZFAG.js';
|
|
5
|
+
import '../chunk-V3QNTB7Z.js';
|
|
6
|
+
import '../chunk-XXVEULWX.js';
|
|
7
|
+
import '../chunk-2MRAX3UE.js';
|
|
8
|
+
import '../chunk-GZCNZ7QW.js';
|
|
9
|
+
import '../chunk-2EBMPJBO.js';
|
|
10
|
+
import '../chunk-Z5XBMDXU.js';
|
|
11
|
+
import '../chunk-XLUNB2TZ.js';
|
|
4
12
|
import '../chunk-TQOYM4LN.js';
|
|
13
|
+
import '../chunk-K5P5OZXS.js';
|
|
5
14
|
//# sourceMappingURL=index.js.map
|
|
6
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as NodeRegistration, E as EdgeRegistration, D as DeleteBehavior, T as TemporalMode, G as GraphExtension, N as NodeType, A as AnyEdgeType, c as GraphDefaults, I as IndexEntity } from './extension-types-
|
|
2
|
-
import { O as OntologyRelation, I as IndexDeclaration, f as SerializedNodeDef, g as SerializedEdgeDef, k as SerializedSchema, H as SchemaVersionRow, G as GraphBackend } from './types-
|
|
1
|
+
import { b as NodeRegistration, E as EdgeRegistration, D as DeleteBehavior, T as TemporalMode, G as GraphExtension, N as NodeType, A as AnyEdgeType, c as GraphDefaults, I as IndexEntity } from './extension-types-YGFJPrzK.js';
|
|
2
|
+
import { O as OntologyRelation, I as IndexDeclaration, f as SerializedNodeDef, g as SerializedEdgeDef, k as SerializedSchema, H as SchemaVersionRow, G as GraphBackend } from './types-D1Sqeyxy.js';
|
|
3
3
|
|
|
4
4
|
/** Brand key for GraphDef */
|
|
5
5
|
declare const GRAPH_DEF_BRAND: "__graphDef";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as NodeRegistration, E as EdgeRegistration, D as DeleteBehavior, T as TemporalMode, G as GraphExtension, N as NodeType, A as AnyEdgeType, c as GraphDefaults, I as IndexEntity } from './extension-types-
|
|
2
|
-
import { O as OntologyRelation, I as IndexDeclaration, f as SerializedNodeDef, g as SerializedEdgeDef, k as SerializedSchema, H as SchemaVersionRow, G as GraphBackend } from './types-
|
|
1
|
+
import { b as NodeRegistration, E as EdgeRegistration, D as DeleteBehavior, T as TemporalMode, G as GraphExtension, N as NodeType, A as AnyEdgeType, c as GraphDefaults, I as IndexEntity } from './extension-types-YGFJPrzK.cjs';
|
|
2
|
+
import { O as OntologyRelation, I as IndexDeclaration, f as SerializedNodeDef, g as SerializedEdgeDef, k as SerializedSchema, H as SchemaVersionRow, G as GraphBackend } from './types-DkNnF-7K.cjs';
|
|
3
3
|
|
|
4
4
|
/** Brand key for GraphDef */
|
|
5
5
|
declare const GRAPH_DEF_BRAND: "__graphDef";
|