mcard-js 2.1.41 → 2.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CardCollection-MXTUJV4J.js → CardCollection-7DKJWKAG.js} +3 -2
- package/dist/CardCollection-S4RE3RXP.js +10 -0
- package/dist/CardCollection-VPN7AAAX.js +10 -0
- package/dist/{IndexedDBEngine-2G5KCISA.js → IndexedDBEngine-7JOGM2MM.js} +3 -2
- package/dist/IndexedDBEngine-BGZHJK5L.js +12 -0
- package/dist/IndexedDBEngine-ZJ442GI7.js +12 -0
- package/dist/{LLMRuntime-GIGDMDEZ.js → LLMRuntime-OZNVAPXJ.js} +4 -3
- package/dist/{LLMRuntime-LBWUJ7ON.js → LLMRuntime-UPSEDSIK.js} +2 -2
- package/dist/{LambdaRuntime-B6D6IQKZ.js → LambdaRuntime-JZ4Q56TI.js} +6 -5
- package/dist/LambdaRuntime-PM3OUFHU.js +19 -0
- package/dist/LambdaRuntime-WBEK37AF.js +19 -0
- package/dist/LambdaRuntime-YKSBAT65.js +19 -0
- package/dist/{Loader-3LSJXJQG.js → Loader-7HQVYDPA.js} +2 -2
- package/dist/{Loader-BM56B2TX.js → Loader-NYWTV7CQ.js} +4 -3
- package/dist/{Loader-CYLAA4XU.js → Loader-OLKPY6HT.js} +3 -3
- package/dist/{MCard-H56VOJLR.js → MCard-OYI73CUI.js} +1 -1
- package/dist/{MCard-5LIREV2B.js → MCard-XHG3BZC7.js} +2 -2
- package/dist/{NetworkRuntime-IAFHPQSX.js → NetworkRuntime-VYCC5HSY.js} +16 -11
- package/dist/{NetworkRuntime-JNGKW3DY.js → NetworkRuntime-XQX3LDDI.js} +61 -33
- package/dist/{NetworkRuntime-CXPKIAOQ.js → NetworkRuntime-XZR733M5.js} +17 -12
- package/dist/{OllamaProvider-QPX2JXL2.js → OllamaProvider-FBZ5WW72.js} +1 -1
- package/dist/OllamaProvider-W6TPZNHD.js +9 -0
- package/dist/chunk-2NFGZ6PA.js +170 -0
- package/dist/{chunk-VXV35I5J.js → chunk-4TYRTQ4V.js} +48 -17
- package/dist/chunk-4VWWTGRW.js +497 -0
- package/dist/{chunk-4PDYHPR6.js → chunk-5GHZP7E5.js} +4 -2
- package/dist/{chunk-42VF42KH.js → chunk-5HZNWJFT.js} +4 -2
- package/dist/{chunk-DEYMHG5A.js → chunk-6MG5ZHAP.js} +58 -22
- package/dist/{chunk-7V37AAPK.js → chunk-7B4PABOL.js} +16 -7
- package/dist/chunk-A5S2PI37.js +47 -0
- package/dist/chunk-BFD4WSWU.js +497 -0
- package/dist/chunk-BSEFN25Q.js +32 -0
- package/dist/{chunk-3LPY36OG.js → chunk-CBEVE7RG.js} +20 -15
- package/dist/{chunk-A5AB4WQN.js → chunk-DPA3ZK4Q.js} +30 -21
- package/dist/{chunk-5FA54AMM.js → chunk-EJHX3VZL.js} +54 -21
- package/dist/{chunk-QXPHMSPA.js → chunk-GNF4WAPV.js} +22 -9
- package/dist/{chunk-XPG6B5IW.js → chunk-JHIA2BQK.js} +26 -13
- package/dist/{chunk-4I5IZILN.js → chunk-KGPICAQW.js} +10 -7
- package/dist/{chunk-4WBJPHZP.js → chunk-MST5AZXJ.js} +17 -8
- package/dist/{chunk-K35KFTEA.js → chunk-N6KDHCBC.js} +58 -33
- package/dist/{chunk-2R4ESMZB.js → chunk-NFO5NU6B.js} +5 -3
- package/dist/chunk-OKWBHCKC.js +170 -0
- package/dist/{chunk-FIE4LAJG.js → chunk-OX3K6UZJ.js} +5 -3
- package/dist/{chunk-6SEX42H2.js → chunk-R3K7DG7O.js} +21 -16
- package/dist/chunk-RB35Z35T.js +44 -0
- package/dist/{chunk-AWGFLRLI.js → chunk-SP4YPKPR.js} +51 -318
- package/dist/chunk-U7TSFDKX.js +217 -0
- package/dist/chunk-UP3SQX56.js +112 -0
- package/dist/{chunk-4EUEU4SM.js → chunk-VGIRC3HX.js} +13 -110
- package/dist/chunk-WGG7526Z.js +112 -0
- package/dist/{chunk-3JBSRALP.js → chunk-WNKP66IR.js} +10 -7
- package/dist/{chunk-DOC55MPG.js → chunk-WR6ISHCS.js} +11 -3
- package/dist/{chunk-52UNWVOD.js → chunk-ZVOPQ5BM.js} +54 -21
- package/dist/chunk-ZZMOPQER.js +217 -0
- package/dist/index.browser.cjs +79 -1454
- package/dist/index.browser.d.cts +2 -17
- package/dist/index.browser.d.ts +2 -17
- package/dist/index.browser.js +7 -6
- package/dist/index.cjs +306 -1631
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +49 -35
- package/dist/storage/SqliteNodeEngine.cjs +59 -1335
- package/dist/storage/SqliteNodeEngine.js +4 -3
- package/dist/storage/SqliteWasmEngine.cjs +57 -1335
- package/dist/storage/SqliteWasmEngine.js +4 -3
- package/package.json +12 -8
- package/dist/CardCollection-4OFJ6XQJ.js +0 -9
- package/dist/CardCollection-7PDWM24F.js +0 -9
- package/dist/CardCollection-CEFQ5PA6.js +0 -9
- package/dist/CardCollection-GUEYGN2Y.js +0 -9
- package/dist/CardCollection-KDO4CQ4B.js +0 -9
- package/dist/CardCollection-PB7ZY73E.js +0 -9
- package/dist/CardCollection-RK4DVH63.js +0 -9
- package/dist/CardCollection-T376E3TS.js +0 -9
- package/dist/CardCollection-WGCKKUOD.js +0 -9
- package/dist/CardCollection-XON2IWDU.js +0 -9
- package/dist/CardCollection-ZEI6FMP3.js +0 -9
- package/dist/EventProducer-MW6QF4IO.js +0 -47
- package/dist/EventProducer-V7RY2KKR.js +0 -47
- package/dist/FileIO.d.ts +0 -44
- package/dist/FileIO.d.ts.map +0 -1
- package/dist/FileIO.js +0 -203
- package/dist/FileIO.js.map +0 -1
- package/dist/IndexedDBEngine-7JI2CL32.js +0 -10
- package/dist/IndexedDBEngine-7OHQIRTI.js +0 -10
- package/dist/IndexedDBEngine-E5YJQG4U.js +0 -10
- package/dist/IndexedDBEngine-NV625E7L.js +0 -10
- package/dist/IndexedDBEngine-RPQS7ILF.js +0 -10
- package/dist/IndexedDBEngine-S3ZWCSI7.js +0 -10
- package/dist/IndexedDBEngine-T7OC5GRR.js +0 -10
- package/dist/LLMRuntime-BKB3CLXM.js +0 -16
- package/dist/LLMRuntime-BQUUFLAB.js +0 -16
- package/dist/LLMRuntime-TNBC4JCB.js +0 -16
- package/dist/LambdaRuntime-4YILF3G7.js +0 -15
- package/dist/LambdaRuntime-53TPVENI.js +0 -16
- package/dist/LambdaRuntime-73BSWP2G.js +0 -16
- package/dist/LambdaRuntime-AL5SBDCA.js +0 -17
- package/dist/LambdaRuntime-BYBUI7H5.js +0 -17
- package/dist/LambdaRuntime-JDZP3HIQ.js +0 -17
- package/dist/LambdaRuntime-JEI7RVWG.js +0 -16
- package/dist/LambdaRuntime-LCTHBYMV.js +0 -17
- package/dist/LambdaRuntime-LDA3G7IR.js +0 -16
- package/dist/LambdaRuntime-LF4FR6YA.js +0 -16
- package/dist/LambdaRuntime-O7JBVHO2.js +0 -16
- package/dist/LambdaRuntime-OFOTT464.js +0 -17
- package/dist/LambdaRuntime-Q6ISCHAD.js +0 -16
- package/dist/LambdaRuntime-TCZ42XCB.js +0 -16
- package/dist/LambdaRuntime-UKUOKJIW.js +0 -17
- package/dist/LambdaRuntime-VKLON4IB.js +0 -17
- package/dist/LambdaRuntime-WNYDBTS6.js +0 -16
- package/dist/LambdaRuntime-WPTX76CX.js +0 -17
- package/dist/Loader-4P7PEBCL.js +0 -11
- package/dist/Loader-HQ3QKMYM.js +0 -11
- package/dist/Loader-NCATGB67.js +0 -11
- package/dist/Loader-NRHGDQBD.js +0 -11
- package/dist/Loader-RT4NI6AT.js +0 -11
- package/dist/Loader-SSRY57SS.js +0 -11
- package/dist/Loader-W72QZ3T7.js +0 -11
- package/dist/Loader-WECRIXQW.js +0 -11
- package/dist/Loader-XFBIHCQF.js +0 -11
- package/dist/Loader.d.ts +0 -34
- package/dist/Loader.d.ts.map +0 -1
- package/dist/Loader.js +0 -190
- package/dist/Loader.js.map +0 -1
- package/dist/MCard-4J6WSBRF.js +0 -8
- package/dist/MCard-E3MRPTJF.js +0 -8
- package/dist/MCard-FCOIB6BP.js +0 -8
- package/dist/MCard-G4HUWHY5.js +0 -8
- package/dist/MCard-HFL7AFIH.js +0 -8
- package/dist/MCard-JOW6RBSO.js +0 -8
- package/dist/MCard-M4LKN4U2.js +0 -8
- package/dist/MCard-VB7UDUTN.js +0 -8
- package/dist/MCard-WOHE6SX6.js +0 -8
- package/dist/NetworkRuntime-2H7AQITA.js +0 -1571
- package/dist/NetworkRuntime-3MIUBNOF.js +0 -1571
- package/dist/NetworkRuntime-AOE2EJIM.js +0 -1571
- package/dist/NetworkRuntime-BQMDBUDO.js +0 -1570
- package/dist/NetworkRuntime-GMANLCAB.js +0 -1542
- package/dist/NetworkRuntime-L7P4VCGK.js +0 -1542
- package/dist/NetworkRuntime-LC7SUAOF.js +0 -1542
- package/dist/NetworkRuntime-OJWCWPBI.js +0 -1570
- package/dist/NetworkRuntime-ZJ3B4T3A.js +0 -1542
- package/dist/OllamaProvider-32RC36HD.js +0 -8
- package/dist/OllamaProvider-MQXSXLCA.js +0 -8
- package/dist/OllamaProvider-Q45BMOVN.js +0 -8
- package/dist/SqliteNodeEngine-WKVFWBNH.js +0 -9
- package/dist/StorageAdapter-DdDUiIvH.d.cts +0 -391
- package/dist/StorageAdapter-DdDUiIvH.d.ts +0 -391
- package/dist/StorageAdapter-Dw1BeOam.d.cts +0 -380
- package/dist/StorageAdapter-Dw1BeOam.d.ts +0 -380
- package/dist/chunk-23GCCCXB.js +0 -402
- package/dist/chunk-2ECISK2I.js +0 -354
- package/dist/chunk-2MRBTM72.js +0 -354
- package/dist/chunk-2THXO6FH.js +0 -2313
- package/dist/chunk-2VNRWIBZ.js +0 -389
- package/dist/chunk-2VOQRXWH.js +0 -296
- package/dist/chunk-34AYBZRO.js +0 -920
- package/dist/chunk-37EEYISR.js +0 -372
- package/dist/chunk-3E2TKOCZ.js +0 -354
- package/dist/chunk-3MMMJ7NH.js +0 -1068
- package/dist/chunk-437JTYVP.js +0 -292
- package/dist/chunk-4MQINOOG.js +0 -1218
- package/dist/chunk-4UIWXZHY.js +0 -1049
- package/dist/chunk-53S2EZCY.js +0 -290
- package/dist/chunk-5BIDGXA6.js +0 -987
- package/dist/chunk-5HXLTWYN.js +0 -296
- package/dist/chunk-5W2FDGUF.js +0 -371
- package/dist/chunk-6R4ERZMG.js +0 -1136
- package/dist/chunk-74YSNHEM.js +0 -2309
- package/dist/chunk-7H2BQZDK.js +0 -270
- package/dist/chunk-7KEWCCES.js +0 -1136
- package/dist/chunk-7PN2BUYF.js +0 -371
- package/dist/chunk-A2ZJA2EV.js +0 -389
- package/dist/chunk-ARPIBGRP.js +0 -1236
- package/dist/chunk-ATHNEEAG.js +0 -2309
- package/dist/chunk-AVXJOPUE.js +0 -354
- package/dist/chunk-B7VEU4S2.js +0 -204
- package/dist/chunk-C2TKISBR.js +0 -1213
- package/dist/chunk-CBH4YKB4.js +0 -2309
- package/dist/chunk-DP7HBRDL.js +0 -2309
- package/dist/chunk-DV7ZSH4W.js +0 -2309
- package/dist/chunk-DWXNZ5AJ.js +0 -642
- package/dist/chunk-EFKMZTT2.js +0 -270
- package/dist/chunk-FXJYXHG6.js +0 -266
- package/dist/chunk-G466I6RT.js +0 -229
- package/dist/chunk-GATPBTHL.js +0 -1142
- package/dist/chunk-GMQAHPBC.js +0 -292
- package/dist/chunk-GMWA2IJJ.js +0 -1105
- package/dist/chunk-GVX5LDLH.js +0 -371
- package/dist/chunk-HGENNKOJ.js +0 -355
- package/dist/chunk-HM2NBYHU.js +0 -292
- package/dist/chunk-IZWB5GCG.js +0 -389
- package/dist/chunk-J4HOFUKM.js +0 -2309
- package/dist/chunk-JIK2G3EH.js +0 -2313
- package/dist/chunk-JRXNWGSW.js +0 -1136
- package/dist/chunk-KRKK3KP6.js +0 -1081
- package/dist/chunk-KYXZHRUG.js +0 -389
- package/dist/chunk-L36L2VDL.js +0 -371
- package/dist/chunk-L5PZCES6.js +0 -204
- package/dist/chunk-L5U77ZEM.js +0 -1142
- package/dist/chunk-LQEKGX2T.js +0 -204
- package/dist/chunk-LWMUDMMQ.js +0 -1144
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-NZ6OQ7UT.js +0 -92
- package/dist/chunk-O2UMNZGF.js +0 -903
- package/dist/chunk-OFHDMLNM.js +0 -355
- package/dist/chunk-PDBMNUMB.js +0 -316
- package/dist/chunk-PW4XS7M3.js +0 -850
- package/dist/chunk-QA2XQMMJ.js +0 -2313
- package/dist/chunk-QL2JFNA7.js +0 -389
- package/dist/chunk-QPZ2HNSU.js +0 -912
- package/dist/chunk-QVGVU6OS.js +0 -296
- package/dist/chunk-RCEU7PFH.js +0 -270
- package/dist/chunk-RSTKX7WM.js +0 -907
- package/dist/chunk-RXL2CW64.js +0 -266
- package/dist/chunk-RXUF6Y43.js +0 -2309
- package/dist/chunk-SIAA4J6H.js +0 -21
- package/dist/chunk-SOJ2UMO2.js +0 -986
- package/dist/chunk-T3AG6DXY.js +0 -296
- package/dist/chunk-TPCNKMGZ.js +0 -355
- package/dist/chunk-TPT3S5AX.js +0 -204
- package/dist/chunk-TXWGIEVH.js +0 -2313
- package/dist/chunk-TZFI54AU.js +0 -2313
- package/dist/chunk-U3FWUPD3.js +0 -717
- package/dist/chunk-UFW2VW2D.js +0 -266
- package/dist/chunk-UTAOS5Y7.js +0 -2313
- package/dist/chunk-V7VX5OJ6.js +0 -389
- package/dist/chunk-W2XGNMYB.js +0 -355
- package/dist/chunk-W3M4HJ4U.js +0 -2309
- package/dist/chunk-WMJGGREP.js +0 -296
- package/dist/chunk-WTNVQ5WS.js +0 -732
- package/dist/chunk-WVFWNVT2.js +0 -1050
- package/dist/chunk-WY7EYSYC.js +0 -1236
- package/dist/chunk-X42F7DE3.js +0 -373
- package/dist/chunk-XC7Y4I7L.js +0 -290
- package/dist/chunk-YFULZTKP.js +0 -270
- package/dist/chunk-YSVHXKSZ.js +0 -373
- package/dist/chunk-YWGVK5OS.js +0 -292
- package/dist/chunk-Z4BRNTO5.js +0 -2313
- package/dist/chunk-ZDUXDKPD.js +0 -292
- package/dist/chunk-ZXQ2W7LO.js +0 -355
- package/dist/chunk-ZXQELXXO.js +0 -378
- package/dist/index.browser.d.ts.map +0 -1
- package/dist/index.browser.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib-4XS34IPZ.js +0 -778
- package/dist/model/CardCollection.d.ts +0 -147
- package/dist/model/CardCollection.d.ts.map +0 -1
- package/dist/model/CardCollection.js +0 -272
- package/dist/model/CardCollection.js.map +0 -1
- package/dist/model/ContentTypeInterpreter.d.ts +0 -28
- package/dist/model/ContentTypeInterpreter.d.ts.map +0 -1
- package/dist/model/ContentTypeInterpreter.js +0 -147
- package/dist/model/ContentTypeInterpreter.js.map +0 -1
- package/dist/model/EventProducer.d.ts +0 -10
- package/dist/model/EventProducer.d.ts.map +0 -1
- package/dist/model/EventProducer.js +0 -46
- package/dist/model/EventProducer.js.map +0 -1
- package/dist/model/GTime.d.ts +0 -44
- package/dist/model/GTime.d.ts.map +0 -1
- package/dist/model/GTime.js +0 -91
- package/dist/model/GTime.js.map +0 -1
- package/dist/model/Handle.d.ts +0 -37
- package/dist/model/Handle.d.ts.map +0 -1
- package/dist/model/Handle.js +0 -90
- package/dist/model/Handle.js.map +0 -1
- package/dist/model/MCard.d.ts +0 -145
- package/dist/model/MCard.d.ts.map +0 -1
- package/dist/model/MCard.js +0 -180
- package/dist/model/MCard.js.map +0 -1
- package/dist/model/PCard.d.ts +0 -271
- package/dist/model/PCard.d.ts.map +0 -1
- package/dist/model/PCard.js +0 -558
- package/dist/model/PCard.js.map +0 -1
- package/dist/model/VCard.d.ts +0 -277
- package/dist/model/VCard.d.ts.map +0 -1
- package/dist/model/VCard.js +0 -573
- package/dist/model/VCard.js.map +0 -1
- package/dist/model/constants.d.ts +0 -45
- package/dist/model/constants.d.ts.map +0 -1
- package/dist/model/constants.js +0 -27
- package/dist/model/constants.js.map +0 -1
- package/dist/model/vcard_vocabulary.d.ts +0 -174
- package/dist/model/vcard_vocabulary.d.ts.map +0 -1
- package/dist/model/vcard_vocabulary.js +0 -187
- package/dist/model/vcard_vocabulary.js.map +0 -1
- package/dist/monads/Either.d.ts +0 -51
- package/dist/monads/Either.d.ts.map +0 -1
- package/dist/monads/Either.js +0 -82
- package/dist/monads/Either.js.map +0 -1
- package/dist/monads/IO.d.ts +0 -38
- package/dist/monads/IO.d.ts.map +0 -1
- package/dist/monads/IO.js +0 -66
- package/dist/monads/IO.js.map +0 -1
- package/dist/monads/Maybe.d.ts +0 -45
- package/dist/monads/Maybe.d.ts.map +0 -1
- package/dist/monads/Maybe.js +0 -73
- package/dist/monads/Maybe.js.map +0 -1
- package/dist/monads/Reader.d.ts +0 -29
- package/dist/monads/Reader.d.ts.map +0 -1
- package/dist/monads/Reader.js +0 -44
- package/dist/monads/Reader.js.map +0 -1
- package/dist/monads/State.d.ts +0 -33
- package/dist/monads/State.d.ts.map +0 -1
- package/dist/monads/State.js +0 -50
- package/dist/monads/State.js.map +0 -1
- package/dist/monads/Writer.d.ts +0 -29
- package/dist/monads/Writer.d.ts.map +0 -1
- package/dist/monads/Writer.js +0 -46
- package/dist/monads/Writer.js.map +0 -1
- package/dist/ptr/Bridgelet.d.ts +0 -180
- package/dist/ptr/Bridgelet.d.ts.map +0 -1
- package/dist/ptr/Bridgelet.js +0 -296
- package/dist/ptr/Bridgelet.js.map +0 -1
- package/dist/ptr/CLMIntrospection.d.ts +0 -169
- package/dist/ptr/CLMIntrospection.d.ts.map +0 -1
- package/dist/ptr/CLMIntrospection.js +0 -329
- package/dist/ptr/CLMIntrospection.js.map +0 -1
- package/dist/ptr/FaroSidecar.d.ts +0 -56
- package/dist/ptr/FaroSidecar.d.ts.map +0 -1
- package/dist/ptr/FaroSidecar.js +0 -102
- package/dist/ptr/FaroSidecar.js.map +0 -1
- package/dist/ptr/LensProtocol.d.ts +0 -84
- package/dist/ptr/LensProtocol.d.ts.map +0 -1
- package/dist/ptr/LensProtocol.js +0 -98
- package/dist/ptr/LensProtocol.js.map +0 -1
- package/dist/ptr/OpenTelemetrySidecar.d.ts +0 -144
- package/dist/ptr/OpenTelemetrySidecar.d.ts.map +0 -1
- package/dist/ptr/OpenTelemetrySidecar.js +0 -232
- package/dist/ptr/OpenTelemetrySidecar.js.map +0 -1
- package/dist/ptr/SandboxWorker.d.ts +0 -79
- package/dist/ptr/SandboxWorker.d.ts.map +0 -1
- package/dist/ptr/SandboxWorker.js +0 -298
- package/dist/ptr/SandboxWorker.js.map +0 -1
- package/dist/ptr/common_types.d.ts +0 -39
- package/dist/ptr/common_types.d.ts.map +0 -1
- package/dist/ptr/common_types.js +0 -12
- package/dist/ptr/common_types.js.map +0 -1
- package/dist/rag/GraphRAGEngine.d.ts +0 -26
- package/dist/rag/GraphRAGEngine.d.ts.map +0 -1
- package/dist/rag/GraphRAGEngine.js +0 -166
- package/dist/rag/GraphRAGEngine.js.map +0 -1
- package/dist/rag/HandleVectorStore.d.ts +0 -201
- package/dist/rag/HandleVectorStore.d.ts.map +0 -1
- package/dist/rag/HandleVectorStore.js +0 -527
- package/dist/rag/HandleVectorStore.js.map +0 -1
- package/dist/rag/PersistentIndexer.d.ts +0 -148
- package/dist/rag/PersistentIndexer.d.ts.map +0 -1
- package/dist/rag/PersistentIndexer.js +0 -302
- package/dist/rag/PersistentIndexer.js.map +0 -1
- package/dist/rag/index.d.ts +0 -20
- package/dist/rag/index.d.ts.map +0 -1
- package/dist/rag/index.js +0 -26
- package/dist/rag/index.js.map +0 -1
- package/dist/rag/semanticVersioning.d.ts +0 -187
- package/dist/rag/semanticVersioning.d.ts.map +0 -1
- package/dist/rag/semanticVersioning.js +0 -253
- package/dist/rag/semanticVersioning.js.map +0 -1
- package/dist/storage/IndexedDBEngine.d.ts +0 -33
- package/dist/storage/IndexedDBEngine.d.ts.map +0 -1
- package/dist/storage/IndexedDBEngine.js +0 -198
- package/dist/storage/IndexedDBEngine.js.map +0 -1
- package/dist/storage/SqliteNodeEngine.d.ts.map +0 -1
- package/dist/storage/SqliteNodeEngine.js.map +0 -1
- package/dist/storage/SqliteWasmEngine.d.ts.map +0 -1
- package/dist/storage/SqliteWasmEngine.js.map +0 -1
- package/dist/storage/StorageAdapter.d.ts +0 -42
- package/dist/storage/StorageAdapter.d.ts.map +0 -1
- package/dist/storage/StorageAdapter.js +0 -2
- package/dist/storage/StorageAdapter.js.map +0 -1
- package/dist/storage/VectorStore.d.ts +0 -202
- package/dist/storage/VectorStore.d.ts.map +0 -1
- package/dist/storage/VectorStore.js +0 -557
- package/dist/storage/VectorStore.js.map +0 -1
- package/dist/storage/schema.d.ts +0 -162
- package/dist/storage/schema.d.ts.map +0 -1
- package/dist/storage/schema.js +0 -335
- package/dist/storage/schema.js.map +0 -1
- package/dist/storage/schema_constants.d.ts +0 -7
- package/dist/storage/schema_constants.d.ts.map +0 -1
- package/dist/storage/schema_constants.js +0 -415
- package/dist/storage/schema_constants.js.map +0 -1
- package/dist/types/dots.d.ts +0 -206
- package/dist/types/dots.d.ts.map +0 -1
- package/dist/types/dots.js +0 -201
- package/dist/types/dots.js.map +0 -1
package/dist/storage/schema.d.ts
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCard Database Schema Loader for JavaScript/TypeScript
|
|
3
|
-
*
|
|
4
|
-
* Singleton implementation that loads all schemas from:
|
|
5
|
-
* schema/mcard_schema.sql (SINGLE SOURCE OF TRUTH)
|
|
6
|
-
*
|
|
7
|
-
* This ensures schema consistency between Python and JavaScript runtimes.
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
* import { MCardSchema } from './schema';
|
|
11
|
-
*
|
|
12
|
-
* const schema = MCardSchema.getInstance();
|
|
13
|
-
* const cardSchema = schema.getTable('card');
|
|
14
|
-
* schema.initAllTables(db);
|
|
15
|
-
*
|
|
16
|
-
* Architecture Layers:
|
|
17
|
-
* Layer 1: Core Content Storage (card)
|
|
18
|
-
* Layer 2: Handle System (handle_registry, handle_history)
|
|
19
|
-
* Layer 3: Vector Storage (mcard_vector_metadata, mcard_embeddings)
|
|
20
|
-
* Layer 4: Semantic Versioning (handle_version_vectors, similarity_cache)
|
|
21
|
-
* Layer 5: Knowledge Graph (entities, relationships, communities)
|
|
22
|
-
*
|
|
23
|
-
* See: docs/architecture/Handle_Vector_Similarity_Design.md
|
|
24
|
-
*/
|
|
25
|
-
export type SchemaLayer = 'core' | 'handle' | 'vector' | 'semantic' | 'graph' | 'metadata';
|
|
26
|
-
/**
|
|
27
|
-
* Singleton class for MCard database schema management.
|
|
28
|
-
*
|
|
29
|
-
* Ensures all schema definitions come from the single source of truth:
|
|
30
|
-
* schema/mcard_schema.sql
|
|
31
|
-
*/
|
|
32
|
-
export declare class MCardSchema {
|
|
33
|
-
private static instance;
|
|
34
|
-
private schemaPath;
|
|
35
|
-
private rawSql;
|
|
36
|
-
private statements;
|
|
37
|
-
private tables;
|
|
38
|
-
private indexes;
|
|
39
|
-
private loaded;
|
|
40
|
-
private constructor();
|
|
41
|
-
/**
|
|
42
|
-
* Get the singleton instance.
|
|
43
|
-
*/
|
|
44
|
-
static getInstance(): MCardSchema;
|
|
45
|
-
/**
|
|
46
|
-
* Reset the singleton (for testing).
|
|
47
|
-
*/
|
|
48
|
-
static resetInstance(): void;
|
|
49
|
-
private load;
|
|
50
|
-
private parseStatements;
|
|
51
|
-
private extractName;
|
|
52
|
-
getSchemaPath(): string;
|
|
53
|
-
getTable(tableName: string): string | undefined;
|
|
54
|
-
getIndex(indexName: string): string | undefined;
|
|
55
|
-
getAllTables(): Map<string, string>;
|
|
56
|
-
getAllIndexes(): Map<string, string>;
|
|
57
|
-
getAllStatements(): string[];
|
|
58
|
-
getTablesByLayer(layer: SchemaLayer): string[];
|
|
59
|
-
getLayerStatements(layer: SchemaLayer): string[];
|
|
60
|
-
private execStatements;
|
|
61
|
-
initLayer(db: {
|
|
62
|
-
exec: (sql: string) => void;
|
|
63
|
-
}, layer: SchemaLayer): number;
|
|
64
|
-
initCoreTables(db: {
|
|
65
|
-
exec: (sql: string) => void;
|
|
66
|
-
}): number;
|
|
67
|
-
initHandleTables(db: {
|
|
68
|
-
exec: (sql: string) => void;
|
|
69
|
-
}): number;
|
|
70
|
-
initVectorTables(db: {
|
|
71
|
-
exec: (sql: string) => void;
|
|
72
|
-
}, enableFts?: boolean): number;
|
|
73
|
-
initSemanticTables(db: {
|
|
74
|
-
exec: (sql: string) => void;
|
|
75
|
-
}): number;
|
|
76
|
-
initGraphTables(db: {
|
|
77
|
-
exec: (sql: string) => void;
|
|
78
|
-
}): number;
|
|
79
|
-
initAllTables(db: {
|
|
80
|
-
exec: (sql: string) => void;
|
|
81
|
-
}, options?: {
|
|
82
|
-
enableFts?: boolean;
|
|
83
|
-
enableGraph?: boolean;
|
|
84
|
-
enableSemantic?: boolean;
|
|
85
|
-
}): number;
|
|
86
|
-
initVec0Table(db: {
|
|
87
|
-
exec: (sql: string) => void;
|
|
88
|
-
}, dimensions: number): void;
|
|
89
|
-
}
|
|
90
|
-
export declare const CARD_TABLE_SCHEMA: string;
|
|
91
|
-
export declare const HANDLE_REGISTRY_SCHEMA: string;
|
|
92
|
-
export declare const HANDLE_HISTORY_SCHEMA: string;
|
|
93
|
-
export declare const HANDLE_INDEX_SCHEMA: string;
|
|
94
|
-
export declare const VECTOR_METADATA_SCHEMA: string;
|
|
95
|
-
export declare const VECTOR_METADATA_INDEX: string;
|
|
96
|
-
export declare const VECTOR_EMBEDDINGS_SCHEMA: string;
|
|
97
|
-
export declare const VECTOR_FTS_SCHEMA: string;
|
|
98
|
-
export declare const HANDLE_VERSION_VECTORS_SCHEMA: string;
|
|
99
|
-
export declare const HANDLE_VERSION_VECTORS_INDEXES: string;
|
|
100
|
-
export declare const VERSION_SIMILARITY_CACHE_SCHEMA: string;
|
|
101
|
-
export declare const VERSION_SIMILARITY_CACHE_INDEX: string;
|
|
102
|
-
export declare const GRAPH_ENTITY_SCHEMA: string;
|
|
103
|
-
export declare const GRAPH_ENTITY_INDEX_NAME: string;
|
|
104
|
-
export declare const GRAPH_ENTITY_INDEX_TYPE: string;
|
|
105
|
-
export declare const GRAPH_ENTITY_INDEX_SOURCE: string;
|
|
106
|
-
export declare const GRAPH_RELATIONSHIP_SCHEMA: string;
|
|
107
|
-
export declare const GRAPH_RELATIONSHIP_INDEX_SOURCE: string;
|
|
108
|
-
export declare const GRAPH_RELATIONSHIP_INDEX_TARGET: string;
|
|
109
|
-
export declare const GRAPH_COMMUNITY_SCHEMA: string;
|
|
110
|
-
export declare const GRAPH_COMMUNITY_INDEX_LEVEL: string;
|
|
111
|
-
export declare const GRAPH_EXTRACTION_SCHEMA: string;
|
|
112
|
-
export declare const CORE_SCHEMAS: {
|
|
113
|
-
card: string;
|
|
114
|
-
handleRegistry: string;
|
|
115
|
-
handleHistory: string;
|
|
116
|
-
handleIndex: string;
|
|
117
|
-
};
|
|
118
|
-
export declare const VECTOR_SCHEMAS: {
|
|
119
|
-
metadata: string;
|
|
120
|
-
metadataIndex: string;
|
|
121
|
-
embeddings: string;
|
|
122
|
-
fts: string;
|
|
123
|
-
};
|
|
124
|
-
export declare const SEMANTIC_SCHEMAS: {
|
|
125
|
-
handleVersionVectors: string;
|
|
126
|
-
handleVersionVectorsIndexes: string;
|
|
127
|
-
similarityCache: string;
|
|
128
|
-
similarityCacheIndex: string;
|
|
129
|
-
};
|
|
130
|
-
export declare const GRAPH_SCHEMAS: {
|
|
131
|
-
entities: string;
|
|
132
|
-
entityIndexName: string;
|
|
133
|
-
entityIndexType: string;
|
|
134
|
-
entityIndexSource: string;
|
|
135
|
-
relationships: string;
|
|
136
|
-
relIndexSource: string;
|
|
137
|
-
relIndexTarget: string;
|
|
138
|
-
communities: string;
|
|
139
|
-
communityIndexLevel: string;
|
|
140
|
-
extractions: string;
|
|
141
|
-
};
|
|
142
|
-
export declare function initCoreSchemas(db: {
|
|
143
|
-
exec: (sql: string) => void;
|
|
144
|
-
}): void;
|
|
145
|
-
export declare function initVectorSchemas(db: {
|
|
146
|
-
exec: (sql: string) => void;
|
|
147
|
-
}, enableFts?: boolean): void;
|
|
148
|
-
export declare function initSemanticSchemas(db: {
|
|
149
|
-
exec: (sql: string) => void;
|
|
150
|
-
}): void;
|
|
151
|
-
export declare function initGraphSchemas(db: {
|
|
152
|
-
exec: (sql: string) => void;
|
|
153
|
-
}): void;
|
|
154
|
-
export declare function initAllSchemas(db: {
|
|
155
|
-
exec: (sql: string) => void;
|
|
156
|
-
}, options?: {
|
|
157
|
-
enableFts?: boolean;
|
|
158
|
-
enableGraph?: boolean;
|
|
159
|
-
enableSemantic?: boolean;
|
|
160
|
-
}): void;
|
|
161
|
-
export declare function getVec0Schema(dimensions: number): string;
|
|
162
|
-
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/storage/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAYH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CAAC;AA4B3F;;;;;GAKG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA4B;IAEnD,OAAO,CAAC,UAAU,CAAc;IAChC,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,MAAM,CAAkB;IAEhC,OAAO;IAEP;;OAEG;IACH,MAAM,CAAC,WAAW,IAAI,WAAW;IAQjC;;OAEG;IACH,MAAM,CAAC,aAAa,IAAI,IAAI;IAI5B,OAAO,CAAC,IAAI;IA4BZ,OAAO,CAAC,eAAe;IA2BvB,OAAO,CAAC,WAAW;IAgBnB,aAAa,IAAI,MA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;;;CAK1B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;CAK5B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;CAWzB,CAAC;AAMF,wBAAgB,eAAe,CAAC,EAAE,EAAE;IAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GAAG,IAAI,CAMzE;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE;IAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,EAAE,SAAS,GAAE,OAAc,GAAG,IAAI,CAEtG;AAED,wBAAgB,mBAAmB,CAAC,EAAE,EAAE;IAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GAAG,IAAI,CAE7E;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE;IAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GAAG,IAAI,CAE1E;AAED,wBAAgB,cAAc,CAC1B,EAAE,EAAE;IAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,EACnC,OAAO,GAAE;IACL,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;CACvB,GACP,IAAI,CAEN;AAGD,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAOxD"}
|
package/dist/storage/schema.js
DELETED
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCard Database Schema Loader for JavaScript/TypeScript
|
|
3
|
-
*
|
|
4
|
-
* Singleton implementation that loads all schemas from:
|
|
5
|
-
* schema/mcard_schema.sql (SINGLE SOURCE OF TRUTH)
|
|
6
|
-
*
|
|
7
|
-
* This ensures schema consistency between Python and JavaScript runtimes.
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
* import { MCardSchema } from './schema';
|
|
11
|
-
*
|
|
12
|
-
* const schema = MCardSchema.getInstance();
|
|
13
|
-
* const cardSchema = schema.getTable('card');
|
|
14
|
-
* schema.initAllTables(db);
|
|
15
|
-
*
|
|
16
|
-
* Architecture Layers:
|
|
17
|
-
* Layer 1: Core Content Storage (card)
|
|
18
|
-
* Layer 2: Handle System (handle_registry, handle_history)
|
|
19
|
-
* Layer 3: Vector Storage (mcard_vector_metadata, mcard_embeddings)
|
|
20
|
-
* Layer 4: Semantic Versioning (handle_version_vectors, similarity_cache)
|
|
21
|
-
* Layer 5: Knowledge Graph (entities, relationships, communities)
|
|
22
|
-
*
|
|
23
|
-
* See: docs/architecture/Handle_Vector_Similarity_Design.md
|
|
24
|
-
*/
|
|
25
|
-
import { MCARD_SCHEMA_SQL, MCARD_VECTOR_SCHEMA_SQL } from './schema_constants';
|
|
26
|
-
const TABLE_LAYERS = {
|
|
27
|
-
// Layer 1: Core
|
|
28
|
-
'card': 'core',
|
|
29
|
-
// Layer 2: Handle System
|
|
30
|
-
'handle_registry': 'handle',
|
|
31
|
-
'handle_history': 'handle',
|
|
32
|
-
// Layer 3: Vector Storage
|
|
33
|
-
'mcard_vector_metadata': 'vector',
|
|
34
|
-
'mcard_embeddings': 'vector',
|
|
35
|
-
'mcard_fts': 'vector',
|
|
36
|
-
// Layer 4: Semantic Versioning
|
|
37
|
-
'handle_version_vectors': 'semantic',
|
|
38
|
-
'version_similarity_cache': 'semantic',
|
|
39
|
-
// Layer 5: Knowledge Graph
|
|
40
|
-
'graph_entities': 'graph',
|
|
41
|
-
'graph_relationships': 'graph',
|
|
42
|
-
'graph_communities': 'graph',
|
|
43
|
-
'graph_extractions': 'graph',
|
|
44
|
-
// Metadata
|
|
45
|
-
'schema_version': 'metadata',
|
|
46
|
-
};
|
|
47
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
48
|
-
// Singleton Schema Manager
|
|
49
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
50
|
-
/**
|
|
51
|
-
* Singleton class for MCard database schema management.
|
|
52
|
-
*
|
|
53
|
-
* Ensures all schema definitions come from the single source of truth:
|
|
54
|
-
* schema/mcard_schema.sql
|
|
55
|
-
*/
|
|
56
|
-
export class MCardSchema {
|
|
57
|
-
static instance = null;
|
|
58
|
-
schemaPath = '';
|
|
59
|
-
rawSql = '';
|
|
60
|
-
statements = [];
|
|
61
|
-
tables = new Map();
|
|
62
|
-
indexes = new Map();
|
|
63
|
-
loaded = false;
|
|
64
|
-
constructor() { }
|
|
65
|
-
/**
|
|
66
|
-
* Get the singleton instance.
|
|
67
|
-
*/
|
|
68
|
-
static getInstance() {
|
|
69
|
-
if (!MCardSchema.instance) {
|
|
70
|
-
MCardSchema.instance = new MCardSchema();
|
|
71
|
-
MCardSchema.instance.load();
|
|
72
|
-
}
|
|
73
|
-
return MCardSchema.instance;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Reset the singleton (for testing).
|
|
77
|
-
*/
|
|
78
|
-
static resetInstance() {
|
|
79
|
-
MCardSchema.instance = null;
|
|
80
|
-
}
|
|
81
|
-
load() {
|
|
82
|
-
if (this.loaded)
|
|
83
|
-
return;
|
|
84
|
-
this.schemaPath = 'IN_MEMORY_CONSTANTS'; // path no longer relevant
|
|
85
|
-
this.rawSql = MCARD_SCHEMA_SQL;
|
|
86
|
-
// Load vector schema if available
|
|
87
|
-
if (MCARD_VECTOR_SCHEMA_SQL) {
|
|
88
|
-
this.rawSql += "\n\n" + MCARD_VECTOR_SCHEMA_SQL;
|
|
89
|
-
}
|
|
90
|
-
this.statements = this.parseStatements(this.rawSql);
|
|
91
|
-
for (const stmt of this.statements) {
|
|
92
|
-
const name = this.extractName(stmt);
|
|
93
|
-
if (name) {
|
|
94
|
-
const upper = stmt.toUpperCase();
|
|
95
|
-
if (upper.includes('CREATE TABLE') || upper.includes('CREATE VIRTUAL TABLE')) {
|
|
96
|
-
this.tables.set(name.toLowerCase(), stmt);
|
|
97
|
-
}
|
|
98
|
-
else if (upper.includes('CREATE INDEX')) {
|
|
99
|
-
this.indexes.set(name.toLowerCase(), stmt);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
this.loaded = true;
|
|
104
|
-
}
|
|
105
|
-
parseStatements(sql) {
|
|
106
|
-
// Remove block comments
|
|
107
|
-
sql = sql.replace(/\/\*[\s\S]*?\*\//g, '');
|
|
108
|
-
const statements = [];
|
|
109
|
-
let current = [];
|
|
110
|
-
for (const line of sql.split('\n')) {
|
|
111
|
-
// Skip line comments
|
|
112
|
-
const stripped = line.split('--')[0].trim();
|
|
113
|
-
if (!stripped)
|
|
114
|
-
continue;
|
|
115
|
-
current.push(stripped);
|
|
116
|
-
if (stripped.endsWith(';')) {
|
|
117
|
-
const statement = current.join(' ');
|
|
118
|
-
// Skip INSERT statements
|
|
119
|
-
if (!statement.trim().toUpperCase().startsWith('INSERT')) {
|
|
120
|
-
statements.push(statement);
|
|
121
|
-
}
|
|
122
|
-
current = [];
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return statements.filter(s => s.trim());
|
|
126
|
-
}
|
|
127
|
-
extractName(statement) {
|
|
128
|
-
// Handle CREATE TABLE
|
|
129
|
-
let match = statement.match(/CREATE\s+(?:VIRTUAL\s+)?TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(\w+)/i);
|
|
130
|
-
if (match)
|
|
131
|
-
return match[1];
|
|
132
|
-
// Handle CREATE INDEX
|
|
133
|
-
match = statement.match(/CREATE\s+INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(\w+)/i);
|
|
134
|
-
if (match)
|
|
135
|
-
return match[1];
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
139
|
-
// Schema Access
|
|
140
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
141
|
-
getSchemaPath() {
|
|
142
|
-
return this.schemaPath;
|
|
143
|
-
}
|
|
144
|
-
getTable(tableName) {
|
|
145
|
-
return this.tables.get(tableName.toLowerCase());
|
|
146
|
-
}
|
|
147
|
-
getIndex(indexName) {
|
|
148
|
-
return this.indexes.get(indexName.toLowerCase());
|
|
149
|
-
}
|
|
150
|
-
getAllTables() {
|
|
151
|
-
return new Map(this.tables);
|
|
152
|
-
}
|
|
153
|
-
getAllIndexes() {
|
|
154
|
-
return new Map(this.indexes);
|
|
155
|
-
}
|
|
156
|
-
getAllStatements() {
|
|
157
|
-
return [...this.statements];
|
|
158
|
-
}
|
|
159
|
-
getTablesByLayer(layer) {
|
|
160
|
-
return Object.entries(TABLE_LAYERS)
|
|
161
|
-
.filter(([_, l]) => l === layer)
|
|
162
|
-
.map(([name, _]) => name);
|
|
163
|
-
}
|
|
164
|
-
getLayerStatements(layer) {
|
|
165
|
-
const statements = [];
|
|
166
|
-
const tables = this.getTablesByLayer(layer);
|
|
167
|
-
// Add tables
|
|
168
|
-
for (const table of tables) {
|
|
169
|
-
const stmt = this.getTable(table);
|
|
170
|
-
if (stmt)
|
|
171
|
-
statements.push(stmt);
|
|
172
|
-
}
|
|
173
|
-
// Add indexes for these tables
|
|
174
|
-
for (const [_, stmt] of this.indexes) {
|
|
175
|
-
const match = stmt.match(/ON\s+(\w+)/i);
|
|
176
|
-
if (match && tables.includes(match[1].toLowerCase())) {
|
|
177
|
-
statements.push(stmt);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return statements;
|
|
181
|
-
}
|
|
182
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
183
|
-
// Database Initialization
|
|
184
|
-
// ─────────────────────────────────────────────────────────────────────────
|
|
185
|
-
execStatements(db, statements) {
|
|
186
|
-
for (const stmt of statements) {
|
|
187
|
-
db.exec(stmt);
|
|
188
|
-
}
|
|
189
|
-
return statements.length;
|
|
190
|
-
}
|
|
191
|
-
initLayer(db, layer) {
|
|
192
|
-
return this.execStatements(db, this.getLayerStatements(layer));
|
|
193
|
-
}
|
|
194
|
-
initCoreTables(db) {
|
|
195
|
-
return this.initLayer(db, 'core');
|
|
196
|
-
}
|
|
197
|
-
initHandleTables(db) {
|
|
198
|
-
return this.initLayer(db, 'handle');
|
|
199
|
-
}
|
|
200
|
-
initVectorTables(db, enableFts = true) {
|
|
201
|
-
const statements = this.getLayerStatements('vector')
|
|
202
|
-
.filter(s => enableFts || !s.toLowerCase().includes('fts'));
|
|
203
|
-
return this.execStatements(db, statements);
|
|
204
|
-
}
|
|
205
|
-
initSemanticTables(db) {
|
|
206
|
-
return this.initLayer(db, 'semantic');
|
|
207
|
-
}
|
|
208
|
-
initGraphTables(db) {
|
|
209
|
-
return this.initLayer(db, 'graph');
|
|
210
|
-
}
|
|
211
|
-
initAllTables(db, options = {}) {
|
|
212
|
-
const { enableFts = true, enableGraph = true, enableSemantic = true } = options;
|
|
213
|
-
let count = 0;
|
|
214
|
-
count += this.initCoreTables(db);
|
|
215
|
-
count += this.initHandleTables(db);
|
|
216
|
-
count += this.initVectorTables(db, enableFts);
|
|
217
|
-
if (enableSemantic) {
|
|
218
|
-
count += this.initSemanticTables(db);
|
|
219
|
-
}
|
|
220
|
-
if (enableGraph) {
|
|
221
|
-
count += this.initGraphTables(db);
|
|
222
|
-
}
|
|
223
|
-
return count;
|
|
224
|
-
}
|
|
225
|
-
initVec0Table(db, dimensions) {
|
|
226
|
-
db.exec(`
|
|
227
|
-
CREATE VIRTUAL TABLE IF NOT EXISTS mcard_vec USING vec0(
|
|
228
|
-
metadata_id INTEGER PRIMARY KEY,
|
|
229
|
-
embedding float[${dimensions}]
|
|
230
|
-
)
|
|
231
|
-
`);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
235
|
-
// Convenience Exports (Backward Compatibility)
|
|
236
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
237
|
-
// These are lazy-loaded from the singleton
|
|
238
|
-
let _cachedSchemas = {};
|
|
239
|
-
function getSchemaInstance() {
|
|
240
|
-
return MCardSchema.getInstance();
|
|
241
|
-
}
|
|
242
|
-
// Core schemas
|
|
243
|
-
export const CARD_TABLE_SCHEMA = getSchemaInstance().getTable('card') || '';
|
|
244
|
-
export const HANDLE_REGISTRY_SCHEMA = getSchemaInstance().getTable('handle_registry') || '';
|
|
245
|
-
export const HANDLE_HISTORY_SCHEMA = getSchemaInstance().getTable('handle_history') || '';
|
|
246
|
-
export const HANDLE_INDEX_SCHEMA = getSchemaInstance().getIndex('idx_handle_current_hash') || '';
|
|
247
|
-
// Vector schemas
|
|
248
|
-
export const VECTOR_METADATA_SCHEMA = getSchemaInstance().getTable('mcard_vector_metadata') || '';
|
|
249
|
-
export const VECTOR_METADATA_INDEX = getSchemaInstance().getIndex('idx_vector_metadata_hash') || '';
|
|
250
|
-
export const VECTOR_EMBEDDINGS_SCHEMA = getSchemaInstance().getTable('mcard_embeddings') || '';
|
|
251
|
-
export const VECTOR_FTS_SCHEMA = getSchemaInstance().getTable('mcard_fts') || '';
|
|
252
|
-
// Semantic versioning schemas
|
|
253
|
-
export const HANDLE_VERSION_VECTORS_SCHEMA = getSchemaInstance().getTable('handle_version_vectors') || '';
|
|
254
|
-
export const HANDLE_VERSION_VECTORS_INDEXES = [
|
|
255
|
-
getSchemaInstance().getIndex('idx_hvv_handle'),
|
|
256
|
-
getSchemaInstance().getIndex('idx_hvv_hash'),
|
|
257
|
-
getSchemaInstance().getIndex('idx_hvv_current'),
|
|
258
|
-
getSchemaInstance().getIndex('idx_hvv_parent'),
|
|
259
|
-
].filter(Boolean).join('; ');
|
|
260
|
-
export const VERSION_SIMILARITY_CACHE_SCHEMA = getSchemaInstance().getTable('version_similarity_cache') || '';
|
|
261
|
-
export const VERSION_SIMILARITY_CACHE_INDEX = getSchemaInstance().getIndex('idx_vsc_handle') || '';
|
|
262
|
-
// Graph schemas
|
|
263
|
-
export const GRAPH_ENTITY_SCHEMA = getSchemaInstance().getTable('graph_entities') || '';
|
|
264
|
-
export const GRAPH_ENTITY_INDEX_NAME = getSchemaInstance().getIndex('idx_entity_name') || '';
|
|
265
|
-
export const GRAPH_ENTITY_INDEX_TYPE = getSchemaInstance().getIndex('idx_entity_type') || '';
|
|
266
|
-
export const GRAPH_ENTITY_INDEX_SOURCE = getSchemaInstance().getIndex('idx_entity_source') || '';
|
|
267
|
-
export const GRAPH_RELATIONSHIP_SCHEMA = getSchemaInstance().getTable('graph_relationships') || '';
|
|
268
|
-
export const GRAPH_RELATIONSHIP_INDEX_SOURCE = getSchemaInstance().getIndex('idx_rel_source') || '';
|
|
269
|
-
export const GRAPH_RELATIONSHIP_INDEX_TARGET = getSchemaInstance().getIndex('idx_rel_target') || '';
|
|
270
|
-
export const GRAPH_COMMUNITY_SCHEMA = getSchemaInstance().getTable('graph_communities') || '';
|
|
271
|
-
export const GRAPH_COMMUNITY_INDEX_LEVEL = getSchemaInstance().getIndex('idx_community_level') || '';
|
|
272
|
-
export const GRAPH_EXTRACTION_SCHEMA = getSchemaInstance().getTable('graph_extractions') || '';
|
|
273
|
-
// Schema collections
|
|
274
|
-
export const CORE_SCHEMAS = {
|
|
275
|
-
card: CARD_TABLE_SCHEMA,
|
|
276
|
-
handleRegistry: HANDLE_REGISTRY_SCHEMA,
|
|
277
|
-
handleHistory: HANDLE_HISTORY_SCHEMA,
|
|
278
|
-
handleIndex: HANDLE_INDEX_SCHEMA,
|
|
279
|
-
};
|
|
280
|
-
export const VECTOR_SCHEMAS = {
|
|
281
|
-
metadata: VECTOR_METADATA_SCHEMA,
|
|
282
|
-
metadataIndex: VECTOR_METADATA_INDEX,
|
|
283
|
-
embeddings: VECTOR_EMBEDDINGS_SCHEMA,
|
|
284
|
-
fts: VECTOR_FTS_SCHEMA,
|
|
285
|
-
};
|
|
286
|
-
export const SEMANTIC_SCHEMAS = {
|
|
287
|
-
handleVersionVectors: HANDLE_VERSION_VECTORS_SCHEMA,
|
|
288
|
-
handleVersionVectorsIndexes: HANDLE_VERSION_VECTORS_INDEXES,
|
|
289
|
-
similarityCache: VERSION_SIMILARITY_CACHE_SCHEMA,
|
|
290
|
-
similarityCacheIndex: VERSION_SIMILARITY_CACHE_INDEX,
|
|
291
|
-
};
|
|
292
|
-
export const GRAPH_SCHEMAS = {
|
|
293
|
-
entities: GRAPH_ENTITY_SCHEMA,
|
|
294
|
-
entityIndexName: GRAPH_ENTITY_INDEX_NAME,
|
|
295
|
-
entityIndexType: GRAPH_ENTITY_INDEX_TYPE,
|
|
296
|
-
entityIndexSource: GRAPH_ENTITY_INDEX_SOURCE,
|
|
297
|
-
relationships: GRAPH_RELATIONSHIP_SCHEMA,
|
|
298
|
-
relIndexSource: GRAPH_RELATIONSHIP_INDEX_SOURCE,
|
|
299
|
-
relIndexTarget: GRAPH_RELATIONSHIP_INDEX_TARGET,
|
|
300
|
-
communities: GRAPH_COMMUNITY_SCHEMA,
|
|
301
|
-
communityIndexLevel: GRAPH_COMMUNITY_INDEX_LEVEL,
|
|
302
|
-
extractions: GRAPH_EXTRACTION_SCHEMA,
|
|
303
|
-
};
|
|
304
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
305
|
-
// Initialization Functions (use singleton internally)
|
|
306
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
307
|
-
export function initCoreSchemas(db) {
|
|
308
|
-
const schema = MCardSchema.getInstance();
|
|
309
|
-
// Initialize both core (card) and handle tables (handle_registry, handle_history)
|
|
310
|
-
// because they are fundamental to MCard operation
|
|
311
|
-
schema.initCoreTables(db);
|
|
312
|
-
schema.initHandleTables(db);
|
|
313
|
-
}
|
|
314
|
-
export function initVectorSchemas(db, enableFts = true) {
|
|
315
|
-
MCardSchema.getInstance().initVectorTables(db, enableFts);
|
|
316
|
-
}
|
|
317
|
-
export function initSemanticSchemas(db) {
|
|
318
|
-
MCardSchema.getInstance().initSemanticTables(db);
|
|
319
|
-
}
|
|
320
|
-
export function initGraphSchemas(db) {
|
|
321
|
-
MCardSchema.getInstance().initGraphTables(db);
|
|
322
|
-
}
|
|
323
|
-
export function initAllSchemas(db, options = {}) {
|
|
324
|
-
MCardSchema.getInstance().initAllTables(db, options);
|
|
325
|
-
}
|
|
326
|
-
// Dynamic schema generator (dimensions can't come from SQL file)
|
|
327
|
-
export function getVec0Schema(dimensions) {
|
|
328
|
-
return `
|
|
329
|
-
CREATE VIRTUAL TABLE IF NOT EXISTS mcard_vec USING vec0(
|
|
330
|
-
metadata_id INTEGER PRIMARY KEY,
|
|
331
|
-
embedding float[${dimensions}]
|
|
332
|
-
)
|
|
333
|
-
`;
|
|
334
|
-
}
|
|
335
|
-
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/storage/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAY/E,MAAM,YAAY,GAAgC;IAC9C,gBAAgB;IAChB,MAAM,EAAE,MAAM;IACd,yBAAyB;IACzB,iBAAiB,EAAE,QAAQ;IAC3B,gBAAgB,EAAE,QAAQ;IAC1B,0BAA0B;IAC1B,uBAAuB,EAAE,QAAQ;IACjC,kBAAkB,EAAE,QAAQ;IAC5B,WAAW,EAAE,QAAQ;IACrB,+BAA+B;IAC/B,wBAAwB,EAAE,UAAU;IACpC,0BAA0B,EAAE,UAAU;IACtC,2BAA2B;IAC3B,gBAAgB,EAAE,OAAO;IACzB,qBAAqB,EAAE,OAAO;IAC9B,mBAAmB,EAAE,OAAO;IAC5B,mBAAmB,EAAE,OAAO;IAC5B,WAAW;IACX,gBAAgB,EAAE,UAAU;CAC/B,CAAC;AAEF,gFAAgF;AAChF,2BAA2B;AAC3B,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,OAAO,WAAW;IACZ,MAAM,CAAC,QAAQ,GAAuB,IAAI,CAAC;IAE3C,UAAU,GAAW,EAAE,CAAC;IAC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AA2B;IAChD,WAAW,EAAE,uBAAuB;CACvC,CAAC;AAEF,gFAAgF;AAChF,sDAAsD;AACtD,gFAAgF;AAEhF,MAAM,UAAU,eAAe,CAAC,EAAmC;IAC/D,MAAM,MAAM,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;IACzC,kFAAkF;IAClF,kDAAkD;IAClD,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAC1B,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,EAAmC,EAAE,YAAqB,IAAI;IAC5F,WAAW,CAAC,WAAW,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,EAAmC;IACnE,WAAW,CAAC,WAAW,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,EAAmC;IAChE,WAAW,CAAC,WAAW,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,cAAc,CAC1B,EAAmC,EACnC,UAII,EAAE;IAEN,WAAW,CAAC,WAAW,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,aAAa,CAAC,UAAkB;IAC5C,OAAO;;;sBAGW,UAAU;;CAE/B,CAAC;AACF,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AUTO-GENERATED FILE - DO NOT EDIT
|
|
3
|
-
* Generated by scripts/sync-schemas.js
|
|
4
|
-
*/
|
|
5
|
-
export declare const MCARD_SCHEMA_SQL = "-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- MCard Unified Database Schema (Monadic Core)\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- \n-- STABILITY WARNING: This schema is the invariant \"seeding meta-language\" for all\n-- Domain Specific Languages (DSLs). It must remain as stable as possible.\n--\n-- THE UNIFICATION THESIS:\n-- This design unites three distinct namespaces into a single relational network\n-- by leveraging the power of cryptographic hash functions:\n-- 1. CONTENT SPACE (Intrinsic Identity): Content-Addressable Storage (CAS).\n-- 2. HANDLE SPACE (Reserved Words): Mapping human logic to content hashes.\n-- 3. VERSION SPACE (Temporal Evolution): Tracking state transitions via hash history.\n--\n-- TURING MACHINE ANALOGY (The Infinitely Long Tape):\n-- The `card` table stores content blobs with unique identities, emulating the \n-- \"Infinitely Long Tape\" of the Turing Machine formalism. By using relational \n-- queries, this tape can be dynamically constructed and traversed for different \n-- DSLs, providing a flexible substrate for practically all computable languages.\n--\n-- By using hash values as the universal primitives across content, handles, and \n-- time, we create a \"Wordless Book\" \u2014 a minimal substrate capable of seeding any \n-- domain-specific knowledge system without requiring schema changes.\n--\n-- Monadic Mapping (See: Monadic Justification for Schema Design.md):\n-- 1. Card = Monad (Perception/State/Exponent) - Intrinsic Identity\n-- 2. Handle = Registry (Appetition/Reader/Sum) - Mutable Reference\n-- 3. Version = History (Harmony/Writer/Product) - Coordinated Evolution\n--\n-- Version: 3.0.2 (Turing Tape Refinement)\n-- Last Updated: 2025-12-20\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- LAYER 1: CORE CONTENT-ADDRESSABLE STORAGE (The Monad / Exponent)\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- The fundamental MCard storage: content-addressed by cryptographic hash.\n-- \"Each Monad ... mirrors the universe\"\n\n-- @table card\n-- @description Core content-addressable storage table (Monad/State)\n-- @column hash - SHA-256 hash of content (primary key)\n-- @column content - The actual content (BLOB for binary safety)\n-- @column g_time - Generation timestamp (ISO 8601)\nCREATE TABLE IF NOT EXISTS card (\n hash TEXT PRIMARY KEY,\n content BLOB NOT NULL,\n g_time TEXT NOT NULL\n);\n\n\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- LAYER 2: HANDLE SYSTEM (Appetition / Sum)\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- The mutable pointer that \"desires\" to reference new content.\n-- \"Appetition: the tendency to move to new states\"\n\n-- @table handle_registry (Monadic Role: Handle)\n-- @description Maps human-readable handles to current content hashes\n-- @column handle - UTF-8 handle name (primary key)\n-- @column current_hash - FK to card.hash of current version\n-- @column created_at - When handle was first created\n-- @column updated_at - When handle was last updated\nCREATE TABLE IF NOT EXISTS handle_registry (\n handle TEXT PRIMARY KEY,\n current_hash TEXT NOT NULL,\n created_at TEXT NOT NULL,\n updated_at TEXT NOT NULL,\n FOREIGN KEY (current_hash) REFERENCES card(hash)\n);\n\n-- @index idx_handle_current_hash\n-- @description Efficient reverse lookup from hash to handles\nCREATE INDEX IF NOT EXISTS idx_handle_current_hash \nON handle_registry(current_hash);\n\n-- @table handle_history (Monadic Role: Version / Product)\n-- @description Audit trail for handle pointer changes (Pre-Established Harmony)\n-- @column id - Auto-increment primary key\n-- @column handle - The handle that was updated\n-- @column previous_hash - Hash it pointed to before update\n-- @column changed_at - When the change occurred\nCREATE TABLE IF NOT EXISTS handle_history (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n handle TEXT NOT NULL,\n previous_hash TEXT NOT NULL,\n changed_at TEXT NOT NULL,\n FOREIGN KEY (handle) REFERENCES handle_registry(handle),\n FOREIGN KEY (previous_hash) REFERENCES card(hash)\n);\n\n-- @index idx_handle_history_handle\n-- @description Efficient lookup of history by handle\nCREATE INDEX IF NOT EXISTS idx_handle_history_handle \nON handle_history(handle);\n\n\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- LEGACY SUPPORT: FTS5 Documents Table\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- KEPT FOR BACKWARD COMPATIBILITY with existing codebase.\n-- New implementations should use mcard_vector_schema.sql -> mcard_fts\n\n-- @virtual_table documents\n-- @description Legacy FTS table for backward compatibility\n-- @note Synced with card table via triggers\nCREATE VIRTUAL TABLE IF NOT EXISTS documents USING fts5(content);\n\n\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- SCHEMA METADATA\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n-- @table schema_version\n-- @description Tracks schema version for migrations\nCREATE TABLE IF NOT EXISTS schema_version (\n version TEXT PRIMARY KEY,\n applied_at TEXT NOT NULL,\n description TEXT\n);\n\n-- Insert current schema version\nINSERT OR IGNORE INTO schema_version (version, applied_at, description)\nVALUES ('3.0.0', datetime('now'), 'Monadic Core Schema (split vectors to mcard_vector_schema.sql)');\n";
|
|
6
|
-
export declare const MCARD_VECTOR_SCHEMA_SQL = "-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- MCard Vector Database Schema (mcard_vectors.db)\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- \n-- This schema defines the structure for \"Secondary Qualities\" (Extrinsic Embeddings).\n-- It is separated from the core mcard.db (Monadic Intrinsic Properties) to ensure:\n-- 1. Separation of Concerns (Intrinsic vs Extrinsic)\n-- 2. Linearity (Vectors are observer-dependent and large)\n-- 3. Upgradability (Embedding models change frequently)\n--\n-- See: Monadic Justification for Schema Design.md\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- LAYER 3: VECTOR STORAGE (Semantic Embeddings)\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- Storage for vector embeddings enabling semantic search.\n-- Links to content via hash for content-addressing.\n\n-- @table mcard_vector_metadata\n-- @description Metadata for stored embeddings\n-- @column id - Auto-increment primary key\n-- @column hash - FK to card.hash\n-- @column model_name - Embedding model used (e.g., \"nomic-embed-text\")\n-- @column dimensions - Vector dimensions\n-- @column chunk_index - Index for chunked documents (0 = first/whole)\n-- @column chunk_total - Total chunks for this document\n-- @column chunk_text - Preview text for this chunk\n-- @column created_at - When embedding was created\nCREATE TABLE IF NOT EXISTS mcard_vector_metadata (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n hash TEXT NOT NULL,\n model_name TEXT NOT NULL,\n dimensions INTEGER NOT NULL,\n chunk_index INTEGER DEFAULT 0,\n chunk_total INTEGER DEFAULT 1,\n chunk_text TEXT,\n created_at TEXT NOT NULL,\n UNIQUE(hash, chunk_index)\n);\n\n-- @index idx_vector_metadata_hash\n-- @description Efficient lookup of embeddings by content hash\nCREATE INDEX IF NOT EXISTS idx_vector_metadata_hash \nON mcard_vector_metadata(hash);\n\n-- @table mcard_embeddings\n-- @description Fallback embedding storage when sqlite-vec is unavailable\n-- @column id - Auto-increment primary key\n-- @column metadata_id - FK to mcard_vector_metadata.id\n-- @column embedding - Serialized float32 vector as BLOB\nCREATE TABLE IF NOT EXISTS mcard_embeddings (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n metadata_id INTEGER NOT NULL,\n embedding BLOB NOT NULL,\n UNIQUE(metadata_id),\n FOREIGN KEY (metadata_id) REFERENCES mcard_vector_metadata(id)\n);\n\n-- @virtual_table mcard_fts\n-- @description Full-text search for hybrid retrieval\n-- @note Uses Porter stemming with Unicode support\nCREATE VIRTUAL TABLE IF NOT EXISTS mcard_fts USING fts5(\n hash,\n content,\n tokenize='porter unicode61'\n);\n\n-- Note: sqlite-vec virtual table is created dynamically with dimensions:\n-- CREATE VIRTUAL TABLE IF NOT EXISTS mcard_vec USING vec0(\n-- metadata_id INTEGER PRIMARY KEY,\n-- embedding float[${dimensions}]\n-- );\n\n\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- LAYER 4: SEMANTIC VERSIONING (Handle-Vector Bridge)\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- Bridges handles to vector embeddings for semantic version comparison.\n-- Enables measuring semantic drift between document versions.\n\n-- @table handle_version_vectors\n-- @description Links handle versions to their semantic embeddings\n-- @column id - Auto-increment primary key\n-- @column handle - FK to handle_registry.handle\n-- @column hash - FK to card.hash (this version)\n-- @column parent_hash - FK to card.hash (previous version)\n-- @column version_order - 0 = current, 1 = previous, etc.\n-- @column is_current - TRUE if this is the current version\n-- @column embedding_id - FK to mcard_vector_metadata.id\n-- @column semantic_delta_from_parent - Cosine similarity to parent [-1, 1]\n-- @column upgrade_type - Classification: 'trivial' | 'minor' | 'major' | 'breaking'\n-- @column created_at - When this version was linked\nCREATE TABLE IF NOT EXISTS handle_version_vectors (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n handle TEXT NOT NULL,\n hash TEXT NOT NULL,\n parent_hash TEXT,\n version_order INTEGER NOT NULL,\n is_current BOOLEAN DEFAULT FALSE,\n embedding_id INTEGER,\n semantic_delta_from_parent REAL,\n upgrade_type TEXT,\n created_at TEXT NOT NULL,\n UNIQUE(handle, hash),\n FOREIGN KEY (embedding_id) REFERENCES mcard_vector_metadata(id)\n);\n\n-- @index idx_hvv_handle\n-- @description Efficient lookup of versions by handle\nCREATE INDEX IF NOT EXISTS idx_hvv_handle \nON handle_version_vectors(handle);\n\n-- @index idx_hvv_hash\n-- @description Efficient lookup of versions by hash\nCREATE INDEX IF NOT EXISTS idx_hvv_hash \nON handle_version_vectors(hash);\n\n-- @index idx_hvv_current\n-- @description Efficient lookup of current versions\nCREATE INDEX IF NOT EXISTS idx_hvv_current \nON handle_version_vectors(is_current);\n\n-- @index idx_hvv_parent\n-- @description Efficient lookup by parent hash\nCREATE INDEX IF NOT EXISTS idx_hvv_parent \nON handle_version_vectors(parent_hash);\n\n-- @table version_similarity_cache\n-- @description Precomputed pairwise similarities for performance\n-- @column id - Auto-increment primary key\n-- @column handle - Handle these versions belong to\n-- @column hash_a - First version hash\n-- @column hash_b - Second version hash\n-- @column similarity_score - Cosine similarity [-1, 1]\n-- @column distance_euclidean - L2 distance [0, \u221E)\n-- @column computed_at - When similarity was computed\nCREATE TABLE IF NOT EXISTS version_similarity_cache (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n handle TEXT NOT NULL,\n hash_a TEXT NOT NULL,\n hash_b TEXT NOT NULL,\n similarity_score REAL NOT NULL,\n distance_euclidean REAL,\n computed_at TEXT NOT NULL,\n UNIQUE(handle, hash_a, hash_b)\n);\n\n-- @index idx_vsc_handle\n-- @description Efficient lookup of cached similarities by handle\nCREATE INDEX IF NOT EXISTS idx_vsc_handle \nON version_similarity_cache(handle);\n\n\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- LAYER 5: KNOWLEDGE GRAPH (GraphRAG)\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- Storage for extracted knowledge graph entities and relationships.\n\n-- @table graph_entities\n-- @description Nodes in the knowledge graph\n-- @column id - Auto-increment primary key\n-- @column name - Entity name\n-- @column type - Entity type (e.g., \"Person\", \"Organization\")\n-- @column description - Optional description\n-- @column source_hash - FK to card.hash where entity was extracted\n-- @column embedding - Optional entity embedding\n-- @column created_at - When entity was created\nCREATE TABLE IF NOT EXISTS graph_entities (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n name TEXT NOT NULL,\n type TEXT NOT NULL,\n description TEXT,\n source_hash TEXT NOT NULL,\n embedding BLOB,\n created_at TEXT NOT NULL,\n UNIQUE(name, type, source_hash)\n);\n\n-- @index idx_entity_name\n-- @description Efficient entity lookup by name\nCREATE INDEX IF NOT EXISTS idx_entity_name \nON graph_entities(name);\n\n-- @index idx_entity_type\n-- @description Efficient entity lookup by type\nCREATE INDEX IF NOT EXISTS idx_entity_type \nON graph_entities(type);\n\n-- @index idx_entity_source\n-- @description Efficient entity lookup by source document\nCREATE INDEX IF NOT EXISTS idx_entity_source \nON graph_entities(source_hash);\n\n-- @table graph_relationships\n-- @description Edges in the knowledge graph\n-- @column id - Auto-increment primary key\n-- @column source_entity_id - FK to graph_entities.id (from)\n-- @column target_entity_id - FK to graph_entities.id (to)\n-- @column relationship - Relationship type/label\n-- @column description - Optional description\n-- @column weight - Relationship strength\n-- @column source_hash - FK to card.hash where relationship was extracted\n-- @column created_at - When relationship was created\nCREATE TABLE IF NOT EXISTS graph_relationships (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n source_entity_id INTEGER NOT NULL,\n target_entity_id INTEGER NOT NULL,\n relationship TEXT NOT NULL,\n description TEXT,\n weight REAL DEFAULT 1.0,\n source_hash TEXT NOT NULL,\n created_at TEXT NOT NULL,\n UNIQUE(source_entity_id, target_entity_id, relationship, source_hash),\n FOREIGN KEY (source_entity_id) REFERENCES graph_entities(id),\n FOREIGN KEY (target_entity_id) REFERENCES graph_entities(id)\n);\n\n-- @index idx_rel_source\n-- @description Efficient lookup of relationships by source entity\nCREATE INDEX IF NOT EXISTS idx_rel_source \nON graph_relationships(source_entity_id);\n\n-- @index idx_rel_target\n-- @description Efficient lookup of relationships by target entity\nCREATE INDEX IF NOT EXISTS idx_rel_target \nON graph_relationships(target_entity_id);\n\n-- @table graph_communities\n-- @description Hierarchical community summaries (GraphRAG)\n-- @column id - Auto-increment primary key\n-- @column level - Hierarchy level (0 = leaf)\n-- @column title - Community title\n-- @column summary - AI-generated summary\n-- @column embedding - Community embedding\n-- @column member_entity_ids - JSON array of entity IDs\n-- @column parent_community_id - FK to parent community\n-- @column created_at - When community was created\nCREATE TABLE IF NOT EXISTS graph_communities (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n level INTEGER NOT NULL DEFAULT 0,\n title TEXT,\n summary TEXT NOT NULL,\n embedding BLOB,\n member_entity_ids TEXT,\n parent_community_id INTEGER,\n created_at TEXT NOT NULL,\n FOREIGN KEY (parent_community_id) REFERENCES graph_communities(id)\n);\n\n-- @index idx_community_level\n-- @description Efficient lookup of communities by level\nCREATE INDEX IF NOT EXISTS idx_community_level \nON graph_communities(level);\n\n-- @table graph_extractions\n-- @description Tracks which documents have been processed for entity extraction\n-- @column hash - FK to card.hash (primary key)\n-- @column entity_count - Number of entities extracted\n-- @column relationship_count - Number of relationships extracted\n-- @column extracted_at - When extraction was performed\nCREATE TABLE IF NOT EXISTS graph_extractions (\n hash TEXT PRIMARY KEY,\n entity_count INTEGER DEFAULT 0,\n relationship_count INTEGER DEFAULT 0,\n extracted_at TEXT NOT NULL\n);\n\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n-- SCHEMA METADATA (Vector DB)\n-- \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n-- @table schema_version\n-- @description Tracks schema version for migrations\nCREATE TABLE IF NOT EXISTS vector_schema_version (\n version TEXT PRIMARY KEY,\n applied_at TEXT NOT NULL,\n description TEXT\n);\n\n-- Insert current schema version\nINSERT OR IGNORE INTO vector_schema_version (version, applied_at, description)\nVALUES ('1.0.0', datetime('now'), 'Initial MCard Vector Schema');\n";
|
|
7
|
-
//# sourceMappingURL=schema_constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema_constants.d.ts","sourceRoot":"","sources":["../../src/storage/schema_constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,gBAAgB,y4TA6H5B,CAAC;AAEF,eAAO,MAAM,uBAAuB,8ofA2RnC,CAAC"}
|