@delali/narsil 0.2.4-next.49 → 0.2.4-next.50

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 (43) hide show
  1. package/README.md +1 -1
  2. package/dist/{options-Dtk99qUs.d.ts → capabilities-JrVQOwi4.d.ts} +55 -47
  3. package/dist/chunk-AV4IJKD2.mjs +35 -0
  4. package/dist/{chunk-M6JGMKA5.mjs → chunk-BEIK3EOZ.mjs} +503 -2273
  5. package/dist/chunk-CMVG2UEF.mjs +2038 -0
  6. package/dist/chunk-CV5H7XL7.mjs +876 -0
  7. package/dist/{chunk-KGRYQVZ5.mjs → chunk-MHE7YWAU.mjs} +2 -1
  8. package/dist/{chunk-56PJBIJ6.mjs → chunk-ND34I3SV.mjs} +427 -1455
  9. package/dist/chunk-PIWKZPP7.mjs +64 -0
  10. package/dist/{chunk-HGJC5L65.mjs → chunk-PMBHH44R.mjs} +121 -2
  11. package/dist/chunk-RP23PWMV.mjs +11 -0
  12. package/dist/{chunk-RDGXYRF4.mjs → chunk-WYJXSLER.mjs} +8 -19
  13. package/dist/{chunk-JXHUHFJ5.mjs → chunk-X6YZO4MQ.mjs} +2 -11
  14. package/dist/{chunk-OWCFK42Q.mjs → chunk-XE6XR2OE.mjs} +3 -10
  15. package/dist/chunk-ZHUQKZBE.mjs +1292 -0
  16. package/dist/{client-DX7xPcNA.d.ts → client-CBOVHdjp.d.ts} +31 -7
  17. package/dist/client.d.ts +7 -7
  18. package/dist/client.mjs +26 -10
  19. package/dist/{config-B41W23Us.d.ts → config-Czh2YNDi.d.ts} +2 -2
  20. package/dist/{config-Co-zAXqO.d.ts → config-OON7IJ_B.d.ts} +26 -5
  21. package/dist/direct-executor-OREXU72C.mjs +12 -0
  22. package/dist/distribution/coordinator/etcd.d.ts +2 -2
  23. package/dist/distribution/coordinator/in-memory.d.ts +2 -2
  24. package/dist/distribution.d.ts +8 -8
  25. package/dist/distribution.mjs +28 -11
  26. package/dist/{engine-CABZg25p.d.ts → engine-9PtFY50q.d.ts} +114 -62
  27. package/dist/index.browser.mjs +3255 -2516
  28. package/dist/index.d.ts +7 -7
  29. package/dist/index.mjs +11 -6
  30. package/dist/{search-FjWhZN3f.d.ts → memory-Bzd5xcEW.d.ts} +88 -79
  31. package/dist/persistence/durability/checkpoint-worker.d.ts +1 -1
  32. package/dist/persistence/durability/checkpoint-worker.mjs +11 -6
  33. package/dist/react.d.ts +4 -4
  34. package/dist/{schema-B7juWg8Q.d.ts → schema-BqRx9t4E.d.ts} +22 -3
  35. package/dist/server.d.ts +47 -42
  36. package/dist/server.mjs +321 -817
  37. package/dist/thread-PZLEO6JL.mjs +310 -0
  38. package/dist/{types-DsSSjY4d.d.ts → types-DXPxaXPO.d.ts} +1 -1
  39. package/dist/vector/hnsw-build-worker.mjs +2 -1
  40. package/dist/vector/search-worker.mjs +3 -121
  41. package/dist/workers/entry.mjs +47 -3
  42. package/package.json +5 -1
  43. package/dist/direct-executor-HRTDWMVB.mjs +0 -9
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { c as StopWordOverride, C as CustomTokenizer } from './schema-B7juWg8Q.js';
2
- export { A as AnyDocument, B as BM25Params, E as EmbeddingFieldConfig, F as FieldType, I as IndexConfig, b as InsertOptions, P as PartitionConfig, S as SchemaDefinition, a as ScoringMode, V as VectorIndexConfig, d as VectorQuantizationMode } from './schema-B7juWg8Q.js';
1
+ import { c as StopWordOverride, C as CustomTokenizer } from './schema-BqRx9t4E.js';
2
+ export { A as AnyDocument, B as BM25Params, E as EmbeddingFieldConfig, F as FieldType, I as IndexConfig, b as InsertOptions, P as PartitionConfig, S as SchemaDefinition, a as ScoringMode, V as VectorIndexConfig, d as VectorQuantizationMode, W as WriteOptions } from './schema-BqRx9t4E.js';
3
3
  import { L as LanguageModule } from './language-DB8KG1z5.js';
