@delali/narsil 0.2.4-next.43 → 0.2.4-next.45

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 (35) hide show
  1. package/dist/adapters/filesystem.mjs +1 -1
  2. package/dist/adapters/indexeddb.mjs +1 -1
  3. package/dist/{chunk-TLRUUMVE.mjs → chunk-P4ELXVJQ.mjs} +1 -0
  4. package/dist/{chunk-KEDL6FFZ.mjs → chunk-WASNWIEK.mjs} +1142 -327
  5. package/dist/{chunk-YGQMKTKG.mjs → chunk-XNCJFU2E.mjs} +121 -27
  6. package/dist/{chunk-O4Q5JYNK.mjs → chunk-XWICBGYT.mjs} +1 -1
  7. package/dist/{client-B5uO5jL1.d.ts → client-C5BkUqB8.d.ts} +25 -2
  8. package/dist/client.d.ts +7 -7
  9. package/dist/client.mjs +11 -2
  10. package/dist/{config-NgUCkc6a.d.ts → config-B-ZI-ft5.d.ts} +2 -2
  11. package/dist/{config-B09-cud9.d.ts → config-BZRExglL.d.ts} +20 -3
  12. package/dist/{direct-executor-7O23GEHE.mjs → direct-executor-IMXNRS7O.mjs} +2 -2
  13. package/dist/distribution/coordinator/etcd.d.ts +2 -2
  14. package/dist/distribution/coordinator/etcd.mjs +1 -1
  15. package/dist/distribution/coordinator/in-memory.d.ts +2 -2
  16. package/dist/distribution/transport/grpc.mjs +1 -1
  17. package/dist/distribution.d.ts +24 -10
  18. package/dist/distribution.mjs +1023 -864
  19. package/dist/embeddings/openai.mjs +1 -1
  20. package/dist/{engine-CjLhdDIm.d.ts → engine-Cjr1uBLa.d.ts} +28 -6
  21. package/dist/index.browser.mjs +1237 -330
  22. package/dist/index.d.ts +9 -9
  23. package/dist/index.mjs +4 -4
  24. package/dist/{options-BakECW-r.d.ts → options-BC68VPoE.d.ts} +9 -2
  25. package/dist/persistence/durability/checkpoint-worker.d.ts +3 -1
  26. package/dist/persistence/durability/checkpoint-worker.mjs +4 -4
  27. package/dist/react.d.ts +4 -4
  28. package/dist/react.mjs +1 -0
  29. package/dist/{schema-DXOd96kx.d.ts → schema-B7juWg8Q.d.ts} +1 -1
  30. package/dist/{search-BGouJxH4.d.ts → search-DDHjfXhJ.d.ts} +14 -3
  31. package/dist/server.d.ts +8 -8
  32. package/dist/server.mjs +27 -6
  33. package/dist/{types-BTE33VZS.d.ts → types-DsSSjY4d.d.ts} +1 -1
  34. package/dist/workers/entry.mjs +2 -2
  35. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { c as StopWordOverride, C as CustomTokenizer } from './schema-DXOd96kx.js';
