@delali/narsil 0.4.1-next.215 → 0.4.2-next.271

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 (157) hide show
  1. package/README.md +1 -1
  2. package/dist/adapters/filesystem.d.ts +1 -1
  3. package/dist/adapters/filesystem.mjs +9 -3
  4. package/dist/adapters/gcs.d.ts +1 -1
  5. package/dist/adapters/indexeddb.d.ts +6 -1
  6. package/dist/adapters/indexeddb.mjs +20 -26
  7. package/dist/adapters/memory.d.ts +1 -1
  8. package/dist/adapters/s3.d.ts +1 -1
  9. package/dist/{adapters-pljAqmrC.d.ts → adapters-8LcdNB77.d.ts} +18 -1
  10. package/dist/browser/{chunk-GBJSEHVJ.mjs → chunk-DPRCAVC2.mjs} +14 -8
  11. package/dist/browser/{chunk-YINZFPLT.mjs → chunk-WRRXR57N.mjs} +1 -1
  12. package/dist/browser/{chunk-QAOVAYAG.mjs → chunk-XBWABEL3.mjs} +1 -1
  13. package/dist/browser/{chunk-4E5APHTM.mjs → chunk-Y5CSZDOH.mjs} +1 -1
  14. package/dist/browser/{durability-config-75NSFCQN.mjs → durability-config-UP3OTUMB.mjs} +34 -2
  15. package/dist/browser/{msgpack-leaf-44XNWSSY.mjs → msgpack-leaf-FEPCLXXY.mjs} +7 -1
  16. package/dist/browser/{optional-reads-6LN3HMUH.mjs → optional-reads-NQO5DKM4.mjs} +18 -16
  17. package/dist/browser/{optional-writes-76DWMRQH.mjs → optional-writes-HVPPDHSY.mjs} +259 -104
  18. package/dist/browser/{storage-leaf-5UTR5K7J.mjs → storage-leaf-42IZEOJJ.mjs} +1473 -305
  19. package/dist/{capabilities-BOFFMx84.d.ts → capabilities-BoWiLNv7.d.ts} +76 -61
  20. package/dist/{chunk-DBC4EJWB.mjs → chunk-33ZMFOAR.mjs} +1 -1
  21. package/dist/{chunk-NCIGNQJE.mjs → chunk-4GCHJ3XD.mjs} +930 -387
  22. package/dist/{chunk-7P5YWDRQ.mjs → chunk-4WQNWAQE.mjs} +1 -1
  23. package/dist/{chunk-357KIU5E.mjs → chunk-5E3TJ4P3.mjs} +5 -5
  24. package/dist/{chunk-GXCDWLQI.mjs → chunk-5GYGHPCH.mjs} +7 -1
  25. package/dist/{chunk-SMQPZHPS.mjs → chunk-ATQ6JR3I.mjs} +1 -1
  26. package/dist/{chunk-2K24MEYV.mjs → chunk-BBIAUHAB.mjs} +3 -3
  27. package/dist/{react-native/chunks/chunk-MMPBO4WR.mjs → chunk-DA32WXBT.mjs} +2 -2
  28. package/dist/{chunk-MSJD74GN.mjs → chunk-EALKCTWH.mjs} +5 -5
  29. package/dist/{chunk-755NM4PL.mjs → chunk-FOGTBAYN.mjs} +183 -21
  30. package/dist/{chunk-6GHX35ZM.mjs → chunk-GTBJSNN2.mjs} +1 -1
  31. package/dist/{chunk-DDUXEJXW.mjs → chunk-H6LWGMPQ.mjs} +45 -22
  32. package/dist/{chunk-UNEEFTEU.mjs → chunk-HZ3OAUTL.mjs} +2 -1
  33. package/dist/{chunk-M3B7SGJB.mjs → chunk-KL4ORYJW.mjs} +6 -6
  34. package/dist/{chunk-IL5DRCNU.mjs → chunk-KQWTS7AM.mjs} +1 -1
  35. package/dist/{chunk-DKIMHIBC.mjs → chunk-KX3OP6VP.mjs} +2 -2
  36. package/dist/{chunk-D456ZFPQ.mjs → chunk-MIIJ5O3O.mjs} +2 -2
  37. package/dist/{chunk-PP3W5PQQ.mjs → chunk-MS746XNY.mjs} +285 -118
  38. package/dist/{chunk-WM5KJSQV.mjs → chunk-NFA3WHJU.mjs} +1 -1
  39. package/dist/{react-native/chunks/chunk-ZUJCUPVS.mjs → chunk-OETLM4EH.mjs} +1 -1
  40. package/dist/{chunk-MYN4K5IS.mjs → chunk-OLXFIUIZ.mjs} +1 -1
  41. package/dist/{chunk-P4F4UWLC.mjs → chunk-PSO7V7VW.mjs} +17 -3
  42. package/dist/{chunk-X3EQCQLP.mjs → chunk-Q4NLL66U.mjs} +2 -2
  43. package/dist/{chunk-WC5KAWXQ.mjs → chunk-QJFKL4NK.mjs} +4 -4
  44. package/dist/{chunk-MSIN4NM3.mjs → chunk-S3JHYPH7.mjs} +6 -1
  45. package/dist/{chunk-3IE3A74H.mjs → chunk-SSITKQU6.mjs} +3 -3
  46. package/dist/{chunk-B3MO37YF.mjs → chunk-TANKI7TG.mjs} +1 -1
  47. package/dist/{chunk-Z7XSHKOF.mjs → chunk-TI4G3SIG.mjs} +63 -144
  48. package/dist/{chunk-OGYSPNL2.mjs → chunk-TT3UDDL3.mjs} +7 -7
  49. package/dist/{react-native/chunks/chunk-4FUCRLSA.mjs → chunk-VHIOGDVD.mjs} +1 -1
  50. package/dist/{chunk-AXDB6KUQ.mjs → chunk-W3JH2IK6.mjs} +4 -4
  51. package/dist/{chunk-CERPUGRK.mjs → chunk-WIT6B5OB.mjs} +2 -2
  52. package/dist/{chunk-MI6UZGUR.mjs → chunk-XGVSG6ZU.mjs} +3 -3
  53. package/dist/{chunk-6I6OO6B2.mjs → chunk-XWPNRHTG.mjs} +4 -4
  54. package/dist/{chunk-WTMCGZ74.mjs → chunk-YHZSSPG3.mjs} +2 -2
  55. package/dist/chunk-ZYEEOZTT.mjs +52 -0
  56. package/dist/{client-BhNxHtcZ.d.ts → client-B0NPZSKY.d.ts} +4 -4
  57. package/dist/client.d.ts +9 -9
  58. package/dist/client.mjs +2 -2
  59. package/dist/{config-P9zW3Zz7.d.ts → config-B3-sw887.d.ts} +3 -3
  60. package/dist/{config-BJSL7piq.d.ts → config-DL_nkguq.d.ts} +4 -4
  61. package/dist/{direct-executor-GWJXDFLD.mjs → direct-executor-PCBB6FCO.mjs} +4 -4
  62. package/dist/distribution/coordinator/etcd.d.ts +3 -3
  63. package/dist/distribution/coordinator/etcd.mjs +33 -3
  64. package/dist/distribution/coordinator/in-memory.d.ts +3 -3
  65. package/dist/distribution/transport/grpc.mjs +4 -4
  66. package/dist/distribution/transport/in-memory.mjs +1 -1
  67. package/dist/distribution/transport/tcp.mjs +12 -7
  68. package/dist/distribution.d.ts +8 -8
  69. package/dist/distribution.mjs +167 -91
  70. package/dist/{durability-config-VWS2K24E.mjs → durability-config-HWKWP35M.mjs} +34 -2
  71. package/dist/embeddings/openai.d.ts +7 -3
  72. package/dist/embeddings/openai.mjs +37 -31
  73. package/dist/{engine-DoFnkRoF.d.ts → engine-DGG_yX0p.d.ts} +3 -3
  74. package/dist/{index-B_vmxpgW.d.ts → index-fX_FbuRT.d.ts} +1 -1
  75. package/dist/index.browser.mjs +3 -3
  76. package/dist/index.d.ts +7 -7
  77. package/dist/index.mjs +4 -4
  78. package/dist/index.react-native.mjs +4 -4
  79. package/dist/invalidation/broadcast-channel.d.ts +1 -1
  80. package/dist/invalidation/filesystem.d.ts +1 -1
  81. package/dist/invalidation/noop.d.ts +1 -1
  82. package/dist/{long-query-thread-GNTDYDOZ.mjs → long-query-thread-4ALYIIC4.mjs} +14 -14
  83. package/dist/msgpack-leaf-6ZBZWFRD.mjs +9 -0
  84. package/dist/{optional-reads-UCS23AWP.mjs → optional-reads-ESDVS225.mjs} +18 -16
  85. package/dist/{optional-writes-2AHJCGTY.mjs → optional-writes-2OK4TOLY.mjs} +9 -8
  86. package/dist/{paged-partition-archive-GBAHDT55.mjs → paged-partition-archive-Y5OAKNRB.mjs} +13 -13
  87. package/dist/partial-words.browser.mjs +3 -3
  88. package/dist/partial-words.mjs +4 -4
  89. package/dist/pattern.browser.mjs +2 -2
  90. package/dist/pattern.mjs +2 -2
  91. package/dist/persistence/durability/checkpoint-worker.d.ts +2 -2
  92. package/dist/persistence/durability/checkpoint-worker.mjs +14 -14
  93. package/dist/{query-actions-IDCUA7UV.mjs → query-actions-UQVQZFIJ.mjs} +4 -4
  94. package/dist/query-suggestions/merge-worker.mjs +7 -7
  95. package/dist/query-suggestions.browser.mjs +3 -3
  96. package/dist/query-suggestions.d.ts +3 -3
  97. package/dist/query-suggestions.mjs +5 -5
  98. package/dist/{chunk-F26DOOUH.mjs → react-native/chunks/chunk-4OOUY2K7.mjs} +1 -1
  99. package/dist/react-native/chunks/{chunk-LPX26NNL.mjs → chunk-5MYHYBET.mjs} +286 -118
  100. package/dist/react-native/chunks/{chunk-MRH36RN3.mjs → chunk-AVCMTWET.mjs} +1 -1
  101. package/dist/react-native/chunks/{chunk-HTBY4GON.mjs → chunk-GS6LGXY3.mjs} +1 -1
  102. package/dist/{chunk-UHLFCGZ3.mjs → react-native/chunks/chunk-LE4DTMDL.mjs} +2 -2
  103. package/dist/react-native/chunks/{chunk-TG56N5JC.mjs → chunk-VIO5IPF7.mjs} +2 -2
  104. package/dist/react-native/chunks/{chunk-UO44MA5M.mjs → chunk-VRI5XH2M.mjs} +7 -1
  105. package/dist/{chunk-R2PJKSNL.mjs → react-native/chunks/chunk-XGS2UYVI.mjs} +1 -1
  106. package/dist/react-native/chunks/{chunk-AJAH6X7W.mjs → chunk-XW6GZQWP.mjs} +4 -4
  107. package/dist/react-native/chunks/{chunk-SCGBU47K.mjs → chunk-Z44S6WW5.mjs} +2 -2
  108. package/dist/react-native/chunks/{durability-config-FCSD4MXY.mjs → durability-config-HJETGZVB.mjs} +34 -2
  109. package/dist/react-native/chunks/msgpack-leaf-4MIGXWZT.mjs +7 -0
  110. package/dist/react-native/chunks/{optional-reads-4XCJ34QG.mjs → optional-reads-TN3PT6M4.mjs} +18 -16
  111. package/dist/react-native/chunks/{optional-writes-XYZVTBFB.mjs → optional-writes-LZDHB7FX.mjs} +8 -7
  112. package/dist/react-native/chunks/{restore-queue-NOKQZJ2Z.mjs → restore-queue-J7SB263E.mjs} +7 -7
  113. package/dist/react-native/chunks/{segment-codec-leaf-3ZXBJVKH.mjs → segment-codec-leaf-PEKX7TBL.mjs} +5 -5
  114. package/dist/react-native/chunks/{segment-merge-leaf-3Z7MMPWE.mjs → segment-merge-leaf-I2EC7H6R.mjs} +6 -6
  115. package/dist/react-native/chunks/{storage-leaf-KJOX3MMW.mjs → storage-leaf-RQXM7HBO.mjs} +1481 -314
  116. package/dist/react-native/chunks/{store-leaf-QGLVSO5X.mjs → store-leaf-EZGCLSLM.mjs} +6 -6
  117. package/dist/react-native/chunks/{suggestions-leaf-6GI5ZSW6.mjs → suggestions-leaf-JNGH2JYC.mjs} +6 -6
  118. package/dist/react-native/chunks/{worker-copies-ALOD7TSP.mjs → worker-copies-2OWLLBCV.mjs} +5 -5
  119. package/dist/react-native/partial-words.mjs +4 -4
  120. package/dist/react-native/pattern.mjs +2 -2
  121. package/dist/react-native/query-suggestions.mjs +4 -4
  122. package/dist/react-native/sync.mjs +4 -4
  123. package/dist/react-native/synonyms.mjs +4 -4
  124. package/dist/react.d.ts +10 -10
  125. package/dist/react.mjs +0 -2
  126. package/dist/{rerank-HB6DU6GS.mjs → rerank-TQ4SU76L.mjs} +4 -4
  127. package/dist/rerankers/http.d.ts +1 -1
  128. package/dist/rerankers/http.mjs +19 -15
  129. package/dist/{restore-queue-VUQHGCXE.mjs → restore-queue-W7U2X6V3.mjs} +7 -7
  130. package/dist/{schema-CzG9OUw5.d.ts → schema-CFnQ-WI3.d.ts} +1 -1
  131. package/dist/{segment-codec-leaf-TW2FPAAT.mjs → segment-codec-leaf-WGP4FBXF.mjs} +5 -5
  132. package/dist/{segment-merge-leaf-BS3QV5PZ.mjs → segment-merge-leaf-FYWJQSPL.mjs} +5 -5
  133. package/dist/server.d.ts +86 -12
  134. package/dist/server.mjs +2243 -1918
  135. package/dist/{storage-leaf-5IG2HPNY.mjs → storage-leaf-GRG44RQA.mjs} +1193 -219
  136. package/dist/{store-leaf-ZWSOK2DV.mjs → store-leaf-YDJVH73G.mjs} +6 -6
  137. package/dist/{suggestions-leaf-MUZNKQVF.mjs → suggestions-leaf-5UFJV7SC.mjs} +8 -8
  138. package/dist/sync/filesystem.d.ts +4 -4
  139. package/dist/sync/filesystem.mjs +12 -12
  140. package/dist/sync/indexeddb.browser.mjs +1 -1
  141. package/dist/sync/indexeddb.d.ts +4 -4
  142. package/dist/sync/indexeddb.mjs +2 -2
  143. package/dist/sync.browser.mjs +4 -4
  144. package/dist/sync.d.ts +5 -5
  145. package/dist/sync.mjs +4 -4
  146. package/dist/synonyms.browser.mjs +3 -3
  147. package/dist/synonyms.mjs +4 -4
  148. package/dist/{tasks-DrLiolTG.d.ts → tasks-B2MDjPL0.d.ts} +4 -4
  149. package/dist/{thread-6ZBCENAP.mjs → thread-6YLVL2NC.mjs} +13 -13
  150. package/dist/{types-pS-mAJmX.d.ts → types-DGjk684l.d.ts} +2 -2
  151. package/dist/vector/search-worker.d.ts +2 -2
  152. package/dist/{worker-copies-32HWFUH7.mjs → worker-copies-IP4L7KEW.mjs} +7 -7
  153. package/dist/workers/entry.mjs +16 -16
  154. package/package.json +12 -10
  155. package/dist/chunk-HLPRHOSO.mjs +0 -17
  156. package/dist/msgpack-leaf-H5ZYW7S7.mjs +0 -9
  157. package/dist/react-native/chunks/msgpack-leaf-JMNGSTRW.mjs +0 -7
