@delali/narsil 0.3.1-next.153 → 0.3.1-next.154
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/adapters/filesystem.mjs +2 -2
- package/dist/adapters/gcs.mjs +2 -2
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/s3.mjs +2 -2
- package/dist/{analysis-change-2OYM7ARW.mjs → analysis-change-4GCRVRBW.mjs} +27 -18
- package/dist/{react-native/chunks/analysis-change-entry-CXNRW324.mjs → analysis-change-entry-KYGSXW4K.mjs} +1 -1
- package/dist/browser/{analysis-change-2V2HZ2NY.mjs → analysis-change-IXWPXXJJ.mjs} +17 -7
- package/dist/{analysis-change-entry-QD7YNDEE.mjs → browser/analysis-change-entry-FCSHFQSS.mjs} +1 -1
- package/dist/browser/{chunk-TQ5UMFG5.mjs → chunk-2FX6ROWR.mjs} +15 -6
- package/dist/browser/{chunk-KWYQ6KX4.mjs → chunk-2SHAKW2Z.mjs} +119 -1922
- package/dist/browser/{chunk-55WYRLDZ.mjs → chunk-3U3QR5YP.mjs} +2 -2
- package/dist/browser/chunk-4PD752F6.mjs +85 -0
- package/dist/browser/chunk-5W3MMTLG.mjs +19 -0
- package/dist/browser/{chunk-IAXZAVYL.mjs → chunk-7MEYN7V6.mjs} +1 -151
- package/dist/browser/chunk-7TTWXUH6.mjs +1828 -0
- package/dist/browser/{chunk-CSCKZBVJ.mjs → chunk-AJ4HHOVT.mjs} +4 -4
- package/dist/{react-native/chunks/chunk-DFQJ4IJB.mjs → browser/chunk-AYY6PIKL.mjs} +2 -2
- package/dist/browser/{chunk-VD7JEUIR.mjs → chunk-C4KS2QNF.mjs} +9 -8
- package/dist/browser/chunk-DSXIBE6N.mjs +78 -0
- package/dist/browser/chunk-ELV4OZOI.mjs +29 -0
- package/dist/browser/{chunk-PM4MUM5N.mjs → chunk-EUNBNLKM.mjs} +6 -5
- package/dist/browser/{chunk-GJKXW3SF.mjs → chunk-G7LUMBSG.mjs} +137 -253
- package/dist/browser/{chunk-B3JM6Z74.mjs → chunk-H6QFBMVE.mjs} +3 -2
- package/dist/browser/chunk-J433A7P3.mjs +241 -0
- package/dist/browser/chunk-ML6HY7T7.mjs +96 -0
- package/dist/browser/chunk-ML7THVLJ.mjs +38 -0
- package/dist/{chunk-MDF6PDIA.mjs → browser/chunk-MYITLCHT.mjs} +7 -1
- package/dist/browser/{chunk-QJCO3TJU.mjs → chunk-QXTPSX2H.mjs} +9 -150
- package/dist/browser/{chunk-MPK76GVS.mjs → chunk-RA6LSBCM.mjs} +1 -21
- package/dist/browser/{chunk-7ZJTRUVW.mjs → chunk-SIR3LMTV.mjs} +2 -2
- package/dist/browser/{chunk-LURXVCHG.mjs → chunk-SJB6VIZG.mjs} +1 -1
- package/dist/browser/chunk-TTD27VXX.mjs +298 -0
- package/dist/browser/chunk-U2E3HMYW.mjs +151 -0
- package/dist/browser/{chunk-2A2IPRC3.mjs → chunk-VCOYGVP7.mjs} +5 -31
- package/dist/browser/chunk-VI7BQR4U.mjs +21 -0
- package/dist/browser/chunk-W5X2UFWQ.mjs +102 -0
- package/dist/browser/{chunk-HT7J73QL.mjs → chunk-XRV72TJD.mjs} +2 -2
- package/dist/browser/chunk-YJHGOJAC.mjs +15 -0
- package/dist/browser/chunk-ZI2V4VD7.mjs +21 -0
- package/dist/{react-native/chunks/chunk-QC4ZRBSX.mjs → browser/chunk-ZPTA75ZC.mjs} +2 -79
- package/dist/browser/{cold-module-YECAK4MN.mjs → cold-module-VTUGDYNY.mjs} +20 -14
- package/dist/browser/{durability-wiring-LM7WFL6X.mjs → durability-wiring-GL4A7KDV.mjs} +1886 -1364
- package/dist/browser/import-YI5GNB4H.mjs +17 -0
- package/dist/browser/methods-LMUTS7OI.mjs +30 -0
- package/dist/browser/{module-XQLEOYNM.mjs → module-EC3FYW7N.mjs} +9 -8
- package/dist/browser/{module-KAMRAJLE.mjs → module-M4JNBV6V.mjs} +16 -10
- package/dist/browser/operations-WVYLF72Q.mjs +5 -0
- package/dist/browser/{phrase-module-CNKMUY4U.mjs → phrase-module-NPYUVX75.mjs} +1 -1
- package/dist/browser/{pool-DTYSPBMQ.mjs → pool-WCGDZHJP.mjs} +3 -2
- package/dist/{restore-queue-AOF5OTQV.mjs → browser/restore-queue-TYIGDL5L.mjs} +2 -2
- package/dist/browser/retention-6QMRS5VK.mjs +207 -0
- package/dist/browser/{runtime-D2ULZGCN.mjs → runtime-3EW2AGB6.mjs} +1 -1
- package/dist/browser/{snapshot-UGZVMP4H.mjs → snapshot-DN3CRVUQ.mjs} +38 -307
- package/dist/browser/sync-state-P5XG6LTQ.mjs +15 -0
- package/dist/browser/{write-I5P5MW4O.mjs → write-WAWAFGKQ.mjs} +16 -11
- package/dist/{capabilities-BT-HLDC8.d.ts → capabilities-B3Brs1Rc.d.ts} +62 -7
- package/dist/{chunk-DGRM4EZZ.mjs → chunk-37IVJLP6.mjs} +1 -1
- package/dist/{chunk-KYVRZAYP.mjs → chunk-3A5KI24C.mjs} +2 -69
- package/dist/{chunk-POUYICOU.mjs → chunk-3OFU3NJT.mjs} +1 -1
- package/dist/{chunk-3TVDTACC.mjs → chunk-3Y3J4V2R.mjs} +1 -1
- package/dist/{chunk-FNBNZCGP.mjs → chunk-466PYR4P.mjs} +2 -2
- package/dist/{chunk-SEAJS664.mjs → chunk-4HWZV5MK.mjs} +5 -5
- package/dist/{chunk-UGVUW27S.mjs → chunk-5FUOVJKG.mjs} +13 -9
- package/dist/{chunk-ZHAXP7SD.mjs → chunk-5KGYQT6W.mjs} +6 -235
- package/dist/{chunk-NPXVQS33.mjs → chunk-62G63NMH.mjs} +4 -3
- package/dist/chunk-6MSZ543Y.mjs +32 -0
- package/dist/chunk-7GXJUJ24.mjs +49 -0
- package/dist/{chunk-3E4RRF5J.mjs → chunk-7HCZWC7B.mjs} +58 -8
- package/dist/{chunk-6RKSY3BX.mjs → chunk-7NTMUDC5.mjs} +5 -5
- package/dist/chunk-7QUGDVFC.mjs +101 -0
- package/dist/{chunk-G5KHSM6E.mjs → chunk-AO2FAYIZ.mjs} +1 -1
- package/dist/chunk-B7S6YEBP.mjs +102 -0
- package/dist/{chunk-AWNHDBKV.mjs → chunk-BPSKLCS7.mjs} +15 -7
- package/dist/chunk-BUMREPLU.mjs +15 -0
- package/dist/{chunk-T4CJDBBE.mjs → chunk-C6ASEFZI.mjs} +1 -1
- package/dist/{chunk-NITCPDFL.mjs → chunk-C73JLU4E.mjs} +2 -2
- package/dist/{chunk-NYSONUB7.mjs → chunk-CP5RRPJR.mjs} +1 -1
- package/dist/{chunk-TTCKT2RT.mjs → chunk-DMQPFLGI.mjs} +134 -11
- package/dist/{chunk-3SBJVQLL.mjs → chunk-DVWYODEB.mjs} +2 -2
- package/dist/chunk-ECX4SGX6.mjs +167 -0
- package/dist/chunk-GES7U2PM.mjs +68 -0
- package/dist/{chunk-NVTFQFUL.mjs → chunk-HVKXNBFL.mjs} +1 -1
- package/dist/chunk-HVYICDY3.mjs +214 -0
- package/dist/{chunk-3HV7M5OJ.mjs → chunk-HWEDFLB7.mjs} +9 -133
- package/dist/{chunk-52QQWEBS.mjs → chunk-IBNLW3AV.mjs} +21 -6
- package/dist/chunk-IJU7LL7D.mjs +242 -0
- package/dist/chunk-IPN7S4KX.mjs +130 -0
- package/dist/{chunk-5QMHMELB.mjs → chunk-IQ4R2I6N.mjs} +4 -1
- package/dist/chunk-JCLTESFN.mjs +96 -0
- package/dist/{chunk-J4BDAH2W.mjs → chunk-JFNKIBDT.mjs} +2 -2
- package/dist/{chunk-LDGGR7YT.mjs → chunk-K4B7OH65.mjs} +2 -2
- package/dist/{chunk-7TE2AJIH.mjs → chunk-K7KLL263.mjs} +13 -10
- package/dist/{chunk-CSHHU7PA.mjs → chunk-KCUIFVVW.mjs} +11 -30
- package/dist/{react-native/chunks/chunk-YH7W556M.mjs → chunk-KUZKUONM.mjs} +11 -2
- package/dist/chunk-KYYABCSW.mjs +72 -0
- package/dist/{chunk-B2FTZNNF.mjs → chunk-LKUE5GXS.mjs} +34 -14
- package/dist/{chunk-2PNYKG2D.mjs → chunk-LSM2YTKM.mjs} +100 -335
- package/dist/{chunk-DMNPYF54.mjs → chunk-LTUGDMV4.mjs} +2 -2
- package/dist/{chunk-FDG4KXX5.mjs → chunk-MLHNSAPK.mjs} +5 -3
- package/dist/{chunk-VP6XRMWR.mjs → chunk-MMBEANB2.mjs} +6 -32
- package/dist/{chunk-LJ4ENXOD.mjs → chunk-MMEMEUOO.mjs} +2 -2
- package/dist/{chunk-2HJWQPR6.mjs → chunk-NTZOXVUZ.mjs} +6 -122
- package/dist/{chunk-5WB2A3XU.mjs → chunk-NZMAXR2S.mjs} +397 -24
- package/dist/{chunk-IZT3G24Q.mjs → chunk-O43Z4MS6.mjs} +2 -2
- package/dist/{chunk-U46IZNCW.mjs → chunk-OKX2BBNW.mjs} +3 -2
- package/dist/{chunk-RBEHLIKX.mjs → chunk-PFKM7VNZ.mjs} +14 -8
- package/dist/chunk-PGVPE7GJ.mjs +96 -0
- package/dist/chunk-Q3TCTQCC.mjs +85 -0
- package/dist/chunk-Q7MS6P2J.mjs +74 -0
- package/dist/chunk-QDZJM7NI.mjs +23 -0
- package/dist/{chunk-ZS6CMXAE.mjs → chunk-QKZHLADX.mjs} +89 -250
- package/dist/{chunk-IJSFWGVW.mjs → chunk-REL7LFLR.mjs} +3 -3
- package/dist/chunk-RVKFI3A2.mjs +237 -0
- package/dist/chunk-S2N75OTN.mjs +83 -0
- package/dist/chunk-TRISKD4Q.mjs +50 -0
- package/dist/{chunk-6F6USYII.mjs → chunk-TV2L3BN7.mjs} +13 -11
- package/dist/{chunk-6BWLDLS3.mjs → chunk-URPCYQVJ.mjs} +1 -1
- package/dist/chunk-USR7FQRZ.mjs +34 -0
- package/dist/chunk-V6EUBAIT.mjs +19 -0
- package/dist/{chunk-SOUZMPME.mjs → chunk-VMXSVVXG.mjs} +7 -194
- package/dist/{chunk-4QCSHLNM.mjs → chunk-VREK3MYG.mjs} +3 -3
- package/dist/{chunk-YGQOPB2Z.mjs → chunk-WCBA2LVZ.mjs} +1 -1
- package/dist/{chunk-KQJVNPRM.mjs → chunk-X6NSJYQ3.mjs} +19 -16
- package/dist/chunk-Y4WPNHMC.mjs +50 -0
- package/dist/{chunk-IRWP524D.mjs → chunk-YBJDOA2T.mjs} +1 -1
- package/dist/{chunk-IJPK5PGM.mjs → chunk-YPUEV6ZC.mjs} +1 -1
- package/dist/{chunk-J7M73VY7.mjs → chunk-YROWNOMH.mjs} +1 -1
- package/dist/chunk-Z3TNWCI5.mjs +196 -0
- package/dist/{chunk-65WCV5JO.mjs → chunk-ZIFJXCKA.mjs} +1 -1
- package/dist/chunk-ZYAY26KG.mjs +29 -0
- package/dist/{client-Cn3gNxUU.d.ts → client-Df76GNKm.d.ts} +76 -6
- package/dist/client.d.ts +8 -7
- package/dist/client.mjs +56 -5
- package/dist/{cold-module-PYSSBIL7.mjs → cold-module-YLWMTTZG.mjs} +38 -28
- package/dist/{config-CfhH1IWQ.d.ts → config-05G_hy-1.d.ts} +3 -3
- package/dist/config-B8DP2VwR.d.ts +463 -0
- package/dist/{direct-executor-WYALQSMD.mjs → direct-executor-FI5GJHWX.mjs} +14 -9
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +1 -1
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +4 -4
- package/dist/distribution/transport/in-memory.mjs +2 -2
- package/dist/distribution/transport/tcp.mjs +3 -3
- package/dist/distribution.d.ts +41 -9
- package/dist/distribution.mjs +1296 -117
- package/dist/{durability-wiring-7VBZEJLG.mjs → durability-wiring-RHLXDIVF.mjs} +1751 -1226
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-CJRUHXgf.d.ts → engine-DYu-e0oR.d.ts} +50 -40
- package/dist/{import-GJOMB2HC.mjs → import-SRBNC6TE.mjs} +27 -19
- package/dist/{index-MsF7e5hL.d.ts → index-nRqDM6uS.d.ts} +1 -1
- package/dist/index.browser.mjs +8 -4
- package/dist/index.d.ts +7 -6
- package/dist/index.mjs +24 -16
- package/dist/index.react-native.mjs +17 -11
- package/dist/{long-query-thread-SCUE62TO.mjs → long-query-thread-EMYTGSJP.mjs} +28 -15
- package/dist/methods-ABM5ELBR.mjs +30 -0
- package/dist/{module-AVQEIB7O.mjs → module-3OMJZUFT.mjs} +12 -12
- package/dist/{module-6RLIKSZQ.mjs → module-MG7JMV2U.mjs} +33 -23
- package/dist/operations-PGOAY2KS.mjs +5 -0
- package/dist/{paged-partition-archive-KGRW366Y.mjs → paged-partition-archive-UOLHOEZJ.mjs} +37 -26
- package/dist/partial-words.mjs +6 -4
- package/dist/pattern.mjs +4 -3
- package/dist/persistence/durability/checkpoint-worker.d.ts +9 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +34 -23
- package/dist/{phrase-module-OUQIRUQU.mjs → phrase-module-O3MDRQXP.mjs} +1 -1
- package/dist/{pool-UPV5PVPY.mjs → pool-CQXYPFLG.mjs} +2 -2
- package/dist/react-native/chunks/{analysis-change-DXPZRGWF.mjs → analysis-change-EAYO3Y6Q.mjs} +27 -15
- package/dist/{browser/analysis-change-entry-JL5U2N3Q.mjs → react-native/chunks/analysis-change-entry-TNLUC6IZ.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-D7LFYPYI.mjs → chunk-2CGSQM4O.mjs} +12 -10
- package/dist/react-native/chunks/chunk-3NQOVO3K.mjs +1 -0
- package/dist/react-native/chunks/{chunk-R4OPUZQ5.mjs → chunk-3O57C2ZO.mjs} +2 -2
- package/dist/react-native/chunks/chunk-3XKMRNRE.mjs +298 -0
- package/dist/react-native/chunks/{chunk-IDFMNRIC.mjs → chunk-63YSZOXB.mjs} +97 -333
- package/dist/react-native/chunks/{chunk-UFNCLEQM.mjs → chunk-75VWIY35.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-2J2727V4.mjs → chunk-7GWPJDOA.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-PU55IOG4.mjs → chunk-AUT7PMA4.mjs} +6 -190
- package/dist/react-native/chunks/chunk-C2H2QQFW.mjs +288 -0
- package/dist/react-native/chunks/chunk-CHPTFFJM.mjs +43 -0
- package/dist/{browser/chunk-PIS7ZAP7.mjs → react-native/chunks/chunk-CUNGPR5R.mjs} +11 -2
- package/dist/{browser/chunk-NVEJJP4R.mjs → react-native/chunks/chunk-DCKMICOB.mjs} +2 -79
- package/dist/react-native/chunks/chunk-DH3TVWWK.mjs +102 -0
- package/dist/react-native/chunks/{chunk-ZCKNBPQ4.mjs → chunk-EH5CFV6Z.mjs} +2 -2
- package/dist/react-native/chunks/chunk-F753DA54.mjs +23 -0
- package/dist/{browser/chunk-VBX2TI5V.mjs → react-native/chunks/chunk-GFYFQLJD.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-7IQR3SZO.mjs → chunk-I5PGWQJF.mjs} +142 -257
- package/dist/react-native/chunks/{chunk-NFGBOI46.mjs → chunk-IOY2SM2P.mjs} +1 -1
- package/dist/react-native/chunks/chunk-JDOEEMEF.mjs +38 -0
- package/dist/react-native/chunks/{chunk-TLYD7IJ2.mjs → chunk-JPAJWO6D.mjs} +1 -1
- package/dist/react-native/chunks/chunk-JWUCMVRK.mjs +15 -0
- package/dist/react-native/chunks/{chunk-KLZGAOLT.mjs → chunk-JX2RIAXH.mjs} +4 -4
- package/dist/react-native/chunks/chunk-LU3Y3P63.mjs +68 -0
- package/dist/react-native/chunks/{chunk-LQAKO5QV.mjs → chunk-NCJS3WIY.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-BRNAVOKP.mjs → chunk-NKIZX26F.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-CLE3LZ77.mjs → chunk-NP7DD4G5.mjs} +5 -4
- package/dist/react-native/chunks/chunk-NVVRSRX5.mjs +78 -0
- package/dist/react-native/chunks/chunk-O32RB3BL.mjs +191 -0
- package/dist/react-native/chunks/{chunk-DKJTZ625.mjs → chunk-OQQVRWZ2.mjs} +2 -69
- package/dist/react-native/chunks/chunk-PB2YXVQW.mjs +29 -0
- package/dist/react-native/chunks/chunk-Q32DDFKX.mjs +19 -0
- package/dist/react-native/chunks/{chunk-LRGWK367.mjs → chunk-RVAEBN74.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-KOCTCUXW.mjs → chunk-RYMDHGL4.mjs} +16 -8
- package/dist/react-native/chunks/chunk-SJWDBRNP.mjs +85 -0
- package/dist/react-native/chunks/chunk-UNUFZ2QY.mjs +68 -0
- package/dist/react-native/chunks/chunk-UWDNZDWK.mjs +242 -0
- package/dist/react-native/chunks/{chunk-FS7BYE23.mjs → chunk-VQSKZ3EZ.mjs} +9 -152
- package/dist/react-native/chunks/{chunk-UCJU6WNH.mjs → chunk-VVFYOADG.mjs} +7 -6
- package/dist/react-native/chunks/{chunk-VGUWIZFQ.mjs → chunk-YBEW6YTR.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-JYL35A4A.mjs → chunk-YHKZSLOC.mjs} +7 -33
- package/dist/react-native/chunks/{chunk-3CTWSQRW.mjs → chunk-ZBSWRSBG.mjs} +4 -30
- package/dist/react-native/chunks/chunk-ZYDKJXQJ.mjs +96 -0
- package/dist/react-native/chunks/{cold-module-KFGEWYEL.mjs → cold-module-TJL6AFAD.mjs} +29 -21
- package/dist/react-native/chunks/{durability-wiring-QKJB2QBT.mjs → durability-wiring-RRDYJLLM.mjs} +1882 -1358
- package/dist/react-native/chunks/gzip.react-native-DNB5YNFA.mjs +3 -0
- package/dist/react-native/chunks/import-JYBMEJPQ.mjs +29 -0
- package/dist/react-native/chunks/methods-X6F36SJE.mjs +30 -0
- package/dist/react-native/chunks/module-QT5HZAY4.mjs +33 -0
- package/dist/react-native/chunks/{module-UJ5VUARS.mjs → module-S4DKSWMF.mjs} +10 -9
- package/dist/react-native/chunks/operations-RYKTSZQA.mjs +5 -0
- package/dist/react-native/chunks/{phrase-module-76UAPPSG.mjs → phrase-module-JZ37TB7N.mjs} +1 -1
- package/dist/react-native/chunks/{pool-CD4ANYUI.mjs → pool-RTGXJXPU.mjs} +3 -2
- package/dist/{browser/restore-queue-UQ6AAUVX.mjs → react-native/chunks/restore-queue-ZBVIKJWI.mjs} +2 -2
- package/dist/react-native/chunks/retention-PPCTP2VY.mjs +219 -0
- package/dist/react-native/chunks/{runtime-3MCDLJAF.mjs → runtime-KUATOLYB.mjs} +1 -1
- package/dist/react-native/chunks/{snapshot-KVBD4LRC.mjs → snapshot-ZBIEOZTZ.mjs} +47 -314
- package/dist/react-native/chunks/sync-state-PASCIHHT.mjs +15 -0
- package/dist/react-native/chunks/{write-ES5A3WUA.mjs → write-2W4FTX7J.mjs} +25 -18
- package/dist/react-native/partial-words.mjs +6 -4
- package/dist/react-native/pattern.mjs +4 -3
- package/dist/react-native/sync.mjs +2236 -0
- package/dist/react-native/synonyms.mjs +7 -4
- package/dist/react.d.ts +10 -9
- package/dist/react.mjs +7 -1
- package/dist/{rerank-3W54N6P2.mjs → rerank-IZOB6NII.mjs} +4 -4
- package/dist/rerankers/http.mjs +2 -2
- package/dist/{react-native/chunks/restore-queue-H5VCN453.mjs → restore-queue-COI2GSSK.mjs} +2 -2
- package/dist/retention-55WA7GPU.mjs +58 -0
- package/dist/{runtime-L2DZYY6N.mjs → runtime-UZOC3NPY.mjs} +5 -5
- package/dist/{schema-D33CyXCy.d.ts → schema-DDauvDOv.d.ts} +1 -1
- package/dist/server.d.ts +22 -19
- package/dist/server.mjs +868 -50
- package/dist/{snapshot-WMX6JCLP.mjs → snapshot-NFX2EYN2.mjs} +62 -36
- package/dist/sync/filesystem.d.ts +30 -0
- package/dist/sync/filesystem.mjs +271 -0
- package/dist/sync/indexeddb.d.ts +30 -0
- package/dist/sync/indexeddb.mjs +237 -0
- package/dist/sync-state-ZWHLAFLE.mjs +15 -0
- package/dist/{config-aIsy7mcL.d.ts → sync-uXR7MmM7.d.ts} +53 -444
- package/dist/sync.browser.mjs +2231 -0
- package/dist/sync.d.ts +23 -0
- package/dist/sync.mjs +2206 -0
- package/dist/synonyms.mjs +5 -3
- package/dist/{tasks-C4ElXr4P.d.ts → tasks-BShx8pdK.d.ts} +4 -4
- package/dist/thread-P2G2FWM2.mjs +44 -0
- package/dist/types-SnO7_tAI.d.ts +228 -0
- package/dist/vector/search-worker.d.ts +1 -1
- package/dist/vector/search-worker.mjs +6 -6
- package/dist/workers/entry.mjs +7 -7
- package/dist/{write-SKJ6HW7O.mjs → write-FGB62BHQ.mjs} +31 -23
- package/openapi.json +119 -3
- package/package.json +28 -8
- package/dist/browser/import-QOY6ZH6X.mjs +0 -12
- package/dist/chunk-7LDMWKP6.mjs +0 -209
- package/dist/react-native/chunks/chunk-L4M7QJNP.mjs +0 -110
- package/dist/react-native/chunks/gzip.react-native-7JWCLVOB.mjs +0 -3
- package/dist/react-native/chunks/import-XFBCCENV.mjs +0 -22
- package/dist/react-native/chunks/module-FHJ2GOBI.mjs +0 -25
- package/dist/thread-I7DVHHW7.mjs +0 -31
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { compareCodePoints } from './chunk-PPEPTUVV.mjs';
|
|
2
2
|
import { LOOKUP_KEY_SCRATCH_BYTES } from './chunk-JV6VQY2S.mjs';
|
|
3
|
-
import { createNarsilError, ErrorCodes } from './chunk-
|
|
3
|
+
import { createNarsilError, ErrorCodes } from './chunk-CUNGPR5R.mjs';
|
|
4
4
|
|
|
5
5
|
// src/core/tokenizer/constants.ts
|
|
6
6
|
var TOKEN_CACHE_SIZE_FLOOR = 5e4;
|
|
@@ -1,161 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { visitTokens, visitSurfaceSpellings } from './chunk-7GWPJDOA.mjs';
|
|
2
|
+
import { flattenSchema, encodeDocument } from './chunk-O32RB3BL.mjs';
|
|
3
|
+
import { EARLIER_RELEASE_MIN_M, MIN_M, MAX_M } from './chunk-TJMSKBEM.mjs';
|
|
4
|
+
import { DEFAULT_PATTERN_VALUE_LIMIT, isPlainObject, MAX_DOCUMENT_BYTES, isWordIndexedBase, MAX_DOCUMENT_NESTING_DEPTH, VECTOR_PATTERN, parseFieldType } from './chunk-OQQVRWZ2.mjs';
|
|
4
5
|
import { compareCodePoints, holdsUnpairedSurrogate, exceedsCodePoints } from './chunk-PPEPTUVV.mjs';
|
|
5
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
6
|
-
import { Encoder } from '@msgpack/msgpack';
|
|
7
|
-
|
|
8
|
-
// src/schema/validator/schema.ts
|
|
9
|
-
function validateSchemaFields(schema, depth, prefix) {
|
|
10
|
-
if (depth > MAX_NESTING_DEPTH) {
|
|
11
|
-
throw new NarsilError(
|
|
12
|
-
ErrorCodes.SCHEMA_DEPTH_EXCEEDED,
|
|
13
|
-
`Schema nesting exceeds the maximum depth of ${MAX_NESTING_DEPTH} at "${prefix}"`,
|
|
14
|
-
{ path: prefix, maxDepth: MAX_NESTING_DEPTH }
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
let canonical = null;
|
|
18
|
-
const replace = (field, value) => {
|
|
19
|
-
if (canonical === null) canonical = { ...schema };
|
|
20
|
-
canonical[field] = value;
|
|
21
|
-
};
|
|
22
|
-
for (const [field, type] of Object.entries(schema)) {
|
|
23
|
-
const path = prefix ? `${prefix}.${field}` : field;
|
|
24
|
-
if (PROTOTYPE_POLLUTION_KEYS.has(field)) {
|
|
25
|
-
throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, `Field name "${field}" is not allowed in a schema`, {
|
|
26
|
-
field,
|
|
27
|
-
path
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
if (!FIELD_NAME_PATTERN.test(field)) {
|
|
31
|
-
throw new NarsilError(
|
|
32
|
-
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
33
|
-
`Field name "${field}" contains characters that are not allowed; use letters, digits, and underscores only`,
|
|
34
|
-
{ field, path }
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
if (depth === 1 && RESERVED_ROOT_FIELDS.has(field)) {
|
|
38
|
-
throw new NarsilError(
|
|
39
|
-
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
40
|
-
`Field "${field}" is reserved and cannot be defined in a schema`,
|
|
41
|
-
{ field, path }
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
if (isPlainObject(type)) {
|
|
45
|
-
const nested = validateSchemaFields(type, depth + 1, path);
|
|
46
|
-
if (nested !== type) replace(field, nested);
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
if (typeof type !== "string") {
|
|
50
|
-
throw new NarsilError(
|
|
51
|
-
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
52
|
-
`Field "${path}" has an invalid type definition: ${String(type)}`,
|
|
53
|
-
{
|
|
54
|
-
field: path,
|
|
55
|
-
type: String(type)
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
const parsed = parseFieldType(type, path);
|
|
60
|
-
if (parsed.type !== type) replace(field, parsed.type);
|
|
61
|
-
}
|
|
62
|
-
return canonical ?? schema;
|
|
63
|
-
}
|
|
64
|
-
function validateSchema(schema) {
|
|
65
|
-
if (!isPlainObject(schema)) {
|
|
66
|
-
throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, "Schema must be a plain object", {
|
|
67
|
-
received: typeof schema
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
if (Object.keys(schema).length === 0) {
|
|
71
|
-
throw new NarsilError(ErrorCodes.SCHEMA_INVALID_TYPE, "Schema must define at least one field");
|
|
72
|
-
}
|
|
73
|
-
const validated = validateSchemaFields(schema, 1, "");
|
|
74
|
-
requireTextFieldCount(schemaFieldsOf(validated).filter((field) => isWordIndexedBase(field.base)).length);
|
|
75
|
-
return validated;
|
|
76
|
-
}
|
|
77
|
-
function requireTextFieldCount(count) {
|
|
78
|
-
if (count <= MAX_TEXT_FIELDS) return;
|
|
79
|
-
throw new NarsilError(
|
|
80
|
-
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
81
|
-
`The schema declares ${count} string and string[] fields, but a schema holds at most ${MAX_TEXT_FIELDS}`,
|
|
82
|
-
{ textFields: count, maximum: MAX_TEXT_FIELDS }
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
function requireCreatableSchema(schema) {
|
|
86
|
-
for (const field of schemaFieldsOf(schema)) {
|
|
87
|
-
if (field.base !== "vector" || field.dimension <= MAX_VECTOR_DIMENSION) continue;
|
|
88
|
-
throw new NarsilError(
|
|
89
|
-
ErrorCodes.SCHEMA_INVALID_VECTOR_DIMENSION,
|
|
90
|
-
`Vector field "${field.path}" has ${field.dimension} dimensions, but a new index takes at most ${MAX_VECTOR_DIMENSION}`,
|
|
91
|
-
{ field: field.path, dimension: field.dimension, maximum: MAX_VECTOR_DIMENSION }
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function requireValidFieldTypes(flatSchema) {
|
|
96
|
-
let textFields = 0;
|
|
97
|
-
for (const [path, type] of Object.entries(flatSchema)) {
|
|
98
|
-
if (typeof type !== "string") {
|
|
99
|
-
throw new NarsilError(
|
|
100
|
-
ErrorCodes.SCHEMA_INVALID_TYPE,
|
|
101
|
-
`Field "${path}" has an invalid type definition: ${String(type)}`,
|
|
102
|
-
{ field: path, type: String(type) }
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
if (isWordIndexedBase(parseFieldType(type, path).base)) textFields += 1;
|
|
106
|
-
}
|
|
107
|
-
requireTextFieldCount(textFields);
|
|
108
|
-
}
|
|
109
|
-
function flattenRecursive(schema, prefix, result) {
|
|
110
|
-
for (const [field, type] of Object.entries(schema)) {
|
|
111
|
-
const path = prefix ? `${prefix}.${field}` : field;
|
|
112
|
-
if (isPlainObject(type)) {
|
|
113
|
-
flattenRecursive(type, path, result);
|
|
114
|
-
} else {
|
|
115
|
-
result[path] = type;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
var flattenedSchemas = /* @__PURE__ */ new WeakMap();
|
|
120
|
-
function flattenSchema(schema) {
|
|
121
|
-
const cached = flattenedSchemas.get(schema);
|
|
122
|
-
if (cached !== void 0) return cached;
|
|
123
|
-
const result = /* @__PURE__ */ Object.create(null);
|
|
124
|
-
flattenRecursive(schema, "", result);
|
|
125
|
-
flattenedSchemas.set(schema, Object.freeze(result));
|
|
126
|
-
return result;
|
|
127
|
-
}
|
|
128
|
-
var parsedSchemas = /* @__PURE__ */ new WeakMap();
|
|
129
|
-
function schemaFieldsOf(schema) {
|
|
130
|
-
const cached = parsedSchemas.get(schema);
|
|
131
|
-
if (cached !== void 0) return cached;
|
|
132
|
-
const fields = [];
|
|
133
|
-
for (const [path, type] of Object.entries(flattenSchema(schema))) {
|
|
134
|
-
fields.push({ ...parseFieldType(type, path), path });
|
|
135
|
-
}
|
|
136
|
-
const frozen = Object.freeze(fields);
|
|
137
|
-
parsedSchemas.set(schema, frozen);
|
|
138
|
-
return frozen;
|
|
139
|
-
}
|
|
140
|
-
var partialFieldsBySchema = /* @__PURE__ */ new WeakMap();
|
|
141
|
-
function partialFieldsOf(schema) {
|
|
142
|
-
const cached = partialFieldsBySchema.get(schema);
|
|
143
|
-
if (cached !== void 0) return cached;
|
|
144
|
-
const paths = [];
|
|
145
|
-
for (const field of schemaFieldsOf(schema)) {
|
|
146
|
-
if (field.partial) paths.push(field.path);
|
|
147
|
-
}
|
|
148
|
-
const frozen = Object.freeze(paths.sort(compareCodePoints));
|
|
149
|
-
partialFieldsBySchema.set(schema, frozen);
|
|
150
|
-
return frozen;
|
|
151
|
-
}
|
|
152
|
-
function extractVectorFieldsFromSchema(schema) {
|
|
153
|
-
const result = /* @__PURE__ */ new Map();
|
|
154
|
-
for (const field of schemaFieldsOf(schema)) {
|
|
155
|
-
if (field.base === "vector") result.set(field.path, field.dimension);
|
|
156
|
-
}
|
|
157
|
-
return result;
|
|
158
|
-
}
|
|
6
|
+
import { NarsilError, ErrorCodes } from './chunk-CUNGPR5R.mjs';
|
|
159
7
|
|
|
160
8
|
// src/geo/constants.ts
|
|
161
9
|
var DEG_TO_RAD = Math.PI / 180;
|
|
@@ -542,38 +390,6 @@ function validateRequiredFields(document, required) {
|
|
|
542
390
|
}
|
|
543
391
|
}
|
|
544
392
|
}
|
|
545
|
-
var INTEGER_ENCODING = { maxDepth: MAX_DOCUMENT_ENCODING_DEPTH };
|
|
546
|
-
var FLOAT_ENCODING = { maxDepth: MAX_DOCUMENT_ENCODING_DEPTH, forceIntegerToFloat: true };
|
|
547
|
-
var integerEncoder = new Encoder(INTEGER_ENCODING);
|
|
548
|
-
var floatEncoder = new Encoder(FLOAT_ENCODING);
|
|
549
|
-
function encodeExactly(document, forceIntegerToFloat) {
|
|
550
|
-
const bytes = (forceIntegerToFloat ? floatEncoder : integerEncoder).encode(document);
|
|
551
|
-
if (bytes.byteLength > DOCUMENT_ENCODER_RETAINED_BUFFER_BYTES) {
|
|
552
|
-
if (forceIntegerToFloat) floatEncoder = new Encoder(FLOAT_ENCODING);
|
|
553
|
-
else integerEncoder = new Encoder(INTEGER_ENCODING);
|
|
554
|
-
}
|
|
555
|
-
return bytes;
|
|
556
|
-
}
|
|
557
|
-
function holdsNegativeZero(value, depth) {
|
|
558
|
-
if (typeof value === "number") return Object.is(value, -0);
|
|
559
|
-
if (value === null || typeof value !== "object" || ArrayBuffer.isView(value) || depth > MAX_DOCUMENT_ENCODING_DEPTH) {
|
|
560
|
-
return false;
|
|
561
|
-
}
|
|
562
|
-
for (const child of Array.isArray(value) ? value : Object.values(value)) {
|
|
563
|
-
if (holdsNegativeZero(child, depth + 1)) return true;
|
|
564
|
-
}
|
|
565
|
-
return false;
|
|
566
|
-
}
|
|
567
|
-
function encodeDocument(document) {
|
|
568
|
-
try {
|
|
569
|
-
return encodeExactly(document, holdsNegativeZero(document, 1));
|
|
570
|
-
} catch (error) {
|
|
571
|
-
throw new NarsilError(
|
|
572
|
-
ErrorCodes.DOC_VALIDATION_FAILED,
|
|
573
|
-
`The document cannot be encoded as MessagePack: ${error instanceof Error ? error.message : String(error)}`
|
|
574
|
-
);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
393
|
|
|
578
394
|
// src/schema/validator/document-size.ts
|
|
579
395
|
var LARGEST_HEADER_BYTES = 5;
|
|
@@ -907,4 +723,4 @@ function expandTermPrefix(subs, surfacePrefix, stemmedToken, maxExpansions) {
|
|
|
907
723
|
return ranked.map((entry) => entry.token);
|
|
908
724
|
}
|
|
909
725
|
|
|
910
|
-
export { ANTIMERIDIAN_SPAN_DEGREES, DEG_TO_RAD, EARTH_RADIUS_METERS, FROZEN_PARTIAL_REMOVED_ENTRY_BYTES, FULL_TURN_DEGREES, GROWING_PARTIAL_ENTRY_BYTES, GROWING_PARTIAL_PENDING_ENTRIES_PER_ENTRY, GROWING_PARTIAL_PENDING_ENTRY_BYTES, GROWING_PARTIAL_RUN_BYTES, GROWING_PARTIAL_RUN_MEMBER_BYTES, LOCATION_CODE_BITS_PER_AXIS, MAX_COVERING_CELLS, MAX_LATITUDE_DEGREES, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, PARTIAL_WORD_RUN_CODE_POINTS, RADIUS_BOX_MARGIN_RADIANS, RADIUS_BOX_MARGIN_RATIO, VINCENTY_CONVERGENCE_THRESHOLD, VINCENTY_MAX_ITERATIONS, codePointCountOf, countDocumentSpellings, countSpelling,
|
|
726
|
+
export { ANTIMERIDIAN_SPAN_DEGREES, DEG_TO_RAD, EARTH_RADIUS_METERS, FROZEN_PARTIAL_REMOVED_ENTRY_BYTES, FULL_TURN_DEGREES, GROWING_PARTIAL_ENTRY_BYTES, GROWING_PARTIAL_PENDING_ENTRIES_PER_ENTRY, GROWING_PARTIAL_PENDING_ENTRY_BYTES, GROWING_PARTIAL_RUN_BYTES, GROWING_PARTIAL_RUN_MEMBER_BYTES, LOCATION_CODE_BITS_PER_AXIS, MAX_COVERING_CELLS, MAX_LATITUDE_DEGREES, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, PARTIAL_WORD_RUN_CODE_POINTS, RADIUS_BOX_MARGIN_RADIANS, RADIUS_BOX_MARGIN_RATIO, VINCENTY_CONVERGENCE_THRESHOLD, VINCENTY_MAX_ITERATIONS, codePointCountOf, countDocumentSpellings, countSpelling, encodePartialSpellings, expandTermPrefix, getFlatSchema, getNestedValue, getOrCreateFieldNameIndex, isLatitude, isLongitude, isQuantizationMode, isStorageMode, messagePackUpperBoundBytes, parseVectorDimension, partitionDocumentFrequency, raiseEarlierReleaseGraphSetting, requireDocumentWithinSizeLimit, sameFields, spellingCountsOf, suggestDisplayTerms, textFieldsChanged, tokenizeOptions, validateDocument, validateDocumentStrict, validateRequiredFields, validateTextStorage, validateVectorPromotion, validateVectorStorage, visitDocumentSpellings, visitDocumentSurfaceSpellings };
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { MAX_FILE_BYTES, CHECKSUM_YIELD_CHUNK_BYTES } from './chunk-TJMSKBEM.mjs';
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-CUNGPR5R.mjs';
|
|
3
|
+
import { decode } from '@msgpack/msgpack';
|
|
4
|
+
|
|
5
|
+
// src/serialization/header.ts
|
|
6
|
+
var MAGIC_BYTES = new Uint8Array([78, 82, 83, 76]);
|
|
7
|
+
var HEADER_SIZE = 32;
|
|
8
|
+
var MAX_PAYLOAD_LENGTH = 4294967295;
|
|
9
|
+
var COMPRESSION_ALGORITHMS = {
|
|
10
|
+
0: "none",
|
|
11
|
+
1: "gzip",
|
|
12
|
+
2: "lz4",
|
|
13
|
+
3: "zstd"
|
|
14
|
+
};
|
|
15
|
+
var COMPRESSION_TO_BITS = {
|
|
16
|
+
none: 0,
|
|
17
|
+
gzip: 1,
|
|
18
|
+
lz4: 2,
|
|
19
|
+
zstd: 3
|
|
20
|
+
};
|
|
21
|
+
function encodeFlags(flags) {
|
|
22
|
+
let bits = 0;
|
|
23
|
+
if (flags.compressionEnabled) bits |= 1;
|
|
24
|
+
bits |= (COMPRESSION_TO_BITS[flags.compressionAlgorithm] & 3) << 1;
|
|
25
|
+
if (flags.checksumPresent) bits |= 1 << 3;
|
|
26
|
+
if (flags.encryptionEnabled) bits |= 1 << 4;
|
|
27
|
+
return bits;
|
|
28
|
+
}
|
|
29
|
+
function decodeFlags(value) {
|
|
30
|
+
const compressionEnabled = (value & 1) === 1;
|
|
31
|
+
const algorithmBits = value >> 1 & 3;
|
|
32
|
+
const checksumPresent = (value >> 3 & 1) === 1;
|
|
33
|
+
const encryptionEnabled = (value >> 4 & 1) === 1;
|
|
34
|
+
return {
|
|
35
|
+
compressionEnabled,
|
|
36
|
+
compressionAlgorithm: COMPRESSION_ALGORITHMS[algorithmBits] ?? "none",
|
|
37
|
+
checksumPresent,
|
|
38
|
+
encryptionEnabled
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function writeHeader(header) {
|
|
42
|
+
if (header.payloadLength > MAX_PAYLOAD_LENGTH) {
|
|
43
|
+
throw new NarsilError(
|
|
44
|
+
ErrorCodes.PERSISTENCE_SAVE_FAILED,
|
|
45
|
+
`A payload of ${header.payloadLength} bytes exceeds the ${MAX_PAYLOAD_LENGTH} bytes the envelope header can describe`,
|
|
46
|
+
{ payloadLength: header.payloadLength, maxPayloadLength: MAX_PAYLOAD_LENGTH }
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
const buffer = new Uint8Array(HEADER_SIZE);
|
|
50
|
+
const view = new DataView(buffer.buffer);
|
|
51
|
+
buffer.set(MAGIC_BYTES, 0);
|
|
52
|
+
buffer[4] = header.envelopeFormatVersion & 255;
|
|
53
|
+
buffer[5] = header.engineVersionMajor & 255;
|
|
54
|
+
buffer[6] = header.engineVersionMinor & 255;
|
|
55
|
+
buffer[7] = header.engineVersionPatch & 255;
|
|
56
|
+
view.setUint32(8, header.payloadLength, false);
|
|
57
|
+
view.setUint16(12, encodeFlags(header.flags), false);
|
|
58
|
+
view.setUint32(14, header.checksum, false);
|
|
59
|
+
for (let i = 18; i < HEADER_SIZE; i++) {
|
|
60
|
+
buffer[i] = 0;
|
|
61
|
+
}
|
|
62
|
+
return buffer;
|
|
63
|
+
}
|
|
64
|
+
function hasNrslMagic(data) {
|
|
65
|
+
return data.length >= MAGIC_BYTES.length && data[0] === MAGIC_BYTES[0] && data[1] === MAGIC_BYTES[1] && data[2] === MAGIC_BYTES[2] && data[3] === MAGIC_BYTES[3];
|
|
66
|
+
}
|
|
67
|
+
function readHeader(data) {
|
|
68
|
+
if (data.length < HEADER_SIZE) {
|
|
69
|
+
throw new NarsilError(
|
|
70
|
+
ErrorCodes.ENVELOPE_INVALID_MAGIC,
|
|
71
|
+
`Expected at least ${HEADER_SIZE} bytes, received ${data.length}`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
if (data[0] !== MAGIC_BYTES[0] || data[1] !== MAGIC_BYTES[1] || data[2] !== MAGIC_BYTES[2] || data[3] !== MAGIC_BYTES[3]) {
|
|
75
|
+
throw new NarsilError(ErrorCodes.ENVELOPE_INVALID_MAGIC, "File does not begin with NRSL magic bytes");
|
|
76
|
+
}
|
|
77
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
78
|
+
const envelopeFormatVersion = data[4];
|
|
79
|
+
const engineVersionMajor = data[5];
|
|
80
|
+
const engineVersionMinor = data[6];
|
|
81
|
+
const engineVersionPatch = data[7];
|
|
82
|
+
const payloadLength = view.getUint32(8, false);
|
|
83
|
+
const flagBits = view.getUint16(12, false);
|
|
84
|
+
const checksum = view.getUint32(14, false);
|
|
85
|
+
const reserved = data.slice(18, HEADER_SIZE);
|
|
86
|
+
return {
|
|
87
|
+
magic: "NRSL",
|
|
88
|
+
envelopeFormatVersion,
|
|
89
|
+
engineVersionMajor,
|
|
90
|
+
engineVersionMinor,
|
|
91
|
+
engineVersionPatch,
|
|
92
|
+
payloadLength,
|
|
93
|
+
flags: decodeFlags(flagBits),
|
|
94
|
+
checksum,
|
|
95
|
+
reserved
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/serialization/crc32.ts
|
|
100
|
+
var IEEE_POLYNOMIAL = 3988292384;
|
|
101
|
+
var ALL_BITS = 4294967295;
|
|
102
|
+
var cachedTable = null;
|
|
103
|
+
function buildTable() {
|
|
104
|
+
const table = new Uint32Array(256);
|
|
105
|
+
for (let i = 0; i < 256; i++) {
|
|
106
|
+
let crc = i;
|
|
107
|
+
for (let bit = 0; bit < 8; bit++) {
|
|
108
|
+
crc = crc & 1 ? crc >>> 1 ^ IEEE_POLYNOMIAL : crc >>> 1;
|
|
109
|
+
}
|
|
110
|
+
table[i] = crc;
|
|
111
|
+
}
|
|
112
|
+
return table;
|
|
113
|
+
}
|
|
114
|
+
function getTable() {
|
|
115
|
+
if (cachedTable === null) {
|
|
116
|
+
cachedTable = buildTable();
|
|
117
|
+
}
|
|
118
|
+
return cachedTable;
|
|
119
|
+
}
|
|
120
|
+
function crc32(data) {
|
|
121
|
+
return crc32Final(crc32Update(crc32Init(), data));
|
|
122
|
+
}
|
|
123
|
+
function crc32Init() {
|
|
124
|
+
return ALL_BITS;
|
|
125
|
+
}
|
|
126
|
+
function crc32Update(state, data) {
|
|
127
|
+
const table = getTable();
|
|
128
|
+
let crc = state;
|
|
129
|
+
for (let i = 0; i < data.length; i++) {
|
|
130
|
+
crc = crc >>> 8 ^ table[(crc ^ data[i]) & 255];
|
|
131
|
+
}
|
|
132
|
+
return crc;
|
|
133
|
+
}
|
|
134
|
+
function crc32Final(state) {
|
|
135
|
+
return (state ^ ALL_BITS) >>> 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// src/serialization/chunk-checksum.ts
|
|
139
|
+
function yieldToEventLoop() {
|
|
140
|
+
if (typeof setImmediate === "function") {
|
|
141
|
+
return new Promise((resolve) => setImmediate(resolve));
|
|
142
|
+
}
|
|
143
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
144
|
+
}
|
|
145
|
+
async function advanceChecksum(start, payload) {
|
|
146
|
+
let state = start;
|
|
147
|
+
for (let offset = 0; offset < payload.length; offset += CHECKSUM_YIELD_CHUNK_BYTES) {
|
|
148
|
+
const end = Math.min(offset + CHECKSUM_YIELD_CHUNK_BYTES, payload.length);
|
|
149
|
+
state = crc32Update(state, payload.subarray(offset, end));
|
|
150
|
+
if (end < payload.length) {
|
|
151
|
+
await yieldToEventLoop();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return state;
|
|
155
|
+
}
|
|
156
|
+
async function checksumOfChunks(chunks) {
|
|
157
|
+
let state = crc32Init();
|
|
158
|
+
for (const chunk of chunks) state = await advanceChecksum(state, chunk);
|
|
159
|
+
return crc32Final(state);
|
|
160
|
+
}
|
|
161
|
+
function payloadByteLength(chunks) {
|
|
162
|
+
let total = 0;
|
|
163
|
+
for (const chunk of chunks) total += chunk.byteLength;
|
|
164
|
+
return total;
|
|
165
|
+
}
|
|
166
|
+
function requireWithinFileLimit(byteLength, what) {
|
|
167
|
+
if (byteLength <= MAX_FILE_BYTES) return;
|
|
168
|
+
throw new NarsilError(
|
|
169
|
+
ErrorCodes.PERSISTENCE_SAVE_FAILED,
|
|
170
|
+
`The ${what} would take ${byteLength} bytes, above the file size limit of ${MAX_FILE_BYTES}`,
|
|
171
|
+
{ bytes: byteLength, maximum: MAX_FILE_BYTES }
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
function packEnvelopeWithEngineVersion(payloadChunks, envelopeFormatVersion, what, checksum, engineVersion) {
|
|
175
|
+
const payloadLength = payloadByteLength(payloadChunks);
|
|
176
|
+
requireWithinFileLimit(HEADER_SIZE + payloadLength, what);
|
|
177
|
+
const [major, minor, patch] = engineVersion;
|
|
178
|
+
const header = writeHeader({
|
|
179
|
+
envelopeFormatVersion,
|
|
180
|
+
engineVersionMajor: major,
|
|
181
|
+
engineVersionMinor: minor,
|
|
182
|
+
engineVersionPatch: patch,
|
|
183
|
+
payloadLength,
|
|
184
|
+
flags: { compressionEnabled: false, compressionAlgorithm: "none", checksumPresent: true, encryptionEnabled: false },
|
|
185
|
+
checksum});
|
|
186
|
+
return { chunks: [header, ...payloadChunks], byteLength: HEADER_SIZE + payloadLength, checksum };
|
|
187
|
+
}
|
|
188
|
+
function loadFailed(message, details) {
|
|
189
|
+
throw new NarsilError(ErrorCodes.PERSISTENCE_LOAD_FAILED, message, details);
|
|
190
|
+
}
|
|
191
|
+
async function gunzipWithinLimit(compressed, what) {
|
|
192
|
+
const { gunzip } = await import('./gzip.react-native-DNB5YNFA.mjs');
|
|
193
|
+
try {
|
|
194
|
+
return await gunzip(compressed, MAX_FILE_BYTES);
|
|
195
|
+
} catch (error) {
|
|
196
|
+
if (error?.code === "EFBIG") {
|
|
197
|
+
loadFailed(`The ${what} inflates past the file size limit of ${MAX_FILE_BYTES} bytes`);
|
|
198
|
+
}
|
|
199
|
+
loadFailed(`The ${what} holds a gzip payload that fails to inflate`, {
|
|
200
|
+
cause: error instanceof Error ? error.message : String(error)
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
async function openChecksummedEnvelope(data, expected) {
|
|
205
|
+
const { envelopeFormatVersion, what } = expected;
|
|
206
|
+
const header = readHeader(data);
|
|
207
|
+
if (header.envelopeFormatVersion !== envelopeFormatVersion) {
|
|
208
|
+
throw new NarsilError(
|
|
209
|
+
ErrorCodes.ENVELOPE_VERSION_MISMATCH,
|
|
210
|
+
`The ${what} holds envelope format v${header.envelopeFormatVersion}, while this build reads it as v${envelopeFormatVersion}`,
|
|
211
|
+
{ version: header.envelopeFormatVersion, expected: envelopeFormatVersion }
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
if (header.flags.encryptionEnabled) {
|
|
215
|
+
throw new NarsilError(
|
|
216
|
+
ErrorCodes.ENVELOPE_VERSION_MISMATCH,
|
|
217
|
+
`The ${what} is encrypted, which this build cannot read`
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
if (header.flags.compressionEnabled && !expected.allowsCompression) {
|
|
221
|
+
loadFailed(`The ${what} is compressed, while its format stores it raw`);
|
|
222
|
+
}
|
|
223
|
+
if (header.flags.compressionEnabled && header.flags.compressionAlgorithm !== "gzip") {
|
|
224
|
+
throw new NarsilError(
|
|
225
|
+
ErrorCodes.ENVELOPE_VERSION_MISMATCH,
|
|
226
|
+
`The ${what} uses ${header.flags.compressionAlgorithm} compression, which this build cannot read`
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
if (!header.flags.checksumPresent) loadFailed(`The ${what} carries no checksum, while its format requires one`);
|
|
230
|
+
if (data.byteLength !== HEADER_SIZE + header.payloadLength) {
|
|
231
|
+
loadFailed(
|
|
232
|
+
`The ${what} holds ${data.byteLength} bytes where its header gives ${HEADER_SIZE + header.payloadLength}`,
|
|
233
|
+
{ bytes: data.byteLength, expected: HEADER_SIZE + header.payloadLength }
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
const payload = data.subarray(HEADER_SIZE);
|
|
237
|
+
const computed = await checksumOfChunks([payload]);
|
|
238
|
+
if (computed !== header.checksum) {
|
|
239
|
+
throw new NarsilError(
|
|
240
|
+
ErrorCodes.PERSISTENCE_CRC_MISMATCH,
|
|
241
|
+
`The checksum of the ${what} does not match its payload`,
|
|
242
|
+
{
|
|
243
|
+
expected: header.checksum,
|
|
244
|
+
computed
|
|
245
|
+
}
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
if (header.flags.compressionEnabled) return { header, payload: await gunzipWithinLimit(payload, what) };
|
|
249
|
+
return { header, payload };
|
|
250
|
+
}
|
|
251
|
+
var INDEX_CONFIGURATION_ENVELOPE_VERSION = 5;
|
|
252
|
+
function requireConfigurationShape(raw, what) {
|
|
253
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
|
|
254
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The ${what} does not hold an index configuration`);
|
|
255
|
+
}
|
|
256
|
+
const configuration = raw;
|
|
257
|
+
if (configuration.schema === null || typeof configuration.schema !== "object") {
|
|
258
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The ${what} holds no schema`);
|
|
259
|
+
}
|
|
260
|
+
if (typeof configuration.language !== "string" || configuration.language.length === 0) {
|
|
261
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The ${what} holds no language`);
|
|
262
|
+
}
|
|
263
|
+
return configuration;
|
|
264
|
+
}
|
|
265
|
+
async function decodeIndexConfiguration(bytes) {
|
|
266
|
+
const { payload } = await openChecksummedEnvelope(bytes, {
|
|
267
|
+
envelopeFormatVersion: INDEX_CONFIGURATION_ENVELOPE_VERSION,
|
|
268
|
+
what: "index configuration",
|
|
269
|
+
allowsCompression: true
|
|
270
|
+
});
|
|
271
|
+
let raw;
|
|
272
|
+
try {
|
|
273
|
+
raw = decode(payload);
|
|
274
|
+
} catch {
|
|
275
|
+
throw new NarsilError(ErrorCodes.PERSISTENCE_LOAD_FAILED, "The index configuration is not MessagePack");
|
|
276
|
+
}
|
|
277
|
+
return requireConfigurationShape(raw, "index configuration");
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// src/runtime/heap-statistics.browser.ts
|
|
281
|
+
function readHeapStatistics() {
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
function readOldGenerationStatistics() {
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export { HEADER_SIZE, INDEX_CONFIGURATION_ENVELOPE_VERSION, checksumOfChunks, crc32, crc32Final, crc32Init, crc32Update, decodeIndexConfiguration, hasNrslMagic, openChecksummedEnvelope, packEnvelopeWithEngineVersion, payloadByteLength, readHeader, readHeapStatistics, readOldGenerationStatistics, requireConfigurationShape, requireWithinFileLimit, writeHeader };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// src/core/hash.ts
|
|
2
|
+
var FNV_OFFSET_BASIS = 2166136261;
|
|
3
|
+
var FNV_PRIME = 16777619;
|
|
4
|
+
var encoder = new TextEncoder();
|
|
5
|
+
function fnv1aBytes(bytes) {
|
|
6
|
+
return fnv1aContinue(FNV_OFFSET_BASIS, bytes, bytes.length) >>> 0;
|
|
7
|
+
}
|
|
8
|
+
function fnv1aContinue(start, bytes, length) {
|
|
9
|
+
let hash = start;
|
|
10
|
+
for (let i = 0; i < length; i++) {
|
|
11
|
+
hash = Math.imul(hash ^ bytes[i], FNV_PRIME);
|
|
12
|
+
}
|
|
13
|
+
return hash;
|
|
14
|
+
}
|
|
15
|
+
var scratchNumber = new Float64Array(1);
|
|
16
|
+
var scratchBytes = new Uint8Array(scratchNumber.buffer);
|
|
17
|
+
var HOST_IS_LITTLE_ENDIAN = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;
|
|
18
|
+
function fnv1aContinueTaggedNumbers(start, tag, numbers) {
|
|
19
|
+
let hash = start;
|
|
20
|
+
const b = scratchBytes;
|
|
21
|
+
for (let i = 0; i < numbers.length; i++) {
|
|
22
|
+
scratchNumber[0] = Math.fround(numbers[i]);
|
|
23
|
+
hash = Math.imul(hash ^ tag, FNV_PRIME);
|
|
24
|
+
if (HOST_IS_LITTLE_ENDIAN) {
|
|
25
|
+
hash = Math.imul(hash ^ b[7], FNV_PRIME);
|
|
26
|
+
hash = Math.imul(hash ^ b[6], FNV_PRIME);
|
|
27
|
+
hash = Math.imul(hash ^ b[5], FNV_PRIME);
|
|
28
|
+
hash = Math.imul(hash ^ b[4], FNV_PRIME);
|
|
29
|
+
hash = Math.imul(hash ^ b[3], FNV_PRIME);
|
|
30
|
+
hash = Math.imul(hash ^ b[2], FNV_PRIME);
|
|
31
|
+
hash = Math.imul(hash ^ b[1], FNV_PRIME);
|
|
32
|
+
hash = Math.imul(hash ^ b[0], FNV_PRIME);
|
|
33
|
+
} else {
|
|
34
|
+
for (let at = 0; at < 8; at++) hash = Math.imul(hash ^ b[at], FNV_PRIME);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return hash;
|
|
38
|
+
}
|
|
39
|
+
function fnv1a(input) {
|
|
40
|
+
return fnv1aBytes(encoder.encode(input));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { FNV_OFFSET_BASIS, FNV_PRIME, fnv1a, fnv1aContinue, fnv1aContinueTaggedNumbers };
|
|
@@ -34,6 +34,11 @@ var ErrorCodes = {
|
|
|
34
34
|
BACKUP_STORE_CLAIMED: "BACKUP_STORE_CLAIMED",
|
|
35
35
|
BACKUP_STORE_NOT_CONFIGURED: "BACKUP_STORE_NOT_CONFIGURED",
|
|
36
36
|
BACKUP_NOT_READY: "BACKUP_NOT_READY",
|
|
37
|
+
SYNC_DURABILITY_REQUIRED: "SYNC_DURABILITY_REQUIRED",
|
|
38
|
+
SYNC_BACKUP_STORE_REQUIRED: "SYNC_BACKUP_STORE_REQUIRED",
|
|
39
|
+
SYNC_NOT_READY: "SYNC_NOT_READY",
|
|
40
|
+
SYNC_NOT_ENABLED: "SYNC_NOT_ENABLED",
|
|
41
|
+
SYNC_SNAPSHOT_PREPARING: "SYNC_SNAPSHOT_PREPARING",
|
|
37
42
|
SEARCH_INVALID_FIELD: "SEARCH_INVALID_FIELD",
|
|
38
43
|
VECTOR_DIMENSION_MISMATCH: "VECTOR_DIMENSION_MISMATCH",
|
|
39
44
|
SEARCH_INVALID_FILTER: "SEARCH_INVALID_FILTER",
|
|
@@ -143,7 +148,8 @@ var ClientErrorCodes = {
|
|
|
143
148
|
CLIENT_REQUEST_ABORTED: "CLIENT_REQUEST_ABORTED",
|
|
144
149
|
CLIENT_INVALID_RESPONSE: "CLIENT_INVALID_RESPONSE",
|
|
145
150
|
CLIENT_TASK_TIMEOUT: "CLIENT_TASK_TIMEOUT",
|
|
146
|
-
CLIENT_UNEXPECTED_ERROR: "CLIENT_UNEXPECTED_ERROR"
|
|
151
|
+
CLIENT_UNEXPECTED_ERROR: "CLIENT_UNEXPECTED_ERROR",
|
|
152
|
+
SYNC_ANALYSIS_UNAVAILABLE: "SYNC_ANALYSIS_UNAVAILABLE"
|
|
147
153
|
};
|
|
148
154
|
var NarsilError = class extends Error {
|
|
149
155
|
/** This says which failure it is. */
|
|
@@ -175,5 +181,8 @@ function isNarsilError(value) {
|
|
|
175
181
|
function createNarsilError(code, message, details) {
|
|
176
182
|
return new NarsilError(code, message, details);
|
|
177
183
|
}
|
|
184
|
+
function describeError(error) {
|
|
185
|
+
return error instanceof Error ? error.message : String(error);
|
|
186
|
+
}
|
|
178
187
|
|
|
179
|
-
export { ClientErrorCodes, ErrorCodes, NarsilError, ServerErrorCodes, createNarsilError, isNarsilError };
|
|
188
|
+
export { ClientErrorCodes, ErrorCodes, NarsilError, ServerErrorCodes, createNarsilError, describeError, isNarsilError };
|
|
@@ -1,81 +1,4 @@
|
|
|
1
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
2
|
-
|
|
3
|
-
// src/persistence/archive/byte-reader.ts
|
|
4
|
-
async function* chunksOf(source) {
|
|
5
|
-
if (source instanceof Uint8Array) {
|
|
6
|
-
yield source;
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
if (typeof source.getReader === "function") {
|
|
10
|
-
const reader = source.getReader();
|
|
11
|
-
try {
|
|
12
|
-
for (; ; ) {
|
|
13
|
-
const step = await reader.read();
|
|
14
|
-
if (step.done) return;
|
|
15
|
-
yield step.value;
|
|
16
|
-
}
|
|
17
|
-
} finally {
|
|
18
|
-
reader.releaseLock();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
yield* source;
|
|
22
|
-
}
|
|
23
|
-
function createByteReader(source) {
|
|
24
|
-
const iterator = chunksOf(source);
|
|
25
|
-
const pending = [];
|
|
26
|
-
let pendingBytes = 0;
|
|
27
|
-
let ended = false;
|
|
28
|
-
async function fill(length) {
|
|
29
|
-
while (pendingBytes < length && !ended) {
|
|
30
|
-
const step = await iterator.next();
|
|
31
|
-
if (step.done) {
|
|
32
|
-
ended = true;
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
if (step.value.byteLength === 0) continue;
|
|
36
|
-
pending.push(step.value);
|
|
37
|
-
pendingBytes += step.value.byteLength;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function take(length) {
|
|
41
|
-
const out = new Uint8Array(length);
|
|
42
|
-
let filled = 0;
|
|
43
|
-
while (filled < length) {
|
|
44
|
-
const head = pending[0];
|
|
45
|
-
const needed = length - filled;
|
|
46
|
-
if (head.byteLength <= needed) {
|
|
47
|
-
out.set(head, filled);
|
|
48
|
-
filled += head.byteLength;
|
|
49
|
-
pending.shift();
|
|
50
|
-
} else {
|
|
51
|
-
out.set(head.subarray(0, needed), filled);
|
|
52
|
-
pending[0] = head.subarray(needed);
|
|
53
|
-
filled += needed;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
pendingBytes -= length;
|
|
57
|
-
return out;
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
async readExactly(length) {
|
|
61
|
-
await fill(length);
|
|
62
|
-
if (pendingBytes === 0 && length > 0) return null;
|
|
63
|
-
if (pendingBytes < length) return take(pendingBytes);
|
|
64
|
-
return take(length);
|
|
65
|
-
},
|
|
66
|
-
async peek(length) {
|
|
67
|
-
await fill(length);
|
|
68
|
-
const available = Math.min(length, pendingBytes);
|
|
69
|
-
const copy = take(available);
|
|
70
|
-
pending.unshift(copy);
|
|
71
|
-
pendingBytes += copy.byteLength;
|
|
72
|
-
return copy;
|
|
73
|
-
},
|
|
74
|
-
async close() {
|
|
75
|
-
await iterator.return(void 0);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
1
|
+
import { NarsilError, ErrorCodes } from './chunk-CUNGPR5R.mjs';
|
|
79
2
|
|
|
80
3
|
// src/engine/snapshot/restore-config.ts
|
|
81
4
|
function rejectSnapshot(message) {
|
|
@@ -267,4 +190,4 @@ function restoredConfigFields(envelope, reject = rejectSnapshot) {
|
|
|
267
190
|
};
|
|
268
191
|
}
|
|
269
192
|
|
|
270
|
-
export {
|
|
193
|
+
export { rejectSnapshot, restoredConfigFields, restoredEmbedding };
|