4
4
  export { T as TokenizerConfig } from './language-DB8KG1z5.js';
5
- export { A as ArrayFilter, B as BatchResult, C as ClientErrorCode, a as ClientErrorCodes, k as ComparisonFilter, D as DocumentProjection, E as ErrorCode, b as ErrorCodes, F as FacetConfig, l as FacetResult, m as FieldFilter, n as FilterExpression, G as GeoFilter, o as GeoPolygonFilter, p as GeoRadiusFilter, q as GroupConfig, r as GroupReducer, s as GroupResult, H as HighlightConfig, t as HighlightMatch, u as Hit, v as HybridConfig, I as IndexInfo, f as IndexStats, L as ListParams, g as ListResult, w as ListedDocument, M as MemoryStats, N as NarsilError, c as NarsilErrorCode, P as PartitionStatsResult, h as PreflightResult, x as PresenceFilter, y as ProcessMemoryReport, z as QueryCoverage, Q as QueryParams, e as QueryResult, J as ScoreComponents, K as SearchMode, S as ServerErrorCode, d as ServerErrorCodes, O as SortField, R as SortSpec, T as StringFilter, i as SuggestParams, j as SuggestResult, U as TermMatchPolicy, V as VectorMaintenanceResult, W as VectorQueryConfig, X as WorkerCopyReport } from './search-FjWhZN3f.js';
6
- import { N as NarsilConfig } from './config-Co-zAXqO.js';
7
- export { A as AnalysisConfig, D as DurabilityConfig, I as IndexContext, a as IndexLifecycleConfig, b as InsertContext, c as NarsilPlugin, P as PartitionContext, R as RemoveContext, S as SearchContext, d as StaleAnalysis, U as UpdateContext, W as WorkerConfig, e as WorkerContext } from './config-Co-zAXqO.js';
8
- import { a as Narsil } from './engine-CABZg25p.js';
9
- export { I as IndexLifecycleOperations, N as NarsilEventMap } from './engine-CABZg25p.js';
5
+ export { A as ArrayFilter, B as BatchResult, C as ClientErrorCode, a as ClientErrorCodes, k as ComparisonFilter, D as DocumentProjection, E as ErrorCode, b as ErrorCodes, F as FacetConfig, l as FacetResult, m as FieldFilter, n as FilterExpression, G as GeoFilter, o as GeoPolygonFilter, p as GeoRadiusFilter, q as GroupConfig, r as GroupReducer, s as GroupResult, H as HighlightConfig, t as HighlightMatch, u as Hit, v as HybridConfig, I as IndexInfo, f as IndexStats, L as ListParams, g as ListResult, w as ListedDocument, M as MemoryStats, N as NarsilError, c as NarsilErrorCode, P as PartitionStatsResult, h as PreflightResult, x as PresenceFilter, y as ProcessMemoryReport, z as QueryCoverage, Q as QueryParams, e as QueryResult, J as ScoreComponents, K as SearchMode, S as ServerErrorCode, d as ServerErrorCodes, O as SortField, R as SortSpec, T as StringFilter, i as SuggestParams, j as SuggestResult, U as TermMatchPolicy, V as VectorMaintenanceResult, W as VectorQueryConfig, X as WorkerCopyReport } from './memory-Bzd5xcEW.js';
6
+ import { N as NarsilConfig } from './config-OON7IJ_B.js';
7
+ export { A as AnalysisConfig, D as DurabilityConfig, I as IndexContext, a as IndexLifecycleConfig, b as InsertContext, M as MainCopyQueries, c as NarsilPlugin, P as PartitionContext, R as RemoveContext, S as SearchContext, d as StaleAnalysis, U as UpdateContext, W as WorkerConfig, e as WorkerContext } from './config-OON7IJ_B.js';
8
+ import { a as Narsil } from './engine-9PtFY50q.js';
9
+ export { D as DocumentWriteOperations, I as IndexLifecycleOperations, N as NarsilEventMap } from './engine-9PtFY50q.js';
10
10
  export { E as EmbeddingAdapter, I as InvalidationAdapter, a as InvalidationEvent, b as PartitionStatistics, P as PersistenceAdapter } from './adapters-79OIa4xm.js';