2
- export { A as AnyDocument, B as BM25Params, E as EmbeddingFieldConfig, F as FieldType, I as IndexConfig, a as InsertOptions, P as PartitionConfig, S as SchemaDefinition, b as ScoringMode, V as VectorIndexConfig, d as VectorQuantizationMode } from './schema-DXOd96kx.js';
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';
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 } from './search-BGouJxH4.js';
6
- import { N as NarsilConfig } from './config-B09-cud9.js';
7
- export { A as AnalysisConfig, D as DurabilityConfig, I as IndexContext, a as InsertContext, b as NarsilPlugin, P as PartitionContext, R as RemoveContext, S as SearchContext, c as StaleAnalysis, U as UpdateContext, W as WorkerConfig, d as WorkerContext } from './config-B09-cud9.js';
8
- import { a as Narsil } from './engine-CjLhdDIm.js';
9
- export { N as NarsilEventMap } from './engine-CjLhdDIm.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 } from './search-DDHjfXhJ.js';
6
+ import { N as NarsilConfig } from './config-BZRExglL.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-BZRExglL.js';
8
+ import { a as Narsil } from './engine-Cjr1uBLa.js';
9
+ export { I as IndexLifecycleOperations, N as NarsilEventMap } from './engine-Cjr1uBLa.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
  /**
@@ -154,8 +154,8 @@ declare function getLanguage(name: string): LanguageModule;
154
154
  *
155
155
  * The engine holds every index you create, so an application usually keeps one
156
156
  * instance for its lifetime. When you configure persistence, this recovers the
157
- * indexes already on disk before it resolves, so the engine is ready to query
158
- * as soon as you have it.
157
+ * indexes already on disk before it resolves. Lifecycle settings register
158
+ * those indexes as closed and load each one when its first request arrives.
159
159
  *
160
160
  * @param config - This carries the persistence, partitioning, and worker
161
161
  * invalidation settings. Omit it for an engine that keeps everything in memory.
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- export { VERSION, createNarsil } from './chunk-KEDL6FFZ.mjs';
1
+ export { VERSION, createNarsil } from './chunk-WASNWIEK.mjs';
2
2
  import './chunk-JQUL2T6I.mjs';
3
- import './chunk-O4Q5JYNK.mjs';
4
- export { clearNormalizationCache, configureNormalizationCache, getLanguage, getNormalizationCacheSize, getStopWords, getTokenizer, hasStopWords, hasTokenizer, registerLanguage, registerStopWords, registerTokenizer, resetNormalizationCache } from './chunk-YGQMKTKG.mjs';
3
+ import './chunk-XWICBGYT.mjs';
4
+ export { clearNormalizationCache, configureNormalizationCache, getLanguage, getNormalizationCacheSize, getStopWords, getTokenizer, hasStopWords, hasTokenizer, registerLanguage, registerStopWords, registerTokenizer, resetNormalizationCache } from './chunk-XNCJFU2E.mjs';
5
5
  import './chunk-TGP5M5R7.mjs';
6
6
  import './chunk-OBXS7OZM.mjs';
7
7
  export { isSimdAvailable } from './chunk-WDL632CN.mjs';
@@ -9,4 +9,4 @@ import './chunk-KMMJMDUA.mjs';
9
9
  import './chunk-U2BKYEC7.mjs';
10
10
  import './chunk-BFIH7OV5.mjs';
11
11
  import './chunk-WTONLDU3.mjs';
12
- export { ClientErrorCodes, ErrorCodes, NarsilError, ServerErrorCodes } from './chunk-TLRUUMVE.mjs';
12
+ export { ClientErrorCodes, ErrorCodes, NarsilError, ServerErrorCodes } from './chunk-P4ELXVJQ.mjs';
@@ -1,4 +1,4 @@
1
- import { C as ClusterNamespace } from './config-NgUCkc6a.js';
1
+ import { C as ClusterNamespace } from './config-B-ZI-ft5.js';
2
2
  import { E as EmbeddingAdapter } from './adapters-79OIa4xm.js';
3
3
  import { h as TaskStore } from './tasks-Bn4R1NPN.js';
4
4
 
@@ -29,6 +29,13 @@ declare const TASK_FILTER_CAPABILITY = "tasks.filter";
29
29
  * @public
30
30
  */
31
31
  declare const REBUILD_ANALYSIS_CAPABILITY = "indexes.rebuildAnalysis";
