@delali/narsil 0.4.1 → 0.4.2-next.273

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 (158) 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-QAOVAYAG.mjs → chunk-56UNHLAF.mjs} +1 -1
  11. package/dist/browser/{chunk-GBJSEHVJ.mjs → chunk-EKISQBV2.mjs} +283 -244
  12. package/dist/browser/{chunk-YINZFPLT.mjs → chunk-VAPCFSMX.mjs} +1 -1
  13. package/dist/browser/{chunk-4E5APHTM.mjs → chunk-VIVG3OXM.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-76Q5SZ5S.mjs} +23 -10
  16. package/dist/browser/{optional-reads-6LN3HMUH.mjs → optional-reads-NQO5DKM4.mjs} +18 -16
  17. package/dist/browser/{optional-writes-76DWMRQH.mjs → optional-writes-3HKIVZFU.mjs} +295 -106
  18. package/dist/browser/{segment-codec-leaf-A427QJUX.mjs → segment-codec-leaf-GXSRX5VT.mjs} +47 -30
  19. package/dist/browser/{storage-leaf-5UTR5K7J.mjs → storage-leaf-42IZEOJJ.mjs} +1473 -305
  20. package/dist/{capabilities-BOFFMx84.d.ts → capabilities-BoWiLNv7.d.ts} +76 -61
  21. package/dist/{chunk-Z7XSHKOF.mjs → chunk-35RWLUVY.mjs} +63 -144
  22. package/dist/{chunk-6GHX35ZM.mjs → chunk-43T3P3BE.mjs} +1 -1
  23. package/dist/{chunk-IL5DRCNU.mjs → chunk-4JLHHEBN.mjs} +1 -1
  24. package/dist/{chunk-DKIMHIBC.mjs → chunk-4YIVY3PB.mjs} +2 -2
  25. package/dist/{react-native/chunks/chunk-ZUJCUPVS.mjs → chunk-5SHWA6PE.mjs} +1 -1
  26. package/dist/{chunk-2K24MEYV.mjs → chunk-6LVQ3GLT.mjs} +3 -3
  27. package/dist/{chunk-DDUXEJXW.mjs → chunk-6SIEVWMG.mjs} +45 -22
  28. package/dist/{chunk-WM5KJSQV.mjs → chunk-ACNHJOGC.mjs} +1 -1
  29. package/dist/{chunk-755NM4PL.mjs → chunk-BWPVDIRN.mjs} +183 -21
  30. package/dist/{chunk-SMQPZHPS.mjs → chunk-C57GWAXN.mjs} +1 -1
  31. package/dist/{chunk-357KIU5E.mjs → chunk-DRZP5MSG.mjs} +5 -5
  32. package/dist/{chunk-MYN4K5IS.mjs → chunk-DZMD4OMD.mjs} +1 -1
  33. package/dist/{chunk-7P5YWDRQ.mjs → chunk-EY5U4P5V.mjs} +1 -1
  34. package/dist/{chunk-X3EQCQLP.mjs → chunk-EZJ6HBG7.mjs} +2 -2
  35. package/dist/{chunk-WC5KAWXQ.mjs → chunk-FE2XILWN.mjs} +4 -4
  36. package/dist/{chunk-CERPUGRK.mjs → chunk-G3KVEHIW.mjs} +2 -2
  37. package/dist/{chunk-B3MO37YF.mjs → chunk-GTGQLCEI.mjs} +1 -1
  38. package/dist/{chunk-MSJD74GN.mjs → chunk-H23FB267.mjs} +5 -5
  39. package/dist/{chunk-UNEEFTEU.mjs → chunk-HZ3OAUTL.mjs} +2 -1
  40. package/dist/{chunk-M3B7SGJB.mjs → chunk-KL4ORYJW.mjs} +6 -6
  41. package/dist/{chunk-WTMCGZ74.mjs → chunk-KXA77DPZ.mjs} +2 -2
  42. package/dist/{chunk-6I6OO6B2.mjs → chunk-LRIJ7U3T.mjs} +4 -4
  43. package/dist/{chunk-3IE3A74H.mjs → chunk-PNFP5THV.mjs} +3 -3
  44. package/dist/{react-native/chunks/chunk-4FUCRLSA.mjs → chunk-PQWK7KXS.mjs} +1 -1
  45. package/dist/{chunk-P4F4UWLC.mjs → chunk-PSO7V7VW.mjs} +17 -3
  46. package/dist/{chunk-OGYSPNL2.mjs → chunk-QNZJYMCF.mjs} +7 -7
  47. package/dist/{chunk-DBC4EJWB.mjs → chunk-R3PFPFME.mjs} +1 -1
  48. package/dist/{chunk-MSIN4NM3.mjs → chunk-S3JHYPH7.mjs} +6 -1
  49. package/dist/{chunk-MI6UZGUR.mjs → chunk-SPA7GXST.mjs} +3 -3
  50. package/dist/{chunk-PP3W5PQQ.mjs → chunk-WYH3QHBK.mjs} +698 -451
  51. package/dist/{chunk-D456ZFPQ.mjs → chunk-X5V25BPN.mjs} +2 -2
  52. package/dist/{chunk-GXCDWLQI.mjs → chunk-Y7GXGJFZ.mjs} +23 -10
  53. package/dist/{chunk-NCIGNQJE.mjs → chunk-YGRJLI2Z.mjs} +930 -387
  54. package/dist/{react-native/chunks/chunk-MMPBO4WR.mjs → chunk-ZO7VLAIT.mjs} +2 -2
  55. package/dist/{chunk-AXDB6KUQ.mjs → chunk-ZTB7AWTW.mjs} +4 -4
  56. package/dist/chunk-ZYEEOZTT.mjs +52 -0
  57. package/dist/{client-BhNxHtcZ.d.ts → client-B0NPZSKY.d.ts} +4 -4
  58. package/dist/client.d.ts +9 -9
  59. package/dist/client.mjs +2 -2
  60. package/dist/{config-P9zW3Zz7.d.ts → config-B3-sw887.d.ts} +3 -3
  61. package/dist/{config-BJSL7piq.d.ts → config-DL_nkguq.d.ts} +4 -4
  62. package/dist/{direct-executor-GWJXDFLD.mjs → direct-executor-7G57AYXH.mjs} +4 -4
  63. package/dist/distribution/coordinator/etcd.d.ts +3 -3
  64. package/dist/distribution/coordinator/etcd.mjs +33 -3
  65. package/dist/distribution/coordinator/in-memory.d.ts +3 -3
  66. package/dist/distribution/transport/grpc.mjs +4 -4
  67. package/dist/distribution/transport/in-memory.mjs +1 -1
  68. package/dist/distribution/transport/tcp.mjs +12 -7
  69. package/dist/distribution.d.ts +8 -8
  70. package/dist/distribution.mjs +167 -91
  71. package/dist/{durability-config-VWS2K24E.mjs → durability-config-HWKWP35M.mjs} +34 -2
  72. package/dist/embeddings/openai.d.ts +7 -3
  73. package/dist/embeddings/openai.mjs +37 -31
  74. package/dist/{engine-DoFnkRoF.d.ts → engine-DGG_yX0p.d.ts} +3 -3
  75. package/dist/{index-B_vmxpgW.d.ts → index-fX_FbuRT.d.ts} +1 -1
  76. package/dist/index.browser.mjs +3 -3
  77. package/dist/index.d.ts +7 -7
  78. package/dist/index.mjs +4 -4
  79. package/dist/index.react-native.mjs +4 -4
  80. package/dist/invalidation/broadcast-channel.d.ts +1 -1
  81. package/dist/invalidation/filesystem.d.ts +1 -1
  82. package/dist/invalidation/noop.d.ts +1 -1
  83. package/dist/{long-query-thread-GNTDYDOZ.mjs → long-query-thread-KPN7NSOC.mjs} +14 -14
  84. package/dist/msgpack-leaf-LIT7TKZW.mjs +9 -0
  85. package/dist/{optional-reads-UCS23AWP.mjs → optional-reads-ESDVS225.mjs} +18 -16
  86. package/dist/{optional-writes-2AHJCGTY.mjs → optional-writes-CSULLISE.mjs} +9 -8
  87. package/dist/{paged-partition-archive-GBAHDT55.mjs → paged-partition-archive-BKQADXOT.mjs} +13 -13
  88. package/dist/partial-words.browser.mjs +3 -3
  89. package/dist/partial-words.mjs +4 -4
  90. package/dist/pattern.browser.mjs +2 -2
  91. package/dist/pattern.mjs +2 -2
  92. package/dist/persistence/durability/checkpoint-worker.d.ts +2 -2
  93. package/dist/persistence/durability/checkpoint-worker.mjs +14 -14
  94. package/dist/{query-actions-IDCUA7UV.mjs → query-actions-HTSJKZRU.mjs} +4 -4
  95. package/dist/query-suggestions/merge-worker.mjs +7 -7
  96. package/dist/query-suggestions.browser.mjs +3 -3
  97. package/dist/query-suggestions.d.ts +3 -3
  98. package/dist/query-suggestions.mjs +5 -5
  99. package/dist/react-native/chunks/{chunk-MRH36RN3.mjs → chunk-AOLLV37A.mjs} +1 -1
  100. package/dist/react-native/chunks/{chunk-UO44MA5M.mjs → chunk-DN4FT62B.mjs} +23 -10
  101. package/dist/react-native/chunks/{chunk-TG56N5JC.mjs → chunk-EF4Y5C3Y.mjs} +2 -2
  102. package/dist/react-native/chunks/{chunk-HTBY4GON.mjs → chunk-ESVBC3AT.mjs} +1 -1
  103. package/dist/{chunk-F26DOOUH.mjs → react-native/chunks/chunk-H6LK5WCF.mjs} +1 -1
  104. package/dist/react-native/chunks/{chunk-LPX26NNL.mjs → chunk-JEYZQA4Z.mjs} +699 -451
  105. package/dist/react-native/chunks/{chunk-AJAH6X7W.mjs → chunk-KJQ3BUVM.mjs} +4 -4
  106. package/dist/{chunk-UHLFCGZ3.mjs → react-native/chunks/chunk-QYVRD6C5.mjs} +2 -2
  107. package/dist/react-native/chunks/{chunk-SCGBU47K.mjs → chunk-X3VY2YT4.mjs} +2 -2
  108. package/dist/{chunk-R2PJKSNL.mjs → react-native/chunks/chunk-ZF3VSGEI.mjs} +1 -1
  109. package/dist/react-native/chunks/{durability-config-FCSD4MXY.mjs → durability-config-HJETGZVB.mjs} +34 -2
  110. package/dist/react-native/chunks/msgpack-leaf-FOUPTT7J.mjs +7 -0
  111. package/dist/react-native/chunks/{optional-reads-4XCJ34QG.mjs → optional-reads-TN3PT6M4.mjs} +18 -16
  112. package/dist/react-native/chunks/{optional-writes-XYZVTBFB.mjs → optional-writes-MGFFGKYQ.mjs} +8 -7
  113. package/dist/react-native/chunks/{restore-queue-NOKQZJ2Z.mjs → restore-queue-MVJTP3E4.mjs} +7 -7
  114. package/dist/react-native/chunks/{segment-codec-leaf-3ZXBJVKH.mjs → segment-codec-leaf-PSWHL55A.mjs} +5 -5
  115. package/dist/react-native/chunks/{segment-merge-leaf-3Z7MMPWE.mjs → segment-merge-leaf-WOJWSDLW.mjs} +6 -6
  116. package/dist/react-native/chunks/{storage-leaf-KJOX3MMW.mjs → storage-leaf-ZUN6Y44X.mjs} +1481 -314
  117. package/dist/react-native/chunks/{store-leaf-QGLVSO5X.mjs → store-leaf-K5XG46FV.mjs} +6 -6
  118. package/dist/react-native/chunks/{suggestions-leaf-6GI5ZSW6.mjs → suggestions-leaf-KDPM3P27.mjs} +6 -6
  119. package/dist/react-native/chunks/{worker-copies-ALOD7TSP.mjs → worker-copies-FVFMBBH6.mjs} +5 -5
  120. package/dist/react-native/partial-words.mjs +4 -4
  121. package/dist/react-native/pattern.mjs +2 -2
  122. package/dist/react-native/query-suggestions.mjs +4 -4
  123. package/dist/react-native/sync.mjs +4 -4
  124. package/dist/react-native/synonyms.mjs +4 -4
  125. package/dist/react.d.ts +10 -10
  126. package/dist/react.mjs +0 -2
  127. package/dist/{rerank-HB6DU6GS.mjs → rerank-3QEJNMFH.mjs} +4 -4
  128. package/dist/rerankers/http.d.ts +1 -1
  129. package/dist/rerankers/http.mjs +19 -15
  130. package/dist/{restore-queue-VUQHGCXE.mjs → restore-queue-Q76Q4S35.mjs} +7 -7
  131. package/dist/{schema-CzG9OUw5.d.ts → schema-CFnQ-WI3.d.ts} +1 -1
  132. package/dist/{segment-codec-leaf-TW2FPAAT.mjs → segment-codec-leaf-BSDDR7DQ.mjs} +5 -5
  133. package/dist/{segment-merge-leaf-BS3QV5PZ.mjs → segment-merge-leaf-6TT66HC5.mjs} +5 -5
  134. package/dist/server.d.ts +86 -12
  135. package/dist/server.mjs +2243 -1918
  136. package/dist/{storage-leaf-5IG2HPNY.mjs → storage-leaf-R5JQ2X2M.mjs} +1193 -219
  137. package/dist/{store-leaf-ZWSOK2DV.mjs → store-leaf-NCGETZYY.mjs} +6 -6
  138. package/dist/{suggestions-leaf-MUZNKQVF.mjs → suggestions-leaf-TX3GTD6S.mjs} +8 -8
  139. package/dist/sync/filesystem.d.ts +4 -4
  140. package/dist/sync/filesystem.mjs +12 -12
  141. package/dist/sync/indexeddb.browser.mjs +1 -1
  142. package/dist/sync/indexeddb.d.ts +4 -4
  143. package/dist/sync/indexeddb.mjs +2 -2
  144. package/dist/sync.browser.mjs +4 -4
  145. package/dist/sync.d.ts +5 -5
  146. package/dist/sync.mjs +4 -4
  147. package/dist/synonyms.browser.mjs +3 -3
  148. package/dist/synonyms.mjs +4 -4
  149. package/dist/{tasks-DrLiolTG.d.ts → tasks-B2MDjPL0.d.ts} +4 -4
  150. package/dist/{thread-6ZBCENAP.mjs → thread-VLVPAUWC.mjs} +13 -13
  151. package/dist/{types-pS-mAJmX.d.ts → types-DGjk684l.d.ts} +2 -2
  152. package/dist/vector/search-worker.d.ts +2 -2
  153. package/dist/{worker-copies-32HWFUH7.mjs → worker-copies-NZSBQZKG.mjs} +7 -7
  154. package/dist/workers/entry.mjs +16 -16
  155. package/package.json +12 -12
  156. package/dist/chunk-HLPRHOSO.mjs +0 -17
  157. package/dist/msgpack-leaf-H5ZYW7S7.mjs +0 -9
  158. package/dist/react-native/chunks/msgpack-leaf-JMNGSTRW.mjs +0 -7