11
11
 
12
12
  /**
package/dist/index.mjs CHANGED
@@ -1,13 +1,18 @@
1
- export { VERSION, createNarsil } from './chunk-56PJBIJ6.mjs';
1
+ export { VERSION, createNarsil } from './chunk-ND34I3SV.mjs';
2
+ import './chunk-ZHUQKZBE.mjs';
2
3
  import './chunk-GCM3JFVA.mjs';
3
- import './chunk-OWCFK42Q.mjs';
4
- export { clearNormalizationCache, configureNormalizationCache, getLanguage, getNormalizationCacheSize, getStopWords, getTokenizer, hasStopWords, hasTokenizer, registerLanguage, registerStopWords, registerTokenizer, resetNormalizationCache } from './chunk-M6JGMKA5.mjs';
4
+ import './chunk-PIWKZPP7.mjs';
5
+ import './chunk-XE6XR2OE.mjs';
6
+ export { getLanguage, getStopWords, getTokenizer, hasStopWords, hasTokenizer, registerLanguage, registerStopWords, registerTokenizer } from './chunk-BEIK3EOZ.mjs';
7
+ export { clearNormalizationCache, configureNormalizationCache, getNormalizationCacheSize, resetNormalizationCache } from './chunk-CMVG2UEF.mjs';
8
+ import './chunk-AV4IJKD2.mjs';
5
9
  import './chunk-CBLS46IE.mjs';
6
10
  import './chunk-TGP5M5R7.mjs';
7
- import './chunk-HGJC5L65.mjs';
8
- export { isSimdAvailable } from './chunk-JXHUHFJ5.mjs';
11
+ import './chunk-PMBHH44R.mjs';
12
+ export { isSimdAvailable } from './chunk-X6YZO4MQ.mjs';
13
+ import './chunk-RP23PWMV.mjs';
9
14
  import './chunk-KMMJMDUA.mjs';
10
15
  import './chunk-U2BKYEC7.mjs';
11
16
  import './chunk-2GWVQWGA.mjs';
12
- import './chunk-RDGXYRF4.mjs';
17
+ import './chunk-WYJXSLER.mjs';
13
18
  export { ClientErrorCodes, ErrorCodes, NarsilError, ServerErrorCodes } from './chunk-P4ELXVJQ.mjs';
@@ -1,4 +1,4 @@
1
- import { A as AnyDocument, S as SchemaDefinition, a as ScoringMode } from './schema-B7juWg8Q.js';
1
+ import { A as AnyDocument, S as SchemaDefinition, a as ScoringMode } from './schema-BqRx9t4E.js';
2
2
 
3
3
  /**
4
4
  * Every code a {@link NarsilError} carries, grouped by the part of the engine
@@ -450,83 +450,6 @@ interface SuggestResult {
450
450
  /** This turns true when the index's terms came from an older analysis than its language module produces now. */
451
451
  analysisStale?: boolean;
452
452
  }