32
+ /**
33
+ * Marks that `POST /indexes/{name}/_open` and `POST /indexes/{name}/_close`
34
+ * load and release an index's server memory.
35
+ *
36
+ * @public
37
+ */
38
+ declare const INDEX_LIFECYCLE_CAPABILITY = "indexes.lifecycle";
32
39
  /**
33
40
  * Every capability this server announces at `/capabilities`.
34
41
  *
@@ -240,4 +247,4 @@ interface ErrorEnvelope {
240
247
  };
241
248
  }
242
249
 
243
- export { ASYNC_IMPORT_CAPABILITY as A, type CorsOptions as C, type ErrorEnvelope as E, type NarsilServer as N, type OnRequestHook as O, REBUILD_ANALYSIS_CAPABILITY as R, SERVER_CAPABILITIES as S, TASK_CANCEL_CAPABILITY as T, TASK_FILTER_CAPABILITY as a, type ServerOptions as b, type RequestContext as c, type RequestDenial as d, type ServerLimits as e };
250
+ export { ASYNC_IMPORT_CAPABILITY as A, type CorsOptions as C, type ErrorEnvelope as E, INDEX_LIFECYCLE_CAPABILITY as I, type NarsilServer as N, type OnRequestHook as O, REBUILD_ANALYSIS_CAPABILITY as R, SERVER_CAPABILITIES as S, TASK_CANCEL_CAPABILITY as T, TASK_FILTER_CAPABILITY as a, type ServerOptions as b, type RequestContext as c, type RequestDenial as d, type ServerLimits as e };
@@ -1,8 +1,10 @@
1
- import { P as PartitionConfig, b as ScoringMode, V as VectorIndexConfig } from '../../schema-DXOd96kx.js';
1
+ import { P as PartitionConfig, a as ScoringMode, V as VectorIndexConfig } from '../../schema-B7juWg8Q.js';
2
2
  import '../../adapters-79OIa4xm.js';
3
3
 
4
4
  interface IndexMetadata {
5
5
  indexName: string;
6
+ /** Number of documents represented by the last completed checkpoint. */
7
+ documentCount?: number;
6
8
  /** The identity a cluster gave the index at creation; absent on a single engine. */
7
9
  indexUuid?: string;
8
10
  /** The partitions this copy holds, which a cluster node answers a partition-stores request from. */
@@ -1,7 +1,7 @@
1
- import { createDurableDirectory, writeSegmentedCheckpoint } from '../../chunk-KEDL6FFZ.mjs';
1
+ import { createDurableDirectory, writeSegmentedCheckpoint } from '../../chunk-WASNWIEK.mjs';
2
2
  import '../../chunk-JQUL2T6I.mjs';
3
- import '../../chunk-O4Q5JYNK.mjs';
4
- import '../../chunk-YGQMKTKG.mjs';
3
+ import '../../chunk-XWICBGYT.mjs';
4
+ import '../../chunk-XNCJFU2E.mjs';
5
5
  import '../../chunk-TGP5M5R7.mjs';
6
6
  import '../../chunk-OBXS7OZM.mjs';
7
7
  import '../../chunk-WDL632CN.mjs';
@@ -9,7 +9,7 @@ import '../../chunk-KMMJMDUA.mjs';
9
9
  import '../../chunk-U2BKYEC7.mjs';
10
10
  import '../../chunk-BFIH7OV5.mjs';
11
11
  import '../../chunk-WTONLDU3.mjs';
12
- import '../../chunk-TLRUUMVE.mjs';
12
+ import '../../chunk-P4ELXVJQ.mjs';
13
13
 
14
14
  // src/persistence/durability/rebuild.ts
