@delali/narsil 0.3.1-next.143 → 0.3.1-next.145

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 (165) 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-HQUT2Z3I.mjs → analysis-change-D5APH4Z3.mjs} +24 -33
  13. package/dist/{browser/analysis-change-entry-7HR4LWL3.mjs → analysis-change-entry-V4SQQSXQ.mjs} +1 -1
  14. package/dist/browser/{analysis-change-JPV775LR.mjs → analysis-change-QTCQ5ETU.mjs} +5 -5
  15. package/dist/{analysis-change-entry-TZTG4AZB.mjs → browser/analysis-change-entry-KYEQSP3I.mjs} +1 -1
  16. package/dist/{chunk-46NZOPHS.mjs → browser/chunk-5WYWLTM5.mjs} +2 -2
  17. package/dist/browser/{chunk-ZEV26AQ6.mjs → chunk-6OFS7RUN.mjs} +1 -1
  18. package/dist/browser/{chunk-MZI3TEOW.mjs → chunk-75PMIFQA.mjs} +1 -1
  19. package/dist/browser/{chunk-R4WUDZQV.mjs → chunk-AOKLYVTT.mjs} +2 -2
  20. package/dist/browser/{chunk-LVY2LI35.mjs → chunk-BTMRV5MY.mjs} +2 -2
  21. package/dist/browser/{chunk-3ZBJYAS4.mjs → chunk-FHO5N7FD.mjs} +1 -1
  22. package/dist/browser/{chunk-KTOK275N.mjs → chunk-FXPMF65P.mjs} +12 -12
  23. package/dist/browser/{chunk-VFYMPCOV.mjs → chunk-GP4QLUQM.mjs} +5 -5
  24. package/dist/browser/{chunk-35B42UFM.mjs → chunk-IFGTRRPU.mjs} +9 -0
  25. package/dist/browser/{chunk-6RHTAVZX.mjs → chunk-K7UFXEJS.mjs} +31 -14
  26. package/dist/browser/{chunk-MVM33ZUL.mjs → chunk-LGJ6XMH5.mjs} +5 -5
  27. package/dist/{chunk-NN33CZRE.mjs → browser/chunk-PMBSBSCN.mjs} +2 -2
  28. package/dist/browser/{chunk-D33A5VMU.mjs → chunk-QNDWMPV2.mjs} +1 -1
  29. package/dist/browser/{chunk-HKX2G6WH.mjs → chunk-U77XQJOY.mjs} +3 -3
  30. package/dist/browser/{chunk-TCLEOZ4P.mjs → chunk-XIHLIMFX.mjs} +2 -2
  31. package/dist/browser/{chunk-WCFCHIBB.mjs → chunk-XWMEGKDC.mjs} +2 -2
  32. package/dist/browser/{chunk-5DB2VDGI.mjs → chunk-ZALEKEUH.mjs} +27 -27
  33. package/dist/browser/{chunk-MWUK3DA5.mjs → chunk-ZKVDQ5ZH.mjs} +8 -8
  34. package/dist/browser/{cold-module-MJMKNUYJ.mjs → cold-module-Y2IJAP7S.mjs} +14 -14
  35. package/dist/browser/{durability-wiring-SNOWIT6Z.mjs → durability-wiring-MLXZ5QQF.mjs} +78 -61
  36. package/dist/browser/import-FTMLTPGQ.mjs +9 -0
  37. package/dist/browser/{module-BUFNZMEU.mjs → module-5LMDGXQH.mjs} +10 -10
  38. package/dist/browser/{module-BVP4TKZU.mjs → module-Q6VFGLMG.mjs} +71 -11
  39. package/dist/browser/{phrase-module-HGVBO24W.mjs → phrase-module-KXNRTWCS.mjs} +1 -1
  40. package/dist/{restore-queue-FEYAC4SB.mjs → browser/restore-queue-SOAHKZSQ.mjs} +2 -2
  41. package/dist/browser/{runtime-VEUH674B.mjs → runtime-ZNEGK33G.mjs} +2 -2
  42. package/dist/browser/{snapshot-QXBKHJAG.mjs → snapshot-2EGS2FYU.mjs} +16 -15
  43. package/dist/browser/{write-WHFBDWQS.mjs → write-WMZA6NSF.mjs} +11 -11
  44. package/dist/{capabilities-BCdUwK_L.d.ts → capabilities-CNnzGtqP.d.ts} +3 -3
  45. package/dist/{chunk-ZMBFWQXN.mjs → chunk-2E2ZFOPT.mjs} +2 -2
  46. package/dist/{chunk-BOJZGUS6.mjs → chunk-5K2JHKM3.mjs} +1 -1
  47. package/dist/{chunk-YH5OIL7B.mjs → chunk-5QMHMELB.mjs} +6 -1
  48. package/dist/{browser/chunk-CCOAOO73.mjs → chunk-6FOJKNUR.mjs} +2 -2
  49. package/dist/{chunk-GLZHNSGB.mjs → chunk-6Z22L5RN.mjs} +1 -1
  50. package/dist/{chunk-AST3SHFA.mjs → chunk-7523VCM4.mjs} +2 -2
  51. package/dist/{chunk-KZL72VTC.mjs → chunk-7AJAW6NN.mjs} +11 -10
  52. package/dist/{chunk-DQNKVOJ2.mjs → chunk-BTARFTEN.mjs} +695 -8
  53. package/dist/{chunk-YLNSJQLX.mjs → chunk-DHEJAGVW.mjs} +5 -5
  54. package/dist/{chunk-Z4HFMYNX.mjs → chunk-DKMZ7JFW.mjs} +29 -12
  55. package/dist/{chunk-NRUXBYPH.mjs → chunk-F442VZUL.mjs} +5 -5
  56. package/dist/{chunk-O4LJQI4G.mjs → chunk-FRJ5RGX7.mjs} +126 -4
  57. package/dist/{chunk-L76W3IZJ.mjs → chunk-FTQLF5JI.mjs} +1 -1
  58. package/dist/{chunk-UIKN2OTQ.mjs → chunk-G6Q5DEF5.mjs} +37 -3
  59. package/dist/{chunk-DD2673TX.mjs → chunk-GRFXSEFF.mjs} +2 -2
  60. package/dist/{chunk-ZSWHPKGM.mjs → chunk-GVPYMSLO.mjs} +69 -2
  61. package/dist/{chunk-VEFN6X6Q.mjs → chunk-HOC5JP2H.mjs} +9 -10
  62. package/dist/{chunk-SRJBFG2T.mjs → chunk-HTMUGEFU.mjs} +6 -7
  63. package/dist/{chunk-J6YVB2XM.mjs → chunk-IJPK5PGM.mjs} +1 -1
  64. package/dist/{chunk-HNHCNTVG.mjs → chunk-IQHZMCLX.mjs} +9 -0
  65. package/dist/{chunk-C3YDYX6C.mjs → chunk-ISUOSACK.mjs} +1 -1
  66. package/dist/{chunk-YHUTF6EA.mjs → chunk-IV2XTSS2.mjs} +14 -14
  67. package/dist/chunk-K5HSUPYS.mjs +11 -0
  68. package/dist/{chunk-LA4WNDHL.mjs → chunk-KG5N7LE6.mjs} +12 -14
  69. package/dist/{chunk-NPNK57CA.mjs → chunk-LWFK3TC2.mjs} +1 -1
  70. package/dist/{chunk-RKAVHNRW.mjs → chunk-LYKUJNAV.mjs} +10 -5
  71. package/dist/{chunk-TNBIK2LQ.mjs → chunk-MJTEU2XK.mjs} +3 -4
  72. package/dist/chunk-NWTEJ2T7.mjs +100 -0
  73. package/dist/{chunk-WJGO5PGV.mjs → chunk-OH7SX5MY.mjs} +28 -16
  74. package/dist/{chunk-W2COJ5AH.mjs → chunk-ONDEEBTA.mjs} +2 -2
  75. package/dist/{chunk-PWIWSUCX.mjs → chunk-POUYICOU.mjs} +1 -1
  76. package/dist/chunk-PRID7CA6.mjs +104 -0
  77. package/dist/{chunk-ICW45TTU.mjs → chunk-QLDLQW36.mjs} +1 -1
  78. package/dist/{chunk-KEIYVZUX.mjs → chunk-QU2XF7VI.mjs} +3 -4
  79. package/dist/{chunk-74XB2SXI.mjs → chunk-QXH2CS4V.mjs} +35 -2
  80. package/dist/{chunk-ZPWS2SKJ.mjs → chunk-QYMAYU7M.mjs} +165 -11
  81. package/dist/{chunk-NJJCPFXN.mjs → chunk-RNUP6WZ6.mjs} +2 -2
  82. package/dist/{chunk-SBMAWTRG.mjs → chunk-RTVAWNUL.mjs} +80 -14
  83. package/dist/{chunk-7AUASRE7.mjs → chunk-RVBUQITB.mjs} +7 -7
  84. package/dist/{chunk-VJEGOELZ.mjs → chunk-SA52N7G3.mjs} +3 -3
  85. package/dist/{chunk-NOT5QOHU.mjs → chunk-SE7MKJVK.mjs} +1 -1
  86. package/dist/{chunk-BRUUBXCB.mjs → chunk-SNB4DYL3.mjs} +10 -38
  87. package/dist/chunk-SVO6NV4D.mjs +248 -0
  88. package/dist/{chunk-GWOS5DYC.mjs → chunk-UGQULMSU.mjs} +11 -13
  89. package/dist/{chunk-6SNBQESJ.mjs → chunk-UHVTEVF5.mjs} +5 -5
  90. package/dist/{chunk-HJJWY6PT.mjs → chunk-UQS5PAS5.mjs} +1 -1
  91. package/dist/{chunk-UUZCQQG2.mjs → chunk-W6M4RRAT.mjs} +3 -3
  92. package/dist/{browser/chunk-XNWPP5NS.mjs → chunk-WDEWU46C.mjs} +2 -2
  93. package/dist/{chunk-XZ3SRNDJ.mjs → chunk-WMIV7PJ7.mjs} +65 -5
  94. package/dist/{chunk-RHKRTYGO.mjs → chunk-X5SBWARI.mjs} +3 -3
  95. package/dist/{chunk-XS2VM7UE.mjs → chunk-XLAI4OIO.mjs} +2 -2
  96. package/dist/{chunk-IO5F7ZBE.mjs → chunk-YUCGFPMS.mjs} +454 -37
  97. package/dist/{client-B12YFALP.d.ts → client-DoYPHcUn.d.ts} +62 -5
  98. package/dist/client.d.ts +8 -8
  99. package/dist/client.mjs +44 -0
  100. package/dist/{cold-module-4X7WJCFM.mjs → cold-module-NUD332YD.mjs} +32 -41
  101. package/dist/{config-CIG5yDyg.d.ts → config-CuUfls_H.d.ts} +150 -3
  102. package/dist/{config-BhZxIeb1.d.ts → config-Dzs46im6.d.ts} +11 -2
  103. package/dist/direct-executor-FDQYQEJQ.mjs +22 -0
  104. package/dist/distribution/coordinator/etcd.d.ts +3 -3
  105. package/dist/distribution/coordinator/etcd.mjs +1 -1
  106. package/dist/distribution/coordinator/in-memory.d.ts +3 -3
  107. package/dist/distribution/transport/grpc.mjs +4 -4
  108. package/dist/distribution/transport/in-memory.mjs +2 -2
  109. package/dist/distribution/transport/tcp.mjs +3 -3
  110. package/dist/distribution.d.ts +8 -8
  111. package/dist/distribution.mjs +16219 -14535
  112. package/dist/{durability-wiring-324D2DDD.mjs → durability-wiring-K7RDXWL6.mjs} +103 -95
  113. package/dist/embeddings/openai.d.ts +1 -1
  114. package/dist/embeddings/openai.mjs +2 -2
  115. package/dist/{engine-CtzbHOmG.d.ts → engine-C0ifUEcm.d.ts} +3 -3
  116. package/dist/import-6KXFY6XI.mjs +35 -0
  117. package/dist/{index-DsEurhSl.d.ts → index-MsF7e5hL.d.ts} +2 -2
  118. package/dist/index.browser.mjs +4 -4
  119. package/dist/index.d.ts +7 -7
  120. package/dist/index.mjs +21 -30
  121. package/dist/invalidation/broadcast-channel.d.ts +1 -1
  122. package/dist/invalidation/filesystem.d.ts +1 -1
  123. package/dist/invalidation/filesystem.mjs +1 -1
  124. package/dist/invalidation/noop.d.ts +1 -1
  125. package/dist/{long-query-thread-4SW7RWDE.mjs → long-query-thread-FKVHRCHF.mjs} +18 -23
  126. package/dist/{module-DXSJ5LT2.mjs → module-GJUKW5VU.mjs} +14 -16
  127. package/dist/{module-IYPLWHGC.mjs → module-TMFIWOD2.mjs} +28 -37
  128. package/dist/{paged-partition-archive-HFP45PLU.mjs → paged-partition-archive-WNUEMYWM.mjs} +34 -39
  129. package/dist/partial-words.mjs +7 -9
  130. package/dist/pattern.mjs +4 -6
  131. package/dist/persistence/durability/checkpoint-worker.d.ts +2 -2
  132. package/dist/persistence/durability/checkpoint-worker.mjs +27 -36
  133. package/dist/{phrase-module-5QHBD2VJ.mjs → phrase-module-OMY3QQV7.mjs} +1 -1
  134. package/dist/react.d.ts +11 -11
  135. package/dist/react.mjs +9 -0
  136. package/dist/{rerank-KTLC3E6N.mjs → rerank-ZZ5CHKLW.mjs} +4 -4
  137. package/dist/rerankers/http.d.ts +1 -1
  138. package/dist/rerankers/http.mjs +2 -2
  139. package/dist/{browser/restore-queue-ONYNYUDE.mjs → restore-queue-UAVGBSJG.mjs} +2 -2
  140. package/dist/{runtime-DYV75DCB.mjs → runtime-RAOCKSYA.mjs} +5 -5
  141. package/dist/{schema-B-Runv0n.d.ts → schema-D33CyXCy.d.ts} +1 -1
  142. package/dist/server.d.ts +24 -12
  143. package/dist/server.mjs +153 -36
  144. package/dist/{snapshot-CGM65VCD.mjs → snapshot-DB5ZVCDN.mjs} +39 -48
  145. package/dist/synonyms.mjs +3 -4
  146. package/dist/{tasks-CjRJRGTb.d.ts → tasks-ChWp0wrF.d.ts} +59 -7
  147. package/dist/{thread-KGNAIKPD.mjs → thread-OV6T555H.mjs} +17 -22
  148. package/dist/vector/search-worker.d.ts +2 -2
  149. package/dist/vector/search-worker.mjs +5 -6
  150. package/dist/workers/entry.mjs +7 -7
  151. package/dist/{write-2DZPEQL2.mjs → write-KZVTLGCI.mjs} +28 -37
  152. package/openapi.json +349 -2
  153. package/package.json +27 -8
  154. package/dist/browser/import-TLB2A5LJ.mjs +0 -9
  155. package/dist/chunk-5WYVUPGD.mjs +0 -427
  156. package/dist/chunk-AV4IJKD2.mjs +0 -35
  157. package/dist/chunk-GES7U2PM.mjs +0 -68
  158. package/dist/chunk-KGOXHLLZ.mjs +0 -693
  159. package/dist/chunk-N37VMC62.mjs +0 -18
  160. package/dist/chunk-QSK35UC2.mjs +0 -35
  161. package/dist/chunk-WNBRW4Q2.mjs +0 -128
  162. package/dist/chunk-WQBCBKY3.mjs +0 -8
  163. package/dist/chunk-ZATRDAYU.mjs +0 -160
  164. package/dist/direct-executor-7XOQ7VQP.mjs +0 -28
  165. package/dist/import-OOBUW3RR.mjs +0 -44
