@delali/narsil 0.3.1-next.153 → 0.3.1-next.155
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 +3 -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-3TFIHT5E.mjs} +32 -23
- package/dist/{react-native/chunks/analysis-change-entry-CXNRW324.mjs → analysis-change-entry-KA6JAO4X.mjs} +1 -1
- package/dist/archive-history-E4R73RWD.mjs +29 -0
- package/dist/browser/{analysis-change-2V2HZ2NY.mjs → analysis-change-TC36BU47.mjs} +39 -10
- package/dist/{analysis-change-entry-QD7YNDEE.mjs → browser/analysis-change-entry-4MH3CZXH.mjs} +1 -1
- package/dist/browser/archive-history-4IP5XQZY.mjs +29 -0
- package/dist/browser/chunk-23XRXIBW.mjs +85 -0
- package/dist/browser/chunk-3UIEB4QF.mjs +63 -0
- package/dist/browser/{chunk-CSCKZBVJ.mjs → chunk-4EWUGZYZ.mjs} +4 -4
- package/dist/browser/chunk-4WCVMOU3.mjs +151 -0
- package/dist/browser/{chunk-QJCO3TJU.mjs → chunk-56W3HQVJ.mjs} +9 -150
- package/dist/{react-native/chunks/chunk-VGUWIZFQ.mjs → browser/chunk-5TCXK5SB.mjs} +2 -2
- package/dist/browser/chunk-5W3MMTLG.mjs +19 -0
- package/dist/browser/chunk-7IGKGWSQ.mjs +79 -0
- package/dist/browser/chunk-A5KUEGDY.mjs +241 -0
- package/dist/browser/{chunk-HT7J73QL.mjs → chunk-ABCXENU5.mjs} +2 -2
- package/dist/browser/chunk-ATEBYXP6.mjs +10 -0
- package/dist/browser/chunk-BXM5XOCA.mjs +315 -0
- package/dist/browser/chunk-CJSYBQ4J.mjs +100 -0
- package/dist/browser/chunk-DSXIBE6N.mjs +78 -0
- package/dist/browser/chunk-ELV4OZOI.mjs +29 -0
- package/dist/{react-native/chunks/chunk-QC4ZRBSX.mjs → browser/chunk-EXQZGUQH.mjs} +2 -79
- package/dist/browser/{chunk-2A2IPRC3.mjs → chunk-FNIFPFB7.mjs} +5 -31
- package/dist/browser/chunk-G64Q6OJF.mjs +96 -0
- package/dist/browser/chunk-GPPOG6PT.mjs +9 -0
- package/dist/browser/chunk-IKDKX5VQ.mjs +1007 -0
- package/dist/browser/chunk-JIJXMI42.mjs +1829 -0
- package/dist/browser/chunk-JVBP5EYO.mjs +1106 -0
- package/dist/browser/{chunk-TQ5UMFG5.mjs → chunk-K4GCSZLI.mjs} +15 -6
- package/dist/browser/{chunk-PM4MUM5N.mjs → chunk-K5AXJBLL.mjs} +6 -5
- package/dist/browser/chunk-KKAMCABR.mjs +432 -0
- package/dist/browser/{chunk-IAXZAVYL.mjs → chunk-LFIWRCEA.mjs} +1 -159
- package/dist/browser/chunk-M3MQE2X7.mjs +151 -0
- package/dist/browser/chunk-ML7THVLJ.mjs +38 -0
- package/dist/browser/chunk-NLWTBAGB.mjs +111 -0
- package/dist/browser/chunk-OEDCEZXJ.mjs +92 -0
- package/dist/browser/{chunk-MPK76GVS.mjs → chunk-RA6LSBCM.mjs} +1 -21
- package/dist/browser/{chunk-GJKXW3SF.mjs → chunk-RND5CLX3.mjs} +147 -253
- package/dist/{react-native/chunks/chunk-DFQJ4IJB.mjs → browser/chunk-RQBUNZQW.mjs} +2 -2
- package/dist/browser/{chunk-VD7JEUIR.mjs → chunk-RRO3EV4C.mjs} +9 -8
- package/dist/browser/{chunk-KWYQ6KX4.mjs → chunk-SMEQ36NT.mjs} +162 -2019
- package/dist/{chunk-MDF6PDIA.mjs → browser/chunk-SRMZXJSL.mjs} +8 -1
- package/dist/browser/{chunk-7ZJTRUVW.mjs → chunk-SUDNZKPL.mjs} +2 -2
- package/dist/browser/{chunk-LURXVCHG.mjs → chunk-U3JOQGWX.mjs} +1 -1
- package/dist/browser/chunk-VI7BQR4U.mjs +21 -0
- package/dist/browser/{chunk-B3JM6Z74.mjs → chunk-XY4VVBBO.mjs} +3 -2
- package/dist/browser/chunk-YJHGOJAC.mjs +15 -0
- package/dist/browser/chunk-ZI2V4VD7.mjs +21 -0
- package/dist/browser/{cold-module-YECAK4MN.mjs → cold-module-NEUGHUPA.mjs} +21 -14
- package/dist/browser/durability-config-TIYKW6XX.mjs +89 -0
- package/dist/browser/{durability-wiring-LM7WFL6X.mjs → durability-wiring-CVGPRO6D.mjs} +1299 -881
- package/dist/browser/engine-hooks-YXMPHZKZ.mjs +16 -0
- package/dist/browser/import-OM6QAW45.mjs +18 -0
- package/dist/browser/methods-KTQCSIN4.mjs +30 -0
- package/dist/browser/{module-XQLEOYNM.mjs → module-3HNFCBJ5.mjs} +10 -8
- package/dist/browser/{module-KAMRAJLE.mjs → module-E33X4AOK.mjs} +17 -10
- package/dist/browser/operations-OJ3BXS55.mjs +5 -0
- package/dist/browser/{phrase-module-CNKMUY4U.mjs → phrase-module-ZXXU7S3B.mjs} +1 -1
- package/dist/browser/{pool-DTYSPBMQ.mjs → pool-3JLET5RO.mjs} +3 -2
- package/dist/browser/restore-hooks-IF2ZROUP.mjs +113 -0
- package/dist/browser/restore-queue-ZBS7CJA6.mjs +55 -0
- package/dist/browser/retention-ASWUHAYI.mjs +209 -0
- package/dist/browser/{runtime-D2ULZGCN.mjs → runtime-OTAGEFQW.mjs} +1 -1
- package/dist/browser/{snapshot-UGZVMP4H.mjs → snapshot-PN7ZW6Q4.mjs} +80 -315
- package/dist/browser/start-ZIRB7MQ2.mjs +24 -0
- package/dist/browser/sync-state-P5XG6LTQ.mjs +15 -0
- package/dist/browser/{write-I5P5MW4O.mjs → write-HMDYCTV2.mjs} +17 -11
- package/dist/{capabilities-BT-HLDC8.d.ts → capabilities-Da4ywVVl.d.ts} +94 -7
- package/dist/{chunk-LDGGR7YT.mjs → chunk-2MANFZJ3.mjs} +2 -2
- package/dist/{chunk-IZT3G24Q.mjs → chunk-2NE7VCYE.mjs} +2 -2
- package/dist/{chunk-3TVDTACC.mjs → chunk-3C7MTCCI.mjs} +1 -1
- package/dist/chunk-3HB3PEC6.mjs +240 -0
- package/dist/chunk-3HHQLEEQ.mjs +1092 -0
- package/dist/chunk-3OH67G7R.mjs +214 -0
- package/dist/{chunk-ZS6CMXAE.mjs → chunk-3R4UZWQG.mjs} +98 -250
- package/dist/{chunk-65WCV5JO.mjs → chunk-4BYWRYPM.mjs} +1 -1
- package/dist/{chunk-SOUZMPME.mjs → chunk-4KRC2APY.mjs} +7 -194
- package/dist/{chunk-5QMHMELB.mjs → chunk-5FLRXF73.mjs} +8 -1
- package/dist/chunk-5FVU47TB.mjs +20 -0
- package/dist/chunk-5YNRKI2C.mjs +81 -0
- package/dist/chunk-6L3XJXGU.mjs +470 -0
- package/dist/chunk-6MSZ543Y.mjs +32 -0
- package/dist/{chunk-T4CJDBBE.mjs → chunk-6OEGXLBX.mjs} +1 -1
- package/dist/{chunk-3SBJVQLL.mjs → chunk-6RC4K46J.mjs} +2 -2
- package/dist/chunk-7GXJUJ24.mjs +49 -0
- package/dist/{chunk-FNBNZCGP.mjs → chunk-AILVAOLX.mjs} +2 -2
- package/dist/chunk-BDRIVYOK.mjs +72 -0
- package/dist/chunk-BUMREPLU.mjs +15 -0
- package/dist/chunk-BY6ZDGYS.mjs +50 -0
- package/dist/{chunk-5WB2A3XU.mjs → chunk-DCNKVEDB.mjs} +511 -27
- package/dist/{chunk-NITCPDFL.mjs → chunk-DIBHI6W5.mjs} +2 -2
- package/dist/{chunk-4QCSHLNM.mjs → chunk-DUOLGBTE.mjs} +3 -3
- package/dist/chunk-GES7U2PM.mjs +68 -0
- package/dist/chunk-GH4WQ22V.mjs +34 -0
- package/dist/chunk-GQPTDQCL.mjs +54 -0
- package/dist/chunk-H4KHPLHJ.mjs +382 -0
- package/dist/{chunk-7TE2AJIH.mjs → chunk-H6VIGE62.mjs} +13 -10
- package/dist/{chunk-J7M73VY7.mjs → chunk-HJJI72X7.mjs} +1 -1
- package/dist/{chunk-DGRM4EZZ.mjs → chunk-HNVVEQP7.mjs} +1 -1
- package/dist/{chunk-RBEHLIKX.mjs → chunk-HW5TNXBO.mjs} +35 -11
- package/dist/{chunk-KYVRZAYP.mjs → chunk-I54T6CQP.mjs} +2 -69
- package/dist/{chunk-IRWP524D.mjs → chunk-INJYO3BU.mjs} +1 -1
- package/dist/chunk-IPN7S4KX.mjs +130 -0
- package/dist/{chunk-CSHHU7PA.mjs → chunk-J4IWBIVY.mjs} +11 -30
- package/dist/{chunk-G5KHSM6E.mjs → chunk-K4ZIGL2O.mjs} +1 -1
- package/dist/{chunk-6RKSY3BX.mjs → chunk-KBDBPVLN.mjs} +5 -5
- package/dist/{chunk-J4BDAH2W.mjs → chunk-KBKEXQZA.mjs} +2 -2
- package/dist/{chunk-IJSFWGVW.mjs → chunk-KFLK5NA2.mjs} +3 -3
- package/dist/{chunk-YGQOPB2Z.mjs → chunk-KHKIRS5D.mjs} +1 -1
- package/dist/chunk-KJ3RTZDJ.mjs +101 -0
- package/dist/{chunk-2PNYKG2D.mjs → chunk-KMUNHGBQ.mjs} +139 -432
- package/dist/chunk-KP7TYHWT.mjs +92 -0
- package/dist/{chunk-VP6XRMWR.mjs → chunk-KPIV4RUC.mjs} +6 -32
- package/dist/{chunk-NPXVQS33.mjs → chunk-KXCVQWOR.mjs} +4 -3
- package/dist/chunk-KYYABCSW.mjs +72 -0
- package/dist/{chunk-6F6USYII.mjs → chunk-L7ZD4L3K.mjs} +267 -265
- package/dist/{chunk-U46IZNCW.mjs → chunk-LC3FDWTX.mjs} +3 -2
- package/dist/{chunk-6BWLDLS3.mjs → chunk-LHKOSI2J.mjs} +1 -1
- package/dist/chunk-LNGE7SLY.mjs +151 -0
- package/dist/{react-native/chunks/chunk-YH7W556M.mjs → chunk-MP7ABPTD.mjs} +12 -2
- package/dist/chunk-MT2NRTA6.mjs +216 -0
- package/dist/chunk-NF4DT3IH.mjs +85 -0
- package/dist/{chunk-POUYICOU.mjs → chunk-OIJ64LGT.mjs} +1 -1
- package/dist/{chunk-SEAJS664.mjs → chunk-PCRA7HTI.mjs} +5 -5
- package/dist/chunk-PHQNACDT.mjs +63 -0
- package/dist/chunk-Q622CTMC.mjs +74 -0
- package/dist/{chunk-NVTFQFUL.mjs → chunk-Q7G3BV3Y.mjs} +1 -1
- package/dist/chunk-QDZJM7NI.mjs +23 -0
- package/dist/{chunk-52QQWEBS.mjs → chunk-QH3YIQP4.mjs} +36 -7
- package/dist/chunk-QJVOLKU6.mjs +111 -0
- package/dist/chunk-QUJHMPTP.mjs +30 -0
- package/dist/{chunk-3E4RRF5J.mjs → chunk-RSVULW4Q.mjs} +100 -8
- package/dist/{chunk-IJPK5PGM.mjs → chunk-RVGRFOGN.mjs} +1 -1
- package/dist/chunk-RZWWB2XR.mjs +96 -0
- package/dist/{chunk-KQJVNPRM.mjs → chunk-S2EQU2GE.mjs} +19 -16
- package/dist/chunk-S5LN746F.mjs +10 -0
- package/dist/{chunk-LJ4ENXOD.mjs → chunk-SG3JBNHY.mjs} +2 -2
- package/dist/{chunk-B2FTZNNF.mjs → chunk-SMVH6JBE.mjs} +34 -14
- package/dist/chunk-SY3EWKQY.mjs +242 -0
- package/dist/{chunk-NYSONUB7.mjs → chunk-TQXHPFWT.mjs} +1 -1
- package/dist/{chunk-ZHAXP7SD.mjs → chunk-U4BS74YN.mjs} +26 -238
- package/dist/chunk-UHICS3JI.mjs +83 -0
- package/dist/chunk-UZRZKNNZ.mjs +101 -0
- package/dist/chunk-V6EUBAIT.mjs +19 -0
- package/dist/{chunk-TTCKT2RT.mjs → chunk-VGF7CFRP.mjs} +134 -11
- package/dist/chunk-VHBNF4MA.mjs +543 -0
- package/dist/{chunk-AWNHDBKV.mjs → chunk-VQEUR6T6.mjs} +16 -8
- package/dist/chunk-WQRN64Q6.mjs +196 -0
- package/dist/{chunk-DMNPYF54.mjs → chunk-WZ7YV54N.mjs} +2 -2
- package/dist/chunk-Y4WPNHMC.mjs +50 -0
- package/dist/{chunk-2HJWQPR6.mjs → chunk-YEDIDCR7.mjs} +6 -122
- package/dist/chunk-YEKL4JBK.mjs +96 -0
- package/dist/{chunk-UGVUW27S.mjs → chunk-Z2BE2MAM.mjs} +14 -10
- package/dist/{chunk-3HV7M5OJ.mjs → chunk-ZAUJFLEN.mjs} +11 -135
- package/dist/{chunk-FDG4KXX5.mjs → chunk-ZHCUZZE5.mjs} +6 -4
- package/dist/chunk-ZTW5WTGG.mjs +167 -0
- package/dist/chunk-ZYAY26KG.mjs +29 -0
- package/dist/{client-Cn3gNxUU.d.ts → client-DRv7UVeY.d.ts} +193 -11
- package/dist/client.d.ts +9 -7
- package/dist/client.mjs +120 -7
- package/dist/{cold-module-PYSSBIL7.mjs → cold-module-7XXCEGTZ.mjs} +43 -33
- package/dist/config-CoSig5Ox.d.ts +482 -0
- package/dist/{config-CfhH1IWQ.d.ts → config-DMwffLKn.d.ts} +20 -5
- package/dist/{direct-executor-WYALQSMD.mjs → direct-executor-G5TK7NLA.mjs} +18 -13
- 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 +9304 -7271
- package/dist/durability-config-GE4U7MCZ.mjs +89 -0
- package/dist/{durability-wiring-7VBZEJLG.mjs → durability-wiring-NCKUC5EO.mjs} +1293 -872
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{config-aIsy7mcL.d.ts → engine-CFxPYqEk.d.ts} +716 -407
- package/dist/engine-hooks-DHCMOADY.mjs +47 -0
- package/dist/{import-GJOMB2HC.mjs → import-NBFXFCSG.mjs} +32 -24
- package/dist/{index-MsF7e5hL.d.ts → index-C4AmUnl1.d.ts} +1 -1
- package/dist/index.browser.mjs +9 -4
- package/dist/index.d.ts +7 -6
- package/dist/index.mjs +29 -21
- package/dist/index.react-native.mjs +19 -12
- package/dist/{long-query-thread-SCUE62TO.mjs → long-query-thread-J4DVRM4A.mjs} +33 -19
- package/dist/methods-7IOINERF.mjs +30 -0
- package/dist/{module-6RLIKSZQ.mjs → module-DWKPBSMN.mjs} +38 -28
- package/dist/{module-AVQEIB7O.mjs → module-UN76TF7I.mjs} +14 -14
- package/dist/operations-G5EP6JPX.mjs +5 -0
- package/dist/{paged-partition-archive-KGRW366Y.mjs → paged-partition-archive-DPNWVSK2.mjs} +46 -31
- package/dist/partial-words.mjs +7 -5
- package/dist/pattern.mjs +4 -3
- package/dist/persistence/durability/checkpoint-worker.d.ts +16 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +40 -29
- package/dist/{phrase-module-OUQIRUQU.mjs → phrase-module-ZI4WSQVH.mjs} +1 -1
- package/dist/{pool-UPV5PVPY.mjs → pool-Y4A46T36.mjs} +2 -2
- package/dist/query-suggestions/merge-worker.d.ts +55 -0
- package/dist/query-suggestions/merge-worker.mjs +81 -0
- package/dist/query-suggestions-CBYkrQ5T.d.ts +311 -0
- package/dist/query-suggestions.browser.mjs +246 -0
- package/dist/query-suggestions.d.ts +20 -0
- package/dist/query-suggestions.mjs +62 -0
- package/dist/react-native/chunks/{analysis-change-DXPZRGWF.mjs → analysis-change-6BPDPH6K.mjs} +50 -19
- package/dist/{browser/analysis-change-entry-JL5U2N3Q.mjs → react-native/chunks/analysis-change-entry-JLL42PH6.mjs} +1 -1
- package/dist/react-native/chunks/archive-history-MJKUQLSU.mjs +29 -0
- package/dist/react-native/chunks/chunk-3JIBF3XT.mjs +191 -0
- package/dist/react-native/chunks/chunk-3NQOVO3K.mjs +1 -0
- package/dist/react-native/chunks/{chunk-UFNCLEQM.mjs → chunk-4DII3ZSM.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-BRNAVOKP.mjs → chunk-4J74WHQM.mjs} +2 -2
- package/dist/react-native/chunks/chunk-4LCEN2IU.mjs +315 -0
- package/dist/react-native/chunks/{chunk-PU55IOG4.mjs → chunk-4Y53T4YE.mjs} +6 -190
- package/dist/react-native/chunks/chunk-5CQX3XXV.mjs +17 -0
- package/dist/react-native/chunks/chunk-6VBXNFLE.mjs +9 -0
- package/dist/react-native/chunks/chunk-6WA3C3DV.mjs +85 -0
- package/dist/react-native/chunks/chunk-7GRCBBME.mjs +63 -0
- package/dist/react-native/chunks/{chunk-2J2727V4.mjs → chunk-7PXRWYUU.mjs} +1 -1
- package/dist/{browser/chunk-VBX2TI5V.mjs → react-native/chunks/chunk-ALOIBXWN.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-FS7BYE23.mjs → chunk-C3PTWYKT.mjs} +10 -153
- package/dist/react-native/chunks/{chunk-DKJTZ625.mjs → chunk-C5G6TJ7A.mjs} +2 -69
- package/dist/react-native/chunks/chunk-CHPTFFJM.mjs +43 -0
- package/dist/react-native/chunks/{chunk-LRGWK367.mjs → chunk-CKNRFDTZ.mjs} +1 -1
- package/dist/react-native/chunks/chunk-CUH5F57W.mjs +242 -0
- package/dist/react-native/chunks/chunk-DIYDOIM4.mjs +10 -0
- package/dist/{browser/chunk-55WYRLDZ.mjs → react-native/chunks/chunk-DVDX4SDR.mjs} +2 -2
- package/dist/{browser/chunk-PIS7ZAP7.mjs → react-native/chunks/chunk-DZ7H7D2C.mjs} +12 -2
- package/dist/react-native/chunks/{chunk-KOCTCUXW.mjs → chunk-EIOYM5TO.mjs} +17 -9
- package/dist/react-native/chunks/chunk-F753DA54.mjs +23 -0
- package/dist/react-native/chunks/chunk-GIZTJXYW.mjs +1007 -0
- package/dist/react-native/chunks/{chunk-CLE3LZ77.mjs → chunk-GJFXPHXI.mjs} +5 -4
- package/dist/react-native/chunks/chunk-H3MDVPBO.mjs +151 -0
- package/dist/react-native/chunks/{chunk-IDFMNRIC.mjs → chunk-HUOYZJ3Q.mjs} +140 -430
- package/dist/react-native/chunks/chunk-IYNT75CE.mjs +111 -0
- package/dist/react-native/chunks/chunk-JDOEEMEF.mjs +38 -0
- package/dist/react-native/chunks/{chunk-LQAKO5QV.mjs → chunk-JLIIWJUV.mjs} +2 -2
- package/dist/react-native/chunks/chunk-JWUCMVRK.mjs +15 -0
- package/dist/react-native/chunks/chunk-KJIG57UD.mjs +1106 -0
- package/dist/react-native/chunks/{chunk-KLZGAOLT.mjs → chunk-KTTAU63H.mjs} +5 -5
- package/dist/react-native/chunks/chunk-LU3Y3P63.mjs +68 -0
- package/dist/{browser/chunk-NVEJJP4R.mjs → react-native/chunks/chunk-LZSLNSUN.mjs} +2 -79
- package/dist/react-native/chunks/{chunk-3CTWSQRW.mjs → chunk-MJDQU5MW.mjs} +4 -30
- package/dist/react-native/chunks/{chunk-NFGBOI46.mjs → chunk-MVXELMJX.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-D7LFYPYI.mjs → chunk-N2WUOWLL.mjs} +12 -10
- package/dist/react-native/chunks/chunk-NVVRSRX5.mjs +78 -0
- package/dist/react-native/chunks/{chunk-JYL35A4A.mjs → chunk-OL3WDV53.mjs} +7 -33
- package/dist/react-native/chunks/chunk-PB2YXVQW.mjs +29 -0
- package/dist/react-native/chunks/{chunk-UCJU6WNH.mjs → chunk-PEHS2UO3.mjs} +7 -6
- package/dist/react-native/chunks/chunk-PJHAB5ZY.mjs +79 -0
- package/dist/react-native/chunks/chunk-Q32DDFKX.mjs +19 -0
- package/dist/react-native/chunks/chunk-QJXTNPLQ.mjs +100 -0
- package/dist/react-native/chunks/{chunk-ZCKNBPQ4.mjs → chunk-RDWG33MM.mjs} +2 -2
- package/dist/react-native/chunks/chunk-SUPXRTMD.mjs +96 -0
- package/dist/react-native/chunks/chunk-TYIRMPD3.mjs +432 -0
- package/dist/react-native/chunks/{chunk-TLYD7IJ2.mjs → chunk-U4KSKA4Z.mjs} +1 -1
- package/dist/react-native/chunks/chunk-UNUFZ2QY.mjs +68 -0
- package/dist/react-native/chunks/{chunk-7IQR3SZO.mjs → chunk-VXGE4ZXL.mjs} +151 -257
- package/dist/react-native/chunks/{chunk-R4OPUZQ5.mjs → chunk-WBYQRHDY.mjs} +2 -2
- package/dist/react-native/chunks/chunk-YH7QY657.mjs +288 -0
- package/dist/react-native/chunks/chunk-ZZT7CEN7.mjs +92 -0
- package/dist/react-native/chunks/{cold-module-KFGEWYEL.mjs → cold-module-5PHF6DZR.mjs} +31 -22
- package/dist/react-native/chunks/durability-config-QXVZEO7T.mjs +89 -0
- package/dist/react-native/chunks/{durability-wiring-QKJB2QBT.mjs → durability-wiring-KO565FZC.mjs} +1309 -889
- package/dist/react-native/chunks/engine-hooks-MVRRHH6B.mjs +28 -0
- package/dist/react-native/chunks/gzip.react-native-HLEPDKZ3.mjs +3 -0
- package/dist/react-native/chunks/import-YVZA4V4V.mjs +30 -0
- package/dist/react-native/chunks/methods-6W5U4C3H.mjs +30 -0
- package/dist/react-native/chunks/{module-UJ5VUARS.mjs → module-H5MVPSP2.mjs} +13 -11
- package/dist/react-native/chunks/module-ZL5ZG6YB.mjs +34 -0
- package/dist/react-native/chunks/operations-GNRMD6EX.mjs +5 -0
- package/dist/react-native/chunks/{phrase-module-76UAPPSG.mjs → phrase-module-RTVKEWJT.mjs} +1 -1
- package/dist/react-native/chunks/{pool-CD4ANYUI.mjs → pool-JR3NJCAF.mjs} +3 -2
- package/dist/react-native/chunks/restore-hooks-SILFPU6B.mjs +125 -0
- package/dist/react-native/chunks/restore-queue-HSYP2AEC.mjs +55 -0
- package/dist/react-native/chunks/retention-7I7UAWYK.mjs +221 -0
- package/dist/react-native/chunks/{runtime-3MCDLJAF.mjs → runtime-R5E3TB3J.mjs} +1 -1
- package/dist/react-native/chunks/{snapshot-KVBD4LRC.mjs → snapshot-EZYB6SLF.mjs} +90 -323
- package/dist/react-native/chunks/start-SHVZ72I5.mjs +36 -0
- package/dist/react-native/chunks/sync-state-PASCIHHT.mjs +15 -0
- package/dist/react-native/chunks/{write-ES5A3WUA.mjs → write-JUESXHDL.mjs} +27 -19
- package/dist/react-native/partial-words.mjs +8 -5
- package/dist/react-native/pattern.mjs +4 -3
- package/dist/react-native/query-suggestions.mjs +258 -0
- package/dist/react-native/sync.mjs +2299 -0
- package/dist/react-native/synonyms.mjs +7 -4
- package/dist/react.d.ts +11 -10
- package/dist/react.mjs +8 -1
- package/dist/{rerank-3W54N6P2.mjs → rerank-MQ37IYRV.mjs} +4 -4
- package/dist/rerankers/http.mjs +2 -2
- package/dist/restore-hooks-HZ3ILAMO.mjs +146 -0
- package/dist/restore-queue-JVGENGGE.mjs +55 -0
- package/dist/retention-HROPV2QU.mjs +59 -0
- package/dist/{runtime-L2DZYY6N.mjs → runtime-COIUORCN.mjs} +5 -5
- package/dist/{schema-D33CyXCy.d.ts → schema-Jwt928nJ.d.ts} +1 -1
- package/dist/server.d.ts +119 -20
- package/dist/server.mjs +1123 -58
- package/dist/{snapshot-WMX6JCLP.mjs → snapshot-4HS2G2UM.mjs} +106 -49
- package/dist/start-UTWHGH42.mjs +59 -0
- 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/sync.browser.mjs +2294 -0
- package/dist/sync.d.ts +23 -0
- package/dist/sync.mjs +2268 -0
- package/dist/synonyms.mjs +6 -4
- package/dist/{tasks-C4ElXr4P.d.ts → tasks-qrJojgST.d.ts} +13 -5
- package/dist/thread-6MOXY2KD.mjs +45 -0
- package/dist/types-BZCGjfLn.d.ts +227 -0
- package/dist/vector/search-worker.d.ts +1 -1
- package/dist/vector/search-worker.mjs +7 -7
- package/dist/workers/entry.mjs +8 -8
- package/dist/{write-SKJ6HW7O.mjs → write-GTTWWRRG.mjs} +36 -28
- package/openapi.json +912 -5
- package/package.json +45 -8
- package/dist/browser/import-QOY6ZH6X.mjs +0 -12
- package/dist/browser/restore-queue-UQ6AAUVX.mjs +0 -41
- package/dist/chunk-7LDMWKP6.mjs +0 -209
- package/dist/engine-CJRUHXgf.d.ts +0 -664
- package/dist/react-native/chunks/chunk-L4M7QJNP.mjs +0 -110
- package/dist/react-native/chunks/chunk-TJMSKBEM.mjs +0 -25
- 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/react-native/chunks/restore-queue-H5VCN453.mjs +0 -41
- package/dist/restore-queue-AOF5OTQV.mjs +0 -41
- package/dist/thread-I7DVHHW7.mjs +0 -31
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// src/persistence/durability/sha256.ts
|
|
2
|
+
var ROUND_CONSTANTS = new Uint32Array([
|
|
3
|
+
1116352408,
|
|
4
|
+
1899447441,
|
|
5
|
+
3049323471,
|
|
6
|
+
3921009573,
|
|
7
|
+
961987163,
|
|
8
|
+
1508970993,
|
|
9
|
+
2453635748,
|
|
10
|
+
2870763221,
|
|
11
|
+
3624381080,
|
|
12
|
+
310598401,
|
|
13
|
+
607225278,
|
|
14
|
+
1426881987,
|
|
15
|
+
1925078388,
|
|
16
|
+
2162078206,
|
|
17
|
+
2614888103,
|
|
18
|
+
3248222580,
|
|
19
|
+
3835390401,
|
|
20
|
+
4022224774,
|
|
21
|
+
264347078,
|
|
22
|
+
604807628,
|
|
23
|
+
770255983,
|
|
24
|
+
1249150122,
|
|
25
|
+
1555081692,
|
|
26
|
+
1996064986,
|
|
27
|
+
2554220882,
|
|
28
|
+
2821834349,
|
|
29
|
+
2952996808,
|
|
30
|
+
3210313671,
|
|
31
|
+
3336571891,
|
|
32
|
+
3584528711,
|
|
33
|
+
113926993,
|
|
34
|
+
338241895,
|
|
35
|
+
666307205,
|
|
36
|
+
773529912,
|
|
37
|
+
1294757372,
|
|
38
|
+
1396182291,
|
|
39
|
+
1695183700,
|
|
40
|
+
1986661051,
|
|
41
|
+
2177026350,
|
|
42
|
+
2456956037,
|
|
43
|
+
2730485921,
|
|
44
|
+
2820302411,
|
|
45
|
+
3259730800,
|
|
46
|
+
3345764771,
|
|
47
|
+
3516065817,
|
|
48
|
+
3600352804,
|
|
49
|
+
4094571909,
|
|
50
|
+
275423344,
|
|
51
|
+
430227734,
|
|
52
|
+
506948616,
|
|
53
|
+
659060556,
|
|
54
|
+
883997877,
|
|
55
|
+
958139571,
|
|
56
|
+
1322822218,
|
|
57
|
+
1537002063,
|
|
58
|
+
1747873779,
|
|
59
|
+
1955562222,
|
|
60
|
+
2024104815,
|
|
61
|
+
2227730452,
|
|
62
|
+
2361852424,
|
|
63
|
+
2428436474,
|
|
64
|
+
2756734187,
|
|
65
|
+
3204031479,
|
|
66
|
+
3329325298
|
|
67
|
+
]);
|
|
68
|
+
var SHA256_INITIAL_STATE = [
|
|
69
|
+
1779033703,
|
|
70
|
+
3144134277,
|
|
71
|
+
1013904242,
|
|
72
|
+
2773480762,
|
|
73
|
+
1359893119,
|
|
74
|
+
2600822924,
|
|
75
|
+
528734635,
|
|
76
|
+
1541459225
|
|
77
|
+
];
|
|
78
|
+
var SHA256_BLOCK_BYTES = 64;
|
|
79
|
+
var LENGTH_BYTES = 8;
|
|
80
|
+
function rotateRight(value, bits) {
|
|
81
|
+
return value >>> bits | value << 32 - bits;
|
|
82
|
+
}
|
|
83
|
+
function paddedSha256Message(bytes, precedingBytes = 0) {
|
|
84
|
+
const total = Math.ceil((bytes.byteLength + 1 + LENGTH_BYTES) / SHA256_BLOCK_BYTES) * SHA256_BLOCK_BYTES;
|
|
85
|
+
const message = new Uint8Array(total);
|
|
86
|
+
message.set(bytes);
|
|
87
|
+
message[bytes.byteLength] = 128;
|
|
88
|
+
const view = new DataView(message.buffer);
|
|
89
|
+
const bitLength = (precedingBytes + bytes.byteLength) * 8;
|
|
90
|
+
view.setUint32(total - LENGTH_BYTES, Math.floor(bitLength / 4294967296), false);
|
|
91
|
+
view.setUint32(total - 4, bitLength >>> 0, false);
|
|
92
|
+
return view;
|
|
93
|
+
}
|
|
94
|
+
function compressSha256Block(state, view, block, words) {
|
|
95
|
+
for (let i = 0; i < 16; i++) words[i] = view.getUint32(block + i * 4, false);
|
|
96
|
+
for (let i = 16; i < 64; i++) {
|
|
97
|
+
const w15 = words[i - 15];
|
|
98
|
+
const w2 = words[i - 2];
|
|
99
|
+
const s0 = rotateRight(w15, 7) ^ rotateRight(w15, 18) ^ w15 >>> 3;
|
|
100
|
+
const s1 = rotateRight(w2, 17) ^ rotateRight(w2, 19) ^ w2 >>> 10;
|
|
101
|
+
words[i] = words[i - 16] + s0 + words[i - 7] + s1 >>> 0;
|
|
102
|
+
}
|
|
103
|
+
let a = state[0];
|
|
104
|
+
let b = state[1];
|
|
105
|
+
let c = state[2];
|
|
106
|
+
let d = state[3];
|
|
107
|
+
let e = state[4];
|
|
108
|
+
let f = state[5];
|
|
109
|
+
let g = state[6];
|
|
110
|
+
let h = state[7];
|
|
111
|
+
for (let i = 0; i < 64; i++) {
|
|
112
|
+
const s1 = rotateRight(e, 6) ^ rotateRight(e, 11) ^ rotateRight(e, 25);
|
|
113
|
+
const choice = e & f ^ ~e & g;
|
|
114
|
+
const t1 = h + s1 + choice + ROUND_CONSTANTS[i] + words[i] >>> 0;
|
|
115
|
+
const s0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);
|
|
116
|
+
const majority = a & b ^ a & c ^ b & c;
|
|
117
|
+
const t2 = s0 + majority >>> 0;
|
|
118
|
+
h = g;
|
|
119
|
+
g = f;
|
|
120
|
+
f = e;
|
|
121
|
+
e = d + t1 >>> 0;
|
|
122
|
+
d = c;
|
|
123
|
+
c = b;
|
|
124
|
+
b = a;
|
|
125
|
+
a = t1 + t2 >>> 0;
|
|
126
|
+
}
|
|
127
|
+
state[0] = state[0] + a >>> 0;
|
|
128
|
+
state[1] = state[1] + b >>> 0;
|
|
129
|
+
state[2] = state[2] + c >>> 0;
|
|
130
|
+
state[3] = state[3] + d >>> 0;
|
|
131
|
+
state[4] = state[4] + e >>> 0;
|
|
132
|
+
state[5] = state[5] + f >>> 0;
|
|
133
|
+
state[6] = state[6] + g >>> 0;
|
|
134
|
+
state[7] = state[7] + h >>> 0;
|
|
135
|
+
}
|
|
136
|
+
function sha256Digest(state) {
|
|
137
|
+
const digest = new Uint8Array(32);
|
|
138
|
+
const out = new DataView(digest.buffer);
|
|
139
|
+
for (let i = 0; i < 8; i++) out.setUint32(i * 4, state[i], false);
|
|
140
|
+
return digest;
|
|
141
|
+
}
|
|
142
|
+
function sha256(bytes) {
|
|
143
|
+
const view = paddedSha256Message(bytes);
|
|
144
|
+
const state = Uint32Array.from(SHA256_INITIAL_STATE);
|
|
145
|
+
const words = new Uint32Array(64);
|
|
146
|
+
for (let block = 0; block < view.byteLength; block += SHA256_BLOCK_BYTES)
|
|
147
|
+
compressSha256Block(state, view, block, words);
|
|
148
|
+
return sha256Digest(state);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export { SHA256_BLOCK_BYTES, SHA256_INITIAL_STATE, compressSha256Block, paddedSha256Message, sha256, sha256Digest };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// src/engine/serial-index-update.ts
|
|
2
|
+
var updatingByCore = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
async function withOpenIndex(core, indexName, action) {
|
|
4
|
+
core.guardShutdown();
|
|
5
|
+
core.requireIndex(indexName);
|
|
6
|
+
const release = await core.indexState.acquire(indexName);
|
|
7
|
+
try {
|
|
8
|
+
return await action();
|
|
9
|
+
} finally {
|
|
10
|
+
release();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
async function oneAtATime(core, indexName, action) {
|
|
14
|
+
let chains = updatingByCore.get(core);
|
|
15
|
+
if (chains === void 0) {
|
|
16
|
+
chains = /* @__PURE__ */ new Map();
|
|
17
|
+
updatingByCore.set(core, chains);
|
|
18
|
+
}
|
|
19
|
+
const updating = chains;
|
|
20
|
+
const earlier = updating.get(indexName) ?? Promise.resolve();
|
|
21
|
+
const current = earlier.catch(() => void 0).then(action);
|
|
22
|
+
updating.set(indexName, current);
|
|
23
|
+
try {
|
|
24
|
+
return await current;
|
|
25
|
+
} finally {
|
|
26
|
+
if (updating.get(indexName) === current) updating.delete(indexName);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/engine/sync-notify.ts
|
|
31
|
+
var listenersByRegistry = /* @__PURE__ */ new WeakMap();
|
|
32
|
+
function emitSyncChange(registry, change) {
|
|
33
|
+
const listeners = listenersByRegistry.get(registry);
|
|
34
|
+
if (listeners === void 0) return;
|
|
35
|
+
for (const listener of [...listeners]) listener(change);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { emitSyncChange, oneAtATime, withOpenIndex };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { newSyncEpoch } from './chunk-YJHGOJAC.mjs';
|
|
2
|
+
import { oneSyncChangeAtATime } from './chunk-5W3MMTLG.mjs';
|
|
3
|
+
import { withOpenIndex, emitSyncChange } from './chunk-ML7THVLJ.mjs';
|
|
4
|
+
import { NarsilError, ErrorCodes } from './chunk-SRMZXJSL.mjs';
|
|
5
|
+
|
|
6
|
+
// src/engine/sync/operations.ts
|
|
7
|
+
function invalidLimit(name, value) {
|
|
8
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, `The sync setting ${name} must be a positive whole number`, {
|
|
9
|
+
[name]: String(value)
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function requireSyncSetting(setting) {
|
|
13
|
+
if (setting === null || typeof setting !== "object") {
|
|
14
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "The sync setting must be an object");
|
|
15
|
+
}
|
|
16
|
+
const { enabled, historyMaxAgeMs, historyMaxBytes } = setting;
|
|
17
|
+
if (typeof enabled !== "boolean") {
|
|
18
|
+
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "The sync setting needs enabled set to true or false");
|
|
19
|
+
}
|
|
20
|
+
const isLimit = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 1;
|
|
21
|
+
if (historyMaxAgeMs !== void 0 && !isLimit(historyMaxAgeMs)) invalidLimit("historyMaxAgeMs", historyMaxAgeMs);
|
|
22
|
+
if (historyMaxBytes !== void 0 && !isLimit(historyMaxBytes)) invalidLimit("historyMaxBytes", historyMaxBytes);
|
|
23
|
+
return {
|
|
24
|
+
enabled,
|
|
25
|
+
...historyMaxAgeMs !== void 0 ? { historyMaxAgeMs } : {},
|
|
26
|
+
...historyMaxBytes !== void 0 ? { historyMaxBytes } : {}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function requireNoQuerySuggestions(state, indexName) {
|
|
30
|
+
if (state?.querySuggestions?.enabled !== true) return;
|
|
31
|
+
throw new NarsilError(
|
|
32
|
+
ErrorCodes.CONFIG_INVALID,
|
|
33
|
+
`Index "${indexName}" has popular query suggestions on, so it cannot sync to devices: a device receives the whole index of one user, while a suggestion comes from the searches of several people`,
|
|
34
|
+
{ indexName }
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function syncStorageOf(core, indexName) {
|
|
38
|
+
const storage = core.durability?.manager.syncStorage?.();
|
|
39
|
+
if (storage === void 0) {
|
|
40
|
+
throw new NarsilError(
|
|
41
|
+
ErrorCodes.SYNC_DURABILITY_REQUIRED,
|
|
42
|
+
`Index "${indexName}" needs write-ahead log durability for device sync, because the feed reads the log`,
|
|
43
|
+
{ indexName }
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
return storage;
|
|
47
|
+
}
|
|
48
|
+
async function persistSyncState(core, indexName, next) {
|
|
49
|
+
const entry = core.requireIndex(indexName);
|
|
50
|
+
const previous = entry.sync;
|
|
51
|
+
entry.sync = next;
|
|
52
|
+
try {
|
|
53
|
+
await core.durability?.manager.persistMetadata(indexName);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
entry.sync = previous;
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function updateIndexSync(core, indexName, value) {
|
|
60
|
+
const setting = requireSyncSetting(value);
|
|
61
|
+
core.requireIndex(indexName);
|
|
62
|
+
const storage = syncStorageOf(core, indexName);
|
|
63
|
+
return withOpenIndex(
|
|
64
|
+
core,
|
|
65
|
+
indexName,
|
|
66
|
+
() => oneSyncChangeAtATime(core.indexRegistry, indexName, async () => {
|
|
67
|
+
if (setting.enabled) requireNoQuerySuggestions(core.requireIndex(indexName).querySuggestions, indexName);
|
|
68
|
+
const previous = core.requireIndex(indexName).sync;
|
|
69
|
+
if (!setting.enabled) {
|
|
70
|
+
if (previous === null) return;
|
|
71
|
+
await persistSyncState(core, indexName, null);
|
|
72
|
+
await storage.release(indexName);
|
|
73
|
+
emitSyncChange(core.indexRegistry, { kind: "off", indexName });
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const limits = {
|
|
77
|
+
...setting.historyMaxAgeMs !== void 0 ? { historyMaxAgeMs: setting.historyMaxAgeMs } : {},
|
|
78
|
+
...setting.historyMaxBytes !== void 0 ? { historyMaxBytes: setting.historyMaxBytes } : {}
|
|
79
|
+
};
|
|
80
|
+
if (previous !== null) {
|
|
81
|
+
await persistSyncState(core, indexName, { ...limits, active: previous.active, epoch: previous.epoch });
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
await storage.release(indexName);
|
|
85
|
+
await persistSyncState(core, indexName, { ...limits, active: false, epoch: newSyncEpoch() });
|
|
86
|
+
})
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
async function renewWhileHeld(core, indexName) {
|
|
90
|
+
const sync = core.indexRegistry.get(indexName)?.sync ?? null;
|
|
91
|
+
if (sync === null) return;
|
|
92
|
+
await persistSyncState(core, indexName, { ...sync, active: false, epoch: newSyncEpoch() });
|
|
93
|
+
await core.durability?.manager.syncStorage?.().release(indexName);
|
|
94
|
+
emitSyncChange(core.indexRegistry, { kind: "epoch", indexName });
|
|
95
|
+
}
|
|
96
|
+
function holdRenewedSyncEpoch(core, indexName) {
|
|
97
|
+
if (core.mutationCtx.capacityScope === "partition") return Promise.resolve(() => void 0);
|
|
98
|
+
return new Promise((resolveHold, rejectHold) => {
|
|
99
|
+
void oneSyncChangeAtATime(core.indexRegistry, indexName, async () => {
|
|
100
|
+
try {
|
|
101
|
+
await renewWhileHeld(core, indexName);
|
|
102
|
+
} catch (error) {
|
|
103
|
+
rejectHold(error);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
await new Promise((release) => resolveHold(() => release()));
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export { holdRenewedSyncEpoch, requireNoQuerySuggestions, requireSyncSetting, syncStorageOf, updateIndexSync };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { RESTORED_HISTORY_FOLDER, QUERY_HISTORY_FOLDER, RESTORE_STAGING_INFIX, MAX_HISTORY_FILE_BYTES } from './chunk-7IGKGWSQ.mjs';
|
|
2
|
+
|
|
3
|
+
// src/query-suggestions/history-files.ts
|
|
4
|
+
var BUILD_RECORD_FILE = "build.nrsl";
|
|
5
|
+
var DAY_FILE = /^(\d{4}-\d{2}-\d{2})\.nrsl$/;
|
|
6
|
+
var RESTORED_FILE = /^(\d{4}-\d{2}-\d{2})-(\d{4})\.nrsl$/;
|
|
7
|
+
function historyFolderOf(indexName) {
|
|
8
|
+
return `${QUERY_HISTORY_FOLDER}/${indexName}/`;
|
|
9
|
+
}
|
|
10
|
+
function dayFileKey(indexName, day) {
|
|
11
|
+
return `${historyFolderOf(indexName)}${day}.nrsl`;
|
|
12
|
+
}
|
|
13
|
+
function restoredFileKey(indexName, day, sequence) {
|
|
14
|
+
return `${historyFolderOf(indexName)}${RESTORED_HISTORY_FOLDER}/${day}-${String(sequence).padStart(4, "0")}.nrsl`;
|
|
15
|
+
}
|
|
16
|
+
function buildRecordKey(indexName) {
|
|
17
|
+
return `${historyFolderOf(indexName)}${BUILD_RECORD_FILE}`;
|
|
18
|
+
}
|
|
19
|
+
function historyFileOf(indexName, key) {
|
|
20
|
+
const folder = historyFolderOf(indexName);
|
|
21
|
+
if (!key.startsWith(folder)) return null;
|
|
22
|
+
const rest = key.slice(folder.length);
|
|
23
|
+
const own = DAY_FILE.exec(rest);
|
|
24
|
+
if (own !== null) return { key, day: own[1], restored: false };
|
|
25
|
+
const restoredPrefix = `${RESTORED_HISTORY_FOLDER}/`;
|
|
26
|
+
if (!rest.startsWith(restoredPrefix)) return null;
|
|
27
|
+
const restored = RESTORED_FILE.exec(rest.slice(restoredPrefix.length));
|
|
28
|
+
return restored === null ? null : { key, day: restored[1], restored: true };
|
|
29
|
+
}
|
|
30
|
+
function directoryFiles(storage) {
|
|
31
|
+
const { directory } = storage;
|
|
32
|
+
return {
|
|
33
|
+
listUnder: (prefix) => directory.list(prefix),
|
|
34
|
+
async read(key) {
|
|
35
|
+
const length = await directory.byteLength?.(key) ?? null;
|
|
36
|
+
if (length !== null && length > MAX_HISTORY_FILE_BYTES) return "too-long";
|
|
37
|
+
const bytes = await directory.read(key);
|
|
38
|
+
if (bytes !== null && bytes.byteLength > MAX_HISTORY_FILE_BYTES) return "too-long";
|
|
39
|
+
return bytes;
|
|
40
|
+
},
|
|
41
|
+
write: (key, bytes) => directory.atomicWrite(key, bytes),
|
|
42
|
+
remove: (key) => directory.remove(key)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function adapterFiles(storage) {
|
|
46
|
+
const { adapter } = storage;
|
|
47
|
+
return {
|
|
48
|
+
listUnder: (prefix) => adapter.list(prefix),
|
|
49
|
+
async read(key) {
|
|
50
|
+
const bytes = await adapter.load(key);
|
|
51
|
+
if (bytes !== null && bytes.byteLength > MAX_HISTORY_FILE_BYTES) return "too-long";
|
|
52
|
+
return bytes;
|
|
53
|
+
},
|
|
54
|
+
write: (key, bytes) => adapter.save(key, bytes),
|
|
55
|
+
remove: (key) => adapter.delete(key)
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function memoryFiles() {
|
|
59
|
+
const files = /* @__PURE__ */ new Map();
|
|
60
|
+
return {
|
|
61
|
+
async listUnder(prefix) {
|
|
62
|
+
return [...files.keys()].filter((key) => key.startsWith(prefix)).sort();
|
|
63
|
+
},
|
|
64
|
+
async read(key) {
|
|
65
|
+
return files.get(key) ?? null;
|
|
66
|
+
},
|
|
67
|
+
async write(key, bytes) {
|
|
68
|
+
files.set(key, bytes);
|
|
69
|
+
},
|
|
70
|
+
async remove(key) {
|
|
71
|
+
files.delete(key);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function historyFilesOf(storage) {
|
|
76
|
+
if (storage === null) return memoryFiles();
|
|
77
|
+
return storage.kind === "directory" ? directoryFiles(storage) : adapterFiles(storage);
|
|
78
|
+
}
|
|
79
|
+
function listHistoryFolder(files, indexName) {
|
|
80
|
+
return files.listUnder(historyFolderOf(indexName));
|
|
81
|
+
}
|
|
82
|
+
async function removeHistoryFolder(files, indexName) {
|
|
83
|
+
for (const key of await listHistoryFolder(files, indexName)) await files.remove(key);
|
|
84
|
+
}
|
|
85
|
+
function restoreStagingPrefix() {
|
|
86
|
+
return `${QUERY_HISTORY_FOLDER}/${RESTORE_STAGING_INFIX}${globalThis.crypto.randomUUID()}/`;
|
|
87
|
+
}
|
|
88
|
+
async function removeRestoreLeftovers(files) {
|
|
89
|
+
for (const key of await files.listUnder(`${QUERY_HISTORY_FOLDER}/${RESTORE_STAGING_INFIX}`)) await files.remove(key);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { buildRecordKey, dayFileKey, historyFileOf, historyFilesOf, listHistoryFolder, removeHistoryFolder, removeRestoreLeftovers, restoreStagingPrefix, restoredFileKey };
|
|
@@ -40,24 +40,4 @@ function fnv1a(input) {
|
|
|
40
40
|
return fnv1aBytes(encoder.encode(input));
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
var nextRequestSequence = 0;
|
|
45
|
-
function createRequestId() {
|
|
46
|
-
nextRequestSequence += 1;
|
|
47
|
-
return String(nextRequestSequence);
|
|
48
|
-
}
|
|
49
|
-
function isValidWorkerResponse(msg) {
|
|
50
|
-
if (msg === null || msg === void 0 || typeof msg !== "object") {
|
|
51
|
-
return false;
|
|
52
|
-
}
|
|
53
|
-
const candidate = msg;
|
|
54
|
-
if (typeof candidate.requestId !== "string") {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
if (candidate.type !== "success" && candidate.type !== "error") {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export { FNV_OFFSET_BASIS, createRequestId, fnv1a, fnv1aContinue, fnv1aContinueTaggedNumbers, isValidWorkerResponse };
|
|
43
|
+
export { FNV_OFFSET_BASIS, fnv1a, fnv1aContinue, fnv1aContinueTaggedNumbers };
|