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-O2UMNZGF.js
DELETED
|
@@ -1,903 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GTime,
|
|
3
|
-
HashValidator
|
|
4
|
-
} from "./chunk-7NKII2JA.js";
|
|
5
|
-
|
|
6
|
-
// src/model/detectors/BinaryDetector.ts
|
|
7
|
-
var BinarySignatureDetector = class _BinarySignatureDetector {
|
|
8
|
-
contentTypeName = "binary";
|
|
9
|
-
// Signatures map: [Signature Bytes, Mime Type]
|
|
10
|
-
static SIGNATURES = [
|
|
11
|
-
[new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]), "image/png"],
|
|
12
|
-
[new Uint8Array([255, 216, 255]), "image/jpeg"],
|
|
13
|
-
[new Uint8Array([71, 73, 70, 56, 55, 97]), "image/gif"],
|
|
14
|
-
// GIF87a
|
|
15
|
-
[new Uint8Array([71, 73, 70, 56, 57, 97]), "image/gif"],
|
|
16
|
-
// GIF89a
|
|
17
|
-
[new Uint8Array([66, 77]), "image/bmp"],
|
|
18
|
-
// BM
|
|
19
|
-
[new Uint8Array([0, 0, 1, 0]), "image/x-icon"],
|
|
20
|
-
[new Uint8Array([0, 0, 2, 0]), "image/x-icon"],
|
|
21
|
-
[new Uint8Array([37, 80, 68, 70]), "application/pdf"],
|
|
22
|
-
// %PDF
|
|
23
|
-
[new Uint8Array([80, 75, 3, 4]), "application/zip"],
|
|
24
|
-
// PK..
|
|
25
|
-
[new Uint8Array([31, 139, 8]), "application/gzip"],
|
|
26
|
-
[new Uint8Array([82, 97, 114, 33, 26, 7, 0]), "application/x-rar-compressed"],
|
|
27
|
-
[new Uint8Array([55, 122, 188, 175, 39, 28]), "application/x-7z-compressed"],
|
|
28
|
-
[new Uint8Array([83, 81, 76, 105, 116, 101, 32, 102, 111, 114, 109, 97, 116, 32, 51, 0]), "application/x-sqlite3"]
|
|
29
|
-
];
|
|
30
|
-
// Extension-to-MIME mapping for binary types (used when byte detection fails)
|
|
31
|
-
static EXT_TO_MIME = {
|
|
32
|
-
// Video
|
|
33
|
-
".mp4": "video/mp4",
|
|
34
|
-
".webm": "video/webm",
|
|
35
|
-
".avi": "video/x-msvideo",
|
|
36
|
-
".mov": "video/quicktime",
|
|
37
|
-
".mkv": "video/x-matroska",
|
|
38
|
-
".wmv": "video/x-ms-wmv",
|
|
39
|
-
".flv": "video/x-flv",
|
|
40
|
-
".m4v": "video/x-m4v",
|
|
41
|
-
// Audio
|
|
42
|
-
".mp3": "audio/mpeg",
|
|
43
|
-
".ogg": "audio/ogg",
|
|
44
|
-
".flac": "audio/flac",
|
|
45
|
-
".aac": "audio/aac",
|
|
46
|
-
".m4a": "audio/mp4",
|
|
47
|
-
".wma": "audio/x-ms-wma",
|
|
48
|
-
// Images (backup for when signature detection fails)
|
|
49
|
-
".png": "image/png",
|
|
50
|
-
".jpg": "image/jpeg",
|
|
51
|
-
".jpeg": "image/jpeg",
|
|
52
|
-
".gif": "image/gif",
|
|
53
|
-
".bmp": "image/bmp",
|
|
54
|
-
".ico": "image/x-icon",
|
|
55
|
-
".webp": "image/webp",
|
|
56
|
-
".svg": "image/svg+xml",
|
|
57
|
-
// Documents
|
|
58
|
-
".pdf": "application/pdf",
|
|
59
|
-
// Archives
|
|
60
|
-
".zip": "application/zip",
|
|
61
|
-
".gz": "application/gzip",
|
|
62
|
-
".rar": "application/x-rar-compressed",
|
|
63
|
-
".7z": "application/x-7z-compressed",
|
|
64
|
-
".tar": "application/x-tar",
|
|
65
|
-
// Database
|
|
66
|
-
".db": "application/x-sqlite3",
|
|
67
|
-
".sqlite": "application/x-sqlite3",
|
|
68
|
-
".sqlite3": "application/x-sqlite3",
|
|
69
|
-
// Fonts
|
|
70
|
-
".woff": "font/woff",
|
|
71
|
-
".woff2": "font/woff2",
|
|
72
|
-
".ttf": "font/ttf",
|
|
73
|
-
".otf": "font/otf",
|
|
74
|
-
".eot": "application/vnd.ms-fontobject"
|
|
75
|
-
};
|
|
76
|
-
detect(contentSample, lines, firstLine, fileExtension) {
|
|
77
|
-
const mime = this.getMimeType(contentSample, lines, firstLine, fileExtension);
|
|
78
|
-
return mime && mime !== "application/octet-stream" ? 0.95 : 0;
|
|
79
|
-
}
|
|
80
|
-
getMimeType(contentSample, lines, firstLine, fileExtension) {
|
|
81
|
-
const bytes = this.toBytes(contentSample);
|
|
82
|
-
const detected = this.detectFromBytes(bytes);
|
|
83
|
-
if (detected !== "application/octet-stream") {
|
|
84
|
-
return detected;
|
|
85
|
-
}
|
|
86
|
-
if (fileExtension) {
|
|
87
|
-
const ext = fileExtension.toLowerCase().startsWith(".") ? fileExtension.toLowerCase() : `.${fileExtension.toLowerCase()}`;
|
|
88
|
-
const extMime = _BinarySignatureDetector.EXT_TO_MIME[ext];
|
|
89
|
-
if (extMime) {
|
|
90
|
-
return extMime;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return "application/octet-stream";
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Detect MIME type directly from bytes.
|
|
97
|
-
*/
|
|
98
|
-
detectFromBytes(bytes) {
|
|
99
|
-
if (this.startsWith(bytes, new Uint8Array([82, 73, 70, 70]))) {
|
|
100
|
-
return this.detectRiffFormat(bytes);
|
|
101
|
-
}
|
|
102
|
-
for (const [sig, mime] of _BinarySignatureDetector.SIGNATURES) {
|
|
103
|
-
if (this.startsWith(bytes, sig)) {
|
|
104
|
-
if (mime === "application/zip") {
|
|
105
|
-
return this.detectZipType(bytes);
|
|
106
|
-
}
|
|
107
|
-
return mime;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return "application/octet-stream";
|
|
111
|
-
}
|
|
112
|
-
toBytes(content) {
|
|
113
|
-
if (content instanceof Uint8Array) return content;
|
|
114
|
-
return new TextEncoder().encode(content);
|
|
115
|
-
}
|
|
116
|
-
startsWith(data, prefix) {
|
|
117
|
-
if (data.length < prefix.length) return false;
|
|
118
|
-
for (let i = 0; i < prefix.length; i++) {
|
|
119
|
-
if (data[i] !== prefix[i]) return false;
|
|
120
|
-
}
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
detectRiffFormat(bytes) {
|
|
124
|
-
if (bytes.length < 12) return "application/octet-stream";
|
|
125
|
-
const format = new TextDecoder().decode(bytes.slice(8, 12));
|
|
126
|
-
if (format === "WAVE") return "audio/wav";
|
|
127
|
-
if (format === "WEBP") return "image/webp";
|
|
128
|
-
return "application/octet-stream";
|
|
129
|
-
}
|
|
130
|
-
detectZipType(bytes) {
|
|
131
|
-
const header = new TextDecoder().decode(bytes.slice(0, 2048));
|
|
132
|
-
if (header.includes("[Content_Types].xml") && header.includes("_rels/.rels")) {
|
|
133
|
-
if (header.includes("word/")) return "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
134
|
-
if (header.includes("xl/")) return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
135
|
-
if (header.includes("ppt/")) return "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
136
|
-
}
|
|
137
|
-
return "application/zip";
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
// src/model/detectors/LanguageDetector.ts
|
|
142
|
-
var ProgrammingLanguageDetector = class {
|
|
143
|
-
contentTypeName = "code";
|
|
144
|
-
detect(contentSample, lines, firstLine, fileExtension) {
|
|
145
|
-
const mime = this.getMimeType(contentSample, lines, firstLine, fileExtension);
|
|
146
|
-
return mime && mime !== "text/plain" ? 0.95 : 0;
|
|
147
|
-
}
|
|
148
|
-
getMimeType(contentSample, lines, firstLine, fileExtension) {
|
|
149
|
-
const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
|
|
150
|
-
if (this.isPython(firstLine, text, lines)) {
|
|
151
|
-
return "text/x-python";
|
|
152
|
-
}
|
|
153
|
-
const cType = this.detectCFamily(text);
|
|
154
|
-
if (cType) return cType;
|
|
155
|
-
const jsType = this.detectJsType(text);
|
|
156
|
-
if (jsType) return jsType;
|
|
157
|
-
if (this.isTypescript(text)) {
|
|
158
|
-
return "text/typescript";
|
|
159
|
-
}
|
|
160
|
-
return "text/plain";
|
|
161
|
-
}
|
|
162
|
-
isPython(firstLine, text, lines) {
|
|
163
|
-
if (/^\s*import\s+(\w+|\w+\.\w+)/m.test(text) || /^\s*from\s+(\w+|\w+\.\w+)\s+import\s+/m.test(text)) {
|
|
164
|
-
const stdLibs = ["os", "sys", "re", "json", "math", "random", "datetime"];
|
|
165
|
-
if (stdLibs.some((lib) => text.includes(`import ${lib}`) || text.includes(`from ${lib}`))) {
|
|
166
|
-
return true;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
if (firstLine.startsWith("#!") && firstLine.toLowerCase().includes("python")) return true;
|
|
170
|
-
if (text.includes("if __name__ ==") && text.includes("__main__")) return true;
|
|
171
|
-
if (/^\s*def\s+\w+\s*\(/.test(text) && !text.includes("function")) return true;
|
|
172
|
-
if (/^\s*class\s+\w+\s*[\(:]/m.test(text)) return true;
|
|
173
|
-
if (/^\s*@\w+/m.test(text)) return true;
|
|
174
|
-
let count = 0;
|
|
175
|
-
const patterns = [
|
|
176
|
-
/\bif\b.*?:/,
|
|
177
|
-
/\belif\b.*?:/,
|
|
178
|
-
/\belse\s*:/,
|
|
179
|
-
/\bfor\b.*?\bin\b.*?:/,
|
|
180
|
-
/\bwhile\b.*?:/,
|
|
181
|
-
/\btry\s*:/,
|
|
182
|
-
/\bexcept\b.*?:/,
|
|
183
|
-
/\bfinally\s*:/,
|
|
184
|
-
/\bNone\b/,
|
|
185
|
-
/\bTrue\b/,
|
|
186
|
-
/\bFalse\b/,
|
|
187
|
-
/f["'].*?\{.*?\}["']/,
|
|
188
|
-
// f-string
|
|
189
|
-
/\bdef\b/,
|
|
190
|
-
/\bclass\b/,
|
|
191
|
-
/\bimport\b/,
|
|
192
|
-
/\bfrom\b/,
|
|
193
|
-
/\blambda\b.*?:/
|
|
194
|
-
];
|
|
195
|
-
for (const p of patterns) {
|
|
196
|
-
if (p.test(text)) count++;
|
|
197
|
-
}
|
|
198
|
-
const nonEmptyLines = lines.filter((l) => l.trim().length > 0).length;
|
|
199
|
-
if (nonEmptyLines <= 5 && count >= 1) {
|
|
200
|
-
return true;
|
|
201
|
-
}
|
|
202
|
-
return count >= 3;
|
|
203
|
-
}
|
|
204
|
-
detectCFamily(text) {
|
|
205
|
-
const cPatterns = [
|
|
206
|
-
/#include\s*<.*?>/,
|
|
207
|
-
/#include\s*".*?"/,
|
|
208
|
-
/\b(int|void|char|float|double)\s+main\s*\(.*\)\s*\{/,
|
|
209
|
-
/\bstruct\s+\w+\s*\{/,
|
|
210
|
-
/#define\s+\w+/,
|
|
211
|
-
/printf\(.*?\);/,
|
|
212
|
-
/scanf\(.*?\);/
|
|
213
|
-
];
|
|
214
|
-
const cppPatterns = [
|
|
215
|
-
/\bclass\s+\w+\s*\{/,
|
|
216
|
-
/\bnamespace\s+\w+\s*\{/,
|
|
217
|
-
/\btemplate\s*<.*?>/,
|
|
218
|
-
/::/,
|
|
219
|
-
/\bstd::/,
|
|
220
|
-
/\bcout\s*<</,
|
|
221
|
-
/\bcin\s*>>/,
|
|
222
|
-
/\bnew\s+\w+/,
|
|
223
|
-
/\bdelete\s+\w+/,
|
|
224
|
-
/#include\s*<iostream>/
|
|
225
|
-
];
|
|
226
|
-
let cCount = 0;
|
|
227
|
-
let cppCount = 0;
|
|
228
|
-
cPatterns.forEach((p) => {
|
|
229
|
-
if (p.test(text)) cCount++;
|
|
230
|
-
});
|
|
231
|
-
cppPatterns.forEach((p) => {
|
|
232
|
-
if (p.test(text)) cppCount++;
|
|
233
|
-
});
|
|
234
|
-
if (cppCount >= 2 || cppCount >= 1 && text.includes("std::")) return "text/x-c++";
|
|
235
|
-
if (cCount >= 2) return "text/x-c";
|
|
236
|
-
return null;
|
|
237
|
-
}
|
|
238
|
-
detectJsType(text) {
|
|
239
|
-
const jsPatterns = [
|
|
240
|
-
/function\s+\w+\s*\(/.test(text),
|
|
241
|
-
// function foo(
|
|
242
|
-
/\bconst\s+\w+\s*=/.test(text),
|
|
243
|
-
/\blet\s+\w+\s*=/.test(text),
|
|
244
|
-
/\bvar\s+\w+\s*=/.test(text),
|
|
245
|
-
/\bimport\s+.*\s+from/.test(text),
|
|
246
|
-
/\bexport\s+/.test(text),
|
|
247
|
-
/\=\>\s*\{/.test(text),
|
|
248
|
-
// Arrow func
|
|
249
|
-
/console\.log\(/.test(text)
|
|
250
|
-
];
|
|
251
|
-
const jsxPatterns = [
|
|
252
|
-
/<\w+(>|\s+.*?>)[\s\S]*?<\/\w+>/m.test(text),
|
|
253
|
-
/<\w+\s+\/>/m.test(text),
|
|
254
|
-
/className=/.test(text),
|
|
255
|
-
/React\.createElement/.test(text)
|
|
256
|
-
];
|
|
257
|
-
const jsCount = jsPatterns.filter(Boolean).length;
|
|
258
|
-
const jsxCount = jsxPatterns.filter(Boolean).length;
|
|
259
|
-
if (jsxCount > 0 && (text.includes("import React") || text.includes('from "react"'))) return "text/jsx";
|
|
260
|
-
if (jsxCount >= 2) return "text/jsx";
|
|
261
|
-
if (jsCount >= 2) {
|
|
262
|
-
const stripped = text.trim();
|
|
263
|
-
if (stripped.startsWith("{") && stripped.endsWith("}") || stripped.startsWith("[") && stripped.endsWith("]")) {
|
|
264
|
-
try {
|
|
265
|
-
JSON.parse(text);
|
|
266
|
-
if (jsCount < 2) return null;
|
|
267
|
-
} catch {
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
return "text/javascript";
|
|
271
|
-
}
|
|
272
|
-
return null;
|
|
273
|
-
}
|
|
274
|
-
isTypescript(text) {
|
|
275
|
-
const tsPatterns = [
|
|
276
|
-
/:\s*(string|number|boolean|any|void|null|undefined)\b/,
|
|
277
|
-
/\binterface\s+\w+\s*\{/,
|
|
278
|
-
/\bclass\s+\w+\s+implements\s+\w+/,
|
|
279
|
-
/\btype\s+\w+\s*=/,
|
|
280
|
-
/\b(public|private|protected)\s+/,
|
|
281
|
-
/\bnamespace\s+\w+\s*\{/,
|
|
282
|
-
/<\w+>/
|
|
283
|
-
// Generics (simple check)
|
|
284
|
-
];
|
|
285
|
-
let count = 0;
|
|
286
|
-
tsPatterns.forEach((p) => {
|
|
287
|
-
if (p.test(text)) count++;
|
|
288
|
-
});
|
|
289
|
-
return count >= 2;
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
// src/model/detectors/MarkupDetectors.ts
|
|
294
|
-
var XMLDetector = class _XMLDetector {
|
|
295
|
-
contentTypeName = "xml";
|
|
296
|
-
static XML_DECLARATION = /^\s*<\?xml/i;
|
|
297
|
-
static BASIC_TAG_PAIR = /<(\w+)[^>]*>.*?<\/\1>/s;
|
|
298
|
-
detect(contentSample, lines, firstLine, fileExtension) {
|
|
299
|
-
const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
|
|
300
|
-
let confidence = 0;
|
|
301
|
-
if (fileExtension && fileExtension.toLowerCase() === ".xml") {
|
|
302
|
-
confidence = Math.max(confidence, 0.95);
|
|
303
|
-
}
|
|
304
|
-
if (_XMLDetector.XML_DECLARATION.test(firstLine) || text.trim().startsWith("<?xml")) {
|
|
305
|
-
confidence = Math.max(confidence, 0.95);
|
|
306
|
-
}
|
|
307
|
-
if (text.includes("<") && text.includes(">") && text.includes("</")) {
|
|
308
|
-
confidence = Math.max(confidence, 0.5);
|
|
309
|
-
if (_XMLDetector.BASIC_TAG_PAIR.test(text)) {
|
|
310
|
-
confidence = Math.max(confidence, 0.7);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
if (text.toLowerCase().includes("<!doctype html")) {
|
|
314
|
-
if (confidence > 0.3) confidence -= 0.4;
|
|
315
|
-
}
|
|
316
|
-
return Math.min(Math.max(confidence, 0), 1);
|
|
317
|
-
}
|
|
318
|
-
getMimeType(contentSample, lines, firstLine, fileExtension) {
|
|
319
|
-
const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
|
|
320
|
-
if (fileExtension === ".xml") return "application/xml";
|
|
321
|
-
if (text.toLowerCase().includes("<svg")) return "image/svg+xml";
|
|
322
|
-
if (text.toLowerCase().includes("<html") || text.toLowerCase().includes("<!doctype html")) return "text/html";
|
|
323
|
-
if (this.detect(contentSample, lines, firstLine, fileExtension) > 0.5) return "application/xml";
|
|
324
|
-
return "text/plain";
|
|
325
|
-
}
|
|
326
|
-
};
|
|
327
|
-
var MarkdownDetector = class _MarkdownDetector {
|
|
328
|
-
contentTypeName = "markdown";
|
|
329
|
-
static MD_PATTERNS = [
|
|
330
|
-
/^#{1,6}\s+\S+/,
|
|
331
|
-
// ATX Headers
|
|
332
|
-
/^\s*[\*\+\-]\s+\S+/,
|
|
333
|
-
// List items
|
|
334
|
-
/^\s*\d+\.\s+\S+/,
|
|
335
|
-
// Ordered list items
|
|
336
|
-
/`{1,3}[^`]+`{1,3}/,
|
|
337
|
-
// Inline code
|
|
338
|
-
/\[[^\]]+\]\([^\)]+\)/,
|
|
339
|
-
// Links
|
|
340
|
-
/!\[[^\]]+\]\([^\)]+\)/,
|
|
341
|
-
// Images
|
|
342
|
-
/^\s*>.*/
|
|
343
|
-
// Blockquotes
|
|
344
|
-
];
|
|
345
|
-
static SETEXT_HEADER = /^.*\n(?:={3,}|-{3,})\s*$/m;
|
|
346
|
-
detect(contentSample, lines, firstLine, fileExtension) {
|
|
347
|
-
const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
|
|
348
|
-
let confidence = 0;
|
|
349
|
-
if (fileExtension && [".md", ".markdown"].includes(fileExtension.toLowerCase())) {
|
|
350
|
-
confidence = Math.max(confidence, 0.95);
|
|
351
|
-
}
|
|
352
|
-
let mdFeatures = 0;
|
|
353
|
-
if (_MarkdownDetector.SETEXT_HEADER.test(text)) mdFeatures += 2;
|
|
354
|
-
for (const line of lines.slice(0, 20)) {
|
|
355
|
-
if (_MarkdownDetector.MD_PATTERNS.some((p) => p.test(line))) {
|
|
356
|
-
mdFeatures++;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
const hasCodeFence = text.includes("```");
|
|
360
|
-
if (hasCodeFence) mdFeatures++;
|
|
361
|
-
if (mdFeatures > 1 && hasCodeFence) confidence = Math.max(confidence, 0.85);
|
|
362
|
-
if (mdFeatures > 3 && hasCodeFence) confidence = Math.max(confidence, 0.95);
|
|
363
|
-
else if (mdFeatures > 1) confidence = Math.max(confidence, 0.6);
|
|
364
|
-
else if (mdFeatures > 3) confidence = Math.max(confidence, 0.8);
|
|
365
|
-
else if (mdFeatures > 5) confidence = Math.max(confidence, 0.9);
|
|
366
|
-
const stripped = text.trim();
|
|
367
|
-
if (stripped.startsWith("{") && stripped.endsWith("}") || stripped.startsWith("[") && stripped.endsWith("]")) {
|
|
368
|
-
try {
|
|
369
|
-
JSON.parse(text);
|
|
370
|
-
if (confidence > 0.3) confidence -= 0.4;
|
|
371
|
-
} catch {
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
if (stripped.startsWith("<") && text.includes("<?xml")) {
|
|
375
|
-
if (confidence > 0.3) confidence -= 0.4;
|
|
376
|
-
}
|
|
377
|
-
return Math.min(Math.max(confidence, 0), 1);
|
|
378
|
-
}
|
|
379
|
-
getMimeType(contentSample, lines, firstLine, fileExtension) {
|
|
380
|
-
return this.detect(contentSample, lines, firstLine, fileExtension) > 0.5 ? "text/markdown" : "text/plain";
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
var PlainTextDetector = class _PlainTextDetector {
|
|
384
|
-
contentTypeName = "text";
|
|
385
|
-
static IMAGE_EXTS = [".png", ".jpg", ".jpeg", ".gif", ".bmp", ".svg", ".webp"];
|
|
386
|
-
detect(contentSample, lines, firstLine, fileExtension) {
|
|
387
|
-
if (!contentSample && lines.length === 0) return 0.1;
|
|
388
|
-
if (fileExtension) {
|
|
389
|
-
const ext = fileExtension.toLowerCase();
|
|
390
|
-
if (_PlainTextDetector.IMAGE_EXTS.includes(ext) || ext === ".pdf") return 0;
|
|
391
|
-
}
|
|
392
|
-
const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
|
|
393
|
-
if (text.includes(",") && lines.length < 5) {
|
|
394
|
-
const commaLines = lines.filter((l) => l.includes(",")).length;
|
|
395
|
-
if (commaLines > 0 && commaLines === lines.length) {
|
|
396
|
-
return 0.8;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
return 0.15;
|
|
400
|
-
}
|
|
401
|
-
getMimeType(contentSample, lines, firstLine, fileExtension) {
|
|
402
|
-
return "text/plain";
|
|
403
|
-
}
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
// src/model/detectors/DataFormatDetectors.ts
|
|
407
|
-
var SQLDetector = class _SQLDetector {
|
|
408
|
-
contentTypeName = "sql";
|
|
409
|
-
// Keywords (case insensitive checking handled in method)
|
|
410
|
-
static KEYWORDS = [
|
|
411
|
-
"SELECT ",
|
|
412
|
-
"INSERT ",
|
|
413
|
-
"UPDATE ",
|
|
414
|
-
"DELETE ",
|
|
415
|
-
"CREATE ",
|
|
416
|
-
"DROP ",
|
|
417
|
-
"ALTER ",
|
|
418
|
-
"FROM ",
|
|
419
|
-
"WHERE ",
|
|
420
|
-
"JOIN ",
|
|
421
|
-
"TABLE ",
|
|
422
|
-
"INTO ",
|
|
423
|
-
"VALUES ",
|
|
424
|
-
"SET ",
|
|
425
|
-
"PRIMARY KEY"
|
|
426
|
-
];
|
|
427
|
-
detect(contentSample, lines, firstLine, fileExtension) {
|
|
428
|
-
const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
|
|
429
|
-
let confidence = 0;
|
|
430
|
-
if (fileExtension && fileExtension.toLowerCase() === ".sql") {
|
|
431
|
-
confidence = Math.max(confidence, 0.95);
|
|
432
|
-
}
|
|
433
|
-
let hits = 0;
|
|
434
|
-
const upperText = text.toUpperCase();
|
|
435
|
-
for (const line of lines.slice(0, 10)) {
|
|
436
|
-
const upperLine = line.toUpperCase();
|
|
437
|
-
for (const kw of _SQLDetector.KEYWORDS) {
|
|
438
|
-
if (upperLine.includes(kw)) {
|
|
439
|
-
hits++;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
if (hits >= 2) confidence = Math.max(confidence, 0.85);
|
|
444
|
-
else if (hits === 1) confidence = Math.max(confidence, 0.6);
|
|
445
|
-
return Math.min(confidence, 1);
|
|
446
|
-
}
|
|
447
|
-
getMimeType(contentSample, lines, firstLine, fileExtension) {
|
|
448
|
-
return this.detect(contentSample, lines, firstLine, fileExtension) > 0.5 ? "text/x-sql" : "text/plain";
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
var JSONDetector = class {
|
|
452
|
-
contentTypeName = "json";
|
|
453
|
-
detect(contentSample, lines, firstLine, fileExtension) {
|
|
454
|
-
const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
|
|
455
|
-
if (fileExtension && fileExtension.toLowerCase() === ".json") {
|
|
456
|
-
return this.verifyJsonStructure(text) ? 0.95 : 0.6;
|
|
457
|
-
}
|
|
458
|
-
const stripped = text.trim();
|
|
459
|
-
if (!(stripped.startsWith("{") && stripped.endsWith("}") || stripped.startsWith("[") && stripped.endsWith("]"))) {
|
|
460
|
-
return 0;
|
|
461
|
-
}
|
|
462
|
-
for (const line of lines.slice(0, 5)) {
|
|
463
|
-
const l = line.trim();
|
|
464
|
-
if (l.startsWith("//") || l.startsWith("/*")) return 0;
|
|
465
|
-
}
|
|
466
|
-
try {
|
|
467
|
-
JSON.parse(text);
|
|
468
|
-
return 0.9;
|
|
469
|
-
} catch (e) {
|
|
470
|
-
return 0;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
getMimeType(contentSample, lines, firstLine, fileExtension) {
|
|
474
|
-
return this.detect(contentSample, lines, firstLine, fileExtension) > 0.5 ? "application/json" : "text/plain";
|
|
475
|
-
}
|
|
476
|
-
verifyJsonStructure(text) {
|
|
477
|
-
try {
|
|
478
|
-
JSON.parse(text);
|
|
479
|
-
return true;
|
|
480
|
-
} catch {
|
|
481
|
-
return false;
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
};
|
|
485
|
-
var YAMLDetector = class _YAMLDetector {
|
|
486
|
-
contentTypeName = "yaml";
|
|
487
|
-
static YAML_START_PATTERNS = [/^---\s*$/, /^%YAML/];
|
|
488
|
-
static KEY_VALUE_PATTERN = /^\s*[\w.-]+:\s+(?![=\{\[])/;
|
|
489
|
-
static LIST_ITEM_PATTERN = /^\s*-\s+[\w\'\"]/;
|
|
490
|
-
detect(contentSample, lines, firstLine, fileExtension) {
|
|
491
|
-
const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
|
|
492
|
-
let confidence = 0;
|
|
493
|
-
if (fileExtension && [".yaml", ".yml"].includes(fileExtension.toLowerCase())) {
|
|
494
|
-
confidence = Math.max(confidence, 0.95);
|
|
495
|
-
}
|
|
496
|
-
if (_YAMLDetector.YAML_START_PATTERNS.some((p) => p.test(firstLine))) {
|
|
497
|
-
confidence = Math.max(confidence, 0.9);
|
|
498
|
-
}
|
|
499
|
-
let yamlFeatures = 0;
|
|
500
|
-
if (_YAMLDetector.YAML_START_PATTERNS.some((p) => new RegExp(p.source, "m").test(text))) {
|
|
501
|
-
yamlFeatures += 2;
|
|
502
|
-
}
|
|
503
|
-
for (const line of lines.slice(0, 20)) {
|
|
504
|
-
const stripped = line.trim();
|
|
505
|
-
if (_YAMLDetector.KEY_VALUE_PATTERN.test(stripped)) yamlFeatures++;
|
|
506
|
-
else if (_YAMLDetector.LIST_ITEM_PATTERN.test(stripped)) yamlFeatures++;
|
|
507
|
-
}
|
|
508
|
-
const firstNonEmpty = lines.find((l) => l.trim().length > 0) || "";
|
|
509
|
-
if (firstNonEmpty.trim() === "---") {
|
|
510
|
-
if (yamlFeatures > 1) confidence = Math.max(confidence, 0.5);
|
|
511
|
-
if (yamlFeatures > 3) confidence = Math.max(confidence, 0.75);
|
|
512
|
-
if (yamlFeatures > 5) confidence = Math.max(confidence, 0.9);
|
|
513
|
-
} else {
|
|
514
|
-
if (fileExtension && [".yaml", ".yml"].includes(fileExtension.toLowerCase())) {
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
return Math.min(Math.max(confidence, 0), 1);
|
|
518
|
-
}
|
|
519
|
-
getMimeType(contentSample, lines, firstLine, fileExtension) {
|
|
520
|
-
const conf = this.detect(contentSample, lines, firstLine, fileExtension);
|
|
521
|
-
return conf > 0.5 ? "application/x-yaml" : "text/plain";
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
var CSVDetector = class {
|
|
525
|
-
contentTypeName = "csv";
|
|
526
|
-
detect(contentSample, lines, firstLine, fileExtension) {
|
|
527
|
-
const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
|
|
528
|
-
if (fileExtension && fileExtension.toLowerCase() === ".csv") {
|
|
529
|
-
return this.verifyCsvStructure(lines) ? 0.95 : 0.6;
|
|
530
|
-
}
|
|
531
|
-
return this.analyzeCsvContent(lines);
|
|
532
|
-
}
|
|
533
|
-
getMimeType(contentSample, lines, firstLine, fileExtension) {
|
|
534
|
-
return this.detect(contentSample, lines, firstLine, fileExtension) > 0.5 ? "text/csv" : "text/plain";
|
|
535
|
-
}
|
|
536
|
-
verifyCsvStructure(lines) {
|
|
537
|
-
const sampleLines = lines.slice(0, 10).filter((l) => l.trim().length > 0);
|
|
538
|
-
if (sampleLines.length === 0) return false;
|
|
539
|
-
if (!sampleLines.every((l) => l.includes(","))) return false;
|
|
540
|
-
const counts = sampleLines.map((l) => (l.match(/,/g) || []).length);
|
|
541
|
-
const uniqueCounts = [...new Set(counts)];
|
|
542
|
-
if (uniqueCounts.length === 1 && uniqueCounts[0] > 0) return true;
|
|
543
|
-
if (sampleLines.length > 1) {
|
|
544
|
-
const dataCounts = counts.slice(1);
|
|
545
|
-
const uniqueData = [...new Set(dataCounts)];
|
|
546
|
-
if (uniqueData.length === 1 && uniqueData[0] > 0) return true;
|
|
547
|
-
}
|
|
548
|
-
return false;
|
|
549
|
-
}
|
|
550
|
-
analyzeCsvContent(lines) {
|
|
551
|
-
if (!lines || lines.length === 0) return 0;
|
|
552
|
-
const sampleLines = lines.slice(0, 10).filter((l) => l.trim().length > 0);
|
|
553
|
-
if (sampleLines.length === 0 || !sampleLines.every((l) => l.includes(","))) return 0;
|
|
554
|
-
const counts = sampleLines.map((l) => (l.match(/,/g) || []).length);
|
|
555
|
-
const uniqueCounts = [...new Set(counts)];
|
|
556
|
-
if (uniqueCounts.length === 1 && uniqueCounts[0] > 0) return 0.9;
|
|
557
|
-
if (sampleLines.length > 1) {
|
|
558
|
-
const dataCounts = counts.slice(1);
|
|
559
|
-
const uniqueData = [...new Set(dataCounts)];
|
|
560
|
-
if (uniqueData.length === 1 && uniqueData[0] > 0) return 0.8;
|
|
561
|
-
}
|
|
562
|
-
if (counts.every((c) => c > 0)) return 0.5;
|
|
563
|
-
return 0;
|
|
564
|
-
}
|
|
565
|
-
};
|
|
566
|
-
|
|
567
|
-
// src/model/detectors/OBJDetector.ts
|
|
568
|
-
var OBJDetector = class _OBJDetector {
|
|
569
|
-
contentTypeName = "obj";
|
|
570
|
-
// Check for 'v ' (vertex), 'f ' (face), 'vn ', 'vt '
|
|
571
|
-
static COMMANDS = ["v ", "vt ", "vn ", "f ", "g ", "o ", "s ", "mtllib ", "usemtl "];
|
|
572
|
-
detect(contentSample, lines, firstLine, fileExtension) {
|
|
573
|
-
const text = typeof contentSample === "string" ? contentSample : new TextDecoder().decode(contentSample);
|
|
574
|
-
let confidence = 0;
|
|
575
|
-
if (fileExtension && fileExtension.toLowerCase() === ".obj") {
|
|
576
|
-
confidence = Math.max(confidence, 0.95);
|
|
577
|
-
}
|
|
578
|
-
const validLines = lines.filter((l) => l.trim().length > 0 && !l.trim().startsWith("#"));
|
|
579
|
-
let commandCount = 0;
|
|
580
|
-
for (const line of validLines.slice(0, 20)) {
|
|
581
|
-
const trimmed = line.trim();
|
|
582
|
-
for (const cmd of _OBJDetector.COMMANDS) {
|
|
583
|
-
if (trimmed.startsWith(cmd)) {
|
|
584
|
-
commandCount++;
|
|
585
|
-
break;
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
if (commandCount >= 2) {
|
|
590
|
-
if (commandCount > 10) confidence = Math.max(confidence, 0.9);
|
|
591
|
-
else if (commandCount > 5) confidence = Math.max(confidence, 0.8);
|
|
592
|
-
else confidence = Math.max(confidence, 0.7);
|
|
593
|
-
}
|
|
594
|
-
const codeKeywords = ["def ", "class ", "import ", "function ", "var ", "let ", "const "];
|
|
595
|
-
if (codeKeywords.some((k) => text.includes(k))) {
|
|
596
|
-
return 0;
|
|
597
|
-
}
|
|
598
|
-
return Math.min(confidence, 1);
|
|
599
|
-
}
|
|
600
|
-
getMimeType(contentSample, lines, firstLine, fileExtension) {
|
|
601
|
-
return this.detect(contentSample, lines, firstLine, fileExtension) > 0.5 ? "application/3d-obj" : "text/plain";
|
|
602
|
-
}
|
|
603
|
-
};
|
|
604
|
-
|
|
605
|
-
// src/model/detectors/registry.ts
|
|
606
|
-
var DetectorRegistry = class {
|
|
607
|
-
detectors;
|
|
608
|
-
constructor() {
|
|
609
|
-
this.detectors = [
|
|
610
|
-
new BinarySignatureDetector(),
|
|
611
|
-
// Programming languages
|
|
612
|
-
new ProgrammingLanguageDetector(),
|
|
613
|
-
// Structured data
|
|
614
|
-
new XMLDetector(),
|
|
615
|
-
new JSONDetector(),
|
|
616
|
-
new OBJDetector(),
|
|
617
|
-
// Markup
|
|
618
|
-
new MarkdownDetector(),
|
|
619
|
-
// Data formats (lower priority)
|
|
620
|
-
new SQLDetector(),
|
|
621
|
-
new CSVDetector(),
|
|
622
|
-
new YAMLDetector(),
|
|
623
|
-
// Fallback
|
|
624
|
-
new PlainTextDetector()
|
|
625
|
-
];
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* Detect content type and return the most likely MIME type.
|
|
629
|
-
*/
|
|
630
|
-
detect(contentSample, lines, firstLine, fileExtension) {
|
|
631
|
-
const hasComma = lines.some((l) => l.includes(","));
|
|
632
|
-
if (hasComma) {
|
|
633
|
-
if (lines.length < 3) {
|
|
634
|
-
const commaLines = lines.filter((l) => l.includes(",")).length;
|
|
635
|
-
if (commaLines > 0 && commaLines === lines.length) {
|
|
636
|
-
const delimCounts = lines.filter((l) => l.trim()).map((l) => (l.match(/,/g) || []).length);
|
|
637
|
-
if (delimCounts.length > 0 && delimCounts.every((c) => c <= 2)) {
|
|
638
|
-
return "text/plain";
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
let bestConfidence = 0;
|
|
644
|
-
let bestMime = "text/plain";
|
|
645
|
-
for (const detector of this.detectors) {
|
|
646
|
-
const confidence = detector.detect(contentSample, lines, firstLine, fileExtension);
|
|
647
|
-
if (confidence > bestConfidence) {
|
|
648
|
-
const mime = detector.getMimeType(contentSample, lines, firstLine, fileExtension);
|
|
649
|
-
if (mime) {
|
|
650
|
-
bestConfidence = confidence;
|
|
651
|
-
bestMime = mime;
|
|
652
|
-
if (confidence >= 0.99) break;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
return bestMime;
|
|
657
|
-
}
|
|
658
|
-
};
|
|
659
|
-
var registry = new DetectorRegistry();
|
|
660
|
-
|
|
661
|
-
// src/model/ContentTypeInterpreter.ts
|
|
662
|
-
var ContentTypeInterpreter = class {
|
|
663
|
-
static MIME_TO_EXT = {
|
|
664
|
-
"text/plain": ".txt",
|
|
665
|
-
"application/json": ".json",
|
|
666
|
-
"text/csv": ".csv",
|
|
667
|
-
"text/x-python": ".py",
|
|
668
|
-
"text/javascript": ".js",
|
|
669
|
-
"text/jsx": ".jsx",
|
|
670
|
-
"text/typescript": ".ts",
|
|
671
|
-
"text/x-c": ".c",
|
|
672
|
-
"text/x-c++": ".cpp",
|
|
673
|
-
"application/xml": ".xml",
|
|
674
|
-
"text/html": ".html",
|
|
675
|
-
"application/x-yaml": ".yaml",
|
|
676
|
-
"text/markdown": ".md",
|
|
677
|
-
"text/x-sql": ".sql",
|
|
678
|
-
"image/png": ".png",
|
|
679
|
-
"image/jpeg": ".jpg",
|
|
680
|
-
"image/gif": ".gif",
|
|
681
|
-
"image/bmp": ".bmp",
|
|
682
|
-
"image/x-icon": ".ico",
|
|
683
|
-
"image/webp": ".webp",
|
|
684
|
-
"image/svg+xml": ".svg",
|
|
685
|
-
"application/pdf": ".pdf",
|
|
686
|
-
"application/zip": ".zip",
|
|
687
|
-
"application/gzip": ".gz",
|
|
688
|
-
"application/x-rar-compressed": ".rar",
|
|
689
|
-
"application/x-7z-compressed": ".7z",
|
|
690
|
-
"application/x-sqlite3": ".db",
|
|
691
|
-
"audio/wav": ".wav"
|
|
692
|
-
// Add more as needed
|
|
693
|
-
};
|
|
694
|
-
/**
|
|
695
|
-
* Convenience method to detect MIME type only.
|
|
696
|
-
* Matches the API expected by MCard/PCard/VCard.
|
|
697
|
-
*/
|
|
698
|
-
static detect(content) {
|
|
699
|
-
return this.detectContentType(content).mimeType;
|
|
700
|
-
}
|
|
701
|
-
/**
|
|
702
|
-
* Detect content type and suggest extension.
|
|
703
|
-
*
|
|
704
|
-
* @param content Content string or binary buffer
|
|
705
|
-
* @param fileExtension Optional file extension hint
|
|
706
|
-
* @returns Object containing detected mimeType and suggested extension
|
|
707
|
-
*/
|
|
708
|
-
static detectContentType(content, fileExtension) {
|
|
709
|
-
let lines = [];
|
|
710
|
-
let firstLine = "";
|
|
711
|
-
let textSample = "";
|
|
712
|
-
if (typeof content === "string") {
|
|
713
|
-
textSample = content.slice(0, 8192);
|
|
714
|
-
} else {
|
|
715
|
-
textSample = new TextDecoder("utf-8", { fatal: false }).decode(content.slice(0, 8192));
|
|
716
|
-
}
|
|
717
|
-
lines = textSample.split("\n").slice(0, 20);
|
|
718
|
-
firstLine = lines[0] || "";
|
|
719
|
-
const mimeType = registry.detect(content, lines, firstLine, fileExtension);
|
|
720
|
-
let extension = this.getExtension(mimeType);
|
|
721
|
-
if (fileExtension && extension) {
|
|
722
|
-
if (fileExtension.toLowerCase() === extension || fileExtension.toLowerCase() === `.${extension}`) {
|
|
723
|
-
extension = fileExtension;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
if (!extension && fileExtension) {
|
|
727
|
-
extension = fileExtension;
|
|
728
|
-
}
|
|
729
|
-
if (!extension) {
|
|
730
|
-
extension = ".txt";
|
|
731
|
-
}
|
|
732
|
-
return { mimeType, extension };
|
|
733
|
-
}
|
|
734
|
-
static getExtension(mimeType) {
|
|
735
|
-
return this.MIME_TO_EXT[mimeType] || "";
|
|
736
|
-
}
|
|
737
|
-
/**
|
|
738
|
-
* Check if content should be treated as binary.
|
|
739
|
-
*/
|
|
740
|
-
static isBinaryContent(content, mimeType) {
|
|
741
|
-
if (mimeType) {
|
|
742
|
-
if (mimeType.startsWith("text/") || mimeType.includes("json") || mimeType.includes("xml") || mimeType.includes("javascript") || mimeType.includes("ecmascript")) {
|
|
743
|
-
return false;
|
|
744
|
-
}
|
|
745
|
-
return true;
|
|
746
|
-
}
|
|
747
|
-
if (typeof content === "string") return false;
|
|
748
|
-
const detection = this.detectContentType(content);
|
|
749
|
-
return !detection.mimeType.startsWith("text/") && !detection.mimeType.includes("json") && !detection.mimeType.includes("xml");
|
|
750
|
-
}
|
|
751
|
-
static isKnownLongLineExtension(extension) {
|
|
752
|
-
if (!extension) return false;
|
|
753
|
-
const ext = extension.toLowerCase();
|
|
754
|
-
return [".min.js", ".min.css", ".map", ".svg", ".json", ".geojson"].some((e) => ext.endsWith(e));
|
|
755
|
-
}
|
|
756
|
-
static isUnstructuredBinary(sample) {
|
|
757
|
-
if (sample.length < 512) return false;
|
|
758
|
-
let nullCount = 0;
|
|
759
|
-
let controlCount = 0;
|
|
760
|
-
const len = Math.min(sample.length, 32 * 1024);
|
|
761
|
-
for (let i = 0; i < len; i++) {
|
|
762
|
-
const byte = sample[i];
|
|
763
|
-
if (byte === 0) {
|
|
764
|
-
nullCount++;
|
|
765
|
-
}
|
|
766
|
-
if (byte < 32 && byte !== 9 && byte !== 10 && byte !== 13) {
|
|
767
|
-
controlCount++;
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
const nullRatio = nullCount / len;
|
|
771
|
-
const controlRatio = controlCount / len;
|
|
772
|
-
return nullRatio > 0.1 || controlRatio > 0.2;
|
|
773
|
-
}
|
|
774
|
-
static hasPathologicalLines(sample, isKnownType) {
|
|
775
|
-
if (isKnownType || sample.length < 32768) return false;
|
|
776
|
-
for (let i = 0; i < sample.length; i++) {
|
|
777
|
-
if (sample[i] === 10 || sample[i] === 13) return false;
|
|
778
|
-
}
|
|
779
|
-
return true;
|
|
780
|
-
}
|
|
781
|
-
};
|
|
782
|
-
|
|
783
|
-
// src/types/dots.ts
|
|
784
|
-
function createMCardDOTSMetadata(tightRefs = [], looseRefs = []) {
|
|
785
|
-
return {
|
|
786
|
-
role: "Carrier" /* CARRIER */,
|
|
787
|
-
eosRole: "InvariantContent" /* INVARIANT_CONTENT */,
|
|
788
|
-
plane: "Data" /* DATA */,
|
|
789
|
-
tightRefs,
|
|
790
|
-
looseRefs
|
|
791
|
-
};
|
|
792
|
-
}
|
|
793
|
-
function createPCardDOTSMetadata(isLens, tightRefs = [], looseRefs = []) {
|
|
794
|
-
return {
|
|
795
|
-
role: isLens ? "Lens" /* LENS */ : "Chart" /* CHART */,
|
|
796
|
-
eosRole: "GenerativeLens" /* GENERATIVE_LENS */,
|
|
797
|
-
plane: "Control" /* CONTROL */,
|
|
798
|
-
tightRefs,
|
|
799
|
-
looseRefs
|
|
800
|
-
};
|
|
801
|
-
}
|
|
802
|
-
function createVCardDOTSMetadata() {
|
|
803
|
-
return {
|
|
804
|
-
role: "Arena" /* ARENA */,
|
|
805
|
-
eosRole: "SovereignDecision" /* SOVEREIGN_DECISION */,
|
|
806
|
-
plane: "Application" /* APPLICATION */
|
|
807
|
-
};
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
// src/model/MCard.ts
|
|
811
|
-
var MCard = class _MCard {
|
|
812
|
-
content;
|
|
813
|
-
hash;
|
|
814
|
-
g_time;
|
|
815
|
-
contentType;
|
|
816
|
-
// Defaulting to specific string or null
|
|
817
|
-
hashFunction;
|
|
818
|
-
constructor(content, hash, g_time, contentType, hashFunction) {
|
|
819
|
-
this.content = content;
|
|
820
|
-
this.hash = hash;
|
|
821
|
-
this.g_time = g_time;
|
|
822
|
-
this.contentType = contentType;
|
|
823
|
-
this.hashFunction = hashFunction;
|
|
824
|
-
}
|
|
825
|
-
/**
|
|
826
|
-
* Create a new MCard from content
|
|
827
|
-
*/
|
|
828
|
-
static async create(content, hashAlgorithm = "sha256") {
|
|
829
|
-
if (content === null || content === void 0) {
|
|
830
|
-
throw new Error("Content cannot be null or undefined");
|
|
831
|
-
}
|
|
832
|
-
const bytes = typeof content === "string" ? new TextEncoder().encode(content) : content;
|
|
833
|
-
if (bytes.length === 0) {
|
|
834
|
-
throw new Error("Content cannot be empty");
|
|
835
|
-
}
|
|
836
|
-
const hash = await HashValidator.computeHash(bytes, hashAlgorithm);
|
|
837
|
-
const g_time = GTime.stampNow(hashAlgorithm);
|
|
838
|
-
const contentType = ContentTypeInterpreter.detect(bytes);
|
|
839
|
-
return new _MCard(bytes, hash, g_time, contentType, hashAlgorithm);
|
|
840
|
-
}
|
|
841
|
-
/**
|
|
842
|
-
* Create an MCard from existing data (e.g., from database)
|
|
843
|
-
*/
|
|
844
|
-
static fromData(content, hash, g_time) {
|
|
845
|
-
const alg = GTime.getHashAlgorithm(g_time);
|
|
846
|
-
const contentType = ContentTypeInterpreter.detect(content);
|
|
847
|
-
return new _MCard(content, hash, g_time, contentType, alg);
|
|
848
|
-
}
|
|
849
|
-
/**
|
|
850
|
-
* Get content as text (UTF-8 decoded)
|
|
851
|
-
*/
|
|
852
|
-
getContentAsText() {
|
|
853
|
-
return new TextDecoder().decode(this.content);
|
|
854
|
-
}
|
|
855
|
-
/**
|
|
856
|
-
* Get content as raw bytes
|
|
857
|
-
*/
|
|
858
|
-
getContent() {
|
|
859
|
-
return this.content;
|
|
860
|
-
}
|
|
861
|
-
/**
|
|
862
|
-
* Convert to plain object
|
|
863
|
-
*/
|
|
864
|
-
toObject() {
|
|
865
|
-
return {
|
|
866
|
-
hash: this.hash,
|
|
867
|
-
content: this.getContentAsText(),
|
|
868
|
-
g_time: this.g_time,
|
|
869
|
-
contentType: this.contentType,
|
|
870
|
-
hashFunction: this.hashFunction
|
|
871
|
-
};
|
|
872
|
-
}
|
|
873
|
-
/**
|
|
874
|
-
* Get DOTS vocabulary metadata for this MCard
|
|
875
|
-
*
|
|
876
|
-
* Returns the DOTS role information that positions this MCard
|
|
877
|
-
* in the Double Operadic Theory of Systems framework.
|
|
878
|
-
*
|
|
879
|
-
* MCard is always a CARRIER object in the Data Plane.
|
|
880
|
-
*
|
|
881
|
-
* @param tightRefs - Optional array of prerequisite MCard hashes (vertical composition)
|
|
882
|
-
* @param looseRefs - Optional array of alternative MCard hashes (horizontal composition)
|
|
883
|
-
* @returns DOTSMetadata describing this card's role in the compositional system
|
|
884
|
-
*
|
|
885
|
-
* @example
|
|
886
|
-
* ```typescript
|
|
887
|
-
* const card = await MCard.create('Hello World');
|
|
888
|
-
* const meta = card.getDOTSMetadata();
|
|
889
|
-
* console.log(meta.role); // 'Carrier'
|
|
890
|
-
* console.log(meta.plane); // 'Data'
|
|
891
|
-
* ```
|
|
892
|
-
*/
|
|
893
|
-
getDOTSMetadata(tightRefs = [], looseRefs = []) {
|
|
894
|
-
return createMCardDOTSMetadata(tightRefs, looseRefs);
|
|
895
|
-
}
|
|
896
|
-
};
|
|
897
|
-
|
|
898
|
-
export {
|
|
899
|
-
ContentTypeInterpreter,
|
|
900
|
-
createPCardDOTSMetadata,
|
|
901
|
-
createVCardDOTSMetadata,
|
|
902
|
-
MCard
|
|
903
|
-
};
|