@@ -1,17 +1,18 @@
1
- import { PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, patternSearchModule, DEFAULT_PATTERN_WORK_CAP, TYPO_CLAIM_SLOTS_PER_WORD, PATTERN_WORK_FLUSH_UNITS, MATCHER_STATE_BUDGET_BYTES } from './chunk-RKAVHNRW.mjs';
2
- import { GEO_UNIT_METRES, MAX_FILTER_DEPTH, MAX_FILTER_TESTS, FILTER_OPERAND_COPY_DEPTH } from './chunk-WQBCBKY3.mjs';
1
+ import { youngGenerationBytesOfThisV8 } from './chunk-EBIHRL7B.mjs';
2
+ import { PROCESS_LIMIT_REFRESH_INTERVAL_MS } from './chunk-22YPZVMG.mjs';
3
+ import { PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, GEO_UNIT_METRES, patternSearchModule, DEFAULT_PATTERN_WORK_CAP, MAX_FILTER_DEPTH, MAX_FILTER_TESTS, TYPO_CLAIM_SLOTS_PER_WORD, FILTER_OPERAND_COPY_DEPTH, PATTERN_WORK_FLUSH_UNITS, MATCHER_STATE_BUDGET_BYTES } from './chunk-LYKUJNAV.mjs';
3
4
  import { bitsetHas, createBitSet, bitsetSet, bitsetIsEmpty, bitsetOrInto, bitsetAndNotInto, bitsetAndInto, bitsetFromSet } from './chunk-JUKYYXSP.mjs';
