@delali/narsil 0.3.1-next.129 → 0.3.1-next.131

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 (107) hide show
  1. package/dist/adapters/filesystem.mjs +1 -1
  2. package/dist/adapters/indexeddb.mjs +1 -1
  3. package/dist/browser/chunk-26A5JFT2.mjs +89 -0
  4. package/dist/browser/{chunk-5D6NJD6C.mjs → chunk-2Y3CO4EQ.mjs} +342 -201
  5. package/dist/browser/{chunk-WLD6DDIX.mjs → chunk-AIIJDWMG.mjs} +1 -1
  6. package/dist/browser/{chunk-YAGXZU4W.mjs → chunk-D7WQF6DV.mjs} +2 -2
  7. package/dist/browser/{chunk-WZBTVTSU.mjs → chunk-M5UAAXGU.mjs} +2 -2
  8. package/dist/browser/{chunk-XTFJZHQP.mjs → chunk-NSCSR6MA.mjs} +15 -5
  9. package/dist/browser/{chunk-3NVZD52E.mjs → chunk-UDGB2MWT.mjs} +5 -28
  10. package/dist/browser/{chunk-II5POT55.mjs → chunk-VBBLTD7O.mjs} +4 -3
  11. package/dist/browser/chunk-VEGHFP2P.mjs +30 -0
  12. package/dist/browser/{durability-wiring-HCCC6BJB.mjs → durability-wiring-FNZSRH4N.mjs} +8 -6
  13. package/dist/browser/{module-S2VDU2JE.mjs → module-4HIMOQM5.mjs} +6 -5
  14. package/dist/browser/phrase-module-WESYVU7K.mjs +327 -0
  15. package/dist/browser/{restore-queue-BZ7WWEC4.mjs → restore-queue-GEZ54CA5.mjs} +1 -1
  16. package/dist/browser/{runtime-PL4TTFJE.mjs → runtime-3X7ZJ5T3.mjs} +2 -1
  17. package/dist/browser/{snapshot-RTUCHI2L.mjs → snapshot-V7VF6BN6.mjs} +25 -10
  18. package/dist/browser/{write-IMU7G5NU.mjs → write-YIC2MKRY.mjs} +7 -5
  19. package/dist/{capabilities-BTjv-tK8.d.ts → capabilities-B6WxrWxt.d.ts} +3 -10
  20. package/dist/{chunk-3XHFVYIQ.mjs → chunk-2C3WXBQS.mjs} +1 -1
  21. package/dist/{chunk-37RTD6KD.mjs → chunk-2JWNJSNE.mjs} +8 -8
  22. package/dist/{chunk-K76F5YYX.mjs → chunk-2MKX2SCO.mjs} +219 -58
  23. package/dist/{chunk-AN3CUMPZ.mjs → chunk-2SEL6SBS.mjs} +4 -95
  24. package/dist/{chunk-OPO5SE4J.mjs → chunk-2WBY4Y4M.mjs} +1 -1
  25. package/dist/{chunk-PTIJAZWL.mjs → chunk-4GDLFDPZ.mjs} +1 -1
  26. package/dist/chunk-4UMZ7KQL.mjs +17 -0
  27. package/dist/{chunk-TY64A3ZW.mjs → chunk-5LX6MOIB.mjs} +2 -2
  28. package/dist/{chunk-3LJVM6XM.mjs → chunk-5W7AEVTH.mjs} +2 -2
  29. package/dist/{chunk-PCRWCOZC.mjs → chunk-6M6SDH3S.mjs} +43 -23
  30. package/dist/{chunk-MGD7XETB.mjs → chunk-6SSVIW7Y.mjs} +19 -3
  31. package/dist/{chunk-5LC5VMDQ.mjs → chunk-7OIQ2SIO.mjs} +4 -4
  32. package/dist/{chunk-4XEVROSP.mjs → chunk-7XY6VD7B.mjs} +1 -1
  33. package/dist/{chunk-WI5Q3L43.mjs → chunk-CZ7ISLXA.mjs} +2 -0
  34. package/dist/{chunk-RC27KF7F.mjs → chunk-D5TFRB5G.mjs} +3 -15
  35. package/dist/{chunk-F4UKMTKM.mjs → chunk-EUCX5K74.mjs} +4 -4
  36. package/dist/{chunk-CTF6WFTX.mjs → chunk-F6AAXI7T.mjs} +3 -3
  37. package/dist/{chunk-DX2FI4LU.mjs → chunk-FQBFZAWG.mjs} +3 -1
  38. package/dist/{chunk-XTER67YM.mjs → chunk-HCGJKDZV.mjs} +1 -1
  39. package/dist/{chunk-WQYB4TNR.mjs → chunk-JJ6EUMXB.mjs} +2 -2
  40. package/dist/{chunk-2HQQ7Y5D.mjs → chunk-JT3YZGCE.mjs} +2 -2
  41. package/dist/chunk-JUKYYXSP.mjs +93 -0
  42. package/dist/{chunk-WUIDPBSY.mjs → chunk-K77FJXKS.mjs} +17 -7
  43. package/dist/{chunk-CSSCLRGY.mjs → chunk-NMXRXFGZ.mjs} +2 -2
  44. package/dist/{chunk-44TB6AIZ.mjs → chunk-NNO7CO3A.mjs} +1 -1
  45. package/dist/{chunk-EZIGAOUJ.mjs → chunk-OGLV4I3L.mjs} +6 -5
  46. package/dist/{chunk-FRSWYMXH.mjs → chunk-PATMDIMN.mjs} +1 -1
  47. package/dist/{chunk-AFOZR4ZQ.mjs → chunk-PU6SKH7O.mjs} +2 -2
  48. package/dist/{chunk-TB7YMDD5.mjs → chunk-RCMNL7RI.mjs} +650 -100
  49. package/dist/{chunk-Y4NOHICF.mjs → chunk-RNSC4NFI.mjs} +1 -1
  50. package/dist/{chunk-RYH3PASD.mjs → chunk-RWESFSJI.mjs} +21 -11
  51. package/dist/{chunk-QQS4QZQA.mjs → chunk-SOHMMNCH.mjs} +4 -4
  52. package/dist/{chunk-K73PZTBR.mjs → chunk-SZGRYEIC.mjs} +4 -4
  53. package/dist/{chunk-43Q7HAI2.mjs → chunk-T4OFG4IQ.mjs} +4 -4
  54. package/dist/{chunk-2YOAGAGF.mjs → chunk-TGHNXN7W.mjs} +59 -30
  55. package/dist/{chunk-J4LRE5Q7.mjs → chunk-WVRDRLIC.mjs} +6 -6
  56. package/dist/{chunk-XRXBCOA4.mjs → chunk-X5CNUKD5.mjs} +2 -2
  57. package/dist/{chunk-Y4US5EGH.mjs → chunk-Y2U5VVWX.mjs} +1 -1
  58. package/dist/{chunk-5VSTAJET.mjs → chunk-Y4BVTQ53.mjs} +2 -2
  59. package/dist/{chunk-M6MBSVIJ.mjs → chunk-ZR4VM4A6.mjs} +1 -1
  60. package/dist/{client-BOcveV7A.d.ts → client-gNAfaHcE.d.ts} +3 -3
  61. package/dist/client.d.ts +7 -8
  62. package/dist/client.mjs +2 -0
  63. package/dist/{config-CPmIY3aH.d.ts → config-CmYJO34X.d.ts} +3 -3
  64. package/dist/{events-pM0lna7M.d.ts → config-D1cDv3sE.d.ts} +431 -3
  65. package/dist/direct-executor-HQ4QVDX7.mjs +28 -0
  66. package/dist/distribution/coordinator/etcd.d.ts +2 -2
  67. package/dist/distribution/coordinator/etcd.mjs +1 -1
  68. package/dist/distribution/coordinator/in-memory.d.ts +2 -2
  69. package/dist/distribution/transport/grpc.mjs +1 -1
  70. package/dist/distribution.d.ts +7 -8
  71. package/dist/distribution.mjs +85 -45
  72. package/dist/{durability-wiring-6R26AJDI.mjs → durability-wiring-S7OX2MAI.mjs} +27 -25
  73. package/dist/embeddings/openai.mjs +2 -2
  74. package/dist/{engine-JjRAXpT3.d.ts → engine-m_Ddr1bz.d.ts} +2 -2
  75. package/dist/{index-DkQ2DlgR.d.ts → index-HYnqS1SE.d.ts} +2 -2
  76. package/dist/index.browser.mjs +5 -3
  77. package/dist/index.d.ts +6 -7
  78. package/dist/index.mjs +20 -18
  79. package/dist/{long-query-thread-6VLA6YJI.mjs → long-query-thread-BSL25PD6.mjs} +17 -15
  80. package/dist/{module-S4WGMFNW.mjs → module-2E4XYSGT.mjs} +11 -11
  81. package/dist/partial-words.mjs +7 -6
  82. package/dist/pattern.mjs +4 -3
  83. package/dist/persistence/durability/checkpoint-worker.d.ts +2 -1
  84. package/dist/persistence/durability/checkpoint-worker.mjs +23 -21
  85. package/dist/phrase-module-JERF2IDG.mjs +329 -0
  86. package/dist/react.d.ts +11 -8
  87. package/dist/react.mjs +2 -0
  88. package/dist/{rerank-V4J4MIWR.mjs → rerank-DMMT4FZA.mjs} +6 -6
  89. package/dist/rerankers/http.mjs +2 -2
  90. package/dist/{restore-queue-PUGWCPCX.mjs → restore-queue-JAMNRC6T.mjs} +1 -1
  91. package/dist/{runtime-TBFBQQQO.mjs → runtime-7MLQ7J64.mjs} +7 -7
  92. package/dist/{schema-DGAP_8HJ.d.ts → schema-BTXbHCqA.d.ts} +8 -5
  93. package/dist/server.d.ts +198 -11
  94. package/dist/server.mjs +30 -19
  95. package/dist/{snapshot-PUVSMV7E.mjs → snapshot-DOQLGGEX.mjs} +44 -29
  96. package/dist/synonyms.mjs +4 -3
  97. package/dist/tasks-Co8HfRD7.d.ts +704 -0
  98. package/dist/{thread-TA7QQBWP.mjs → thread-SKO7CN3R.mjs} +16 -14
  99. package/dist/vector/search-worker.d.ts +1 -1
  100. package/dist/vector/search-worker.mjs +4 -4
  101. package/dist/workers/entry.mjs +7 -7
  102. package/dist/{write-TGKYT3C4.mjs → write-ZKR7SNRT.mjs} +22 -20
  103. package/openapi.json +5215 -0
  104. package/package.json +16 -8
  105. package/dist/config-C3YXk5Rn.d.ts +0 -412
  106. package/dist/direct-executor-ULA6V5HC.mjs +0 -26
  107. package/dist/tasks-txGvNz6h.d.ts +0 -302
