@delali/narsil 0.3.1-next.144 → 0.3.1-next.146

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.
Files changed (241) hide show
  1. package/dist/adapters/filesystem.d.ts +1 -1
  2. package/dist/adapters/filesystem.mjs +101 -13
  3. package/dist/adapters/gcs.d.ts +49 -0
  4. package/dist/adapters/gcs.mjs +213 -0
  5. package/dist/adapters/indexeddb.d.ts +1 -1
  6. package/dist/adapters/indexeddb.mjs +2 -7
  7. package/dist/adapters/memory.d.ts +1 -1
  8. package/dist/adapters/memory.mjs +5 -0
  9. package/dist/adapters/s3.d.ts +53 -0
  10. package/dist/adapters/s3.mjs +263 -0
  11. package/dist/{adapters-BQFQ4PRz.d.ts → adapters-pljAqmrC.d.ts} +33 -0
  12. package/dist/analysis-change-ZCJNYBJM.mjs +39 -0
  13. package/dist/{browser/analysis-change-entry-7HR4LWL3.mjs → analysis-change-entry-YN3ELL6C.mjs} +1 -1
  14. package/dist/browser/{analysis-change-JPV775LR.mjs → analysis-change-M65AZQQG.mjs} +8 -5
  15. package/dist/{analysis-change-entry-TZTG4AZB.mjs → browser/analysis-change-entry-H3YIOLXZ.mjs} +1 -1
  16. package/dist/browser/{chunk-VFYMPCOV.mjs → chunk-2JABMB4S.mjs} +10 -6
  17. package/dist/{chunk-46NZOPHS.mjs → browser/chunk-4DYLCICG.mjs} +2 -2
  18. package/dist/browser/{chunk-MZI3TEOW.mjs → chunk-4RD3AFSB.mjs} +1 -1
  19. package/dist/browser/{chunk-WCFCHIBB.mjs → chunk-5V74FFZE.mjs} +2 -2
  20. package/dist/{chunk-NN33CZRE.mjs → browser/chunk-6OWX3OP2.mjs} +2 -2
  21. package/dist/browser/chunk-BRWY3JCN.mjs +678 -0
  22. package/dist/browser/{chunk-5DB2VDGI.mjs → chunk-BVX2MEHA.mjs} +306 -607
  23. package/dist/browser/{chunk-KTOK275N.mjs → chunk-D6UFGBF5.mjs} +15 -45
  24. package/dist/browser/{chunk-D33A5VMU.mjs → chunk-IAXZAVYL.mjs} +25 -66
  25. package/dist/browser/chunk-JNOAKDUM.mjs +31 -0
  26. package/dist/browser/{chunk-LVY2LI35.mjs → chunk-KAEVGLYN.mjs} +2 -2
  27. package/dist/browser/{chunk-3ZBJYAS4.mjs → chunk-LURXVCHG.mjs} +1 -1
  28. package/dist/browser/chunk-MPK76GVS.mjs +63 -0
  29. package/dist/browser/{chunk-ZEV26AQ6.mjs → chunk-NVEJJP4R.mjs} +1 -1
  30. package/dist/browser/{chunk-HKX2G6WH.mjs → chunk-ODQP7P3H.mjs} +455 -66
  31. package/dist/browser/{chunk-35B42UFM.mjs → chunk-PIS7ZAP7.mjs} +12 -25
  32. package/dist/browser/{chunk-TCLEOZ4P.mjs → chunk-QMNZFFD3.mjs} +4 -3
  33. package/dist/browser/{chunk-R4WUDZQV.mjs → chunk-SRL47USS.mjs} +2 -2
  34. package/dist/browser/chunk-TY7L6OXO.mjs +69 -0
  35. package/dist/browser/{chunk-MVM33ZUL.mjs → chunk-W643QV3L.mjs} +6 -5
  36. package/dist/browser/chunk-WXLBZJMT.mjs +25 -0
  37. package/dist/browser/{chunk-MWUK3DA5.mjs → chunk-XILIT5MT.mjs} +8 -8
  38. package/dist/browser/{cold-module-MJMKNUYJ.mjs → cold-module-A5S6JFDN.mjs} +20 -20
  39. package/dist/browser/{durability-wiring-SNOWIT6Z.mjs → durability-wiring-W5AVV3RF.mjs} +120 -80
  40. package/dist/browser/gzip-5S7ROJFJ.mjs +1 -0
  41. package/dist/browser/import-PTT63AGK.mjs +12 -0
  42. package/dist/browser/{module-BUFNZMEU.mjs → module-CEKA7MQH.mjs} +13 -10
  43. package/dist/browser/module-X5PGOE47.mjs +4288 -0
  44. package/dist/browser/{phrase-module-HGVBO24W.mjs → phrase-module-CNKMUY4U.mjs} +2 -1
  45. package/dist/browser/pool-DTYSPBMQ.mjs +296 -0
  46. package/dist/{restore-queue-FEYAC4SB.mjs → browser/restore-queue-DD4LWZK7.mjs} +2 -2
  47. package/dist/browser/{runtime-VEUH674B.mjs → runtime-D2ULZGCN.mjs} +3 -2
  48. package/dist/browser/{snapshot-QXBKHJAG.mjs → snapshot-DQ6A4PQP.mjs} +20 -15
  49. package/dist/browser/{write-WHFBDWQS.mjs → write-MAGRAIEH.mjs} +14 -11
  50. package/dist/{capabilities-BCdUwK_L.d.ts → capabilities-BT-HLDC8.d.ts} +3 -3
  51. package/dist/{chunk-O4LJQI4G.mjs → chunk-2HJWQPR6.mjs} +126 -4
  52. package/dist/{chunk-Z4HFMYNX.mjs → chunk-3BVGJ4JR.mjs} +36 -13
  53. package/dist/{chunk-ZPWS2SKJ.mjs → chunk-3HV7M5OJ.mjs} +272 -112
  54. package/dist/{chunk-UIKN2OTQ.mjs → chunk-3MXV3VHR.mjs} +2 -23
  55. package/dist/{browser/chunk-CCOAOO73.mjs → chunk-3SBJVQLL.mjs} +2 -2
  56. package/dist/chunk-3TVDTACC.mjs +104 -0
  57. package/dist/{chunk-YH5OIL7B.mjs → chunk-5QMHMELB.mjs} +6 -1
  58. package/dist/{chunk-SBMAWTRG.mjs → chunk-5WB2A3XU.mjs} +84 -15
  59. package/dist/{chunk-NPNK57CA.mjs → chunk-65WCV5JO.mjs} +1 -1
  60. package/dist/chunk-6BWLDLS3.mjs +58 -0
  61. package/dist/{chunk-UUZCQQG2.mjs → chunk-6C5EX2QR.mjs} +3 -3
  62. package/dist/{chunk-VEFN6X6Q.mjs → chunk-6F6USYII.mjs} +120 -13
  63. package/dist/{chunk-AST3SHFA.mjs → chunk-7HKWO4BJ.mjs} +7 -7
  64. package/dist/{chunk-W2COJ5AH.mjs → chunk-7N223GWV.mjs} +2 -2
  65. package/dist/{chunk-GWOS5DYC.mjs → chunk-ADBS5XRI.mjs} +11 -13
  66. package/dist/{chunk-TNBIK2LQ.mjs → chunk-AWNHDBKV.mjs} +430 -75
  67. package/dist/{chunk-ZMBFWQXN.mjs → chunk-B2FTZNNF.mjs} +2 -2
  68. package/dist/chunk-B7XIOAMK.mjs +100 -0
  69. package/dist/{chunk-W55X2BYN.mjs → chunk-BEZH7VEH.mjs} +1 -1
  70. package/dist/{chunk-QSK35UC2.mjs → chunk-BTPGQC6Z.mjs} +3 -11
  71. package/dist/{chunk-LA4WNDHL.mjs → chunk-CYYSZPVV.mjs} +12 -14
  72. package/dist/{chunk-SRJBFG2T.mjs → chunk-DOY6EG76.mjs} +6 -7
  73. package/dist/{chunk-6SNBQESJ.mjs → chunk-F22IOCR2.mjs} +10 -6
  74. package/dist/{chunk-J6YVB2XM.mjs → chunk-IJPK5PGM.mjs} +1 -1
  75. package/dist/{chunk-L76W3IZJ.mjs → chunk-IRWP524D.mjs} +1 -1
  76. package/dist/{chunk-XS2VM7UE.mjs → chunk-IZT3G24Q.mjs} +2 -2
  77. package/dist/{chunk-NOT5QOHU.mjs → chunk-J7M73VY7.mjs} +1 -1
  78. package/dist/chunk-K5HSUPYS.mjs +11 -0
  79. package/dist/chunk-KAKQ74LS.mjs +53 -0
  80. package/dist/{chunk-ZSWHPKGM.mjs → chunk-KYVRZAYP.mjs} +69 -2
  81. package/dist/{chunk-NRUXBYPH.mjs → chunk-KZ5GQE4Z.mjs} +5 -5
  82. package/dist/{browser/chunk-XNWPP5NS.mjs → chunk-KZQIVGW7.mjs} +2 -2
  83. package/dist/{chunk-KZL72VTC.mjs → chunk-L7TIAYPX.mjs} +11 -10
  84. package/dist/{chunk-DD2673TX.mjs → chunk-LDGGR7YT.mjs} +4 -81
  85. package/dist/{chunk-XZ3SRNDJ.mjs → chunk-LJ4ENXOD.mjs} +77 -16
  86. package/dist/chunk-LQG5G2LY.mjs +39 -0
  87. package/dist/{chunk-HNHCNTVG.mjs → chunk-MDF6PDIA.mjs} +11 -0
  88. package/dist/{chunk-74XB2SXI.mjs → chunk-NVTFQFUL.mjs} +16 -2
  89. package/dist/{chunk-BOJZGUS6.mjs → chunk-NYSONUB7.mjs} +1 -1
  90. package/dist/{chunk-WJGO5PGV.mjs → chunk-O4KUNDVF.mjs} +31 -17
  91. package/dist/{chunk-PWIWSUCX.mjs → chunk-POUYICOU.mjs} +1 -1
  92. package/dist/{chunk-EBIHRL7B.mjs → chunk-Q2UL2TPC.mjs} +1 -1
  93. package/dist/{chunk-NJJCPFXN.mjs → chunk-QEYF2SQ6.mjs} +2 -2
  94. package/dist/{chunk-7AUASRE7.mjs → chunk-QN5WVV5K.mjs} +7 -7
  95. package/dist/{chunk-RIIUZJQ3.mjs → chunk-QYRNLLLI.mjs} +1 -1
  96. package/dist/chunk-SOUZMPME.mjs +1635 -0
  97. package/dist/{chunk-C3YDYX6C.mjs → chunk-T4CJDBBE.mjs} +1 -1
  98. package/dist/{chunk-YLNSJQLX.mjs → chunk-TTCKT2RT.mjs} +5 -5
  99. package/dist/{chunk-KEIYVZUX.mjs → chunk-U2726TL5.mjs} +5 -5
  100. package/dist/{chunk-RKAVHNRW.mjs → chunk-U46IZNCW.mjs} +10 -5
  101. package/dist/{chunk-BRUUBXCB.mjs → chunk-U6NE6RCV.mjs} +10 -38
  102. package/dist/{chunk-VJEGOELZ.mjs → chunk-VP6XRMWR.mjs} +4 -4
  103. package/dist/{chunk-IO5F7ZBE.mjs → chunk-VQDZVWN3.mjs} +874 -413
  104. package/dist/{chunk-IWVEG5CX.mjs → chunk-XIHUI4KB.mjs} +2 -2
  105. package/dist/{chunk-YHUTF6EA.mjs → chunk-XKPNKR3V.mjs} +17 -47
  106. package/dist/{chunk-HJJWY6PT.mjs → chunk-YGQOPB2Z.mjs} +1 -1
  107. package/dist/chunk-YKEHQUSZ.mjs +248 -0
  108. package/dist/{chunk-GLZHNSGB.mjs → chunk-ZAYWOHVG.mjs} +1 -1
  109. package/dist/{chunk-ICW45TTU.mjs → chunk-ZEKDO7YX.mjs} +2 -2
  110. package/dist/chunk-ZXNNR73R.mjs +31 -0
  111. package/dist/{chunk-VJS4JFBQ.mjs → chunk-ZXX5GZEX.mjs} +3 -1
  112. package/dist/{chunk-RHKRTYGO.mjs → chunk-ZYKUD5NX.mjs} +9 -7
  113. package/dist/{client-B12YFALP.d.ts → client-Cn3gNxUU.d.ts} +62 -5
  114. package/dist/client.d.ts +8 -8
  115. package/dist/client.mjs +46 -0
  116. package/dist/{cold-module-4X7WJCFM.mjs → cold-module-2WWGBFJC.mjs} +43 -49
  117. package/dist/{config-CIG5yDyg.d.ts → config-CfhH1IWQ.d.ts} +150 -3
  118. package/dist/{config-BhZxIeb1.d.ts → config-aIsy7mcL.d.ts} +63 -3
  119. package/dist/direct-executor-QLVHMELJ.mjs +24 -0
  120. package/dist/distribution/coordinator/etcd.d.ts +3 -3
  121. package/dist/distribution/coordinator/etcd.mjs +1 -1
  122. package/dist/distribution/coordinator/in-memory.d.ts +3 -3
  123. package/dist/distribution/transport/grpc.mjs +4 -4
  124. package/dist/distribution/transport/in-memory.mjs +2 -2
  125. package/dist/distribution/transport/tcp.mjs +3 -3
  126. package/dist/distribution.d.ts +8 -8
  127. package/dist/distribution.mjs +16116 -14537
  128. package/dist/{durability-wiring-324D2DDD.mjs → durability-wiring-GNWQSZI3.mjs} +142 -109
  129. package/dist/embeddings/openai.d.ts +1 -1
  130. package/dist/embeddings/openai.mjs +2 -2
  131. package/dist/{engine-CtzbHOmG.d.ts → engine-CJRUHXgf.d.ts} +3 -3
  132. package/dist/gzip-F4HMIEEQ.mjs +1 -0
  133. package/dist/import-DX55PN4G.mjs +41 -0
  134. package/dist/{index-DsEurhSl.d.ts → index-MsF7e5hL.d.ts} +2 -2
  135. package/dist/index.browser.mjs +7 -4
  136. package/dist/index.d.ts +542 -8
  137. package/dist/index.mjs +29 -32
  138. package/dist/index.react-native.mjs +19 -0
  139. package/dist/invalidation/broadcast-channel.d.ts +1 -1
  140. package/dist/invalidation/filesystem.d.ts +1 -1
  141. package/dist/invalidation/filesystem.mjs +1 -1
  142. package/dist/invalidation/noop.d.ts +1 -1
  143. package/dist/{long-query-thread-4SW7RWDE.mjs → long-query-thread-SCUE62TO.mjs} +23 -25
  144. package/dist/{module-DXSJ5LT2.mjs → module-HW6IXUM6.mjs} +603 -112
  145. package/dist/module-V5K4ZP23.mjs +45 -0
  146. package/dist/{paged-partition-archive-HFP45PLU.mjs → paged-partition-archive-FDIIWZNR.mjs} +42 -41
  147. package/dist/partial-words.mjs +7 -9
  148. package/dist/pattern.mjs +4 -6
  149. package/dist/persistence/durability/checkpoint-worker.d.ts +2 -2
  150. package/dist/persistence/durability/checkpoint-worker.mjs +36 -39
  151. package/dist/{phrase-module-5QHBD2VJ.mjs → phrase-module-OUQIRUQU.mjs} +1 -1
  152. package/dist/pool-UPV5PVPY.mjs +298 -0
  153. package/dist/react-native/chunks/analysis-change-HGW3L6NY.mjs +893 -0
  154. package/dist/react-native/chunks/analysis-change-entry-BNRU6STO.mjs +1 -0
  155. package/dist/react-native/chunks/chunk-2J2727V4.mjs +495 -0
  156. package/dist/react-native/chunks/chunk-3CTWSQRW.mjs +1251 -0
  157. package/dist/react-native/chunks/chunk-5FV4ZEVA.mjs +2619 -0
  158. package/dist/react-native/chunks/chunk-7VWQLEFV.mjs +642 -0
  159. package/dist/react-native/chunks/chunk-AAAETEJK.mjs +27 -0
  160. package/dist/react-native/chunks/chunk-AM7RSBPF.mjs +32 -0
  161. package/dist/react-native/chunks/chunk-B6OD63Z3.mjs +997 -0
  162. package/dist/react-native/chunks/chunk-BRNAVOKP.mjs +177 -0
  163. package/dist/react-native/chunks/chunk-DKJTZ625.mjs +207 -0
  164. package/dist/react-native/chunks/chunk-FKGG4UOF.mjs +177 -0
  165. package/dist/{browser/chunk-6RHTAVZX.mjs → react-native/chunks/chunk-GV5KFQ6M.mjs} +38 -15
  166. package/dist/react-native/chunks/chunk-HURV3ASY.mjs +4416 -0
  167. package/dist/react-native/chunks/chunk-IO2SMUQD.mjs +10 -0
  168. package/dist/react-native/chunks/chunk-JV6VQY2S.mjs +17 -0
  169. package/dist/react-native/chunks/chunk-KUJOBRKS.mjs +217 -0
  170. package/dist/react-native/chunks/chunk-KWRW5U65.mjs +226 -0
  171. package/dist/react-native/chunks/chunk-L4M7QJNP.mjs +110 -0
  172. package/dist/react-native/chunks/chunk-LQ6Q4L5B.mjs +360 -0
  173. package/dist/react-native/chunks/chunk-LQAKO5QV.mjs +523 -0
  174. package/dist/react-native/chunks/chunk-LRGWK367.mjs +11 -0
  175. package/dist/react-native/chunks/chunk-LVIKKAA6.mjs +93 -0
  176. package/dist/react-native/chunks/chunk-NFGBOI46.mjs +14 -0
  177. package/dist/react-native/chunks/chunk-NNE4VDMM.mjs +8 -0
  178. package/dist/react-native/chunks/chunk-PPEPTUVV.mjs +56 -0
  179. package/dist/react-native/chunks/chunk-PSWKQVVT.mjs +9 -0
  180. package/dist/{chunk-KGOXHLLZ.mjs → react-native/chunks/chunk-PU55IOG4.mjs} +228 -11
  181. package/dist/react-native/chunks/chunk-QC4ZRBSX.mjs +270 -0
  182. package/dist/react-native/chunks/chunk-R4EEMYM6.mjs +21 -0
  183. package/dist/react-native/chunks/chunk-R4OPUZQ5.mjs +86 -0
  184. package/dist/react-native/chunks/chunk-SLGIAD6B.mjs +2634 -0
  185. package/dist/react-native/chunks/chunk-TJMSKBEM.mjs +25 -0
  186. package/dist/react-native/chunks/chunk-TLYD7IJ2.mjs +23 -0
  187. package/dist/react-native/chunks/chunk-UFNCLEQM.mjs +73 -0
  188. package/dist/react-native/chunks/chunk-YH7W556M.mjs +179 -0
  189. package/dist/react-native/chunks/chunk-YJSMEKRE.mjs +22385 -0
  190. package/dist/react-native/chunks/chunk-ZCKNBPQ4.mjs +79 -0
  191. package/dist/react-native/chunks/cold-module-TSFWLYWC.mjs +755 -0
  192. package/dist/react-native/chunks/durability-wiring-PZR6KOQK.mjs +4509 -0
  193. package/dist/react-native/chunks/gzip.react-native-7JWCLVOB.mjs +3 -0
  194. package/dist/react-native/chunks/import-VTODLPLO.mjs +22 -0
  195. package/dist/{browser/module-BVP4TKZU.mjs → react-native/chunks/module-JBBH6PZH.mjs} +671 -146
  196. package/dist/react-native/chunks/module-VEK2KCKU.mjs +25 -0
  197. package/dist/react-native/chunks/phrase-module-76UAPPSG.mjs +329 -0
  198. package/dist/react-native/chunks/pool-CD4ANYUI.mjs +296 -0
  199. package/dist/react-native/chunks/release-D7ZTIANM.mjs +33 -0
  200. package/dist/react-native/chunks/replace-IMZUVUOE.mjs +57 -0
  201. package/dist/{browser/restore-queue-ONYNYUDE.mjs → react-native/chunks/restore-queue-OI5EH7R3.mjs} +2 -2
  202. package/dist/react-native/chunks/runtime-3MCDLJAF.mjs +559 -0
  203. package/dist/react-native/chunks/snapshot-AUZMEV36.mjs +1205 -0
  204. package/dist/react-native/chunks/write-DDC2QBRJ.mjs +197 -0
  205. package/dist/{chunk-DQNKVOJ2.mjs → react-native/partial-words.mjs} +13 -228
  206. package/dist/react-native/pattern.mjs +2442 -0
  207. package/dist/react-native/synonyms.mjs +460 -0
  208. package/dist/react.d.ts +11 -11
  209. package/dist/react.mjs +11 -0
  210. package/dist/{rerank-KTLC3E6N.mjs → rerank-3W54N6P2.mjs} +4 -4
  211. package/dist/rerankers/http.d.ts +1 -1
  212. package/dist/rerankers/http.mjs +2 -2
  213. package/dist/restore-queue-BQWWNNQI.mjs +41 -0
  214. package/dist/{runtime-DYV75DCB.mjs → runtime-L2DZYY6N.mjs} +5 -5
  215. package/dist/{schema-B-Runv0n.d.ts → schema-D33CyXCy.d.ts} +1 -1
  216. package/dist/server.d.ts +24 -12
  217. package/dist/server.mjs +159 -38
  218. package/dist/{snapshot-CGM65VCD.mjs → snapshot-EHXTOTW5.mjs} +47 -50
  219. package/dist/synonyms.mjs +3 -4
  220. package/dist/{tasks-CjRJRGTb.d.ts → tasks-C4ElXr4P.d.ts} +59 -7
  221. package/dist/thread-I7DVHHW7.mjs +31 -0
  222. package/dist/vector/search-worker.d.ts +2 -2
  223. package/dist/vector/search-worker.mjs +8 -7
  224. package/dist/workers/entry.mjs +9 -9
  225. package/dist/{write-2DZPEQL2.mjs → write-SDJXXQ2G.mjs} +36 -39
  226. package/openapi.json +349 -2
  227. package/package.json +108 -8
  228. package/dist/analysis-change-HQUT2Z3I.mjs +0 -43
  229. package/dist/browser/import-TLB2A5LJ.mjs +0 -9
  230. package/dist/chunk-5WYVUPGD.mjs +0 -427
  231. package/dist/chunk-AV4IJKD2.mjs +0 -35
  232. package/dist/chunk-GES7U2PM.mjs +0 -68
  233. package/dist/chunk-N37VMC62.mjs +0 -18
  234. package/dist/chunk-WNBRW4Q2.mjs +0 -128
  235. package/dist/chunk-WQBCBKY3.mjs +0 -8
  236. package/dist/chunk-ZATRDAYU.mjs +0 -160
  237. package/dist/direct-executor-7XOQ7VQP.mjs +0 -28
  238. package/dist/import-OOBUW3RR.mjs +0 -44
  239. package/dist/module-IYPLWHGC.mjs +0 -48
  240. package/dist/thread-KGNAIKPD.mjs +0 -33
  241. /package/dist/{chunk-22YPZVMG.mjs → chunk-ZXNQEW43.mjs} +0 -0