4
- import { expandTermPrefix, suggestDisplayTerms, getNestedValue, textFieldsChanged, getFlatSchema, tokenizeOptions, partialWordSearchModule, getOrCreateFieldNameIndex, partitionDocumentFrequency } from './chunk-DQNKVOJ2.mjs';
5
- import { isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, partialFieldsOf, schemaFieldsOf, flattenSchema, validateDocument, validateDocumentStrict, ANTIMERIDIAN_SPAN_DEGREES, FULL_TURN_DEGREES, LOCATION_CODE_BITS_PER_AXIS, MAX_COVERING_CELLS, VINCENTY_CONVERGENCE_THRESHOLD, EARTH_RADIUS_METERS, RADIUS_BOX_MARGIN_RATIO, RADIUS_BOX_MARGIN_RADIANS, DEG_TO_RAD, VINCENTY_MAX_ITERATIONS } from './chunk-KGOXHLLZ.mjs';
5
+ import { isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, partialFieldsOf, schemaFieldsOf, expandTermPrefix, flattenSchema, suggestDisplayTerms, getNestedValue, validateDocument, validateDocumentStrict, textFieldsChanged, getFlatSchema, tokenizeOptions, partialWordSearchModule, ANTIMERIDIAN_SPAN_DEGREES, FULL_TURN_DEGREES, getOrCreateFieldNameIndex, partitionDocumentFrequency, LOCATION_CODE_BITS_PER_AXIS, MAX_COVERING_CELLS, VINCENTY_CONVERGENCE_THRESHOLD, EARTH_RADIUS_METERS, RADIUS_BOX_MARGIN_RATIO, RADIUS_BOX_MARGIN_RADIANS, DEG_TO_RAD, VINCENTY_MAX_ITERATIONS } from './chunk-BTARFTEN.mjs';
6
6
  import { MAX_SORT_FIELDS, MAX_SORT_FIELD_NAME_LENGTH, MAX_CURSOR_LENGTH, MAX_CURSOR_ANCHOR_CODE_POINTS, RESULT_WINDOW, DEFAULT_FUZZY_PREFIX_LENGTH, DEFAULT_PAGE_SIZE, PREFIX_MAX_EXPANSIONS } from './chunk-FQBFZAWG.mjs';
7
- import { fuzzyPrefixOf, boundedLevenshtein, fuzzyTermMatches } from './chunk-GES7U2PM.mjs';
8
- import { parsedTypeOf, isStringValuedBase, withSortableOption, isWordIndexedBase, isWordIndexedFieldType, isListBase } from './chunk-ZSWHPKGM.mjs';
9
- import { tokenize, visitTokens } from './chunk-NPNK57CA.mjs';
7
+ import { tokenize, visitTokens } from './chunk-LWFK3TC2.mjs';
10
8
  import { TARGET_BLOCK_ENTRIES, SCORE_BUFFER_INITIAL_TOUCHED_CAPACITY, PRUNING_REJECTION_SLACK, SORT_COLUMN_MINIMUM_REBUILD_THRESHOLD, SORT_COLUMN_REBUILD_FRACTION_SHIFT } from './chunk-4UMZ7KQL.mjs';
