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/chunk-OFHDMLNM.js
DELETED
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ContentTypeInterpreter,
|
|
3
|
-
MCard
|
|
4
|
-
} from "./chunk-5BIDGXA6.js";
|
|
5
|
-
import {
|
|
6
|
-
__export
|
|
7
|
-
} from "./chunk-MLKGABMK.js";
|
|
8
|
-
|
|
9
|
-
// src/Loader.ts
|
|
10
|
-
var Loader_exports = {};
|
|
11
|
-
__export(Loader_exports, {
|
|
12
|
-
loadFileToCollection: () => loadFileToCollection,
|
|
13
|
-
processAndStoreFile: () => processAndStoreFile
|
|
14
|
-
});
|
|
15
|
-
import * as fs2 from "fs/promises";
|
|
16
|
-
import * as path2 from "path";
|
|
17
|
-
|
|
18
|
-
// src/FileIO.ts
|
|
19
|
-
var FileIO_exports = {};
|
|
20
|
-
__export(FileIO_exports, {
|
|
21
|
-
isProblematicFile: () => isProblematicFile,
|
|
22
|
-
listFiles: () => listFiles,
|
|
23
|
-
processFileContent: () => processFileContent,
|
|
24
|
-
readFileSafely: () => readFileSafely,
|
|
25
|
-
streamReadNormalizedText: () => streamReadNormalizedText
|
|
26
|
-
});
|
|
27
|
-
import * as crypto from "crypto";
|
|
28
|
-
import * as fs from "fs/promises";
|
|
29
|
-
import * as path from "path";
|
|
30
|
-
async function streamReadNormalizedText(filePath, options) {
|
|
31
|
-
const { byteCap, wrapWidth } = options;
|
|
32
|
-
const sha = crypto.createHash("sha256");
|
|
33
|
-
let totalSize = 0;
|
|
34
|
-
let producedText = "";
|
|
35
|
-
let currentLen = 0;
|
|
36
|
-
const handle = await fs.open(filePath, "r");
|
|
37
|
-
try {
|
|
38
|
-
const buffer = new Uint8Array(8192);
|
|
39
|
-
let remaining = byteCap;
|
|
40
|
-
const decoder = new TextDecoder("utf-8", { fatal: false });
|
|
41
|
-
let position = 0;
|
|
42
|
-
while (remaining > 0) {
|
|
43
|
-
const { bytesRead } = await handle.read(buffer, 0, Math.min(buffer.length, remaining), position);
|
|
44
|
-
if (bytesRead === 0) break;
|
|
45
|
-
position += bytesRead;
|
|
46
|
-
const chunk = buffer.subarray(0, bytesRead);
|
|
47
|
-
sha.update(chunk);
|
|
48
|
-
totalSize += bytesRead;
|
|
49
|
-
remaining -= bytesRead;
|
|
50
|
-
const s2 = decoder.decode(chunk, { stream: true });
|
|
51
|
-
for (const ch of s2) {
|
|
52
|
-
if (ch === "\r") continue;
|
|
53
|
-
producedText += ch;
|
|
54
|
-
if (ch === "\n") {
|
|
55
|
-
currentLen = 0;
|
|
56
|
-
} else {
|
|
57
|
-
currentLen++;
|
|
58
|
-
if (wrapWidth > 0 && currentLen >= wrapWidth) {
|
|
59
|
-
producedText += "\n";
|
|
60
|
-
currentLen = 0;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const s = decoder.decode();
|
|
66
|
-
for (const ch of s) {
|
|
67
|
-
if (ch === "\r") continue;
|
|
68
|
-
producedText += ch;
|
|
69
|
-
if (ch === "\n") {
|
|
70
|
-
currentLen = 0;
|
|
71
|
-
} else {
|
|
72
|
-
currentLen++;
|
|
73
|
-
if (wrapWidth > 0 && currentLen >= wrapWidth) {
|
|
74
|
-
producedText += "\n";
|
|
75
|
-
currentLen = 0;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
} finally {
|
|
80
|
-
await handle.close();
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
text: producedText,
|
|
84
|
-
originalSize: totalSize,
|
|
85
|
-
originalSha256Prefix: sha.digest("hex").substring(0, 16)
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
var MAX_FILE_SIZE = 50 * 1024 * 1024;
|
|
89
|
-
var READ_TIMEOUT_MS = 5e3;
|
|
90
|
-
async function isProblematicFile(filePath) {
|
|
91
|
-
try {
|
|
92
|
-
const stats = await fs.stat(filePath);
|
|
93
|
-
if (stats.size === 0) return false;
|
|
94
|
-
if (path.basename(filePath).startsWith(".")) return true;
|
|
95
|
-
if (stats.size > MAX_FILE_SIZE) return true;
|
|
96
|
-
const ext = path.extname(filePath);
|
|
97
|
-
const isKnownType = ContentTypeInterpreter.isKnownLongLineExtension(ext);
|
|
98
|
-
if (isKnownType && stats.size > 1024 * 1024) return true;
|
|
99
|
-
const handle = await fs.open(filePath, "r");
|
|
100
|
-
try {
|
|
101
|
-
const buffer = new Uint8Array(32 * 1024);
|
|
102
|
-
const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
|
|
103
|
-
const sample = buffer.subarray(0, bytesRead);
|
|
104
|
-
if (ContentTypeInterpreter.isUnstructuredBinary(sample)) return true;
|
|
105
|
-
if (ContentTypeInterpreter.hasPathologicalLines(sample, isKnownType)) return true;
|
|
106
|
-
} finally {
|
|
107
|
-
await handle.close();
|
|
108
|
-
}
|
|
109
|
-
return false;
|
|
110
|
-
} catch {
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
async function readFileSafely(filePath, options = {}) {
|
|
115
|
-
const stats = await fs.stat(filePath);
|
|
116
|
-
if (stats.size > MAX_FILE_SIZE) throw new Error(`File too large: ${stats.size}`);
|
|
117
|
-
const controller = new AbortController();
|
|
118
|
-
const timeout = setTimeout(() => controller.abort(), READ_TIMEOUT_MS);
|
|
119
|
-
try {
|
|
120
|
-
const handle = await fs.open(filePath, "r");
|
|
121
|
-
try {
|
|
122
|
-
const buffer = new Uint8Array(stats.size);
|
|
123
|
-
await handle.read(buffer, 0, stats.size, 0);
|
|
124
|
-
return buffer;
|
|
125
|
-
} finally {
|
|
126
|
-
await handle.close();
|
|
127
|
-
}
|
|
128
|
-
} catch (e) {
|
|
129
|
-
const error = e;
|
|
130
|
-
if (error.name === "AbortError") throw new Error(`Read timeout for ${filePath}`);
|
|
131
|
-
throw e;
|
|
132
|
-
} finally {
|
|
133
|
-
clearTimeout(timeout);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
async function listFiles(dirPath, recursive = false) {
|
|
137
|
-
let files = [];
|
|
138
|
-
try {
|
|
139
|
-
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
140
|
-
for (const entry of entries) {
|
|
141
|
-
const fullPath = path.join(dirPath, entry.name);
|
|
142
|
-
if (entry.name.startsWith(".")) continue;
|
|
143
|
-
if (entry.isDirectory()) {
|
|
144
|
-
if (recursive) {
|
|
145
|
-
files = files.concat(await listFiles(fullPath, true));
|
|
146
|
-
}
|
|
147
|
-
} else if (entry.isFile()) {
|
|
148
|
-
if (!await isProblematicFile(fullPath)) {
|
|
149
|
-
files.push(fullPath);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
} catch (e) {
|
|
154
|
-
console.warn(`Error listing directory ${dirPath}:`, e);
|
|
155
|
-
}
|
|
156
|
-
return files;
|
|
157
|
-
}
|
|
158
|
-
async function processFileContent(filePath, options = {}) {
|
|
159
|
-
const rawContent = await readFileSafely(filePath, { allowPathological: options.allowPathological, maxBytes: options.maxBytes });
|
|
160
|
-
const sample = rawContent.subarray(0, 1024 * 1024);
|
|
161
|
-
const detection = ContentTypeInterpreter.detectContentType(sample, path.extname(filePath));
|
|
162
|
-
let isBinary = ContentTypeInterpreter.isBinaryContent(sample, detection.mimeType);
|
|
163
|
-
if (options.forceBinary) isBinary = true;
|
|
164
|
-
let content = rawContent;
|
|
165
|
-
if (!isBinary) {
|
|
166
|
-
try {
|
|
167
|
-
content = new TextDecoder("utf-8", { fatal: true }).decode(rawContent);
|
|
168
|
-
} catch {
|
|
169
|
-
content = new TextDecoder("utf-8", { fatal: false }).decode(rawContent);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return {
|
|
173
|
-
content,
|
|
174
|
-
filename: path.basename(filePath),
|
|
175
|
-
mimeType: detection.mimeType,
|
|
176
|
-
extension: detection.extension,
|
|
177
|
-
isBinary,
|
|
178
|
-
size: rawContent.length
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// src/Loader.ts
|
|
183
|
-
var DEFAULT_MAX_PROBLEM_BYTES = 2 * 1024 * 1024;
|
|
184
|
-
var WRAP_WIDTH_KNOWN = 1e3;
|
|
185
|
-
var WRAP_WIDTH_DEFAULT = 80;
|
|
186
|
-
async function processAndStoreFile(filePath, collection, options = {}) {
|
|
187
|
-
const {
|
|
188
|
-
allowProblematic = false,
|
|
189
|
-
maxBytesOnProblem = DEFAULT_MAX_PROBLEM_BYTES,
|
|
190
|
-
metadataOnly = false,
|
|
191
|
-
rootPath
|
|
192
|
-
} = options;
|
|
193
|
-
try {
|
|
194
|
-
let fileInfo;
|
|
195
|
-
if (await isProblematicFile(filePath)) {
|
|
196
|
-
if (!allowProblematic) {
|
|
197
|
-
console.warn(`Skipping problematic file: ${filePath}`);
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
const extension = path2.extname(filePath).toLowerCase();
|
|
201
|
-
const isKnownType = ContentTypeInterpreter.isKnownLongLineExtension(extension);
|
|
202
|
-
const wrapWidth = isKnownType ? WRAP_WIDTH_KNOWN : WRAP_WIDTH_DEFAULT;
|
|
203
|
-
console.warn(`Problematic file detected, processing as safe text: ${filePath}`);
|
|
204
|
-
try {
|
|
205
|
-
const streamed = await streamReadNormalizedText(filePath, {
|
|
206
|
-
byteCap: maxBytesOnProblem,
|
|
207
|
-
wrapWidth
|
|
208
|
-
});
|
|
209
|
-
fileInfo = {
|
|
210
|
-
content: streamed.text,
|
|
211
|
-
filename: path2.basename(filePath),
|
|
212
|
-
mimeType: "text/plain",
|
|
213
|
-
extension,
|
|
214
|
-
isBinary: false,
|
|
215
|
-
size: streamed.text.length,
|
|
216
|
-
originalSize: streamed.originalSize,
|
|
217
|
-
originalSha256Prefix: streamed.originalSha256Prefix,
|
|
218
|
-
normalized: true,
|
|
219
|
-
wrapWidth
|
|
220
|
-
};
|
|
221
|
-
} catch (e) {
|
|
222
|
-
console.warn(`Safe text processing failed, falling back to capped binary: ${filePath}`);
|
|
223
|
-
fileInfo = await processFileContent(filePath, {
|
|
224
|
-
forceBinary: true,
|
|
225
|
-
allowPathological: true,
|
|
226
|
-
maxBytes: maxBytesOnProblem
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
} else {
|
|
230
|
-
console.log(`Processing file: ${filePath}`);
|
|
231
|
-
fileInfo = await processFileContent(filePath);
|
|
232
|
-
}
|
|
233
|
-
if (!fileInfo) return null;
|
|
234
|
-
const content = fileInfo.content;
|
|
235
|
-
if (!content || typeof content === "string" && content.length === 0 || content instanceof Uint8Array && content.length === 0) {
|
|
236
|
-
if (process.env.DEBUG) {
|
|
237
|
-
console.log(`Skipping empty file: ${filePath} (empty files cannot be stored as MCards)`);
|
|
238
|
-
}
|
|
239
|
-
return {
|
|
240
|
-
hash: "",
|
|
241
|
-
contentType: fileInfo.mimeType,
|
|
242
|
-
isBinary: fileInfo.isBinary,
|
|
243
|
-
filename: fileInfo.filename,
|
|
244
|
-
size: 0,
|
|
245
|
-
filePath
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
let mcard = null;
|
|
249
|
-
const isProblematic = await isProblematicFile(filePath);
|
|
250
|
-
if (metadataOnly && isProblematic) {
|
|
251
|
-
mcard = null;
|
|
252
|
-
} else {
|
|
253
|
-
mcard = await MCard.create(fileInfo.content);
|
|
254
|
-
const handle = path2.basename(filePath);
|
|
255
|
-
try {
|
|
256
|
-
await collection.addWithHandle(mcard, handle);
|
|
257
|
-
} catch (e) {
|
|
258
|
-
let registered = false;
|
|
259
|
-
if (rootPath) {
|
|
260
|
-
const relPath = path2.relative(rootPath, filePath);
|
|
261
|
-
if (relPath !== handle) {
|
|
262
|
-
try {
|
|
263
|
-
await collection.addWithHandle(mcard, relPath);
|
|
264
|
-
registered = true;
|
|
265
|
-
} catch (e2) {
|
|
266
|
-
if (process.env.DEBUG) {
|
|
267
|
-
console.log(
|
|
268
|
-
`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)`
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
if (!registered) {
|
|
275
|
-
try {
|
|
276
|
-
await collection.add(mcard);
|
|
277
|
-
} catch (e3) {
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
const result = {
|
|
283
|
-
hash: mcard ? mcard.hash : "METADATA_ONLY",
|
|
284
|
-
contentType: fileInfo.mimeType,
|
|
285
|
-
isBinary: fileInfo.isBinary,
|
|
286
|
-
filename: fileInfo.filename,
|
|
287
|
-
size: fileInfo.size,
|
|
288
|
-
filePath
|
|
289
|
-
};
|
|
290
|
-
if (fileInfo.originalSize !== void 0) result.originalSize = fileInfo.originalSize;
|
|
291
|
-
if (fileInfo.originalSha256Prefix) result.originalSha256Prefix = fileInfo.originalSha256Prefix;
|
|
292
|
-
if (metadataOnly && isProblematic) result.metadataOnly = true;
|
|
293
|
-
return result;
|
|
294
|
-
} catch (e) {
|
|
295
|
-
console.error(`Error processing ${filePath}:`, e);
|
|
296
|
-
return null;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
async function loadFileToCollection(targetPath, collection, options = {}) {
|
|
300
|
-
const {
|
|
301
|
-
recursive = false,
|
|
302
|
-
includeProblematic = false,
|
|
303
|
-
maxBytesOnProblem = DEFAULT_MAX_PROBLEM_BYTES,
|
|
304
|
-
metadataOnly = false
|
|
305
|
-
} = options;
|
|
306
|
-
const resolvedPath = path2.resolve(targetPath);
|
|
307
|
-
const stats = await fs2.stat(resolvedPath);
|
|
308
|
-
const results = [];
|
|
309
|
-
let files = [];
|
|
310
|
-
let rootPath = resolvedPath;
|
|
311
|
-
if (stats.isFile()) {
|
|
312
|
-
files = [resolvedPath];
|
|
313
|
-
rootPath = path2.dirname(resolvedPath);
|
|
314
|
-
} else if (stats.isDirectory()) {
|
|
315
|
-
files = await listFiles(resolvedPath, recursive);
|
|
316
|
-
rootPath = resolvedPath;
|
|
317
|
-
} else {
|
|
318
|
-
throw new Error(`Path ${targetPath} is not a file or directory`);
|
|
319
|
-
}
|
|
320
|
-
const uniqueDirs = /* @__PURE__ */ new Set();
|
|
321
|
-
let maxDepth = 0;
|
|
322
|
-
for (const file of files) {
|
|
323
|
-
const dir = path2.dirname(file);
|
|
324
|
-
if (dir.startsWith(rootPath)) {
|
|
325
|
-
uniqueDirs.add(dir);
|
|
326
|
-
const rel = path2.relative(rootPath, file);
|
|
327
|
-
const parts = rel.split(path2.sep);
|
|
328
|
-
const depth = parts.length - 1;
|
|
329
|
-
if (depth > maxDepth) maxDepth = depth;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
const metrics = {
|
|
333
|
-
filesCount: files.length,
|
|
334
|
-
directoriesCount: uniqueDirs.size,
|
|
335
|
-
directoryLevels: maxDepth
|
|
336
|
-
};
|
|
337
|
-
console.log(`About to process ${files.length} files`);
|
|
338
|
-
for (const file of files) {
|
|
339
|
-
const result = await processAndStoreFile(file, collection, {
|
|
340
|
-
allowProblematic: includeProblematic,
|
|
341
|
-
maxBytesOnProblem,
|
|
342
|
-
metadataOnly,
|
|
343
|
-
rootPath
|
|
344
|
-
});
|
|
345
|
-
if (result) results.push(result);
|
|
346
|
-
}
|
|
347
|
-
return { metrics, results };
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
export {
|
|
351
|
-
FileIO_exports,
|
|
352
|
-
processAndStoreFile,
|
|
353
|
-
loadFileToCollection,
|
|
354
|
-
Loader_exports
|
|
355
|
-
};
|
package/dist/chunk-PDBMNUMB.js
DELETED
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createPage,
|
|
3
|
-
initCoreSchemas,
|
|
4
|
-
validateHandle
|
|
5
|
-
} from "./chunk-WTNVQ5WS.js";
|
|
6
|
-
import {
|
|
7
|
-
MCard
|
|
8
|
-
} from "./chunk-QPZ2HNSU.js";
|
|
9
|
-
|
|
10
|
-
// src/storage/SqliteNodeEngine.ts
|
|
11
|
-
import { createRequire } from "module";
|
|
12
|
-
var DEFAULT_PAGE_SIZE = 10;
|
|
13
|
-
var SqliteNodeEngine = class _SqliteNodeEngine {
|
|
14
|
-
db;
|
|
15
|
-
dbPath;
|
|
16
|
-
/**
|
|
17
|
-
* Convert a database row into an MCard instance.
|
|
18
|
-
*/
|
|
19
|
-
static rowToCard(row) {
|
|
20
|
-
const content = row.content instanceof Buffer ? new Uint8Array(row.content) : new Uint8Array(row.content);
|
|
21
|
-
return MCard.fromData(content, row.hash, row.g_time);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Create a new SqliteNodeEngine
|
|
25
|
-
* @param dbPath Path to database file, or ':memory:' for in-memory database
|
|
26
|
-
*/
|
|
27
|
-
constructor(dbPath = ":memory:") {
|
|
28
|
-
this.dbPath = dbPath;
|
|
29
|
-
const require2 = createRequire(import.meta.url);
|
|
30
|
-
const Database = require2("better-sqlite3");
|
|
31
|
-
this.db = new Database(dbPath);
|
|
32
|
-
this.setupDatabase();
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Initialize database schema
|
|
36
|
-
*/
|
|
37
|
-
setupDatabase() {
|
|
38
|
-
initCoreSchemas(this.db);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Close the database connection
|
|
42
|
-
*/
|
|
43
|
-
close() {
|
|
44
|
-
this.db.close();
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Get the database path
|
|
48
|
-
*/
|
|
49
|
-
getDbPath() {
|
|
50
|
-
return this.dbPath;
|
|
51
|
-
}
|
|
52
|
-
// =========== Card Operations ===========
|
|
53
|
-
async add(card) {
|
|
54
|
-
const stmt = this.db.prepare(
|
|
55
|
-
"INSERT OR REPLACE INTO card (hash, content, g_time) VALUES (?, ?, ?)"
|
|
56
|
-
);
|
|
57
|
-
stmt.run(card.hash, Buffer.from(card.content), card.g_time);
|
|
58
|
-
return card.hash;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Add a card synchronously (for performance-critical paths)
|
|
62
|
-
*/
|
|
63
|
-
addSync(card) {
|
|
64
|
-
const stmt = this.db.prepare(
|
|
65
|
-
"INSERT OR REPLACE INTO card (hash, content, g_time) VALUES (?, ?, ?)"
|
|
66
|
-
);
|
|
67
|
-
stmt.run(card.hash, Buffer.from(card.content), card.g_time);
|
|
68
|
-
return card.hash;
|
|
69
|
-
}
|
|
70
|
-
async get(hash) {
|
|
71
|
-
return this.getSync(hash);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Get a card synchronously
|
|
75
|
-
*/
|
|
76
|
-
getSync(hash) {
|
|
77
|
-
const stmt = this.db.prepare("SELECT hash, content, g_time FROM card WHERE hash = ?");
|
|
78
|
-
const row = stmt.get(hash);
|
|
79
|
-
if (!row) return null;
|
|
80
|
-
return _SqliteNodeEngine.rowToCard(row);
|
|
81
|
-
}
|
|
82
|
-
async delete(hash) {
|
|
83
|
-
this.deleteSync(hash);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Delete a card synchronously
|
|
87
|
-
*/
|
|
88
|
-
deleteSync(hash) {
|
|
89
|
-
const stmt = this.db.prepare("DELETE FROM card WHERE hash = ?");
|
|
90
|
-
const result = stmt.run(hash);
|
|
91
|
-
return result.changes > 0;
|
|
92
|
-
}
|
|
93
|
-
async getPage(pageNumber = 1, pageSize = DEFAULT_PAGE_SIZE) {
|
|
94
|
-
return this.getPageSync(pageNumber, pageSize);
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Get a page of cards synchronously
|
|
98
|
-
*/
|
|
99
|
-
getPageSync(pageNumber = 1, pageSize = DEFAULT_PAGE_SIZE) {
|
|
100
|
-
if (pageNumber < 1) throw new Error("Page number must be >= 1");
|
|
101
|
-
if (pageSize < 1) throw new Error("Page size must be >= 1");
|
|
102
|
-
const totalItems = this.countSync();
|
|
103
|
-
const offset = (pageNumber - 1) * pageSize;
|
|
104
|
-
const stmt = this.db.prepare(
|
|
105
|
-
"SELECT hash, content, g_time FROM card ORDER BY g_time DESC LIMIT ? OFFSET ?"
|
|
106
|
-
);
|
|
107
|
-
const rows = stmt.all(pageSize, offset);
|
|
108
|
-
const items = rows.map((row) => _SqliteNodeEngine.rowToCard(row));
|
|
109
|
-
return createPage(items, totalItems, pageNumber, pageSize);
|
|
110
|
-
}
|
|
111
|
-
async count() {
|
|
112
|
-
return this.countSync();
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Count cards synchronously
|
|
116
|
-
*/
|
|
117
|
-
countSync() {
|
|
118
|
-
const stmt = this.db.prepare("SELECT COUNT(*) as count FROM card");
|
|
119
|
-
const row = stmt.get();
|
|
120
|
-
return row.count;
|
|
121
|
-
}
|
|
122
|
-
async searchByHash(hashPrefix) {
|
|
123
|
-
const rows = this.db.prepare("SELECT hash, content, g_time FROM card WHERE hash LIKE ?").all(`${hashPrefix}%`);
|
|
124
|
-
return rows.map((row) => _SqliteNodeEngine.rowToCard(row));
|
|
125
|
-
}
|
|
126
|
-
async search(query, pageNumber, pageSize) {
|
|
127
|
-
const offset = (pageNumber - 1) * pageSize;
|
|
128
|
-
const searchPattern = `%${query}%`;
|
|
129
|
-
const countResult = this.db.prepare("SELECT COUNT(*) as count FROM card WHERE CAST(content AS TEXT) LIKE ?").get(searchPattern);
|
|
130
|
-
const totalItems = countResult.count;
|
|
131
|
-
const rows = this.db.prepare("SELECT hash, content, g_time FROM card WHERE CAST(content AS TEXT) LIKE ? LIMIT ? OFFSET ?").all(searchPattern, pageSize, offset);
|
|
132
|
-
const items = rows.map((row) => _SqliteNodeEngine.rowToCard(row));
|
|
133
|
-
return createPage(items, totalItems, pageNumber, pageSize);
|
|
134
|
-
}
|
|
135
|
-
async getAll() {
|
|
136
|
-
const rows = this.db.prepare("SELECT hash, content, g_time FROM card").all();
|
|
137
|
-
return rows.map((row) => _SqliteNodeEngine.rowToCard(row));
|
|
138
|
-
}
|
|
139
|
-
async clear() {
|
|
140
|
-
this.clearSync();
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Clear all data synchronously
|
|
144
|
-
* Delete in FK-safe order: children first, then parents
|
|
145
|
-
*/
|
|
146
|
-
clearSync() {
|
|
147
|
-
this.db.exec("DELETE FROM handle_history");
|
|
148
|
-
this.db.exec("DELETE FROM handle_registry");
|
|
149
|
-
this.db.exec("DELETE FROM card");
|
|
150
|
-
}
|
|
151
|
-
// =========== Search Operations ===========
|
|
152
|
-
/**
|
|
153
|
-
* Search cards by string in content, hash, or g_time
|
|
154
|
-
*/
|
|
155
|
-
searchByString(searchString, pageNumber = 1, pageSize = DEFAULT_PAGE_SIZE) {
|
|
156
|
-
if (pageNumber < 1) throw new Error("Page number must be >= 1");
|
|
157
|
-
if (pageSize < 1) throw new Error("Page size must be >= 1");
|
|
158
|
-
const pattern = `%${searchString}%`;
|
|
159
|
-
const offset = (pageNumber - 1) * pageSize;
|
|
160
|
-
const countStmt = this.db.prepare(`
|
|
161
|
-
SELECT COUNT(*) as count FROM card
|
|
162
|
-
WHERE hash LIKE ? OR g_time LIKE ? OR CAST(content AS TEXT) LIKE ?
|
|
163
|
-
`);
|
|
164
|
-
const countRow = countStmt.get(pattern, pattern, pattern);
|
|
165
|
-
const totalItems = countRow.count;
|
|
166
|
-
const stmt = this.db.prepare(`
|
|
167
|
-
SELECT hash, content, g_time FROM card
|
|
168
|
-
WHERE hash LIKE ? OR g_time LIKE ? OR CAST(content AS TEXT) LIKE ?
|
|
169
|
-
ORDER BY g_time DESC LIMIT ? OFFSET ?
|
|
170
|
-
`);
|
|
171
|
-
const rows = stmt.all(pattern, pattern, pattern, pageSize, offset);
|
|
172
|
-
const items = rows.map((row) => _SqliteNodeEngine.rowToCard(row));
|
|
173
|
-
return createPage(items, totalItems, pageNumber, pageSize);
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Search cards by content pattern (binary-safe)
|
|
177
|
-
*/
|
|
178
|
-
searchByContent(searchPattern, pageNumber = 1, pageSize = DEFAULT_PAGE_SIZE) {
|
|
179
|
-
if (pageNumber < 1) throw new Error("Page number must be >= 1");
|
|
180
|
-
if (pageSize < 1) throw new Error("Page size must be >= 1");
|
|
181
|
-
if (!searchPattern || typeof searchPattern === "string" && searchPattern.length === 0) {
|
|
182
|
-
throw new Error("Search pattern cannot be empty");
|
|
183
|
-
}
|
|
184
|
-
const searchBytes = typeof searchPattern === "string" ? Buffer.from(searchPattern, "utf-8") : Buffer.from(searchPattern);
|
|
185
|
-
const offset = (pageNumber - 1) * pageSize;
|
|
186
|
-
const countStmt = this.db.prepare("SELECT COUNT(*) as count FROM card WHERE INSTR(content, ?) > 0");
|
|
187
|
-
const countRow = countStmt.get(searchBytes);
|
|
188
|
-
const totalItems = countRow.count;
|
|
189
|
-
const stmt = this.db.prepare(`
|
|
190
|
-
SELECT hash, content, g_time FROM card
|
|
191
|
-
WHERE INSTR(content, ?) > 0
|
|
192
|
-
ORDER BY g_time DESC LIMIT ? OFFSET ?
|
|
193
|
-
`);
|
|
194
|
-
const rows = stmt.all(searchBytes, pageSize, offset);
|
|
195
|
-
const items = rows.map((row) => _SqliteNodeEngine.rowToCard(row));
|
|
196
|
-
return createPage(items, totalItems, pageNumber, pageSize);
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Get all cards (single page with all items)
|
|
200
|
-
*/
|
|
201
|
-
getAllCards() {
|
|
202
|
-
const stmt = this.db.prepare("SELECT hash, content, g_time FROM card ORDER BY g_time DESC");
|
|
203
|
-
const rows = stmt.all();
|
|
204
|
-
const items = rows.map((row) => _SqliteNodeEngine.rowToCard(row));
|
|
205
|
-
return createPage(items, items.length, 1, items.length || 1);
|
|
206
|
-
}
|
|
207
|
-
// =========== Handle Operations ===========
|
|
208
|
-
async registerHandle(handle, hash) {
|
|
209
|
-
this.registerHandleSync(handle, hash);
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Register a handle synchronously
|
|
213
|
-
*/
|
|
214
|
-
registerHandleSync(handle, hash) {
|
|
215
|
-
const normalized = validateHandle(handle);
|
|
216
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
217
|
-
const checkStmt = this.db.prepare("SELECT handle FROM handle_registry WHERE handle = ?");
|
|
218
|
-
const existing = checkStmt.get(normalized);
|
|
219
|
-
if (existing) {
|
|
220
|
-
throw new Error(`Handle '${handle}' already exists.`);
|
|
221
|
-
}
|
|
222
|
-
const stmt = this.db.prepare(
|
|
223
|
-
"INSERT INTO handle_registry (handle, current_hash, created_at, updated_at) VALUES (?, ?, ?, ?)"
|
|
224
|
-
);
|
|
225
|
-
stmt.run(normalized, hash, now, now);
|
|
226
|
-
}
|
|
227
|
-
async resolveHandle(handle) {
|
|
228
|
-
return this.resolveHandleSync(handle);
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Resolve a handle synchronously
|
|
232
|
-
*/
|
|
233
|
-
resolveHandleSync(handle) {
|
|
234
|
-
const normalized = validateHandle(handle);
|
|
235
|
-
const stmt = this.db.prepare("SELECT current_hash FROM handle_registry WHERE handle = ?");
|
|
236
|
-
const row = stmt.get(normalized);
|
|
237
|
-
return row?.current_hash || null;
|
|
238
|
-
}
|
|
239
|
-
async getByHandle(handle) {
|
|
240
|
-
return this.getByHandleSync(handle);
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Get card by handle synchronously
|
|
244
|
-
*/
|
|
245
|
-
getByHandleSync(handle) {
|
|
246
|
-
const hash = this.resolveHandleSync(handle);
|
|
247
|
-
if (!hash) return null;
|
|
248
|
-
return this.getSync(hash);
|
|
249
|
-
}
|
|
250
|
-
async updateHandle(handle, newHash) {
|
|
251
|
-
return this.updateHandleSync(handle, newHash);
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Update a handle synchronously
|
|
255
|
-
*/
|
|
256
|
-
updateHandleSync(handle, newHash) {
|
|
257
|
-
const normalized = validateHandle(handle);
|
|
258
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
259
|
-
const getStmt = this.db.prepare("SELECT current_hash FROM handle_registry WHERE handle = ?");
|
|
260
|
-
const row = getStmt.get(normalized);
|
|
261
|
-
if (!row) {
|
|
262
|
-
throw new Error(`Handle '${handle}' not found.`);
|
|
263
|
-
}
|
|
264
|
-
const previousHash = row.current_hash;
|
|
265
|
-
const historyStmt = this.db.prepare(
|
|
266
|
-
"INSERT INTO handle_history (handle, previous_hash, changed_at) VALUES (?, ?, ?)"
|
|
267
|
-
);
|
|
268
|
-
historyStmt.run(normalized, previousHash, now);
|
|
269
|
-
const updateStmt = this.db.prepare(
|
|
270
|
-
"UPDATE handle_registry SET current_hash = ?, updated_at = ? WHERE handle = ?"
|
|
271
|
-
);
|
|
272
|
-
updateStmt.run(newHash, now, normalized);
|
|
273
|
-
return previousHash;
|
|
274
|
-
}
|
|
275
|
-
async getHandleHistory(handle) {
|
|
276
|
-
return this.getHandleHistorySync(handle);
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Get handle history synchronously
|
|
280
|
-
*/
|
|
281
|
-
getHandleHistorySync(handle) {
|
|
282
|
-
const normalized = validateHandle(handle);
|
|
283
|
-
const stmt = this.db.prepare(
|
|
284
|
-
"SELECT previous_hash, changed_at FROM handle_history WHERE handle = ? ORDER BY id DESC"
|
|
285
|
-
);
|
|
286
|
-
const rows = stmt.all(normalized);
|
|
287
|
-
return rows.map((row) => ({
|
|
288
|
-
previousHash: row.previous_hash,
|
|
289
|
-
changedAt: row.changed_at
|
|
290
|
-
}));
|
|
291
|
-
}
|
|
292
|
-
async pruneHandleHistory(handle, options = {}) {
|
|
293
|
-
return this.pruneHandleHistorySync(handle, options);
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Prune handle history synchronously
|
|
297
|
-
*/
|
|
298
|
-
pruneHandleHistorySync(handle, options = {}) {
|
|
299
|
-
const normalized = validateHandle(handle);
|
|
300
|
-
let stmt;
|
|
301
|
-
if (options.deleteAll) {
|
|
302
|
-
stmt = this.db.prepare("DELETE FROM handle_history WHERE handle = ?");
|
|
303
|
-
const result = stmt.run(normalized);
|
|
304
|
-
return result.changes;
|
|
305
|
-
} else if (options.olderThan) {
|
|
306
|
-
stmt = this.db.prepare("DELETE FROM handle_history WHERE handle = ? AND changed_at < ?");
|
|
307
|
-
const result = stmt.run(normalized, options.olderThan);
|
|
308
|
-
return result.changes;
|
|
309
|
-
}
|
|
310
|
-
return 0;
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
export {
|
|
315
|
-
SqliteNodeEngine
|
|
316
|
-
};
|