@@ -1,5 +1,5 @@
1
- import { collectYoungGeneration, collectAndReturnPages } from './chunk-RIIUZJQ3.mjs';
2
- import { REFUSAL_YOUNG_COLLECTION_MIN_INTERVAL_MS, REFUSAL_COLLECTION_MIN_INTERVAL_MS, REFUSAL_COLLECTION_TIME_MULTIPLE } from './chunk-22YPZVMG.mjs';
1
+ import { collectYoungGeneration, collectAndReturnPages } from './chunk-QYRNLLLI.mjs';
2
+ import { REFUSAL_YOUNG_COLLECTION_MIN_INTERVAL_MS, REFUSAL_COLLECTION_MIN_INTERVAL_MS, REFUSAL_COLLECTION_TIME_MULTIPLE } from './chunk-ZXNQEW43.mjs';
3
3
 
4
4
  // src/runtime/thread-heap.ts
5
5
  var refusalListeners = /* @__PURE__ */ new Set();
@@ -1,16 +1,17 @@
1
- import { loadVectorField, VECTOR_FILE_ENVELOPE_VERSION, GRAPH_PART_ENVELOPE_VERSION } from './chunk-NRUXBYPH.mjs';
2
- import { SEGMENT_PAGE_BYTES, RECORD_PAGE_BYTES } from './chunk-W2COJ5AH.mjs';
3
- import { VECTOR_FILE_MAX_VECTORS, deadBytesFor } from './chunk-ICW45TTU.mjs';
4
- import { readSegmentFile, STABLE_HEAD_ATTEMPTS } from './chunk-7AUASRE7.mjs';
5
- import { MAX_SEGMENT_ID, MANIFEST_ENVELOPE_VERSION, EARLIER_SEGMENT_MANIFEST_VERSION, SEGMENT_MANIFEST_VERSION, MAX_SEGMENTS_PER_PARTITION, segmentKey, manifestKey, segmentsPrefix, vectorFileKey, graphPartKey } from './chunk-UUZCQQG2.mjs';
6
- import { VERSION, rulesOfStoredSynonyms, openChecksummedEnvelope, readHeader, HEADER_SIZE, crc32, engineVersionParts, writeHeader, packChecksummedEnvelope, packEnvelopeWithChecksum, checksumOfChunks } from './chunk-IO5F7ZBE.mjs';
7
- import { decodeEveryStoredDocument, createSharedFrozenSegment, shareSegmentArrays } from './chunk-WJGO5PGV.mjs';
8
- import { DEFAULT_BM25_B, DEFAULT_BM25_K1 } from './chunk-ZPWS2SKJ.mjs';
9
- import { flattenSchema, requireValidFieldTypes, isQuantizationMode, isStorageMode } from './chunk-KGOXHLLZ.mjs';
1
+ import { loadVectorField, VECTOR_FILE_ENVELOPE_VERSION, GRAPH_PART_ENVELOPE_VERSION } from './chunk-KZ5GQE4Z.mjs';
2
+ import { gunzip, gzip } from './chunk-ZXNNR73R.mjs';
3
+ import { SEGMENT_PAGE_BYTES, RECORD_PAGE_BYTES } from './chunk-7N223GWV.mjs';
4
+ import { VECTOR_FILE_MAX_VECTORS, deadBytesFor } from './chunk-ZEKDO7YX.mjs';
5
+ import { readSegmentFile, STABLE_HEAD_ATTEMPTS } from './chunk-QN5WVV5K.mjs';
6
+ import { MAX_SEGMENT_ID, MANIFEST_ENVELOPE_VERSION, EARLIER_SEGMENT_MANIFEST_VERSION, SEGMENT_MANIFEST_VERSION, MAX_SEGMENTS_PER_PARTITION, segmentKey, manifestKey, segmentsPrefix, vectorFileKey, graphPartKey } from './chunk-6C5EX2QR.mjs';
7
+ import { VERSION, rulesOfStoredSynonyms, openChecksummedEnvelope, readHeader, HEADER_SIZE, crc32, engineVersionParts, writeHeader, packChecksummedEnvelope, packEnvelopeWithChecksum, checksumOfChunks } from './chunk-VQDZVWN3.mjs';
8
+ import { decodeEveryStoredDocument, createSharedFrozenSegment, shareSegmentArrays } from './chunk-O4KUNDVF.mjs';
9
+ import { DEFAULT_BM25_B, DEFAULT_BM25_K1 } from './chunk-3HV7M5OJ.mjs';
10
+ import { flattenSchema, requireValidFieldTypes, isQuantizationMode, isStorageMode } from './chunk-SOUZMPME.mjs';
11
+ import { VECTOR_PATTERN } from './chunk-L5ORED7V.mjs';
10
12
  import { MAX_FILE_BYTES, VALID_HNSW_METRICS } from './chunk-U476IXKQ.mjs';