453
- /**
454
- * Snapshot of V8 heap usage as reported by `process.memoryUsage()`. All values
455
- * are bytes. `null` in environments that do not expose `process.memoryUsage`,
456
- * such as browsers.
457
- *
458
- * @public
459
- */
460
- interface ProcessMemoryReport {
461
- /** The process is using this much heap. */
462
- heapUsed: number;
463
- /** V8 has reserved this much heap. */
464
- heapTotal: number;
465
- /** The process holds this much outside the heap, such as buffers. */
466
- external: number;
467
- /** The process occupies this much physical memory in total. */
468
- rss: number;
469
- }
470
- /**
471
- * Whether one index holds worker copies at the moment
472
- * {@link Narsil.getMemoryStats} reads it, and how many times it has loaded
473
- * them again after giving them up while idle.
474
- *
475
- * @public
476
- */
477
- interface WorkerCopyReport {
478
- /** This names the index. */
479
- indexName: string;
480
- /** This is true while every worker holds a copy of the index. */
481
- scaledOut: boolean;
482
- /** The index has loaded its copies again this many times after an idle spell dropped them. */
483
- reloadCount: number;
484
- }
485
- /**
486
- * What {@link Narsil.getMemoryStats} returns, which is what you size a host
487
- * from.
488
- *
489
- * @public
490
- */
491
- interface MemoryStats {
492
- /**
493
- * V8 heap usage for the host process at the moment the call was made. This
494
- * is process-wide, not engine-wide; if multiple Narsil engines are running
495
- * in the same process every engine's `getMemoryStats` returns the same
496
- * `process` figures. `null` in browsers and any runtime where
497
- * `process.memoryUsage` is unavailable.
498
- */
499
- process: ProcessMemoryReport | null;
500
- /**
501
- * Sum of every index's {@link IndexStats.estimatedMemoryBytes} held by this
502
- * engine. Formula-based; treat as an estimate, not a measurement. Useful
503
- * for cross-engine relative comparisons inside a single process where
504
- * `process.heapUsed` cannot tell engines apart.
505
- */
506
- estimatedIndexBytes: number;
507
- /** This many indexes currently occupy engine memory. */
508
- openIndexCount: number;
509
- /** This many indexes remain registered without occupying engine memory, including parked recovery failures. */
510
- closedIndexCount: number;
511
- /** This counts successful index loads since this engine started. */
512
- reopenCount: number;
513
- /** One entry per index, saying whether it holds worker copies now and how many times it has reloaded them. */
514
- workerCopies: WorkerCopyReport[];
515
- /**
516
- * Per-worker V8 heap usage once the engine has started its worker pool.
517
- * Empty while no worker is running.
518
- */
519
- workers: Array<{
520
- /** This identifies the worker within the pool. */
521
- workerId: number;
522
- /** That worker is using this much heap. */
523
- heapUsed: number;
524
- /** V8 has reserved this much heap in that worker. */
525
- heapTotal: number;
526
- /** That worker holds this much outside its heap. */
527
- external: number;
528
- }>;
529
- }
530
453
  /**
531
454
  * The state of one vector field, and what maintenance would cost, as
532
455
  * {@link Narsil.vectorMaintenanceStatus} reports it.
@@ -541,7 +464,7 @@ interface VectorMaintenanceResult {
541
464
  fieldName: string;
542
465
  /** Tombstones make up this share of the graph's nodes, from 0 to 1. */
543
466
  tombstoneRatio: number;
544
- /** The field's HNSW graph holds this many vectors. */
467
+ /** The field holds this many HNSW graphs: 0 before the first build and 1 once a graph exists. */
545
468
  graphCount: number;
546
469
  /** This many vectors wait outside the graph, which a search scans one by one. */
547
470
  bufferSize: number;
@@ -1064,4 +987,90 @@ interface ListParams {
1064
987
  document?: DocumentProjection;
1065
988
  }
1066
989
 
