@delali/narsil 0.2.4-next.42 → 0.2.4-next.44
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.
- package/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/{chunk-GB2IIJJG.mjs → chunk-P4ELXVJQ.mjs} +2 -4
- package/dist/{chunk-MMSWEEZT.mjs → chunk-WASNWIEK.mjs} +1452 -373
- package/dist/{chunk-GRWFY2HI.mjs → chunk-XNCJFU2E.mjs} +239 -61
- package/dist/{chunk-WU2UZEVD.mjs → chunk-XWICBGYT.mjs} +1 -1
- package/dist/{client-BobVnoIK.d.ts → client-C5BkUqB8.d.ts} +26 -3
- package/dist/client.d.ts +8 -8
- package/dist/client.mjs +12 -6
- package/dist/{config-fLC4lbmg.d.ts → config-B-ZI-ft5.d.ts} +2 -2
- package/dist/{config-Byyl1QqH.d.ts → config-BZRExglL.d.ts} +20 -3
- package/dist/{direct-executor-MSJEVPZU.mjs → direct-executor-IMXNRS7O.mjs} +2 -2
- package/dist/distribution/coordinator/etcd.d.ts +2 -2
- package/dist/distribution/coordinator/etcd.mjs +1 -1
- package/dist/distribution/coordinator/in-memory.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +1 -1
- package/dist/distribution.d.ts +24 -10
- package/dist/distribution.mjs +1721 -1129
- package/dist/embeddings/openai.mjs +1 -1
- package/dist/{engine-BE45D5ZG.d.ts → engine-Cjr1uBLa.d.ts} +47 -24
- package/dist/index.browser.mjs +1668 -416
- package/dist/index.d.ts +9 -9
- package/dist/index.mjs +4 -4
- package/dist/{options-EXYFcem-.d.ts → options-BC68VPoE.d.ts} +10 -3
- package/dist/persistence/durability/checkpoint-worker.d.ts +3 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +4 -4
- package/dist/react.d.ts +6 -6
- package/dist/react.mjs +2 -4
- package/dist/{schema-ZRbk8BgH.d.ts → schema-B7juWg8Q.d.ts} +17 -6
- package/dist/{search-DHuXwJYk.d.ts → search-DDHjfXhJ.d.ts} +35 -11
- package/dist/server.d.ts +10 -10
- package/dist/server.mjs +30 -12
- package/dist/{tasks-CnMLpfk-.d.ts → tasks-Bn4R1NPN.d.ts} +1 -1
- package/dist/{types-B5Tsaalz.d.ts → types-DsSSjY4d.d.ts} +1 -1
- package/dist/workers/entry.mjs +2 -2
- package/package.json +1 -1
package/dist/client.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// src/errors.ts
|
|
2
2
|
var ErrorCodes = {
|
|
3
3
|
SCHEMA_INVALID_TYPE: "SCHEMA_INVALID_TYPE",
|
|
4
|
-
SCHEMA_MISSING_FIELD: "SCHEMA_MISSING_FIELD",
|
|
5
4
|
SCHEMA_DEPTH_EXCEEDED: "SCHEMA_DEPTH_EXCEEDED",
|
|
6
5
|
SCHEMA_INVALID_VECTOR_DIMENSION: "SCHEMA_INVALID_VECTOR_DIMENSION",
|
|
7
6
|
SCHEMA_INVALID_GEOPOINT: "SCHEMA_INVALID_GEOPOINT",
|
|
@@ -11,6 +10,7 @@ var ErrorCodes = {
|
|
|
11
10
|
INDEX_NOT_FOUND: "INDEX_NOT_FOUND",
|
|
12
11
|
INDEX_ALREADY_EXISTS: "INDEX_ALREADY_EXISTS",
|
|
13
12
|
INDEX_ORPHANED: "INDEX_ORPHANED",
|
|
13
|
+
INDEX_REOPEN_CAPACITY_EXHAUSTED: "INDEX_REOPEN_CAPACITY_EXHAUSTED",
|
|
14
14
|
PARTITION_CORRUPTED: "PARTITION_CORRUPTED",
|
|
15
15
|
PARTITION_REBALANCING_BACKPRESSURE: "PARTITION_REBALANCING_BACKPRESSURE",
|
|
16
16
|
WORKER_CRASHED: "WORKER_CRASHED",
|
|
@@ -23,7 +23,6 @@ var ErrorCodes = {
|
|
|
23
23
|
PERSISTENCE_WAL_CORRUPT: "PERSISTENCE_WAL_CORRUPT",
|
|
24
24
|
PERSISTENCE_FSYNC_FAILED: "PERSISTENCE_FSYNC_FAILED",
|
|
25
25
|
SEARCH_INVALID_FIELD: "SEARCH_INVALID_FIELD",
|
|
26
|
-
SEARCH_INVALID_VECTOR_SIZE: "SEARCH_INVALID_VECTOR_SIZE",
|
|
27
26
|
VECTOR_DIMENSION_MISMATCH: "VECTOR_DIMENSION_MISMATCH",
|
|
28
27
|
SEARCH_INVALID_FILTER: "SEARCH_INVALID_FILTER",
|
|
29
28
|
SEARCH_INVALID_MODE: "SEARCH_INVALID_MODE",
|
|
@@ -47,8 +46,6 @@ var ErrorCodes = {
|
|
|
47
46
|
ALLOCATION_NO_DATA_NODES: "ALLOCATION_NO_DATA_NODES",
|
|
48
47
|
ALLOCATION_INVALID_CONFIG: "ALLOCATION_INVALID_CONFIG",
|
|
49
48
|
ALLOCATION_FAILED: "ALLOCATION_FAILED",
|
|
50
|
-
CONTROLLER_LEASE_LOST: "CONTROLLER_LEASE_LOST",
|
|
51
|
-
CONTROLLER_NOT_ACTIVE: "CONTROLLER_NOT_ACTIVE",
|
|
52
49
|
CONTROLLER_METADATA_INVALID: "CONTROLLER_METADATA_INVALID",
|
|
53
50
|
NODE_BOOTSTRAP_FAILED: "NODE_BOOTSTRAP_FAILED",
|
|
54
51
|
NODE_ALREADY_JOINED: "NODE_ALREADY_JOINED",
|
|
@@ -104,6 +101,7 @@ var ServerErrorCodes = {
|
|
|
104
101
|
TASK_NOT_FOUND: "TASK_NOT_FOUND",
|
|
105
102
|
TASK_NOT_CANCELLABLE: "TASK_NOT_CANCELLABLE",
|
|
106
103
|
TASK_OWNED_BY_ANOTHER_INSTANCE: "TASK_OWNED_BY_ANOTHER_INSTANCE",
|
|
104
|
+
TASK_INTERRUPTED: "TASK_INTERRUPTED",
|
|
107
105
|
TOO_MANY_REQUESTS: "TOO_MANY_REQUESTS",
|
|
108
106
|
HOOK_ERROR: "HOOK_ERROR",
|
|
109
107
|
INTERNAL_ERROR: "INTERNAL_ERROR"
|
|
@@ -148,11 +146,13 @@ var ASYNC_IMPORT_CAPABILITY = "documents.import.async";
|
|
|
148
146
|
var TASK_CANCEL_CAPABILITY = "tasks.cancel";
|
|
149
147
|
var TASK_FILTER_CAPABILITY = "tasks.filter";
|
|
150
148
|
var REBUILD_ANALYSIS_CAPABILITY = "indexes.rebuildAnalysis";
|
|
149
|
+
var INDEX_LIFECYCLE_CAPABILITY = "indexes.lifecycle";
|
|
151
150
|
var SERVER_CAPABILITIES = [
|
|
152
151
|
ASYNC_IMPORT_CAPABILITY,
|
|
153
152
|
TASK_CANCEL_CAPABILITY,
|
|
154
153
|
TASK_FILTER_CAPABILITY,
|
|
155
|
-
REBUILD_ANALYSIS_CAPABILITY
|
|
154
|
+
REBUILD_ANALYSIS_CAPABILITY,
|
|
155
|
+
INDEX_LIFECYCLE_CAPABILITY
|
|
156
156
|
];
|
|
157
157
|
|
|
158
158
|
// src/json-encoding.ts
|
|
@@ -672,6 +672,12 @@ function createIndexOperations(transport) {
|
|
|
672
672
|
},
|
|
673
673
|
async clear(indexName, options) {
|
|
674
674
|
await transport.json({ method: "POST", path: `${indexPath(indexName)}/_clear`, options });
|
|
675
|
+
},
|
|
676
|
+
async open(indexName, options) {
|
|
677
|
+
await transport.json({ method: "POST", path: `${indexPath(indexName)}/_open`, options });
|
|
678
|
+
},
|
|
679
|
+
async close(indexName, options) {
|
|
680
|
+
await transport.json({ method: "POST", path: `${indexPath(indexName)}/_close`, options });
|
|
675
681
|
}
|
|
676
682
|
};
|
|
677
683
|
}
|
|
@@ -842,4 +848,4 @@ function createNarsilClient(options) {
|
|
|
842
848
|
};
|
|
843
849
|
}
|
|
844
850
|
|
|
845
|
-
export { ASYNC_IMPORT_CAPABILITY, ClientErrorCodes, ErrorCodes, NarsilError, REBUILD_ANALYSIS_CAPABILITY, SERVER_CAPABILITIES, ServerErrorCodes, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, createNarsilClient };
|
|
851
|
+
export { ASYNC_IMPORT_CAPABILITY, ClientErrorCodes, ErrorCodes, INDEX_LIFECYCLE_CAPABILITY, NarsilError, REBUILD_ANALYSIS_CAPABILITY, SERVER_CAPABILITIES, ServerErrorCodes, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, createNarsilClient };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NarsilConfig } from './config-
|
|
2
|
-
import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './types-
|
|
1
|
+
import { N as NarsilConfig } from './config-BZRExglL.js';
|
|
2
|
+
import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './types-DsSSjY4d.js';
|
|
3
3
|
import { N as NodeTransport } from './types-D5OwhtsQ.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { P as PersistenceAdapter, I as InvalidationAdapter, E as EmbeddingAdapter } from './adapters-79OIa4xm.js';
|
|
2
|
-
import { Q as QueryParams, e as QueryResult } from './search-
|
|
3
|
-
import { I as IndexConfig, A as AnyDocument } from './schema-
|
|
2
|
+
import { Q as QueryParams, e as QueryResult } from './search-DDHjfXhJ.js';
|
|
3
|
+
import { I as IndexConfig, A as AnyDocument } from './schema-B7juWg8Q.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Hooks that run alongside the engine's own work, which is how you add
|
|
@@ -158,6 +158,23 @@ interface NarsilConfig {
|
|
|
158
158
|
durability?: DurabilityConfig;
|
|
159
159
|
/** These settings control what the engine does when an index's stored analysis differs from its language module. */
|
|
160
160
|
analysis?: AnalysisConfig;
|
|
161
|
+
/** These limits close indexes while keeping their durable files ready to reopen. */
|
|
162
|
+
lifecycle?: IndexLifecycleConfig;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Limits on the indexes one engine keeps open in memory.
|
|
166
|
+
*
|
|
167
|
+
* @public
|
|
168
|
+
*/
|
|
169
|
+
interface IndexLifecycleConfig {
|
|
170
|
+
/** An index closes after this many milliseconds without activity. */
|
|
171
|
+
idleTimeoutMs?: number;
|
|
172
|
+
/** The engine keeps at most this many indexes open at once. */
|
|
173
|
+
maxOpenIndexes?: number;
|
|
174
|
+
/** Open indexes may use at most this many estimated bytes in total. */
|
|
175
|
+
maxOpenBytes?: number;
|
|
176
|
+
/** At most this many callers may wait behind one index reopen. */
|
|
177
|
+
maxReopenWaiters?: number;
|
|
161
178
|
}
|
|
162
179
|
/**
|
|
163
180
|
* Describes an index whose stored terms came from an older analysis than the
|
|
@@ -253,4 +270,4 @@ interface WorkerConfig {
|
|
|
253
270
|
bootstrapModule?: string;
|
|
254
271
|
}
|
|
255
272
|
|
|
256
|
-
export type { AnalysisConfig as A, DurabilityConfig as D, IndexContext as I, NarsilConfig as N, PartitionContext as P, RemoveContext as R, SearchContext as S, UpdateContext as U, WorkerConfig as W,
|
|
273
|
+
export type { AnalysisConfig as A, DurabilityConfig as D, IndexContext as I, NarsilConfig as N, PartitionContext as P, RemoveContext as R, SearchContext as S, UpdateContext as U, WorkerConfig as W, IndexLifecycleConfig as a, InsertContext as b, NarsilPlugin as c, StaleAnalysis as d, WorkerContext as e };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { createDirectExecutor } from './chunk-
|
|
1
|
+
export { createDirectExecutor } from './chunk-XNCJFU2E.mjs';
|
|
2
2
|
import './chunk-TGP5M5R7.mjs';
|
|
3
3
|
import './chunk-OBXS7OZM.mjs';
|
|
4
4
|
import './chunk-WDL632CN.mjs';
|
|
5
5
|
import './chunk-U2BKYEC7.mjs';
|
|
6
6
|
import './chunk-BFIH7OV5.mjs';
|
|
7
7
|
import './chunk-WTONLDU3.mjs';
|
|
8
|
-
import './chunk-
|
|
8
|
+
import './chunk-P4ELXVJQ.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { compareCodePoints } from '../../chunk-BFIH7OV5.mjs';
|
|
2
|
-
import { NarsilError, ErrorCodes } from '../../chunk-
|
|
2
|
+
import { NarsilError, ErrorCodes } from '../../chunk-P4ELXVJQ.mjs';
|
|
3
3
|
import { decode, encode } from '@msgpack/msgpack';
|
|
4
4
|
|
|
5
5
|
// src/distribution/coordinator/etcd/types.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { decodeTransportMessage, encodeTransportMessage } from '../../chunk-PM52SMBT.mjs';
|
|
2
2
|
import { TransportError, TransportErrorCodes, MAX_MESSAGE_SIZE_BYTES } from '../../chunk-JQUL2T6I.mjs';
|
|
3
|
-
import { NarsilError, ErrorCodes } from '../../chunk-
|
|
3
|
+
import { NarsilError, ErrorCodes } from '../../chunk-P4ELXVJQ.mjs';
|
|
4
4
|
|
|
5
5
|
// src/distribution/transport/grpc/codec.ts
|
|
6
6
|
var FIELD_ONE_LENGTH_DELIMITED_KEY = 10;
|
package/dist/distribution.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-
|
|
2
|
-
export { c as ClusterControllerConfig, d as ClusterNodeInfo, e as ClusterQueryConfig, N as NodeReadiness, R as ReplicationConfig } from './config-
|
|
3
|
-
import { N as NarsilEventMap, a as Narsil } from './engine-
|
|
4
|
-
import { B as BatchResult, L as ListParams, g as ListResult, i as SuggestParams, j as SuggestResult, Q as QueryParams, h as PreflightResult, f as IndexStats, P as PartitionStatsResult, M as MemoryStats, e as QueryResult } from './search-
|
|
5
|
-
import { I as IndexConfig, A as AnyDocument,
|
|
6
|
-
import { b as NodeCapacity, N as NodeRole } from './types-
|
|
7
|
-
export { c as AllocationConstraints, d as AllocationEvent, A as AllocationTable, C as ClusterCoordinator, e as NodeEvent, a as NodeRegistration, P as PartitionAssignment, f as PartitionState, S as SchemaEvent, U as UnassignedReason } from './types-
|
|
1
|
+
import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-B-ZI-ft5.js';
|
|
2
|
+
export { c as ClusterControllerConfig, d as ClusterNodeInfo, e as ClusterQueryConfig, N as NodeReadiness, R as ReplicationConfig } from './config-B-ZI-ft5.js';
|
|
3
|
+
import { N as NarsilEventMap, a as Narsil } from './engine-Cjr1uBLa.js';
|
|
4
|
+
import { B as BatchResult, L as ListParams, g as ListResult, i as SuggestParams, j as SuggestResult, Q as QueryParams, h as PreflightResult, f as IndexStats, P as PartitionStatsResult, M as MemoryStats, e as QueryResult } from './search-DDHjfXhJ.js';
|
|
5
|
+
import { I as IndexConfig, A as AnyDocument, b as InsertOptions } from './schema-B7juWg8Q.js';
|
|
6
|
+
import { b as NodeCapacity, N as NodeRole } from './types-DsSSjY4d.js';
|
|
7
|
+
export { c as AllocationConstraints, d as AllocationEvent, A as AllocationTable, C as ClusterCoordinator, e as NodeEvent, a as NodeRegistration, P as PartitionAssignment, f as PartitionState, S as SchemaEvent, U as UnassignedReason } from './types-DsSSjY4d.js';
|
|
8
8
|
export { L as ListenHandler, N as NodeTransport, R as RespondFn, T as TransportConfig, a as TransportMessage } from './types-D5OwhtsQ.js';
|
|
9
|
-
import './config-
|
|
9
|
+
import './config-BZRExglL.js';
|
|
10
10
|
import './adapters-79OIa4xm.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -48,6 +48,20 @@ interface ClusterNode {
|
|
|
48
48
|
readonly nodeId: string;
|
|
49
49
|
/** The node holds these roles in the cluster. */
|
|
50
50
|
readonly roles: ReadonlyArray<NodeRole>;
|
|
51
|
+
/**
|
|
52
|
+
* Loads this node's local copy of an index from durable storage.
|
|
53
|
+
*
|
|
54
|
+
* @param indexName - The index to load on this node.
|
|
55
|
+
* @returns A promise that settles when the local copy is ready for operations.
|
|
56
|
+
*/
|
|
57
|
+
open(indexName: string): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Checkpoints and releases this node's local copy of an index.
|
|
60
|
+
*
|
|
61
|
+
* @param indexName - The index to close on this node.
|
|
62
|
+
* @returns A promise that settles after the local copy releases its memory.
|
|
63
|
+
*/
|
|
64
|
+
close(indexName: string): Promise<void>;
|
|
51
65
|
/**
|
|
52
66
|
* Creates an index across the cluster, publishing its schema and allocating
|
|
53
67
|
* its partitions to nodes.
|
|
@@ -325,8 +339,8 @@ interface ClusterEngineOptions {
|
|
|
325
339
|
*
|
|
326
340
|
* Writes, updates, searches, suggestions, listings, counts, index creation,
|
|
327
341
|
* index removal, and document reads route through the cluster. Checkpointing,
|
|
328
|
-
* memory statistics, and engine events reach this
|
|
329
|
-
* each covers a per-node fact. Every other operation fails with
|
|
342
|
+
* memory statistics, index opens, index closes, and engine events reach this
|
|
343
|
+
* node's local engine, because each covers a per-node fact. Every other operation fails with
|
|
330
344
|
* `CLUSTER_OPERATION_UNSUPPORTED`, which the HTTP server answers with status
|
|
331
345
|
* 501, so a caller learns the operation is missing rather than reading a
|
|
332
346
|
* wrong answer. That covers `getStats`, `getPartitionStats`, and
|