@@ -1,5 +1,5 @@
1
- import { createNumericIndex, createBooleanIndex, createEnumIndex, createLoadedGeoIndex, rebuildSizeIndexes, requirePatternSearch, patternIndexOf } from './chunk-LPX26NNL.mjs';
2
- import { getFlatSchema, schemaFieldsOf, getNestedValue } from './chunk-MRH36RN3.mjs';
1
+ import { createNumericIndex, createBooleanIndex, createEnumIndex, createLoadedGeoIndex, rebuildSizeIndexes, requirePatternSearch, patternIndexOf } from './chunk-WYH3QHBK.mjs';
2
+ import { getFlatSchema, schemaFieldsOf, getNestedValue } from './chunk-EY5U4P5V.mjs';
3
3
 
4
4
  // src/core/partition/pattern-snapshot.ts
5
5
  function serializePatternIndexes(state, schema) {
@@ -1,5 +1,4 @@
1
- import { bindResponseStop, sendError, RELAY_STREAM_CHUNKS_IN_FLIGHT } from './chunk-NCIGNQJE.mjs';
2
- import { ServerErrorCodes } from './chunk-ZKOQR7EA.mjs';
1
+ import { bindResponseStop, toHttpError, sendError, RELAY_STREAM_CHUNKS_IN_FLIGHT } from './chunk-YGRJLI2Z.mjs';
3
2
  import { rm } from 'fs/promises';
4
3
  import path from 'path';
5
4
 
@@ -207,8 +206,9 @@ async function answerRequest(handler, request, port, streams) {
207
206
  };
208
207
  try {
209
208
  await handler(ctx);
210
- } catch {
211
- sendError(ctx.res, 500, ServerErrorCodes.INTERNAL_ERROR, "An unexpected error occurred");
209
+ } catch (err) {
210
+ const { status, body } = toHttpError(err);
211
+ sendError(ctx.res, status, body.code, body.message, body.details);
212
212
  }
213
213
  captured.finishUnanswered();
214
214
  const answered = await captured.done;
@@ -0,0 +1,52 @@
1
+ import { HELD_FILE_RETRY_LONGEST_PAUSE_MS, HELD_FILE_RETRY_FIRST_PAUSE_MS, HELD_FILE_RETRY_WINDOW_MS } from './chunk-S3JHYPH7.mjs';
2
+
3
+ // src/persistence/durability/node-fs.ts
4
+ var cachedFs = null;
5
+ var cachedPath = null;
6
+ async function getFs() {
7
+ if (cachedFs === null) {
8
+ cachedFs = await import('fs/promises');
9
+ }
10
+ return cachedFs;
11
+ }
12
+ async function getPath() {
13
+ if (cachedPath === null) {
14
+ cachedPath = await import('path');
15
+ }
16
+ return cachedPath;
17
+ }
18
+ function heldByAnotherHandle(error, retriesMissing) {
19
+ if (typeof process === "undefined" || process.platform !== "win32") return false;
20
+ const code = error?.code;
21
+ return code === "EPERM" || code === "EBUSY" || retriesMissing && code === "ENOENT";
22
+ }
23
+ function pause(ms) {
24
+ return new Promise((resolve) => setTimeout(resolve, ms));
25
+ }
26
+ async function retriedWhileHeld(operation, retriesMissing) {
27
+ let deadline = null;
28
+ let wait = HELD_FILE_RETRY_FIRST_PAUSE_MS;
29
+ for (; ; ) {
30
+ try {
31
+ await operation();
32
+ return;
33
+ } catch (error) {
34
+ if (!heldByAnotherHandle(error, retriesMissing)) throw error;
35
+ const now = performance.now();
36
+ deadline ??= now + HELD_FILE_RETRY_WINDOW_MS;
37
+ if (now + wait >= deadline) throw error;
38
+ }
39
+ await pause(wait);
40
+ wait = Math.min(2 * wait, HELD_FILE_RETRY_LONGEST_PAUSE_MS);
41
+ }
42
+ }
43
+ async function renameReplacing(from, to) {
44
+ const fs = await getFs();
45
+ await retriedWhileHeld(() => fs.rename(from, to), true);
46
+ }
47
+ async function renameUnlessMissing(from, to) {
48
+ const fs = await getFs();
49
+ await retriedWhileHeld(() => fs.rename(from, to), false);
50
+ }
51
+
52
+ export { getFs, getPath, renameReplacing, renameUnlessMissing };
@@ -1,8 +1,8 @@
1
- import { P as PartitionConfig, B as BM25Params, A as AnyDocument, a as InsertOptions, W as WriteOptions } from './schema-CzG9OUw5.js';
2
- import { o as SnapshotOptions, V as VectorMaintenanceResult, B as BatchResult, L as ListParams, y as ListResult, F as FollowChangesOptions, d as ChangesEvent, a as ChangePosition, h as ChangesStatus, g as ChangesSetting, I as IndexInfo, x as IndexStats, P as PartitionStatsResult, Q as QueryParams, t as QueryResult, z as PreflightResult, w as SuggestParams, A as SuggestResult, q as SyncStatus, p as SyncSetting } from './engine-DoFnkRoF.js';
1
+ import { P as PartitionConfig, B as BM25Params, A as AnyDocument, a as InsertOptions, W as WriteOptions } from './schema-CFnQ-WI3.js';
2
+ import { o as SnapshotOptions, V as VectorMaintenanceResult, B as BatchResult, L as ListParams, v as ListResult, F as FollowChangesOptions, d as ChangesEvent, a as ChangePosition, h as ChangesStatus, g as ChangesSetting, I as IndexInfo, z as IndexStats, P as PartitionStatsResult, Q as QueryParams, t as QueryResult, y as PreflightResult, w as SuggestParams, x as SuggestResult, q as SyncStatus, p as SyncSetting } from './engine-DGG_yX0p.js';
3
3
  import { a as SynonymRule } from './synonyms-CpOAHPa-.js';
4
- import { f as TaskRecord, a as ChangeAnalysisBody, M as MemoryStatsResponse, m as CreateBackupBody, R as RestoreBackupBody, c as ImportResult, H as HttpIndexConfig, d as TaskListQuery, T as TaskListPage } from './tasks-DrLiolTG.js';
5
- import { B as BackupListing } from './config-BJSL7piq.js';
4
+ import { f as TaskRecord, a as ChangeAnalysisBody, M as MemoryStatsResponse, m as CreateBackupBody, R as RestoreBackupBody, c as ImportResult, H as HttpIndexConfig, d as TaskListQuery, T as TaskListPage } from './tasks-B2MDjPL0.js';
5
+ import { B as BackupListing } from './config-DL_nkguq.js';
6
6
  import { d as QuerySuggestionsSetting, e as QuerySuggestionsStatus, f as RecordQueryResult, c as QuerySuggestionsPreview, M as ManualQuerySuggestion } from './query-suggestions-CBYkrQ5T.js';
7
7
 
8
8
  /**
package/dist/client.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- export { B as BackupListing, a as BackupSummary, D as DamagedBackup } from './config-BJSL7piq.js';
2
- export { C as Change, a as ChangePosition, b as ChangeType, c as ChangesBatch, d as ChangesEvent, e as ChangesOperations, f as ChangesResync, g as ChangesSetting, h as ChangesStatus, i as ChangesSubscribed, j as ClientErrorCode, k as ClientErrorCodes, E as ErrorCode, l as ErrorCodes, F as FollowChangesOptions, N as NarsilError, m as NarsilErrorCode, S as ServerErrorCode, n as ServerErrorCodes, o as SnapshotOptions, p as SyncSetting, q as SyncStatus, r as isNarsilError } from './engine-DoFnkRoF.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-BOFFMx84.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-DrLiolTG.js';
1
+ export { B as BackupListing, a as BackupSummary, D as DamagedBackup } from './config-DL_nkguq.js';
2
+ export { C as Change, a as ChangePosition, b as ChangeType, c as ChangesBatch, d as ChangesEvent, e as ChangesOperations, f as ChangesResync, g as ChangesSetting, h as ChangesStatus, i as ChangesSubscribed, j as ClientErrorCode, k as ClientErrorCodes, E as ErrorCode, l as ErrorCodes, F as FollowChangesOptions, N as NarsilError, m as NarsilErrorCode, S as ServerErrorCode, n as ServerErrorCodes, o as SnapshotOptions, p as SyncSetting, q as SyncStatus, r as isNarsilError } from './engine-DGG_yX0p.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-BoWiLNv7.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-B2MDjPL0.js';
5
5
  export { M as ManualQuerySuggestion, Q as QuerySuggestionPreviewEntry, a as QuerySuggestionsBuild, b as QuerySuggestionsBuildTrigger, c as QuerySuggestionsPreview, d as QuerySuggestionsSetting, e as QuerySuggestionsStatus, R as RecordQueryOutcome, f as RecordQueryResult } from './query-suggestions-CBYkrQ5T.js';
6
- export { A as AdminOperations, B as BackupOperations, a as BulkOperations, C as ChangeFeedOptions, b as ChangeSubscription, c as ChangesClientOperations, D as DocumentOperations, F as FetchFunction, I as ImportSource, d as IndexOperations, N as NarsilClient, e as NarsilClientOptions, P as PutResult, Q as QuerySuggestionOperations, R as RequestOptions, S as SearchOperations, f as ServerOperations, g as ServerVersion, h as SyncSettingOperations, i as SyncSnapshotDownload, j as SyncSnapshotResume, T as TaskOperations, W as WaitForTaskOptions, k as createNarsilClient } from './client-BhNxHtcZ.js';
7
- import './config-P9zW3Zz7.js';
8
- import './adapters-pljAqmrC.js';
9
- import './schema-CzG9OUw5.js';
6
+ export { A as AdminOperations, B as BackupOperations, a as BulkOperations, C as ChangeFeedOptions, b as ChangeSubscription, c as ChangesClientOperations, D as DocumentOperations, F as FetchFunction, I as ImportSource, d as IndexOperations, N as NarsilClient, e as NarsilClientOptions, P as PutResult, Q as QuerySuggestionOperations, R as RequestOptions, S as SearchOperations, f as ServerOperations, g as ServerVersion, h as SyncSettingOperations, i as SyncSnapshotDownload, j as SyncSnapshotResume, T as TaskOperations, W as WaitForTaskOptions, k as createNarsilClient } from './client-B0NPZSKY.js';
7
+ import './config-B3-sw887.js';
8
+ import './adapters-8LcdNB77.js';
9
+ import './schema-CFnQ-WI3.js';
10
10
  import './synonyms-CpOAHPa-.js';
11
- import './index-B_vmxpgW.js';
11
+ import './index-fX_FbuRT.js';
12
12
  import './types-DvncmvuQ.js';
package/dist/client.mjs CHANGED
@@ -1,5 +1,5 @@
1
- export { createNarsilClient } from './browser/chunk-4E5APHTM.mjs';
2
- export { ClientErrorCodes, ErrorCodes, NarsilError, ServerErrorCodes, isNarsilError } from './browser/chunk-YINZFPLT.mjs';
1
+ export { createNarsilClient } from './browser/chunk-VIVG3OXM.mjs';
2
+ export { ClientErrorCodes, ErrorCodes, NarsilError, ServerErrorCodes, isNarsilError } from './browser/chunk-VAPCFSMX.mjs';
3
3
 
4
4
  // src/server/capabilities.ts
5
5
  var ASYNC_IMPORT_CAPABILITY = "documents.import.async";
@@ -1,6 +1,6 @@
1
- import { P as PersistenceAdapter, I as InvalidationAdapter, E as EmbeddingAdapter, R as RerankAdapter } from './adapters-pljAqmrC.js';
2
- import { Q as QueryParams, t as QueryResult, u as NarsilEventHandlers } from './engine-DoFnkRoF.js';
3
- import { I as IndexConfig, A as AnyDocument } from './schema-CzG9OUw5.js';
1
+ import { P as PersistenceAdapter, I as InvalidationAdapter, E as EmbeddingAdapter, R as RerankAdapter } from './adapters-8LcdNB77.js';
2
+ import { Q as QueryParams, t as QueryResult, u as NarsilEventHandlers } from './engine-DGG_yX0p.js';
3
+ import { I as IndexConfig, A as AnyDocument } from './schema-CFnQ-WI3.js';
4
4
 
5
5
  /**
6
6
  * Hooks that the engine calls alongside its own work, so that an application
@@ -1,6 +1,6 @@
1
- import { N as NarsilConfig } from './config-P9zW3Zz7.js';
2
- import { P as PersistenceAdapter } from './adapters-pljAqmrC.js';
3
- import { A as AllocationConstraints, a as AllocationTable, N as NodeRole, b as NodeRegistration, C as ClusterCoordinator, c as NodeCapacity } from './index-B_vmxpgW.js';
1
+ import { N as NarsilConfig } from './config-B3-sw887.js';
2
+ import { P as PersistenceAdapter } from './adapters-8LcdNB77.js';
3
+ import { A as AllocationConstraints, a as AllocationTable, N as NodeRole, b as NodeRegistration, C as ClusterCoordinator, c as NodeCapacity } from './index-fX_FbuRT.js';
4
4
  import { N as NodeTransport } from './types-DvncmvuQ.js';
5
5
 
6
6
  /**
@@ -605,4 +605,4 @@ interface ClusterNodeInfo {
605
605
  status: string;
606
606
  }
607
607
 
608
- export type { BackupListing as B, ClusterNamespace as C, DamagedBackup as D, IndexHealth as I, NodeReadiness as N, PartitionReplicationFigure as P, ReplicaLagFigure as R, VectorRebuildWaitFigure as V, BackupSummary as a, ClusterNodeInfo as b, ClusterHealth as c, CreateIndexOptions as d, ClusterNodeConfig as e, BackupOperationOptions as f, BackupProgress as g, ClusterBackupConfig as h, ClusterControllerConfig as i, ClusterHealthStatus as j, ClusterMemoryConfig as k, ClusterMetrics as l, ClusterQueryConfig as m, CommitPointFigure as n, CoordinatorRequestFigure as o, CreateBackupOptions as p, ReplicationConfig as q, RestoreBackupOptions as r };
608
+ export type { BackupListing as B, ClusterNamespace as C, DamagedBackup as D, IndexHealth as I, NodeReadiness as N, PartitionReplicationFigure as P, ReplicaLagFigure as R, VectorRebuildWaitFigure as V, BackupSummary as a, ClusterNodeInfo as b, CreateIndexOptions as c, ClusterNodeConfig as d, BackupOperationOptions as e, BackupProgress as f, ClusterBackupConfig as g, ClusterControllerConfig as h, ClusterHealth as i, ClusterHealthStatus as j, ClusterMemoryConfig as k, ClusterMetrics as l, ClusterQueryConfig as m, CommitPointFigure as n, CoordinatorRequestFigure as o, CreateBackupOptions as p, ReplicationConfig as q, RestoreBackupOptions as r };
@@ -1,11 +1,11 @@
1
- export { createDirectExecutor } from './chunk-PP3W5PQQ.mjs';
1
+ export { createDirectExecutor } from './chunk-WYH3QHBK.mjs';
2
2
  import './chunk-2CKDCC65.mjs';
3
3
  import './chunk-2AFZE7Y3.mjs';
4
- import './chunk-GXCDWLQI.mjs';
4
+ import './chunk-Y7GXGJFZ.mjs';
5
5
  import './chunk-BUMREPLU.mjs';
6
6
  import './chunk-7T4LAYT4.mjs';
7
- import './chunk-IL5DRCNU.mjs';
8
- import './chunk-7P5YWDRQ.mjs';
7
+ import './chunk-4JLHHEBN.mjs';
8
+ import './chunk-EY5U4P5V.mjs';
9
9
  import './chunk-U2BKYEC7.mjs';
10
10
  import './chunk-FJXJZUWF.mjs';
11
11
  import './chunk-5EI5CXO6.mjs';
@@ -1,6 +1,6 @@
1
- import { C as ClusterCoordinator } from '../../index-B_vmxpgW.js';
2
- import '../../schema-CzG9OUw5.js';
3
- import '../../adapters-pljAqmrC.js';
1
+ import { C as ClusterCoordinator } from '../../index-fX_FbuRT.js';
2
+ import '../../schema-CFnQ-WI3.js';
3
+ import '../../adapters-8LcdNB77.js';
4
4
  import '../../synonyms-CpOAHPa-.js';
5
5
 
6
6
  /**
@@ -1,7 +1,7 @@
1
1
  import { INDEX_METADATA_KEY_PREFIX, indexNameOfMetadataSuffix } from '../../chunk-Q2AP2FSN.mjs';
2
2
  import { MAX_NODE_ID_LENGTH, CONTROLLER_LEASE_KEY, MAX_WATCHERS } from '../../chunk-44W3CBNG.mjs';
3
- import { decode } from '../../chunk-GXCDWLQI.mjs';
4
- import '../../chunk-7P5YWDRQ.mjs';
3
+ import { decode } from '../../chunk-Y7GXGJFZ.mjs';
4
+ import '../../chunk-EY5U4P5V.mjs';
5
5
  import '../../chunk-ZXX5GZEX.mjs';
6
6
  import '../../chunk-4PY4JYMY.mjs';
7
7
  import { NarsilError, ErrorCodes, describeError } from '../../chunk-ZKOQR7EA.mjs';
@@ -969,6 +969,36 @@ function storedValueMethods(context) {
969
969
  };
970
970
  }
971
971
 
972
+ // src/distribution/coordinator/etcd/unreachable-etcd.ts
973
+ function unreachableEtcdOf(error, operation, isRecoverable) {
974
+ if (!(error instanceof Error) || error instanceof NarsilError || !isRecoverable(error)) return error;
975
+ return new NarsilError(
976
+ ErrorCodes.COORDINATOR_UNAVAILABLE,
977
+ `The coordinator reached no etcd endpoint for ${operation}: ${error.message}`,
978
+ { operation }
979
+ );
980
+ }
981
+ function refusingUnreachableEtcdAsUnavailable(coordinator, isRecoverable) {
982
+ const wrapped = /* @__PURE__ */ new Map();
983
+ return new Proxy(coordinator, {
984
+ get(target, property, receiver) {
985
+ const value = Reflect.get(target, property, receiver);
986
+ if (typeof value !== "function" || typeof property !== "string") return value;
987
+ const held = wrapped.get(property);
988
+ if (held !== void 0) return held;
989
+ const call = (...args) => {
990
+ const result = value.apply(target, args);
991
+ if (!(result instanceof Promise)) return result;
992
+ return result.catch((error) => {
993
+ throw unreachableEtcdOf(error, property, isRecoverable);
994
+ });
995
+ };
996
+ wrapped.set(property, call);
997
+ return call;
998
+ }
999
+ });
1000
+ }
1001
+
972
1002
  // src/distribution/coordinator/etcd/validation.ts