13
+ import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
11
14
  import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
12
- import { VECTOR_PATTERN } from './chunk-L5ORED7V.mjs';
13
- import { NarsilError, ErrorCodes } from './chunk-HNHCNTVG.mjs';
14
15
  import { decode, encode } from '@msgpack/msgpack';
15
16
 
16
17
  // src/engine/durability-metadata.ts
@@ -618,37 +619,6 @@ function deserializeMetadata(data) {
618
619
  var CURRENT_ENVELOPE_VERSION = 1;
619
620
  var SNAPSHOT_ENVELOPE_VERSION = 2;
620
621
  var INDEX_SNAPSHOT_ENVELOPE_VERSION = 3;
621
- async function collectStream(stream) {
622
- const reader = stream.getReader();
623
- const chunks = [];
624
- let totalLength = 0;
625
- for (; ; ) {
626
- const { done, value } = await reader.read();
627
- if (done) break;
628
- chunks.push(value);
629
- totalLength += value.length;
630
- }
631
- const result = new Uint8Array(totalLength);
632
- let offset = 0;
633
- for (const chunk of chunks) {
634
- result.set(chunk, offset);
635
- offset += chunk.length;
636
- }
637
- return result;
638
- }
639
- function toArrayBuffer(data) {
640
- return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
641
- }
642
- async function compressGzip(data) {
643
- const blob = new Blob([toArrayBuffer(data)]);
644
- const compressed = blob.stream().pipeThrough(new CompressionStream("gzip"));
645
- return collectStream(compressed);
646
- }
647
- async function decompressGzip(data) {
648
- const blob = new Blob([toArrayBuffer(data)]);
649
- const decompressed = blob.stream().pipeThrough(new DecompressionStream("gzip"));
650
- return collectStream(decompressed);
651
- }
652
622
  function buildFlags(options) {
653
623
  const useCompression = options.compression === "gzip";
654
624
  return {
@@ -662,7 +632,7 @@ async function packEnvelope(payloadBytes, options) {
662
632
  const flags = buildFlags(options);
663
633
  let finalPayload = payloadBytes;
664
634
  if (flags.compressionEnabled) {
665
- finalPayload = await compressGzip(payloadBytes);
635
+ finalPayload = await gzip(payloadBytes);
666
636
  }
667
637
  const checksum = flags.checksumPresent ? crc32(finalPayload) : 0;
668
638
  const [major, minor, patch] = engineVersionParts();
@@ -723,7 +693,7 @@ async function unpackEnvelope(data, maxAcceptedVersion = CURRENT_ENVELOPE_VERSIO
723
693
  }
724
694
  }
725
695
  if (header.flags.compressionEnabled) {
726
- payloadBytes = await decompressGzip(payloadBytes);
696
+ payloadBytes = await gunzip(payloadBytes);
727
697
  }
728
698
  return { header, payloadBytes };
729
699
  }
@@ -1450,7 +1420,7 @@ function removeFromPartition(manager, partitionId, docIds) {
1450
1420
  }
1451
1421
  }
1452
1422
  async function attachPagedSegment(directory, ref, partitionId, manager, options) {
1453
- const { checkPagedSegmentFully, createPagedFrozenSegment, openPagedSnapshot, pagedListingOf } = await import('./module-IYPLWHGC.mjs');
1423
+ const { checkPagedSegmentFully, createPagedFrozenSegment, openPagedSnapshot, pagedListingOf } = await import('./module-V5K4ZP23.mjs');
1454
1424
  if (options.decodesEveryDocument) await checkPagedSegmentFully(directory, ref);
1455
1425
  const snapshot = openPagedSnapshot(await pagedListingOf(directory, ref));
1456
1426
  requireAgreedSchema(options.schema, snapshot.schema, ref.key);
@@ -1464,7 +1434,7 @@ async function loadPartitionSegments(store, partition, manager, options) {
1464
1434
  const { directory } = store;
1465
1435
  for (const ref of partition.segments) {
1466
1436
  if (manager.config.textStorage === "disk" && directory !== void 0) {
1467
- const { isPagedSegmentFile } = await import('./module-IYPLWHGC.mjs');
1437
+ const { isPagedSegmentFile } = await import('./module-V5K4ZP23.mjs');
1468
1438
  if (await isPagedSegmentFile(directory, ref.key)) {
1469
1439
  await attachPagedSegment(directory, ref, partition.partitionId, manager, options);
1470
1440
  await yieldToEventLoop();
@@ -1520,7 +1490,7 @@ async function loadSegmentedCheckpoint(store, indexName, manifest, deps, decodes
1520
1490
  (field) => deps.vectorIndexes.get(field.fieldPath)?.storage === "disk" && field.files.some((file) => file.headOffset !== void 0)
1521
1491
  );
1522
1492
  if (!decodesEveryDocument && directory !== void 0 && opensVectorsOnDemand) {
1523
- const { startReadingOpeningSectionsAhead } = await import('./module-IYPLWHGC.mjs');
1493
+ const { startReadingOpeningSectionsAhead } = await import('./module-V5K4ZP23.mjs');
1524
1494
  await startReadingOpeningSectionsAhead(directory, manifest);
1525
1495
  }
1526
1496
  for (const partition of manifest.partitions) {
@@ -1,4 +1,4 @@
1
- import { NarsilError, ErrorCodes } from './chunk-HNHCNTVG.mjs';
1
+ import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
2
2
 
3
3
  // src/rerank/call.ts
4
4
  function unregistered(adapters, name) {
@@ -0,0 +1,248 @@
1
+ import { isValidInteger, isRecord } from './chunk-U6NE6RCV.mjs';
2
+ import { MAX_REPLICATION_FACTOR, MAX_PARTITION_COUNT } from './chunk-JDDXV6UF.mjs';
3
+ import { openChecksummedEnvelope, packChecksummedEnvelope } from './chunk-VQDZVWN3.mjs';
4
+ import { joinChunks } from './chunk-3TVDTACC.mjs';
5
+ import { MAX_FILE_BYTES } from './chunk-U476IXKQ.mjs';
6
+ import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
7
+ import { decode, encode } from '@msgpack/msgpack';
8
+
9
+ // src/narsil/write-blocks.ts
10
+ var writeBlockLookups = /* @__PURE__ */ new WeakMap();
11
+ function bindWriteBlockLookup(owner, lookup) {
12
+ writeBlockLookups.set(owner, lookup);
13
+ }
14
+ function writeBlockLookupOf(owner) {
15
+ return writeBlockLookups.get(owner);
16
+ }
17
+ function bindEngineWriteBlock(engine, owner) {
18
+ const lookup = writeBlockLookups.get(owner);
19
+ if (lookup !== void 0) writeBlockLookups.set(engine, lookup);
20
+ }
21
+
22
+ // src/narsil/index-reads.ts
23
+ var boundReads = /* @__PURE__ */ new WeakMap();
24
+ function bindIndexReads(engine, reads) {
25
+ boundReads.set(engine, reads);
26
+ }
27
+ function indexReadsOf(engine) {
28
+ const bound = boundReads.get(engine);
29
+ if (bound !== void 0) return bound;
30
+ return {
31
+ listIndexes: async () => engine.listIndexes(),
32
+ getStats: async (indexName) => engine.getStats(indexName),
33
+ getPartitionStats: async (indexName) => engine.getPartitionStats(indexName)
34
+ };
35
+ }
36
+
37
+ // src/distribution/backups/constants.ts
38
+ var BACKUP_JOBS_KEY = "_narsil/backups/jobs";
39
+ var CLUSTER_UUID_KEY = "_narsil/cluster/uuid";
40
+ var BACKUP_JOB_CAS_ATTEMPTS = 20;
41
+ var BACKUP_JOB_CAS_RETRY_MS = 25;
42
+ var MAX_FINISHED_BACKUP_JOBS = 100;
43
+ var BACKUP_JOB_POLL_INTERVAL_MS = 250;
44
+ var MAX_BACKUP_NAME_LENGTH = 128;
45
+ var MAX_BACKUP_KEY_PREFIX_LENGTH = 512;
46
+ var BACKUP_PARTITION_POLL_INTERVAL_MS = 500;
47
+ var BACKUP_PARTITION_RESULT_RETENTION_MS = 6e5;
48
+ var BACKUP_PRIMARY_WAIT_MS = 12e4;
49
+ var BACKUP_PARTITIONS_AT_ONCE = 4;
50
+ var BACKUP_FILES_AT_ONCE = 4;
51
+ var BACKUP_FILE_CHUNK_BYTES = 1048576;
52
+ var BACKUP_DELETES_AT_ONCE = 8;
53
+ var BACKUP_PROGRESS_REPORT_INTERVAL_MS = 1e3;
54
+ var BACKUP_SWEEP_INTERVAL_MS = 3e4;
55
+ var BACKUP_PUBLISH_RETRY_MS = 1e3;
56
+ var MAX_BACKUP_FILES_PER_PARTITION = 1e6;
57
+ var MAX_BACKUP_FILE_PATH_LENGTH = 1024;
58
+ var BACKUP_MANIFEST_READS_AT_ONCE = 8;
59
+ var MAX_CLUSTER_UUID_BYTES = 128;
60
+
61
+ // src/distribution/backups/keys.ts
62
+ var NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
63
+ var PREFIX_SEGMENT_PATTERN = /^[A-Za-z0-9._-]+$/;
64
+ var SHA256_HEX_PATTERN = /^[0-9a-f]{64}$/;
65
+ var CLAIM_KEY = "cluster";
66
+ var MANIFESTS_DIRECTORY = "backups/";
67
+ var FILES_DIRECTORY = "files/";
68
+ function validateBackupName(backupName) {
69
+ if (typeof backupName !== "string" || backupName.length > MAX_BACKUP_NAME_LENGTH || !NAME_PATTERN.test(backupName)) {
70
+ throw new NarsilError(
71
+ ErrorCodes.CONFIG_INVALID,
72
+ `A backup name holds from 1 to ${MAX_BACKUP_NAME_LENGTH} letters, digits, '.', '_', and '-', and starts with a letter or a digit`,
73
+ { backupName: typeof backupName === "string" ? backupName.slice(0, MAX_BACKUP_NAME_LENGTH) : typeof backupName }
74
+ );
75
+ }
76
+ return backupName;
77
+ }
78
+ function validateBackupKeyPrefix(keyPrefix) {
79
+ const valid = typeof keyPrefix === "string" && keyPrefix.length <= MAX_BACKUP_KEY_PREFIX_LENGTH && keyPrefix.split("/").every((segment) => PREFIX_SEGMENT_PATTERN.test(segment) && segment !== "." && segment !== "..");
80
+ if (!valid) {
81
+ throw new NarsilError(
82
+ ErrorCodes.CONFIG_INVALID,
83
+ `A backup key prefix holds up to ${MAX_BACKUP_KEY_PREFIX_LENGTH} characters in segments joined by '/', where each segment holds letters, digits, '.', '_', and '-', and no segment is '.' or '..'`,
84
+ {
85
+ keyPrefix: typeof keyPrefix === "string" ? keyPrefix.slice(0, MAX_BACKUP_KEY_PREFIX_LENGTH) : typeof keyPrefix
86
+ }
87
+ );
88
+ }
89
+ return keyPrefix;
90
+ }
91
+ function storeWithoutSaveIfAbsent() {
92
+ return new NarsilError(
93
+ ErrorCodes.CONFIG_INVALID,
94
+ "A backup store must offer saveIfAbsent, because a save followed by a read can't stop two clusters from both claiming an empty key prefix",
95
+ {}
96
+ );
97
+ }
98
+ function validateBackupConfig(backups) {
99
+ const store = typeof backups === "object" && backups !== null ? backups.store : void 0;
100
+ if (typeof store !== "object" || store === null) {
101
+ throw new NarsilError(
102
+ ErrorCodes.CONFIG_INVALID,
103
+ "ClusterNodeConfig.backups.store must be a persistence adapter",
104
+ {}
105
+ );
106
+ }
107
+ if (typeof store.saveIfAbsent !== "function") throw storeWithoutSaveIfAbsent();
108
+ validateBackupKeyPrefix(backups.keyPrefix);
109
+ }
110
+ function isSha256Hex(value) {
111
+ return typeof value === "string" && SHA256_HEX_PATTERN.test(value);
112
+ }
113
+ function backupKeys(keyPrefix) {
114
+ const prefix = `${validateBackupKeyPrefix(keyPrefix)}/`;
115
+ return {
116
+ prefix,
117
+ claim: `${prefix}${CLAIM_KEY}`,
118
+ manifests: `${prefix}${MANIFESTS_DIRECTORY}`,
119
+ files: `${prefix}${FILES_DIRECTORY}`,
120
+ manifest: (backupName) => `${prefix}${MANIFESTS_DIRECTORY}${validateBackupName(backupName)}`,
121
+ file: (sha256) => {
122
+ if (!isSha256Hex(sha256)) {
123
+ throw new NarsilError(ErrorCodes.BACKUP_DAMAGED, "A backup lists a file under a digest that is not SHA-256", {
124
+ sha256: String(sha256).slice(0, 80)
125
+ });
126
+ }
127
+ return `${prefix}${FILES_DIRECTORY}${sha256}`;
128
+ }
129
+ };
130
+ }
131
+ var BACKUP_MANIFEST_ENVELOPE_VERSION = 1;
132
+ var PATH_SEGMENT_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
133
+ function damaged(backupName, reason) {
134
+ return new NarsilError(ErrorCodes.BACKUP_DAMAGED, `The manifest of backup '${backupName}' ${reason}`, {
135
+ backupName
136
+ });
137
+ }
138
+ function isCount(value) {
139
+ return isValidInteger(value) && value >= 0;
140
+ }
141
+ function isSafeFileKey(key) {
142
+ return typeof key === "string" && key.length <= MAX_BACKUP_FILE_PATH_LENGTH && key.split("/").every((segment) => PATH_SEGMENT_PATTERN.test(segment));
143
+ }
144
+ function readAllocationConstraints(value) {
145
+ if (!isRecord(value) || typeof value.zoneAwareness !== "boolean" || typeof value.zoneAttribute !== "string" || value.zoneAttribute.length === 0 || !(value.maxShardsPerNode === null || isValidInteger(value.maxShardsPerNode) && value.maxShardsPerNode > 0)) {
146
+ return null;
147
+ }
148
+ return {
149
+ zoneAwareness: value.zoneAwareness,
150
+ zoneAttribute: value.zoneAttribute,
151
+ maxShardsPerNode: value.maxShardsPerNode
152
+ };
153
+ }
154
+ function readStoredFile(value, backupName) {
155
+ if (!isRecord(value) || !isSha256Hex(value.sha256) || !isCount(value.bytes) || value.bytes > MAX_FILE_BYTES) {
156
+ throw damaged(backupName, "lists a file without a valid SHA-256 digest and length");
157
+ }
158
+ return { sha256: value.sha256, bytes: value.bytes };
159
+ }
160
+ function readListedFile(value, backupName) {
161
+ const stored = readStoredFile(value, backupName);
162
+ if (!isRecord(value) || !isSafeFileKey(value.key)) throw damaged(backupName, "lists a file under an unsafe key");
163
+ return { key: value.key, ...stored };
164
+ }
165
+ function readBackupPartition(value, backupName, partitionCount) {
166
+ if (!isRecord(value) || !isCount(value.partitionId) || value.partitionId >= partitionCount || !isCount(value.lastSeqNo) || !Array.isArray(value.files) || value.files.length > MAX_BACKUP_FILES_PER_PARTITION) {
167
+ throw damaged(backupName, "holds a malformed partition entry");
168
+ }
169
+ const files = value.files.map((file) => readListedFile(file, backupName));
170
+ if (new Set(files.map((file) => file.key)).size !== files.length) {
171
+ throw damaged(backupName, `lists one key twice in partition ${value.partitionId}`);
172
+ }
173
+ return {
174
+ partitionId: value.partitionId,
175
+ lastSeqNo: value.lastSeqNo,
176
+ manifest: readStoredFile(value.manifest, backupName),
177
+ files
178
+ };
179
+ }
180
+ function validateManifest(raw, backupName) {
181
+ if (!isRecord(raw) || raw.name !== backupName || typeof raw.clusterUuid !== "string" || typeof raw.indexName !== "string" || !isCount(raw.startedAt) || !isCount(raw.completedAt) || !isValidInteger(raw.partitionCount) || raw.partitionCount < 1 || raw.partitionCount > MAX_PARTITION_COUNT || !isCount(raw.replicationFactor) || raw.replicationFactor > MAX_REPLICATION_FACTOR || !Array.isArray(raw.partitions) || raw.partitions.length !== raw.partitionCount) {
182
+ throw damaged(backupName, "holds a malformed header");
183
+ }
184
+ const constraints = readAllocationConstraints(raw.constraints);
185
+ if (constraints === null) throw damaged(backupName, "holds malformed allocation constraints");
186
+ const partitionCount = raw.partitionCount;
187
+ const partitions = raw.partitions.map((entry) => readBackupPartition(entry, backupName, partitionCount));
188
+ if (partitions.some((entry, position) => entry.partitionId !== position)) {
189
+ throw damaged(backupName, "lists its partitions out of partitionId order");
190
+ }
191
+ return {
192
+ name: backupName,
193
+ clusterUuid: raw.clusterUuid,
194
+ indexName: raw.indexName,
195
+ startedAt: raw.startedAt,
196
+ completedAt: raw.completedAt,
197
+ partitionCount,
198
+ replicationFactor: raw.replicationFactor,
199
+ constraints,
200
+ config: readStoredFile(raw.config, backupName),
201
+ partitions
202
+ };
203
+ }
204
+ async function decodeBackupManifest(bytes, backupName) {
205
+ let raw;
206
+ try {
207
+ const { payload } = await openChecksummedEnvelope(bytes, {
208
+ envelopeFormatVersion: BACKUP_MANIFEST_ENVELOPE_VERSION,
209
+ what: `manifest of backup '${backupName}'`,
210
+ allowsCompression: false
211
+ });
212
+ raw = decode(payload);
213
+ } catch (error) {
214
+ throw damaged(backupName, `is not readable: ${error instanceof Error ? error.message : String(error)}`);
215
+ }
216
+ return validateManifest(raw, backupName);
217
+ }
218
+ async function encodeBackupManifest(manifest) {
219
+ const packed = await packChecksummedEnvelope([encode(manifest)], BACKUP_MANIFEST_ENVELOPE_VERSION, "backup manifest");
220
+ return joinChunks(packed.chunks, packed.byteLength);
221
+ }
222
+ function storedFilesOf(manifest) {
223
+ const files = [manifest.config];
224
+ for (const partition of manifest.partitions) files.push(partition.manifest, ...partition.files);
225
+ return files;
226
+ }
227
+
228
+ // src/distribution/backups/restore-options.ts
229
+ function readRestorePlacement(request) {
230
+ const { replicationFactor, constraints } = request;
231
+ const placement = {};
232
+ if (replicationFactor !== void 0 && replicationFactor !== null) {
233
+ if (!isValidInteger(replicationFactor) || replicationFactor < 0 || replicationFactor > MAX_REPLICATION_FACTOR) {
234
+ return `"replicationFactor" must be an integer from 0 to ${MAX_REPLICATION_FACTOR}`;
235
+ }
236
+ placement.replicationFactor = replicationFactor;
237
+ }
238
+ if (constraints !== void 0 && constraints !== null) {
239
+ const read = readAllocationConstraints(constraints);
240
+ if (read === null) {
241
+ return '"constraints" must hold "zoneAwareness" as a boolean, "zoneAttribute" as a non-empty string, and "maxShardsPerNode" as a positive integer or null';
242
+ }
243
+ placement.constraints = read;
244
+ }
245
+ return placement;
246
+ }
247
+
248
+ export { BACKUP_DELETES_AT_ONCE, BACKUP_FILES_AT_ONCE, BACKUP_FILE_CHUNK_BYTES, BACKUP_JOBS_KEY, BACKUP_JOB_CAS_ATTEMPTS, BACKUP_JOB_CAS_RETRY_MS, BACKUP_JOB_POLL_INTERVAL_MS, BACKUP_MANIFEST_READS_AT_ONCE, BACKUP_PARTITIONS_AT_ONCE, BACKUP_PARTITION_POLL_INTERVAL_MS, BACKUP_PARTITION_RESULT_RETENTION_MS, BACKUP_PRIMARY_WAIT_MS, BACKUP_PROGRESS_REPORT_INTERVAL_MS, BACKUP_PUBLISH_RETRY_MS, BACKUP_SWEEP_INTERVAL_MS, CLUSTER_UUID_KEY, MAX_CLUSTER_UUID_BYTES, MAX_FINISHED_BACKUP_JOBS, backupKeys, bindEngineWriteBlock, bindIndexReads, bindWriteBlockLookup, decodeBackupManifest, encodeBackupManifest, indexReadsOf, isCount, isSha256Hex, readBackupPartition, readRestorePlacement, readStoredFile, storeWithoutSaveIfAbsent, storedFilesOf, validateBackupConfig, validateBackupName, writeBlockLookupOf };
@@ -14,7 +14,7 @@ function requireLoadedVectorCode() {
14
14
  function loadVectorCode() {
15
15
  if (loaded !== null) return Promise.resolve(loaded);
16
16
  if (loading === null) {
17
- loading = import('./module-DXSJ5LT2.mjs').then(
17
+ loading = import('./module-HW6IXUM6.mjs').then(
18
18
  (code) => {
19
19
  loaded = code;
20
20
  return code;
@@ -1,6 +1,6 @@
1
1
  import { osqRecordBytes } from './chunk-37CD3OKS.mjs';
2
- import { MAX_M, EARLIER_RELEASE_MIN_M, MIN_M } from './chunk-VJS4JFBQ.mjs';
3
- import { NarsilError, ErrorCodes } from './chunk-HNHCNTVG.mjs';
2
+ import { MAX_M, EARLIER_RELEASE_MIN_M, MIN_M } from './chunk-ZXX5GZEX.mjs';
3
+ import { NarsilError, ErrorCodes } from './chunk-MDF6PDIA.mjs';
4
4
 
5
5
  // src/vector/vector-index/dead-bits.ts
6
6
  var NO_LIVE_VECTOR_AT_POSITION = -1;
@@ -0,0 +1,31 @@
1
+ // src/serialization/gzip.ts
2
+ function streamOf(data) {
3
+ return new Blob([data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength)]).stream();
4
+ }
5
+ async function gzip(data) {
6
+ return new Uint8Array(await new Response(streamOf(data).pipeThrough(new CompressionStream("gzip"))).arrayBuffer());
7
+ }
8
+ async function gunzip(compressed, maxBytes = Number.POSITIVE_INFINITY) {
9
+ const reader = streamOf(compressed).pipeThrough(new DecompressionStream("gzip")).getReader();
10
+ const chunks = [];
11
+ let total = 0;
12
+ for (; ; ) {
13
+ const { done, value } = await reader.read();
14
+ if (done) break;
15
+ total += value.byteLength;
16
+ if (total > maxBytes) {
17
+ await reader.cancel();
18
+ throw Object.assign(new RangeError(`The compressed data inflates past ${maxBytes} bytes`), { code: "EFBIG" });
19
+ }
20
+ chunks.push(value);
21
+ }
22
+ const result = new Uint8Array(total);
23
+ let offset = 0;
24
+ for (const chunk of chunks) {
25
+ result.set(chunk, offset);
26
+ offset += chunk.byteLength;
27
+ }
28
+ return result;
29
+ }
30
+
31
+ export { gunzip, gzip };
@@ -11,5 +11,7 @@ var COMPACTION_TOMBSTONE_RATIO = 0.1;
11
11
  var COMPACTION_ABSOLUTE_THRESHOLD = 1e3;
12
12
  var DEFAULT_EF_SEARCH = 50;
13
13
  var NEAREST_LINK_FALLBACK_HOSTS = 4;
14
+ var CONNECT_STEPS_BETWEEN_CLOCK_CHECKS = 256;
15
+ var CONNECT_RESTARTS_BEFORE_ONE_PASS = 8;
14
16
 
15
- export { COMPACTION_ABSOLUTE_THRESHOLD, COMPACTION_TOMBSTONE_RATIO, DEFAULT_EF_SEARCH, EARLIER_RELEASE_MIN_M, FARTHEST_REJECTED_LINKS_KEPT, INITIAL_LIST_CAPACITY, INITIAL_UPPER_SLOTS, MAX_LAYER_CAP, MAX_M, MIN_M, NEAREST_LINK_FALLBACK_HOSTS, PLACEMENT_ROOM_REQUESTS };
17
+ export { COMPACTION_ABSOLUTE_THRESHOLD, COMPACTION_TOMBSTONE_RATIO, CONNECT_RESTARTS_BEFORE_ONE_PASS, CONNECT_STEPS_BETWEEN_CLOCK_CHECKS, DEFAULT_EF_SEARCH, EARLIER_RELEASE_MIN_M, FARTHEST_REJECTED_LINKS_KEPT, INITIAL_LIST_CAPACITY, INITIAL_UPPER_SLOTS, MAX_LAYER_CAP, MAX_M, MIN_M, NEAREST_LINK_FALLBACK_HOSTS, PLACEMENT_ROOM_REQUESTS };
@@ -1,6 +1,7 @@
1
- import { readMetadataEnvelope } from './chunk-YHUTF6EA.mjs';
2
- import { nextSegmentKey, readWalSegments, durableRecordMissing, checkpointLastSeqNo, SEGMENT_HEADER_SIZE } from './chunk-LA4WNDHL.mjs';
3
- import { applyDeleteEntry, applyIndexEntry } from './chunk-KEIYVZUX.mjs';
1
+ import { readMetadataEnvelope } from './chunk-XKPNKR3V.mjs';
2
+ import { nextSegmentKey, readWalSegments, durableRecordMissing, checkpointLastSeqNo, SEGMENT_HEADER_SIZE } from './chunk-CYYSZPVV.mjs';
3
+ import { applyDeleteEntry, applyIndexEntry } from './chunk-U2726TL5.mjs';
4
+ import { turnIsSpent, yieldTurn } from './chunk-LQG5G2LY.mjs';
4
5
 
5
6
  // src/persistence/durability/recovery.ts
6
7
  async function removeLeftoverRewriteFiles(directory, names) {
@@ -40,11 +41,12 @@ async function replayWal(directory, indexName, partitionId, fromSeqNoExclusive,
40
41
  }
41
42
  let highestSeqNo = fromSeqNoExclusive;
42
43
  let highestPrimaryTerm = 0;
43
- const replay = (entries) => {
44
+ const replay = async (entries) => {
44
45
  for (const entry of entries) {
45
46
  if (entry.seqNo <= highestSeqNo) {
46
47
  continue;
47
48
  }
49
+ if (turnIsSpent()) await yieldTurn();
48
50
  applyEntry(entry, deps);
49
51
  highestSeqNo = entry.seqNo;
50
52
  if (entry.primaryTerm > highestPrimaryTerm) {
@@ -52,9 +54,9 @@ async function replayWal(directory, indexName, partitionId, fromSeqNoExclusive,
52
54
  }
53
55
  }
54
56
  };
55
- replay(durableEntries);
57
+ await replay(durableEntries);
56
58
  if (activeTail !== null) {
57
- replay(activeTail.entries);
59
+ await replay(activeTail.entries);
58
60
  }
59
61
  await deleteOrphanSegments(directory, segments, marker.state.activeSegmentSeqNo);
60
62
  if (activeTail !== null && activeTail.cleanEnd < activeTail.segmentLength) {
@@ -127,7 +129,7 @@ function applyEntry(entry, deps) {
127
129
  applyDeleteEntry(entry, deps.manager, deps.vectorIndexes);
128
130
  return;
129
131
  }
130
- applyIndexEntry(entry, deps.manager, deps.vectorFieldPaths, deps.vectorIndexes);
132
+ applyIndexEntry(entry, deps.manager, deps.vectorFieldPaths, deps.vectorIndexes, deps.defersGraphBuilds !== true);
131
133
  }
132
134
  function snapshotCheckpointFor(checkpoint, partitionId) {
133
135
  return checkpointLastSeqNo(checkpoint, partitionId);
@@ -1,7 +1,8 @@
1
- import { P as PartitionConfig, B as BM25Params, A as AnyDocument, I as InsertOptions, W as WriteOptions } from './schema-B-Runv0n.js';
2
- import { V as VectorMaintenanceResult, B as BatchResult, L as ListParams, f as ListResult, I as IndexInfo, k as IndexStats, P as PartitionStatsResult, Q as QueryParams, m as QueryResult, j as PreflightResult, g as SuggestParams, h as SuggestResult } from './config-BhZxIeb1.js';
1
+ import { P as PartitionConfig, B as BM25Params, A as AnyDocument, I as InsertOptions, W as WriteOptions } from './schema-D33CyXCy.js';
2
+ import { V as VectorMaintenanceResult, B as BatchResult, L as ListParams, f as ListResult, I as IndexInfo, k as IndexStats, P as PartitionStatsResult, Q as QueryParams, m as QueryResult, j as PreflightResult, g as SuggestParams, h as SuggestResult } from './config-aIsy7mcL.js';
3
3
  import { a as SynonymRule } from './synonyms-CpOAHPa-.js';
4
- import { f as TaskRecord, a as ChangeAnalysisBody, M as MemoryStatsResponse, c as ImportResult, H as HttpIndexConfig, d as TaskListQuery, T as TaskListPage } from './tasks-CjRJRGTb.js';
4
+ import { f as TaskRecord, a as ChangeAnalysisBody, M as MemoryStatsResponse, R as RestoreBackupBody, c as ImportResult, H as HttpIndexConfig, d as TaskListQuery, T as TaskListPage } from './tasks-C4ElXr4P.js';
5
+ import { B as BackupListing } from './config-CfhH1IWQ.js';
5
6
 
6
7
  /**
7
8
  * This is the `fetch` implementation the client sends every request through.
@@ -365,6 +366,62 @@ interface AdminOperations {
365
366
  getMemoryStats(options?: RequestOptions): Promise<MemoryStatsResponse>;
366
367
  }
367
368
 
369
+ /**
370
+ * These methods back up an index to the store outside the cluster, list and delete the backups there, and restore one
371
+ * as a new index. A server that fronts a cluster node with a backup store answers them.
372
+ *
373
+ * Each method except {@link BackupOperations.listBackups} answers with a {@link TaskRecord} while the work continues,
374
+ * and the task's `steps` report how many partitions, or how many files for a deletion, are done. Follow that task with
375
+ * {@link TaskOperations.waitForTask}.
376
+ *
377
+ * @public
378
+ */
379
+ interface BackupOperations {
380
+ /**
381
+ * Starts a backup of an index, which holds every write that the cluster acknowledged before the backup started.
382
+ *
383
+ * @param indexName - This names the index to back up.
384
+ * @param backupName - This names the backup, with 1 to 128 letters, digits, `.`, `_`, and `-`, starting with a
385
+ * letter or a digit.
386
+ * @param options - This sets the signal, the deadline, and the headers for this request.
387
+ * @returns The record is the task to follow.
388
+ * @throws A `NarsilError` with `CLUSTER_OPERATION_UNSUPPORTED` from a server that fronts a single engine. The task
389
+ * reports `BACKUP_ALREADY_EXISTS` or `BACKUP_DURABILITY_REQUIRED` in its `error`.
390
+ */
391
+ createBackup(indexName: string, backupName: string, options?: RequestOptions): Promise<TaskRecord>;
392
+ /**
393
+ * Lists the backups under the cluster's key prefix, in name order.
394
+ *
395
+ * @param options - This sets the signal, the deadline, and the headers for this request.
396
+ * @returns One summary per backup, and a {@link DamagedBackup} with `BACKUP_DAMAGED` for each manifest that the
397
+ * cluster can't read.
398
+ */
399
+ listBackups(options?: RequestOptions): Promise<BackupListing[]>;
400
+ /**
401
+ * Starts the restore of a backup as a new index, on a cluster of any size.
402
+ *
403
+ * @param backupName - This names the backup to restore.
404
+ * @param restore - This names the new index, and it can set the replication factor and the allocation constraints in
405
+ * place of the backup's.
406
+ * @param options - This sets the signal, the deadline, and the headers for this request.
407
+ * @returns The record is the task to follow.
408
+ * @throws A `NarsilError` with `CLUSTER_OPERATION_UNSUPPORTED` from a server that fronts a single engine. The task
409
+ * reports `BACKUP_NOT_FOUND`, `BACKUP_DAMAGED`, or `INDEX_ALREADY_EXISTS` in its `error`, and a failed restore
410
+ * creates no index.
411
+ */
412
+ restoreBackup(backupName: string, restore: RestoreBackupBody, options?: RequestOptions): Promise<TaskRecord>;
413
+ /**
414
+ * Starts the deletion of a backup, which also removes each of its files that no other backup lists.
415
+ *
416
+ * @param backupName - This names the backup to delete.
417
+ * @param options - This sets the signal, the deadline, and the headers for this request.
418
+ * @returns The record is the task to follow.
419
+ * @throws A `NarsilError` with `CLUSTER_OPERATION_UNSUPPORTED` from a server that fronts a single engine. The task
420
+ * reports `BACKUP_NOT_FOUND` in its `error`.
421
+ */
422
+ deleteBackup(backupName: string, options?: RequestOptions): Promise<TaskRecord>;
423
+ }
424
+
368
425
  /**
369
426
  * This is a corpus, in whichever form you already hold it.
370
427
  *
@@ -986,7 +1043,7 @@ interface TaskOperations {
986
1043
  *
987
1044
  * @public
988
1045
  */
989
- interface NarsilClient extends IndexOperations, DocumentOperations, BulkOperations, SearchOperations, TaskOperations, AdminOperations, ServerOperations {
1046
+ interface NarsilClient extends IndexOperations, DocumentOperations, BulkOperations, SearchOperations, TaskOperations, AdminOperations, BackupOperations, ServerOperations {
990
1047
  }
991
1048
  /**
992
1049
  * Builds a client for one Narsil server, or for a list of them that it moves
@@ -1007,4 +1064,4 @@ interface NarsilClient extends IndexOperations, DocumentOperations, BulkOperatio
1007
1064
  */
1008
1065
  declare function createNarsilClient(options: NarsilClientOptions): NarsilClient;
1009
1066
 
1010
- export { type AdminOperations as A, type BulkOperations as B, type DocumentOperations as D, type FetchFunction as F, type ImportSource as I, type NarsilClient as N, type PutResult as P, type RequestOptions as R, type SearchOperations as S, type TaskOperations as T, type WaitForTaskOptions as W, type IndexOperations as a, type NarsilClientOptions as b, type ServerOperations as c, type ServerVersion as d, createNarsilClient as e };
1067
+ export { type AdminOperations as A, type BackupOperations as B, type DocumentOperations as D, type FetchFunction as F, type ImportSource as I, type NarsilClient as N, type PutResult as P, type RequestOptions as R, type SearchOperations as S, type TaskOperations as T, type WaitForTaskOptions as W, type BulkOperations as a, type IndexOperations as b, type NarsilClientOptions as c, type ServerOperations as d, type ServerVersion as e, createNarsilClient as f };
package/dist/client.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, N as NarsilError, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './config-BhZxIeb1.js';
2
- export { A as ASYNC_IMPORT_CAPABILITY, B as BM25_TUNING_CAPABILITY, C as CHANGE_ANALYSIS_CAPABILITY, D as DOCUMENT_EXPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, R as REBUILD_ANALYSIS_CAPABILITY, S as SERVER_CAPABILITIES, a as SYNONYMS_CAPABILITY, T as TASK_CANCEL_CAPABILITY, b as TASK_FILTER_CAPABILITY } from './capabilities-BCdUwK_L.js';
3
- export { C as CapabilitiesResponse, a as ChangeAnalysisBody, b as CreateIndexEmbedding, E as ErrorDetail, H as HttpIndexConfig, I as ImportError, c as ImportResult, M as MemoryStatsResponse, T as TaskListPage, d as TaskListQuery, e as TaskProgress, f as TaskRecord, g as TaskStatus, h as TaskType } from './tasks-CjRJRGTb.js';
4
- export { A as AdminOperations, B as BulkOperations, D as DocumentOperations, F as FetchFunction, I as ImportSource, a as IndexOperations, N as NarsilClient, b as NarsilClientOptions, P as PutResult, R as RequestOptions, S as SearchOperations, c as ServerOperations, d as ServerVersion, T as TaskOperations, W as WaitForTaskOptions, e as createNarsilClient } from './client-B12YFALP.js';
5
- import './adapters-BQFQ4PRz.js';
6
- import './schema-B-Runv0n.js';
1
+ export { B as BackupListing, a as BackupSummary, D as DamagedBackup } from './config-CfhH1IWQ.js';
2
+ export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, N as NarsilError, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './config-aIsy7mcL.js';
3
+ export { A as ASYNC_IMPORT_CAPABILITY, B as BM25_TUNING_CAPABILITY, C as CHANGE_ANALYSIS_CAPABILITY, D as DOCUMENT_EXPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, R as REBUILD_ANALYSIS_CAPABILITY, S as SERVER_CAPABILITIES, a as SYNONYMS_CAPABILITY, T as TASK_CANCEL_CAPABILITY, b as TASK_FILTER_CAPABILITY } from './capabilities-BT-HLDC8.js';
4
+ export { B as BackupListResponse, C as CapabilitiesResponse, a as ChangeAnalysisBody, b as CreateIndexEmbedding, E as ErrorDetail, H as HttpIndexConfig, I as ImportError, c as ImportResult, M as MemoryStatsResponse, R as RestoreBackupBody, T as TaskListPage, d as TaskListQuery, e as TaskProgress, f as TaskRecord, g as TaskStatus, h as TaskStepProgress, i as TaskType } from './tasks-C4ElXr4P.js';
5
+ export { A as AdminOperations, B as BackupOperations, a as BulkOperations, D as DocumentOperations, F as FetchFunction, I as ImportSource, b as IndexOperations, N as NarsilClient, c as NarsilClientOptions, P as PutResult, R as RequestOptions, S as SearchOperations, d as ServerOperations, e as ServerVersion, T as TaskOperations, W as WaitForTaskOptions, f as createNarsilClient } from './client-Cn3gNxUU.js';
6
+ import './adapters-pljAqmrC.js';
7
+ import './index-MsF7e5hL.js';
8
+ import './schema-D33CyXCy.js';
7
9
  import './synonyms-CpOAHPa-.js';
8
- import './config-CIG5yDyg.js';
9
- import './index-DsEurhSl.js';
10
10
  import './types-DvncmvuQ.js';