@@ -866,7 +866,7 @@ var loaded = null;
866
866
  var loading = null;
867
867
  function loadMessagePack() {
868
868
  if (loaded !== null) return Promise.resolve(loaded);
869
- loading ??= import('./msgpack-leaf-JMNGSTRW.mjs').then(
869
+ loading ??= import('./msgpack-leaf-4MIGXWZT.mjs').then(
870
870
  (code) => {
871
871
  code.bindMsgpackHost({
872
872
  BYTE_ORDER_MARK_WALK_BYTES_PER_HEADER,
@@ -1,4 +1,4 @@
1
- import { requireLoadedMessagePack, getNestedValue, parsedTypeOf } from './chunk-MRH36RN3.mjs';
1
+ import { requireLoadedMessagePack, getNestedValue, parsedTypeOf } from './chunk-AVCMTWET.mjs';
2
2
  import { NarsilError, ErrorCodes } from './chunk-43R4GCM7.mjs';
3
3
 
4
4
  // src/core/bitset.ts
@@ -1,5 +1,5 @@
1
- import { createNumericIndex, createBooleanIndex, createEnumIndex, createLoadedGeoIndex, rebuildSizeIndexes, requirePatternSearch, patternIndexOf } from './chunk-PP3W5PQQ.mjs';
2
- import { getFlatSchema, schemaFieldsOf, getNestedValue } from './chunk-7P5YWDRQ.mjs';
1
+ import { createNumericIndex, createBooleanIndex, createEnumIndex, createLoadedGeoIndex, rebuildSizeIndexes, requirePatternSearch, patternIndexOf } from './chunk-5MYHYBET.mjs';
2
+ import { getFlatSchema, schemaFieldsOf, getNestedValue } from './chunk-AVCMTWET.mjs';
3
3
 
4
4
  // src/core/partition/pattern-snapshot.ts
5
5
  function serializePatternIndexes(state, schema) {
@@ -1,5 +1,5 @@
1
- import { MAX_HISTORY_FILE_BYTES, openChecksummedEnvelope, KEY_FINGERPRINT_BYTES, DAY_MS, dayFileKey, SCRAMBLED_ID_BYTES, restoreStagingPrefix, resolveSetting, QUERY_HISTORY_ARCHIVE_PREFIX, restoredFileKey, attachedRuntimeOf, MAX_INDEX_UUID_LENGTH, HEADER_SIZE, isGroup, isNormalPhrase, MAX_MAX_LENGTH, MAX_MAX_WORDS, listHistoryFolder, historyFileOf, MIN_PHRASE_TABLE_CAPACITY, PERSON_TABLE_MIN_SLOTS, PAIR_PAGE_BLOCKS, PAIR_BLOCK_SLOTS, packEnvelopeWithChecksum, crc32, MAX_PEOPLE_PER_PHRASE_IN_FILE } from './chunk-SCGBU47K.mjs';
2
- import { loadSuggestionsCode, emitWriteEventAfter, dropEngineIndex } from './chunk-LPX26NNL.mjs';
1
+ import { MAX_HISTORY_FILE_BYTES, openChecksummedEnvelope, KEY_FINGERPRINT_BYTES, DAY_MS, dayFileKey, SCRAMBLED_ID_BYTES, restoreStagingPrefix, resolveSetting, QUERY_HISTORY_ARCHIVE_PREFIX, restoredFileKey, attachedRuntimeOf, MAX_INDEX_UUID_LENGTH, HEADER_SIZE, isGroup, isNormalPhrase, MAX_MAX_LENGTH, MAX_MAX_WORDS, listHistoryFolder, historyFileOf, MIN_PHRASE_TABLE_CAPACITY, PERSON_TABLE_MIN_SLOTS, PAIR_PAGE_BLOCKS, PAIR_BLOCK_SLOTS, packEnvelopeWithChecksum, crc32, MAX_PEOPLE_PER_PHRASE_IN_FILE } from './chunk-Z44S6WW5.mjs';
2
+ import { loadSuggestionsCode, emitWriteEventAfter, dropEngineIndex } from './chunk-5MYHYBET.mjs';
3
3
  import { NarsilError, ErrorCodes } from './chunk-43R4GCM7.mjs';
4
4
 
5
5
  // src/query-suggestions/engine-hooks.ts
@@ -225,8 +225,14 @@ function decode(bytes) {
225
225
  sharedDecoder ??= new Decoder();
226
226
  return sharedDecoder.decode(bytes);
227
227
  }
228
+ function decodeBoundedMessage(bytes) {
229
+ if (scanStrings(bytes, 0, null, Number.POSITIVE_INFINITY) === null) {
230
+ throw new RangeError("Invalid MessagePack value header");
231
+ }
232
+ return decode(bytes);
233
+ }
228
234
  function decodeMulti(bytes) {
229
235
  return new Decoder().decodeMulti(bytes);
230
236
  }
231
237
 
232
- export { Decoder, MAP_TAGS, bindMsgpackHost, decode, decodeMulti, encodeDocument, headerAt };
238
+ export { Decoder, MAP_TAGS, bindMsgpackHost, decode, decodeBoundedMessage, decodeMulti, encodeDocument, headerAt };
@@ -1,4 +1,4 @@
1
- import { getNestedValue } from './chunk-7P5YWDRQ.mjs';
1
+ import { getNestedValue } from './chunk-AVCMTWET.mjs';
2
2
 
3
3
  // src/serialization/vector-field-bytes.ts
4
4
  var FORBIDDEN_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
@@ -1,7 +1,7 @@
1
- import { createSurfaceRegistry, SegmentRefusal, encodeSurfaceTable, encodePartialSpellingsOf, encodeStringBlob, mergeTextAt, generateId, encodeExternalIdTableData, buildPartialWordTableFrom, wrapFrozenTokenTable, encodeDocumentTableData, topLevelMapKeys, mergeStoredFields, prepareDocumentText, recordValueSize, patternIndexOf, encodeFieldIndexes, mergeFieldRegions, sameFields, partialSpellingsOfDocuments, storedDocumentsOf, encodeFrozenTokenTableData, mergeKeywordSources, GrowingSegment, LivePostings, createSpellingTable, createNumericIndex, createBooleanIndex, createEnumIndex, createLoadedGeoIndex } from './chunk-LPX26NNL.mjs';
2
- import { storedText, bitsetIterator } from './chunk-HTBY4GON.mjs';
3
- import { encodeDocument } from './chunk-UO44MA5M.mjs';
4
- import { schemaFieldsOf, getNestedValue, isWordIndexedBase, validateDocument, validateDocumentStrict } from './chunk-MRH36RN3.mjs';
1
+ import { createSurfaceRegistry, SegmentRefusal, encodeSurfaceTable, encodePartialSpellingsOf, encodeStringBlob, mergeTextAt, generateId, encodeExternalIdTableData, buildPartialWordTableFrom, wrapFrozenTokenTable, encodeDocumentTableData, topLevelMapKeys, mergeStoredFields, prepareDocumentText, recordValueSize, patternIndexOf, encodeFieldIndexes, mergeFieldRegions, sameFields, partialSpellingsOfDocuments, storedDocumentsOf, encodeFrozenTokenTableData, mergeKeywordSources, GrowingSegment, LivePostings, createSpellingTable, createNumericIndex, createBooleanIndex, createEnumIndex, createLoadedGeoIndex } from './chunk-5MYHYBET.mjs';
2
+ import { storedText, bitsetIterator } from './chunk-GS6LGXY3.mjs';
3
+ import { encodeDocument } from './chunk-VRI5XH2M.mjs';
4
+ import { schemaFieldsOf, getNestedValue, isWordIndexedBase, validateDocument, validateDocumentStrict } from './chunk-AVCMTWET.mjs';
5
5
  import { NarsilError, ErrorCodes } from './chunk-43R4GCM7.mjs';
6
6
 
7
7
  // src/engine/orchestration/eligibility.ts
@@ -1,5 +1,5 @@
1
- import { VERSION, GROUP_PATTERN_SOURCE, loadGzip } from './chunk-LPX26NNL.mjs';
2
- import { flattenSchema } from './chunk-MRH36RN3.mjs';
1
+ import { VERSION, GROUP_PATTERN_SOURCE, loadGzip } from './chunk-5MYHYBET.mjs';
2
+ import { flattenSchema } from './chunk-AVCMTWET.mjs';
3
3
  import { MAX_FILE_BYTES, CHECKSUM_YIELD_CHUNK_BYTES } from './chunk-VUJCSQG5.mjs';
4
4
  import { NarsilError, ErrorCodes } from './chunk-43R4GCM7.mjs';
5
5
  import { encode } from '@msgpack/msgpack';
@@ -55,11 +55,37 @@ function filesystemBackedDirectory(config) {
55
55
  }
56
56
  return null;
57
57
  }
58
+ function indexedDBLocationOf(config) {
59
+ const location = config.persistence?.indexedDB;
60
+ if (location === void 0) return null;
61
+ const { databaseName, storeName } = location;
62
+ if (typeof databaseName !== "string" || databaseName.length === 0) {
63
+ throw configError("persistence.indexedDB.databaseName must be a non-empty string");
64
+ }
65
+ if (typeof storeName !== "string" || storeName.length === 0) {
66
+ throw configError("persistence.indexedDB.storeName must be a non-empty string");
67
+ }
68
+ return { databaseName, storeName };
69
+ }
70
+ function requireNoLogFieldsOnSharedStore(durability) {
71
+ for (const field of WAL_ONLY_FIELDS) {
72
+ if (durability?.[field] !== void 0) {
73
+ throw configError(
74
+ `durability.${field} applies to the write-ahead log, which an IndexedDB store that an invalidation adapter shares between tabs cannot keep. Remove durability.${field}, or remove the invalidation adapter`
75
+ );
76
+ }
77
+ }
78
+ }
58
79
  function resolveDurabilityTier(config) {
59
80
  const filesystemDirectory = filesystemBackedDirectory(config);
81
+ const indexedDB = filesystemDirectory === null ? indexedDBLocationOf(config) : null;
60
82
  if (config.durability) {
61
83
  requireValidDurabilityConfig(config.durability);
62
84
  }
85
+ if (indexedDB !== null && config.persistence !== void 0 && config.invalidation !== void 0 && config.durability?.tier === void 0) {
86
+ requireNoLogFieldsOnSharedStore(config.durability);
87
+ return { kind: "snapshot", config: { ...config.durability }, adapter: config.persistence };
88
+ }
63
89
  if (config.durability?.tier === "snapshot") {
64
90
  if (config.persistence === void 0) {
65
91
  throw configError(
@@ -75,13 +101,16 @@ function resolveDurabilityTier(config) {
75
101
  if (filesystemDirectory !== null) {
76
102
  return { kind: "wal", config: { ...config.durability, directory: filesystemDirectory } };
77
103
  }
104
+ if (indexedDB !== null) {
105
+ return { kind: "wal", config: { ...config.durability }, indexedDB };
106
+ }
78
107
  if (config.persistence !== void 0) {
79
108
  throw configError(
80
- "WAL durability requires a filesystem directory, but the configured persistence adapter is not filesystem-backed. Use a filesystem persistence adapter or set durability.directory"
109
+ 'WAL durability requires a filesystem directory or the IndexedDB persistence adapter, and the configured persistence adapter is neither. Use one of those adapters, set durability.directory, or set durability.tier to "snapshot"'
81
110
  );
82
111
  }
83
112
  throw configError(
84
- "Durability requires a directory. Set durability.directory explicitly, or configure a filesystem persistence adapter"
113
+ "Durability requires a directory. Set durability.directory explicitly, or configure a filesystem or IndexedDB persistence adapter"
85
114
  );
86
115
  }
87
116
  if (config.persistence === void 0) {
@@ -90,6 +119,9 @@ function resolveDurabilityTier(config) {
90
119
  if (filesystemDirectory !== null) {
91
120
  return { kind: "wal", config: { directory: filesystemDirectory } };
92
121
  }
122
+ if (indexedDB !== null) {
123
+ return { kind: "wal", config: {}, indexedDB };
124
+ }
93
125
  return { kind: "snapshot", config: {}, adapter: config.persistence };
94
126
  }
95
127
 
@@ -0,0 +1,7 @@
1
+ export { restoreVectorFields, setNestedValue } from './chunk-XGS2UYVI.mjs';
2
+ export { Decoder, MAP_TAGS, bindMsgpackHost, decode, decodeBoundedMessage, decodeMulti, encodeDocument, headerAt } from './chunk-VRI5XH2M.mjs';
3
+ import './chunk-AVCMTWET.mjs';
4
+ import './chunk-HRDMIQ63.mjs';
5
+ import './chunk-VUJCSQG5.mjs';
6
+ import './chunk-43R4GCM7.mjs';
7
+ export { encode } from '@msgpack/msgpack';
@@ -1710,8 +1710,11 @@ function hitsKeptPerGroup(maxPerGroup) {
1710
1710
  return Math.floor(maxPerGroup);
1711
1711
  }
1712
1712
  function applyGrouping(hits, group, documents) {
1713
+ const keptPerGroup = hitsKeptPerGroup(group.maxPerGroup);
1714
+ const limit = group.limit !== void 0 && Number.isFinite(group.limit) && group.limit >= 0 ? Math.min(Math.floor(group.limit), hits.length) : null;
1713
1715
  if (!group.fields || group.fields.length === 0) {
1714
- return [{ values: {}, hits }];
1716
+ if (hits.length === 0 || limit === 0) return [];
1717
+ return [reducedGroup({ values: {}, hits: hits.slice(0, keptPerGroup) }, group, hits, documents)];
1715
1718
  }
1716
1719
  if (hits.length > 4294967295)
1717
1720
  throw new NarsilError(ErrorCodes.CONFIG_INVALID, "The hit count exceeds the group layout");
@@ -1729,8 +1732,6 @@ function applyGrouping(hits, group, documents) {
1729
1732
  if (at > 0 && hits[order[at - 1]].id !== hits[order[at]].id) rank++;
1730
1733
  idRanks[order[at]] = rank;
1731
1734
  }
1732
- const keptPerGroup = hitsKeptPerGroup(group.maxPerGroup);
1733
- const limit = group.limit !== void 0 && Number.isFinite(group.limit) && group.limit >= 0 ? Math.min(Math.floor(group.limit), hits.length) : null;
1734
1735
  const heads = new Uint32Array(hits.length);
1735
1736
  const offsets = new Uint32Array(hits.length + 1);
1736
1737
  const positions = new Uint32Array(hits.length);
@@ -1755,23 +1756,24 @@ function applyGrouping(hits, group, documents) {
1755
1756
  for (let field = 0; field < group.fields.length; field++) values[group.fields[field]] = row?.[field] ?? null;
1756
1757
  const everyHit = [];
1757
1758
  for (let member = offsets[at]; member < offsets[at + 1]; member++) everyHit.push(hits[positions[member]]);
1758
- const result = { values, hits: everyHit.slice(0, keptPerGroup) };
1759
- if (group.reduce) {
1760
- const folded = foldGroupReducer(
1761
- group.reduce,
1762
- everyHit.map((hit) => ({ document: documents.document(hit.id), score: hit.score ?? 0 }))
1763
- );
1764
- if (folded.reducerError !== void 0) {
1765
- result.reducerError = folded.reducerError;
1766
- } else {
1767
- result.reduced = folded.reduced;
1768
- }
1769
- }
1770
- groups.push(result);
1759
+ groups.push(reducedGroup({ values, hits: everyHit.slice(0, keptPerGroup) }, group, everyHit, documents));
1771
1760
  }
1772
1761
  if (limit !== null && groups.length > limit) groups.length = limit;
1773
1762
  return groups;
1774
1763
  }
1764
+ function reducedGroup(result, group, everyHit, documents) {
1765
+ if (!group.reduce) return result;
1766
+ const folded = foldGroupReducer(
1767
+ group.reduce,
1768
+ everyHit.map((hit) => ({ document: documents.document(hit.id), score: hit.score ?? 0 }))
1769
+ );
1770
+ if (folded.reducerError !== void 0) {
1771
+ result.reducerError = folded.reducerError;
1772
+ } else {
1773
+ result.reduced = folded.reduced;
1774
+ }
1775
+ return result;
1776
+ }
1775
1777
  function foldGroupReducer(reduce, rows) {
1776
1778
  try {
1777
1779
  let accumulator = reduce.initialValue();
@@ -1,13 +1,13 @@
1
- import { readHeapStatistics, withOpenIndex, oneAtATime, validateBM25Params, storedBM25Params, loadSchemaCodeFor, loadStorageCode, lookupOfStoredSynonyms, reconstructSchemaFromMetadata, getLanguage, validatePatternValueLimit, requireSurfaceFormsForPartialFields, prepareStoredSynonyms, getVectorFieldPaths, arrayPositionsAreStale, validatePartitionConfig, emitSyncChange, validateEmbeddingConfig, isSyncEpoch, newSyncEpoch } from './chunk-LPX26NNL.mjs';
2
- export { bindOptionalWritesHost, holdVectorsForRollback, insertDocument, insertDocumentBatch, prepareDocumentWrite, removeDocument, removeDocumentBatch, rollbackInsertedDocument, rollbackRemovedDocument, rollbackUpdatedDocument, updateDocument, updateDocumentBatch } from './chunk-LPX26NNL.mjs';
1
+ import { readHeapStatistics, withOpenIndex, oneAtATime, validateBM25Params, storedBM25Params, loadSchemaCodeFor, loadStorageCode, lookupOfStoredSynonyms, reconstructSchemaFromMetadata, getLanguage, validatePatternValueLimit, requireSurfaceFormsForPartialFields, prepareStoredSynonyms, getVectorFieldPaths, arrayPositionsAreStale, validatePartitionConfig, emitSyncChange, validateEmbeddingConfig, isSyncEpoch, newSyncEpoch } from './chunk-5MYHYBET.mjs';
2
+ export { bindOptionalWritesHost, holdVectorsForRollback, insertDocument, insertDocumentBatch, prepareDocumentWrite, removeDocument, removeDocumentBatch, rollbackInsertedDocument, rollbackRemovedDocument, rollbackUpdatedDocument, updateDocument, updateDocumentBatch } from './chunk-5MYHYBET.mjs';
3
3
  import './chunk-HQEVQEDJ.mjs';
4
4
  import './chunk-AKRYHAVG.mjs';
5
5
  import './chunk-LX62Y4B5.mjs';
6
- import './chunk-HTBY4GON.mjs';
6
+ import './chunk-GS6LGXY3.mjs';
7
7
  import './chunk-UYKIV2KT.mjs';
8
8
  import './chunk-CW2ZFXSE.mjs';
9
- import './chunk-UO44MA5M.mjs';
10
- import { validateSchema, validateVectorStorage, validateTextStorage } from './chunk-MRH36RN3.mjs';
9
+ import './chunk-VRI5XH2M.mjs';
10
+ import { validateSchema, validateVectorStorage, validateTextStorage } from './chunk-AVCMTWET.mjs';
11
11
  import './chunk-HRDMIQ63.mjs';
12
12
  import './chunk-VUJCSQG5.mjs';
13
13
  import { ErrorCodes, NarsilError } from './chunk-43R4GCM7.mjs';
@@ -118,7 +118,7 @@ function epochStatesOfMetadata(metadata) {
118
118
 
119
119
  // src/engine/index-from-metadata.ts
120
120
  function isRecoveryConfigError(err) {
121
- return err instanceof NarsilError && (err.code === ErrorCodes.CONFIG_INVALID || err.code === ErrorCodes.SCHEMA_INVALID_TYPE || err.code === ErrorCodes.SCHEMA_INVALID_VECTOR_DIMENSION);
121
+ return err instanceof NarsilError && (err.code === ErrorCodes.CONFIG_INVALID || err.code === ErrorCodes.LANGUAGE_NOT_SUPPORTED || err.code === ErrorCodes.SCHEMA_INVALID_TYPE || err.code === ErrorCodes.SCHEMA_INVALID_VECTOR_DIMENSION);
122
122
  }
123
123
  function resolveEmbeddingAdapter(deps, metadata, schema) {
124
124
  const name = metadata.embedding?.adapter ?? null;
@@ -188,8 +188,9 @@ async function createIndexFromMetadata(deps, metadata, loadData) {
188
188
  return;
189
189
  }
190
190
  const indexConfig = reconstructSchemaFromMetadata(metadata);
191
- const language = getLanguage(indexConfig.language ?? "english");
191
+ let language;
192
192
  try {
193
+ language = getLanguage(indexConfig.language ?? "english");
193
194
  indexConfig.schema = validateSchema(indexConfig.schema);
194
195
  validatePatternValueLimit(indexConfig.patternValueLimit);
195
196
  requireSurfaceFormsForPartialFields(indexConfig.schema, indexConfig.surfaceForms);
@@ -1,15 +1,15 @@
1
- import { installSuggestionHooks, RestoredHistory, clearLeftoversOfName } from './chunk-TG56N5JC.mjs';
2
- export { startQuerySuggestions } from './chunk-TG56N5JC.mjs';
3
- import { attachedRuntimeOf, withState, unionOfBans, BUILD_WRITE_BATCH } from './chunk-SCGBU47K.mjs';
4
- import { loadStorageCode, loadOptionalWrites, emitEngineEvent, removeDocumentBatch2 } from './chunk-LPX26NNL.mjs';
1
+ import { installSuggestionHooks, RestoredHistory, clearLeftoversOfName } from './chunk-VIO5IPF7.mjs';
2
+ export { startQuerySuggestions } from './chunk-VIO5IPF7.mjs';
3
+ import { attachedRuntimeOf, withState, unionOfBans, BUILD_WRITE_BATCH } from './chunk-Z44S6WW5.mjs';
4
+ import { loadStorageCode, loadOptionalWrites, emitEngineEvent, removeDocumentBatch2 } from './chunk-5MYHYBET.mjs';
5
5
  import './chunk-HQEVQEDJ.mjs';
6
6
  import './chunk-AKRYHAVG.mjs';
7
7
  import './chunk-LX62Y4B5.mjs';
8
- import './chunk-HTBY4GON.mjs';
8
+ import './chunk-GS6LGXY3.mjs';
9
9
  import './chunk-UYKIV2KT.mjs';
10
10
  import './chunk-CW2ZFXSE.mjs';
11
- import './chunk-UO44MA5M.mjs';
12
- import './chunk-MRH36RN3.mjs';
11
+ import './chunk-VRI5XH2M.mjs';
12
+ import './chunk-AVCMTWET.mjs';
13
13
  import './chunk-HRDMIQ63.mjs';
14
14
  import './chunk-VUJCSQG5.mjs';
15
15
  import { NarsilError, ErrorCodes } from './chunk-43R4GCM7.mjs';
@@ -1,13 +1,13 @@
1
- export { DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE, REBALANCE_CHUNK_SIZE, rebuildTextIndexes, rewriteSpillOf, textRebuildTargetOf } from './chunk-4FUCRLSA.mjs';
2
- export { bindSegmentCodecHost, createEncodedDocumentSource, createSharedFrozenSegment, decodeEveryStoredDocument, decodeMapWithoutFields, decodeStoredDocument, encodeDocumentTableData, endOfValue, reconstructSchemaFromMetadata, storedDocumentsOf, topLevelMapKeys } from './chunk-LPX26NNL.mjs';
1
+ export { DEFAULT_WRITE_AHEAD_QUEUE_MAX_SIZE, REBALANCE_CHUNK_SIZE, rebuildTextIndexes, rewriteSpillOf, textRebuildTargetOf } from './chunk-4OOUY2K7.mjs';
2
+ export { bindSegmentCodecHost, createEncodedDocumentSource, createSharedFrozenSegment, decodeEveryStoredDocument, decodeMapWithoutFields, decodeStoredDocument, encodeDocumentTableData, endOfValue, reconstructSchemaFromMetadata, storedDocumentsOf, topLevelMapKeys } from './chunk-5MYHYBET.mjs';
3
3
  import './chunk-HQEVQEDJ.mjs';
4
4
  import './chunk-AKRYHAVG.mjs';
5
5
  import './chunk-LX62Y4B5.mjs';
6
- import './chunk-HTBY4GON.mjs';
6
+ import './chunk-GS6LGXY3.mjs';
7
7
  import './chunk-UYKIV2KT.mjs';
8
8
  import './chunk-CW2ZFXSE.mjs';
9
- import './chunk-UO44MA5M.mjs';
10
- import './chunk-MRH36RN3.mjs';
9
+ import './chunk-VRI5XH2M.mjs';
10
+ import './chunk-AVCMTWET.mjs';
11
11
  import './chunk-HRDMIQ63.mjs';
12
12
  import './chunk-VUJCSQG5.mjs';
13
13
  import './chunk-43R4GCM7.mjs';
@@ -1,14 +1,14 @@
1
- export { deserializePartition, serializePartition } from './chunk-MMPBO4WR.mjs';
2
- export { alreadyPresentOnWorker, buildSegmentPayloads, createRequestId, eligibleIndexNames, fieldIndexRemapOf, freezeEncodedSegmentShared, freezeSegmentShared, holdsADiscardedField, isDeterministicFailure, isValidWorkerResponse, mergeFieldIndexes, mergeSegmentContents, mergeSourceSpellings, mergeSourceSurfaces, mergedPartialSpellings, reportIneligible, segmentArraysOf, selectionKeeps, shareSegmentArrays, toError, workerIneligibility } from './chunk-AJAH6X7W.mjs';
3
- export { bindSegmentMergeHost, mergePostings } from './chunk-LPX26NNL.mjs';
1
+ export { deserializePartition, serializePartition } from './chunk-LE4DTMDL.mjs';
2
+ export { alreadyPresentOnWorker, buildSegmentPayloads, createRequestId, eligibleIndexNames, fieldIndexRemapOf, freezeEncodedSegmentShared, freezeSegmentShared, holdsADiscardedField, isDeterministicFailure, isValidWorkerResponse, mergeFieldIndexes, mergeSegmentContents, mergeSourceSpellings, mergeSourceSurfaces, mergedPartialSpellings, reportIneligible, segmentArraysOf, selectionKeeps, shareSegmentArrays, toError, workerIneligibility } from './chunk-XW6GZQWP.mjs';
3
+ export { bindSegmentMergeHost, mergePostings } from './chunk-5MYHYBET.mjs';
4
4
  import './chunk-HQEVQEDJ.mjs';
5
5
  import './chunk-AKRYHAVG.mjs';
6
6
  import './chunk-LX62Y4B5.mjs';
7
- import './chunk-HTBY4GON.mjs';
7
+ import './chunk-GS6LGXY3.mjs';
8
8
  import './chunk-UYKIV2KT.mjs';
9
9
  import './chunk-CW2ZFXSE.mjs';
10
- import './chunk-UO44MA5M.mjs';
11
- import './chunk-MRH36RN3.mjs';
10
+ import './chunk-VRI5XH2M.mjs';
11
+ import './chunk-AVCMTWET.mjs';
12
12
  import './chunk-HRDMIQ63.mjs';
13
13
  import './chunk-VUJCSQG5.mjs';
14
14
  import './chunk-43R4GCM7.mjs';