15
15
  async function rebuildSnapshotFromDurable(root, metadata, targets, compactionThreshold) {
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-BGouJxH4.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-BGouJxH4.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 './search-DDHjfXhJ.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-DDHjfXhJ.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-B5uO5jL1.js';
7
- import { A as AnyDocument } from './schema-DXOd96kx.js';
6
+ import { N as NarsilClient, I as ImportSource } from './client-C5BkUqB8.js';
7
+ import { A as AnyDocument } from './schema-B7juWg8Q.js';
8
8
  import './adapters-79OIa4xm.js';
9
9
 
10
10
  /**
package/dist/react.mjs CHANGED
@@ -12,6 +12,7 @@ var ErrorCodes = {
12
12
  INDEX_NOT_FOUND: "INDEX_NOT_FOUND",
13
13
  INDEX_ALREADY_EXISTS: "INDEX_ALREADY_EXISTS",
14
14
  INDEX_ORPHANED: "INDEX_ORPHANED",
15
+ INDEX_REOPEN_CAPACITY_EXHAUSTED: "INDEX_REOPEN_CAPACITY_EXHAUSTED",
15
16
  PARTITION_CORRUPTED: "PARTITION_CORRUPTED",
16
17
  PARTITION_REBALANCING_BACKPRESSURE: "PARTITION_REBALANCING_BACKPRESSURE",
17
18
  WORKER_CRASHED: "WORKER_CRASHED",
@@ -231,4 +231,4 @@ interface InsertOptions {
231
231
  skipClone?: boolean;
232
232
  }
233
233
 
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, InsertOptions as a, ScoringMode as b, StopWordOverride as c, VectorQuantizationMode as d };
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 };
@@ -1,4 +1,4 @@
1
- import { A as AnyDocument, S as SchemaDefinition, b as ScoringMode } from './schema-DXOd96kx.js';
1
+ import { A as AnyDocument, S as SchemaDefinition, a as ScoringMode } from './schema-B7juWg8Q.js';
2
2
 
3
3
  /**
4
4
  * Every code a {@link NarsilError} carries, grouped by the part of the engine
@@ -21,6 +21,7 @@ declare const ErrorCodes: {
21
21
  readonly INDEX_NOT_FOUND: "INDEX_NOT_FOUND";
22
22
  readonly INDEX_ALREADY_EXISTS: "INDEX_ALREADY_EXISTS";
23
23
  readonly INDEX_ORPHANED: "INDEX_ORPHANED";
24
+ readonly INDEX_REOPEN_CAPACITY_EXHAUSTED: "INDEX_REOPEN_CAPACITY_EXHAUSTED";
24
25
  readonly PARTITION_CORRUPTED: "PARTITION_CORRUPTED";
25
26
  readonly PARTITION_REBALANCING_BACKPRESSURE: "PARTITION_REBALANCING_BACKPRESSURE";
26
27
  readonly WORKER_CRASHED: "WORKER_CRASHED";
@@ -371,7 +372,7 @@ interface BatchResult {
371
372
  * @public
372
373
  */
373
374
  interface IndexStats {
374
- /** The index holds this many documents. */
375
+ /** The index holds this many documents. A closed index reports its count as of the last checkpoint. */
375
376
  documentCount: number;
376
377
  /** The index is spread across this many partitions. */
377
378
  partitionCount: number;
@@ -398,7 +399,7 @@ interface IndexStats {
398
399
  interface IndexInfo {
399
400
  /** The index was created under this name. */
400
401
  name: string;
401
- /** The index holds this many documents. */
402
+ /** The index holds this many documents. A closed index reports its count as of the last checkpoint. */
402
403
  documentCount: number;
403
404
  /** The index is spread across this many partitions. */
404
405
  partitionCount: number;
@@ -406,6 +407,10 @@ interface IndexInfo {
406
407
  language: string;
407
408
  /** This turns true when the index's terms came from an older analysis than its language module produces now. */
408
409
  analysisStale?: boolean;
410
+ /** This is `open` in memory, `closed` after release, and `reopen-failed` after five recovery failures. */
411
+ state: 'open' | 'closed' | 'reopen-failed';
412
+ /** This counts successful loads since this engine started. */
413
+ reopenCount: number;
409
414
  }
410
415
  /**
411
416
  * What {@link Narsil.getPartitionStats} reports for one partition, which is
@@ -484,6 +489,12 @@ interface MemoryStats {
484
489
  * `process.heapUsed` cannot tell engines apart.
485
490
  */
486
491
  estimatedIndexBytes: number;
492
+ /** This many indexes currently occupy engine memory. */
493
+ openIndexCount: number;
494
+ /** This many indexes remain registered without occupying engine memory, including parked recovery failures. */
495
+ closedIndexCount: number;
496
+ /** This counts successful index loads since this engine started. */
497
+ reopenCount: number;
487
498
  /**
488
499
  * Per-worker V8 heap usage when the engine has been promoted to a worker
489
500
  * pool. Empty when no workers are active.
package/dist/server.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { b as ServerOptions, N as NarsilServer } from './options-BakECW-r.js';
2
- export { A as ASYNC_IMPORT_CAPABILITY, C as CorsOptions, E as ErrorEnvelope, 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-BakECW-r.js';
3
- import { a as Narsil } from './engine-CjLhdDIm.js';
1
+ import { b as ServerOptions, N as NarsilServer } from './options-BC68VPoE.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-BC68VPoE.js';
3
+ import { a as Narsil } from './engine-Cjr1uBLa.js';
4
4
  import { h as TaskStore, e as TaskRecord, d as TaskProgress, b as ImportResult } 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-BGouJxH4.js';
7
- import './config-NgUCkc6a.js';
8
- import './config-B09-cud9.js';
6
+ export { d as ServerErrorCodes } from './search-DDHjfXhJ.js';
7
+ import './config-B-ZI-ft5.js';
8
+ import './config-BZRExglL.js';
9
9
  import './adapters-79OIa4xm.js';
10
- import './schema-DXOd96kx.js';
11
- import './types-BTE33VZS.js';
10
+ import './schema-B7juWg8Q.js';
11
+ import './types-DsSSjY4d.js';
12
12
  import './types-D5OwhtsQ.js';
13
13
 
14
14
  /**
package/dist/server.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { validateIndexName } from './chunk-O4Q5JYNK.mjs';
2
- import { ServerErrorCodes, NarsilError, ErrorCodes } from './chunk-TLRUUMVE.mjs';
3
- export { ServerErrorCodes } from './chunk-TLRUUMVE.mjs';
1
+ import { validateIndexName } from './chunk-XWICBGYT.mjs';
2
+ import { ServerErrorCodes, NarsilError, ErrorCodes } from './chunk-P4ELXVJQ.mjs';
3
+ export { ServerErrorCodes } from './chunk-P4ELXVJQ.mjs';
4
4
  import { randomUUID } from 'crypto';
5
5
 
6
6
  // src/server/capabilities.ts
@@ -8,11 +8,13 @@ var ASYNC_IMPORT_CAPABILITY = "documents.import.async";
8
8
  var TASK_CANCEL_CAPABILITY = "tasks.cancel";
9
9
  var TASK_FILTER_CAPABILITY = "tasks.filter";
10
10
  var REBUILD_ANALYSIS_CAPABILITY = "indexes.rebuildAnalysis";
11
+ var INDEX_LIFECYCLE_CAPABILITY = "indexes.lifecycle";
11
12
  var SERVER_CAPABILITIES = [
12
13
  ASYNC_IMPORT_CAPABILITY,
13
14
  TASK_CANCEL_CAPABILITY,
14
15
  TASK_FILTER_CAPABILITY,
15
- REBUILD_ANALYSIS_CAPABILITY
16
+ REBUILD_ANALYSIS_CAPABILITY,
17
+ INDEX_LIFECYCLE_CAPABILITY
16
18
  ];
17
19
 
18
20
  // src/server/cors.ts
@@ -79,6 +81,7 @@ var STATUS_BY_CODE = {
79
81
  DOC_NOT_FOUND: 404,
80
82
  INDEX_ALREADY_EXISTS: 409,
81
83
  INDEX_ORPHANED: 409,
84
+ INDEX_REOPEN_CAPACITY_EXHAUSTED: 503,
82
85
  DOC_ALREADY_EXISTS: 409,
83
86
  PARTITION_REBALANCING_BACKPRESSURE: 409,
84
87
  PARTITION_CAPACITY_EXCEEDED: 409,
@@ -1148,7 +1151,23 @@ function createIndexHandlers(deps) {
1148
1151
  respondError(ctx, err);
1149
1152
  }
1150
1153
  }
1151
- return { create, list, drop, stats, partitions, clear };
1154
+ async function open(ctx) {
1155
+ try {
1156
+ await engine.open(ctx.params[0]);
1157
+ respondJson(ctx, { name: ctx.params[0], state: "open" });
1158
+ } catch (err) {
1159
+ respondError(ctx, err);
1160
+ }
1161
+ }
1162
+ async function close(ctx) {
1163
+ try {
1164
+ await engine.close(ctx.params[0]);
1165
+ respondJson(ctx, { name: ctx.params[0], state: "closed" });
1166
+ } catch (err) {
1167
+ respondError(ctx, err);
1168
+ }
1169
+ }
1170
+ return { create, list, drop, stats, partitions, clear, open, close };
1152
1171
  }
1153
1172
 
1154
1173
  // src/server/handlers/search.ts
@@ -1742,6 +1761,8 @@ var NarsilHttpServer = class {
1742
1761
  app.get("/indexes/:name/partitions", json(idx.partitions, { paramCount: 1, maxBytes: 0 }));
1743
1762
  app.get("/indexes/:name/cluster", json(cluster.allocation, { paramCount: 1, maxBytes: 0 }));
1744
1763
  app.post("/indexes/:name/_clear", json(idx.clear, { paramCount: 1, maxBytes: 0 }));
1764
+ app.post("/indexes/:name/_open", json(idx.open, { paramCount: 1, maxBytes: 0 }));
1765
+ app.post("/indexes/:name/_close", json(idx.close, { paramCount: 1, maxBytes: 0 }));
1745
1766
  app.get("/indexes/:name/count", json(doc.count, { paramCount: 1, maxBytes: 0 }));
1746
1767
  app.post("/indexes/:name/documents", json(doc.insert, { paramCount: 1, needsBody: true, maxBytes: maxBodyBytes }));
1747
1768
  app.post(
@@ -1807,4 +1828,4 @@ function createServer(engine, options) {
1807
1828
  return new NarsilHttpServer(engine, options);
1808
1829
  }
1809
1830
 
1810
- export { ASYNC_IMPORT_CAPABILITY, InMemoryTaskStore, REBUILD_ANALYSIS_CAPABILITY, SERVER_CAPABILITIES, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, createServer, httpStatusForNarsilError };
1831
+ export { ASYNC_IMPORT_CAPABILITY, INDEX_LIFECYCLE_CAPABILITY, InMemoryTaskStore, REBUILD_ANALYSIS_CAPABILITY, SERVER_CAPABILITIES, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, createServer, httpStatusForNarsilError };
@@ -1,4 +1,4 @@
1
- import { S as SchemaDefinition } from './schema-DXOd96kx.js';
1
+ import { S as SchemaDefinition } from './schema-B7juWg8Q.js';
2
2
 
3
3
  /**
4
4
  * What a node does in a cluster. A node may hold several roles at once.
@@ -1,5 +1,5 @@
1
1
  import { isValidWorkerAction } from '../chunk-WTONLDU3.mjs';
2
- import { NarsilError, ErrorCodes } from '../chunk-TLRUUMVE.mjs';
2
+ import { NarsilError, ErrorCodes } from '../chunk-P4ELXVJQ.mjs';
3
3
 
4
4
  // src/workers/action-handler.ts
5
5
  function buildErrorResponse(requestId, code, message) {
@@ -55,7 +55,7 @@ async function setup() {
55
55
  } catch {
56
56
  parentPort = null;
57
57
  }
58
- const { createDirectExecutor } = await import('../direct-executor-7O23GEHE.mjs');
58
+ const { createDirectExecutor } = await import('../direct-executor-IMXNRS7O.mjs');
59
59
  const handleAction = createActionHandler(createDirectExecutor());
60
60
  if (parentPort) {
61
61
  const port = parentPort;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delali/narsil",
3
- "version": "0.2.4-next.43",
3
+ "version": "0.2.4-next.45",
4
4
  "type": "module",
5
5
  "description": "A distributed full-text search engine with cross-language portable binary format.",
6
6
  "author": "Delali (https://sondelali.com)",