@delali/narsil 0.3.0 → 0.3.1-next.102
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/README.md +9 -8
- package/dist/adapters/filesystem.d.ts +1 -1
- package/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.d.ts +1 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/memory.d.ts +1 -1
- package/dist/{adapters-79OIa4xm.d.ts → adapters-BQFQ4PRz.d.ts} +27 -1
- package/dist/browser/chunk-BDOSMEEP.mjs +493 -0
- package/dist/browser/chunk-EJDUFWSO.mjs +602 -0
- package/dist/browser/chunk-HOZW3PKP.mjs +9 -0
- package/dist/browser/chunk-JOVZ6HMT.mjs +4358 -0
- package/dist/browser/chunk-JPTQZWJQ.mjs +10 -0
- package/dist/browser/chunk-KPJMDPHG.mjs +24558 -0
- package/dist/browser/chunk-PGIM3HIM.mjs +2743 -0
- package/dist/browser/chunk-RHG4O77A.mjs +206 -0
- package/dist/browser/chunk-RIJSLY2I.mjs +360 -0
- package/dist/browser/durability-wiring-SRUYT3VV.mjs +3875 -0
- package/dist/browser/module-CBB2ETYP.mjs +3111 -0
- package/dist/browser/release-76MXRPGV.mjs +33 -0
- package/dist/browser/replace-RURXTGVG.mjs +57 -0
- package/dist/browser/restore-queue-EEZQO6RF.mjs +35 -0
- package/dist/browser/runtime-7ZAHCHWR.mjs +557 -0
- package/dist/browser/snapshot-OAAA5UJ7.mjs +1210 -0
- package/dist/browser/write-7D6VIK6O.mjs +208 -0
- package/dist/{capabilities-DSsOGz6F.d.ts → capabilities-ByQRMOx-.d.ts} +68 -7
- package/dist/chunk-2RIRGOUL.mjs +113 -0
- package/dist/chunk-37CD3OKS.mjs +87 -0
- package/dist/chunk-44W3CBNG.mjs +7 -0
- package/dist/chunk-46D6JQIG.mjs +426 -0
- package/dist/{chunk-VMRR3DQU.mjs → chunk-5JNA5SKS.mjs} +546 -35
- package/dist/chunk-747OHOUA.mjs +11 -0
- package/dist/chunk-75XIEF6H.mjs +126 -0
- package/dist/chunk-7X5JST5L.mjs +114 -0
- package/dist/chunk-BOFBLJFZ.mjs +209 -0
- package/dist/{chunk-USKFU7J5.mjs → chunk-BWJVNZPR.mjs} +8 -1
- package/dist/chunk-C7SLA6CM.mjs +19 -0
- package/dist/{chunk-POWOTUKJ.mjs → chunk-CQUMNIIG.mjs} +3 -6
- package/dist/chunk-CVXLLEQ3.mjs +1011 -0
- package/dist/chunk-DJHHF2L5.mjs +17 -0
- package/dist/chunk-E74YLAIG.mjs +24 -0
- package/dist/{chunk-UXNWQZST.mjs → chunk-EMRMGYRE.mjs} +236 -18
- package/dist/chunk-EWZLIYHV.mjs +57 -0
- package/dist/chunk-GBEEG5AN.mjs +35 -0
- package/dist/chunk-GES7U2PM.mjs +68 -0
- package/dist/chunk-HJSN7UYG.mjs +10 -0
- package/dist/chunk-HLPRHOSO.mjs +17 -0
- package/dist/chunk-HMFNFVP7.mjs +14 -0
- package/dist/chunk-J5QP52HA.mjs +1751 -0
- package/dist/{chunk-YNVIUGF5.mjs → chunk-JZVARCRZ.mjs} +3 -28
- package/dist/chunk-KOKM4PQN.mjs +52 -0
- package/dist/{chunk-B2TFROFX.mjs → chunk-KWTW6VTG.mjs} +465 -250
- package/dist/chunk-KZ3NX2P7.mjs +21 -0
- package/dist/chunk-L5ORED7V.mjs +25 -0
- package/dist/{chunk-THYRHHO2.mjs → chunk-LGAMKHA2.mjs} +2009 -2351
- package/dist/chunk-LKOB5COA.mjs +117 -0
- package/dist/chunk-LPQOEU5M.mjs +96 -0
- package/dist/{chunk-3LHGNRYE.mjs → chunk-LXWDQLTW.mjs} +7 -2
- package/dist/{chunk-L6TNPLAR.mjs → chunk-OEYI3KRB.mjs} +270 -108
- package/dist/chunk-OM362BRO.mjs +948 -0
- package/dist/chunk-OZDFA4WC.mjs +67 -0
- package/dist/chunk-P36MUFEJ.mjs +10 -0
- package/dist/chunk-PC2G76VW.mjs +2540 -0
- package/dist/{chunk-GCM3JFVA.mjs → chunk-PNEYIHA4.mjs} +11 -2
- package/dist/chunk-PNFKUCG3.mjs +1130 -0
- package/dist/chunk-Q6XWVUZX.mjs +44 -0
- package/dist/chunk-R27EMH5M.mjs +617 -0
- package/dist/{chunk-YMZCMH5M.mjs → chunk-R6A773WK.mjs} +19 -24
- package/dist/chunk-RF7PLG43.mjs +106 -0
- package/dist/chunk-RFBLQLLZ.mjs +16 -0
- package/dist/{chunk-Y3L5MDRV.mjs → chunk-RFVUDM5E.mjs} +17 -2
- package/dist/chunk-S7FL6UAH.mjs +521 -0
- package/dist/chunk-S7GNDRPS.mjs +651 -0
- package/dist/chunk-SP3NM3ZG.mjs +3537 -0
- package/dist/chunk-U476IXKQ.mjs +10 -0
- package/dist/chunk-UA3AUGNV.mjs +462 -0
- package/dist/chunk-UTG5YNXV.mjs +507 -0
- package/dist/chunk-VI4R6W25.mjs +8484 -0
- package/dist/chunk-WQBCBKY3.mjs +8 -0
- package/dist/{chunk-24RXHMEL.mjs → chunk-WVCOCKBU.mjs} +3794 -7570
- package/dist/chunk-X5CV2E2B.mjs +1 -0
- package/dist/chunk-XADZPPZI.mjs +614 -0
- package/dist/chunk-YEEQHT4V.mjs +212 -0
- package/dist/chunk-YTJCGKM4.mjs +56 -0
- package/dist/chunk-YYQIODMF.mjs +275 -0
- package/dist/chunk-ZI34TVOA.mjs +144 -0
- package/dist/{chunk-OOSIDHA3.mjs → chunk-ZKWYWW4Y.mjs} +1 -1
- package/dist/chunk-ZM7KU4YW.mjs +35 -0
- package/dist/{client-BQK6Tf6A.d.ts → client-BOStAkc5.d.ts} +160 -37
- package/dist/client.d.ts +11 -10
- package/dist/client.mjs +209 -45
- package/dist/{config-DmXULPa-.d.ts → config-Cjvzbs_j.d.ts} +51 -3
- package/dist/config-H6SGzbPH.d.ts +421 -0
- package/dist/direct-executor-ZD64PPEZ.mjs +24 -0
- package/dist/distribution/coordinator/etcd.d.ts +79 -18
- package/dist/distribution/coordinator/etcd.mjs +553 -109
- package/dist/distribution/coordinator/in-memory.d.ts +4 -3
- package/dist/distribution/coordinator/in-memory.mjs +22 -3
- package/dist/distribution/transport/grpc.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +79 -14
- package/dist/distribution/transport/in-memory.d.ts +2 -2
- package/dist/distribution/transport/in-memory.mjs +12 -7
- package/dist/distribution/transport/tcp.d.ts +2 -2
- package/dist/distribution/transport/tcp.mjs +50 -28
- package/dist/distribution.d.ts +144 -23
- package/dist/distribution.mjs +14479 -8173
- package/dist/durability-wiring-FEUBR5BT.mjs +3330 -0
- package/dist/embeddings/openai.d.ts +2 -2
- package/dist/embeddings/openai.mjs +22 -133
- package/dist/{engine-CIOyFozK.d.ts → engine-rC0vjjY-.d.ts} +165 -141
- package/dist/{memory-yFaVn2xZ.d.ts → events-DqOIg5xa.d.ts} +645 -136
- package/dist/{types-DAK7mnUZ.d.ts → index-Bkdt8nDw.d.ts} +182 -45
- package/dist/index.browser.mjs +4 -32180
- package/dist/index.d.ts +91 -20
- package/dist/index.mjs +33 -16
- package/dist/invalidation/broadcast-channel.d.ts +1 -1
- package/dist/invalidation/filesystem.d.ts +1 -1
- package/dist/invalidation/filesystem.mjs +2 -1
- package/dist/invalidation/noop.d.ts +1 -1
- package/dist/module-3S65MVCM.mjs +2151 -0
- package/dist/partial-words-DTIHO8G4.d.ts +19 -0
- package/dist/partial-words.d.ts +22 -0
- package/dist/partial-words.mjs +17 -0
- package/dist/pattern-Cledccbl.d.ts +18 -0
- package/dist/pattern.d.ts +22 -0
- package/dist/pattern.mjs +12 -0
- package/dist/persistence/durability/checkpoint-worker.d.ts +119 -72
- package/dist/persistence/durability/checkpoint-worker.mjs +51 -18
- package/dist/react.d.ts +279 -183
- package/dist/react.mjs +201 -48
- package/dist/release-BH3DKW3T.mjs +33 -0
- package/dist/replace-CEO5KJJ3.mjs +57 -0
- package/dist/rerank-K7C4WZFG.mjs +60 -0
- package/dist/rerankers/http.d.ts +50 -0
- package/dist/rerankers/http.mjs +104 -0
- package/dist/restore-queue-KQHA7ZV2.mjs +35 -0
- package/dist/runtime-6Y4ZYXOG.mjs +177 -0
- package/dist/{schema-d5Afu03A.d.ts → schema-4W_7tk1f.d.ts} +81 -11
- package/dist/server.d.ts +13 -12
- package/dist/server.mjs +611 -80
- package/dist/snapshot-QGZPODM5.mjs +799 -0
- package/dist/synonyms-CpOAHPa-.d.ts +52 -0
- package/dist/synonyms.d.ts +22 -0
- package/dist/synonyms.mjs +12 -0
- package/dist/{tasks-CH2Dod8w.d.ts → tasks-CwPTz-tP.d.ts} +10 -3
- package/dist/thread-N3IUGUS3.mjs +697 -0
- package/dist/{types-BQDlIvfS.d.ts → types-2qoitTXg.d.ts} +1 -1
- package/dist/{types-D5OwhtsQ.d.ts → types-Cz5okLml.d.ts} +2 -2
- package/dist/vector/search-worker.d.ts +46 -4
- package/dist/vector/search-worker.mjs +21 -11
- package/dist/workers/entry.mjs +9 -6
- package/dist/write-U5RI7MAX.mjs +241 -0
- package/package.json +55 -9
- package/dist/chunk-3L4U6EJQ.mjs +0 -49
- package/dist/chunk-IFBKLBGB.mjs +0 -7
- package/dist/chunk-ORBLD3EL.mjs +0 -6
- package/dist/chunk-U7KYW4BA.mjs +0 -135
- package/dist/chunk-ZJ4CSAB2.mjs +0 -13
- package/dist/chunk-ZNZBXMP5.mjs +0 -2117
- package/dist/chunk-ZZT3EAUC.mjs +0 -11168
- package/dist/config-BhldZgaK.d.ts +0 -194
- package/dist/direct-executor-ALAVE7FC.mjs +0 -12
- package/dist/serialization/crc32-worker.d.ts +0 -20
- package/dist/serialization/crc32-worker.mjs +0 -62
- package/dist/simd-DW5AtJ6B.d.ts +0 -41
- package/dist/thread-DYHEQRVY.mjs +0 -402
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MAX_MESSAGE_SIZE_BYTES } from './chunk-UNEEFTEU.mjs';
|
|
2
|
-
import { TransportError, TransportErrorCodes } from './chunk-
|
|
2
|
+
import { TransportError, TransportErrorCodes } from './chunk-PNEYIHA4.mjs';
|
|
3
3
|
import { encode, decode } from '@msgpack/msgpack';
|
|
4
4
|
|
|
5
5
|
// src/distribution/transport/tcp/types.ts
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { english } from './chunk-TGP5M5R7.mjs';
|
|
2
|
+
import { NarsilError, ErrorCodes } from './chunk-BWJVNZPR.mjs';
|
|
3
|
+
|
|
4
|
+
// src/languages/registry.ts
|
|
5
|
+
var languages = /* @__PURE__ */ new Map();
|
|
6
|
+
languages.set("english", english);
|
|
7
|
+
function registerLanguage(module) {
|
|
8
|
+
languages.set(module.name, module);
|
|
9
|
+
}
|
|
10
|
+
function getLanguage(name) {
|
|
11
|
+
const lang = languages.get(name);
|
|
12
|
+
if (!lang) {
|
|
13
|
+
throw new NarsilError(ErrorCodes.LANGUAGE_NOT_SUPPORTED, `Language "${name}" is not registered`, { language: name });
|
|
14
|
+
}
|
|
15
|
+
return lang;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/core/id-generator.ts
|
|
19
|
+
function generateId() {
|
|
20
|
+
const bytes = new Uint8Array(16);
|
|
21
|
+
crypto.getRandomValues(bytes);
|
|
22
|
+
const now = Date.now();
|
|
23
|
+
bytes[0] = Math.floor(now / 2 ** 40);
|
|
24
|
+
bytes[1] = Math.floor(now / 2 ** 32) % 256;
|
|
25
|
+
bytes[2] = Math.floor(now / 2 ** 24) % 256;
|
|
26
|
+
bytes[3] = Math.floor(now / 2 ** 16) % 256;
|
|
27
|
+
bytes[4] = Math.floor(now / 2 ** 8) % 256;
|
|
28
|
+
bytes[5] = now % 256;
|
|
29
|
+
bytes[6] = bytes[6] & 15 | 112;
|
|
30
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
31
|
+
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
32
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { generateId, getLanguage, registerLanguage };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { P as PartitionConfig, A as AnyDocument, a as InsertOptions, W as WriteOptions } from './schema-
|
|
2
|
-
import { V as VectorMaintenanceResult, B as BatchResult, L as ListParams, g as ListResult, I as IndexInfo,
|
|
3
|
-
import {
|
|
1
|
+
import { P as PartitionConfig, A as AnyDocument, a as InsertOptions, W as WriteOptions } from './schema-4W_7tk1f.js';
|
|
2
|
+
import { V as VectorMaintenanceResult, B as BatchResult, L as ListParams, g as ListResult, I as IndexInfo, k as IndexStats, l as PartitionStatsResult, Q as QueryParams, e as QueryResult, P as PreflightResult, h as SuggestParams, j as SuggestResult } from './events-DqOIg5xa.js';
|
|
3
|
+
import { a as SynonymRule } from './synonyms-CpOAHPa-.js';
|
|
4
|
+
import { e as TaskRecord, M as MemoryStatsResponse, b as ImportResult, H as HttpIndexConfig, c as TaskListQuery, T as TaskListPage } from './tasks-CwPTz-tP.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* This is the `fetch` implementation the client sends every request through.
|
|
@@ -23,9 +24,55 @@ interface NarsilClientOptions {
|
|
|
23
24
|
/**
|
|
24
25
|
* The server answers at this address. Pass an absolute URL such as
|
|
25
26
|
* `https://search.example.com`, or a path such as `/search-api` when a
|
|
26
|
-
* browser reaches the server through its own origin.
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
* browser reaches the server through its own origin. Pass a list of them,
|
|
28
|
+
* such as the address of every node in a cluster, so that the client moves
|
|
29
|
+
* on when one of them fails. An empty list, or one that holds an address the
|
|
30
|
+
* client cannot read, fails with `CONFIG_INVALID`.
|
|
31
|
+
*
|
|
32
|
+
* A client takes one server URL or a list of them. It sends each request to
|
|
33
|
+
* one URL, starting one place after the URL that took the previous request,
|
|
34
|
+
* so that requests spread across the list.
|
|
35
|
+
*
|
|
36
|
+
* The client moves a request to the next URL when the connection fails, when
|
|
37
|
+
* the request times out, or when the server answers 502, 503, or 504. It
|
|
38
|
+
* tries each URL at most once per request, and it fails with the error from
|
|
39
|
+
* the last URL once every URL has failed. `timeoutMs` applies to each URL
|
|
40
|
+
* that the client tries.
|
|
41
|
+
*
|
|
42
|
+
* The client repeats a request on another URL only where repeating it cannot
|
|
43
|
+
* apply a change twice. A read, meaning a get, a search, a listing, or a
|
|
44
|
+
* stats call, moves on after any of the failures above. A write moves on only
|
|
45
|
+
* where the client sent no byte of it, because the connection was refused or
|
|
46
|
+
* the name did not resolve, or where the server refused it with
|
|
47
|
+
* `NODE_NOT_READY`. A write that times out, or that a server answers with
|
|
48
|
+
* 502, 503, or 504, fails without being sent again, so that the caller
|
|
49
|
+
* decides whether to resend it. A request whose body is a stream goes to one
|
|
50
|
+
* URL alone, because the client cannot read the stream a second time. A
|
|
51
|
+
* browser reports no reason for a failed connection, so a write that a
|
|
52
|
+
* browser sends moves on only after a `NODE_NOT_READY` answer.
|
|
53
|
+
*
|
|
54
|
+
* After a URL refuses a connection, the client skips it for
|
|
55
|
+
* {@link NarsilClientOptions.urlSkipMs}, 1,000 milliseconds unless you say
|
|
56
|
+
* otherwise, then for twice as long after each further refusal, up to
|
|
57
|
+
* {@link NarsilClientOptions.maxUrlSkipMs}, 30,000 milliseconds unless you
|
|
58
|
+
* say otherwise, and it uses it again once the URL answers with any status
|
|
59
|
+
* other than 502, 503, or 504. When
|
|
60
|
+
* every URL is in its skip period, the client tries the one whose skip period
|
|
61
|
+
* ends first.
|
|
62
|
+
*/
|
|
63
|
+
url: string | readonly string[];
|
|
64
|
+
/**
|
|
65
|
+
* The client skips a URL for this many milliseconds after it refuses a
|
|
66
|
+
* connection, and for twice as long after each further refusal. It skips
|
|
67
|
+
* one for 1000 unless you say otherwise.
|
|
68
|
+
*/
|
|
69
|
+
urlSkipMs?: number;
|
|
70
|
+
/**
|
|
71
|
+
* The client never skips a URL for longer than this many milliseconds, and
|
|
72
|
+
* it stops at 30000 unless you say otherwise. It must be at least
|
|
73
|
+
* {@link NarsilClientOptions.urlSkipMs}.
|
|
74
|
+
*/
|
|
75
|
+
maxUrlSkipMs?: number;
|
|
29
76
|
/**
|
|
30
77
|
* The client sends this key as `authorization: Bearer <key>`, which a server
|
|
31
78
|
* reads in its `onRequest` hook. For any other scheme, set the header
|
|
@@ -74,14 +121,15 @@ interface RequestOptions {
|
|
|
74
121
|
}
|
|
75
122
|
|
|
76
123
|
/**
|
|
77
|
-
* These methods
|
|
78
|
-
* snapshots, vector maintenance, partitioning, and analysis
|
|
124
|
+
* These methods carry out the operations that maintain an index: checkpoints,
|
|
125
|
+
* snapshots, document exports, vector maintenance, partitioning, and analysis
|
|
126
|
+
* rebuilds.
|
|
79
127
|
*
|
|
80
|
-
*
|
|
81
|
-
* while the work
|
|
82
|
-
* {@link TaskOperations.waitForTask}. The {@link Narsil} methods they
|
|
83
|
-
*
|
|
84
|
-
* client
|
|
128
|
+
* Five of them can take minutes, so each answers with a {@link TaskRecord}
|
|
129
|
+
* while the work continues. Follow that task with
|
|
130
|
+
* {@link TaskOperations.waitForTask}. The {@link Narsil} methods that they
|
|
131
|
+
* mirror finish their work before they resolve, which is the one place where
|
|
132
|
+
* this client differs from the engine.
|
|
85
133
|
*
|
|
86
134
|
* @public
|
|
87
135
|
*/
|
|
@@ -96,35 +144,85 @@ interface AdminOperations {
|
|
|
96
144
|
*/
|
|
97
145
|
checkpoint(indexName: string, options?: RequestOptions): Promise<void>;
|
|
98
146
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
147
|
+
* Returns a stream of an index's snapshot archive. Any implementation of
|
|
148
|
+
* the Narsil format can restore the archive.
|
|
101
149
|
*
|
|
102
|
-
* The
|
|
103
|
-
*
|
|
104
|
-
* {@link NarsilClientOptions.timeoutMs} or a per-call `timeoutMs` sets
|
|
150
|
+
* The download takes longer as the index grows, so this method sets no
|
|
151
|
+
* deadline of its own. It waits until the download ends, unless
|
|
152
|
+
* {@link NarsilClientOptions.timeoutMs} or a per-call `timeoutMs` sets a
|
|
153
|
+
* deadline.
|
|
105
154
|
*
|
|
106
|
-
* @param indexName - This names the index to
|
|
155
|
+
* @param indexName - This names the index to stream.
|
|
107
156
|
* @param options - This sets the signal, the deadline, and the headers for
|
|
108
157
|
* this request.
|
|
109
|
-
* @returns The bytes
|
|
158
|
+
* @returns The stream holds the archive's bytes in the order that the server
|
|
159
|
+
* sends them.
|
|
110
160
|
*/
|
|
111
|
-
snapshot(indexName: string, options?: RequestOptions): Promise<Uint8Array
|
|
161
|
+
snapshot(indexName: string, options?: RequestOptions): Promise<ReadableStream<Uint8Array>>;
|
|
112
162
|
/**
|
|
113
|
-
*
|
|
114
|
-
* the
|
|
163
|
+
* Uploads a snapshot archive and replaces the named index with the
|
|
164
|
+
* archive's contents. The method also accepts the single `.nrsl` file that
|
|
165
|
+
* `snapshot` returned in release 0.3.
|
|
115
166
|
*
|
|
116
|
-
* The
|
|
117
|
-
*
|
|
167
|
+
* The server writes the upload to a temporary file and restores the index
|
|
168
|
+
* in a task. This method therefore resolves once the server holds the whole
|
|
169
|
+
* upload, and the task's status changes to `succeeded` once the restored
|
|
170
|
+
* index is ready.
|
|
118
171
|
*
|
|
119
172
|
* @param indexName - This names the index to replace.
|
|
120
|
-
* @param data -
|
|
173
|
+
* @param data - This is the archive, as one byte array or a stream of bytes.
|
|
121
174
|
* @param options - This sets the signal, the deadline, and the headers for
|
|
122
175
|
* this request.
|
|
123
176
|
* @returns The record is the task to follow.
|
|
124
|
-
* @throws A `NarsilError` with `
|
|
125
|
-
*
|
|
177
|
+
* @throws A `NarsilError` with `PAYLOAD_TOO_LARGE` when the upload passes
|
|
178
|
+
* the server's `maxRestoreBytes` limit, and with `EMPTY_BODY` for an empty
|
|
179
|
+
* upload. The task reports `PERSISTENCE_LOAD_FAILED`,
|
|
180
|
+
* `PERSISTENCE_CRC_MISMATCH`, `ENVELOPE_VERSION_MISMATCH`, or
|
|
181
|
+
* `CONFIG_INVALID` in its `error` when a check of the archive fails.
|
|
182
|
+
*/
|
|
183
|
+
restore(indexName: string, data: Uint8Array | ReadableStream<Uint8Array>, options?: RequestOptions): Promise<TaskRecord>;
|
|
184
|
+
/**
|
|
185
|
+
* Returns a stream of an index's document export. The export is JSON Lines
|
|
186
|
+
* text, with the index configuration on the first line and one document on
|
|
187
|
+
* each later line. Pass the export to
|
|
188
|
+
* {@link AdminOperations.importDocumentExport} to load it into a server of
|
|
189
|
+
* this release or a later one.
|
|
190
|
+
*
|
|
191
|
+
* The download takes longer as the index grows, so this method sets no
|
|
192
|
+
* deadline of its own. It waits until the download ends, unless
|
|
193
|
+
* {@link NarsilClientOptions.timeoutMs} or a per-call `timeoutMs` sets a
|
|
194
|
+
* deadline.
|
|
195
|
+
*
|
|
196
|
+
* @param indexName - This names the index to export.
|
|
197
|
+
* @param options - This sets the signal, the deadline, and the headers for
|
|
198
|
+
* this request.
|
|
199
|
+
* @returns The stream holds the export's UTF-8 bytes in the order that the
|
|
200
|
+
* server sends them.
|
|
126
201
|
*/
|
|
127
|
-
|
|
202
|
+
exportDocuments(indexName: string, options?: RequestOptions): Promise<ReadableStream<Uint8Array>>;
|
|
203
|
+
/**
|
|
204
|
+
* Uploads a document export and imports it into an index in a task. Where
|
|
205
|
+
* the name is free, the engine creates the index from the export's
|
|
206
|
+
* configuration. The engine replaces each document whose ID the index
|
|
207
|
+
* already contains.
|
|
208
|
+
*
|
|
209
|
+
* The server writes the upload to a temporary file before the task starts,
|
|
210
|
+
* so this method resolves once the server holds the whole upload. When the
|
|
211
|
+
* task finishes, its result holds the number of imported documents and the
|
|
212
|
+
* refused lines.
|
|
213
|
+
*
|
|
214
|
+
* @param indexName - This names the index that receives the documents.
|
|
215
|
+
* @param data - This is the export, as one byte array or a stream of bytes.
|
|
216
|
+
* @param options - This sets the signal, the deadline, and the headers for
|
|
217
|
+
* this request.
|
|
218
|
+
* @returns The record is the task to follow.
|
|
219
|
+
* @throws A `NarsilError` with `PAYLOAD_TOO_LARGE` when the upload passes
|
|
220
|
+
* the server's `maxRestoreBytes` limit, and with `EMPTY_BODY` for an empty
|
|
221
|
+
* upload. The task reports `CONFIG_INVALID` in its `error` when the first
|
|
222
|
+
* line is anything other than an export header, or when the named index
|
|
223
|
+
* exists with a different schema.
|
|
224
|
+
*/
|
|
225
|
+
importDocumentExport(indexName: string, data: Uint8Array | ReadableStream<Uint8Array>, options?: RequestOptions): Promise<TaskRecord>;
|
|
128
226
|
/**
|
|
129
227
|
* Reports the state of each vector field, and what maintenance would cost.
|
|
130
228
|
*
|
|
@@ -182,6 +280,29 @@ interface AdminOperations {
|
|
|
182
280
|
* ceiling falls below what the index already holds.
|
|
183
281
|
*/
|
|
184
282
|
updatePartitionConfig(indexName: string, partitionConfig: Partial<PartitionConfig>, options?: RequestOptions): Promise<void>;
|
|
283
|
+
/**
|
|
284
|
+
* Replaces the synonym set of an index, which takes effect from the next
|
|
285
|
+
* search without a rebuild. Send an empty list to remove the set.
|
|
286
|
+
*
|
|
287
|
+
* @param indexName - The server replaces the set of this index.
|
|
288
|
+
* @param synonyms - This is the new set, in the shape that
|
|
289
|
+
* {@link SynonymRule} describes.
|
|
290
|
+
* @param options - This sets the signal, the deadline, and the headers for
|
|
291
|
+
* this request.
|
|
292
|
+
* @throws A `NarsilError` with `CONFIG_INVALID` when a rule breaks that
|
|
293
|
+
* shape, when a word analyses to no token or to more than one, or when the
|
|
294
|
+
* set passes its limits. The index then keeps the set that it held before.
|
|
295
|
+
*/
|
|
296
|
+
updateSynonyms(indexName: string, synonyms: SynonymRule[], options?: RequestOptions): Promise<void>;
|
|
297
|
+
/**
|
|
298
|
+
* Reads the synonym set of an index, with every word as the caller wrote it.
|
|
299
|
+
*
|
|
300
|
+
* @param indexName - The server returns the set of this index.
|
|
301
|
+
* @param options - This sets the signal, the deadline, and the headers for
|
|
302
|
+
* this request.
|
|
303
|
+
* @returns The rules of the set, or an empty list when the index holds none.
|
|
304
|
+
*/
|
|
305
|
+
getSynonyms(indexName: string, options?: RequestOptions): Promise<SynonymRule[]>;
|
|
185
306
|
/**
|
|
186
307
|
* Reanalyses every document in an index, as a task. An index analysed by an
|
|
187
308
|
* earlier revision of its language module must run this before its terms
|
|
@@ -814,8 +935,8 @@ interface TaskOperations {
|
|
|
814
935
|
}
|
|
815
936
|
|
|
816
937
|
/**
|
|
817
|
-
* This client reaches one Narsil server, and it runs
|
|
818
|
-
* server serves.
|
|
938
|
+
* This client reaches one Narsil server, or any of a list of them, and it runs
|
|
939
|
+
* every operation that a server serves.
|
|
819
940
|
*
|
|
820
941
|
* Every method has the name the embedded engine uses, so a call written against
|
|
821
942
|
* {@link Narsil} works here. HTTP forces two differences: every method takes
|
|
@@ -830,17 +951,19 @@ interface TaskOperations {
|
|
|
830
951
|
interface NarsilClient extends IndexOperations, DocumentOperations, BulkOperations, SearchOperations, TaskOperations, AdminOperations, ServerOperations {
|
|
831
952
|
}
|
|
832
953
|
/**
|
|
833
|
-
* Builds a client for one Narsil server
|
|
954
|
+
* Builds a client for one Narsil server, or for a list of them that it moves
|
|
955
|
+
* between as {@link NarsilClientOptions.url} describes.
|
|
834
956
|
*
|
|
835
957
|
* The client opens no connection, and it holds no state beyond the
|
|
836
|
-
* capabilities it has read
|
|
837
|
-
* application's lifetime.
|
|
958
|
+
* capabilities it has read and the URLs it is skipping, so nothing needs
|
|
959
|
+
* closing. Keep one client for the application's lifetime.
|
|
838
960
|
*
|
|
839
|
-
* @param options - These set the server
|
|
961
|
+
* @param options - These set the server addresses, the credentials, and the
|
|
840
962
|
* defaults every request inherits.
|
|
841
963
|
* @returns The client is ready to use.
|
|
842
|
-
* @throws A `NarsilError` with `CONFIG_INVALID` when it cannot read
|
|
843
|
-
* as a URL
|
|
964
|
+
* @throws A `NarsilError` with `CONFIG_INVALID` when it cannot read an address
|
|
965
|
+
* as a URL, when the list of addresses is empty, or when a skip duration is
|
|
966
|
+
* not a whole number of milliseconds.
|
|
844
967
|
*
|
|
845
968
|
* @public
|
|
846
969
|
*/
|
package/dist/client.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, N as NarsilError, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './
|
|
2
|
-
export { A as ASYNC_IMPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, R as REBUILD_ANALYSIS_CAPABILITY, S as SERVER_CAPABILITIES, T as TASK_CANCEL_CAPABILITY,
|
|
3
|
-
export { C as CapabilitiesResponse, a as CreateIndexEmbedding, H as HttpIndexConfig, I as ImportError, b as ImportResult, M as MemoryStatsResponse, T as TaskListPage, c as TaskListQuery, d as TaskProgress, e as TaskRecord, f as TaskStatus, g as TaskType } from './tasks-
|
|
4
|
-
export { A as AdminOperations, B as BulkOperations, D as DocumentOperations, F as FetchFunction, I as ImportSource, a as IndexOperations, N as NarsilClient, b as NarsilClientOptions, P as PutResult, R as RequestOptions, S as SearchOperations, c as ServerOperations, d as ServerVersion, T as TaskOperations, W as WaitForTaskOptions, e as createNarsilClient } from './client-
|
|
5
|
-
import './schema-
|
|
6
|
-
import './adapters-
|
|
7
|
-
import './
|
|
8
|
-
import './config-
|
|
9
|
-
import './
|
|
10
|
-
import './
|
|
1
|
+
export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, N as NarsilError, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './events-DqOIg5xa.js';
|
|
2
|
+
export { A as ASYNC_IMPORT_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-ByQRMOx-.js';
|
|
3
|
+
export { C as CapabilitiesResponse, a as CreateIndexEmbedding, H as HttpIndexConfig, I as ImportError, b as ImportResult, M as MemoryStatsResponse, T as TaskListPage, c as TaskListQuery, d as TaskProgress, e as TaskRecord, f as TaskStatus, g as TaskType } from './tasks-CwPTz-tP.js';
|
|
4
|
+
export { A as AdminOperations, B as BulkOperations, D as DocumentOperations, F as FetchFunction, I as ImportSource, a as IndexOperations, N as NarsilClient, b as NarsilClientOptions, P as PutResult, R as RequestOptions, S as SearchOperations, c as ServerOperations, d as ServerVersion, T as TaskOperations, W as WaitForTaskOptions, e as createNarsilClient } from './client-BOStAkc5.js';
|
|
5
|
+
import './schema-4W_7tk1f.js';
|
|
6
|
+
import './adapters-BQFQ4PRz.js';
|
|
7
|
+
import './synonyms-CpOAHPa-.js';
|
|
8
|
+
import './config-H6SGzbPH.js';
|
|
9
|
+
import './config-Cjvzbs_j.js';
|
|
10
|
+
import './index-Bkdt8nDw.js';
|
|
11
|
+
import './types-Cz5okLml.js';
|