990
+ /**
991
+ * Snapshot of V8 heap usage as reported by `process.memoryUsage()`, with the
992
+ * limit the heap may grow to. All values are bytes. `null` in environments
993
+ * that do not expose `process.memoryUsage`, such as browsers.
994
+ *
995
+ * @public
996
+ */
997
+ interface ProcessMemoryReport {
998
+ /** The process is using this much heap. */
999
+ heapUsed: number;
1000
+ /** V8 has reserved this much heap. */
1001
+ heapTotal: number;
1002
+ /**
1003
+ * The heap may grow to this many bytes before the runtime ends the process
1004
+ * for running out of memory. Node sets it from `--max-old-space-size`, from
1005
+ * `--max-old-space-size-percentage`, or from the memory the host or the
1006
+ * container reports. `null` where the runtime cannot report it.
1007
+ */
1008
+ heapLimit: number | null;
1009
+ /** The process holds this much outside the heap, such as buffers. */
1010
+ external: number;
1011
+ /** The process occupies this much physical memory in total. */
1012
+ rss: number;
1013
+ }
1014
+ /**
1015
+ * Whether one index holds worker copies at the moment
1016
+ * {@link Narsil.getMemoryStats} reads it, and how many times it has loaded
1017
+ * them again after giving them up while idle.
1018
+ *
1019
+ * @public
1020
+ */
1021
+ interface WorkerCopyReport {
1022
+ /** This names the index. */
1023
+ indexName: string;
1024
+ /** This is true while every worker holds a copy of the index. */
1025
+ scaledOut: boolean;
1026
+ /** The index has loaded its copies again this many times after an idle spell dropped them. */
1027
+ reloadCount: number;
1028
+ }
1029
+ /**
1030
+ * What {@link Narsil.getMemoryStats} returns, which is what you size a host
1031
+ * from.
1032
+ *
1033
+ * @public
1034
+ */
1035
+ interface MemoryStats {
1036
+ /**
1037
+ * V8 heap usage for the host process at the moment of the call. It covers
1038
+ * the whole process, so every Narsil engine in one process returns the same
1039
+ * `process` figures from `getMemoryStats`. `null` in browsers and in any
1040
+ * runtime that does not expose `process.memoryUsage`.
1041
+ */
1042
+ process: ProcessMemoryReport | null;
1043
+ /**
1044
+ * The sum of every index's {@link IndexStats.estimatedMemoryBytes} held by
1045
+ * this engine. A formula produces it, so read it as an estimate. It compares
1046
+ * engines inside one process, where `process.heapUsed` cannot tell them
1047
+ * apart.
1048
+ */
1049
+ estimatedIndexBytes: number;
1050
+ /** This many indexes currently occupy engine memory. */
1051
+ openIndexCount: number;
1052
+ /** This many indexes remain registered without occupying engine memory, including parked recovery failures. */
1053
+ closedIndexCount: number;
1054
+ /** This counts successful index loads since this engine started. */
1055
+ reopenCount: number;
1056
+ /** One entry per index, saying whether it holds worker copies now and how many times it has reloaded them. */
1057
+ workerCopies: WorkerCopyReport[];
1058
+ /**
1059
+ * Per-worker V8 heap usage once the engine has started its worker pool.
1060
+ * Empty while no worker is running.
1061
+ */
1062
+ workers: Array<{
1063
+ /** This identifies the worker within the pool. */
1064
+ workerId: number;
1065
+ /** That worker is using this much heap. */
1066
+ heapUsed: number;
1067
+ /** V8 has reserved this much heap in that worker. */
1068
+ heapTotal: number;
1069
+ /** That worker's heap may grow to this many bytes, or `null` where its runtime cannot report it. */
1070
+ heapLimit: number | null;
1071
+ /** That worker holds this much outside its heap. */
1072
+ external: number;
1073
+ }>;
1074
+ }
1075
+
1067
1076
  export { type ArrayFilter as A, type BatchResult as B, type ClientErrorCode as C, type DocumentProjection as D, type ErrorCode as E, type FacetConfig as F, type GeoFilter as G, type HighlightConfig as H, type IndexInfo as I, type ScoreComponents as J, type SearchMode as K, type ListParams as L, type MemoryStats as M, NarsilError as N, type SortField as O, type PartitionStatsResult as P, type QueryParams as Q, type SortSpec as R, type ServerErrorCode as S, type StringFilter as T, type TermMatchPolicy as U, type VectorMaintenanceResult as V, type VectorQueryConfig as W, type WorkerCopyReport as X, ClientErrorCodes as a, ErrorCodes as b, type NarsilErrorCode as c, ServerErrorCodes as d, type QueryResult as e, type IndexStats as f, type ListResult as g, type PreflightResult as h, type SuggestParams as i, type SuggestResult as j, type ComparisonFilter as k, type FacetResult as l, type FieldFilter as m, type FilterExpression as n, type GeoPolygonFilter as o, type GeoRadiusFilter as p, type GroupConfig as q, type GroupReducer as r, type GroupResult as s, type HighlightMatch as t, type Hit as u, type HybridConfig as v, type ListedDocument as w, type PresenceFilter as x, type ProcessMemoryReport as y, type QueryCoverage as z };
