@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.
- package/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/browser/chunk-26A5JFT2.mjs +89 -0
- package/dist/browser/{chunk-5D6NJD6C.mjs → chunk-2Y3CO4EQ.mjs} +342 -201
- package/dist/browser/{chunk-WLD6DDIX.mjs → chunk-AIIJDWMG.mjs} +1 -1
- package/dist/browser/{chunk-YAGXZU4W.mjs → chunk-D7WQF6DV.mjs} +2 -2
- package/dist/browser/{chunk-WZBTVTSU.mjs → chunk-M5UAAXGU.mjs} +2 -2
- package/dist/browser/{chunk-XTFJZHQP.mjs → chunk-NSCSR6MA.mjs} +15 -5
- package/dist/browser/{chunk-3NVZD52E.mjs → chunk-UDGB2MWT.mjs} +5 -28
- package/dist/browser/{chunk-II5POT55.mjs → chunk-VBBLTD7O.mjs} +4 -3
- package/dist/browser/chunk-VEGHFP2P.mjs +30 -0
- package/dist/browser/{durability-wiring-HCCC6BJB.mjs → durability-wiring-FNZSRH4N.mjs} +8 -6
- package/dist/browser/{module-S2VDU2JE.mjs → module-4HIMOQM5.mjs} +6 -5
- package/dist/browser/phrase-module-WESYVU7K.mjs +327 -0
- package/dist/browser/{restore-queue-BZ7WWEC4.mjs → restore-queue-GEZ54CA5.mjs} +1 -1
- package/dist/browser/{runtime-PL4TTFJE.mjs → runtime-3X7ZJ5T3.mjs} +2 -1
- package/dist/browser/{snapshot-RTUCHI2L.mjs → snapshot-V7VF6BN6.mjs} +25 -10
- package/dist/browser/{write-IMU7G5NU.mjs → write-YIC2MKRY.mjs} +7 -5
- package/dist/{capabilities-BTjv-tK8.d.ts → capabilities-B6WxrWxt.d.ts} +3 -10
- package/dist/{chunk-3XHFVYIQ.mjs → chunk-2C3WXBQS.mjs} +1 -1
- package/dist/{chunk-37RTD6KD.mjs → chunk-2JWNJSNE.mjs} +8 -8
- package/dist/{chunk-K76F5YYX.mjs → chunk-2MKX2SCO.mjs} +219 -58
- package/dist/{chunk-AN3CUMPZ.mjs → chunk-2SEL6SBS.mjs} +4 -95
- package/dist/{chunk-OPO5SE4J.mjs → chunk-2WBY4Y4M.mjs} +1 -1
- package/dist/{chunk-PTIJAZWL.mjs → chunk-4GDLFDPZ.mjs} +1 -1
- package/dist/chunk-4UMZ7KQL.mjs +17 -0
- package/dist/{chunk-TY64A3ZW.mjs → chunk-5LX6MOIB.mjs} +2 -2
- package/dist/{chunk-3LJVM6XM.mjs → chunk-5W7AEVTH.mjs} +2 -2
- package/dist/{chunk-PCRWCOZC.mjs → chunk-6M6SDH3S.mjs} +43 -23
- package/dist/{chunk-MGD7XETB.mjs → chunk-6SSVIW7Y.mjs} +19 -3
- package/dist/{chunk-5LC5VMDQ.mjs → chunk-7OIQ2SIO.mjs} +4 -4
- package/dist/{chunk-4XEVROSP.mjs → chunk-7XY6VD7B.mjs} +1 -1
- package/dist/{chunk-WI5Q3L43.mjs → chunk-CZ7ISLXA.mjs} +2 -0
- package/dist/{chunk-RC27KF7F.mjs → chunk-D5TFRB5G.mjs} +3 -15
- package/dist/{chunk-F4UKMTKM.mjs → chunk-EUCX5K74.mjs} +4 -4
- package/dist/{chunk-CTF6WFTX.mjs → chunk-F6AAXI7T.mjs} +3 -3
- package/dist/{chunk-DX2FI4LU.mjs → chunk-FQBFZAWG.mjs} +3 -1
- package/dist/{chunk-XTER67YM.mjs → chunk-HCGJKDZV.mjs} +1 -1
- package/dist/{chunk-WQYB4TNR.mjs → chunk-JJ6EUMXB.mjs} +2 -2
- package/dist/{chunk-2HQQ7Y5D.mjs → chunk-JT3YZGCE.mjs} +2 -2
- package/dist/chunk-JUKYYXSP.mjs +93 -0
- package/dist/{chunk-WUIDPBSY.mjs → chunk-K77FJXKS.mjs} +17 -7
- package/dist/{chunk-CSSCLRGY.mjs → chunk-NMXRXFGZ.mjs} +2 -2
- package/dist/{chunk-44TB6AIZ.mjs → chunk-NNO7CO3A.mjs} +1 -1
- package/dist/{chunk-EZIGAOUJ.mjs → chunk-OGLV4I3L.mjs} +6 -5
- package/dist/{chunk-FRSWYMXH.mjs → chunk-PATMDIMN.mjs} +1 -1
- package/dist/{chunk-AFOZR4ZQ.mjs → chunk-PU6SKH7O.mjs} +2 -2
- package/dist/{chunk-TB7YMDD5.mjs → chunk-RCMNL7RI.mjs} +650 -100
- package/dist/{chunk-Y4NOHICF.mjs → chunk-RNSC4NFI.mjs} +1 -1
- package/dist/{chunk-RYH3PASD.mjs → chunk-RWESFSJI.mjs} +21 -11
- package/dist/{chunk-QQS4QZQA.mjs → chunk-SOHMMNCH.mjs} +4 -4
- package/dist/{chunk-K73PZTBR.mjs → chunk-SZGRYEIC.mjs} +4 -4
- package/dist/{chunk-43Q7HAI2.mjs → chunk-T4OFG4IQ.mjs} +4 -4
- package/dist/{chunk-2YOAGAGF.mjs → chunk-TGHNXN7W.mjs} +59 -30
- package/dist/{chunk-J4LRE5Q7.mjs → chunk-WVRDRLIC.mjs} +6 -6
- package/dist/{chunk-XRXBCOA4.mjs → chunk-X5CNUKD5.mjs} +2 -2
- package/dist/{chunk-Y4US5EGH.mjs → chunk-Y2U5VVWX.mjs} +1 -1
- package/dist/{chunk-5VSTAJET.mjs → chunk-Y4BVTQ53.mjs} +2 -2
- package/dist/{chunk-M6MBSVIJ.mjs → chunk-ZR4VM4A6.mjs} +1 -1
- package/dist/{client-BOcveV7A.d.ts → client-gNAfaHcE.d.ts} +3 -3
- package/dist/client.d.ts +7 -8
- package/dist/client.mjs +2 -0
- package/dist/{config-CPmIY3aH.d.ts → config-CmYJO34X.d.ts} +3 -3
- package/dist/{events-pM0lna7M.d.ts → config-D1cDv3sE.d.ts} +431 -3
- package/dist/direct-executor-HQ4QVDX7.mjs +28 -0
- 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 +7 -8
- package/dist/distribution.mjs +85 -45
- package/dist/{durability-wiring-6R26AJDI.mjs → durability-wiring-S7OX2MAI.mjs} +27 -25
- package/dist/embeddings/openai.mjs +2 -2
- package/dist/{engine-JjRAXpT3.d.ts → engine-m_Ddr1bz.d.ts} +2 -2
- package/dist/{index-DkQ2DlgR.d.ts → index-HYnqS1SE.d.ts} +2 -2
- package/dist/index.browser.mjs +5 -3
- package/dist/index.d.ts +6 -7
- package/dist/index.mjs +20 -18
- package/dist/{long-query-thread-6VLA6YJI.mjs → long-query-thread-BSL25PD6.mjs} +17 -15
- package/dist/{module-S4WGMFNW.mjs → module-2E4XYSGT.mjs} +11 -11
- package/dist/partial-words.mjs +7 -6
- package/dist/pattern.mjs +4 -3
- package/dist/persistence/durability/checkpoint-worker.d.ts +2 -1
- package/dist/persistence/durability/checkpoint-worker.mjs +23 -21
- package/dist/phrase-module-JERF2IDG.mjs +329 -0
- package/dist/react.d.ts +11 -8
- package/dist/react.mjs +2 -0
- package/dist/{rerank-V4J4MIWR.mjs → rerank-DMMT4FZA.mjs} +6 -6
- package/dist/rerankers/http.mjs +2 -2
- package/dist/{restore-queue-PUGWCPCX.mjs → restore-queue-JAMNRC6T.mjs} +1 -1
- package/dist/{runtime-TBFBQQQO.mjs → runtime-7MLQ7J64.mjs} +7 -7
- package/dist/{schema-DGAP_8HJ.d.ts → schema-BTXbHCqA.d.ts} +8 -5
- package/dist/server.d.ts +198 -11
- package/dist/server.mjs +30 -19
- package/dist/{snapshot-PUVSMV7E.mjs → snapshot-DOQLGGEX.mjs} +44 -29
- package/dist/synonyms.mjs +4 -3
- package/dist/tasks-Co8HfRD7.d.ts +704 -0
- package/dist/{thread-TA7QQBWP.mjs → thread-SKO7CN3R.mjs} +16 -14
- package/dist/vector/search-worker.d.ts +1 -1
- package/dist/vector/search-worker.mjs +4 -4
- package/dist/workers/entry.mjs +7 -7
- package/dist/{write-TGKYT3C4.mjs → write-ZKR7SNRT.mjs} +22 -20
- package/openapi.json +5215 -0
- package/package.json +16 -8
- package/dist/config-C3YXk5Rn.d.ts +0 -412
- package/dist/direct-executor-ULA6V5HC.mjs +0 -26
- package/dist/tasks-txGvNz6h.d.ts +0 -302
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { readRecentMemoryFigures, readMemoryFigures, answerRefusalOf } from './chunk-
|
|
1
|
+
import { readRecentMemoryFigures, readMemoryFigures, answerRefusalOf } from './chunk-4GDLFDPZ.mjs';
|
|
2
2
|
import { collectGarbageBeforeRefusal, collectYoungGenerationBeforeRefusal, reportRefusalAfterCollection, reservedHeapBytes, admitHeapBytes } from './chunk-IWVEG5CX.mjs';
|
|
3
3
|
import { nativeSearchCoreIsEnabled } from './chunk-DJHHF2L5.mjs';
|
|
4
4
|
import { DEFAULT_RERANK_WINDOW } from './chunk-HJSN7UYG.mjs';
|
|
5
|
-
import { loadNativeCore } from './chunk-
|
|
5
|
+
import { loadNativeCore } from './chunk-2C3WXBQS.mjs';
|
|
6
6
|
import { MAX_FILTER_DEPTH } from './chunk-WQBCBKY3.mjs';
|
|
7
|
-
import { MAX_SORT_FIELDS } from './chunk-
|
|
7
|
+
import { MAX_SORT_FIELDS } from './chunk-FQBFZAWG.mjs';
|
|
8
8
|
import { HEAP_BLOCK_FRACTION_BELOW_V8_INEFFECTIVE_MARK_COMPACT_LINE } from './chunk-22YPZVMG.mjs';
|
|
9
|
-
import { NarsilError, ServerErrorCodes, ErrorCodes } from './chunk-
|
|
9
|
+
import { NarsilError, ServerErrorCodes, ErrorCodes } from './chunk-CZ7ISLXA.mjs';
|
|
10
10
|
import { randomUUID } from 'crypto';
|
|
11
11
|
import { mkdtemp, open, rm } from 'fs/promises';
|
|
12
12
|
import { tmpdir } from 'os';
|
|
@@ -181,6 +181,8 @@ var STATUS_BY_CODE = {
|
|
|
181
181
|
SEARCH_INVALID_CURSOR: 400,
|
|
182
182
|
SEARCH_RESULT_WINDOW_EXCEEDED: 400,
|
|
183
183
|
SEARCH_WORK_CAP_EXCEEDED: 400,
|
|
184
|
+
SEARCH_INVALID_PHRASE: 400,
|
|
185
|
+
SEARCH_PHRASE_NOT_READY: 503,
|
|
184
186
|
LANGUAGE_NOT_SUPPORTED: 400,
|
|
185
187
|
CONFIG_INVALID: 400,
|
|
186
188
|
EMBEDDING_DIMENSION_MISMATCH: 400,
|
|
@@ -296,6 +298,7 @@ var DEFAULT_MAX_RESTORE_BYTES = 64 * 1024 * BYTES_PER_MB;
|
|
|
296
298
|
var SPOOL_PAUSE_ABOVE_BYTES = 8 * BYTES_PER_MB;
|
|
297
299
|
var SNAPSHOT_ARCHIVE_CONTENT_TYPE = "application/x-tar";
|
|
298
300
|
var DOCUMENT_EXPORT_CONTENT_TYPE = "application/x-ndjson";
|
|
301
|
+
var PROMETHEUS_TEXT_CONTENT_TYPE = "text/plain; version=0.0.4; charset=utf-8";
|
|
299
302
|
var RELAY_STREAM_CHUNKS_IN_FLIGHT = 4;
|
|
300
303
|
var DEFAULT_MAX_LINE_BYTES = 4 * BYTES_PER_MB;
|
|
301
304
|
var DEFAULT_IMPORT_BATCH_SIZE = 1e3;
|
|
@@ -1103,7 +1106,8 @@ function createDocumentReadHandlers(deps) {
|
|
|
1103
1106
|
const found = await engine.getMultiple(ctx.params[0], body.docIds);
|
|
1104
1107
|
const documents = {};
|
|
1105
1108
|
for (const [id, doc] of found) documents[id] = doc;
|
|
1106
|
-
|
|
1109
|
+
const answer = { documents };
|
|
1110
|
+
await respondAnswer(ctx, answer, "documents", `a multi-get on index '${ctx.params[0]}'`);
|
|
1107
1111
|
} catch (err) {
|
|
1108
1112
|
respondError(ctx, err);
|
|
1109
1113
|
}
|
|
@@ -1266,9 +1270,15 @@ function spoolBody(res, maxBytes, abort, admitted2) {
|
|
|
1266
1270
|
paused: true,
|
|
1267
1271
|
done: false
|
|
1268
1272
|
};
|
|
1273
|
+
const resumeReading = () => {
|
|
1274
|
+
if (!state.paused || abort.aborted) return;
|
|
1275
|
+
state.paused = false;
|
|
1276
|
+
res.resume();
|
|
1277
|
+
};
|
|
1269
1278
|
const fail = (error, answer) => {
|
|
1270
1279
|
if (state.done) return;
|
|
1271
1280
|
state.done = true;
|
|
1281
|
+
resumeReading();
|
|
1272
1282
|
if (answer && !abort.aborted) {
|
|
1273
1283
|
sendError(res, 500, ServerErrorCodes.INTERNAL_ERROR, "The server could not store the request body");
|
|
1274
1284
|
}
|
|
@@ -1286,10 +1296,7 @@ function spoolBody(res, maxBytes, abort, admitted2) {
|
|
|
1286
1296
|
if (!await admitted2) throw new NotAdmittedError("the request was not admitted");
|
|
1287
1297
|
state.directory = await mkdtemp(path.join(tmpdir(), "narsil-spool-"));
|
|
1288
1298
|
state.handle = await open(path.join(state.directory, "body"), "w");
|
|
1289
|
-
if (!
|
|
1290
|
-
state.paused = false;
|
|
1291
|
-
res.resume();
|
|
1292
|
-
}
|
|
1299
|
+
if (!state.done && state.queued <= SPOOL_PAUSE_ABOVE_BYTES) resumeReading();
|
|
1293
1300
|
})();
|
|
1294
1301
|
state.chain.catch(failFromChain);
|
|
1295
1302
|
abort.onAbort(() => fail(new Error("aborted"), false));
|
|
@@ -1297,6 +1304,7 @@ function spoolBody(res, maxBytes, abort, admitted2) {
|
|
|
1297
1304
|
if (state.done || abort.aborted) return;
|
|
1298
1305
|
state.total += chunk.byteLength;
|
|
1299
1306
|
if (maxBytes > 0 && state.total > maxBytes) {
|
|
1307
|
+
resumeReading();
|
|
1300
1308
|
sendError(res, 413, ServerErrorCodes.PAYLOAD_TOO_LARGE, "Request body exceeds the configured size limit");
|
|
1301
1309
|
fail(new Error("payload too large"), false);
|
|
1302
1310
|
return;
|
|
@@ -1311,10 +1319,7 @@ function spoolBody(res, maxBytes, abort, admitted2) {
|
|
|
1311
1319
|
if (state.handle === null) throw new Error("the spool file is not open");
|
|
1312
1320
|
await state.handle.write(copy);
|
|
1313
1321
|
state.queued -= copy.byteLength;
|
|
1314
|
-
if (state.
|
|
1315
|
-
state.paused = false;
|
|
1316
|
-
res.resume();
|
|
1317
|
-
}
|
|
1322
|
+
if (!state.done && state.queued <= SPOOL_PAUSE_ABOVE_BYTES) resumeReading();
|
|
1318
1323
|
});
|
|
1319
1324
|
state.chain.catch(failFromChain);
|
|
1320
1325
|
if (!isLast) return;
|
|
@@ -1540,6 +1545,608 @@ function createRouteRunner(deps) {
|
|
|
1540
1545
|
};
|
|
1541
1546
|
}
|
|
1542
1547
|
|
|
1548
|
+
// src/server/routes/documents.ts
|
|
1549
|
+
function documentRoutes(shared) {
|
|
1550
|
+
const { named, document, writeBody, readBody: readBody2, batchBody, importBody, documentWriteBody } = shared;
|
|
1551
|
+
return [
|
|
1552
|
+
{
|
|
1553
|
+
method: "post",
|
|
1554
|
+
path: "/indexes/:name/documents",
|
|
1555
|
+
handler: "insert",
|
|
1556
|
+
options: writeBody,
|
|
1557
|
+
operationId: "insert",
|
|
1558
|
+
summary: "Insert one document",
|
|
1559
|
+
tags: ["Documents"],
|
|
1560
|
+
request: "InsertBody",
|
|
1561
|
+
responses: { 201: "DocumentIdResponse" }
|
|
1562
|
+
},
|
|
1563
|
+
{
|
|
1564
|
+
method: "post",
|
|
1565
|
+
path: "/indexes/:name/documents/_batch",
|
|
1566
|
+
handler: "batch",
|
|
1567
|
+
options: batchBody,
|
|
1568
|
+
operationId: "writeBatch",
|
|
1569
|
+
summary: "Insert, update, or remove many documents, with a result for each",
|
|
1570
|
+
tags: ["Documents"],
|
|
1571
|
+
request: "BatchBody",
|
|
1572
|
+
responses: { 200: "BatchResponse" }
|
|
1573
|
+
},
|
|
1574
|
+
{
|
|
1575
|
+
method: "post",
|
|
1576
|
+
path: "/indexes/:name/documents/_list",
|
|
1577
|
+
handler: "list",
|
|
1578
|
+
options: readBody2,
|
|
1579
|
+
operationId: "listDocuments",
|
|
1580
|
+
summary: "Read one page of stored documents",
|
|
1581
|
+
tags: ["Documents"],
|
|
1582
|
+
request: "ListParams",
|
|
1583
|
+
responses: { 200: "ListResult" },
|
|
1584
|
+
repeatable: true
|
|
1585
|
+
},
|
|
1586
|
+
{
|
|
1587
|
+
method: "post",
|
|
1588
|
+
path: "/indexes/:name/documents/_multi-get",
|
|
1589
|
+
handler: "multiGet",
|
|
1590
|
+
options: readBody2,
|
|
1591
|
+
operationId: "getMultiple",
|
|
1592
|
+
summary: "Fetch many documents by id",
|
|
1593
|
+
tags: ["Documents"],
|
|
1594
|
+
request: "MultiGetBody",
|
|
1595
|
+
responses: { 200: "MultiGetResponse" },
|
|
1596
|
+
repeatable: true
|
|
1597
|
+
},
|
|
1598
|
+
{
|
|
1599
|
+
method: "post",
|
|
1600
|
+
path: "/indexes/:name/documents/_import",
|
|
1601
|
+
handler: "importNdjson",
|
|
1602
|
+
options: importBody,
|
|
1603
|
+
operationId: "importNdjson",
|
|
1604
|
+
summary: "Load newline-delimited documents, inside the request or as a task",
|
|
1605
|
+
tags: ["Documents"],
|
|
1606
|
+
request: { contentType: DOCUMENT_EXPORT_CONTENT_TYPE },
|
|
1607
|
+
query: "ImportDocumentsQuery",
|
|
1608
|
+
responses: { 200: "ImportResult", 202: "TaskRecord" }
|
|
1609
|
+
},
|
|
1610
|
+
{
|
|
1611
|
+
method: "post",
|
|
1612
|
+
path: "/indexes/:name/_wait-for-writes",
|
|
1613
|
+
handler: "waitForWrites",
|
|
1614
|
+
options: named,
|
|
1615
|
+
operationId: "waitForWrites",
|
|
1616
|
+
summary: "Wait until every worker copy has applied the writes that returned before this request",
|
|
1617
|
+
tags: ["Documents"],
|
|
1618
|
+
request: null,
|
|
1619
|
+
responses: { 200: "OkResponse" }
|
|
1620
|
+
},
|
|
1621
|
+
{
|
|
1622
|
+
method: "get",
|
|
1623
|
+
path: "/indexes/:name/documents/:id",
|
|
1624
|
+
handler: "get",
|
|
1625
|
+
options: document,
|
|
1626
|
+
operationId: "get",
|
|
1627
|
+
summary: "Read one document",
|
|
1628
|
+
tags: ["Documents"],
|
|
1629
|
+
request: null,
|
|
1630
|
+
responses: { 200: "DocumentResponse" }
|
|
1631
|
+
},
|
|
1632
|
+
{
|
|
1633
|
+
method: "get",
|
|
1634
|
+
path: "/indexes/:name/documents/:id/_exists",
|
|
1635
|
+
handler: "exists",
|
|
1636
|
+
options: document,
|
|
1637
|
+
operationId: "has",
|
|
1638
|
+
summary: "Report whether an index holds a document with the id",
|
|
1639
|
+
tags: ["Documents"],
|
|
1640
|
+
request: null,
|
|
1641
|
+
responses: { 200: "DocumentExistsResponse" }
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
method: "put",
|
|
1645
|
+
path: "/indexes/:name/documents/:id",
|
|
1646
|
+
handler: "put",
|
|
1647
|
+
options: documentWriteBody,
|
|
1648
|
+
operationId: "put",
|
|
1649
|
+
summary: "Write one document under the id, whether or not the id exists",
|
|
1650
|
+
tags: ["Documents"],
|
|
1651
|
+
request: "DocumentBody",
|
|
1652
|
+
responses: { 200: "DocumentPutResponse", 201: "DocumentPutResponse" }
|
|
1653
|
+
},
|
|
1654
|
+
{
|
|
1655
|
+
method: "patch",
|
|
1656
|
+
path: "/indexes/:name/documents/:id",
|
|
1657
|
+
handler: "patch",
|
|
1658
|
+
options: documentWriteBody,
|
|
1659
|
+
operationId: "update",
|
|
1660
|
+
summary: "Update one existing document",
|
|
1661
|
+
tags: ["Documents"],
|
|
1662
|
+
request: "DocumentBody",
|
|
1663
|
+
responses: { 200: "DocumentIdResponse" }
|
|
1664
|
+
},
|
|
1665
|
+
{
|
|
1666
|
+
method: "del",
|
|
1667
|
+
path: "/indexes/:name/documents/:id",
|
|
1668
|
+
handler: "remove",
|
|
1669
|
+
options: document,
|
|
1670
|
+
operationId: "remove",
|
|
1671
|
+
summary: "Remove one document",
|
|
1672
|
+
tags: ["Documents"],
|
|
1673
|
+
request: null,
|
|
1674
|
+
query: "RemoveDocumentQuery",
|
|
1675
|
+
responses: { 200: "DocumentRemovedResponse" }
|
|
1676
|
+
}
|
|
1677
|
+
];
|
|
1678
|
+
}
|
|
1679
|
+
function searchRoutes(shared) {
|
|
1680
|
+
const { readBody: readBody2 } = shared;
|
|
1681
|
+
return [
|
|
1682
|
+
{
|
|
1683
|
+
method: "post",
|
|
1684
|
+
path: "/indexes/:name/search",
|
|
1685
|
+
handler: "search",
|
|
1686
|
+
options: readBody2,
|
|
1687
|
+
operationId: "query",
|
|
1688
|
+
summary: "Search an index",
|
|
1689
|
+
tags: ["Search"],
|
|
1690
|
+
request: "HttpQueryParams",
|
|
1691
|
+
responses: { 200: "HttpQueryResult" },
|
|
1692
|
+
repeatable: true
|
|
1693
|
+
},
|
|
1694
|
+
{
|
|
1695
|
+
method: "post",
|
|
1696
|
+
path: "/indexes/:name/search/preflight",
|
|
1697
|
+
handler: "preflight",
|
|
1698
|
+
options: readBody2,
|
|
1699
|
+
operationId: "preflight",
|
|
1700
|
+
summary: "Count the documents that a search matches, with no hits",
|
|
1701
|
+
tags: ["Search"],
|
|
1702
|
+
request: "HttpQueryParams",
|
|
1703
|
+
responses: { 200: "PreflightResult" },
|
|
1704
|
+
repeatable: true
|
|
1705
|
+
},
|
|
1706
|
+
{
|
|
1707
|
+
method: "post",
|
|
1708
|
+
path: "/indexes/:name/suggest",
|
|
1709
|
+
handler: "suggest",
|
|
1710
|
+
options: readBody2,
|
|
1711
|
+
operationId: "suggest",
|
|
1712
|
+
summary: "Complete a prefix from the terms of an index",
|
|
1713
|
+
tags: ["Search"],
|
|
1714
|
+
request: "SuggestParams",
|
|
1715
|
+
responses: { 200: "SuggestResult" },
|
|
1716
|
+
repeatable: true
|
|
1717
|
+
}
|
|
1718
|
+
];
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
// src/server/routes/indexes.ts
|
|
1722
|
+
function indexRoutes(shared) {
|
|
1723
|
+
const { bare, named, namedBody, newIndexBody } = shared;
|
|
1724
|
+
return [
|
|
1725
|
+
{
|
|
1726
|
+
method: "post",
|
|
1727
|
+
path: "/indexes",
|
|
1728
|
+
handler: "createIndex",
|
|
1729
|
+
options: newIndexBody,
|
|
1730
|
+
operationId: "createIndex",
|
|
1731
|
+
summary: "Create an index",
|
|
1732
|
+
tags: ["Indexes"],
|
|
1733
|
+
request: "HttpCreateIndexBody",
|
|
1734
|
+
responses: { 201: "IndexCreatedResponse" }
|
|
1735
|
+
},
|
|
1736
|
+
{
|
|
1737
|
+
method: "get",
|
|
1738
|
+
path: "/indexes",
|
|
1739
|
+
handler: "listIndexes",
|
|
1740
|
+
options: bare,
|
|
1741
|
+
operationId: "listIndexes",
|
|
1742
|
+
summary: "List every index",
|
|
1743
|
+
tags: ["Indexes"],
|
|
1744
|
+
request: null,
|
|
1745
|
+
responses: { 200: "IndexListResponse" }
|
|
1746
|
+
},
|
|
1747
|
+
{
|
|
1748
|
+
method: "del",
|
|
1749
|
+
path: "/indexes/:name",
|
|
1750
|
+
handler: "dropIndex",
|
|
1751
|
+
options: named,
|
|
1752
|
+
operationId: "dropIndex",
|
|
1753
|
+
summary: "Drop an index",
|
|
1754
|
+
tags: ["Indexes"],
|
|
1755
|
+
request: null,
|
|
1756
|
+
responses: { 200: "IndexDroppedResponse" }
|
|
1757
|
+
},
|
|
1758
|
+
{
|
|
1759
|
+
method: "get",
|
|
1760
|
+
path: "/indexes/:name/stats",
|
|
1761
|
+
handler: "indexStats",
|
|
1762
|
+
options: named,
|
|
1763
|
+
operationId: "getStats",
|
|
1764
|
+
summary: "Report the statistics of an index",
|
|
1765
|
+
tags: ["Indexes"],
|
|
1766
|
+
request: null,
|
|
1767
|
+
responses: { 200: "IndexStats" }
|
|
1768
|
+
},
|
|
1769
|
+
{
|
|
1770
|
+
method: "get",
|
|
1771
|
+
path: "/indexes/:name/partitions",
|
|
1772
|
+
handler: "indexPartitions",
|
|
1773
|
+
options: named,
|
|
1774
|
+
operationId: "getPartitionStats",
|
|
1775
|
+
summary: "Report the statistics of each partition of an index",
|
|
1776
|
+
tags: ["Indexes"],
|
|
1777
|
+
request: null,
|
|
1778
|
+
responses: { 200: "IndexPartitionsResponse" }
|
|
1779
|
+
},
|
|
1780
|
+
{
|
|
1781
|
+
method: "get",
|
|
1782
|
+
path: "/indexes/:name/cluster",
|
|
1783
|
+
handler: "clusterAllocation",
|
|
1784
|
+
options: named,
|
|
1785
|
+
operationId: "getIndexAllocation",
|
|
1786
|
+
summary: "Report how the cluster has placed the partitions of an index",
|
|
1787
|
+
tags: ["Cluster"],
|
|
1788
|
+
request: null,
|
|
1789
|
+
responses: { 200: "ClusterAllocationResponse" }
|
|
1790
|
+
},
|
|
1791
|
+
{
|
|
1792
|
+
method: "put",
|
|
1793
|
+
path: "/indexes/:name/replication-factor",
|
|
1794
|
+
handler: "clusterReplicationFactor",
|
|
1795
|
+
options: namedBody,
|
|
1796
|
+
operationId: "setReplicationFactor",
|
|
1797
|
+
summary: "Change how many replicas each partition of an index keeps",
|
|
1798
|
+
tags: ["Cluster"],
|
|
1799
|
+
request: "ReplicationFactorBody",
|
|
1800
|
+
responses: { 200: "ReplicationFactorResponse" }
|
|
1801
|
+
},
|
|
1802
|
+
{
|
|
1803
|
+
method: "post",
|
|
1804
|
+
path: "/indexes/:name/_clear",
|
|
1805
|
+
handler: "clearIndex",
|
|
1806
|
+
options: named,
|
|
1807
|
+
operationId: "clear",
|
|
1808
|
+
summary: "Remove every document and keep the index",
|
|
1809
|
+
tags: ["Indexes"],
|
|
1810
|
+
request: null,
|
|
1811
|
+
responses: { 200: "IndexClearedResponse" }
|
|
1812
|
+
},
|
|
1813
|
+
{
|
|
1814
|
+
method: "post",
|
|
1815
|
+
path: "/indexes/:name/_open",
|
|
1816
|
+
handler: "openIndex",
|
|
1817
|
+
options: named,
|
|
1818
|
+
operationId: "open",
|
|
1819
|
+
summary: "Load an index into memory",
|
|
1820
|
+
tags: ["Indexes"],
|
|
1821
|
+
request: null,
|
|
1822
|
+
responses: { 200: "IndexStateResponse" }
|
|
1823
|
+
},
|
|
1824
|
+
{
|
|
1825
|
+
method: "post",
|
|
1826
|
+
path: "/indexes/:name/_close",
|
|
1827
|
+
handler: "closeIndex",
|
|
1828
|
+
options: named,
|
|
1829
|
+
operationId: "close",
|
|
1830
|
+
summary: "Release the memory of an index",
|
|
1831
|
+
tags: ["Indexes"],
|
|
1832
|
+
request: null,
|
|
1833
|
+
responses: { 200: "IndexStateResponse" }
|
|
1834
|
+
},
|
|
1835
|
+
{
|
|
1836
|
+
method: "get",
|
|
1837
|
+
path: "/indexes/:name/count",
|
|
1838
|
+
handler: "count",
|
|
1839
|
+
options: named,
|
|
1840
|
+
operationId: "countDocuments",
|
|
1841
|
+
summary: "Count the documents in an index",
|
|
1842
|
+
tags: ["Indexes"],
|
|
1843
|
+
request: null,
|
|
1844
|
+
responses: { 200: "DocumentCountResponse" }
|
|
1845
|
+
}
|
|
1846
|
+
];
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
// src/server/routes/info.ts
|
|
1850
|
+
function infoRoutes(shared) {
|
|
1851
|
+
const { probe, bare, named } = shared;
|
|
1852
|
+
return [
|
|
1853
|
+
{
|
|
1854
|
+
method: "get",
|
|
1855
|
+
path: "/livez",
|
|
1856
|
+
handler: "livez",
|
|
1857
|
+
options: probe,
|
|
1858
|
+
operationId: "isAlive",
|
|
1859
|
+
summary: "Report that the process can serve HTTP",
|
|
1860
|
+
tags: ["Server"],
|
|
1861
|
+
request: null,
|
|
1862
|
+
responses: { 200: "LivenessResponse" }
|
|
1863
|
+
},
|
|
1864
|
+
{
|
|
1865
|
+
method: "get",
|
|
1866
|
+
path: "/readyz",
|
|
1867
|
+
handler: "readyz",
|
|
1868
|
+
options: probe,
|
|
1869
|
+
operationId: "isReady",
|
|
1870
|
+
summary: "Report whether the server can take requests",
|
|
1871
|
+
tags: ["Server"],
|
|
1872
|
+
request: null,
|
|
1873
|
+
responses: { 200: "ReadinessResponse", 503: "ReadinessResponse" }
|
|
1874
|
+
},
|
|
1875
|
+
{
|
|
1876
|
+
method: "get",
|
|
1877
|
+
path: "/health",
|
|
1878
|
+
handler: "readyz",
|
|
1879
|
+
options: probe,
|
|
1880
|
+
operationId: "health",
|
|
1881
|
+
summary: "Report whether the server can take requests, as /readyz does",
|
|
1882
|
+
tags: ["Server"],
|
|
1883
|
+
request: null,
|
|
1884
|
+
responses: { 200: "ReadinessResponse", 503: "ReadinessResponse" }
|
|
1885
|
+
},
|
|
1886
|
+
{
|
|
1887
|
+
method: "get",
|
|
1888
|
+
path: "/version",
|
|
1889
|
+
handler: "version",
|
|
1890
|
+
options: probe,
|
|
1891
|
+
operationId: "version",
|
|
1892
|
+
summary: "Report the build identity of the server",
|
|
1893
|
+
tags: ["Server"],
|
|
1894
|
+
request: null,
|
|
1895
|
+
responses: { 200: "VersionResponse" }
|
|
1896
|
+
},
|
|
1897
|
+
{
|
|
1898
|
+
method: "get",
|
|
1899
|
+
path: "/capabilities",
|
|
1900
|
+
handler: "capabilities",
|
|
1901
|
+
options: probe,
|
|
1902
|
+
operationId: "capabilities",
|
|
1903
|
+
summary: "List the optional routes and modes that this server serves",
|
|
1904
|
+
tags: ["Server"],
|
|
1905
|
+
request: null,
|
|
1906
|
+
responses: { 200: "CapabilitiesResponse" }
|
|
1907
|
+
},
|
|
1908
|
+
{
|
|
1909
|
+
method: "get",
|
|
1910
|
+
path: "/cluster",
|
|
1911
|
+
handler: "clusterTopology",
|
|
1912
|
+
options: bare,
|
|
1913
|
+
operationId: "getClusterTopology",
|
|
1914
|
+
summary: "Report the nodes of the cluster and the controller",
|
|
1915
|
+
tags: ["Cluster"],
|
|
1916
|
+
request: null,
|
|
1917
|
+
responses: { 200: "ClusterTopologyResponse" }
|
|
1918
|
+
},
|
|
1919
|
+
{
|
|
1920
|
+
method: "get",
|
|
1921
|
+
path: "/cluster/health",
|
|
1922
|
+
handler: "clusterHealth",
|
|
1923
|
+
options: bare,
|
|
1924
|
+
operationId: "getClusterHealth",
|
|
1925
|
+
summary: "Report a green, yellow, or red status for the cluster and each index",
|
|
1926
|
+
tags: ["Cluster"],
|
|
1927
|
+
request: null,
|
|
1928
|
+
responses: { 200: "ClusterHealth" }
|
|
1929
|
+
},
|
|
1930
|
+
{
|
|
1931
|
+
method: "get",
|
|
1932
|
+
path: "/metrics",
|
|
1933
|
+
handler: "metrics",
|
|
1934
|
+
options: bare,
|
|
1935
|
+
operationId: "getMetrics",
|
|
1936
|
+
summary: "Report the replication and coordinator figures in the Prometheus text format",
|
|
1937
|
+
tags: ["Cluster"],
|
|
1938
|
+
request: null,
|
|
1939
|
+
responses: { 200: { contentType: PROMETHEUS_TEXT_CONTENT_TYPE } }
|
|
1940
|
+
},
|
|
1941
|
+
{
|
|
1942
|
+
method: "get",
|
|
1943
|
+
path: "/stats/memory",
|
|
1944
|
+
handler: "memory",
|
|
1945
|
+
options: bare,
|
|
1946
|
+
operationId: "getMemoryStats",
|
|
1947
|
+
summary: "Report the memory that the engine and the server use",
|
|
1948
|
+
tags: ["Server"],
|
|
1949
|
+
request: null,
|
|
1950
|
+
responses: { 200: "MemoryStatsResponse" }
|
|
1951
|
+
},
|
|
1952
|
+
{
|
|
1953
|
+
method: "get",
|
|
1954
|
+
path: "/tasks",
|
|
1955
|
+
handler: "listTasks",
|
|
1956
|
+
options: bare,
|
|
1957
|
+
operationId: "listTasks",
|
|
1958
|
+
summary: "List task records, newest first",
|
|
1959
|
+
tags: ["Tasks"],
|
|
1960
|
+
request: null,
|
|
1961
|
+
query: "TaskListQuery",
|
|
1962
|
+
responses: { 200: "TaskListPage" }
|
|
1963
|
+
},
|
|
1964
|
+
{
|
|
1965
|
+
method: "get",
|
|
1966
|
+
path: "/tasks/:id",
|
|
1967
|
+
handler: "getTask",
|
|
1968
|
+
options: named,
|
|
1969
|
+
operationId: "getTask",
|
|
1970
|
+
summary: "Read one task record",
|
|
1971
|
+
tags: ["Tasks"],
|
|
1972
|
+
request: null,
|
|
1973
|
+
responses: { 200: "TaskRecord" }
|
|
1974
|
+
},
|
|
1975
|
+
{
|
|
1976
|
+
method: "post",
|
|
1977
|
+
path: "/tasks/:id/_cancel",
|
|
1978
|
+
handler: "cancelTask",
|
|
1979
|
+
options: named,
|
|
1980
|
+
operationId: "cancelTask",
|
|
1981
|
+
summary: "Ask a running task to stop",
|
|
1982
|
+
tags: ["Tasks"],
|
|
1983
|
+
request: null,
|
|
1984
|
+
responses: { 202: "TaskRecord" }
|
|
1985
|
+
}
|
|
1986
|
+
];
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
// src/server/routes/maintenance.ts
|
|
1990
|
+
function maintenanceRoutes(shared) {
|
|
1991
|
+
const { named, namedBody, spooledBody } = shared;
|
|
1992
|
+
return [
|
|
1993
|
+
{
|
|
1994
|
+
method: "post",
|
|
1995
|
+
path: "/indexes/:name/_checkpoint",
|
|
1996
|
+
handler: "checkpoint",
|
|
1997
|
+
options: named,
|
|
1998
|
+
operationId: "checkpoint",
|
|
1999
|
+
summary: "Force a checkpoint of an index",
|
|
2000
|
+
tags: ["Maintenance"],
|
|
2001
|
+
request: null,
|
|
2002
|
+
responses: { 200: "OkResponse" }
|
|
2003
|
+
},
|
|
2004
|
+
{
|
|
2005
|
+
method: "post",
|
|
2006
|
+
path: "/indexes/:name/_rebuild-analysis",
|
|
2007
|
+
handler: "rebuildAnalysis",
|
|
2008
|
+
options: named,
|
|
2009
|
+
operationId: "rebuildAnalysis",
|
|
2010
|
+
summary: "Reanalyse every document of an index, as a task",
|
|
2011
|
+
tags: ["Maintenance"],
|
|
2012
|
+
request: null,
|
|
2013
|
+
responses: { 202: "TaskRecord" }
|
|
2014
|
+
},
|
|
2015
|
+
{
|
|
2016
|
+
method: "get",
|
|
2017
|
+
path: "/indexes/:name/snapshot",
|
|
2018
|
+
handler: "snapshot",
|
|
2019
|
+
options: named,
|
|
2020
|
+
operationId: "snapshot",
|
|
2021
|
+
summary: "Stream a snapshot archive of an index",
|
|
2022
|
+
tags: ["Maintenance"],
|
|
2023
|
+
request: null,
|
|
2024
|
+
responses: { 200: { contentType: SNAPSHOT_ARCHIVE_CONTENT_TYPE } }
|
|
2025
|
+
},
|
|
2026
|
+
{
|
|
2027
|
+
method: "get",
|
|
2028
|
+
path: "/indexes/:name/vector-maintenance",
|
|
2029
|
+
handler: "vectorMaintenance",
|
|
2030
|
+
options: named,
|
|
2031
|
+
operationId: "vectorMaintenanceStatus",
|
|
2032
|
+
summary: "Report the state of each vector field of an index",
|
|
2033
|
+
tags: ["Maintenance"],
|
|
2034
|
+
request: null,
|
|
2035
|
+
responses: { 200: "VectorMaintenanceResponse" }
|
|
2036
|
+
},
|
|
2037
|
+
{
|
|
2038
|
+
method: "post",
|
|
2039
|
+
path: "/indexes/:name/vectors/_compact",
|
|
2040
|
+
handler: "compact",
|
|
2041
|
+
options: namedBody,
|
|
2042
|
+
operationId: "compactVectors",
|
|
2043
|
+
summary: "Compact the vector fields of an index",
|
|
2044
|
+
tags: ["Maintenance"],
|
|
2045
|
+
request: { optional: "VectorFieldBody" },
|
|
2046
|
+
responses: { 200: "OkResponse" }
|
|
2047
|
+
},
|
|
2048
|
+
{
|
|
2049
|
+
method: "post",
|
|
2050
|
+
path: "/indexes/:name/vectors/_optimize",
|
|
2051
|
+
handler: "optimize",
|
|
2052
|
+
options: namedBody,
|
|
2053
|
+
operationId: "optimizeVectors",
|
|
2054
|
+
summary: "Rebuild the vector graphs of an index, as a task",
|
|
2055
|
+
tags: ["Maintenance"],
|
|
2056
|
+
request: { optional: "VectorFieldBody" },
|
|
2057
|
+
responses: { 202: "TaskRecord" }
|
|
2058
|
+
},
|
|
2059
|
+
{
|
|
2060
|
+
method: "post",
|
|
2061
|
+
path: "/indexes/:name/_rebalance",
|
|
2062
|
+
handler: "rebalance",
|
|
2063
|
+
options: namedBody,
|
|
2064
|
+
operationId: "rebalance",
|
|
2065
|
+
summary: "Move an index to another partition count, as a task",
|
|
2066
|
+
tags: ["Maintenance"],
|
|
2067
|
+
request: "RebalanceBody",
|
|
2068
|
+
responses: { 202: "TaskRecord" }
|
|
2069
|
+
},
|
|
2070
|
+
{
|
|
2071
|
+
method: "post",
|
|
2072
|
+
path: "/indexes/:name/partition-config",
|
|
2073
|
+
handler: "partitionConfig",
|
|
2074
|
+
options: namedBody,
|
|
2075
|
+
operationId: "updatePartitionConfig",
|
|
2076
|
+
summary: "Change the partition settings of an index",
|
|
2077
|
+
tags: ["Maintenance"],
|
|
2078
|
+
request: { optional: "PartitionConfig" },
|
|
2079
|
+
responses: { 200: "OkResponse" }
|
|
2080
|
+
},
|
|
2081
|
+
{
|
|
2082
|
+
method: "get",
|
|
2083
|
+
path: "/indexes/:name/synonyms",
|
|
2084
|
+
handler: "readSynonyms",
|
|
2085
|
+
options: named,
|
|
2086
|
+
operationId: "getSynonyms",
|
|
2087
|
+
summary: "Read the synonym set of an index",
|
|
2088
|
+
tags: ["Maintenance"],
|
|
2089
|
+
request: null,
|
|
2090
|
+
responses: { 200: "SynonymSetBody" }
|
|
2091
|
+
},
|
|
2092
|
+
{
|
|
2093
|
+
method: "post",
|
|
2094
|
+
path: "/indexes/:name/synonyms",
|
|
2095
|
+
handler: "replaceSynonyms",
|
|
2096
|
+
options: namedBody,
|
|
2097
|
+
operationId: "updateSynonyms",
|
|
2098
|
+
summary: "Replace the synonym set of an index",
|
|
2099
|
+
tags: ["Maintenance"],
|
|
2100
|
+
request: "SynonymSetBody",
|
|
2101
|
+
responses: { 200: "OkResponse" }
|
|
2102
|
+
},
|
|
2103
|
+
{
|
|
2104
|
+
method: "post",
|
|
2105
|
+
path: "/indexes/:name/bm25",
|
|
2106
|
+
handler: "updateBm25",
|
|
2107
|
+
options: namedBody,
|
|
2108
|
+
operationId: "updateBM25",
|
|
2109
|
+
summary: "Replace the BM25 setting of an index",
|
|
2110
|
+
tags: ["Maintenance"],
|
|
2111
|
+
request: "BM25Params",
|
|
2112
|
+
responses: { 200: "OkResponse" }
|
|
2113
|
+
},
|
|
2114
|
+
{
|
|
2115
|
+
method: "post",
|
|
2116
|
+
path: "/indexes/:name/restore",
|
|
2117
|
+
handler: "restore",
|
|
2118
|
+
options: spooledBody,
|
|
2119
|
+
operationId: "restore",
|
|
2120
|
+
summary: "Restore an index from a snapshot archive, as a task",
|
|
2121
|
+
tags: ["Maintenance"],
|
|
2122
|
+
request: { contentType: SNAPSHOT_ARCHIVE_CONTENT_TYPE },
|
|
2123
|
+
responses: { 202: "TaskRecord" }
|
|
2124
|
+
},
|
|
2125
|
+
{
|
|
2126
|
+
method: "get",
|
|
2127
|
+
path: "/indexes/:name/export",
|
|
2128
|
+
handler: "exportDocuments",
|
|
2129
|
+
options: named,
|
|
2130
|
+
operationId: "exportDocuments",
|
|
2131
|
+
summary: "Stream a document export of an index",
|
|
2132
|
+
tags: ["Maintenance"],
|
|
2133
|
+
request: null,
|
|
2134
|
+
responses: { 200: { contentType: DOCUMENT_EXPORT_CONTENT_TYPE } }
|
|
2135
|
+
},
|
|
2136
|
+
{
|
|
2137
|
+
method: "post",
|
|
2138
|
+
path: "/indexes/:name/import",
|
|
2139
|
+
handler: "importExport",
|
|
2140
|
+
options: spooledBody,
|
|
2141
|
+
operationId: "importDocumentExport",
|
|
2142
|
+
summary: "Import a document export, as a task",
|
|
2143
|
+
tags: ["Maintenance"],
|
|
2144
|
+
request: { contentType: DOCUMENT_EXPORT_CONTENT_TYPE },
|
|
2145
|
+
responses: { 202: "TaskRecord" }
|
|
2146
|
+
}
|
|
2147
|
+
];
|
|
2148
|
+
}
|
|
2149
|
+
|
|
1543
2150
|
// src/server/batch-scan.ts
|
|
1544
2151
|
var QUOTE2 = 34;
|
|
1545
2152
|
var BACKSLASH2 = 92;
|
|
@@ -1630,99 +2237,42 @@ function batchBodyKindOf(prefix) {
|
|
|
1630
2237
|
return prefix.length > BATCH_KIND_SCAN_BYTES ? "read" : null;
|
|
1631
2238
|
}
|
|
1632
2239
|
|
|
1633
|
-
// src/server/routes.ts
|
|
2240
|
+
// src/server/routes/options.ts
|
|
1634
2241
|
var writeBodyKind = () => "write";
|
|
1635
2242
|
var readBodyKind = () => "read";
|
|
1636
|
-
function
|
|
1637
|
-
const { maxBodyBytes, maxImportBytes } = limits;
|
|
1638
|
-
const probe = { maxBytes: 0, skipHooks: true };
|
|
1639
|
-
const bare = { maxBytes: 0 };
|
|
1640
|
-
const named = { paramCount: 1, maxBytes: 0 };
|
|
2243
|
+
function sharedRouteOptions(limits) {
|
|
2244
|
+
const { maxBodyBytes, maxImportBytes, maxRestoreBytes } = limits;
|
|
1641
2245
|
const namedBody = { paramCount: 1, needsBody: true, maxBytes: maxBodyBytes };
|
|
1642
|
-
const document = { paramCount: 2, maxBytes: 0 };
|
|
1643
2246
|
const documentBody = { paramCount: 2, needsBody: true, maxBytes: maxBodyBytes };
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
2247
|
+
return {
|
|
2248
|
+
probe: { maxBytes: 0, skipHooks: true },
|
|
2249
|
+
bare: { maxBytes: 0 },
|
|
2250
|
+
named: { paramCount: 1, maxBytes: 0 },
|
|
2251
|
+
namedBody,
|
|
2252
|
+
document: { paramCount: 2, maxBytes: 0 },
|
|
2253
|
+
writeBody: { ...namedBody, bodyKind: writeBodyKind },
|
|
2254
|
+
readBody: { ...namedBody, bodyKind: readBodyKind },
|
|
2255
|
+
batchBody: { ...namedBody, bodyKind: batchBodyKindOf },
|
|
2256
|
+
documentWriteBody: { ...documentBody, bodyKind: writeBodyKind },
|
|
2257
|
+
importBody: { paramCount: 1, needsBody: true, maxBytes: maxImportBytes },
|
|
2258
|
+
spooledBody: { paramCount: 1, spoolsBody: true, maxBytes: maxRestoreBytes },
|
|
2259
|
+
newIndexBody: { needsBody: true, maxBytes: maxBodyBytes }
|
|
2260
|
+
};
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
// src/server/routes/table.ts
|
|
2264
|
+
function serverRoutes(limits) {
|
|
2265
|
+
const shared = sharedRouteOptions(limits);
|
|
1647
2266
|
return [
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
{ method: "get", path: "/cluster", handler: "clusterTopology", options: bare },
|
|
1654
|
-
{ method: "get", path: "/cluster/health", handler: "clusterHealth", options: bare },
|
|
1655
|
-
{ method: "get", path: "/metrics", handler: "metrics", options: bare },
|
|
1656
|
-
{ method: "get", path: "/stats/memory", handler: "memory", options: bare },
|
|
1657
|
-
{ method: "get", path: "/tasks", handler: "listTasks", options: bare },
|
|
1658
|
-
{ method: "get", path: "/tasks/:id", handler: "getTask", options: named },
|
|
1659
|
-
{ method: "post", path: "/tasks/:id/_cancel", handler: "cancelTask", options: named },
|
|
1660
|
-
{ method: "post", path: "/indexes", handler: "createIndex", options: { needsBody: true, maxBytes: maxBodyBytes } },
|
|
1661
|
-
{ method: "get", path: "/indexes", handler: "listIndexes", options: bare },
|
|
1662
|
-
{ method: "del", path: "/indexes/:name", handler: "dropIndex", options: named },
|
|
1663
|
-
{ method: "get", path: "/indexes/:name/stats", handler: "indexStats", options: named },
|
|
1664
|
-
{ method: "get", path: "/indexes/:name/partitions", handler: "indexPartitions", options: named },
|
|
1665
|
-
{ method: "get", path: "/indexes/:name/cluster", handler: "clusterAllocation", options: named },
|
|
1666
|
-
{
|
|
1667
|
-
method: "put",
|
|
1668
|
-
path: "/indexes/:name/replication-factor",
|
|
1669
|
-
handler: "clusterReplicationFactor",
|
|
1670
|
-
options: namedBody
|
|
1671
|
-
},
|
|
1672
|
-
{ method: "post", path: "/indexes/:name/_clear", handler: "clearIndex", options: named },
|
|
1673
|
-
{ method: "post", path: "/indexes/:name/_open", handler: "openIndex", options: named },
|
|
1674
|
-
{ method: "post", path: "/indexes/:name/_close", handler: "closeIndex", options: named },
|
|
1675
|
-
{ method: "get", path: "/indexes/:name/count", handler: "count", options: named },
|
|
1676
|
-
{ method: "post", path: "/indexes/:name/documents", handler: "insert", options: writeBody },
|
|
1677
|
-
{
|
|
1678
|
-
method: "post",
|
|
1679
|
-
path: "/indexes/:name/documents/_batch",
|
|
1680
|
-
handler: "batch",
|
|
1681
|
-
options: { ...namedBody, bodyKind: batchBodyKindOf }
|
|
1682
|
-
},
|
|
1683
|
-
{ method: "post", path: "/indexes/:name/documents/_list", handler: "list", options: readBody2 },
|
|
1684
|
-
{ method: "post", path: "/indexes/:name/documents/_multi-get", handler: "multiGet", options: readBody2 },
|
|
1685
|
-
{
|
|
1686
|
-
method: "post",
|
|
1687
|
-
path: "/indexes/:name/documents/_import",
|
|
1688
|
-
handler: "importNdjson",
|
|
1689
|
-
options: { paramCount: 1, needsBody: true, maxBytes: maxImportBytes }
|
|
1690
|
-
},
|
|
1691
|
-
{ method: "post", path: "/indexes/:name/_wait-for-writes", handler: "waitForWrites", options: named },
|
|
1692
|
-
{ method: "get", path: "/indexes/:name/documents/:id", handler: "get", options: document },
|
|
1693
|
-
{ method: "get", path: "/indexes/:name/documents/:id/_exists", handler: "exists", options: document },
|
|
1694
|
-
{ method: "put", path: "/indexes/:name/documents/:id", handler: "put", options: documentWriteBody },
|
|
1695
|
-
{ method: "patch", path: "/indexes/:name/documents/:id", handler: "patch", options: documentWriteBody },
|
|
1696
|
-
{ method: "del", path: "/indexes/:name/documents/:id", handler: "remove", options: document },
|
|
1697
|
-
{ method: "post", path: "/indexes/:name/search", handler: "search", options: readBody2 },
|
|
1698
|
-
{ method: "post", path: "/indexes/:name/search/preflight", handler: "preflight", options: readBody2 },
|
|
1699
|
-
{ method: "post", path: "/indexes/:name/suggest", handler: "suggest", options: readBody2 },
|
|
1700
|
-
{ method: "post", path: "/indexes/:name/_checkpoint", handler: "checkpoint", options: named },
|
|
1701
|
-
{ method: "post", path: "/indexes/:name/_rebuild-analysis", handler: "rebuildAnalysis", options: named },
|
|
1702
|
-
{ method: "get", path: "/indexes/:name/snapshot", handler: "snapshot", options: named },
|
|
1703
|
-
{ method: "get", path: "/indexes/:name/vector-maintenance", handler: "vectorMaintenance", options: named },
|
|
1704
|
-
{ method: "post", path: "/indexes/:name/vectors/_compact", handler: "compact", options: namedBody },
|
|
1705
|
-
{ method: "post", path: "/indexes/:name/vectors/_optimize", handler: "optimize", options: namedBody },
|
|
1706
|
-
{ method: "post", path: "/indexes/:name/_rebalance", handler: "rebalance", options: namedBody },
|
|
1707
|
-
{ method: "post", path: "/indexes/:name/partition-config", handler: "partitionConfig", options: namedBody },
|
|
1708
|
-
{ method: "get", path: "/indexes/:name/synonyms", handler: "readSynonyms", options: named },
|
|
1709
|
-
{ method: "post", path: "/indexes/:name/synonyms", handler: "replaceSynonyms", options: namedBody },
|
|
1710
|
-
{ method: "post", path: "/indexes/:name/bm25", handler: "updateBm25", options: namedBody },
|
|
1711
|
-
{
|
|
1712
|
-
method: "post",
|
|
1713
|
-
path: "/indexes/:name/restore",
|
|
1714
|
-
handler: "restore",
|
|
1715
|
-
options: { paramCount: 1, spoolsBody: true, maxBytes: limits.maxRestoreBytes }
|
|
1716
|
-
},
|
|
1717
|
-
{ method: "get", path: "/indexes/:name/export", handler: "exportDocuments", options: named },
|
|
1718
|
-
{
|
|
1719
|
-
method: "post",
|
|
1720
|
-
path: "/indexes/:name/import",
|
|
1721
|
-
handler: "importExport",
|
|
1722
|
-
options: { paramCount: 1, spoolsBody: true, maxBytes: limits.maxRestoreBytes }
|
|
1723
|
-
}
|
|
2267
|
+
...infoRoutes(shared),
|
|
2268
|
+
...indexRoutes(shared),
|
|
2269
|
+
...documentRoutes(shared),
|
|
2270
|
+
...searchRoutes(shared),
|
|
2271
|
+
...maintenanceRoutes(shared)
|
|
1724
2272
|
];
|
|
1725
2273
|
}
|
|
2274
|
+
|
|
2275
|
+
// src/server/routes/register.ts
|
|
1726
2276
|
function registerServerRoutes(app, run, handlers, limits, cors) {
|
|
1727
2277
|
if (cors) {
|
|
1728
2278
|
app.options("/*", (res, req) => {
|
|
@@ -1834,4 +2384,4 @@ async function departureConfirmation(word) {
|
|
|
1834
2384
|
if (waiting.async) await waiting.value;
|
|
1835
2385
|
}
|
|
1836
2386
|
|
|
1837
|
-
export { ASYNC_IMPORT_CAPABILITY, BM25_TUNING_CAPABILITY, DEFAULT_IMPORT_BATCH_SIZE, DEFAULT_MAX_BODY_BYTES, DEFAULT_MAX_BODY_BYTES_IN_FLIGHT_FRACTION, DEFAULT_MAX_CONCURRENT_REQUESTS, DEFAULT_MAX_CONCURRENT_TASKS, DEFAULT_MAX_FETCH_DOCUMENTS, DEFAULT_MAX_IMPORT_BYTES, DEFAULT_MAX_IMPORT_ERRORS, DEFAULT_MAX_LINE_BYTES, DEFAULT_MAX_RERANK_WINDOW, DEFAULT_MAX_RESTORE_BYTES, DEFAULT_MAX_RESULT_WINDOW, DEFAULT_MAX_RETAINED_TASKS, DEFAULT_MAX_TASK_PAGE_SIZE, DEFAULT_TASK_PAGE_SIZE, DOCUMENT_EXPORT_CAPABILITY, DOCUMENT_EXPORT_CONTENT_TYPE, IMPORT_FLUSHES_IN_FLIGHT, INDEX_LIFECYCLE_CAPABILITY, INDEX_TOUCH_INTERVALS_PER_IDLE_TIMEOUT, MAIN_THREAD_GATE_SLOT, MAX_BODY_BYTES_IN_FLIGHT_FRACTION, MAX_INDEX_TOUCH_INTERVAL_MS, MAX_LONG_QUERIES_IN_FLIGHT, MIN_COUNTED_SERVER_LIMIT, MIN_UNBOUNDED_SERVER_LIMIT, REBUILD_ANALYSIS_CAPABILITY, RELAY_STREAM_CHUNKS_IN_FLIGHT, REQUEST_THREAD_CLOSE_AT_EXIT_MS, REQUEST_THREAD_DEPARTURE_DRAIN_MS, REQUEST_THREAD_MOVE_AFTER_MS, RUNNING_TASK_TTL_MS, SEARCH_CLOCK_SAMPLE_UNITS, SERVER_CAPABILITIES, SNAPSHOT_ARCHIVE_CONTENT_TYPE, SYNONYMS_CAPABILITY, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, TASK_PROGRESS_WRITE_INTERVAL_MS, TERMINAL_TASK_TTL_MS, acceptorOf, authorizerFor, awaitDepartureConfirmation, badRequest, childAppOf, clearBodyBudgetSlot, clearGateSlot, closeEveryThreadAtExit, closeWhenTheProcessExits, confirmDeparture, corsHeaderReader, createBodyBudgetBuffer, createCloseAtExitWords, createDepartureWord, createDocumentReadHandlers, createRouteRunner, createSharedBodyBudget, createSharedGateBuffer, createSharedRequestGate, createVersionHandler, departureConfirmation, departureConfirmed, encodeJson, gateSlotOfWorker, httpStatusForNarsilError, isRemoveOnlyBatch, loadUWebSockets, parseJson, parseJsonOptional, parseRefusalOf, parseTaskListQuery, parseWriteJson, refuseRegex, registerServerRoutes, rejectInvalid, resolveCors, respondAnswer, respondError, respondJson, sendError, sendRelayed, sendStream, sendText, serializeBatchResult, serializeNarsilError, serverRoutes, statusLine, toHttpError, validateBatch, validateCreateIndex, validateDocumentBody, validateQuery, validateRebalance, validateSuggest, versionReport, withServerRerankWindow };
|
|
2387
|
+
export { ASYNC_IMPORT_CAPABILITY, BM25_TUNING_CAPABILITY, DEFAULT_IMPORT_BATCH_SIZE, DEFAULT_MAX_BODY_BYTES, DEFAULT_MAX_BODY_BYTES_IN_FLIGHT_FRACTION, DEFAULT_MAX_CONCURRENT_REQUESTS, DEFAULT_MAX_CONCURRENT_TASKS, DEFAULT_MAX_FETCH_DOCUMENTS, DEFAULT_MAX_IMPORT_BYTES, DEFAULT_MAX_IMPORT_ERRORS, DEFAULT_MAX_LINE_BYTES, DEFAULT_MAX_RERANK_WINDOW, DEFAULT_MAX_RESTORE_BYTES, DEFAULT_MAX_RESULT_WINDOW, DEFAULT_MAX_RETAINED_TASKS, DEFAULT_MAX_TASK_PAGE_SIZE, DEFAULT_TASK_PAGE_SIZE, DOCUMENT_EXPORT_CAPABILITY, DOCUMENT_EXPORT_CONTENT_TYPE, IMPORT_FLUSHES_IN_FLIGHT, INDEX_LIFECYCLE_CAPABILITY, INDEX_TOUCH_INTERVALS_PER_IDLE_TIMEOUT, MAIN_THREAD_GATE_SLOT, MAX_BODY_BYTES_IN_FLIGHT_FRACTION, MAX_INDEX_TOUCH_INTERVAL_MS, MAX_LONG_QUERIES_IN_FLIGHT, MIN_COUNTED_SERVER_LIMIT, MIN_UNBOUNDED_SERVER_LIMIT, PROMETHEUS_TEXT_CONTENT_TYPE, REBUILD_ANALYSIS_CAPABILITY, RELAY_STREAM_CHUNKS_IN_FLIGHT, REQUEST_THREAD_CLOSE_AT_EXIT_MS, REQUEST_THREAD_DEPARTURE_DRAIN_MS, REQUEST_THREAD_MOVE_AFTER_MS, RUNNING_TASK_TTL_MS, SEARCH_CLOCK_SAMPLE_UNITS, SERVER_CAPABILITIES, SNAPSHOT_ARCHIVE_CONTENT_TYPE, SYNONYMS_CAPABILITY, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, TASK_PROGRESS_WRITE_INTERVAL_MS, TERMINAL_TASK_TTL_MS, acceptorOf, authorizerFor, awaitDepartureConfirmation, badRequest, childAppOf, clearBodyBudgetSlot, clearGateSlot, closeEveryThreadAtExit, closeWhenTheProcessExits, confirmDeparture, corsHeaderReader, createBodyBudgetBuffer, createCloseAtExitWords, createDepartureWord, createDocumentReadHandlers, createRouteRunner, createSharedBodyBudget, createSharedGateBuffer, createSharedRequestGate, createVersionHandler, departureConfirmation, departureConfirmed, encodeJson, gateSlotOfWorker, httpStatusForNarsilError, isRemoveOnlyBatch, loadUWebSockets, parseJson, parseJsonOptional, parseRefusalOf, parseTaskListQuery, parseWriteJson, refuseRegex, registerServerRoutes, rejectInvalid, resolveCors, respondAnswer, respondError, respondJson, sendError, sendRelayed, sendStream, sendText, serializeBatchResult, serializeNarsilError, serverRoutes, statusLine, toHttpError, validateBatch, validateCreateIndex, validateDocumentBody, validateQuery, validateRebalance, validateSuggest, versionReport, withServerRerankWindow };
|