973
1003
  var VALID_PARTITION_STATES = /* @__PURE__ */ new Set(["UNASSIGNED", "INITIALISING", "ACTIVE", "MIGRATING", "DECOMMISSIONING"]);
974
1004
  function validateNodeId(nodeId) {
@@ -1296,7 +1326,7 @@ async function createEtcdCoordinator(config) {
1296
1326
  client.close();
1297
1327
  }
1298
1328
  };
1299
- return coordinator;
1329
+ return refusingUnreachableEtcdAsUnavailable(coordinator, etcd3Module.isRecoverableError);
1300
1330
  }
1301
1331
 
1302
1332
  export { createEtcdCoordinator, validateNodeId };
@@ -1,6 +1,6 @@
1
- import { C as ClusterCoordinator } from '../../index-B_vmxpgW.js';
2
- import '../../schema-CzG9OUw5.js';
3
- import '../../adapters-pljAqmrC.js';
1
+ import { C as ClusterCoordinator } from '../../index-fX_FbuRT.js';
2
+ import '../../schema-CFnQ-WI3.js';
3
+ import '../../adapters-8LcdNB77.js';
4
4
  import '../../synonyms-CpOAHPa-.js';
5
5
 
6
6
  /**
@@ -1,9 +1,9 @@
1
- import { decodeTransportMessage, encodeTransportMessage } from '../../chunk-D456ZFPQ.mjs';
1
+ import { decodeTransportMessage, encodeTransportMessage } from '../../chunk-X5V25BPN.mjs';
2
2
  import { timeoutsOf, replyDeadlineMs } from '../../chunk-OIJ64LGT.mjs';
3
- import { MAX_MESSAGE_SIZE_BYTES, GRPC_KEEPALIVE_TIMEOUT_MS, GRPC_KEEPALIVE_TIME_MS, GRPC_ENVELOPE_OVERHEAD_BYTES } from '../../chunk-UNEEFTEU.mjs';
3
+ import { MAX_MESSAGE_SIZE_BYTES, GRPC_KEEPALIVE_TIMEOUT_MS, GRPC_KEEPALIVE_TIME_MS, GRPC_ENVELOPE_OVERHEAD_BYTES } from '../../chunk-HZ3OAUTL.mjs';
4
4
  import { TransportError, TransportErrorCodes } from '../../chunk-5FLRXF73.mjs';
5
- import '../../chunk-GXCDWLQI.mjs';
6
- import '../../chunk-7P5YWDRQ.mjs';
5
+ import '../../chunk-Y7GXGJFZ.mjs';
6
+ import '../../chunk-EY5U4P5V.mjs';
7
7
  import '../../chunk-ZXX5GZEX.mjs';
8
8
  import '../../chunk-4PY4JYMY.mjs';
9
9
  import { NarsilError, ErrorCodes } from '../../chunk-ZKOQR7EA.mjs';
@@ -1,5 +1,5 @@
1
1
  import { timeoutsOf, replyDeadlineMs } from '../../chunk-OIJ64LGT.mjs';
2
- import { MAX_MESSAGE_SIZE_BYTES } from '../../chunk-UNEEFTEU.mjs';
2
+ import { MAX_MESSAGE_SIZE_BYTES } from '../../chunk-HZ3OAUTL.mjs';
3
3
  import { DEFAULT_TRANSPORT_CONFIG, TransportError, TransportErrorCodes } from '../../chunk-5FLRXF73.mjs';
4
4
 
5
5
  // src/distribution/transport/in-memory.ts
@@ -1,9 +1,9 @@
1
- import { DEFAULT_TCP_CONFIG, encodeTransportMessage, encodeFrame, FRAME_TYPE_REQUEST, FrameParser, FRAME_TYPE_RESPONSE, decodeTransportMessage, FRAME_TYPE_STREAM_CHUNK, FRAME_TYPE_STREAM_END } from '../../chunk-D456ZFPQ.mjs';
1
+ import { DEFAULT_TCP_CONFIG, encodeTransportMessage, encodeFrame, FRAME_TYPE_REQUEST, FrameParser, FRAME_TYPE_RESPONSE, decodeTransportMessage, FRAME_TYPE_STREAM_CHUNK, FRAME_TYPE_STREAM_END } from '../../chunk-X5V25BPN.mjs';
2
2
  import { timeoutsOf, replyDeadlineMs } from '../../chunk-OIJ64LGT.mjs';
3
- import { MAX_MESSAGE_SIZE_BYTES } from '../../chunk-UNEEFTEU.mjs';
3
+ import { MAX_MESSAGE_SIZE_BYTES, UNADDRESSABLE_TARGET_DETAIL } from '../../chunk-HZ3OAUTL.mjs';
4
4
  import { TransportError, TransportErrorCodes } from '../../chunk-5FLRXF73.mjs';
5
- import '../../chunk-GXCDWLQI.mjs';
6
- import '../../chunk-7P5YWDRQ.mjs';
5
+ import '../../chunk-Y7GXGJFZ.mjs';
6
+ import '../../chunk-EY5U4P5V.mjs';
7
7
  import '../../chunk-ZXX5GZEX.mjs';
8
8
  import '../../chunk-4PY4JYMY.mjs';
9
9
  import '../../chunk-ZKOQR7EA.mjs';
@@ -19,14 +19,18 @@ function parseAddress(address) {
19
19
  TransportErrorCodes.CONNECT_FAILED,
20
20
  `Invalid address format '${address}', expected host:port`,
21
21
  {
22
- address
22
+ address,
23
+ [UNADDRESSABLE_TARGET_DETAIL]: true
23
24
  }
24
25
  );
25
26
  }
26
27
  const host = address.slice(0, lastColon);
27
28
  const port = address.slice(lastColon + 1);
28
29
  if (host.length === 0 || host.includes("\0")) {
29
- throw new TransportError(TransportErrorCodes.CONNECT_FAILED, `Invalid host in address '${address}'`, { address });
30
+ throw new TransportError(TransportErrorCodes.CONNECT_FAILED, `Invalid host in address '${address}'`, {
31
+ address,
32
+ [UNADDRESSABLE_TARGET_DETAIL]: true
33
+ });
30
34
  }
31
35
  return [host, port];
32
36
  }
@@ -163,7 +167,8 @@ var TcpConnectionPool = class {
163
167
  const port = Number.parseInt(portStr, 10);
164
168
  if (Number.isNaN(port) || port < 0 || port > 65535) {
165
169
  throw new TransportError(TransportErrorCodes.CONNECT_FAILED, `Invalid port in target address '${target}'`, {
166
- target
170
+ target,
171
+ [UNADDRESSABLE_TARGET_DETAIL]: true
167
172
  });
168
173
  }
169
174
  return new Promise((resolve, reject) => {
@@ -1,13 +1,13 @@
1
- import { d as CreateIndexOptions, C as ClusterNamespace, e as ClusterNodeConfig } from './config-BJSL7piq.js';
2
- export { B as BackupListing, f as BackupOperationOptions, g as BackupProgress, a as BackupSummary, h as ClusterBackupConfig, i as ClusterControllerConfig, c as ClusterHealth, j as ClusterHealthStatus, k as ClusterMemoryConfig, l as ClusterMetrics, b as ClusterNodeInfo, m as ClusterQueryConfig, n as CommitPointFigure, o as CoordinatorRequestFigure, p as CreateBackupOptions, D as DamagedBackup, I as IndexHealth, N as NodeReadiness, P as PartitionReplicationFigure, R as ReplicaLagFigure, q as ReplicationConfig, r as RestoreBackupOptions, V as VectorRebuildWaitFigure } from './config-BJSL7piq.js';
3
- import { R as RerankAdapter } from './adapters-pljAqmrC.js';
4
- import { g as ChangesSetting, h as ChangesStatus, F as FollowChangesOptions, d as ChangesEvent, p as SyncSetting, q as SyncStatus, B as BatchResult, L as ListParams, y as ListResult, w as SuggestParams, A as SuggestResult, Q as QueryParams, z as PreflightResult, I as IndexInfo, D as AnalysisChange, x as IndexStats, P as PartitionStatsResult, M as MemoryStats, J as NarsilEventMap, t as QueryResult, s as Narsil } from './engine-DoFnkRoF.js';
5
- import { B as BM25Params, I as IndexConfig, A as AnyDocument, a as InsertOptions } from './schema-CzG9OUw5.js';
6
- import { c as NodeCapacity, N as NodeRole } from './index-B_vmxpgW.js';
7
- export { A as AllocationConstraints, e as AllocationEvent, a as AllocationTable, C as ClusterCoordinator, E as ExpectedReplicaRegistration, I as IndexMetadataEvent, f as IndexMetadataWatch, g as IndexPartitionBytes, h as NodeEvent, d as NodeMemoryReport, b as NodeRegistration, P as PartitionAssignment, i as PartitionState, R as RegistrationLease, S as SchemaEvent, U as UnassignedReason } from './index-B_vmxpgW.js';
1
+ import { c as CreateIndexOptions, C as ClusterNamespace, d as ClusterNodeConfig } from './config-DL_nkguq.js';
2
+ export { B as BackupListing, e as BackupOperationOptions, f as BackupProgress, a as BackupSummary, g as ClusterBackupConfig, h as ClusterControllerConfig, i as ClusterHealth, j as ClusterHealthStatus, k as ClusterMemoryConfig, l as ClusterMetrics, b as ClusterNodeInfo, m as ClusterQueryConfig, n as CommitPointFigure, o as CoordinatorRequestFigure, p as CreateBackupOptions, D as DamagedBackup, I as IndexHealth, N as NodeReadiness, P as PartitionReplicationFigure, R as ReplicaLagFigure, q as ReplicationConfig, r as RestoreBackupOptions, V as VectorRebuildWaitFigure } from './config-DL_nkguq.js';
3
+ import { R as RerankAdapter } from './adapters-8LcdNB77.js';
4
+ import { g as ChangesSetting, h as ChangesStatus, F as FollowChangesOptions, d as ChangesEvent, p as SyncSetting, q as SyncStatus, B as BatchResult, L as ListParams, v as ListResult, w as SuggestParams, x as SuggestResult, Q as QueryParams, y as PreflightResult, I as IndexInfo, A as AnalysisChange, z as IndexStats, P as PartitionStatsResult, M as MemoryStats, D as NarsilEventMap, t as QueryResult, s as Narsil } from './engine-DGG_yX0p.js';
5
+ import { B as BM25Params, I as IndexConfig, A as AnyDocument, a as InsertOptions } from './schema-CFnQ-WI3.js';
6
+ import { c as NodeCapacity, N as NodeRole } from './index-fX_FbuRT.js';
7
+ export { A as AllocationConstraints, e as AllocationEvent, a as AllocationTable, C as ClusterCoordinator, E as ExpectedReplicaRegistration, I as IndexMetadataEvent, f as IndexMetadataWatch, g as IndexPartitionBytes, h as NodeEvent, d as NodeMemoryReport, b as NodeRegistration, P as PartitionAssignment, i as PartitionState, R as RegistrationLease, S as SchemaEvent, U as UnassignedReason } from './index-fX_FbuRT.js';
8
8
  import { a as SynonymRule } from './synonyms-CpOAHPa-.js';
9
9
  export { L as ListenHandler, N as NodeTransport, R as RespondFn, T as TransportConfig, a as TransportMessage } from './types-DvncmvuQ.js';
10
- import './config-P9zW3Zz7.js';
10
+ import './config-B3-sw887.js';
11
11
  import './query-suggestions-CBYkrQ5T.js';
12
12
 
13
13
  /**