@@ -1,4 +1,4 @@
1
- import { P as PartitionConfig, a as ScoringMode, V as VectorIndexConfig } from '../../schema-B7juWg8Q.js';
1
+ import { P as PartitionConfig, a as ScoringMode, V as VectorIndexConfig } from '../../schema-BqRx9t4E.js';
2
2
  import '../../adapters-79OIa4xm.js';
3
3
 
4
4
  interface IndexMetadata {
@@ -1,15 +1,20 @@
1
- import { createDurableDirectory, writeSegmentedCheckpoint } from '../../chunk-56PJBIJ6.mjs';
1
+ import { createDurableDirectory, writeSegmentedCheckpoint } from '../../chunk-ND34I3SV.mjs';
2
+ import '../../chunk-ZHUQKZBE.mjs';
2
3
  import '../../chunk-GCM3JFVA.mjs';
3
- import '../../chunk-OWCFK42Q.mjs';
4
- import '../../chunk-M6JGMKA5.mjs';
4
+ import '../../chunk-PIWKZPP7.mjs';
5
+ import '../../chunk-XE6XR2OE.mjs';
6
+ import '../../chunk-BEIK3EOZ.mjs';
7
+ import '../../chunk-CMVG2UEF.mjs';
8
+ import '../../chunk-AV4IJKD2.mjs';
5
9
  import '../../chunk-CBLS46IE.mjs';
6
10
  import '../../chunk-TGP5M5R7.mjs';
7
- import '../../chunk-HGJC5L65.mjs';
8
- import '../../chunk-JXHUHFJ5.mjs';
11
+ import '../../chunk-PMBHH44R.mjs';
12
+ import '../../chunk-X6YZO4MQ.mjs';
13
+ import '../../chunk-RP23PWMV.mjs';
9
14
  import '../../chunk-KMMJMDUA.mjs';
10
15
  import '../../chunk-U2BKYEC7.mjs';
11
16
  import '../../chunk-2GWVQWGA.mjs';
12
- import '../../chunk-RDGXYRF4.mjs';
17
+ import '../../chunk-WYJXSLER.mjs';
13
18
  import '../../chunk-P4ELXVJQ.mjs';
14
19
 
15
20
  // src/persistence/durability/rebuild.ts
package/dist/react.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { N as NarsilError, L as ListParams, g as ListResult, I as IndexInfo, f as IndexStats, Q as QueryParams, h as PreflightResult, e as QueryResult, i as SuggestParams, j as SuggestResult } from './search-FjWhZN3f.js';
2
- export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes } from './search-FjWhZN3f.js';
1
+ import { N as NarsilError, L as ListParams, g as ListResult, I as IndexInfo, f as IndexStats, Q as QueryParams, h as PreflightResult, e as QueryResult, i as SuggestParams, j as SuggestResult } from './memory-Bzd5xcEW.js';
2
+ export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes } from './memory-Bzd5xcEW.js';
3
3
  import { e as TaskRecord, d as TaskProgress, b as ImportResult, c as TaskListQuery, T as TaskListPage } from './tasks-Bn4R1NPN.js';
4
4
  export { I as ImportError, f as TaskStatus, g as TaskType } from './tasks-Bn4R1NPN.js';
5
5
  import { ReactNode, ReactElement } from 'react';
6
- import { N as NarsilClient, I as ImportSource } from './client-DX7xPcNA.js';
7
- import { A as AnyDocument } from './schema-B7juWg8Q.js';
6
+ import { N as NarsilClient, I as ImportSource } from './client-CBOVHdjp.js';
7
+ import { A as AnyDocument } from './schema-BqRx9t4E.js';
8
8
  import './adapters-79OIa4xm.js';
9
9
 
10
10
  /**
@@ -217,11 +217,30 @@ interface PartitionConfig {
217
217
  */