9
+ import { parsedTypeOf, isStringValuedBase, withSortableOption, fuzzyPrefixOf, boundedLevenshtein, isWordIndexedBase, isWordIndexedFieldType, fuzzyTermMatches, isListBase } from './chunk-GVPYMSLO.mjs';
10
+ import { isGeopointOrVectorType, PROTOTYPE_POLLUTION_KEYS } from './chunk-L5ORED7V.mjs';
11
+ import { NarsilError, ErrorCodes } from './chunk-IQHZMCLX.mjs';
11
12
  import { singleFoldTable, appendFoldedCodePoint, sortModeOf, defaultSortMode, SORT_VALUE_MAX_CODE_POINTS, toReducedSortValue, readSortField, compareComparableKeys, toComparableSortValue, isSortMode, SORT_MODES, compareSortValues, compareComparableValues, truncateSortString } from './chunk-R6A773WK.mjs';
12
13
  import { compareCodePoints, exceedsCodePoints, codePointCount, holdsUnpairedSurrogate } from './chunk-YTJCGKM4.mjs';
13
- import { isGeopointOrVectorType, PROTOTYPE_POLLUTION_KEYS } from './chunk-L5ORED7V.mjs';
14
- import { NarsilError, ErrorCodes } from './chunk-HNHCNTVG.mjs';
14
+ import { totalmem, freemem } from 'os';
15
+ import { getHeapSpaceStatistics, getHeapStatistics } from 'v8';
15
16
 
16
17
  // src/core/partition/partial-words/platform.ts
