@delali/narsil 0.3.1-next.154 → 0.3.1-next.156
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/NOTICE +45 -0
- package/README.md +1 -0
- 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-4GCRVRBW.mjs → analysis-change-5BQOQ4BF.mjs} +35 -28
- package/dist/{react-native/chunks/analysis-change-entry-TNLUC6IZ.mjs → analysis-change-entry-TXX6JSMX.mjs} +1 -1
- package/dist/archive-history-E4R73RWD.mjs +29 -0
- package/dist/browser/{analysis-change-IXWPXXJJ.mjs → analysis-change-435CUEPZ.mjs} +32 -12
- package/dist/{analysis-change-entry-KYGSXW4K.mjs → browser/analysis-change-entry-HZXKPPGV.mjs} +1 -1
- package/dist/browser/archive-history-4IP5XQZY.mjs +29 -0
- package/dist/browser/{chunk-4PD752F6.mjs → chunk-23XRXIBW.mjs} +1 -1
- package/dist/browser/{chunk-J433A7P3.mjs → chunk-2CFI5VVV.mjs} +5 -5
- package/dist/{react-native/chunks/chunk-3XKMRNRE.mjs → browser/chunk-2TI4SSUP.mjs} +27 -10
- package/dist/browser/chunk-3SSRJMFN.mjs +100 -0
- package/dist/browser/{chunk-2SHAKW2Z.mjs → chunk-3V7DNNZL.mjs} +515 -733
- package/dist/browser/{chunk-C4KS2QNF.mjs → chunk-4NGKC4H4.mjs} +9 -9
- package/dist/browser/{chunk-XRV72TJD.mjs → chunk-6LWDPLTB.mjs} +2 -2
- package/dist/browser/chunk-7IGKGWSQ.mjs +79 -0
- package/dist/browser/{chunk-VCOYGVP7.mjs → chunk-7U3WVJUP.mjs} +3 -3
- package/dist/browser/chunk-ATEBYXP6.mjs +10 -0
- package/dist/browser/chunk-BHFQATSC.mjs +432 -0
- package/dist/browser/chunk-CRE3G7F3.mjs +1007 -0
- package/dist/browser/{chunk-QXTPSX2H.mjs → chunk-EA63E3D2.mjs} +7 -7
- package/dist/{react-native/chunks/chunk-DCKMICOB.mjs → browser/chunk-EXQZGUQH.mjs} +1 -1
- package/dist/browser/{chunk-ML6HY7T7.mjs → chunk-G64Q6OJF.mjs} +1 -1
- package/dist/browser/chunk-GPPOG6PT.mjs +9 -0
- package/dist/browser/{chunk-EUNBNLKM.mjs → chunk-IZXVW2ZJ.mjs} +5 -5
- package/dist/browser/{chunk-G7LUMBSG.mjs → chunk-K4Q6KX3R.mjs} +30 -20
- package/dist/browser/{chunk-H6QFBMVE.mjs → chunk-KZWSX6BH.mjs} +3 -3
- package/dist/browser/chunk-M3MQE2X7.mjs +151 -0
- package/dist/browser/chunk-MGI4BCXC.mjs +63 -0
- package/dist/browser/chunk-MOG4OVDK.mjs +51 -0
- package/dist/browser/{chunk-W5X2UFWQ.mjs → chunk-NLWTBAGB.mjs} +12 -3
- package/dist/browser/{chunk-AYY6PIKL.mjs → chunk-NQAME3RK.mjs} +2 -2
- package/dist/browser/{chunk-7MEYN7V6.mjs → chunk-NXQG7DRA.mjs} +29 -14
- package/dist/browser/chunk-OEDCEZXJ.mjs +92 -0
- package/dist/{chunk-KUZKUONM.mjs → browser/chunk-SRMZXJSL.mjs} +1 -0
- package/dist/browser/chunk-SSTPBZZX.mjs +1106 -0
- package/dist/browser/{chunk-7TTWXUH6.mjs → chunk-STOWQFT3.mjs} +3 -2
- package/dist/browser/{chunk-26A5JFT2.mjs → chunk-TK63WFXK.mjs} +2 -1
- package/dist/browser/{chunk-SJB6VIZG.mjs → chunk-U3JOQGWX.mjs} +1 -1
- package/dist/browser/{chunk-AJ4HHOVT.mjs → chunk-U4YDIBUT.mjs} +4 -4
- package/dist/browser/{chunk-2FX6ROWR.mjs → chunk-VLJQW4J6.mjs} +2986 -2986
- package/dist/{react-native/chunks/chunk-3O57C2ZO.mjs → browser/chunk-WI4MR75E.mjs} +2 -2
- package/dist/browser/{chunk-3U3QR5YP.mjs → chunk-WN464PTL.mjs} +2 -2
- package/dist/browser/{chunk-U2E3HMYW.mjs → chunk-XAWNZ4G2.mjs} +11 -11
- package/dist/browser/{cold-module-VTUGDYNY.mjs → cold-module-2EHCIV4K.mjs} +20 -18
- package/dist/browser/durability-config-TIYKW6XX.mjs +89 -0
- package/dist/browser/{durability-wiring-GL4A7KDV.mjs → durability-wiring-A7BVG2DW.mjs} +50 -153
- package/dist/browser/engine-hooks-E4UD67JD.mjs +17 -0
- package/dist/browser/geo-index-HHWGMNIS.mjs +1386 -0
- package/dist/browser/import-DXYB6756.mjs +19 -0
- package/dist/browser/{methods-LMUTS7OI.mjs → methods-KTQCSIN4.mjs} +3 -3
- package/dist/browser/{module-M4JNBV6V.mjs → module-NIYMEA5R.mjs} +16 -14
- package/dist/browser/{module-EC3FYW7N.mjs → module-TCT66FWA.mjs} +10 -9
- package/dist/browser/operations-OJ3BXS55.mjs +5 -0
- package/dist/browser/{phrase-module-NPYUVX75.mjs → phrase-module-HAT3TLZN.mjs} +2 -2
- package/dist/browser/{pool-WCGDZHJP.mjs → pool-3JLET5RO.mjs} +1 -1
- package/dist/browser/restore-hooks-YPN4ZFCY.mjs +114 -0
- package/dist/browser/restore-queue-G3RQGL3Y.mjs +55 -0
- package/dist/browser/{retention-6QMRS5VK.mjs → retention-ZWVMNC3Q.mjs} +18 -15
- package/dist/browser/{runtime-3EW2AGB6.mjs → runtime-OTAGEFQW.mjs} +1 -1
- package/dist/browser/{snapshot-DN3CRVUQ.mjs → snapshot-VEQNIE6C.mjs} +71 -36
- package/dist/browser/start-BM442C6R.mjs +25 -0
- package/dist/browser/{write-WAWAFGKQ.mjs → write-2EVMZWDE.mjs} +16 -14
- package/dist/{capabilities-B3Brs1Rc.d.ts → capabilities-Da4ywVVl.d.ts} +35 -3
- package/dist/{chunk-K4B7OH65.mjs → chunk-25KDNIZZ.mjs} +2 -2
- package/dist/{chunk-O43Z4MS6.mjs → chunk-2NE7VCYE.mjs} +2 -2
- package/dist/chunk-2UV4QBHW.mjs +1092 -0
- package/dist/{chunk-3Y3J4V2R.mjs → chunk-3C7MTCCI.mjs} +1 -1
- package/dist/{chunk-TRISKD4Q.mjs → chunk-3HYC4JRF.mjs} +2 -2
- package/dist/{chunk-HVYICDY3.mjs → chunk-3OH67G7R.mjs} +1 -1
- package/dist/{chunk-PFKM7VNZ.mjs → chunk-46KY2PJD.mjs} +30 -11
- package/dist/{chunk-IJU7LL7D.mjs → chunk-4KKXNJM6.mjs} +5 -5
- package/dist/{chunk-IQ4R2I6N.mjs → chunk-5FLRXF73.mjs} +5 -1
- package/dist/{chunk-BPSKLCS7.mjs → chunk-5VV4R6P7.mjs} +3017 -3017
- package/dist/chunk-5YNRKI2C.mjs +81 -0
- package/dist/chunk-6HTGOXIK.mjs +875 -0
- package/dist/{chunk-7HCZWC7B.mjs → chunk-6I6AYAXS.mjs} +50 -8
- package/dist/{chunk-C6ASEFZI.mjs → chunk-6OEGXLBX.mjs} +1 -1
- package/dist/{chunk-DVWYODEB.mjs → chunk-6RC4K46J.mjs} +2 -2
- package/dist/chunk-7GFE3PEY.mjs +40 -0
- package/dist/{chunk-QKZHLADX.mjs → chunk-7LXHHCXZ.mjs} +28 -19
- package/dist/{chunk-JUKYYXSP.mjs → chunk-7V5IUP2T.mjs} +1 -31
- package/dist/{react-native/chunks/chunk-7GWPJDOA.mjs → chunk-A4L7YTKX.mjs} +53 -90
- package/dist/{chunk-Z3TNWCI5.mjs → chunk-BU4SAIC4.mjs} +3 -3
- package/dist/chunk-BWZ3P4MU.mjs +20 -0
- package/dist/{chunk-OKX2BBNW.mjs → chunk-CITFCZKF.mjs} +5 -4
- package/dist/{chunk-4HWZV5MK.mjs → chunk-CSLGFPFQ.mjs} +5 -5
- package/dist/chunk-DP5C7YFQ.mjs +543 -0
- package/dist/{chunk-RVKFI3A2.mjs → chunk-DWEPMFJE.mjs} +11 -8
- package/dist/{chunk-LSM2YTKM.mjs → chunk-EFBDHH5P.mjs} +87 -144
- package/dist/{chunk-NZMAXR2S.mjs → chunk-FAKFUDZZ.mjs} +121 -11
- package/dist/chunk-FB6463IN.mjs +1499 -0
- package/dist/{chunk-REL7LFLR.mjs → chunk-FCJ553HS.mjs} +3 -3
- package/dist/{chunk-MMEMEUOO.mjs → chunk-FJKKCV4D.mjs} +2 -2
- package/dist/{chunk-K7KLL263.mjs → chunk-FNGAM5B7.mjs} +14 -13
- package/dist/{chunk-DMQPFLGI.mjs → chunk-FRBFVQFN.mjs} +6 -5
- package/dist/{chunk-IBNLW3AV.mjs → chunk-FYOVBEMM.mjs} +20 -6
- package/dist/chunk-G6HRSGOU.mjs +74 -0
- package/dist/{chunk-USR7FQRZ.mjs → chunk-GH4WQ22V.mjs} +2 -2
- package/dist/chunk-GQPTDQCL.mjs +54 -0
- package/dist/{chunk-VREK3MYG.mjs → chunk-HFPMMRQT.mjs} +3 -3
- package/dist/{chunk-MLHNSAPK.mjs → chunk-HHBUCIUY.mjs} +3 -3
- package/dist/{chunk-YROWNOMH.mjs → chunk-HJJI72X7.mjs} +1 -1
- package/dist/{chunk-ECX4SGX6.mjs → chunk-I2KPOLOZ.mjs} +9 -9
- package/dist/{chunk-TV2L3BN7.mjs → chunk-I53G4JAU.mjs} +266 -265
- package/dist/{chunk-3A5KI24C.mjs → chunk-I54T6CQP.mjs} +1 -1
- package/dist/{chunk-NTZOXVUZ.mjs → chunk-I5B7RXU7.mjs} +93 -24
- package/dist/{chunk-YBJDOA2T.mjs → chunk-INJYO3BU.mjs} +1 -1
- package/dist/{react-native/chunks/chunk-KWRW5U65.mjs → chunk-J4IJTTEX.mjs} +1 -1
- package/dist/{chunk-X6NSJYQ3.mjs → chunk-JDJBQLRO.mjs} +13 -13
- package/dist/{chunk-MMBEANB2.mjs → chunk-JWRUUCWD.mjs} +3 -3
- package/dist/{chunk-AO2FAYIZ.mjs → chunk-K4ZIGL2O.mjs} +1 -1
- package/dist/{chunk-JFNKIBDT.mjs → chunk-K5QFDYST.mjs} +2 -2
- package/dist/{chunk-C73JLU4E.mjs → chunk-KF4EXSM4.mjs} +2 -2
- package/dist/{chunk-WCBA2LVZ.mjs → chunk-KHKIRS5D.mjs} +1 -1
- package/dist/{chunk-7QUGDVFC.mjs → chunk-KJ3RTZDJ.mjs} +1 -1
- package/dist/{chunk-HVKXNBFL.mjs → chunk-KKQC526K.mjs} +20 -12
- package/dist/chunk-KP7TYHWT.mjs +92 -0
- package/dist/{chunk-VMXSVVXG.mjs → chunk-L6V6BST3.mjs} +9 -22
- package/dist/{chunk-URPCYQVJ.mjs → chunk-LHKOSI2J.mjs} +1 -1
- package/dist/chunk-LNGE7SLY.mjs +151 -0
- package/dist/{react-native/chunks/chunk-CUNGPR5R.mjs → chunk-MP7ABPTD.mjs} +1 -0
- package/dist/{chunk-5KGYQT6W.mjs → chunk-MQOJIO5B.mjs} +26 -9
- package/dist/{chunk-Q3TCTQCC.mjs → chunk-NF4DT3IH.mjs} +1 -1
- package/dist/{chunk-3OFU3NJT.mjs → chunk-OIJ64LGT.mjs} +1 -1
- package/dist/chunk-ORN5BLL7.mjs +11 -0
- package/dist/{chunk-HWEDFLB7.mjs → chunk-P5ZI2P2W.mjs} +126 -1701
- package/dist/{chunk-466PYR4P.mjs → chunk-PWC4VB3Q.mjs} +2 -2
- package/dist/{chunk-B7S6YEBP.mjs → chunk-QJVOLKU6.mjs} +12 -3
- package/dist/{chunk-KCUIFVVW.mjs → chunk-QOW2JPUI.mjs} +9 -9
- package/dist/chunk-RDXO6JST.mjs +63 -0
- package/dist/chunk-RLOES5SX.mjs +31 -0
- package/dist/{chunk-YPUEV6ZC.mjs → chunk-RVGRFOGN.mjs} +1 -1
- package/dist/{chunk-JCLTESFN.mjs → chunk-RZWWB2XR.mjs} +1 -1
- package/dist/chunk-S5LN746F.mjs +10 -0
- package/dist/chunk-SA5LOGO3.mjs +470 -0
- package/dist/chunk-SQJWAIF4.mjs +12 -0
- package/dist/{chunk-YTJCGKM4.mjs → chunk-TBC3XUL2.mjs} +29 -6
- package/dist/chunk-TDIK6NTV.mjs +10 -0
- package/dist/chunk-TGS5UXBE.mjs +216 -0
- package/dist/{chunk-CP5RRPJR.mjs → chunk-TQXHPFWT.mjs} +1 -1
- package/dist/{chunk-7NTMUDC5.mjs → chunk-TZ3355VS.mjs} +5 -5
- package/dist/{chunk-Q7MS6P2J.mjs → chunk-TZTRKM33.mjs} +2 -2
- package/dist/{chunk-4UMZ7KQL.mjs → chunk-U55XJEIG.mjs} +2 -1
- package/dist/{chunk-S2N75OTN.mjs → chunk-UHICS3JI.mjs} +1 -1
- package/dist/{chunk-5FUOVJKG.mjs → chunk-VTTRFF2C.mjs} +32 -19
- package/dist/{chunk-62G63NMH.mjs → chunk-WX4LAO6M.mjs} +4 -4
- package/dist/{chunk-LTUGDMV4.mjs → chunk-WZ7YV54N.mjs} +1 -1
- package/dist/chunk-XAXKV65G.mjs +72 -0
- package/dist/chunk-XXHN7J46.mjs +101 -0
- package/dist/{chunk-PGVPE7GJ.mjs → chunk-YEKL4JBK.mjs} +1 -1
- package/dist/chunk-YTWZVGCB.mjs +382 -0
- package/dist/chunk-Z2KAFCRT.mjs +30 -0
- package/dist/{chunk-LKUE5GXS.mjs → chunk-ZKP7G7TV.mjs} +2 -2
- package/dist/{client-Df76GNKm.d.ts → client-DRv7UVeY.d.ts} +123 -11
- package/dist/client.d.ts +9 -8
- package/dist/client.mjs +65 -3
- package/dist/{cold-module-YLWMTTZG.mjs → cold-module-6MO2XJF2.mjs} +45 -39
- package/dist/{config-B8DP2VwR.d.ts → config-CoSig5Ox.d.ts} +22 -3
- package/dist/{config-05G_hy-1.d.ts → config-DMwffLKn.d.ts} +20 -5
- package/dist/direct-executor-FTMYY3TI.mjs +34 -0
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +3 -3
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/coordinator/in-memory.mjs +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 +8 -8
- package/dist/distribution.mjs +6799 -5939
- package/dist/durability-config-GE4U7MCZ.mjs +89 -0
- package/dist/{durability-wiring-RHLXDIVF.mjs → durability-wiring-VIF5MOSY.mjs} +82 -179
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{sync-uXR7MmM7.d.ts → engine-CFxPYqEk.d.ts} +702 -2
- package/dist/engine-hooks-EGUGNZYE.mjs +54 -0
- package/dist/geo-index-MRH5JMIR.mjs +1387 -0
- package/dist/import-XKDPJQDP.mjs +56 -0
- package/dist/{index-nRqDM6uS.d.ts → index-C4AmUnl1.d.ts} +1 -1
- package/dist/index.browser.mjs +9 -7
- package/dist/index.d.ts +134 -9
- package/dist/index.mjs +33 -26
- package/dist/index.react-native.mjs +20 -17
- package/dist/invalidation/filesystem.mjs +2 -2
- package/dist/{long-query-thread-EMYTGSJP.mjs → long-query-thread-YA4IAYSY.mjs} +34 -28
- package/dist/{methods-ABM5ELBR.mjs → methods-7IOINERF.mjs} +3 -3
- package/dist/{module-MG7JMV2U.mjs → module-FQ4JWNQJ.mjs} +41 -34
- package/dist/{module-3OMJZUFT.mjs → module-N55W4Q5C.mjs} +14 -14
- package/dist/operations-G5EP6JPX.mjs +5 -0
- package/dist/{paged-partition-archive-UOLHOEZJ.mjs → paged-partition-archive-PXW5XAYU.mjs} +48 -38
- package/dist/partial-words.mjs +11 -9
- package/dist/pattern.mjs +6 -5
- package/dist/persistence/durability/checkpoint-worker.d.ts +8 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +44 -35
- package/dist/{phrase-module-O3MDRQXP.mjs → phrase-module-XW5MKWP5.mjs} +4 -3
- package/dist/{pool-CQXYPFLG.mjs → pool-Y4A46T36.mjs} +1 -1
- package/dist/query-suggestions/merge-worker.d.ts +55 -0
- package/dist/query-suggestions/merge-worker.mjs +88 -0
- package/dist/query-suggestions-CBYkrQ5T.d.ts +311 -0
- package/dist/query-suggestions.browser.mjs +247 -0
- package/dist/query-suggestions.d.ts +20 -0
- package/dist/query-suggestions.mjs +69 -0
- package/dist/react-native/chunks/{analysis-change-EAYO3Y6Q.mjs → analysis-change-LT5QBQ3H.mjs} +43 -22
- package/dist/{browser/analysis-change-entry-FCSHFQSS.mjs → react-native/chunks/analysis-change-entry-SCVWK6OU.mjs} +1 -1
- package/dist/react-native/chunks/archive-history-MJKUQLSU.mjs +29 -0
- package/dist/{chunk-ZIFJXCKA.mjs → react-native/chunks/chunk-2PRHILX3.mjs} +54 -20
- package/dist/react-native/chunks/{chunk-VQSKZ3EZ.mjs → chunk-3JWDECAZ.mjs} +8 -8
- package/dist/{chunk-R6A773WK.mjs → react-native/chunks/chunk-3WI35N75.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-75VWIY35.mjs → chunk-4DII3ZSM.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-NKIZX26F.mjs → chunk-4J74WHQM.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-UWDNZDWK.mjs → chunk-4JYO3JD2.mjs} +6 -6
- 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-SJWDBRNP.mjs → chunk-6WA3C3DV.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-OQQVRWZ2.mjs → chunk-C5G6TJ7A.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-RVAEBN74.mjs → chunk-CKNRFDTZ.mjs} +1 -1
- package/dist/react-native/chunks/chunk-DIYDOIM4.mjs +10 -0
- package/dist/react-native/chunks/{chunk-O32RB3BL.mjs → chunk-DNXOMPAQ.mjs} +4 -4
- package/dist/react-native/chunks/{chunk-YBEW6YTR.mjs → chunk-DVDX4SDR.mjs} +2 -2
- package/dist/react-native/chunks/chunk-DXRSEWA2.mjs +12 -0
- package/dist/{browser/chunk-MYITLCHT.mjs → react-native/chunks/chunk-DZ7H7D2C.mjs} +1 -0
- package/dist/react-native/chunks/{chunk-PPEPTUVV.mjs → chunk-EJ33LCHV.mjs} +29 -6
- package/dist/react-native/chunks/{chunk-RYMDHGL4.mjs → chunk-ENLMYKSX.mjs} +3045 -3075
- package/dist/react-native/chunks/chunk-FHPW7P2O.mjs +40 -0
- package/dist/react-native/chunks/{chunk-JV6VQY2S.mjs → chunk-FTZHMRD2.mjs} +2 -1
- package/dist/react-native/chunks/{chunk-YHKZSLOC.mjs → chunk-G43IPIDG.mjs} +5 -5
- package/dist/react-native/chunks/{chunk-AUT7PMA4.mjs → chunk-GXX3DQXP.mjs} +8 -22
- package/dist/react-native/chunks/chunk-H3MDVPBO.mjs +151 -0
- package/dist/react-native/chunks/{chunk-DH3TVWWK.mjs → chunk-IYNT75CE.mjs} +12 -3
- package/dist/react-native/chunks/chunk-KV46CT4D.mjs +1007 -0
- package/dist/{browser/chunk-ZPTA75ZC.mjs → react-native/chunks/chunk-LZSLNSUN.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-63YSZOXB.mjs → chunk-MIP4SOR6.mjs} +1480 -826
- package/dist/react-native/chunks/{chunk-ZBSWRSBG.mjs → chunk-MJDQU5MW.mjs} +1 -1
- package/dist/react-native/chunks/{chunk-GFYFQLJD.mjs → chunk-MUWD2H2S.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-IOY2SM2P.mjs → chunk-MVXELMJX.mjs} +1 -1
- package/dist/{browser/chunk-TTD27VXX.mjs → react-native/chunks/chunk-NB3LP33V.mjs} +27 -10
- package/dist/react-native/chunks/{chunk-I5PGWQJF.mjs → chunk-PDRWWPKV.mjs} +33 -24
- package/dist/react-native/chunks/chunk-PJHAB5ZY.mjs +79 -0
- package/dist/react-native/chunks/{chunk-2CGSQM4O.mjs → chunk-POPDAGH6.mjs} +13 -13
- package/dist/react-native/chunks/{chunk-NP7DD4G5.mjs → chunk-QUKQNI3H.mjs} +5 -5
- package/dist/react-native/chunks/{chunk-EH5CFV6Z.mjs → chunk-RDWG33MM.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-JX2RIAXH.mjs → chunk-SK2PWYDH.mjs} +5 -5
- package/dist/react-native/chunks/{chunk-ZYDKJXQJ.mjs → chunk-SUPXRTMD.mjs} +1 -1
- package/dist/react-native/chunks/chunk-TP6KCKER.mjs +63 -0
- package/dist/react-native/chunks/{chunk-JPAJWO6D.mjs → chunk-U4KSKA4Z.mjs} +1 -1
- package/dist/react-native/chunks/chunk-UQ4OAXKU.mjs +1106 -0
- package/dist/react-native/chunks/{chunk-VVFYOADG.mjs → chunk-VWUDIOT6.mjs} +6 -6
- package/dist/{browser/chunk-SIR3LMTV.mjs → react-native/chunks/chunk-WBYQRHDY.mjs} +2 -2
- package/dist/react-native/chunks/{chunk-C2H2QQFW.mjs → chunk-YH7QY657.mjs} +3 -3
- package/dist/react-native/chunks/{chunk-NCJS3WIY.mjs → chunk-YZW4CHM6.mjs} +51 -12
- package/dist/react-native/chunks/chunk-ZLWVW734.mjs +100 -0
- package/dist/react-native/chunks/chunk-ZXZFN7FI.mjs +432 -0
- package/dist/react-native/chunks/chunk-ZZT7CEN7.mjs +92 -0
- package/dist/react-native/chunks/{cold-module-TJL6AFAD.mjs → cold-module-KVZYUGRY.mjs} +31 -28
- package/dist/react-native/chunks/durability-config-QXVZEO7T.mjs +89 -0
- package/dist/react-native/chunks/{durability-wiring-RRDYJLLM.mjs → durability-wiring-34OYO32E.mjs} +60 -162
- package/dist/react-native/chunks/engine-hooks-M7JV46NH.mjs +30 -0
- package/dist/react-native/chunks/geo-index-PX3BIHAH.mjs +1387 -0
- package/dist/react-native/chunks/gzip.react-native-HLEPDKZ3.mjs +3 -0
- package/dist/react-native/chunks/import-H6AQREWI.mjs +32 -0
- package/dist/react-native/chunks/{methods-X6F36SJE.mjs → methods-6W5U4C3H.mjs} +3 -3
- package/dist/react-native/chunks/module-LBZPGOWH.mjs +36 -0
- package/dist/react-native/chunks/{module-S4DKSWMF.mjs → module-TTEVPRCW.mjs} +14 -13
- package/dist/react-native/chunks/operations-GNRMD6EX.mjs +5 -0
- package/dist/react-native/chunks/{phrase-module-JZ37TB7N.mjs → phrase-module-QK22HSQ2.mjs} +2 -2
- package/dist/react-native/chunks/{pool-RTGXJXPU.mjs → pool-JR3NJCAF.mjs} +1 -1
- package/dist/react-native/chunks/restore-hooks-IBGIY3DR.mjs +127 -0
- package/dist/react-native/chunks/restore-queue-ZZX54AH7.mjs +55 -0
- package/dist/react-native/chunks/{retention-PPCTP2VY.mjs → retention-EW4TTDFB.mjs} +29 -25
- package/dist/react-native/chunks/{runtime-KUATOLYB.mjs → runtime-R5E3TB3J.mjs} +1 -1
- package/dist/react-native/chunks/{snapshot-ZBIEOZTZ.mjs → snapshot-REYVIN3X.mjs} +80 -44
- package/dist/react-native/chunks/start-BQK6KN3R.mjs +38 -0
- package/dist/react-native/chunks/{write-2W4FTX7J.mjs → write-FQAYCZF5.mjs} +27 -24
- package/dist/react-native/partial-words.mjs +11 -9
- package/dist/react-native/pattern.mjs +4 -4
- package/dist/react-native/query-suggestions.mjs +260 -0
- package/dist/react-native/sync.mjs +78 -15
- package/dist/react-native/synonyms.mjs +95 -27
- package/dist/react.d.ts +11 -11
- package/dist/react.mjs +1 -0
- package/dist/{rerank-IZOB6NII.mjs → rerank-MQ37IYRV.mjs} +4 -4
- package/dist/rerankers/http.mjs +2 -2
- package/dist/restore-hooks-CDERDEF4.mjs +153 -0
- package/dist/restore-queue-7NNSTROA.mjs +55 -0
- package/dist/retention-QSVBBNRM.mjs +66 -0
- package/dist/{runtime-UZOC3NPY.mjs → runtime-COIUORCN.mjs} +5 -5
- package/dist/{schema-DDauvDOv.d.ts → schema-Jwt928nJ.d.ts} +1 -1
- package/dist/server.d.ts +108 -12
- package/dist/server.mjs +303 -50
- package/dist/{snapshot-NFX2EYN2.mjs → snapshot-RH4NSKIZ.mjs} +98 -61
- package/dist/start-MCKCOGIW.mjs +66 -0
- package/dist/sync/filesystem.d.ts +4 -4
- package/dist/sync/filesystem.mjs +6 -6
- package/dist/sync/indexeddb.d.ts +4 -4
- package/dist/sync/indexeddb.mjs +2 -2
- package/dist/sync.browser.mjs +74 -11
- package/dist/sync.d.ts +5 -5
- package/dist/sync.mjs +78 -16
- package/dist/synonyms.mjs +9 -8
- package/dist/{tasks-BShx8pdK.d.ts → tasks-qrJojgST.d.ts} +13 -5
- package/dist/thread-O4SBJJJS.mjs +50 -0
- package/dist/{types-SnO7_tAI.d.ts → types-BZCGjfLn.d.ts} +2 -3
- package/dist/vector/search-worker.d.ts +1 -1
- package/dist/vector/search-worker.mjs +8 -8
- package/dist/workers/entry.mjs +19 -8
- package/dist/{write-FGB62BHQ.mjs → write-3FK7NG3Y.mjs} +40 -33
- package/openapi.json +798 -7
- package/package.json +32 -8
- package/dist/browser/import-YI5GNB4H.mjs +0 -17
- package/dist/browser/operations-WVYLF72Q.mjs +0 -5
- package/dist/browser/restore-queue-TYIGDL5L.mjs +0 -41
- package/dist/chunk-37IVJLP6.mjs +0 -44
- package/dist/chunk-DJHHF2L5.mjs +0 -17
- package/dist/direct-executor-FI5GJHWX.mjs +0 -29
- package/dist/engine-DYu-e0oR.d.ts +0 -674
- package/dist/import-SRBNC6TE.mjs +0 -49
- package/dist/operations-PGOAY2KS.mjs +0 -5
- package/dist/react-native/chunks/chunk-TJMSKBEM.mjs +0 -25
- package/dist/react-native/chunks/gzip.react-native-DNB5YNFA.mjs +0 -3
- package/dist/react-native/chunks/import-JYBMEJPQ.mjs +0 -29
- package/dist/react-native/chunks/module-QT5HZAY4.mjs +0 -33
- package/dist/react-native/chunks/operations-RYKTSZQA.mjs +0 -5
- package/dist/react-native/chunks/restore-queue-ZBVIKJWI.mjs +0 -41
- package/dist/restore-queue-COI2GSSK.mjs +0 -41
- package/dist/retention-55WA7GPU.mjs +0 -58
- package/dist/thread-P2G2FWM2.mjs +0 -44
|
@@ -16,17 +16,40 @@ function exceedsCodePoints(value, maximum) {
|
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
18
18
|
var SURROGATE_UNIT = /[\ud800-\udfff]/;
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
var REPLACEMENT_CHARACTER = "\uFFFD";
|
|
20
|
+
function firstUnpairedSurrogate(value) {
|
|
21
21
|
for (let i = 0; i < value.length; i++) {
|
|
22
22
|
const unit = value.charCodeAt(i);
|
|
23
23
|
if (unit < 55296 || unit >= 57344) continue;
|
|
24
|
-
if (unit >= 56320) return
|
|
24
|
+
if (unit >= 56320) return i;
|
|
25
25
|
const low = value.charCodeAt(i + 1);
|
|
26
|
-
if (!(low >= 56320 && low < 57344)) return
|
|
26
|
+
if (!(low >= 56320 && low < 57344)) return i;
|
|
27
27
|
i++;
|
|
28
28
|
}
|
|
29
|
-
return
|
|
29
|
+
return -1;
|
|
30
|
+
}
|
|
31
|
+
function holdsUnpairedSurrogate(value) {
|
|
32
|
+
return SURROGATE_UNIT.test(value) && firstUnpairedSurrogate(value) >= 0;
|
|
33
|
+
}
|
|
34
|
+
function withUnpairedSurrogatesReplaced(value) {
|
|
35
|
+
const first = firstUnpairedSurrogate(value);
|
|
36
|
+
if (first < 0) return value;
|
|
37
|
+
let repaired = value.slice(0, first);
|
|
38
|
+
for (let i = first; i < value.length; i++) {
|
|
39
|
+
const unit = value.charCodeAt(i);
|
|
40
|
+
if (unit < 55296 || unit >= 57344) {
|
|
41
|
+
repaired += value[i];
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const low = value.charCodeAt(i + 1);
|
|
45
|
+
if (unit < 56320 && low >= 56320 && low < 57344) {
|
|
46
|
+
repaired += value.slice(i, i + 2);
|
|
47
|
+
i++;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
repaired += REPLACEMENT_CHARACTER;
|
|
51
|
+
}
|
|
52
|
+
return repaired;
|
|
30
53
|
}
|
|
31
54
|
function codePointCount(value) {
|
|
32
55
|
let counted = 0;
|
|
@@ -53,4 +76,4 @@ function compareCodePoints(a, b) {
|
|
|
53
76
|
return adjustUtf16Unit(a.charCodeAt(i)) - adjustUtf16Unit(b.charCodeAt(i));
|
|
54
77
|
}
|
|
55
78
|
|
|
56
|
-
export { codePointCount, compareCodePoints, exceedsCodePoints, holdsUnpairedSurrogate };
|
|
79
|
+
export { codePointCount, compareCodePoints, exceedsCodePoints, holdsUnpairedSurrogate, withUnpairedSurrogatesReplaced };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { codeLoader } from './chunk-FB6463IN.mjs';
|
|
2
|
+
|
|
3
|
+
// src/workers/vector-code.ts
|
|
4
|
+
var vectorCode = codeLoader(() => import('./module-N55W4Q5C.mjs'), "vector");
|
|
5
|
+
var loadedVectorCode = vectorCode.loaded;
|
|
6
|
+
var requireLoadedVectorCode = vectorCode.require;
|
|
7
|
+
var loadVectorCode = vectorCode.load;
|
|
8
|
+
var loadVectorCodeFor = vectorCode.loadFor;
|
|
9
|
+
|
|
10
|
+
export { loadVectorCode, loadVectorCodeFor, loadedVectorCode, requireLoadedVectorCode };
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { suggestionsIndexName, markedSuggestionIndexes, ensureSuggestionsIndex, suggestionDocument, ORIGIN_MANUAL, removeSuggestions, enabledSetting, mergeHistory, groupsToWrite, meetsMinResults } from './chunk-2UV4QBHW.mjs';
|
|
2
|
+
import { normaliseBan, banListFromInput, withState } from './chunk-XXHN7J46.mjs';
|
|
3
|
+
import { invalidSetting, resolveSetting, validateSetting, requireFieldsInSchema } from './chunk-YTWZVGCB.mjs';
|
|
4
|
+
import { isGroup, GROUP_FORMAT, acceptedPhrase } from './chunk-GQPTDQCL.mjs';
|
|
5
|
+
import { MAX_MANUAL_SUGGESTION_COUNT, MAX_SOURCE_INDEX_NAME_LENGTH, DEFAULT_PREVIEW_LIMIT, MAX_PREVIEW_LIMIT } from './chunk-5YNRKI2C.mjs';
|
|
6
|
+
import { NarsilError, ErrorCodes } from './chunk-MP7ABPTD.mjs';
|
|
7
|
+
|
|
8
|
+
// src/query-suggestions/preview.ts
|
|
9
|
+
function previewOrder(left, right) {
|
|
10
|
+
if (left.count !== right.count) return right.count - left.count;
|
|
11
|
+
if (left.group !== right.group) return left.group < right.group ? -1 : 1;
|
|
12
|
+
return left.query < right.query ? -1 : left.query > right.query ? 1 : 0;
|
|
13
|
+
}
|
|
14
|
+
async function previewBuild(ctx, indexName, max) {
|
|
15
|
+
const setting = enabledSetting(ctx.host, indexName);
|
|
16
|
+
const merged = await mergeHistory(ctx, indexName, setting, Date.now());
|
|
17
|
+
const { groups } = groupsToWrite(ctx, indexName, setting, merged.result);
|
|
18
|
+
const banned = new Set(ctx.host.view(indexName)?.state?.bannedQueries ?? []);
|
|
19
|
+
const candidates = [];
|
|
20
|
+
for (const group of groups) {
|
|
21
|
+
for (const { phrase, count } of merged.result.groups[group] ?? []) {
|
|
22
|
+
if (!banned.has(phrase)) candidates.push({ group, query: phrase, count });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
candidates.sort(previewOrder);
|
|
26
|
+
const checked = /* @__PURE__ */ new Map();
|
|
27
|
+
const entries = [];
|
|
28
|
+
let next = 0;
|
|
29
|
+
while (next < candidates.length && entries.length < max) {
|
|
30
|
+
const candidate = candidates[next];
|
|
31
|
+
next += 1;
|
|
32
|
+
if (candidate === void 0) break;
|
|
33
|
+
let passes = checked.get(candidate.query);
|
|
34
|
+
if (passes === void 0) {
|
|
35
|
+
passes = await meetsMinResults(ctx, indexName, setting, candidate.query);
|
|
36
|
+
checked.set(candidate.query, passes);
|
|
37
|
+
}
|
|
38
|
+
if (passes) entries.push(candidate);
|
|
39
|
+
}
|
|
40
|
+
return { entries, truncated: next < candidates.length };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// src/query-suggestions/operations.ts
|
|
44
|
+
function requireView(runtime, indexName) {
|
|
45
|
+
const view = runtime.host.view(indexName);
|
|
46
|
+
if (view === null) {
|
|
47
|
+
throw new NarsilError(ErrorCodes.INDEX_NOT_FOUND, `Index "${indexName}" does not exist`, { indexName });
|
|
48
|
+
}
|
|
49
|
+
return view;
|
|
50
|
+
}
|
|
51
|
+
function requireSourceView(runtime, indexName) {
|
|
52
|
+
const view = requireView(runtime, indexName);
|
|
53
|
+
if (view.state?.querySuggestionsSource !== void 0) {
|
|
54
|
+
invalidSetting(`Index "${indexName}" is a suggestions index, so it takes no query suggestions of its own`, {
|
|
55
|
+
indexName
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (indexName.length > MAX_SOURCE_INDEX_NAME_LENGTH) {
|
|
59
|
+
invalidSetting(
|
|
60
|
+
`Index "${indexName}" has a name longer than ${MAX_SOURCE_INDEX_NAME_LENGTH} characters, which leaves no room for the names of its suggestions indexes`,
|
|
61
|
+
{ indexName }
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return view;
|
|
65
|
+
}
|
|
66
|
+
function requireAcceptable(runtime, indexName, setting) {
|
|
67
|
+
const view = requireSourceView(runtime, indexName);
|
|
68
|
+
requireFieldsInSchema(setting, view.schema);
|
|
69
|
+
if (!setting.enabled) return;
|
|
70
|
+
if (runtime.scrambler === null) {
|
|
71
|
+
invalidSetting("This engine has no query suggestions key, so it cannot turn the feature on", { indexName });
|
|
72
|
+
}
|
|
73
|
+
if (view.hasSync) {
|
|
74
|
+
invalidSetting(
|
|
75
|
+
`Index "${indexName}" has device sync on, and a device receives the whole index of one user while a suggestion comes from the searches of several people`,
|
|
76
|
+
{ indexName }
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async function updateSetting(runtime, indexName, raw) {
|
|
81
|
+
const setting = validateSetting(raw);
|
|
82
|
+
requireAcceptable(runtime, indexName, setting);
|
|
83
|
+
await runtime.host.updateState(indexName, (current) => {
|
|
84
|
+
requireAcceptable(runtime, indexName, setting);
|
|
85
|
+
return withState(current, { querySuggestions: setting });
|
|
86
|
+
});
|
|
87
|
+
if (!setting.enabled) await runtime.discardHistory(indexName);
|
|
88
|
+
runtime.settingChanged(indexName);
|
|
89
|
+
}
|
|
90
|
+
async function status(runtime, indexName) {
|
|
91
|
+
const view = requireView(runtime, indexName);
|
|
92
|
+
return {
|
|
93
|
+
indexName,
|
|
94
|
+
setting: view.state?.querySuggestions ?? null,
|
|
95
|
+
lastBuild: await runtime.builds.lastBuild(indexName),
|
|
96
|
+
nextBuildAt: runtime.timers.nextBuildAt(indexName),
|
|
97
|
+
suggestionIndexes: [...markedSuggestionIndexes(runtime.host, indexName).values()].sort()
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function previewLimitOf(limit) {
|
|
101
|
+
if (limit === void 0) return DEFAULT_PREVIEW_LIMIT;
|
|
102
|
+
if (typeof limit !== "number" || !Number.isSafeInteger(limit) || limit < 1 || limit > MAX_PREVIEW_LIMIT) {
|
|
103
|
+
invalidSetting(`The preview limit must be a whole number from 1 to ${MAX_PREVIEW_LIMIT}`);
|
|
104
|
+
}
|
|
105
|
+
return limit;
|
|
106
|
+
}
|
|
107
|
+
async function preview(runtime, indexName, limit) {
|
|
108
|
+
const max = previewLimitOf(limit);
|
|
109
|
+
runtime.enabledSetting(indexName);
|
|
110
|
+
const scrambler = runtime.scrambler;
|
|
111
|
+
if (scrambler === null) invalidSetting("This engine has no query suggestions key, so it holds no counts");
|
|
112
|
+
const context = {
|
|
113
|
+
host: runtime.host,
|
|
114
|
+
scrambler,
|
|
115
|
+
saveDay: (name) => runtime.saveDay(name),
|
|
116
|
+
withWriteLock: (name, work) => runtime.withWriteLock(name, work),
|
|
117
|
+
isStopping: () => runtime.isStopping
|
|
118
|
+
};
|
|
119
|
+
return previewBuild(context, indexName, max);
|
|
120
|
+
}
|
|
121
|
+
async function banPhrases(runtime, indexName, next) {
|
|
122
|
+
requireSourceView(runtime, indexName);
|
|
123
|
+
let added = [];
|
|
124
|
+
let stored = [];
|
|
125
|
+
await runtime.host.updateState(indexName, (current) => {
|
|
126
|
+
requireSourceView(runtime, indexName);
|
|
127
|
+
const previous = current?.bannedQueries ?? [];
|
|
128
|
+
stored = next(previous);
|
|
129
|
+
const before = new Set(previous);
|
|
130
|
+
added = stored.filter((phrase) => !before.has(phrase));
|
|
131
|
+
return withState(current, { bannedQueries: stored });
|
|
132
|
+
});
|
|
133
|
+
return { stored, added };
|
|
134
|
+
}
|
|
135
|
+
async function removeFromSuggestions(runtime, indexName, phrases) {
|
|
136
|
+
let holders = 0;
|
|
137
|
+
if (phrases.length === 0) return holders;
|
|
138
|
+
for (const name of markedSuggestionIndexes(runtime.host, indexName).values()) {
|
|
139
|
+
if (await removeSuggestions(runtime.host, name, phrases) > 0) holders += 1;
|
|
140
|
+
}
|
|
141
|
+
return holders;
|
|
142
|
+
}
|
|
143
|
+
function updateBans(runtime, indexName, raw) {
|
|
144
|
+
const phrases = banListFromInput(raw);
|
|
145
|
+
return runtime.withWriteLock(indexName, async () => {
|
|
146
|
+
const { stored, added } = await banPhrases(runtime, indexName, () => phrases);
|
|
147
|
+
await removeFromSuggestions(runtime, indexName, added);
|
|
148
|
+
return stored;
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function removeQuery(runtime, indexName, raw) {
|
|
152
|
+
const phrase = normaliseBan(raw);
|
|
153
|
+
return runtime.withWriteLock(indexName, async () => {
|
|
154
|
+
await banPhrases(runtime, indexName, (current) => current.includes(phrase) ? [...current] : [...current, phrase]);
|
|
155
|
+
return removeFromSuggestions(runtime, indexName, [phrase]);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function manualCountOf(count) {
|
|
159
|
+
if (count === void 0) return 0;
|
|
160
|
+
if (typeof count !== "number" || !Number.isSafeInteger(count) || count < 0 || count > MAX_MANUAL_SUGGESTION_COUNT) {
|
|
161
|
+
invalidSetting(`A suggestion's count must be a whole number from 0 to ${MAX_MANUAL_SUGGESTION_COUNT}`);
|
|
162
|
+
}
|
|
163
|
+
return count;
|
|
164
|
+
}
|
|
165
|
+
function addSuggestion(runtime, indexName, raw) {
|
|
166
|
+
const { group, query, count } = raw ?? {};
|
|
167
|
+
if (!isGroup(group)) invalidSetting(`A suggestion needs a group of ${GROUP_FORMAT}`);
|
|
168
|
+
if (typeof query !== "string") invalidSetting("A suggestion needs its query as a string");
|
|
169
|
+
const documentCount = manualCountOf(count);
|
|
170
|
+
return runtime.withWriteLock(indexName, async () => {
|
|
171
|
+
const view = requireSourceView(runtime, indexName);
|
|
172
|
+
const setting = resolveSetting(view.state?.querySuggestions ?? { enabled: false, fields: [] });
|
|
173
|
+
const phrase = acceptedPhrase(query, setting);
|
|
174
|
+
if (phrase === null) invalidSetting("The suggestion is not a phrase that the setting of the index accepts");
|
|
175
|
+
if ((view.state?.bannedQueries ?? []).includes(phrase)) {
|
|
176
|
+
invalidSetting("The ban list of the index holds this phrase", { indexName });
|
|
177
|
+
}
|
|
178
|
+
const marked = markedSuggestionIndexes(runtime.host, indexName);
|
|
179
|
+
if (!marked.has(group) && marked.size >= setting.maxGroups) {
|
|
180
|
+
invalidSetting(`Index "${indexName}" already has ${setting.maxGroups} groups`, { indexName });
|
|
181
|
+
}
|
|
182
|
+
const name = await ensureSuggestionsIndex(runtime.host, indexName, group);
|
|
183
|
+
const document = suggestionDocument(phrase, documentCount, ORIGIN_MANUAL);
|
|
184
|
+
if (await runtime.host.engine.has(name, phrase)) await runtime.host.engine.update(name, phrase, document);
|
|
185
|
+
else await runtime.host.engine.insert(name, document);
|
|
186
|
+
return name;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function querySuggestionsOf(runtime) {
|
|
190
|
+
return {
|
|
191
|
+
recordQuery: async (indexName, query) => (await runtime()).record(indexName, query),
|
|
192
|
+
updateSetting: async (indexName, setting) => updateSetting(await runtime(), indexName, setting),
|
|
193
|
+
status: async (indexName) => status(await runtime(), indexName),
|
|
194
|
+
build: async (indexName) => (await runtime()).builds.start(indexName, "caller"),
|
|
195
|
+
preview: async (indexName, limit) => preview(await runtime(), indexName, limit),
|
|
196
|
+
bans: async (indexName) => [...requireView(await runtime(), indexName).state?.bannedQueries ?? []],
|
|
197
|
+
updateBans: async (indexName, phrases) => updateBans(await runtime(), indexName, phrases),
|
|
198
|
+
removeQuery: async (indexName, query) => removeQuery(await runtime(), indexName, query),
|
|
199
|
+
addSuggestion: async (indexName, suggestion) => addSuggestion(await runtime(), indexName, suggestion),
|
|
200
|
+
suggestionsIndexName: (indexName, group) => {
|
|
201
|
+
if (!isGroup(group)) invalidSetting(`A group holds ${GROUP_FORMAT}`);
|
|
202
|
+
return suggestionsIndexName(indexName, group);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// src/query-suggestions/providers.ts
|
|
208
|
+
var providers = /* @__PURE__ */ new WeakMap();
|
|
209
|
+
function bindQuerySuggestions(owner, provide) {
|
|
210
|
+
providers.set(owner, provide);
|
|
211
|
+
}
|
|
212
|
+
function boundQuerySuggestionsOf(owner) {
|
|
213
|
+
return providers.get(owner);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export { bindQuerySuggestions, boundQuerySuggestionsOf, querySuggestionsOf };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MAX_DOCUMENT_NESTING_DEPTH } from './chunk-L5ORED7V.mjs';
|
|
2
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-MP7ABPTD.mjs';
|
|
3
3
|
|
|
4
4
|
// src/serialization/base64.ts
|
|
5
5
|
var ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { decodeVectorGraphPartPayload, assembleGraphParts, decodeVectorFilePayload, countDead } from './chunk-
|
|
2
|
-
import { readListedFile, requireListedChecksum, requireListedSize } from './chunk-
|
|
3
|
-
import { HEADER_SIZE, openChecksummedEnvelope } from './chunk-
|
|
4
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
1
|
+
import { decodeVectorGraphPartPayload, assembleGraphParts, decodeVectorFilePayload, countDead } from './chunk-K4ZIGL2O.mjs';
|
|
2
|
+
import { readListedFile, requireListedChecksum, requireListedSize } from './chunk-UHICS3JI.mjs';
|
|
3
|
+
import { HEADER_SIZE, openChecksummedEnvelope } from './chunk-3OH67G7R.mjs';
|
|
4
|
+
import { NarsilError, ErrorCodes } from './chunk-MP7ABPTD.mjs';
|
|
5
5
|
import { decode } from '@msgpack/msgpack';
|
|
6
6
|
|
|
7
7
|
var VECTOR_FILE_ENVELOPE_VERSION = 2;
|
|
@@ -64,7 +64,7 @@ function holdsEveryHead(ref) {
|
|
|
64
64
|
async function loadFieldOnDemand(store, ref, vectorIndex, resolvePartition) {
|
|
65
65
|
const { pathOf } = store;
|
|
66
66
|
if (pathOf === void 0 || vectorIndex.storage !== "disk" || !holdsEveryHead(ref)) return false;
|
|
67
|
-
const { loadFilesByParts, openColdVectorField, osqBitsOf, waitBeforeColdLoad } = await import('./cold-module-
|
|
67
|
+
const { loadFilesByParts, openColdVectorField, osqBitsOf, waitBeforeColdLoad } = await import('./cold-module-6MO2XJF2.mjs');
|
|
68
68
|
await Promise.all([
|
|
69
69
|
...ref.files.map((file) => requireListedSize(store, file.key, { bytes: file.bytes, what: "vector file" })),
|
|
70
70
|
...ref.graphParts.map((part) => requireListedSize(store, part.key, { bytes: part.bytes, what: "graph part" }))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ARCHIVE_CONFIG_ENTRY, ARCHIVE_MANIFEST_ENTRY, tarEntryHeaders, tarPadding, tarEnd, ARCHIVE_ENTRY_ESTIMATE_BYTES, ARCHIVE_FILE_CHUNK_BYTES } from './chunk-
|
|
2
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
1
|
+
import { ARCHIVE_CONFIG_ENTRY, ARCHIVE_MANIFEST_ENTRY, tarEntryHeaders, tarPadding, tarEnd, ARCHIVE_ENTRY_ESTIMATE_BYTES, ARCHIVE_FILE_CHUNK_BYTES } from './chunk-MQOJIO5B.mjs';
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-MP7ABPTD.mjs';
|
|
3
3
|
|
|
4
4
|
// src/persistence/archive/range-layout.ts
|
|
5
5
|
function archiveLayout(config, manifestBytes, files) {
|
|
@@ -4,6 +4,7 @@ var PRUNING_REJECTION_SLACK = 1e-12;
|
|
|
4
4
|
var SCORE_BUFFER_INITIAL_TOUCHED_CAPACITY = 1024;
|
|
5
5
|
var SEGMENT_TOKEN_TABLE_START = 1 << 12;
|
|
6
6
|
var PHRASE_ROWS_START = 16;
|
|
7
|
+
var FIELD_RUN_ENTRIES_START = 8;
|
|
7
8
|
var PHRASE_SORT_RADIX_BITS = 11;
|
|
8
9
|
var PHRASE_SORT_CLOCK_ROWS = 65536;
|
|
9
10
|
var SEGMENT_POSTING_LOG_START = 1 << 14;
|
|
@@ -14,4 +15,4 @@ var FROZEN_REMOVAL_INDEX_MAX_PROCESS_FRACTION = 0.9;
|
|
|
14
15
|
var SORT_COLUMN_MINIMUM_REBUILD_THRESHOLD = 1024;
|
|
15
16
|
var SORT_COLUMN_REBUILD_FRACTION_SHIFT = 2;
|
|
16
17
|
|
|
17
|
-
export { FROZEN_REMOVAL_INDEX_MAX_PROCESS_FRACTION, LOOKUP_KEY_SCRATCH_BYTES, PHRASE_ROWS_START, PHRASE_SORT_CLOCK_ROWS, PHRASE_SORT_RADIX_BITS, PRUNING_REJECTION_SLACK, SCORE_BUFFER_INITIAL_TOUCHED_CAPACITY, SEGMENT_FIELD_SCRATCH_START, SEGMENT_POSITION_POOL_START, SEGMENT_POSTING_LOG_START, SEGMENT_TOKEN_TABLE_START, SORT_COLUMN_MINIMUM_REBUILD_THRESHOLD, SORT_COLUMN_REBUILD_FRACTION_SHIFT, TARGET_BLOCK_ENTRIES };
|
|
18
|
+
export { FIELD_RUN_ENTRIES_START, FROZEN_REMOVAL_INDEX_MAX_PROCESS_FRACTION, LOOKUP_KEY_SCRATCH_BYTES, PHRASE_ROWS_START, PHRASE_SORT_CLOCK_ROWS, PHRASE_SORT_RADIX_BITS, PRUNING_REJECTION_SLACK, SCORE_BUFFER_INITIAL_TOUCHED_CAPACITY, SEGMENT_FIELD_SCRATCH_START, SEGMENT_POSITION_POOL_START, SEGMENT_POSTING_LOG_START, SEGMENT_TOKEN_TABLE_START, SORT_COLUMN_MINIMUM_REBUILD_THRESHOLD, SORT_COLUMN_REBUILD_FRACTION_SHIFT, TARGET_BLOCK_ENTRIES };
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import { requirePatternSearchFor, requirePartialWordSearchFor, createPartitionIndex, cloneProjected, projectIncludedPaths, valueWithOwnBuffers, buildPartialWordTableFrom, createSurfaceRegistry, encodePartialSpellingsOf, recordValueSize, patternIndexOf, encodeFieldIndexes, countPartialSpelling,
|
|
1
|
+
import { requirePatternSearchFor, requirePartialWordSearchFor, createPartitionIndex, cloneProjected, projectIncludedPaths, valueWithOwnBuffers, buildPartialWordTableFrom, createSurfaceRegistry, encodePartialSpellingsOf, recordValueSize, patternIndexOf, encodeFieldIndexes, countPartialSpelling, documentWithOwnBuffers, readProjectedPath, copyVectorsInto, isCompositePartition, partialSpellingsOfDocuments, createFrozenPartialWords, requirePatternSearch, documentValueBytes, joinPatternWorkMeter, fanOutQuery, sanitizeGlobalStats, countsWithoutScores, fanOutMatchCount, createNumericIndex, createBooleanIndex, createEnumIndex, ValueAffixes, readResidentMemory, createCompositePartition } from './chunk-P5ZI2P2W.mjs';
|
|
2
2
|
import { readHeapStatistics } from './chunk-IPN7S4KX.mjs';
|
|
3
3
|
import { fnv1a } from './chunk-KAKQ74LS.mjs';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { createDocIdMap } from './chunk-LQG5G2LY.mjs';
|
|
8
|
-
import { GrowableUint32, bitsetHas, bitsetSet, createBitSet } from './chunk-JUKYYXSP.mjs';
|
|
9
|
-
import { getNestedValue, tokenizeOptions, sameFields, validateDocument, validateDocumentStrict, visitDocumentSurfaceSpellings, visitDocumentSpellings } from './chunk-VMXSVVXG.mjs';
|
|
10
|
-
import { partialFieldsOf, schemaFieldsOf, encodeDocument, extractVectorFieldsFromSchema } from './chunk-Z3TNWCI5.mjs';
|
|
11
|
-
import { encodeStringBlob, encodeLookupKey, visitTokens, codePointOrder } from './chunk-ZIFJXCKA.mjs';
|
|
12
|
-
import { SEGMENT_TOKEN_TABLE_START, SEGMENT_POSTING_LOG_START, SEGMENT_POSITION_POOL_START, SEGMENT_FIELD_SCRATCH_START, FROZEN_REMOVAL_INDEX_MAX_PROCESS_FRACTION } from './chunk-4UMZ7KQL.mjs';
|
|
4
|
+
import { GrowableUint32 } from './chunk-RLOES5SX.mjs';
|
|
5
|
+
import { getNestedValue, tokenizeOptions, sameFields, validateDocument, validateDocumentStrict, visitDocumentSurfaceSpellings, visitDocumentSpellings } from './chunk-L6V6BST3.mjs';
|
|
6
|
+
import { partialFieldsOf, schemaFieldsOf, encodeDocument, extractVectorFieldsFromSchema } from './chunk-BU4SAIC4.mjs';
|
|
13
7
|
import { fuzzyPrefixOf, boundedLevenshtein } from './chunk-GES7U2PM.mjs';
|
|
14
|
-
import { isWordIndexedBase } from './chunk-
|
|
8
|
+
import { isWordIndexedBase } from './chunk-I54T6CQP.mjs';
|
|
9
|
+
import { synonymSearchModule } from './chunk-I5B7RXU7.mjs';
|
|
10
|
+
import { resolveIndexAnalysis, getLanguage } from './chunk-RZWWB2XR.mjs';
|
|
11
|
+
import { encodeStringBlob, encodeLookupKey, codePointOrder } from './chunk-G6HRSGOU.mjs';
|
|
12
|
+
import { loadVectorCodeFor, loadedVectorCode, loadVectorCode, requireLoadedVectorCode } from './chunk-TDIK6NTV.mjs';
|
|
13
|
+
import { loadGeoCodeFor, ARRAY_POSITION_GAP, MAX_TERM_FREQUENCY, loadPhraseCodeFor, createLoadedGeoIndex } from './chunk-FB6463IN.mjs';
|
|
14
|
+
import { bitsetHas, bitsetSet, createBitSet } from './chunk-7V5IUP2T.mjs';
|
|
15
15
|
import { PROTOTYPE_POLLUTION_KEYS } from './chunk-L5ORED7V.mjs';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { visitTokens } from './chunk-A4L7YTKX.mjs';
|
|
17
|
+
import { SEGMENT_TOKEN_TABLE_START, SEGMENT_POSTING_LOG_START, SEGMENT_POSITION_POOL_START, SEGMENT_FIELD_SCRATCH_START, FROZEN_REMOVAL_INDEX_MAX_PROCESS_FRACTION } from './chunk-U55XJEIG.mjs';
|
|
18
|
+
import { createDocIdMap } from './chunk-LQG5G2LY.mjs';
|
|
19
|
+
import { NarsilError, ErrorCodes } from './chunk-MP7ABPTD.mjs';
|
|
20
|
+
import { compareCodePoints } from './chunk-TBC3XUL2.mjs';
|
|
18
21
|
import { Decoder, decode } from '@msgpack/msgpack';
|
|
19
22
|
|
|
20
23
|
// src/core/synonyms/platform.ts
|
|
@@ -648,6 +651,15 @@ async function runQueryAction(entry, action) {
|
|
|
648
651
|
return { count: result.totalMatched };
|
|
649
652
|
}
|
|
650
653
|
|
|
654
|
+
// src/workers/schema-code.ts
|
|
655
|
+
function loadSchemaCodeFor(schema) {
|
|
656
|
+
const vectorCode = loadVectorCodeFor(schema);
|
|
657
|
+
const geoCode = loadGeoCodeFor(schema);
|
|
658
|
+
if (vectorCode === null) return geoCode;
|
|
659
|
+
if (geoCode === null) return vectorCode;
|
|
660
|
+
return Promise.all([vectorCode, geoCode]);
|
|
661
|
+
}
|
|
662
|
+
|
|
651
663
|
// src/core/id-generator.ts
|
|
652
664
|
function generateId() {
|
|
653
665
|
const bytes = new Uint8Array(16);
|
|
@@ -2248,7 +2260,7 @@ function storedFrequenciesOf(source) {
|
|
|
2248
2260
|
function buildGeoReaders(entries) {
|
|
2249
2261
|
const readers = /* @__PURE__ */ new Map();
|
|
2250
2262
|
for (const entry of entries) {
|
|
2251
|
-
const index =
|
|
2263
|
+
const index = createLoadedGeoIndex();
|
|
2252
2264
|
for (let i = 0; i < entry.docIds.length; i++) {
|
|
2253
2265
|
index.insert(entry.docIds[i], entry.latitudes[i], entry.longitudes[i]);
|
|
2254
2266
|
}
|
|
@@ -2304,6 +2316,7 @@ function assembleFrozenSegment(segmentId, source, documentSource, sharedSnapshot
|
|
|
2304
2316
|
sharedSnapshot,
|
|
2305
2317
|
paged: pagedParts?.access ?? null,
|
|
2306
2318
|
arrays: source,
|
|
2319
|
+
tombstones,
|
|
2307
2320
|
invertedIdx: createFrozenInvertedReader(source.tokenTable, postingViews, counts),
|
|
2308
2321
|
docStore,
|
|
2309
2322
|
stats: buildStatsView(counts),
|
|
@@ -3087,7 +3100,7 @@ function indexFilterValue(indexes, ordinal, fieldPath, fieldType, value) {
|
|
|
3087
3100
|
for (const entry of fieldType === "enum" ? [value] : value) index.insert(ordinal, entry);
|
|
3088
3101
|
} else if (fieldType === "geopoint") {
|
|
3089
3102
|
const point = value;
|
|
3090
|
-
indexOf(indexes.geoIndexes, fieldPath,
|
|
3103
|
+
indexOf(indexes.geoIndexes, fieldPath, createLoadedGeoIndex).insert(ordinal, point.lat, point.lon);
|
|
3091
3104
|
}
|
|
3092
3105
|
}
|
|
3093
3106
|
function refuseRepeatedDocIds(documents) {
|
|
@@ -3238,7 +3251,7 @@ async function attachSegments(entry, action) {
|
|
|
3238
3251
|
growPartitionsTo(entry.manager, segment.partitionId);
|
|
3239
3252
|
const surfaceForms = segment.survivingSurfaceForms;
|
|
3240
3253
|
const spellings = surfaceForms === void 0 ? void 0 : NO_REMOVED_SPELLINGS;
|
|
3241
|
-
const frozen = isPagedSnapshot(segment.snapshot) ? (await import('./module-
|
|
3254
|
+
const frozen = isPagedSnapshot(segment.snapshot) ? (await import('./module-FQ4JWNQJ.mjs')).createPagedFrozenSegment(segment.snapshot) : createSharedFrozenSegment(segment.snapshot, surfaceForms);
|
|
3242
3255
|
for (const docId of segment.tombstonedDocIds ?? []) frozen.tombstoneDocument(docId, spellings);
|
|
3243
3256
|
entry.manager.attachFrozenSegment(segment.partitionId, frozen);
|
|
3244
3257
|
}
|
|
@@ -3293,7 +3306,7 @@ function runSegmentAction(entry, action) {
|
|
|
3293
3306
|
case "attachSegments":
|
|
3294
3307
|
return attachSegments(entry, action);
|
|
3295
3308
|
case "adoptDiskSegments":
|
|
3296
|
-
return import('./module-
|
|
3309
|
+
return import('./module-FQ4JWNQJ.mjs').then((code) => code.adoptSegmentsOnWorker(entry.manager, action));
|
|
3297
3310
|
case "compactSegments": {
|
|
3298
3311
|
const partition = requireComposite(entry, action.indexName, action.partitionId, "compact");
|
|
3299
3312
|
return mergeFrozenSegments(
|
|
@@ -3532,7 +3545,7 @@ function createDirectExecutor(options) {
|
|
|
3532
3545
|
);
|
|
3533
3546
|
}
|
|
3534
3547
|
case "createIndex": {
|
|
3535
|
-
const loading =
|
|
3548
|
+
const loading = loadSchemaCodeFor(action.config.schema);
|
|
3536
3549
|
if (loading !== null) await loading;
|
|
3537
3550
|
const language = getLanguage(action.config.language ?? "english");
|
|
3538
3551
|
const manager = addIndex(
|
|
@@ -3695,4 +3708,4 @@ function createDirectExecutor(options) {
|
|
|
3695
3708
|
};
|
|
3696
3709
|
}
|
|
3697
3710
|
|
|
3698
|
-
export { assemblePagedFrozenSegment, availableSynonymModule, buildSegmentPayload, createDirectExecutor, createEncodedDocumentSource, createFrozenSegment, createPartitionManager, createPartitionRouter, createSharedFrozenSegment, decodeEveryStoredDocument, decodeMapWithoutFields, decodeStoredDocument, decodeSurfaceTable, encodeSurfaceTable, endOfValue, fieldIndexRemapOf, freezeSegmentShared, generateId, holdsADiscardedField, isEmptySynonymSet, mergeFieldIndexes, mergeFieldLengths, mergeFrozenSegments, mergePartialWords, mergeSegmentContents, mergeSurfaceForms, registerSynonyms, resolvePartialWordAnalysis, resolvePartitionInsertOptions, segmentArraysOf, selectionKeeps, shareSegmentArrays, synonymModule, wrapFrozenTokenTable };
|
|
3711
|
+
export { assemblePagedFrozenSegment, availableSynonymModule, buildSegmentPayload, createDirectExecutor, createEncodedDocumentSource, createFrozenSegment, createPartitionManager, createPartitionRouter, createSharedFrozenSegment, decodeEveryStoredDocument, decodeMapWithoutFields, decodeStoredDocument, decodeSurfaceTable, encodeSurfaceTable, endOfValue, fieldIndexRemapOf, freezeSegmentShared, generateId, holdsADiscardedField, isEmptySynonymSet, loadSchemaCodeFor, mergeFieldIndexes, mergeFieldLengths, mergeFrozenSegments, mergePartialWords, mergeSegmentContents, mergeSurfaceForms, registerSynonyms, resolvePartialWordAnalysis, resolvePartitionInsertOptions, segmentArraysOf, selectionKeeps, shareSegmentArrays, synonymModule, wrapFrozenTokenTable };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { removeDocumentVectors, prepareDocumentVectors, insertDocumentVectors } from './chunk-
|
|
2
|
-
import { getNestedValue } from './chunk-
|
|
3
|
-
import { requireValidFieldTypes } from './chunk-
|
|
1
|
+
import { removeDocumentVectors, prepareDocumentVectors, insertDocumentVectors } from './chunk-EFBDHH5P.mjs';
|
|
2
|
+
import { getNestedValue } from './chunk-L6V6BST3.mjs';
|
|
3
|
+
import { requireValidFieldTypes } from './chunk-BU4SAIC4.mjs';
|
|
4
4
|
import { VECTOR_PATTERN } from './chunk-L5ORED7V.mjs';
|
|
5
|
-
import { ErrorCodes, NarsilError } from './chunk-
|
|
5
|
+
import { ErrorCodes, NarsilError } from './chunk-MP7ABPTD.mjs';
|
|
6
6
|
import { decode } from '@msgpack/msgpack';
|
|
7
7
|
|
|
8
8
|
function validateReplicationEntry(entry, localPrimaryTerm, log) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { crc32 } from './chunk-7GXJUJ24.mjs';
|
|
2
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-MP7ABPTD.mjs';
|
|
3
3
|
import { decode, encode } from '@msgpack/msgpack';
|
|
4
4
|
|
|
5
5
|
var PAGED_SEGMENT_ENVELOPE_VERSION = 6;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { openCountsFile } from './chunk-SA5LOGO3.mjs';
|
|
2
|
+
import { SCRAMBLED_ID_BYTES } from './chunk-5YNRKI2C.mjs';
|
|
3
|
+
|
|
4
|
+
// src/query-suggestions/merge.ts
|
|
5
|
+
var SEPARATOR = "\0";
|
|
6
|
+
function idKey(source, offset) {
|
|
7
|
+
let key = "";
|
|
8
|
+
for (let i = 0; i < SCRAMBLED_ID_BYTES; i++) key += String.fromCharCode(source[offset + i]);
|
|
9
|
+
return key;
|
|
10
|
+
}
|
|
11
|
+
var Merger = class {
|
|
12
|
+
settings;
|
|
13
|
+
banned;
|
|
14
|
+
entries = /* @__PURE__ */ new Map();
|
|
15
|
+
groups;
|
|
16
|
+
discarded = 0;
|
|
17
|
+
constructor(settings) {
|
|
18
|
+
this.settings = settings;
|
|
19
|
+
this.banned = new Set(settings.banned);
|
|
20
|
+
this.groups = new Set(settings.markedGroups);
|
|
21
|
+
}
|
|
22
|
+
async addFile(bytes, expectedDay) {
|
|
23
|
+
const opened = await openCountsFile(bytes, expectedDay, this.settings.fingerprint);
|
|
24
|
+
if (opened.kind !== "counts") return opened;
|
|
25
|
+
if (this.settings.clustered && (opened.indexUuid === null || opened.indexUuid !== this.settings.indexUuid)) {
|
|
26
|
+
return { kind: "other-index" };
|
|
27
|
+
}
|
|
28
|
+
const { minPeople, maxMergePhrases, maxGroups } = this.settings;
|
|
29
|
+
opened.visit((group, phrase, count, people) => {
|
|
30
|
+
if (this.banned.has(phrase)) return;
|
|
31
|
+
const key = `${group}${SEPARATOR}${phrase}`;
|
|
32
|
+
let entry = this.entries.get(key);
|
|
33
|
+
if (entry === void 0) {
|
|
34
|
+
const newGroup = !this.groups.has(group);
|
|
35
|
+
if (newGroup && this.groups.size >= maxGroups || this.entries.size >= maxMergePhrases) {
|
|
36
|
+
this.discarded += 1;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (newGroup) this.groups.add(group);
|
|
40
|
+
entry = { count: 0, people: /* @__PURE__ */ new Set() };
|
|
41
|
+
this.entries.set(key, entry);
|
|
42
|
+
}
|
|
43
|
+
entry.count += count;
|
|
44
|
+
if (entry.people === null) return;
|
|
45
|
+
for (const offset of people.offsets) {
|
|
46
|
+
entry.people.add(idKey(people.source, offset));
|
|
47
|
+
if (entry.people.size >= minPeople) {
|
|
48
|
+
entry.people = null;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
return { kind: "merged", day: opened.day, savedAt: opened.savedAt };
|
|
54
|
+
}
|
|
55
|
+
result() {
|
|
56
|
+
const groups = {};
|
|
57
|
+
for (const [key, entry] of this.entries) {
|
|
58
|
+
if (entry.people !== null) continue;
|
|
59
|
+
const split = key.indexOf(SEPARATOR);
|
|
60
|
+
const group = key.slice(0, split);
|
|
61
|
+
const list = groups[group] ?? [];
|
|
62
|
+
list.push({ phrase: key.slice(split + 1), count: entry.count });
|
|
63
|
+
groups[group] = list;
|
|
64
|
+
}
|
|
65
|
+
for (const list of Object.values(groups)) {
|
|
66
|
+
list.sort((left, right) => right.count - left.count || (left.phrase < right.phrase ? -1 : 1));
|
|
67
|
+
}
|
|
68
|
+
return { groups, discarded: this.discarded };
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export { Merger };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { invalidSetting, validateSetting, validateSource, settingToWire, settingFromWire } from './chunk-YTWZVGCB.mjs';
|
|
2
|
+
import { acceptedPhrase, isNormalPhrase } from './chunk-GQPTDQCL.mjs';
|
|
3
|
+
import { MAX_BANNED_PHRASE_CODE_POINTS, MAX_BANNED_PHRASES, MAX_BAN_LIST_BYTES } from './chunk-5YNRKI2C.mjs';
|
|
4
|
+
import { encode } from '@msgpack/msgpack';
|
|
5
|
+
|
|
6
|
+
var BAN_LIMITS = {
|
|
7
|
+
minLetters: 0,
|
|
8
|
+
maxLength: MAX_BANNED_PHRASE_CODE_POINTS,
|
|
9
|
+
maxWords: MAX_BANNED_PHRASE_CODE_POINTS,
|
|
10
|
+
maxDigits: MAX_BANNED_PHRASE_CODE_POINTS
|
|
11
|
+
};
|
|
12
|
+
function requireWithinLimits(phrases) {
|
|
13
|
+
if (phrases.length > MAX_BANNED_PHRASES) {
|
|
14
|
+
invalidSetting(`A ban list holds at most ${MAX_BANNED_PHRASES} phrases`, { phrases: phrases.length });
|
|
15
|
+
}
|
|
16
|
+
if (encode(phrases).byteLength > MAX_BAN_LIST_BYTES) {
|
|
17
|
+
invalidSetting(`A ban list must encode to at most ${MAX_BAN_LIST_BYTES} bytes`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function normaliseBan(raw) {
|
|
21
|
+
if (typeof raw !== "string") invalidSetting("Each banned phrase must be a string");
|
|
22
|
+
const phrase = acceptedPhrase(raw, BAN_LIMITS);
|
|
23
|
+
if (phrase === null) {
|
|
24
|
+
invalidSetting(
|
|
25
|
+
`A banned phrase must hold up to ${MAX_BANNED_PHRASE_CODE_POINTS} letters, digits, spaces, hyphens, and apostrophes`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
return phrase;
|
|
29
|
+
}
|
|
30
|
+
function banListFromInput(raw) {
|
|
31
|
+
if (!Array.isArray(raw)) invalidSetting("A ban list must be an array of phrases");
|
|
32
|
+
if (raw.length > MAX_BANNED_PHRASES) {
|
|
33
|
+
invalidSetting(`A ban list holds at most ${MAX_BANNED_PHRASES} phrases`, { phrases: raw.length });
|
|
34
|
+
}
|
|
35
|
+
const phrases = [...new Set(raw.map(normaliseBan))];
|
|
36
|
+
requireWithinLimits(phrases);
|
|
37
|
+
return phrases;
|
|
38
|
+
}
|
|
39
|
+
function storedBanList(raw) {
|
|
40
|
+
if (!Array.isArray(raw)) invalidSetting("The stored ban list is not an array");
|
|
41
|
+
const seen = /* @__PURE__ */ new Set();
|
|
42
|
+
for (const phrase of raw) {
|
|
43
|
+
if (typeof phrase !== "string" || !isNormalPhrase(phrase, BAN_LIMITS) || seen.has(phrase)) {
|
|
44
|
+
invalidSetting("The stored ban list holds a phrase that is not in normal form, or one twice");
|
|
45
|
+
}
|
|
46
|
+
seen.add(phrase);
|
|
47
|
+
}
|
|
48
|
+
const phrases = [...seen];
|
|
49
|
+
requireWithinLimits(phrases);
|
|
50
|
+
return phrases;
|
|
51
|
+
}
|
|
52
|
+
function unionOfBans(first, second) {
|
|
53
|
+
const union = [.../* @__PURE__ */ new Set([...first, ...second])];
|
|
54
|
+
requireWithinLimits(union);
|
|
55
|
+
return union;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/query-suggestions/stored-state.ts
|
|
59
|
+
function isPresent(value) {
|
|
60
|
+
return value !== void 0 && value !== null;
|
|
61
|
+
}
|
|
62
|
+
function storedStateOf(raw) {
|
|
63
|
+
const state = {};
|
|
64
|
+
if (isPresent(raw.querySuggestions)) state.querySuggestions = validateSetting(raw.querySuggestions);
|
|
65
|
+
if (isPresent(raw.bannedQueries)) {
|
|
66
|
+
const banned = storedBanList(raw.bannedQueries);
|
|
67
|
+
if (banned.length > 0) state.bannedQueries = banned;
|
|
68
|
+
}
|
|
69
|
+
if (isPresent(raw.querySuggestionsSource)) state.querySuggestionsSource = validateSource(raw.querySuggestionsSource);
|
|
70
|
+
return Object.keys(state).length === 0 ? null : state;
|
|
71
|
+
}
|
|
72
|
+
function storedStateToWire(state) {
|
|
73
|
+
const wire = {};
|
|
74
|
+
if (state.querySuggestions !== void 0) wire.query_suggestions = settingToWire(state.querySuggestions);
|
|
75
|
+
if (state.bannedQueries !== void 0) wire.banned_queries = [...state.bannedQueries];
|
|
76
|
+
if (state.querySuggestionsSource !== void 0) {
|
|
77
|
+
wire.query_suggestions_source = {
|
|
78
|
+
index: state.querySuggestionsSource.index,
|
|
79
|
+
group: state.querySuggestionsSource.group
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return wire;
|
|
83
|
+
}
|
|
84
|
+
function storedStateFromWire(raw) {
|
|
85
|
+
const state = storedStateOf({
|
|
86
|
+
bannedQueries: raw.banned_queries,
|
|
87
|
+
querySuggestionsSource: raw.query_suggestions_source
|
|
88
|
+
});
|
|
89
|
+
if (!isPresent(raw.query_suggestions)) return state;
|
|
90
|
+
return { ...state, querySuggestions: settingFromWire(raw.query_suggestions) };
|
|
91
|
+
}
|
|
92
|
+
function withState(current, change) {
|
|
93
|
+
const next = { ...current, ...change };
|
|
94
|
+
for (const key of Object.keys(next)) {
|
|
95
|
+
const value = next[key];
|
|
96
|
+
if (value === void 0 || Array.isArray(value) && value.length === 0) delete next[key];
|
|
97
|
+
}
|
|
98
|
+
return Object.keys(next).length === 0 ? null : next;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { banListFromInput, normaliseBan, storedStateFromWire, storedStateOf, storedStateToWire, unionOfBans, withState };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DIRECTORY_IDENTITY_CHECK_INTERVAL_MS } from './chunk-QDZJM7NI.mjs';
|
|
2
|
-
import { NarsilError, ErrorCodes } from './chunk-
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-MP7ABPTD.mjs';
|
|
3
3
|
|
|
4
4
|
// src/persistence/durability/directory-watch.ts
|
|
5
5
|
function unrefInterval(tick, intervalMs) {
|