218
218
  type ScoringMode = 'local' | 'dfs' | 'broadcast';
219
219
  /**
220
- * Per-write options for {@link Narsil.insert} and {@link Narsil.insertBatch}.
220
+ * Per-write options every write accepts.
221
+ *
222
+ * A write returns once the main copy holds it, and it reaches the worker
223
+ * copies afterwards, so a query that a copy answers may come back without a
224
+ * write that returned before it.
225
+ *
226
+ * @public
227
+ */
228
+ interface WriteOptions {
229
+ /**
230
+ * Setting this makes the write return only once every worker copy holding
231
+ * the index has applied it, so the next query sees it whichever copy
232
+ * answers. Leave it off for a load, and call
233
+ * {@link DocumentWriteOperations.waitForWrites} once at the end.
234
+ */
235
+ wait?: boolean;
236
+ }
237
+ /**
238
+ * Per-write options for {@link DocumentWriteOperations.insert} and
239
+ * {@link DocumentWriteOperations.insertBatch}.
221
240
  *
222
241
  * @public
223
242
  */
224
- interface InsertOptions {
243
+ interface InsertOptions extends WriteOptions {
225
244
  /**
226
245
  * Setting this stores the document object you passed instead of a copy,
227
246
  * which saves a clone on a large load. Changing that object afterwards
@@ -231,4 +250,4 @@ interface InsertOptions {
231
250
  skipClone?: boolean;
232
251
  }
233
252
 
234
- export type { AnyDocument as A, BM25Params as B, CustomTokenizer as C, EmbeddingFieldConfig as E, FieldType as F, IndexConfig as I, PartitionConfig as P, SchemaDefinition as S, VectorIndexConfig as V, ScoringMode as a, InsertOptions as b, StopWordOverride as c, VectorQuantizationMode as d };
253
+ export type { AnyDocument as A, BM25Params as B, CustomTokenizer as C, EmbeddingFieldConfig as E, FieldType as F, IndexConfig as I, PartitionConfig as P, SchemaDefinition as S, VectorIndexConfig as V, WriteOptions as W, ScoringMode as a, InsertOptions as b, StopWordOverride as c, VectorQuantizationMode as d };
package/dist/server.d.ts CHANGED
@@ -1,22 +1,60 @@
1
- import { b as ServerOptions, N as NarsilServer } from './options-Dtk99qUs.js';
2
- export { A as ASYNC_IMPORT_CAPABILITY, C as CorsOptions, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, O as OnRequestHook, R as REBUILD_ANALYSIS_CAPABILITY, c as RequestContext, d as RequestDenial, S as SERVER_CAPABILITIES, e as ServerLimits, T as TASK_CANCEL_CAPABILITY, a as TASK_FILTER_CAPABILITY } from './options-Dtk99qUs.js';
3
- import { a as Narsil } from './engine-CABZg25p.js';
4
- import { h as TaskStore, e as TaskRecord, d as TaskProgress, b as ImportResult } from './tasks-Bn4R1NPN.js';
1
+ import { b as ServerOptions, N as NarsilServer } from './capabilities-JrVQOwi4.js';
2
+ export { A as ASYNC_IMPORT_CAPABILITY, C as CorsOptions, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, O as OnRequestHook, R as REBUILD_ANALYSIS_CAPABILITY, c as RequestContext, d as RequestDenial, S as SERVER_CAPABILITIES, e as ServerLimits, T as TASK_CANCEL_CAPABILITY, a as TASK_FILTER_CAPABILITY } from './capabilities-JrVQOwi4.js';
3
+ import { a as Narsil } from './engine-9PtFY50q.js';
4
+ import { d as TaskProgress, b as ImportResult, h as TaskStore, e as TaskRecord } from './tasks-Bn4R1NPN.js';
5
5
  export { C as CapabilitiesResponse, a as CreateIndexEmbedding, i as CreateIndexRequest, H as HttpIndexConfig, I as ImportError, T as TaskListPage, c as TaskListQuery, f as TaskStatus, g as TaskType } from './tasks-Bn4R1NPN.js';
6
- export { d as ServerErrorCodes } from './search-FjWhZN3f.js';
6
+ export { d as ServerErrorCodes } from './memory-Bzd5xcEW.js';
7
7
  import './adapters-79OIa4xm.js';
8
- import './config-B41W23Us.js';
9
- import './config-Co-zAXqO.js';
10
- import './schema-B7juWg8Q.js';
11
- import './types-DsSSjY4d.js';
8
+ import './config-Czh2YNDi.js';
9
+ import './config-OON7IJ_B.js';
10
+ import './schema-BqRx9t4E.js';
11
+ import './types-DXPxaXPO.js';
12
12
  import './types-D5OwhtsQ.js';
13
13
 
14
+ /**
15
+ * What a running task reports back while it works, and how it learns that a
16
+ * cancel arrived.
17
+ *
18
+ * @public
19
+ */
20
+ interface TaskContext {
21
+ /** Aborts once a cancel arrives, so long-running work can stop between units. */
22
+ readonly signal: AbortSignal;
23
+ /**
24
+ * Records how far the work has gone, which `GET /tasks/{id}` then reports.
25
+ *
26
+ * @param progress - The counters as they stand now.
27
+ */
28
+ reportProgress(progress: TaskProgress): void;
29
+ /**
30
+ * Records what the work produced, which the finished task then carries.
31
+ *
32
+ * @param result - What the work produced.
33
+ */
34
+ reportResult(result: ImportResult): void;
35
+ }
36
+ /**
37
+ * The work one task runs.
38
+ *
39
+ * Resolving marks the task succeeded. Rejecting marks it failed, unless a
40
+ * cancel had already arrived, which marks it cancelled instead. Work that
41
+ * cannot stop early ignores the signal and still finishes.
42
+ *
43
+ * @public
44
+ */
45
+ type TaskOperation = (ctx: TaskContext) => Promise<void>;
46
+
14
47
  /**
15
48
  * Wraps a Narsil engine in an HTTP server. The caller builds and owns the engine
16
49
  * (durability, embedding, workers) and hands the live instance in; the server
17
50
  * shares it across requests and never constructs or shuts it down. Start with
18
51
  * `.listen()` and stop with `.close()`; the engine is shut down separately.
19
52
  *
53
+ * On Node.js the server receives requests on the engine's worker threads, which
54
+ * hold the worker copies. A query on an index that holds copies answers on the
55
+ * thread that received it, and every write goes to the main thread. Read
56
+ * {@link NarsilServer.requestThreadCount} for how many threads took requests.
57
+ *
20
58
  * @param engine - The live engine every request runs against.
21
59
  * @param options - Address, CORS, request limits, the authentication hook, and
22
60
  * the task store. Omit it to bind to loopback with the default limits.
@@ -83,37 +121,4 @@ declare class InMemoryTaskStore implements TaskStore {
83
121
  private prune;
84
122
  }
85
123
 
86
- /**
87
- * What a running task reports back while it works, and how it learns that a
88
- * cancel arrived.
89
- *
90
- * @public
91
- */
92
- interface TaskContext {
93
- /** Aborts once a cancel arrives, so long-running work can stop between units. */
94
- readonly signal: AbortSignal;
95
- /**
96
- * Records how far the work has gone, which `GET /tasks/{id}` then reports.
97
- *
98
- * @param progress - The counters as they stand now.
99
- */
100
- reportProgress(progress: TaskProgress): void;
101
- /**
102
- * Records what the work produced, which the finished task then carries.
103
- *
104
- * @param result - What the work produced.
105
- */
106
- reportResult(result: ImportResult): void;
107
- }
108
- /**
109
- * The work one task runs.
110
- *
111
- * Resolving marks the task succeeded. Rejecting marks it failed, unless a
112
- * cancel had already arrived, which marks it cancelled instead. Work that
113
- * cannot stop early ignores the signal and still finishes.
114
- *
115
- * @public
116
- */
117
- type TaskOperation = (ctx: TaskContext) => Promise<void>;
118
-
119
124
  export { ImportResult, InMemoryTaskStore, NarsilServer, ServerOptions, type TaskContext, type TaskOperation, TaskProgress, TaskRecord, TaskStore, createServer, httpStatusForNarsilError };