17
18
  function platformPartialWordSearch() {
@@ -177,6 +178,130 @@ var MAX_BM25_K1 = 1e3;
177
178
  var MAX_BM25_B = 1;
178
179
  var PENDING_REMOVAL_MERGE_FLOOR = 64;
179
180
  var PENDING_REMOVAL_MERGE_DIVISOR = 256;
181
+ var MEGABYTE_BYTES = 1048576;
182
+ var IN_MEGABYTES = /^--max-old-space-size=(\d+)$/;
183
+ var AS_PERCENTAGE = /^--max-old-space-size-percentage=(\d+(?:\.\d+)?)$/;
184
+ var SEMI_SPACE_IN_MEGABYTES = /^--max-semi-space-size=(\d+)$/;
185
+ var YOUNG_GENERATION_SPACES = /* @__PURE__ */ new Set(["new_space", "new_large_object_space"]);
186
+ var V8_YOUNG_GENERATION_BYTES_PER_SEMI_SPACE_BYTE = 3;
187
+ function flagEntries() {
188
+ const fromNodeOptions = (process.env.NODE_OPTIONS ?? "").split(/\s+/).filter((entry) => entry.length > 0);
189
+ return [...process.execArgv, ...fromNodeOptions];
190
+ }
191
+ function memoryTheHostAllows() {
192
+ const constrained = process.constrainedMemory?.() ?? 0;
193
+ return constrained > 0 ? constrained : totalmem();
194
+ }
195
+ function readConfiguredOldSpaceMegabytes() {
196
+ let megabytes = null;
197
+ for (const entry of flagEntries()) {
198
+ const inMegabytes = IN_MEGABYTES.exec(entry);
199
+ if (inMegabytes !== null) megabytes = Number(inMegabytes[1]);
200
+ if (AS_PERCENTAGE.test(entry)) megabytes = null;
201
+ }
202
+ return megabytes !== null && Number.isFinite(megabytes) && megabytes > 0 ? megabytes : null;
203
+ }
204
+ function readConfiguredLimit() {
205
+ let megabytes = null;
206
+ let percentage = null;
207
+ for (const entry of flagEntries()) {
208
+ const inMegabytes = IN_MEGABYTES.exec(entry);
209
+ if (inMegabytes !== null) {
210
+ megabytes = Number(inMegabytes[1]);
211
+ percentage = null;
212
+ }
213
+ const asPercentage = AS_PERCENTAGE.exec(entry);
214
+ if (asPercentage !== null) {
215
+ percentage = Number(asPercentage[1]);
216
+ megabytes = null;
217
+ }
218
+ }
219
+ const bytes = megabytes !== null && megabytes > 0 ? megabytes * MEGABYTE_BYTES : percentage !== null && percentage > 0 && percentage <= 100 ? Math.floor(memoryTheHostAllows() * percentage / 100) : null;
220
+ return bytes !== null && Number.isFinite(bytes) && bytes > 0 ? bytes : null;
221
+ }
222
+ var configuredLimit;
223
+ function configuredLimitBytes() {
224
+ if (configuredLimit === void 0) configuredLimit = readConfiguredLimit();
225
+ return configuredLimit;
226
+ }
227
+ function readConfiguredYoungGeneration() {
228
+ let megabytes = 0;
229
+ for (const entry of flagEntries()) {
230
+ const semiSpace = SEMI_SPACE_IN_MEGABYTES.exec(entry);
231
+ if (semiSpace !== null) megabytes = Number(semiSpace[1]);
232
+ }
233
+ if (!Number.isFinite(megabytes) || megabytes <= 0) return null;
234
+ const semiSpaceBytes = 2 ** Math.ceil(Math.log2(megabytes)) * MEGABYTE_BYTES;
235
+ return semiSpaceBytes * V8_YOUNG_GENERATION_BYTES_PER_SEMI_SPACE_BYTE;
236
+ }
237
+ var configuredYoungGeneration;
238
+ function configuredYoungGenerationBytes() {
239
+ if (configuredYoungGeneration === void 0) configuredYoungGeneration = readConfiguredYoungGeneration();
240
+ return configuredYoungGeneration;
241
+ }
242
+ var heapSizeLimit;
243
+ function heapSizeLimitBytes() {
244
+ if (heapSizeLimit === void 0) heapSizeLimit = getHeapStatistics().heap_size_limit;
245
+ return heapSizeLimit;
246
+ }
247
+ function readYoungGenerationCeiling() {
248
+ const fromSemiSpace = configuredYoungGenerationBytes();
249
+ if (fromSemiSpace !== null) return fromSemiSpace;
250
+ const oldSpaceMegabytes = readConfiguredOldSpaceMegabytes();
251
+ if (oldSpaceMegabytes !== null) {
252
+ const beyondOldSpace = heapSizeLimitBytes() - oldSpaceMegabytes * MEGABYTE_BYTES;
253
+ if (beyondOldSpace > 0) return beyondOldSpace;
254
+ }
255
+ return youngGenerationBytesOfThisV8();
256
+ }
257
+ var youngGenerationCeiling;
258
+ function youngGenerationCeilingBytes() {
259
+ if (youngGenerationCeiling === void 0) youngGenerationCeiling = readYoungGenerationCeiling();
260
+ return youngGenerationCeiling;
261
+ }
262
+ function readOldGenerationStatistics() {
263
+ try {
264
+ let usedBytes = 0;
265
+ let committedBytes = 0;
266
+ let youngCapacityBytes = 0;
267
+ let youngUsedBytes = 0;
268
+ for (const space of getHeapSpaceStatistics()) {
269
+ if (YOUNG_GENERATION_SPACES.has(space.space_name)) {
270
+ youngCapacityBytes += space.space_size;
271
+ youngUsedBytes += space.space_used_size;
272
+ } else {
273
+ usedBytes += space.space_used_size;
274
+ committedBytes += space.space_size;
275
+ }
276
+ }
277
+ const youngCeilingBytes = youngGenerationCeilingBytes();
278
+ const limitBytes2 = configuredLimitBytes() ?? heapSizeLimitBytes() - youngCeilingBytes;
279
+ if (!Number.isFinite(usedBytes) || !Number.isFinite(limitBytes2) || limitBytes2 <= 0) return null;
280
+ return {
281
+ usedBytes,
282
+ limitBytes: limitBytes2,
283
+ youngUsedBytes: Number.isFinite(youngUsedBytes) ? youngUsedBytes : 0,
284
+ committedBytes: Number.isFinite(committedBytes) ? committedBytes : usedBytes,
285
+ youngReserveBytes: Number.isFinite(youngCapacityBytes) ? Math.max(0, youngCeilingBytes - youngCapacityBytes) : 0,
286
+ youngCeilingBytes
287
+ };
288
+ } catch {
289
+ return null;
290
+ }
291
+ }
292
+ function readHeapStatistics() {
293
+ try {
294
+ const stats = getHeapStatistics();
295
+ const usedBytes = stats.used_heap_size;
296
+ const limitBytes2 = stats.heap_size_limit;
297
+ if (!Number.isFinite(usedBytes) || !Number.isFinite(limitBytes2) || limitBytes2 <= 0) return null;
298
+ const available = stats.total_available_size;
299
+ const availableBytes = Number.isFinite(available) && available >= 0 ? available : null;
300
+ return { usedBytes, limitBytes: limitBytes2, availableBytes, configuredLimitBytes: configuredLimitBytes() };
301
+ } catch {
302
+ return null;
303
+ }
304
+ }
180
305
 
181
306
  // src/core/partition/frozen/memory.ts
182
307
  function frozenSegmentBytes(segment) {
@@ -4795,7 +4920,7 @@ function requireLoadedPhraseCode() {
4795
4920
  }
4796
4921
  function loadPhraseCode() {
4797
4922
  if (loading === null) {
4798
- loading = import('./phrase-module-5QHBD2VJ.mjs').then(
4923
+ loading = import('./phrase-module-OMY3QQV7.mjs').then(
4799
4924
  (code) => {
4800
4925
  loaded = code;
4801
4926
  return code;
@@ -9016,5 +9141,34 @@ function fanOutMatchCount(manager, params, language, schema, options) {
9016
9141
  }
9017
9142
  return count;
9018
9143
  }
9144
+ var limitBytes = 0;
9145
+ var limitReadAt = Number.NEGATIVE_INFINITY;
9146
+ function readProcessLimit(residentBytes) {
9147
+ const hostBytes = totalmem();
9148
+ const constrained = typeof process.constrainedMemory === "function" ? process.constrainedMemory() : 0;
9149
+ if (Number.isFinite(constrained) && constrained > 0 && constrained < hostBytes) return constrained;
9150
+ if (process.platform !== "linux") return hostBytes;
9151
+ const availableBytes = freemem();
9152
+ if (!Number.isFinite(availableBytes) || availableBytes < 0) return hostBytes;
9153
+ return Math.min(hostBytes, residentBytes + availableBytes);
9154
+ }
9155
+ function processLimitBytes(residentBytes) {
9156
+ const now = performance.now();
9157
+ if (now - limitReadAt >= PROCESS_LIMIT_REFRESH_INTERVAL_MS) {
9158
+ limitBytes = readProcessLimit(residentBytes);
9159
+ limitReadAt = now;
9160
+ }
9161
+ return limitBytes;
9162
+ }
9163
+ function readResidentMemory() {
9164
+ try {
9165
+ const residentBytes = process.memoryUsage.rss();
9166
+ const limitBytes2 = processLimitBytes(residentBytes);
9167
+ if (!Number.isFinite(residentBytes) || !Number.isFinite(limitBytes2) || limitBytes2 <= 0) return null;
9168
+ return { residentBytes, limitBytes: limitBytes2 };
9169
+ } catch {
9170
+ return null;
9171
+ }
9172
+ }
9019
9173
 
9020
- export { ARRAY_POSITION_GAP, DEFAULT_BM25_B, DEFAULT_BM25_K1, FIELD_FILTER_OPERATORS, FILTER_EXPRESSION_KEYS, FNV_OFFSET_BASIS, MAX_BM25_B, MAX_BM25_K1, MAX_TERM_FREQUENCY, PATTERN_HOST, ValueAffixes, analyseQueryPhrases, applyPagination, applyPartitionFiltersBitset, applyProjection, applySorting, availablePatternSearch, bm25SetsValue, buildPartialWordTableFrom, clampRowCount, cloneProjected, collectQueryTermStats, copyVectorsInto, countPartialSpelling, countsWithoutScores, createBooleanIndex, createCompositePartition, createEnumIndex, createFrozenPartialWords, createGeoIndex, createNumericIndex, createPartitionIndex, createPatternWorkMeter, createSurfaceRegistry, decodePageCursor, documentValueBytes, documentWithOwnBuffers, encodeFieldIndexes, encodePageCursor, encodePartialSpellingsOf, encodeSegmentState, everyValueFacetConfig, fanOutMatchCount, fanOutQuery, filterTestCount, fnv1a, fnv1aContinue, fnv1aContinueTaggedNumbers, fnv1aUint32s, fulltextMatches, holdsQuotedText, isCompositePartition, joinPatternWorkMeter, kWayMerge, loadPhraseCodeFor, mergeBM25Levels, mergeDocFrequencies, mergeFacets, mergePartitionStats, normalizeSort, oversampledFacetConfig, oversampledShardSize, partialSpellingsOfDocuments, partialWordHighlighter, partialWordsToHighlight, partitionStateOf, partitionsIn, patternIndexOf, projectIncludedPaths, projectionKeepsField, pruneStatsToQueryTerms, readProjectedPath, readSortValues, recordValueSize, registerPartialWordSearch, registerPatternSearch, requireLoadedPhraseCode, requireMatchingCursor, requirePartialWordSearchFor, requirePatternSearch, requirePatternSearchFor, requireSortableFields, requireWithinResultWindow, resolveProjection, sanitizeGlobalStats, scanPostingBlocks, setNestedValue, sortModesOf, sortSignatureEntry, sortSignatureOf, survivorDocumentsOf, undeclaredFieldOnStrictIndex, validatedFilterOf, valueWithOwnBuffers };
9174
+ export { ARRAY_POSITION_GAP, DEFAULT_BM25_B, DEFAULT_BM25_K1, FIELD_FILTER_OPERATORS, FILTER_EXPRESSION_KEYS, FNV_OFFSET_BASIS, MAX_BM25_B, MAX_BM25_K1, MAX_TERM_FREQUENCY, PATTERN_HOST, ValueAffixes, analyseQueryPhrases, applyPagination, applyPartitionFiltersBitset, applyProjection, applySorting, availablePatternSearch, bm25SetsValue, buildPartialWordTableFrom, clampRowCount, cloneProjected, collectQueryTermStats, copyVectorsInto, countPartialSpelling, countsWithoutScores, createBooleanIndex, createCompositePartition, createEnumIndex, createFrozenPartialWords, createGeoIndex, createNumericIndex, createPartitionIndex, createPatternWorkMeter, createSurfaceRegistry, decodePageCursor, documentValueBytes, documentWithOwnBuffers, encodeFieldIndexes, encodePageCursor, encodePartialSpellingsOf, encodeSegmentState, everyValueFacetConfig, fanOutMatchCount, fanOutQuery, filterTestCount, fnv1a, fnv1aContinue, fnv1aContinueTaggedNumbers, fnv1aUint32s, fulltextMatches, holdsQuotedText, isCompositePartition, joinPatternWorkMeter, kWayMerge, loadPhraseCodeFor, mergeBM25Levels, mergeDocFrequencies, mergeFacets, mergePartitionStats, normalizeSort, oversampledFacetConfig, oversampledShardSize, partialSpellingsOfDocuments, partialWordHighlighter, partialWordsToHighlight, partitionStateOf, partitionsIn, patternIndexOf, processLimitBytes, projectIncludedPaths, projectionKeepsField, pruneStatsToQueryTerms, readHeapStatistics, readOldGenerationStatistics, readProjectedPath, readResidentMemory, readSortValues, recordValueSize, registerPartialWordSearch, registerPatternSearch, requireLoadedPhraseCode, requireMatchingCursor, requirePartialWordSearchFor, requirePatternSearch, requirePatternSearchFor, requireSortableFields, requireWithinResultWindow, resolveProjection, sanitizeGlobalStats, scanPostingBlocks, setNestedValue, sortModesOf, sortSignatureEntry, sortSignatureOf, survivorDocumentsOf, undeclaredFieldOnStrictIndex, validatedFilterOf, valueWithOwnBuffers };
@@ -1,5 +1,5 @@
1
- import { sanitizeSurfaceForms, patternIndexesFromWire, dropStoredVectorValues } from './chunk-YHUTF6EA.mjs';
2
- import { requireValidFieldTypes } from './chunk-KGOXHLLZ.mjs';
1
+ import { sanitizeSurfaceForms, patternIndexesFromWire, dropStoredVectorValues } from './chunk-IV2XTSS2.mjs';
2
+ import { requireValidFieldTypes } from './chunk-BTARFTEN.mjs';
3
3
  import { VALID_HNSW_METRICS } from './chunk-U476IXKQ.mjs';
4
4
  import { decode } from '@msgpack/msgpack';
5
5
 
@@ -1,13 +1,13 @@
1
- import { readRecentMemoryFigures, readMemoryFigures, answerRefusalOf } from './chunk-DD2673TX.mjs';
1
+ import { readRecentMemoryFigures, readMemoryFigures, answerRefusalOf } from './chunk-GRFXSEFF.mjs';
2
2
  import { collectGarbageBeforeRefusal, collectYoungGenerationBeforeRefusal, reportRefusalAfterCollection, reservedHeapBytes, admitHeapBytes } from './chunk-IWVEG5CX.mjs';
3
3
  import { nativeSearchCoreIsEnabled } from './chunk-DJHHF2L5.mjs';
4
4
  import { DEFAULT_RERANK_WINDOW } from './chunk-HJSN7UYG.mjs';
5
5
  import { ANALYSIS_CHANGE_MEMBERS } from './chunk-EEBCDP36.mjs';
6
- import { loadNativeCore } from './chunk-74XB2SXI.mjs';
7
- import { MAX_FILTER_DEPTH } from './chunk-WQBCBKY3.mjs';
8
- import { MAX_SORT_FIELDS } from './chunk-FQBFZAWG.mjs';
9
6
  import { HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE } from './chunk-22YPZVMG.mjs';
10
- import { NarsilError, ServerErrorCodes, ErrorCodes } from './chunk-HNHCNTVG.mjs';
7
+ import { loadNativeCore } from './chunk-QXH2CS4V.mjs';
8
+ import { MAX_FILTER_DEPTH } from './chunk-LYKUJNAV.mjs';
9
+ import { MAX_SORT_FIELDS } from './chunk-FQBFZAWG.mjs';
10
+ import { NarsilError, ServerErrorCodes, ErrorCodes } from './chunk-IQHZMCLX.mjs';
11
11
  import { randomUUID } from 'crypto';
12
12
  import { mkdtemp, open, rm } from 'fs/promises';
13
13
  import { tmpdir } from 'os';
@@ -217,6 +217,15 @@ var STATUS_BY_CODE = {
217
217
  PERSISTENCE_CRC_MISMATCH: 503,
218
218
  PERSISTENCE_WAL_CORRUPT: 503,
219
219
  PERSISTENCE_FSYNC_FAILED: 503,
220
+ PERSISTENCE_DEPENDENCY_MISSING: 500,
221
+ BACKUP_NOT_FOUND: 404,
222
+ BACKUP_ALREADY_EXISTS: 409,
223
+ BACKUP_DAMAGED: 422,
224
+ BACKUP_DURABILITY_REQUIRED: 409,
225
+ BACKUP_IN_PROGRESS: 409,
226
+ BACKUP_STORE_CLAIMED: 409,
227
+ BACKUP_STORE_NOT_CONFIGURED: 501,
228
+ BACKUP_NOT_READY: 503,
220
229
  EMBEDDING_FAILED: 503,
221
230
  RERANK_FAILED: 503,
222
231
  QUERY_ROUTING_FAILED: 503,
@@ -906,14 +915,19 @@ function validateRebalance(body) {
906
915
  }
907
916
  return null;
908
917
  }
909
- var TASK_TYPES = [
910
- "optimizeVectors",
911
- "rebalance",
912
- "restore",
913
- "import",
914
- "importExport",
915
- "rebuildAnalysis"
916
- ];
918
+ var TASK_TYPE_SET = {
919
+ optimizeVectors: true,
920
+ rebalance: true,
921
+ restore: true,
922
+ import: true,
923
+ importExport: true,
924
+ rebuildAnalysis: true,
925
+ changeAnalysis: true,
926
+ backup: true,
927
+ backupRestore: true,
928
+ backupDelete: true
929
+ };
930
+ var TASK_TYPES = Object.keys(TASK_TYPE_SET);
917
931
  var TASK_STATUSES = ["running", "succeeded", "failed", "cancelled"];
918
932
  function parseCountParam(raw, field, minimum) {
919
933
  if (raw === null) return minimum;
@@ -1571,6 +1585,57 @@ function createRouteRunner(deps) {
1571
1585
  };
1572
1586
  }
1573
1587
 
1588
+ // src/server/routes/backups.ts
1589
+ function backupRoutes(shared) {
1590
+ const { bare, named, namedBody } = shared;
1591
+ return [
1592
+ {
1593
+ method: "post",
1594
+ path: "/indexes/:name/backups",
1595
+ handler: "createBackup",
1596
+ options: namedBody,
1597
+ operationId: "createBackup",
1598
+ summary: "Back up an index to the store outside the cluster, as a task",
1599
+ tags: ["Cluster"],
1600
+ request: "CreateBackupBody",
1601
+ responses: { 202: "TaskRecord" }
1602
+ },
1603
+ {
1604
+ method: "get",
1605
+ path: "/backups",
1606
+ handler: "listBackups",
1607
+ options: bare,
1608
+ operationId: "listBackups",
1609
+ summary: "List the backups in the store outside the cluster",
1610
+ tags: ["Cluster"],
1611
+ request: null,
1612
+ responses: { 200: "BackupListResponse" }
1613
+ },
1614
+ {
1615
+ method: "post",
1616
+ path: "/backups/:backup/_restore",
1617
+ handler: "restoreBackup",
1618
+ options: namedBody,
1619
+ operationId: "restoreBackup",
1620
+ summary: "Restore a backup as a new index, as a task",
1621
+ tags: ["Cluster"],
1622
+ request: "RestoreBackupBody",
1623
+ responses: { 202: "TaskRecord" }
1624
+ },
1625
+ {
1626
+ method: "del",
1627
+ path: "/backups/:backup",
1628
+ handler: "deleteBackup",
1629
+ options: named,
1630
+ operationId: "deleteBackup",
1631
+ summary: "Delete a backup and the files that no other backup lists, as a task",
1632
+ tags: ["Cluster"],
1633
+ request: null,
1634
+ responses: { 202: "TaskRecord" }
1635
+ }
1636
+ ];
1637
+ }
1638
+
1574
1639
  // src/server/routes/documents.ts
1575
1640
  function documentRoutes(shared) {
1576
1641
  const { named, document, writeBody, readBody: readBody2, batchBody, importBody, documentWriteBody } = shared;
@@ -2305,7 +2370,8 @@ function serverRoutes(limits) {
2305
2370
  ...indexRoutes(shared),
2306
2371
  ...documentRoutes(shared),
2307
2372
  ...searchRoutes(shared),
2308
- ...maintenanceRoutes(shared)
2373
+ ...maintenanceRoutes(shared),
2374
+ ...backupRoutes(shared)
2309
2375
  ];
2310
2376
  }
2311
2377
 
@@ -1,10 +1,10 @@
1
- import { readListedFile, requireListedChecksum, segmentKey, MAX_SEGMENTS_PER_PARTITION } from './chunk-UUZCQQG2.mjs';
2
- import { littleEndianBytes, KEYWORD_SEGMENT_ENVELOPE_VERSION, decodeKeywordSegment, KEYWORD_SEGMENT_PAYLOAD_VERSION, uint64Bytes } from './chunk-KEIYVZUX.mjs';
3
- import { openChecksummedEnvelope, HEADER_SIZE, packChecksummedEnvelope } from './chunk-IO5F7ZBE.mjs';
4
- import { selectionKeeps, segmentArraysOf, mergeSegmentContents } from './chunk-WJGO5PGV.mjs';
5
- import { messagePackUpperBoundBytes } from './chunk-KGOXHLLZ.mjs';
1
+ import { littleEndianBytes, KEYWORD_SEGMENT_ENVELOPE_VERSION, decodeKeywordSegment, KEYWORD_SEGMENT_PAYLOAD_VERSION, uint64Bytes } from './chunk-QU2XF7VI.mjs';
2
+ import { readListedFile, requireListedChecksum, segmentKey, MAX_SEGMENTS_PER_PARTITION } from './chunk-W6M4RRAT.mjs';
3
+ import { openChecksummedEnvelope, HEADER_SIZE, packChecksummedEnvelope } from './chunk-YUCGFPMS.mjs';
4
+ import { selectionKeeps, segmentArraysOf, mergeSegmentContents } from './chunk-OH7SX5MY.mjs';
5
+ import { messagePackUpperBoundBytes } from './chunk-BTARFTEN.mjs';
6
6
  import { MAX_FILE_BYTES } from './chunk-U476IXKQ.mjs';
7
- import { NarsilError, ErrorCodes } from './chunk-HNHCNTVG.mjs';
7
+ import { NarsilError, ErrorCodes } from './chunk-IQHZMCLX.mjs';
8
8
  import { encode } from '@msgpack/msgpack';
9
9
 
10
10
  // src/persistence/durability/constants.ts
@@ -566,7 +566,7 @@ async function writePagedGroup(state, group) {
566
566
  const tombstones = state.tombstonesWritten ? [] : [...request.tombstones];
567
567
  const id = state.nextSegmentId;
568
568
  const key = segmentKey(request.indexName, request.partitionId, id);
569
- const { writePagedSegment } = await import('./module-IYPLWHGC.mjs');
569
+ const { writePagedSegment } = await import('./module-TMFIWOD2.mjs');
570
570
  const written = await writePagedSegment({
571
571
  directory,
572
572
  key,
@@ -1,7 +1,7 @@
1
- import { readHeapStatistics, readResidentMemory } from './chunk-ZATRDAYU.mjs';
2
- import { extractVectorFieldsFromSchema } from './chunk-KGOXHLLZ.mjs';
3
1
  import { collectAndReturnPages } from './chunk-RIIUZJQ3.mjs';
4
- import { NarsilError, ErrorCodes } from './chunk-HNHCNTVG.mjs';
2
+ import { readHeapStatistics, readResidentMemory } from './chunk-QYMAYU7M.mjs';
3
+ import { extractVectorFieldsFromSchema } from './chunk-BTARFTEN.mjs';
4
+ import { NarsilError, ErrorCodes } from './chunk-IQHZMCLX.mjs';
5
5
 
6
6
  // src/engine/snapshot/constants.ts
7
7
  var RESTORE_WORST_HEAP_BYTES_PER_STORED_BYTE = 0.2;
@@ -1,4 +1,4 @@
1
- import { NarsilError } from './chunk-HNHCNTVG.mjs';
1
+ import { NarsilError } from './chunk-IQHZMCLX.mjs';
2
2
 
3
3
  // src/http-retry/constants.ts
4
4
  var RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
@@ -1,23 +1,18 @@
1
- import { restoredEmbedding, restoredPartitionConfig, readSharedConfigFields } from './chunk-L76W3IZJ.mjs';
1
+ import { restoredEmbedding, restoredPartitionConfig, readSharedConfigFields } from './chunk-FTQLF5JI.mjs';
2
2
  import { MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR } from './chunk-JDDXV6UF.mjs';
3
3
  import { MAX_INDEX_NAME_LENGTH, INDEX_NAME_PATTERN } from './chunk-EEBCDP36.mjs';
4
- import { generateId } from './chunk-N37VMC62.mjs';
5
- import { getLanguage, decodeSynonymRules } from './chunk-WNBRW4Q2.mjs';
4
+ import { generateId } from './chunk-OH7SX5MY.mjs';
5
+ import { getLanguage, decodeSynonymRules } from './chunk-FRJ5RGX7.mjs';
6
+ import { NarsilError, ErrorCodes } from './chunk-IQHZMCLX.mjs';
6
7
  import { compareCodePoints } from './chunk-YTJCGKM4.mjs';
7
- import { NarsilError, ErrorCodes } from './chunk-HNHCNTVG.mjs';
8
8
  import { encode, decode } from '@msgpack/msgpack';
9
9
 
10
- // src/narsil/write-blocks.ts
11
- var writeBlockLookups = /* @__PURE__ */ new WeakMap();
12
- function bindWriteBlockLookup(owner, lookup) {
13
- writeBlockLookups.set(owner, lookup);
14
- }
15
- function writeBlockLookupOf(owner) {
16
- return writeBlockLookups.get(owner);
10
+ // src/distribution/payload-guards.ts
11
+ function isRecord(value) {
12
+ return value !== null && typeof value === "object" && !Array.isArray(value);
17
13
  }
18
- function bindEngineWriteBlock(engine, owner) {
19
- const lookup = writeBlockLookups.get(owner);
20
- if (lookup !== void 0) writeBlockLookups.set(engine, lookup);
14
+ function isValidInteger(value) {
15
+ return typeof value === "number" && Number.isFinite(value) && Number.isInteger(value);
21
16
  }
22
17
 
23
18
  // src/distribution/cluster/constants.ts
@@ -60,29 +55,6 @@ var DEFAULT_NODE_LIFECYCLE_CONFIG = {
60
55
  };
61
56
  var MAX_SYNONYM_GENERATION_LENGTH = 128;
62
57
 
63
- // src/narsil/index-reads.ts
64
- var boundReads = /* @__PURE__ */ new WeakMap();
65
- function bindIndexReads(engine, reads) {
66
- boundReads.set(engine, reads);
67
- }
68
- function indexReadsOf(engine) {
69
- const bound = boundReads.get(engine);
70
- if (bound !== void 0) return bound;
71
- return {
72
- listIndexes: async () => engine.listIndexes(),
73
- getStats: async (indexName) => engine.getStats(indexName),
74
- getPartitionStats: async (indexName) => engine.getPartitionStats(indexName)
75
- };
76
- }
77
-
78
- // src/distribution/payload-guards.ts
79
- function isRecord(value) {
80
- return value !== null && typeof value === "object" && !Array.isArray(value);
81
- }
82
- function isValidInteger(value) {
83
- return typeof value === "number" && Number.isFinite(value) && Number.isInteger(value);
84
- }
85
-
86
58
  // src/distribution/cluster/synonym-set.ts
87
59
  var SYNONYM_CHUNK_BYTES = 1048576;
88
60
  var SYNONYM_SET_PREFIX = "_narsil/synonyms/";
@@ -604,4 +576,4 @@ function storedSynonymSetOf(bytes) {
604
576
  return ref === null ? null : { indexUuid: decoded.indexUuid, ref };
605
577
  }
606
578
 
607
- export { ALLOCATION_CAS_ATTEMPTS, ALLOCATION_RETRY_DELAY_MS, ANALYSIS_CHANGE_POLL_INTERVAL_MS, ANALYSIS_CHANGE_RETRY_MS, ANALYSIS_REBUILD_RESEND_MS, BOOTSTRAP_CAS_ATTEMPTS, DEFAULT_CONTROLLER_CONFIG, DEFAULT_NODE_LIFECYCLE_CONFIG, ESTIMATED_PARTITION_BYTES, HIDDEN_GENERATION_PREFIX, LEADERSHIP_IMBALANCE_THRESHOLD, MAX_RESHARD_CUTOVER_ATTEMPTS, PARTITION_STORES_TIMEOUT_MS, REBALANCE_THRESHOLD, RECOVERY_CAS_ATTEMPTS, RESHARD_CONTROLLER_POLL_INTERVAL_MS, RESHARD_CUTOVER_LAG_ENTRIES, RESHARD_CUTOVER_TIMEOUT_MS, RESHARD_FORWARD_BATCH_DOCUMENTS, RESHARD_POLL_INTERVAL_MS, RESHARD_RECORD_CAS_ATTEMPTS, RESHARD_RECORD_CHECK_INTERVAL_MS, RESHARD_RETRY_DELAY_MS, TEARDOWN_CAS_ATTEMPTS, TEARDOWN_RETRY_DELAY_MS, TEARDOWN_RETRY_ROUNDS, bindEngineWriteBlock, bindIndexReads, bindWriteBlockLookup, decodeIndexSettings, deleteSynonymSet, getClusterIndexConfig, getIndexMetadata, indexConfigFromSettings, indexConfigKey, indexMetadataSnapshotOf, indexReadsOf, indexSettingsOf, indexUuidOfStoredMetadata, isRecord, isRecord2, isValidInteger, metadataWithBm25, metadataWithSynonymSet, putGenerationMetadata, putIndexMetadata, putIndexReplicationFactor, readIndexMetadataSnapshot, readIndexState, storeSynonymSet, storedSynonymSetOf, validateIndexName, withPartitionCount, writeBlockLookupOf };
579
+ export { ALLOCATION_CAS_ATTEMPTS, ALLOCATION_RETRY_DELAY_MS, ANALYSIS_CHANGE_POLL_INTERVAL_MS, ANALYSIS_CHANGE_RETRY_MS, ANALYSIS_REBUILD_RESEND_MS, BOOTSTRAP_CAS_ATTEMPTS, DEFAULT_CONTROLLER_CONFIG, DEFAULT_NODE_LIFECYCLE_CONFIG, ESTIMATED_PARTITION_BYTES, HIDDEN_GENERATION_PREFIX, LEADERSHIP_IMBALANCE_THRESHOLD, MAX_RESHARD_CUTOVER_ATTEMPTS, PARTITION_STORES_TIMEOUT_MS, REBALANCE_THRESHOLD, RECOVERY_CAS_ATTEMPTS, RESHARD_CONTROLLER_POLL_INTERVAL_MS, RESHARD_CUTOVER_LAG_ENTRIES, RESHARD_CUTOVER_TIMEOUT_MS, RESHARD_FORWARD_BATCH_DOCUMENTS, RESHARD_POLL_INTERVAL_MS, RESHARD_RECORD_CAS_ATTEMPTS, RESHARD_RECORD_CHECK_INTERVAL_MS, RESHARD_RETRY_DELAY_MS, TEARDOWN_CAS_ATTEMPTS, TEARDOWN_RETRY_DELAY_MS, TEARDOWN_RETRY_ROUNDS, decodeIndexSettings, deleteSynonymSet, getClusterIndexConfig, getIndexMetadata, indexConfigFromSettings, indexConfigKey, indexMetadataSnapshotOf, indexSettingsOf, indexUuidOfStoredMetadata, isRecord, isRecord2, isValidInteger, metadataWithBm25, metadataWithSynonymSet, putGenerationMetadata, putIndexMetadata, putIndexReplicationFactor, readIndexMetadataSnapshot, readIndexState, storeSynonymSet, storedSynonymSetOf, validateIndexName, withPartitionCount };