@@ -0,0 +1,704 @@
1
+ import { I as IndexInfo, P as PartitionStatsResult, V as VectorMaintenanceResult, M as MemoryStats } from './config-D1cDv3sE.js';
2
+ import { A as AnyDocument, I as InsertOptions, B as BM25Params, W as WriteOptions } from './schema-BTXbHCqA.js';
3
+ import { a as SynonymRule } from './synonyms-CpOAHPa-.js';
4
+ import { N as NodeRole, c as NodeMemoryReport } from './index-HYnqS1SE.js';
5
+ import { a as ClusterNodeInfo, N as NodeReadiness } from './config-CmYJO34X.js';
6
+
7
+ /**
8
+ * The body of `POST /indexes`, which the server sends once the index exists.
9
+ *
10
+ * @public
11
+ */
12
+ interface IndexCreatedResponse {
13
+ /** The server created the index under this name. */
14
+ name: string;
15
+ }
16
+ /**
17
+ * The body of `GET /indexes`.
18
+ *
19
+ * @public
20
+ */
21
+ interface IndexListResponse {
22
+ /** Each index appears here once, in creation order. */
23
+ indexes: IndexInfo[];
24
+ }
25
+ /**
26
+ * The body of `DELETE /indexes/{name}`.
27
+ *
28
+ * @public
29
+ */
30
+ interface IndexDroppedResponse {
31
+ /** The server dropped the index with this name. */
32
+ name: string;
33
+ /** This is always true. */
34
+ dropped: true;
35
+ }
36
+ /**
37
+ * The body of `GET /indexes/{name}/partitions`.
38
+ *
39
+ * @public
40
+ */
41
+ interface IndexPartitionsResponse {
42
+ /** One entry describes each partition of the index. */
43
+ partitions: PartitionStatsResult[];
44
+ }
45
+ /**
46
+ * The body of `POST /indexes/{name}/_clear`.
47
+ *
48
+ * @public
49
+ */
50
+ interface IndexClearedResponse {
51
+ /** The server removed every document from the index with this name. */
52
+ name: string;
53
+ /** This is always true. */
54
+ cleared: true;
55
+ }
56
+ /**
57
+ * The body of `POST /indexes/{name}/_open` and `POST /indexes/{name}/_close`.
58
+ *
59
+ * @public
60
+ */
61
+ interface IndexStateResponse {
62
+ /** The request changed the index with this name. */
63
+ name: string;
64
+ /** The index holds this state now. */
65
+ state: 'open' | 'closed';
66
+ }
67
+ /**
68
+ * The body of a request that the server finishes with nothing further to report.
69
+ *
70
+ * @public
71
+ */
72
+ interface OkResponse {
73
+ /** This is always true. */
74
+ ok: true;
75
+ }
76
+ /**
77
+ * The body of `POST /indexes/{name}/documents` and of
78
+ * `PATCH /indexes/{name}/documents/{id}`.
79
+ *
80
+ * @public
81
+ */
82
+ interface DocumentIdResponse {
83
+ /** The server wrote the document under this id. */
84
+ id: string;
85
+ }
86
+ /**
87
+ * The body of `PUT /indexes/{name}/documents/{id}`.
88
+ *
89
+ * @public
90
+ */
91
+ interface DocumentPutResponse {
92
+ /** The server wrote the document under this id. */
93
+ id: string;
94
+ /** This is true where the id was new, and false where the document replaced an existing one. */
95
+ created: boolean;
96
+ }
97
+ /**
98
+ * The body of `DELETE /indexes/{name}/documents/{id}`.
99
+ *
100
+ * @public
101
+ */
102
+ interface DocumentRemovedResponse {
103
+ /** The server removed the document with this id. */
104
+ id: string;
105
+ /** This is always true. */
106
+ removed: true;
107
+ }
108
+ /**
109
+ * The body of `GET /indexes/{name}/documents/{id}`.
110
+ *
111
+ * @public
112
+ */
113
+ interface DocumentResponse {
114
+ /** This is the stored document. */
115
+ document: AnyDocument;
116
+ }
117
+ /**
118
+ * The body of `GET /indexes/{name}/documents/{id}/_exists`.
119
+ *
120
+ * @public
121
+ */
122
+ interface DocumentExistsResponse {
123
+ /** This is true where the index holds a document with the id. */
124
+ exists: boolean;
125
+ }
126
+ /**
127
+ * The body of `GET /indexes/{name}/count`.
128
+ *
129
+ * @public
130
+ */
131
+ interface DocumentCountResponse {
132
+ /** The index holds this many documents. */
133
+ count: number;
134
+ }
135
+ /**
136
+ * The body of `POST /indexes/{name}/documents/_multi-get`.
137
+ *
138
+ * @public
139
+ */
140
+ interface MultiGetResponse {
141
+ /** Each document found appears under its id, and an id with no document has no entry. */
142
+ documents: Record<string, AnyDocument>;
143
+ }
144
+ /**
145
+ * The body of `GET /indexes/{name}/vector-maintenance`.
146
+ *
147
+ * @public
148
+ */
149
+ interface VectorMaintenanceResponse {
150
+ /** One entry describes each vector field of the index. */
151
+ fields: VectorMaintenanceResult[];
152
+ }
153
+ /**
154
+ * The body of `GET /indexes/{name}/synonyms`, and the body that
155
+ * `POST /indexes/{name}/synonyms` takes.
156
+ *
157
+ * @public
158
+ */
159
+ interface SynonymSetBody {
160
+ /** These rules make up the set, with every word as it was written, and an empty list removes the set. */
161
+ synonyms: SynonymRule[];
162
+ }
163
+ /**
164
+ * The body that `POST /indexes/{name}/vectors/_compact` and
165
+ * `POST /indexes/{name}/vectors/_optimize` take.
166
+ *
167
+ * @public
168
+ */
169
+ interface VectorFieldBody {
170
+ /** The request covers this vector field, and every vector field of the index where you leave it out. */
171
+ field?: string;
172
+ }
173
+ /**
174
+ * The body of `GET /livez`.
175
+ *
176
+ * @public
177
+ */
178
+ interface LivenessResponse {
179
+ /** This is always `ok`, because the process answered. */
180
+ status: 'ok';
181
+ }
182
+ /**
183
+ * The cluster node that a server fronts, as `/readyz` and `/cluster` report it.
184
+ *
185
+ * @public
186
+ */
187
+ interface ClusterNodeReport extends ClusterNodeInfo {
188
+ /** This says whether the node can serve requests now. */
189
+ readiness: NodeReadiness;
190
+ /** This is true while the node holds the controller lease. */
191
+ isController: boolean;
192
+ }
193
+ /**
194
+ * The body of `GET /readyz` and `GET /health`, which the server sends with
195
+ * status 200 while it is ready and with status 503 while it is not.
196
+ *
197
+ * @public
198
+ */
199
+ interface ReadinessResponse {
200
+ /** This says whether the server can take requests now. */
201
+ status: 'ready' | 'unavailable';
202
+ /** A server that fronts a cluster node describes that node here. */
203
+ cluster?: ClusterNodeReport;
204
+ }
205
+ /**
206
+ * The body of `GET /version`.
207
+ *
208
+ * @public
209
+ */
210
+ interface VersionResponse {
211
+ /** This is always `narsil`. */
212
+ name: 'narsil';
213
+ /** The build came from this package version, or this is null where the build stamped none. */
214
+ version: string | null;
215
+ /** The build came from this git commit, or this is null where the build stamped none. */
216
+ gitSha: string | null;
217
+ /** This is true when the working tree held uncommitted changes at build time. */
218
+ dirty: boolean;
219
+ /** The thread that answered searches vector graphs through the native search core under `native`, and through WebAssembly under `wasm`. */
220
+ vectorSearch: 'native' | 'wasm';
221
+ }
222
+ /**
223
+ * One member of a cluster, as `GET /cluster` reports it.
224
+ *
225
+ * @public
226
+ */
227
+ interface ClusterMemberReport {
228
+ /** This identifies the node across the cluster. */
229
+ nodeId: string;
230
+ /** Peers reach the node at this address. */
231
+ address: string;
232
+ /** The node holds these roles in the cluster. */
233
+ roles: NodeRole[];
234
+ /** The node uses this much memory, or null where its runtime cannot measure it. */
235
+ memory: NodeMemoryReport | null;
236
+ }
237
+ /**
238
+ * The body of `GET /cluster`.
239
+ *
240
+ * @public
241
+ */
242
+ interface ClusterTopologyResponse {
243
+ /** This describes the node that answered. */
244
+ node: ClusterNodeReport;
245
+ /** This node holds the controller lease, and the value is null while no node holds it. */
246
+ controllerNodeId: string | null;
247
+ /** One entry describes each registered node. */
248
+ nodes: ClusterMemberReport[];
249
+ }
250
+ /**
251
+ * One partition of an index, as `GET /indexes/{name}/cluster` reports it.
252
+ *
253
+ * @public
254
+ */
255
+ interface PartitionAllocationReport {
256
+ /** This identifies the partition within its index. */
257
+ partitionId: number;
258
+ /** The partition holds this allocation state. */
259
+ state: string;
260
+ /** This node holds the primary copy, and the value is null while no node holds it. */
261
+ primary: string | null;
262
+ /** The primary holds this term. */
263
+ primaryTerm: number;
264
+ /** The primary has acknowledged writes up to this sequence number. */
265
+ commitPoint: number;
266
+ /** These nodes hold replica copies. */
267
+ replicas: string[];
268
+ /** These nodes hold replica copies that are up to date. */
269
+ inSyncSet: string[];
270
+ /** These nodes held a copy before the partition lost its primary. */
271
+ lastHolders: string[];
272
+ /** This says why the partition has no node, and the value is null while it has one. */
273
+ unassignedReason: string | null;
274
+ }
275
+ /**
276
+ * The body of `GET /indexes/{name}/cluster`.
277
+ *
278
+ * @public
279
+ */
280
+ interface ClusterAllocationResponse {
281
+ /** The report covers the index with this name. */
282
+ indexName: string;
283
+ /** This is true where the cluster has placed at least one partition of the index. */
284
+ allocated: boolean;
285
+ /** The allocation table holds this version, and the value is null where the index has no table. */
286
+ version: number | null;
287
+ /** One entry describes each partition, in partition order. */
288
+ partitions: PartitionAllocationReport[];
289
+ }
290
+ /**
291
+ * The body that `PUT /indexes/{name}/replication-factor` takes.
292
+ *
293
+ * @public
294
+ */
295
+ interface ReplicationFactorBody {
296
+ /** Each partition keeps this many replicas besides its primary. */
297
+ replicationFactor: number;
298
+ }
299
+ /**
300
+ * The body of `PUT /indexes/{name}/replication-factor`.
301
+ *
302
+ * @public
303
+ */
304
+ interface ReplicationFactorResponse {
305
+ /** The request changed the index with this name. */
306
+ indexName: string;
307
+ /** Each partition now keeps this many replicas besides its primary. */
308
+ replicationFactor: number;
309
+ }
310
+ /**
311
+ * The code, the message, and the details of one failure, as the server writes it to JSON.
312
+ *
313
+ * @public
314
+ */
315
+ interface ErrorDetail {
316
+ /** This code comes from either {@link ServerErrorCodes} or {@link ErrorCodes}. */
317
+ code: string;
318
+ /** This describes the failure, for a log or a person. */
319
+ message: string;
320
+ /** These values are behind the failure, such as the field or limit involved. */
321
+ details?: Record<string, unknown>;
322
+ }
323
+ /**
324
+ * One document that a batch refused.
325
+ *
326
+ * @public
327
+ */
328
+ interface BatchFailure {
329
+ /** The batch refused the document with this id. */
330
+ docId: string;
331
+ /** This says why the batch refused the document. */
332
+ error: ErrorDetail;
333
+ }
334
+ /**
335
+ * The body of `POST /indexes/{name}/documents/_batch`. One bad document never
336
+ * abandons the rest, so read both lists.
337
+ *
338
+ * @public
339
+ */
340
+ interface BatchResponse {
341
+ /** The server wrote the documents under these ids. */
342
+ succeeded: string[];
343
+ /** The server refused each of these documents. */
344
+ failed: BatchFailure[];
345
+ }
346
+
347
+ /** Declarative index configuration accepted over HTTP. Function-valued engine
348
+ * options (custom tokenizer, stopWords-as-function, group reducer, embedding
349
+ * adapter object) are not representable here; the embedding adapter is named
350
+ * instead via {@link CreateIndexEmbedding}.
351
+ *
352
+ * @public */
353
+ interface CreateIndexRequest {
354
+ /** The server creates the index under this name. */
355
+ name: string;
356
+ /** This carries the schema and settings, in the subset JSON can express. */
357
+ config: HttpIndexConfig;
358
+ }
359
+ /**
360
+ * How a JSON `createIndex` request connects an index to an embedding adapter.
361
+ *
362
+ * An adapter is a function and cannot cross JSON, so the request names one the
363
+ * server registered instead of carrying it.
364
+ *
365
+ * @public
366
+ */
367
+ interface CreateIndexEmbedding {
368
+ /** This names an adapter the server registered under `embeddingAdapters`. */
369
+ adapter?: string;
370
+ /** This maps each vector field to the text field, or fields, the server embeds into it. */
371
+ fields: Record<string, string | string[]>;
372
+ }
373
+ /**
374
+ * The body of `POST /indexes/{name}/documents`.
375
+ *
376
+ * @public
377
+ */
378
+ interface InsertBody {
379
+ /** The server stores this document. */
380
+ document: AnyDocument;
381
+ /** The server stores the document under this id, and takes the document's `id` field or a new id where you leave this out. */
382
+ id?: string;
383
+ /** These settings control how the write reaches the worker copies. */
384
+ options?: InsertOptions;
385
+ }
386
+ /**
387
+ * The body of `PUT` and of `PATCH /indexes/{name}/documents/{id}`.
388
+ *
389
+ * @public
390
+ */
391
+ interface DocumentBody {
392
+ /** The server writes this document under the id in the path. */
393
+ document: AnyDocument;
394
+ /** These settings control how the write reaches the worker copies. */
395
+ options?: WriteOptions;
396
+ }
397
+ /**
398
+ * The body of `POST /indexes/{name}/documents/_multi-get`.
399
+ *
400
+ * @public
401
+ */
402
+ interface MultiGetBody {
403
+ /** The server fetches the documents with these ids. */
404
+ docIds: string[];
405
+ }
406
+ /**
407
+ * The body of `POST /indexes/{name}/documents/_batch`.
408
+ *
409
+ * @public
410
+ */
411
+ interface BatchBody {
412
+ /** The server performs this action, and `insert` where you leave it out. */
413
+ action?: 'insert' | 'update' | 'delete';
414
+ /** The `insert` action writes these documents. */
415
+ documents?: AnyDocument[];
416
+ /** The `update` action replaces the document under each of these ids. */
417
+ updates?: Array<{
418
+ /** The update replaces the document with this id. */
419
+ docId: string;
420
+ /** The update writes this document. */
421
+ document: AnyDocument;
422
+ }>;
423
+ /** The `delete` action removes the documents with these ids. */
424
+ docIds?: string[];
425
+ /** These settings apply to the whole batch. */
426
+ options?: InsertOptions;
427
+ }
428
+ /**
429
+ * The body of `POST /indexes/{name}/_rebalance`.
430
+ *
431
+ * @public
432
+ */
433
+ interface RebalanceBody {
434
+ /** The index moves to this many partitions, which must be a positive whole number. */
435
+ targetPartitionCount?: number;
436
+ }
437
+ /**
438
+ * The index settings a JSON request can carry, which is {@link IndexConfig}
439
+ * minus everything that is a function.
440
+ *
441
+ * A custom tokeniser, a stop-word function, and an embedding adapter object
442
+ * have no JSON form, so an HTTP client names a registered one or supplies a
443
+ * plain list instead.
444
+ *
445
+ * @public
446
+ */
447
+ interface HttpIndexConfig {
448
+ /** This layout gives each value as either a field type or a nested schema. */
449
+ schema: Record<string, unknown>;
450
+ /** The server tokenises and stems text fields with the language module registered under this name. */
451
+ language?: string;
452
+ /** These settings control how the index splits documents across partitions as it grows. */
453
+ partitions?: {
454
+ maxDocsPerPartition?: number;
455
+ maxPartitions?: number;
456
+ watermark?: number;
457
+ };
458
+ /** A query scores this way unless it asks for another mode. */
459
+ defaultScoring?: 'local' | 'dfs' | 'broadcast';
460
+ /** These parameters tune BM25 for this index and for each of its text fields. */
461
+ bm25?: BM25Params;
462
+ /** This list replaces the language's stop words. */
463
+ stopWords?: string[];
464
+ /** Setting this records term positions in each posting, which the `.nrsl` format carries for readers that match phrases. Highlighting works without it. */
465
+ trackPositions?: boolean;
466
+ /** Setting this to false returns index stems from suggestions and prefix expansion, instead of the words users typed. */
467
+ surfaceForms?: boolean;
468
+ /** These settings control when vector fields move to an HNSW graph, and how that graph is built. */
469
+ vectorPromotion?: Record<string, unknown>;
470
+ /** Setting this rejects a document carrying a field the schema does not declare. */
471
+ strict?: boolean;
472
+ /** This names a server-registered embedding adapter and the fields it embeds. */
473
+ embedding?: CreateIndexEmbedding;
474
+ /** The server rejects a document that omits any of these fields. */
475
+ required?: string[];
476
+ /** The server returns a `DOC_VALIDATION_FAILED` error for a document whose value in a `verbatim` field, or in a field whose type includes `pattern`, is longer than this many code points. Set a whole number from 1 to 65,536, or leave this unset for a limit of 8,192. */
477
+ patternValueLimit?: number;
478
+ /** A search for a word in one of these rules also matches its synonyms, and the server refuses a set beyond 100,000 rules, 500,000 words, or 4,194,304 bytes of words in UTF-8 with `CONFIG_INVALID`. */
479
+ synonyms?: SynonymRule[];
480
+ }
481
+ /**
482
+ * One record an import refused, naming the line it came from and why the
483
+ * server rejected it.
484
+ *
485
+ * @public
486
+ */
487
+ interface ImportError {
488
+ /** The failing record sat on this line of the body, counting from one. */
489
+ line?: number;
490
+ /** The engine rejected the document stored under this id. */
491
+ docId?: string;
492
+ /** This says which failure it is. */
493
+ code: string;
494
+ /** This describes the failure, for a log or a person. */
495
+ message: string;
496
+ /** The server puts the facts that explain the failure here where it has any, such as the `reason` for a line that it refused to parse because parsing the line could fill the heap. */
497
+ details?: Record<string, unknown>;
498
+ }
499
+ /**
500
+ * What one import produced.
501
+ *
502
+ * `errors` is capped by the server's `maxImportErrors` limit while `failed`
503
+ * counts every refusal, so a run that trips the cap reports the true total and
504
+ * sets `errorsTruncated`.
505
+ *
506
+ * @public
507
+ */
508
+ interface ImportResult {
509
+ /** The engine accepted this many documents. */
510
+ indexed: number;
511
+ /** The server refused this many records in total. */
512
+ failed: number;
513
+ /** The first refusals, up to the server's reporting cap. */
514
+ errors: ImportError[];
515
+ /** Setting this says more records failed than `errors` lists. */
516
+ errorsTruncated: boolean;
517
+ }
518
+ /**
519
+ * What a server announces at `/capabilities`, which is how a client finds out
520
+ * whether an optional route or mode is available before it sends a request.
521
+ *
522
+ * A server that answers 404 here predates the endpoint, so treat every optional
523
+ * capability as absent.
524
+ *
525
+ * @public
526
+ */
527
+ interface CapabilitiesResponse {
528
+ /** Each name marks one capability this server serves. */
529
+ capabilities: string[];
530
+ }
531
+ /**
532
+ * The body `GET /stats/memory` answers with, which is the engine's {@link MemoryStats}
533
+ * plus the number of worker threads the server receives requests on. Only the
534
+ * server can report that count, because it starts those threads.
535
+ *
536
+ * @public
537
+ */
538
+ interface MemoryStatsResponse extends MemoryStats {
539
+ /**
540
+ * This many worker threads receive requests and answer searches from the
541
+ * copies they hold. The count is zero where the main thread answers everything
542
+ * itself, which happens under `workers.enabled: false`, on a runtime without
543
+ * worker threads, and on a cluster node's engine. See
544
+ * {@link NarsilServer.requestThreadCount}.
545
+ */
546
+ requestThreads: number;
547
+ }
548
+
549
+ /**
550
+ * Which long-running operation a task record tracks.
551
+ *
552
+ * @public
553
+ */
554
+ type TaskType = 'optimizeVectors' | 'rebalance' | 'restore' | 'import' | 'importExport' | 'rebuildAnalysis';
555
+ /**
556
+ * Where a long-running operation stands.
557
+ *
558
+ * A task starts `running`, because the server begins the work as it accepts
559
+ * the request. Where the server already drives
560
+ * {@link ServerLimits.maxConcurrentTasks} tasks, it answers 429
561
+ * `TOO_MANY_REQUESTS` and starts none. A task reaches `cancelled` only where
562
+ * the work itself stops early, so a cancel that arrives too late leaves the
563
+ * task `succeeded`.
564
+ *
565
+ * @public
566
+ */
567
+ type TaskStatus = 'running' | 'succeeded' | 'failed' | 'cancelled';
568
+ /**
569
+ * How far a running import has gone, which is what a progress bar reads.
570
+ *
571
+ * The byte counts describe the request body, so they give an honest fraction
572
+ * from the first batch onwards, while the document counts only cover what the
573
+ * server has already handed to the engine. Task types other than `import`
574
+ * report no progress.
575
+ *
576
+ * @public
577
+ */
578
+ interface TaskProgress {
579
+ /** The server has indexed this many documents so far. */
580
+ indexed: number;
581
+ /** The server has rejected this many documents so far. */
582
+ failed: number;
583
+ /** The server has read this many bytes of the body so far. */
584
+ bytesProcessed: number;
585
+ /** The body holds this many bytes in total. */
586
+ bytesTotal: number;
587
+ }
588
+ /**
589
+ * One long-running operation, which the server answers with straight away and
590
+ * you then poll.
591
+ *
592
+ * Every route that starts a task answers with this same record, and
593
+ * `GET /tasks/{id}` returns it again as the work moves on.
594
+ *
595
+ * @public
596
+ */
597
+ interface TaskRecord {
598
+ /** This identifies the task, and is what you poll by. */
599
+ id: string;
600
+ /** This says which operation the task runs. */
601
+ type: TaskType;
602
+ /** The operation runs against this index. */
603
+ indexName: string;
604
+ /** This says where the operation stands. */
605
+ status: TaskStatus;
606
+ /** Identifier of the server instance running this task; see ServerOptions.instanceId. */
607
+ owner: string;
608
+ /** The server accepted the task at this many milliseconds since the epoch. */
609
+ createdAt: number;
610
+ /** Work started at this many milliseconds since the epoch. */
611
+ startedAt?: number;
612
+ /** Work ended at this many milliseconds since the epoch, and a task omits it until it reaches a final status. */
613
+ completedAt?: number;
614
+ /** A cancel arrived at this many milliseconds since the epoch, which is how a
615
+ * task still running shows that it is stopping. */
616
+ cancelRequestedAt?: number;
617
+ /** How far the work has gone, which an import reports and other task types omit. */
618
+ progress?: TaskProgress;
619
+ /** What the work produced, which an `import` or `importExport` task reports once it finishes. */
620
+ result?: ImportResult;
621
+ /** This says why the task failed, and a failed task alone carries it. */
622
+ error?: ErrorDetail;
623
+ }
624
+ /**
625
+ * Which task records `GET /tasks` returns, and where the page starts.
626
+ *
627
+ * Every filter is optional, and omitting all of them lists every record the
628
+ * store still holds, newest first.
629
+ *
630
+ * @public
631
+ */
632
+ interface TaskListQuery {
633
+ /** Keeps the tasks running against this index. */
634
+ indexName?: string;
635
+ /** Keeps the tasks of these types. */
636
+ type?: TaskType[];
637
+ /** Keeps the tasks at these statuses. */
638
+ status?: TaskStatus[];
639
+ /** Skips this many records, and starts at the newest by default. */
640
+ from?: number;
641
+ /** The page carries this many records, and 20 by default. */
642
+ limit?: number;
643
+ }
644
+ /**
645
+ * One page of task records, ordered newest first.
646
+ *
647
+ * @public
648
+ */
649
+ interface TaskListPage {
650
+ /** The records this page carries. */
651
+ tasks: TaskRecord[];
652
+ /** How many records the filters matched in total, across every page. */
653
+ total: number;
654
+ /** This page skipped this many records. */
655
+ from: number;
656
+ /** This page asked for this many records. */
657
+ limit: number;
658
+ /** Pass this back as `from` for the next page, and it is null on the last page. */
659
+ next: number | null;
660
+ }
661
+ /**
662
+ * Pluggable backing store for task records. Every method is async so any
663
+ * backend works: an in-memory map, Redis, an HTTP key-value service, or a
664
+ * database. `set` upserts by `record.id`; `get` returns null for an unknown id.
665
+ * `ttlMs`, when honored by the backend, expires the record so terminal tasks do
666
+ * not accumulate. The server never calls a method that mutates a record it did
667
+ * not construct, so a backend may treat records as immutable snapshots.
668
+ *
669
+ * @public
670
+ */
671
+ interface TaskStore {
672
+ /**
673
+ * Stores a record, replacing whatever its id already held.
674
+ *
675
+ * @param record - The record to store.
676
+ * @param ttlMs - Milliseconds after which the backend may drop it, which
677
+ * keeps finished tasks from accumulating. Ignore it in a backend without
678
+ * expiry.
679
+ */
680
+ set(record: TaskRecord, ttlMs?: number): Promise<void>;
681
+ /**
682
+ * Reads one record back.
683
+ *
684
+ * @param id - The task to read.
685
+ * @returns The record, or `null` when the store holds no such id.
686
+ */
687
+ get(id: string): Promise<TaskRecord | null>;
688
+ /**
689
+ * Lists every record the store holds.
690
+ *
691
+ * @returns Each record the backend still has.
692
+ */
693
+ list(): Promise<TaskRecord[]>;
694
+ /**
695
+ * Removes one record. An id the store never held is not an error.
696
+ *
697
+ * @param id - The task to remove.
698
+ */
699
+ delete(id: string): Promise<void>;
700
+ /** Releases whatever the backend holds open, such as a connection pool. */
701
+ shutdown?(): Promise<void>;
702
+ }
703
+
704
+ export type { IndexStateResponse as A, BatchBody as B, CapabilitiesResponse as C, DocumentBody as D, ErrorDetail as E, MultiGetResponse as F, ReadinessResponse as G, HttpIndexConfig as H, ImportError as I, ReplicationFactorResponse as J, VectorMaintenanceResponse as K, LivenessResponse as L, MemoryStatsResponse as M, VersionResponse as N, OkResponse as O, BatchFailure as P, ClusterMemberReport as Q, RebalanceBody as R, SynonymSetBody as S, TaskListPage as T, ClusterNodeReport as U, VectorFieldBody as V, PartitionAllocationReport as W, CreateIndexEmbedding as a, ImportResult as b, TaskListQuery as c, TaskProgress as d, TaskRecord as e, TaskStatus as f, TaskType as g, TaskStore as h, CreateIndexRequest as i, InsertBody as j, MultiGetBody as k, ReplicationFactorBody as l, BatchResponse as m, ClusterAllocationResponse as n, ClusterTopologyResponse as o, DocumentCountResponse as p, DocumentExistsResponse as q, DocumentIdResponse as r, DocumentPutResponse as s, DocumentRemovedResponse as t, DocumentResponse as u, IndexClearedResponse as v, IndexCreatedResponse as w, IndexDroppedResponse as x, IndexListResponse as y, IndexPartitionsResponse as z };