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
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createPage
|
|
3
|
+
} from "./chunk-3EIBJPNF.js";
|
|
4
|
+
import {
|
|
5
|
+
init_Handle,
|
|
6
|
+
validateHandle
|
|
7
|
+
} from "./chunk-ADV52544.js";
|
|
8
|
+
import {
|
|
9
|
+
DEFAULT_PAGE_SIZE
|
|
10
|
+
} from "./chunk-A5S2PI37.js";
|
|
11
|
+
|
|
12
|
+
// src/storage/schema.ts
|
|
13
|
+
import { get_core_schema, get_vector_schema } from "mcard-wasm";
|
|
14
|
+
var TABLE_LAYERS = {
|
|
15
|
+
// Layer 1: Core
|
|
16
|
+
"card": "core",
|
|
17
|
+
// Layer 2: Handle System
|
|
18
|
+
"handle_registry": "handle",
|
|
19
|
+
"handle_history": "handle",
|
|
20
|
+
// Layer 3: Vector Storage
|
|
21
|
+
"mcard_vector_metadata": "vector",
|
|
22
|
+
"mcard_embeddings": "vector",
|
|
23
|
+
"mcard_fts": "vector",
|
|
24
|
+
// Layer 4: Semantic Versioning
|
|
25
|
+
"handle_version_vectors": "semantic",
|
|
26
|
+
"version_similarity_cache": "semantic",
|
|
27
|
+
// Layer 5: Knowledge Graph
|
|
28
|
+
"graph_entities": "graph",
|
|
29
|
+
"graph_relationships": "graph",
|
|
30
|
+
"graph_communities": "graph",
|
|
31
|
+
"graph_extractions": "graph",
|
|
32
|
+
// Metadata
|
|
33
|
+
"schema_version": "metadata"
|
|
34
|
+
};
|
|
35
|
+
var MCardSchema = class _MCardSchema {
|
|
36
|
+
static instance = null;
|
|
37
|
+
schemaPath = "";
|
|
38
|
+
rawSql = "";
|
|
39
|
+
statements = [];
|
|
40
|
+
tables = /* @__PURE__ */ new Map();
|
|
41
|
+
indexes = /* @__PURE__ */ new Map();
|
|
42
|
+
loaded = false;
|
|
43
|
+
constructor() {
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get the singleton instance.
|
|
47
|
+
*/
|
|
48
|
+
static getInstance() {
|
|
49
|
+
if (!_MCardSchema.instance) {
|
|
50
|
+
_MCardSchema.instance = new _MCardSchema();
|
|
51
|
+
_MCardSchema.instance.load();
|
|
52
|
+
}
|
|
53
|
+
return _MCardSchema.instance;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Reset the singleton (for testing).
|
|
57
|
+
*/
|
|
58
|
+
static resetInstance() {
|
|
59
|
+
_MCardSchema.instance = null;
|
|
60
|
+
}
|
|
61
|
+
load() {
|
|
62
|
+
if (this.loaded) return;
|
|
63
|
+
this.schemaPath = "WASM_MEMORY_SPACE";
|
|
64
|
+
this.rawSql = get_core_schema();
|
|
65
|
+
const vectorSql = get_vector_schema();
|
|
66
|
+
if (vectorSql) {
|
|
67
|
+
this.rawSql += "\n\n" + vectorSql;
|
|
68
|
+
}
|
|
69
|
+
this.statements = this.parseStatements(this.rawSql);
|
|
70
|
+
for (const stmt of this.statements) {
|
|
71
|
+
const name = this.extractName(stmt);
|
|
72
|
+
if (name) {
|
|
73
|
+
const upper = stmt.toUpperCase();
|
|
74
|
+
if (upper.includes("CREATE TABLE") || upper.includes("CREATE VIRTUAL TABLE")) {
|
|
75
|
+
this.tables.set(name.toLowerCase(), stmt);
|
|
76
|
+
} else if (upper.includes("CREATE INDEX")) {
|
|
77
|
+
this.indexes.set(name.toLowerCase(), stmt);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
this.loaded = true;
|
|
82
|
+
}
|
|
83
|
+
parseStatements(sql) {
|
|
84
|
+
sql = sql.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
85
|
+
const statements = [];
|
|
86
|
+
let current = [];
|
|
87
|
+
for (const line of sql.split("\n")) {
|
|
88
|
+
const stripped = line.split("--")[0].trim();
|
|
89
|
+
if (!stripped) continue;
|
|
90
|
+
current.push(stripped);
|
|
91
|
+
if (stripped.endsWith(";")) {
|
|
92
|
+
const statement = current.join(" ");
|
|
93
|
+
if (!statement.trim().toUpperCase().startsWith("INSERT")) {
|
|
94
|
+
statements.push(statement);
|
|
95
|
+
}
|
|
96
|
+
current = [];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return statements.filter((s) => s.trim());
|
|
100
|
+
}
|
|
101
|
+
extractName(statement) {
|
|
102
|
+
let match = statement.match(/CREATE\s+(?:VIRTUAL\s+)?TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?(\w+)/i);
|
|
103
|
+
if (match) return match[1];
|
|
104
|
+
match = statement.match(/CREATE\s+INDEX\s+(?:IF\s+NOT\s+EXISTS\s+)?(\w+)/i);
|
|
105
|
+
if (match) return match[1];
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
109
|
+
// Schema Access
|
|
110
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
111
|
+
getSchemaPath() {
|
|
112
|
+
return this.schemaPath;
|
|
113
|
+
}
|
|
114
|
+
getTable(tableName) {
|
|
115
|
+
return this.tables.get(tableName.toLowerCase());
|
|
116
|
+
}
|
|
117
|
+
getIndex(indexName) {
|
|
118
|
+
return this.indexes.get(indexName.toLowerCase());
|
|
119
|
+
}
|
|
120
|
+
getAllTables() {
|
|
121
|
+
return new Map(this.tables);
|
|
122
|
+
}
|
|
123
|
+
getAllIndexes() {
|
|
124
|
+
return new Map(this.indexes);
|
|
125
|
+
}
|
|
126
|
+
getAllStatements() {
|
|
127
|
+
return [...this.statements];
|
|
128
|
+
}
|
|
129
|
+
getTablesByLayer(layer) {
|
|
130
|
+
return Object.entries(TABLE_LAYERS).filter(([_, l]) => l === layer).map(([name, _]) => name);
|
|
131
|
+
}
|
|
132
|
+
getLayerStatements(layer) {
|
|
133
|
+
const statements = [];
|
|
134
|
+
const tables = this.getTablesByLayer(layer);
|
|
135
|
+
for (const table of tables) {
|
|
136
|
+
const stmt = this.getTable(table);
|
|
137
|
+
if (stmt) statements.push(stmt);
|
|
138
|
+
}
|
|
139
|
+
for (const [_, stmt] of this.indexes) {
|
|
140
|
+
const match = stmt.match(/ON\s+(\w+)/i);
|
|
141
|
+
if (match && tables.includes(match[1].toLowerCase())) {
|
|
142
|
+
statements.push(stmt);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return statements;
|
|
146
|
+
}
|
|
147
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
148
|
+
// Database Initialization
|
|
149
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
150
|
+
execStatements(db, statements) {
|
|
151
|
+
for (const stmt of statements) {
|
|
152
|
+
db.exec(stmt);
|
|
153
|
+
}
|
|
154
|
+
return statements.length;
|
|
155
|
+
}
|
|
156
|
+
initLayer(db, layer) {
|
|
157
|
+
return this.execStatements(db, this.getLayerStatements(layer));
|
|
158
|
+
}
|
|
159
|
+
initCoreTables(db) {
|
|
160
|
+
return this.initLayer(db, "core");
|
|
161
|
+
}
|
|
162
|
+
initHandleTables(db) {
|
|
163
|
+
return this.initLayer(db, "handle");
|
|
164
|
+
}
|
|
165
|
+
initVectorTables(db, enableFts = true) {
|
|
166
|
+
const statements = this.getLayerStatements("vector").filter((s) => enableFts || !s.toLowerCase().includes("fts"));
|
|
167
|
+
return this.execStatements(db, statements);
|
|
168
|
+
}
|
|
169
|
+
initSemanticTables(db) {
|
|
170
|
+
return this.initLayer(db, "semantic");
|
|
171
|
+
}
|
|
172
|
+
initGraphTables(db) {
|
|
173
|
+
return this.initLayer(db, "graph");
|
|
174
|
+
}
|
|
175
|
+
initAllTables(db, options = {}) {
|
|
176
|
+
const { enableFts = true, enableGraph = true, enableSemantic = true } = options;
|
|
177
|
+
let count = 0;
|
|
178
|
+
count += this.initCoreTables(db);
|
|
179
|
+
count += this.initHandleTables(db);
|
|
180
|
+
count += this.initVectorTables(db, enableFts);
|
|
181
|
+
if (enableSemantic) {
|
|
182
|
+
count += this.initSemanticTables(db);
|
|
183
|
+
}
|
|
184
|
+
if (enableGraph) {
|
|
185
|
+
count += this.initGraphTables(db);
|
|
186
|
+
}
|
|
187
|
+
return count;
|
|
188
|
+
}
|
|
189
|
+
initVec0Table(db, dimensions) {
|
|
190
|
+
db.exec(`
|
|
191
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS mcard_vec USING vec0(
|
|
192
|
+
metadata_id INTEGER PRIMARY KEY,
|
|
193
|
+
embedding float[${dimensions}]
|
|
194
|
+
)
|
|
195
|
+
`);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
function getSchemaInstance() {
|
|
199
|
+
return MCardSchema.getInstance();
|
|
200
|
+
}
|
|
201
|
+
var CARD_TABLE_SCHEMA = getSchemaInstance().getTable("card") || "";
|
|
202
|
+
var HANDLE_REGISTRY_SCHEMA = getSchemaInstance().getTable("handle_registry") || "";
|
|
203
|
+
var HANDLE_HISTORY_SCHEMA = getSchemaInstance().getTable("handle_history") || "";
|
|
204
|
+
var HANDLE_INDEX_SCHEMA = getSchemaInstance().getIndex("idx_handle_current_hash") || "";
|
|
205
|
+
var VECTOR_METADATA_SCHEMA = getSchemaInstance().getTable("mcard_vector_metadata") || "";
|
|
206
|
+
var VECTOR_METADATA_INDEX = getSchemaInstance().getIndex("idx_vector_metadata_hash") || "";
|
|
207
|
+
var VECTOR_EMBEDDINGS_SCHEMA = getSchemaInstance().getTable("mcard_embeddings") || "";
|
|
208
|
+
var VECTOR_FTS_SCHEMA = getSchemaInstance().getTable("mcard_fts") || "";
|
|
209
|
+
var HANDLE_VERSION_VECTORS_SCHEMA = getSchemaInstance().getTable("handle_version_vectors") || "";
|
|
210
|
+
var HANDLE_VERSION_VECTORS_INDEXES = [
|
|
211
|
+
getSchemaInstance().getIndex("idx_hvv_handle"),
|
|
212
|
+
getSchemaInstance().getIndex("idx_hvv_hash"),
|
|
213
|
+
getSchemaInstance().getIndex("idx_hvv_current"),
|
|
214
|
+
getSchemaInstance().getIndex("idx_hvv_parent")
|
|
215
|
+
].filter(Boolean).join("; ");
|
|
216
|
+
var VERSION_SIMILARITY_CACHE_SCHEMA = getSchemaInstance().getTable("version_similarity_cache") || "";
|
|
217
|
+
var VERSION_SIMILARITY_CACHE_INDEX = getSchemaInstance().getIndex("idx_vsc_handle") || "";
|
|
218
|
+
var GRAPH_ENTITY_SCHEMA = getSchemaInstance().getTable("graph_entities") || "";
|
|
219
|
+
var GRAPH_ENTITY_INDEX_NAME = getSchemaInstance().getIndex("idx_entity_name") || "";
|
|
220
|
+
var GRAPH_ENTITY_INDEX_TYPE = getSchemaInstance().getIndex("idx_entity_type") || "";
|
|
221
|
+
var GRAPH_ENTITY_INDEX_SOURCE = getSchemaInstance().getIndex("idx_entity_source") || "";
|
|
222
|
+
var GRAPH_RELATIONSHIP_SCHEMA = getSchemaInstance().getTable("graph_relationships") || "";
|
|
223
|
+
var GRAPH_RELATIONSHIP_INDEX_SOURCE = getSchemaInstance().getIndex("idx_rel_source") || "";
|
|
224
|
+
var GRAPH_RELATIONSHIP_INDEX_TARGET = getSchemaInstance().getIndex("idx_rel_target") || "";
|
|
225
|
+
var GRAPH_COMMUNITY_SCHEMA = getSchemaInstance().getTable("graph_communities") || "";
|
|
226
|
+
var GRAPH_COMMUNITY_INDEX_LEVEL = getSchemaInstance().getIndex("idx_community_level") || "";
|
|
227
|
+
var GRAPH_EXTRACTION_SCHEMA = getSchemaInstance().getTable("graph_extractions") || "";
|
|
228
|
+
var CORE_SCHEMAS = {
|
|
229
|
+
card: CARD_TABLE_SCHEMA,
|
|
230
|
+
handleRegistry: HANDLE_REGISTRY_SCHEMA,
|
|
231
|
+
handleHistory: HANDLE_HISTORY_SCHEMA,
|
|
232
|
+
handleIndex: HANDLE_INDEX_SCHEMA
|
|
233
|
+
};
|
|
234
|
+
function initCoreSchemas(db) {
|
|
235
|
+
const schema = MCardSchema.getInstance();
|
|
236
|
+
schema.initCoreTables(db);
|
|
237
|
+
schema.initHandleTables(db);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// src/storage/engines/AbstractSqlEngine.ts
|
|
241
|
+
init_Handle();
|
|
242
|
+
var AbstractSqlEngine = class {
|
|
243
|
+
/**
|
|
244
|
+
* SQL expression for casting content to text in search queries.
|
|
245
|
+
* Override in subclasses: SQLite uses 'TEXT', DuckDB uses 'VARCHAR'.
|
|
246
|
+
*/
|
|
247
|
+
get castContentAs() {
|
|
248
|
+
return "TEXT";
|
|
249
|
+
}
|
|
250
|
+
// ======================================================================
|
|
251
|
+
// Concrete: Card Operations (shared across all SQL engines)
|
|
252
|
+
// ======================================================================
|
|
253
|
+
/**
|
|
254
|
+
* Add a card. Default uses INSERT OR REPLACE (SQLite).
|
|
255
|
+
* DuckDB overrides with DELETE + INSERT.
|
|
256
|
+
*/
|
|
257
|
+
async add(card) {
|
|
258
|
+
const contentBytes = card.content instanceof Uint8Array ? card.content : new TextEncoder().encode(String(card.content));
|
|
259
|
+
await this.execSql(
|
|
260
|
+
"INSERT OR REPLACE INTO card (hash, content, g_time) VALUES (?, ?, ?)",
|
|
261
|
+
card.hash,
|
|
262
|
+
contentBytes,
|
|
263
|
+
card.g_time
|
|
264
|
+
);
|
|
265
|
+
return card.hash;
|
|
266
|
+
}
|
|
267
|
+
async get(hash) {
|
|
268
|
+
const rows = await this.queryRows(
|
|
269
|
+
"SELECT hash, content, g_time FROM card WHERE hash = ?",
|
|
270
|
+
hash
|
|
271
|
+
);
|
|
272
|
+
if (rows.length === 0) return null;
|
|
273
|
+
return this.rowToCard(rows[0]);
|
|
274
|
+
}
|
|
275
|
+
async delete(hash) {
|
|
276
|
+
await this.execSql("DELETE FROM card WHERE hash = ?", hash);
|
|
277
|
+
}
|
|
278
|
+
async getPage(pageNumber = 1, pageSize = DEFAULT_PAGE_SIZE) {
|
|
279
|
+
if (pageNumber < 1) throw new Error("Page number must be >= 1");
|
|
280
|
+
if (pageSize < 1) throw new Error("Page size must be >= 1");
|
|
281
|
+
const totalItems = await this.count();
|
|
282
|
+
const offset = (pageNumber - 1) * pageSize;
|
|
283
|
+
const rows = await this.queryRows(
|
|
284
|
+
"SELECT hash, content, g_time FROM card ORDER BY g_time DESC LIMIT ? OFFSET ?",
|
|
285
|
+
pageSize,
|
|
286
|
+
offset
|
|
287
|
+
);
|
|
288
|
+
const items = rows.map((r) => this.rowToCard(r));
|
|
289
|
+
return createPage(items, totalItems, pageNumber, pageSize);
|
|
290
|
+
}
|
|
291
|
+
async count() {
|
|
292
|
+
const rows = await this.queryRows("SELECT COUNT(*) as cnt FROM card");
|
|
293
|
+
return Number(rows[0]?.cnt ?? 0);
|
|
294
|
+
}
|
|
295
|
+
async searchByHash(hashPrefix) {
|
|
296
|
+
const rows = await this.queryRows(
|
|
297
|
+
"SELECT hash, content, g_time FROM card WHERE hash LIKE ?",
|
|
298
|
+
`${hashPrefix}%`
|
|
299
|
+
);
|
|
300
|
+
return rows.map((r) => this.rowToCard(r));
|
|
301
|
+
}
|
|
302
|
+
async search(queryStr, pageNumber = 1, pageSize = DEFAULT_PAGE_SIZE) {
|
|
303
|
+
if (pageNumber < 1) throw new Error("Page number must be >= 1");
|
|
304
|
+
if (pageSize < 1) throw new Error("Page size must be >= 1");
|
|
305
|
+
const offset = (pageNumber - 1) * pageSize;
|
|
306
|
+
const pattern = `%${queryStr}%`;
|
|
307
|
+
const cast = this.castContentAs;
|
|
308
|
+
const countRows = await this.queryRows(
|
|
309
|
+
`SELECT COUNT(*) as cnt FROM card WHERE CAST(content AS ${cast}) LIKE ?`,
|
|
310
|
+
pattern
|
|
311
|
+
);
|
|
312
|
+
const totalItems = Number(countRows[0]?.cnt ?? 0);
|
|
313
|
+
const rows = await this.queryRows(
|
|
314
|
+
`SELECT hash, content, g_time FROM card WHERE CAST(content AS ${cast}) LIKE ? ORDER BY g_time DESC LIMIT ? OFFSET ?`,
|
|
315
|
+
pattern,
|
|
316
|
+
pageSize,
|
|
317
|
+
offset
|
|
318
|
+
);
|
|
319
|
+
const items = rows.map((r) => this.rowToCard(r));
|
|
320
|
+
return createPage(items, totalItems, pageNumber, pageSize);
|
|
321
|
+
}
|
|
322
|
+
async getAll() {
|
|
323
|
+
const rows = await this.queryRows("SELECT hash, content, g_time FROM card ORDER BY g_time DESC");
|
|
324
|
+
return rows.map((r) => this.rowToCard(r));
|
|
325
|
+
}
|
|
326
|
+
// ======================================================================
|
|
327
|
+
// Concrete: clear (FK-safe delete order)
|
|
328
|
+
// ======================================================================
|
|
329
|
+
async clear() {
|
|
330
|
+
await this.execSql("DELETE FROM handle_history");
|
|
331
|
+
await this.execSql("DELETE FROM handle_registry");
|
|
332
|
+
await this.execSql("DELETE FROM card");
|
|
333
|
+
}
|
|
334
|
+
// ======================================================================
|
|
335
|
+
// Concrete: Handle Operations
|
|
336
|
+
// ======================================================================
|
|
337
|
+
async registerHandle(handle, hash) {
|
|
338
|
+
const normalized = validateHandle(handle);
|
|
339
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
340
|
+
const existing = await this.queryRows(
|
|
341
|
+
"SELECT handle FROM handle_registry WHERE handle = ?",
|
|
342
|
+
normalized
|
|
343
|
+
);
|
|
344
|
+
if (existing.length > 0) {
|
|
345
|
+
throw new Error(`Handle '${handle}' already exists.`);
|
|
346
|
+
}
|
|
347
|
+
await this.execSql(
|
|
348
|
+
"INSERT INTO handle_registry (handle, current_hash, created_at, updated_at) VALUES (?, ?, ?, ?)",
|
|
349
|
+
normalized,
|
|
350
|
+
hash,
|
|
351
|
+
now,
|
|
352
|
+
now
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
async resolveHandle(handle) {
|
|
356
|
+
const normalized = validateHandle(handle);
|
|
357
|
+
const rows = await this.queryRows(
|
|
358
|
+
"SELECT current_hash FROM handle_registry WHERE handle = ?",
|
|
359
|
+
normalized
|
|
360
|
+
);
|
|
361
|
+
if (rows.length === 0) return null;
|
|
362
|
+
return String(rows[0].current_hash);
|
|
363
|
+
}
|
|
364
|
+
async getByHandle(handle) {
|
|
365
|
+
const hash = await this.resolveHandle(handle);
|
|
366
|
+
if (!hash) return null;
|
|
367
|
+
return this.get(hash);
|
|
368
|
+
}
|
|
369
|
+
async updateHandle(handle, newHash) {
|
|
370
|
+
const normalized = validateHandle(handle);
|
|
371
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
372
|
+
const rows = await this.queryRows(
|
|
373
|
+
"SELECT current_hash FROM handle_registry WHERE handle = ?",
|
|
374
|
+
normalized
|
|
375
|
+
);
|
|
376
|
+
if (rows.length === 0) {
|
|
377
|
+
throw new Error(`Handle '${handle}' not found.`);
|
|
378
|
+
}
|
|
379
|
+
const previousHash = String(rows[0].current_hash);
|
|
380
|
+
await this.execSql(
|
|
381
|
+
"INSERT INTO handle_history (handle, previous_hash, changed_at) VALUES (?, ?, ?)",
|
|
382
|
+
normalized,
|
|
383
|
+
previousHash,
|
|
384
|
+
now
|
|
385
|
+
);
|
|
386
|
+
await this.execSql(
|
|
387
|
+
"UPDATE handle_registry SET current_hash = ?, updated_at = ? WHERE handle = ?",
|
|
388
|
+
newHash,
|
|
389
|
+
now,
|
|
390
|
+
normalized
|
|
391
|
+
);
|
|
392
|
+
return previousHash;
|
|
393
|
+
}
|
|
394
|
+
async getHandleHistory(handle) {
|
|
395
|
+
const normalized = validateHandle(handle);
|
|
396
|
+
const rows = await this.queryRows(
|
|
397
|
+
"SELECT previous_hash, changed_at FROM handle_history WHERE handle = ? ORDER BY id DESC",
|
|
398
|
+
normalized
|
|
399
|
+
);
|
|
400
|
+
return rows.map((r) => ({
|
|
401
|
+
previousHash: String(r.previous_hash),
|
|
402
|
+
changedAt: String(r.changed_at)
|
|
403
|
+
}));
|
|
404
|
+
}
|
|
405
|
+
async pruneHandleHistory(handle, options = {}) {
|
|
406
|
+
const normalized = validateHandle(handle);
|
|
407
|
+
if (options.deleteAll) {
|
|
408
|
+
return this.execSql("DELETE FROM handle_history WHERE handle = ?", normalized);
|
|
409
|
+
} else if (options.olderThan) {
|
|
410
|
+
return this.execSql(
|
|
411
|
+
"DELETE FROM handle_history WHERE handle = ? AND changed_at < ?",
|
|
412
|
+
normalized,
|
|
413
|
+
options.olderThan
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
return 0;
|
|
417
|
+
}
|
|
418
|
+
// ======================================================================
|
|
419
|
+
// Concrete: Handle Management Operations
|
|
420
|
+
// ======================================================================
|
|
421
|
+
async getAllHandles() {
|
|
422
|
+
const rows = await this.queryRows("SELECT handle, current_hash FROM handle_registry");
|
|
423
|
+
return rows.map((r) => ({
|
|
424
|
+
handle: String(r.handle),
|
|
425
|
+
hash: String(r.current_hash)
|
|
426
|
+
}));
|
|
427
|
+
}
|
|
428
|
+
async removeHandle(handle) {
|
|
429
|
+
const normalized = validateHandle(handle);
|
|
430
|
+
await this.execSql("DELETE FROM handle_history WHERE handle = ?", normalized);
|
|
431
|
+
await this.execSql("DELETE FROM handle_registry WHERE handle = ?", normalized);
|
|
432
|
+
}
|
|
433
|
+
async renameHandle(oldHandle, newHandle) {
|
|
434
|
+
const normalizedOld = validateHandle(oldHandle);
|
|
435
|
+
const normalizedNew = validateHandle(newHandle);
|
|
436
|
+
if (normalizedOld === normalizedNew) return;
|
|
437
|
+
const existsOld = await this.queryRows(
|
|
438
|
+
"SELECT handle FROM handle_registry WHERE handle = ?",
|
|
439
|
+
normalizedOld
|
|
440
|
+
);
|
|
441
|
+
if (existsOld.length === 0) throw new Error(`Handle '${oldHandle}' not found.`);
|
|
442
|
+
const existsNew = await this.queryRows(
|
|
443
|
+
"SELECT handle FROM handle_registry WHERE handle = ?",
|
|
444
|
+
normalizedNew
|
|
445
|
+
);
|
|
446
|
+
if (existsNew.length > 0) throw new Error(`Handle '${newHandle}' already exists.`);
|
|
447
|
+
const oldRow = await this.queryRows(
|
|
448
|
+
"SELECT current_hash, created_at, updated_at FROM handle_registry WHERE handle = ?",
|
|
449
|
+
normalizedOld
|
|
450
|
+
);
|
|
451
|
+
await this.execSql(
|
|
452
|
+
"INSERT INTO handle_registry (handle, current_hash, created_at, updated_at) VALUES (?, ?, ?, ?)",
|
|
453
|
+
normalizedNew,
|
|
454
|
+
String(oldRow[0].current_hash),
|
|
455
|
+
String(oldRow[0].created_at),
|
|
456
|
+
String(oldRow[0].updated_at)
|
|
457
|
+
);
|
|
458
|
+
await this.execSql(
|
|
459
|
+
"UPDATE handle_history SET handle = ? WHERE handle = ?",
|
|
460
|
+
normalizedNew,
|
|
461
|
+
normalizedOld
|
|
462
|
+
);
|
|
463
|
+
await this.execSql(
|
|
464
|
+
"DELETE FROM handle_registry WHERE handle = ?",
|
|
465
|
+
normalizedOld
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
async deleteHistoryEntry(handle, previousHash) {
|
|
469
|
+
const normalized = validateHandle(handle);
|
|
470
|
+
const rOutRows = await this.queryRows(
|
|
471
|
+
"SELECT id, previous_hash FROM handle_history WHERE handle = ? AND previous_hash = ? ORDER BY id DESC LIMIT 1",
|
|
472
|
+
normalized,
|
|
473
|
+
previousHash
|
|
474
|
+
);
|
|
475
|
+
if (rOutRows.length === 0) return;
|
|
476
|
+
const rOutId = Number(rOutRows[0].id);
|
|
477
|
+
const rInRows = await this.queryRows(
|
|
478
|
+
"SELECT id, previous_hash FROM handle_history WHERE handle = ? AND id < ? ORDER BY id DESC LIMIT 1",
|
|
479
|
+
normalized,
|
|
480
|
+
rOutId
|
|
481
|
+
);
|
|
482
|
+
if (rInRows.length > 0) {
|
|
483
|
+
const rInId = Number(rInRows[0].id);
|
|
484
|
+
const rInPrevHash = String(rInRows[0].previous_hash);
|
|
485
|
+
await this.execSql("UPDATE handle_history SET previous_hash = ? WHERE id = ?", rInPrevHash, rOutId);
|
|
486
|
+
await this.execSql("DELETE FROM handle_history WHERE id = ?", rInId);
|
|
487
|
+
} else {
|
|
488
|
+
await this.execSql("DELETE FROM handle_history WHERE id = ?", rOutId);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
export {
|
|
494
|
+
CORE_SCHEMAS,
|
|
495
|
+
initCoreSchemas,
|
|
496
|
+
AbstractSqlEngine
|
|
497
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/config/constants.ts
|
|
2
|
+
var DEFAULT_PAGE_SIZE = 10;
|
|
3
|
+
var MAX_FILE_SIZE = 50 * 1024 * 1024;
|
|
4
|
+
var KNOWN_TYPE_SIZE_LIMIT = 1024 * 1024;
|
|
5
|
+
var BINARY_CHECK_SAMPLE_SIZE = 32 * 1024;
|
|
6
|
+
var CONTENT_DETECTION_SAMPLE_SIZE = 1024 * 1024;
|
|
7
|
+
var DEFAULT_MAX_PROBLEM_BYTES = 2 * 1024 * 1024;
|
|
8
|
+
var INDEXEDDB_DEFAULT_DB_NAME = "mcard-db";
|
|
9
|
+
var INDEXEDDB_DEFAULT_DB_VERSION = 1;
|
|
10
|
+
var SQLITE_BUSY_TIMEOUT_MS = 5e3;
|
|
11
|
+
var getEnvUrl = (key, fallback) => {
|
|
12
|
+
try {
|
|
13
|
+
if (typeof process !== "undefined" && process.env && process.env[key]) {
|
|
14
|
+
return process.env[key];
|
|
15
|
+
}
|
|
16
|
+
} catch (e) {
|
|
17
|
+
}
|
|
18
|
+
return fallback;
|
|
19
|
+
};
|
|
20
|
+
var DEFAULT_OLLAMA_BASE_URL = getEnvUrl("OLLAMA_BASE_URL", "http://localhost:11434");
|
|
21
|
+
var DEFAULT_OTLP_ENDPOINT = getEnvUrl("OTLP_ENDPOINT", "http://localhost:4317");
|
|
22
|
+
var DEFAULT_VLLM_BASE_URL = getEnvUrl("VLLM_BASE_URL", "http://localhost:8000");
|
|
23
|
+
var DEFAULT_LMSTUDIO_BASE_URL = getEnvUrl("LMSTUDIO_BASE_URL", "http://localhost:1234");
|
|
24
|
+
var DEFAULT_SQLJS_WASM_URL = "https://sql.js.org/dist/";
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
DEFAULT_PAGE_SIZE,
|
|
28
|
+
INDEXEDDB_DEFAULT_DB_NAME,
|
|
29
|
+
INDEXEDDB_DEFAULT_DB_VERSION,
|
|
30
|
+
SQLITE_BUSY_TIMEOUT_MS,
|
|
31
|
+
DEFAULT_SQLJS_WASM_URL
|
|
32
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ContentTypeInterpreter,
|
|
3
3
|
MCard
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2NFGZ6PA.js";
|
|
5
5
|
import {
|
|
6
6
|
__export
|
|
7
7
|
} from "./chunk-PNKVD2UK.js";
|
|
@@ -183,6 +183,14 @@ async function processFileContent(filePath, options = {}) {
|
|
|
183
183
|
var DEFAULT_MAX_PROBLEM_BYTES = 2 * 1024 * 1024;
|
|
184
184
|
var WRAP_WIDTH_KNOWN = 1e3;
|
|
185
185
|
var WRAP_WIDTH_DEFAULT = 80;
|
|
186
|
+
var Logger = {
|
|
187
|
+
info: (...args) => console.log("[Loader]", ...args),
|
|
188
|
+
warn: (...args) => console.warn("[Loader]", ...args),
|
|
189
|
+
error: (...args) => console.error("[Loader]", ...args),
|
|
190
|
+
debug: (...args) => {
|
|
191
|
+
if (process.env.DEBUG) console.log("[Loader]", ...args);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
186
194
|
async function processAndStoreFile(filePath, collection, options = {}) {
|
|
187
195
|
const {
|
|
188
196
|
allowProblematic = false,
|
|
@@ -194,13 +202,13 @@ async function processAndStoreFile(filePath, collection, options = {}) {
|
|
|
194
202
|
let fileInfo;
|
|
195
203
|
if (await isProblematicFile(filePath)) {
|
|
196
204
|
if (!allowProblematic) {
|
|
197
|
-
|
|
205
|
+
Logger.warn(`Skipping problematic file: ${filePath}`);
|
|
198
206
|
return null;
|
|
199
207
|
}
|
|
200
208
|
const extension = path2.extname(filePath).toLowerCase();
|
|
201
209
|
const isKnownType = ContentTypeInterpreter.isKnownLongLineExtension(extension);
|
|
202
210
|
const wrapWidth = isKnownType ? WRAP_WIDTH_KNOWN : WRAP_WIDTH_DEFAULT;
|
|
203
|
-
|
|
211
|
+
Logger.warn(`Problematic file detected, processing as safe text: ${filePath}`);
|
|
204
212
|
try {
|
|
205
213
|
const streamed = await streamReadNormalizedText(filePath, {
|
|
206
214
|
byteCap: maxBytesOnProblem,
|
|
@@ -219,7 +227,7 @@ async function processAndStoreFile(filePath, collection, options = {}) {
|
|
|
219
227
|
wrapWidth
|
|
220
228
|
};
|
|
221
229
|
} catch (e) {
|
|
222
|
-
|
|
230
|
+
Logger.warn(`Safe text processing failed, falling back to capped binary: ${filePath}`, e);
|
|
223
231
|
fileInfo = await processFileContent(filePath, {
|
|
224
232
|
forceBinary: true,
|
|
225
233
|
allowPathological: true,
|
|
@@ -227,15 +235,13 @@ async function processAndStoreFile(filePath, collection, options = {}) {
|
|
|
227
235
|
});
|
|
228
236
|
}
|
|
229
237
|
} else {
|
|
230
|
-
|
|
238
|
+
Logger.info(`Processing file: ${filePath}`);
|
|
231
239
|
fileInfo = await processFileContent(filePath);
|
|
232
240
|
}
|
|
233
241
|
if (!fileInfo) return null;
|
|
234
242
|
const content = fileInfo.content;
|
|
235
243
|
if (!content || typeof content === "string" && content.length === 0 || content instanceof Uint8Array && content.length === 0) {
|
|
236
|
-
|
|
237
|
-
console.log(`Skipping empty file: ${filePath} (empty files cannot be stored as MCards)`);
|
|
238
|
-
}
|
|
244
|
+
Logger.debug(`Skipping empty file: ${filePath} (empty files cannot be stored as MCards)`);
|
|
239
245
|
return {
|
|
240
246
|
hash: "",
|
|
241
247
|
contentType: fileInfo.mimeType,
|
|
@@ -263,11 +269,9 @@ async function processAndStoreFile(filePath, collection, options = {}) {
|
|
|
263
269
|
await collection.addWithHandle(mcard, relPath);
|
|
264
270
|
registered = true;
|
|
265
271
|
} catch (e2) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
);
|
|
270
|
-
}
|
|
272
|
+
Logger.debug(
|
|
273
|
+
`Handle name '${handle}' already in use (common for files like README.md, LICENSE). MCard stored successfully with hash ${mcard.hash.slice(0, 8)}... (accessible by hash, not by handle)`
|
|
274
|
+
);
|
|
271
275
|
}
|
|
272
276
|
}
|
|
273
277
|
}
|
|
@@ -275,6 +279,7 @@ async function processAndStoreFile(filePath, collection, options = {}) {
|
|
|
275
279
|
try {
|
|
276
280
|
await collection.add(mcard);
|
|
277
281
|
} catch (e3) {
|
|
282
|
+
Logger.warn(`Hash fallback also failed for ${handle}:`, e3);
|
|
278
283
|
}
|
|
279
284
|
}
|
|
280
285
|
}
|
|
@@ -292,7 +297,7 @@ async function processAndStoreFile(filePath, collection, options = {}) {
|
|
|
292
297
|
if (metadataOnly && isProblematic) result.metadataOnly = true;
|
|
293
298
|
return result;
|
|
294
299
|
} catch (e) {
|
|
295
|
-
|
|
300
|
+
Logger.error(`Error processing ${filePath}:`, e);
|
|
296
301
|
return null;
|
|
297
302
|
}
|
|
298
303
|
}
|
|
@@ -334,7 +339,7 @@ async function loadFileToCollection(targetPath, collection, options = {}) {
|
|
|
334
339
|
directoriesCount: uniqueDirs.size,
|
|
335
340
|
directoryLevels: maxDepth
|
|
336
341
|
};
|
|
337
|
-
|
|
342
|
+
Logger.info(`About to process ${files.length} files`);
|
|
338
343
|
for (const file of files) {
|
|
339
344
|
const result = await processAndStoreFile(file, collection, {
|
|
340
345
|
allowProblematic: includeProblematic,
|