@delali/narsil 0.3.1-next.73 → 0.3.1-next.75
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/{capabilities-CYeAWYxQ.d.ts → capabilities-BHNksicw.d.ts} +16 -2
- package/dist/{chunk-PU43WDY4.mjs → chunk-2E35UM3G.mjs} +1 -13
- package/dist/{chunk-AK3BLGCI.mjs → chunk-356UOTK2.mjs} +15 -48
- package/dist/chunk-7ODNRREZ.mjs +2050 -0
- package/dist/chunk-AIUOAN7Y.mjs +658 -0
- package/dist/{chunk-WVDFG45M.mjs → chunk-AMGDG4ZJ.mjs} +3 -2
- package/dist/{chunk-AFKH4ZK3.mjs → chunk-BT62MUM5.mjs} +1 -1
- package/dist/{chunk-LPBWCHBE.mjs → chunk-BT6BI4GV.mjs} +42 -4
- package/dist/{chunk-LJYTW7GT.mjs → chunk-IBR6634K.mjs} +1 -1
- package/dist/chunk-KEHK2O6P.mjs +13 -0
- package/dist/{chunk-CVFAFZSN.mjs → chunk-LOARLB4F.mjs} +46 -34
- package/dist/{chunk-3YKWSO54.mjs → chunk-NAMGDK45.mjs} +228 -649
- package/dist/{chunk-2WLD2NFW.mjs → chunk-PXDY5VRT.mjs} +3 -3
- package/dist/chunk-UOJIV2NG.mjs +593 -0
- package/dist/chunk-V3B24XR7.mjs +54 -0
- package/dist/{chunk-ZULSEZCE.mjs → chunk-WL2GDSCV.mjs} +100 -19
- package/dist/{chunk-THMSFOJO.mjs → chunk-YOVS4EV5.mjs} +582 -598
- package/dist/{client-D698E5ge.d.ts → client-D4sXFS9f.d.ts} +3 -3
- package/dist/client.d.ts +8 -8
- package/dist/{config-Bv8etwUZ.d.ts → config-B-GRonqw.d.ts} +2 -2
- package/dist/{config-QXU3HMpq.d.ts → config-C1kbq1X2.d.ts} +2 -2
- package/dist/direct-executor-AVNWB73C.mjs +16 -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/coordinator/in-memory.mjs +1 -1
- package/dist/distribution.d.ts +8 -8
- package/dist/distribution.mjs +23 -13
- package/dist/{engine-D_OzKZ-6.d.ts → engine-DcGSd5vh.d.ts} +2 -2
- package/dist/index.browser.mjs +1272 -834
- package/dist/index.d.ts +27 -8
- package/dist/index.mjs +14 -11
- package/dist/invalidation/filesystem.mjs +1 -1
- package/dist/{memory-B4jMmygw.d.ts → memory-M9kPmYP8.d.ts} +1257 -1178
- package/dist/partial-words-DTIHO8G4.d.ts +19 -0
- package/dist/partial-words.d.ts +22 -0
- package/dist/partial-words.mjs +11 -0
- package/dist/pattern.mjs +2 -2
- package/dist/persistence/durability/checkpoint-worker.d.ts +33 -13
- package/dist/persistence/durability/checkpoint-worker.mjs +14 -11
- package/dist/react.d.ts +7 -7
- package/dist/{schema-BBOCdhND.d.ts → schema-DgyDijhf.d.ts} +6 -2
- package/dist/server.d.ts +10 -10
- package/dist/server.mjs +36 -11
- package/dist/{tasks-DpgCpW1x.d.ts → tasks-A8se0J98.d.ts} +1 -1
- package/dist/{thread-3LNVA43V.mjs → thread-BSIKT6ED.mjs} +16 -9
- package/dist/{types-BiUmaiWT.d.ts → types-ChrVy4lH.d.ts} +1 -1
- package/dist/vector/search-worker.d.ts +1 -1
- package/dist/vector/search-worker.mjs +4 -3
- package/dist/workers/entry.mjs +3 -3
- package/package.json +16 -7
- package/dist/chunk-XW25X6AU.mjs +0 -614
- package/dist/chunk-ZKRV5M2P.mjs +0 -75
- package/dist/direct-executor-5SRDFZAS.mjs +0 -13
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An app passes an object of this type to {@link registerPartialWordSearch}
|
|
3
|
+
* to give the engine its partial-word search code. The engine uses that code
|
|
4
|
+
* to match each query word inside the longer words of a field whose type
|
|
5
|
+
* includes `partial`, whenever a query has {@link QueryParams.partialWords}
|
|
6
|
+
* set.
|
|
7
|
+
*
|
|
8
|
+
* A Node process loads this code by itself. A browser bundle contains it only
|
|
9
|
+
* when the app imports `partialWordSearch` from `@delali/narsil/partial-words`,
|
|
10
|
+
* so a bundler can leave it out of an app that has no `partial` field.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
interface PartialWordSearch {
|
|
15
|
+
/** The engine checks that this name is `'partialWords'` when an app registers the object. */
|
|
16
|
+
readonly name: 'partialWords';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type { PartialWordSearch as P };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { P as PartialWordSearch } from './partial-words-DTIHO8G4.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This object contains the partial-word search code. A browser app has to
|
|
5
|
+
* pass it to {@link registerPartialWordSearch} before the app creates or
|
|
6
|
+
* loads an index with a `partial` field.
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { registerPartialWordSearch } from '@delali/narsil'
|
|
10
|
+
* import { partialWordSearch } from '@delali/narsil/partial-words'
|
|
11
|
+
*
|
|
12
|
+
* registerPartialWordSearch(partialWordSearch)
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* A Node process loads that code by itself, so only a browser app has to make
|
|
16
|
+
* this call.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
declare const partialWordSearch: PartialWordSearch;
|
|
21
|
+
|
|
22
|
+
export { PartialWordSearch, partialWordSearch };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { partialWordSearchModule } from './chunk-AIUOAN7Y.mjs';
|
|
2
|
+
import './chunk-UOJIV2NG.mjs';
|
|
3
|
+
import './chunk-356UOTK2.mjs';
|
|
4
|
+
import './chunk-KEHK2O6P.mjs';
|
|
5
|
+
import './chunk-IBR6634K.mjs';
|
|
6
|
+
import './chunk-I64LXKO3.mjs';
|
|
7
|
+
|
|
8
|
+
// src/partial-words/index.ts
|
|
9
|
+
var partialWordSearch = partialWordSearchModule;
|
|
10
|
+
|
|
11
|
+
export { partialWordSearch };
|
package/dist/pattern.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { P as PartitionConfig, d as ScoringMode, V as VectorIndexConfig } from '../../schema-
|
|
1
|
+
import { P as PartitionConfig, d as ScoringMode, V as VectorIndexConfig } from '../../schema-DgyDijhf.js';
|
|
2
2
|
import '../../adapters-79OIa4xm.js';
|
|
3
3
|
|
|
4
|
-
interface
|
|
5
|
-
|
|
6
|
-
docIds: Uint32Array;
|
|
7
|
-
runs: Uint32Array;
|
|
4
|
+
interface FrozenTokenTableData {
|
|
5
|
+
blob: Uint8Array;
|
|
8
6
|
offsets: Uint32Array;
|
|
9
|
-
|
|
7
|
+
payloadSlots: Uint32Array;
|
|
8
|
+
documentFrequencies: Uint32Array;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
interface IndexMetadata {
|
|
@@ -60,6 +59,32 @@ interface IndexEmbeddingMetadata {
|
|
|
60
59
|
*/
|
|
61
60
|
type SerializedSurfaceForms = Record<string, number | [number, string]>;
|
|
62
61
|
|
|
62
|
+
interface PatternIndexArrays {
|
|
63
|
+
fieldPath: string;
|
|
64
|
+
docIds: Uint32Array;
|
|
65
|
+
runs: Uint32Array;
|
|
66
|
+
offsets: Uint32Array;
|
|
67
|
+
postings: Uint32Array;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface PartialSpellings {
|
|
71
|
+
fields: string[];
|
|
72
|
+
tokens: string[];
|
|
73
|
+
spellings: string[];
|
|
74
|
+
counts: number[];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface PartialWordTableData {
|
|
78
|
+
fields: string[];
|
|
79
|
+
spellings: Uint8Array;
|
|
80
|
+
spellingOffsets: Uint32Array;
|
|
81
|
+
spellingTokens: Uint32Array;
|
|
82
|
+
spellingCounts: Uint32Array;
|
|
83
|
+
runs: Uint32Array;
|
|
84
|
+
runOffsets: Uint32Array;
|
|
85
|
+
runEntries: Uint32Array;
|
|
86
|
+
}
|
|
87
|
+
|
|
63
88
|
interface SegmentPayload {
|
|
64
89
|
documentCount: number;
|
|
65
90
|
docIds: string[];
|
|
@@ -76,6 +101,7 @@ interface SegmentPayload {
|
|
|
76
101
|
totalFieldLengths: Record<string, number>;
|
|
77
102
|
docFrequencies: Record<string, number>;
|
|
78
103
|
surfaceForms: SerializedSurfaceForms | null;
|
|
104
|
+
partialSpellings: PartialSpellings | null;
|
|
79
105
|
numeric: Array<{
|
|
80
106
|
fieldPath: string;
|
|
81
107
|
docIds: Uint32Array;
|
|
@@ -147,13 +173,6 @@ interface SurfaceTableData {
|
|
|
147
173
|
counts: Uint32Array;
|
|
148
174
|
}
|
|
149
175
|
|
|
150
|
-
interface FrozenTokenTableData {
|
|
151
|
-
blob: Uint8Array;
|
|
152
|
-
offsets: Uint32Array;
|
|
153
|
-
payloadSlots: Uint32Array;
|
|
154
|
-
documentFrequencies: Uint32Array;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
176
|
interface SharedSegmentSnapshot extends Omit<SegmentColumns, 'surfaceForms'> {
|
|
158
177
|
segmentId: string;
|
|
159
178
|
tokenTable: FrozenTokenTableData;
|
|
@@ -161,6 +180,7 @@ interface SharedSegmentSnapshot extends Omit<SegmentColumns, 'surfaceForms'> {
|
|
|
161
180
|
documentTable: EncodedDocumentTableData;
|
|
162
181
|
/** The surface forms packed flat, or null where the segment holds none. */
|
|
163
182
|
surfaceTable: SurfaceTableData | null;
|
|
183
|
+
partialWords: PartialWordTableData | null;
|
|
164
184
|
}
|
|
165
185
|
|
|
166
186
|
interface PartitionCheckpoint {
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { CHECKPOINT_WORKER_HEARTBEAT_MS, createDurableDirectory, writeCheckpointSegments, directoryCheckpointStore } from '../../chunk-
|
|
1
|
+
import { CHECKPOINT_WORKER_HEARTBEAT_MS, createDurableDirectory, writeCheckpointSegments, directoryCheckpointStore } from '../../chunk-LOARLB4F.mjs';
|
|
2
|
+
import '../../chunk-WL2GDSCV.mjs';
|
|
2
3
|
import '../../chunk-GCM3JFVA.mjs';
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
4
|
+
import '../../chunk-BT62MUM5.mjs';
|
|
5
|
+
import '../../chunk-YOVS4EV5.mjs';
|
|
6
|
+
import '../../chunk-NAMGDK45.mjs';
|
|
5
7
|
import '../../chunk-4MQ5F4IL.mjs';
|
|
6
|
-
import '../../chunk-
|
|
7
|
-
import '../../chunk-3YKWSO54.mjs';
|
|
8
|
-
import '../../chunk-AK3BLGCI.mjs';
|
|
8
|
+
import '../../chunk-V3B24XR7.mjs';
|
|
9
9
|
import '../../chunk-TGP5M5R7.mjs';
|
|
10
|
-
import '../../chunk-
|
|
10
|
+
import '../../chunk-AMGDG4ZJ.mjs';
|
|
11
11
|
import '../../chunk-ZJ4CSAB2.mjs';
|
|
12
|
-
import '../../chunk-
|
|
13
|
-
import '../../chunk-
|
|
14
|
-
import '../../chunk-
|
|
12
|
+
import '../../chunk-2E35UM3G.mjs';
|
|
13
|
+
import '../../chunk-7ODNRREZ.mjs';
|
|
14
|
+
import '../../chunk-AIUOAN7Y.mjs';
|
|
15
|
+
import '../../chunk-UOJIV2NG.mjs';
|
|
16
|
+
import '../../chunk-356UOTK2.mjs';
|
|
17
|
+
import '../../chunk-KEHK2O6P.mjs';
|
|
15
18
|
import '../../chunk-U2BKYEC7.mjs';
|
|
16
|
-
import '../../chunk-
|
|
19
|
+
import '../../chunk-IBR6634K.mjs';
|
|
17
20
|
import '../../chunk-POWOTUKJ.mjs';
|
|
18
21
|
import '../../chunk-I64LXKO3.mjs';
|
|
19
22
|
|
package/dist/react.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { N as NarsilError, L as ListParams, h as ListResult, I as IndexInfo, g as IndexStats, Q as QueryParams, j as PreflightResult, e as QueryResult, k as SuggestParams, l as SuggestResult } from './memory-
|
|
2
|
-
export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './memory-
|
|
3
|
-
import { e as TaskRecord, d as TaskProgress, b as ImportResult, c as TaskListQuery, T as TaskListPage } from './tasks-
|
|
4
|
-
export { I as ImportError, f as TaskStatus, g as TaskType } from './tasks-
|
|
1
|
+
import { N as NarsilError, L as ListParams, h as ListResult, I as IndexInfo, g as IndexStats, Q as QueryParams, j as PreflightResult, e as QueryResult, k as SuggestParams, l as SuggestResult } from './memory-M9kPmYP8.js';
|
|
2
|
+
export { C as ClientErrorCode, a as ClientErrorCodes, E as ErrorCode, b as ErrorCodes, c as NarsilErrorCode, S as ServerErrorCode, d as ServerErrorCodes, i as isNarsilError } from './memory-M9kPmYP8.js';
|
|
3
|
+
import { e as TaskRecord, d as TaskProgress, b as ImportResult, c as TaskListQuery, T as TaskListPage } from './tasks-A8se0J98.js';
|
|
4
|
+
export { I as ImportError, f as TaskStatus, g as TaskType } from './tasks-A8se0J98.js';
|
|
5
5
|
import { ReactNode, ReactElement } from 'react';
|
|
6
|
-
import { N as Narsil } from './engine-
|
|
7
|
-
import { N as NarsilClient, I as ImportSource } from './client-
|
|
8
|
-
import { A as AnyDocument } from './schema-
|
|
6
|
+
import { N as Narsil } from './engine-DcGSd5vh.js';
|
|
7
|
+
import { N as NarsilClient, I as ImportSource } from './client-D4sXFS9f.js';
|
|
8
|
+
import { A as AnyDocument } from './schema-DgyDijhf.js';
|
|
9
9
|
import './adapters-79OIa4xm.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -23,8 +23,12 @@ type AnyDocument = Record<string, unknown> & {
|
|
|
23
23
|
* `in`, `nin`, `startsWith`, and `endsWith` on that field from the index,
|
|
24
24
|
* comparing case folds for any of those tests that sets `caseFold`. The engine
|
|
25
25
|
* raises `DOC_VALIDATION_FAILED` for a value longer than
|
|
26
|
-
* {@link IndexConfig.patternValueLimit} in such a field.
|
|
27
|
-
*
|
|
26
|
+
* {@link IndexConfig.patternValueLimit} in such a field. For a query with
|
|
27
|
+
* {@link QueryParams.partialWords} set, the engine also matches each query
|
|
28
|
+
* word inside the longer words of a field whose type includes `partial`. It
|
|
29
|
+
* raises `CONFIG_INVALID` for such a field in an index whose `surfaceForms`
|
|
30
|
+
* setting is false, because it matches inside the original spellings of
|
|
31
|
+
* words, which it records only while that setting is on.
|
|
28
32
|
*
|
|
29
33
|
* @public
|
|
30
34
|
*/
|
package/dist/server.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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 './memory-
|
|
2
|
-
import { b as ServerOptions, N as NarsilServer } from './capabilities-
|
|
3
|
-
export { A as ASYNC_IMPORT_CAPABILITY, C as CorsOptions, D as DOCUMENT_EXPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, O as OnRequestHook, R as REBUILD_ANALYSIS_CAPABILITY, c as RequestContext, d as RequestDenial, S as SERVER_CAPABILITIES, e as ServerLimits, T as TASK_CANCEL_CAPABILITY, a as TASK_FILTER_CAPABILITY } from './capabilities-
|
|
4
|
-
import { N as Narsil } from './engine-
|
|
5
|
-
import { d as TaskProgress, b as ImportResult, h as TaskStore, e as TaskRecord } from './tasks-
|
|
6
|
-
export { C as CapabilitiesResponse, a as CreateIndexEmbedding, i as CreateIndexRequest, H as HttpIndexConfig, I as ImportError, M as MemoryStatsResponse, T as TaskListPage, c as TaskListQuery, f as TaskStatus, g as TaskType } from './tasks-
|
|
7
|
-
import './schema-
|
|
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 './memory-M9kPmYP8.js';
|
|
2
|
+
import { b as ServerOptions, N as NarsilServer } from './capabilities-BHNksicw.js';
|
|
3
|
+
export { A as ASYNC_IMPORT_CAPABILITY, C as CorsOptions, D as DOCUMENT_EXPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, O as OnRequestHook, R as REBUILD_ANALYSIS_CAPABILITY, c as RequestContext, d as RequestDenial, S as SERVER_CAPABILITIES, e as ServerLimits, T as TASK_CANCEL_CAPABILITY, a as TASK_FILTER_CAPABILITY } from './capabilities-BHNksicw.js';
|
|
4
|
+
import { N as Narsil } from './engine-DcGSd5vh.js';
|
|
5
|
+
import { d as TaskProgress, b as ImportResult, h as TaskStore, e as TaskRecord } from './tasks-A8se0J98.js';
|
|
6
|
+
export { C as CapabilitiesResponse, a as CreateIndexEmbedding, i as CreateIndexRequest, H as HttpIndexConfig, I as ImportError, M as MemoryStatsResponse, T as TaskListPage, c as TaskListQuery, f as TaskStatus, g as TaskType } from './tasks-A8se0J98.js';
|
|
7
|
+
import './schema-DgyDijhf.js';
|
|
8
8
|
import './adapters-79OIa4xm.js';
|
|
9
|
-
import './config-
|
|
10
|
-
import './config-
|
|
11
|
-
import './types-
|
|
9
|
+
import './config-B-GRonqw.js';
|
|
10
|
+
import './config-C1kbq1X2.js';
|
|
11
|
+
import './types-ChrVy4lH.js';
|
|
12
12
|
import './types-Cb9kiY5P.js';
|
|
13
13
|
|
|
14
14
|
/**
|
package/dist/server.mjs
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { DEFAULT_MAX_RETAINED_TASKS, loadUWebSockets, resolveCors, authorizerFor, createSharedGateBuffer, gateSlotOfWorker, createRouteRunner, corsHeaderReader, createSharedRequestGate, MAIN_THREAD_GATE_SLOT, registerServerRoutes, DEFAULT_MAX_CONCURRENT_TASKS, DEFAULT_MAX_TASK_PAGE_SIZE, DEFAULT_MAX_IMPORT_ERRORS, DEFAULT_MAX_FETCH_DOCUMENTS, DEFAULT_MAX_RESULT_WINDOW, DEFAULT_MAX_CONCURRENT_REQUESTS, DEFAULT_IMPORT_BATCH_SIZE, DEFAULT_MAX_LINE_BYTES, DEFAULT_MAX_RESTORE_BYTES, DEFAULT_MAX_IMPORT_BYTES, DEFAULT_MAX_BODY_BYTES, RUNNING_TASK_TTL_MS, DEFAULT_TASK_PAGE_SIZE, TERMINAL_TASK_TTL_MS, TASK_PROGRESS_WRITE_INTERVAL_MS, serializeNarsilError, createVersionHandler, acceptorOf, createDocumentReadHandlers, sendError, respondError, respondJson, MAX_INDEX_TOUCH_INTERVAL_MS, INDEX_TOUCH_INTERVALS_PER_IDLE_TIMEOUT, clearGateSlot, parseJson, validateCreateIndex, rejectInvalid, validateBatch, serializeBatchResult, validateDocumentBody, validateSuggest, validateQuery, parseTaskListQuery, parseJsonOptional, validateRebalance, sendStream, SNAPSHOT_ARCHIVE_CONTENT_TYPE, DOCUMENT_EXPORT_CONTENT_TYPE, IMPORT_FLUSHES_IN_FLIGHT, badRequest, SERVER_CAPABILITIES, toHttpError, RELAY_STREAM_CHUNKS_IN_FLIGHT, MIN_UNBOUNDED_SERVER_LIMIT, MIN_COUNTED_SERVER_LIMIT } from './chunk-
|
|
2
|
-
export { ASYNC_IMPORT_CAPABILITY, DOCUMENT_EXPORT_CAPABILITY, INDEX_LIFECYCLE_CAPABILITY, REBUILD_ANALYSIS_CAPABILITY, SERVER_CAPABILITIES, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, httpStatusForNarsilError } from './chunk-
|
|
3
|
-
import { validateIndexName } from './chunk-
|
|
4
|
-
import { engineCoreOf, providedDocId, resolveVectorText } from './chunk-
|
|
1
|
+
import { DEFAULT_MAX_RETAINED_TASKS, loadUWebSockets, resolveCors, authorizerFor, createSharedGateBuffer, gateSlotOfWorker, createRouteRunner, corsHeaderReader, createSharedRequestGate, MAIN_THREAD_GATE_SLOT, registerServerRoutes, DEFAULT_MAX_CONCURRENT_TASKS, DEFAULT_MAX_TASK_PAGE_SIZE, DEFAULT_MAX_IMPORT_ERRORS, DEFAULT_MAX_FETCH_DOCUMENTS, DEFAULT_MAX_RESULT_WINDOW, DEFAULT_MAX_CONCURRENT_REQUESTS, DEFAULT_IMPORT_BATCH_SIZE, DEFAULT_MAX_LINE_BYTES, DEFAULT_MAX_RESTORE_BYTES, DEFAULT_MAX_IMPORT_BYTES, DEFAULT_MAX_BODY_BYTES, RUNNING_TASK_TTL_MS, DEFAULT_TASK_PAGE_SIZE, TERMINAL_TASK_TTL_MS, TASK_PROGRESS_WRITE_INTERVAL_MS, serializeNarsilError, createVersionHandler, acceptorOf, createDocumentReadHandlers, sendError, respondError, respondJson, MAX_INDEX_TOUCH_INTERVAL_MS, INDEX_TOUCH_INTERVALS_PER_IDLE_TIMEOUT, clearGateSlot, parseJson, validateCreateIndex, rejectInvalid, validateBatch, serializeBatchResult, validateDocumentBody, validateSuggest, validateQuery, refuseRegex, parseTaskListQuery, parseJsonOptional, validateRebalance, sendStream, SNAPSHOT_ARCHIVE_CONTENT_TYPE, DOCUMENT_EXPORT_CONTENT_TYPE, IMPORT_FLUSHES_IN_FLIGHT, badRequest, SERVER_CAPABILITIES, toHttpError, RELAY_STREAM_CHUNKS_IN_FLIGHT, MIN_UNBOUNDED_SERVER_LIMIT, MIN_COUNTED_SERVER_LIMIT } from './chunk-BT6BI4GV.mjs';
|
|
2
|
+
export { ASYNC_IMPORT_CAPABILITY, DOCUMENT_EXPORT_CAPABILITY, INDEX_LIFECYCLE_CAPABILITY, REBUILD_ANALYSIS_CAPABILITY, SERVER_CAPABILITIES, TASK_CANCEL_CAPABILITY, TASK_FILTER_CAPABILITY, httpStatusForNarsilError } from './chunk-BT6BI4GV.mjs';
|
|
3
|
+
import { validateIndexName } from './chunk-PXDY5VRT.mjs';
|
|
4
|
+
import { engineCoreOf, providedDocId, resolveVectorText } from './chunk-BT62MUM5.mjs';
|
|
5
5
|
import { detectRuntime } from './chunk-4MQ5F4IL.mjs';
|
|
6
|
-
import './chunk-
|
|
6
|
+
import './chunk-V3B24XR7.mjs';
|
|
7
7
|
import './chunk-TGP5M5R7.mjs';
|
|
8
|
-
import './chunk-
|
|
8
|
+
import './chunk-2E35UM3G.mjs';
|
|
9
|
+
import './chunk-356UOTK2.mjs';
|
|
10
|
+
import './chunk-KEHK2O6P.mjs';
|
|
9
11
|
import './chunk-U2BKYEC7.mjs';
|
|
10
|
-
import './chunk-
|
|
12
|
+
import './chunk-IBR6634K.mjs';
|
|
11
13
|
import { startIdleHeapCleanup } from './chunk-Y3L5MDRV.mjs';
|
|
12
14
|
import { NarsilError, ErrorCodes, ServerErrorCodes, isNarsilError } from './chunk-I64LXKO3.mjs';
|
|
13
15
|
export { ClientErrorCodes, ErrorCodes, NarsilError, ServerErrorCodes, isNarsilError } from './chunk-I64LXKO3.mjs';
|
|
@@ -769,7 +771,7 @@ function createIndexHandlers(deps) {
|
|
|
769
771
|
|
|
770
772
|
// src/server/handlers/search.ts
|
|
771
773
|
function createSearchHandlers(deps) {
|
|
772
|
-
const { engine, limits } = deps;
|
|
774
|
+
const { engine, limits, allowRegex } = deps;
|
|
773
775
|
async function search(ctx) {
|
|
774
776
|
const params = parseJson(ctx);
|
|
775
777
|
if (!params) return;
|
|
@@ -778,6 +780,7 @@ function createSearchHandlers(deps) {
|
|
|
778
780
|
rejectInvalid(ctx, failure);
|
|
779
781
|
return;
|
|
780
782
|
}
|
|
783
|
+
if (refuseRegex(ctx, params.filters, allowRegex)) return;
|
|
781
784
|
try {
|
|
782
785
|
respondJson(ctx, await engine.query(ctx.params[0], params));
|
|
783
786
|
} catch (err) {
|
|
@@ -792,6 +795,7 @@ function createSearchHandlers(deps) {
|
|
|
792
795
|
rejectInvalid(ctx, failure);
|
|
793
796
|
return;
|
|
794
797
|
}
|
|
798
|
+
if (refuseRegex(ctx, params.filters, allowRegex)) return;
|
|
795
799
|
try {
|
|
796
800
|
respondJson(ctx, await engine.preflight(ctx.params[0], params));
|
|
797
801
|
} catch (err) {
|
|
@@ -859,6 +863,14 @@ function assertServerLimits(limits) {
|
|
|
859
863
|
for (const field of LIMITS_UNBOUNDED_AT_ZERO) assertLimit(field, limits[field], MIN_UNBOUNDED_SERVER_LIMIT);
|
|
860
864
|
for (const field of COUNTED_LIMITS) assertLimit(field, limits[field], MIN_COUNTED_SERVER_LIMIT);
|
|
861
865
|
}
|
|
866
|
+
function assertAllowRegex(allowRegex) {
|
|
867
|
+
if (allowRegex === void 0 || typeof allowRegex === "boolean") return;
|
|
868
|
+
throw new NarsilError(
|
|
869
|
+
ErrorCodes.CONFIG_INVALID,
|
|
870
|
+
`allowRegex must be true or false; however, this configuration sets it to ${String(allowRegex)}`,
|
|
871
|
+
{ field: "allowRegex", value: String(allowRegex) }
|
|
872
|
+
);
|
|
873
|
+
}
|
|
862
874
|
|
|
863
875
|
// src/server/request-threads/captured-response.ts
|
|
864
876
|
var DEFAULT_STATUS = 200;
|
|
@@ -1157,7 +1169,8 @@ async function startRequestThreads(options) {
|
|
|
1157
1169
|
build: options.build,
|
|
1158
1170
|
authorizes: authorize !== void 0,
|
|
1159
1171
|
searchHooks,
|
|
1160
|
-
patternWorkCap: options.core.patternWorkCap
|
|
1172
|
+
patternWorkCap: options.core.patternWorkCap,
|
|
1173
|
+
allowRegex: options.allowRegex
|
|
1161
1174
|
}
|
|
1162
1175
|
},
|
|
1163
1176
|
[channel.port1]
|
|
@@ -1528,6 +1541,7 @@ var NarsilHttpServer = class {
|
|
|
1528
1541
|
constructor(engine, options = {}) {
|
|
1529
1542
|
assertServerEngine(engine);
|
|
1530
1543
|
assertServerLimits(options.limits);
|
|
1544
|
+
assertAllowRegex(options.allowRegex);
|
|
1531
1545
|
this.host = options.host ?? "127.0.0.1";
|
|
1532
1546
|
this.port = options.port ?? 9876;
|
|
1533
1547
|
this.options = options;
|
|
@@ -1543,6 +1557,7 @@ var NarsilHttpServer = class {
|
|
|
1543
1557
|
engine,
|
|
1544
1558
|
tasks: new TaskRegistry(taskStore, instanceId, limits.maxConcurrentTasks),
|
|
1545
1559
|
limits,
|
|
1560
|
+
allowRegex: options.allowRegex ?? true,
|
|
1546
1561
|
isReady: () => this.ready,
|
|
1547
1562
|
build: resolveBuild(options.build),
|
|
1548
1563
|
cluster: options.cluster,
|
|
@@ -1600,7 +1615,7 @@ var NarsilHttpServer = class {
|
|
|
1600
1615
|
const core = engineCoreOf(this.engine);
|
|
1601
1616
|
const threadCount = core === void 0 ? 0 : core.orchestrator.requestThreadCount();
|
|
1602
1617
|
const gate = createSharedGateBuffer(gateSlotOfWorker(threadCount));
|
|
1603
|
-
const { limits, build } = this.deps;
|
|
1618
|
+
const { limits, build, allowRegex } = this.deps;
|
|
1604
1619
|
const handlers = mainThreadHandlers(this.deps);
|
|
1605
1620
|
const run = createRouteRunner({
|
|
1606
1621
|
authorize,
|
|
@@ -1610,7 +1625,17 @@ var NarsilHttpServer = class {
|
|
|
1610
1625
|
registerServerRoutes(app, run, handlers, limits, cors);
|
|
1611
1626
|
if (core === void 0 || threadCount === 0 || !detectRuntime().supportsWorkerThreads) return;
|
|
1612
1627
|
try {
|
|
1613
|
-
this.threads = await startRequestThreads({
|
|
1628
|
+
this.threads = await startRequestThreads({
|
|
1629
|
+
core,
|
|
1630
|
+
app,
|
|
1631
|
+
handlers,
|
|
1632
|
+
authorize,
|
|
1633
|
+
gate,
|
|
1634
|
+
limits,
|
|
1635
|
+
allowRegex,
|
|
1636
|
+
build,
|
|
1637
|
+
cors
|
|
1638
|
+
});
|
|
1614
1639
|
} catch (err) {
|
|
1615
1640
|
console.warn("The server could not start request threads, so the main thread answers every request:", err);
|
|
1616
1641
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MemoryStats } from './memory-
|
|
1
|
+
import { M as MemoryStats } from './memory-M9kPmYP8.js';
|
|
2
2
|
|
|
3
3
|
/** Declarative index configuration accepted over HTTP. Function-valued engine
|
|
4
4
|
* options (custom tokenizer, stopWords-as-function, group reducer, embedding
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { loadUWebSockets, childAppOf, createRouteRunner, corsHeaderReader, createSharedRequestGate, registerServerRoutes, sendRelayed, createDocumentReadHandlers, respondJson, SERVER_CAPABILITIES, versionReport, statusLine, sendError, serverRoutes, parseJson, validateSuggest, rejectInvalid, respondError, validateQuery } from './chunk-
|
|
2
|
-
import { executeListDocuments, executeSuggest, executePreflight, queryBindingOf, executeQuery } from './chunk-
|
|
3
|
-
import { resolveProjection, projectionKeepsField, setNestedValue } from './chunk-
|
|
4
|
-
import
|
|
1
|
+
import { loadUWebSockets, childAppOf, createRouteRunner, corsHeaderReader, createSharedRequestGate, registerServerRoutes, sendRelayed, createDocumentReadHandlers, respondJson, SERVER_CAPABILITIES, versionReport, statusLine, sendError, serverRoutes, parseJson, validateSuggest, rejectInvalid, respondError, validateQuery, refuseRegex } from './chunk-BT6BI4GV.mjs';
|
|
2
|
+
import { executeListDocuments, executeSuggest, executePreflight, queryBindingOf, executeQuery } from './chunk-WL2GDSCV.mjs';
|
|
3
|
+
import { resolveProjection, projectionKeepsField, setNestedValue } from './chunk-NAMGDK45.mjs';
|
|
4
|
+
import './chunk-V3B24XR7.mjs';
|
|
5
5
|
import './chunk-ZJ4CSAB2.mjs';
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
6
|
+
import './chunk-2E35UM3G.mjs';
|
|
7
|
+
import './chunk-7ODNRREZ.mjs';
|
|
8
|
+
import './chunk-UOJIV2NG.mjs';
|
|
9
|
+
import { extractVectorFieldsFromSchema } from './chunk-356UOTK2.mjs';
|
|
10
|
+
import './chunk-KEHK2O6P.mjs';
|
|
11
|
+
import './chunk-IBR6634K.mjs';
|
|
9
12
|
import { ServerErrorCodes, NarsilError, ErrorCodes } from './chunk-I64LXKO3.mjs';
|
|
10
13
|
|
|
11
14
|
// src/server/request-threads/held-vectors.ts
|
|
@@ -356,7 +359,7 @@ function onWholeDocuments(local, handler, fallback) {
|
|
|
356
359
|
return (ctx) => local.holdsDocumentsOf(ctx.params[0]) ? handler(ctx) : fallback(ctx);
|
|
357
360
|
}
|
|
358
361
|
function searchHandler(options) {
|
|
359
|
-
const { fallback, maxResultWindow, staysOnThread, answer } = options;
|
|
362
|
+
const { fallback, maxResultWindow, allowRegex, staysOnThread, answer } = options;
|
|
360
363
|
return async (ctx) => {
|
|
361
364
|
const params = parseJson(ctx);
|
|
362
365
|
if (!params) return;
|
|
@@ -365,6 +368,7 @@ function searchHandler(options) {
|
|
|
365
368
|
rejectInvalid(ctx, failure);
|
|
366
369
|
return;
|
|
367
370
|
}
|
|
371
|
+
if (refuseRegex(ctx, params.filters, allowRegex)) return;
|
|
368
372
|
if (!staysOnThread(ctx.params[0], params)) {
|
|
369
373
|
await fallback(ctx);
|
|
370
374
|
return;
|
|
@@ -408,7 +412,8 @@ function relayedHandlers(relay, limits) {
|
|
|
408
412
|
return forwarded;
|
|
409
413
|
}
|
|
410
414
|
function threadHandlers(local, relay, settings) {
|
|
411
|
-
const
|
|
415
|
+
const { allowRegex } = settings;
|
|
416
|
+
const reads = createDocumentReadHandlers({ engine: local, limits: settings.limits, allowRegex });
|
|
412
417
|
const forwarded = relayedHandlers(relay, settings.limits);
|
|
413
418
|
const { maxResultWindow } = settings.limits;
|
|
414
419
|
return {
|
|
@@ -419,12 +424,14 @@ function threadHandlers(local, relay, settings) {
|
|
|
419
424
|
search: searchHandler({
|
|
420
425
|
fallback: forwarded.search,
|
|
421
426
|
maxResultWindow,
|
|
427
|
+
allowRegex,
|
|
422
428
|
staysOnThread: (name, params) => local.canAnswer(name, params),
|
|
423
429
|
answer: (name, params) => local.query(name, params)
|
|
424
430
|
}),
|
|
425
431
|
preflight: searchHandler({
|
|
426
432
|
fallback: forwarded.preflight,
|
|
427
433
|
maxResultWindow,
|
|
434
|
+
allowRegex,
|
|
428
435
|
staysOnThread: (name, params) => local.canCount(name, params),
|
|
429
436
|
answer: (name, params) => local.preflight(name, params)
|
|
430
437
|
}),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { openSharedVectorField, MAX_WORKER_COPIES, createVectorStore, osqBitsOf, createHNSWIndex, createOsqQuantizer, osqRecordBytes } from '../chunk-
|
|
1
|
+
import { openSharedVectorField, MAX_WORKER_COPIES, createVectorStore, osqBitsOf, createHNSWIndex, createOsqQuantizer, osqRecordBytes } from '../chunk-AMGDG4ZJ.mjs';
|
|
2
2
|
import '../chunk-ZJ4CSAB2.mjs';
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-
|
|
3
|
+
import '../chunk-2E35UM3G.mjs';
|
|
4
|
+
import '../chunk-KEHK2O6P.mjs';
|
|
5
|
+
import '../chunk-IBR6634K.mjs';
|
|
5
6
|
import '../chunk-I64LXKO3.mjs';
|
|
6
7
|
|
|
7
8
|
// src/vector/worker-copy.ts
|
package/dist/workers/entry.mjs
CHANGED
|
@@ -18,7 +18,7 @@ async function importBootstrapModule(moduleUrl) {
|
|
|
18
18
|
await import(moduleUrl);
|
|
19
19
|
}
|
|
20
20
|
async function stopServingRequests() {
|
|
21
|
-
const { closeRequestThread } = await import('../thread-
|
|
21
|
+
const { closeRequestThread } = await import('../thread-BSIKT6ED.mjs');
|
|
22
22
|
closeRequestThread();
|
|
23
23
|
}
|
|
24
24
|
function holdsCopies(executor) {
|
|
@@ -49,7 +49,7 @@ function createActionHandler(executor) {
|
|
|
49
49
|
if (!holdsCopies(executor)) {
|
|
50
50
|
throw new NarsilError(ErrorCodes.CONFIG_INVALID, "This executor holds no copies to answer requests from");
|
|
51
51
|
}
|
|
52
|
-
const starting = import('../thread-
|
|
52
|
+
const starting = import('../thread-BSIKT6ED.mjs').then(
|
|
53
53
|
({ serveRequests }) => serveRequests(executor, action.settings)
|
|
54
54
|
);
|
|
55
55
|
serving.start = starting.then(
|
|
@@ -102,7 +102,7 @@ async function setup() {
|
|
|
102
102
|
} catch {
|
|
103
103
|
parentPort = null;
|
|
104
104
|
}
|
|
105
|
-
const { createDirectExecutor } = await import('../direct-executor-
|
|
105
|
+
const { createDirectExecutor } = await import('../direct-executor-AVNWB73C.mjs');
|
|
106
106
|
const handleAction = createActionHandler(createDirectExecutor({ threadSlot }));
|
|
107
107
|
if (parentPort) {
|
|
108
108
|
const port = parentPort;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delali/narsil",
|
|
3
|
-
"version": "0.3.1-next.
|
|
3
|
+
"version": "0.3.1-next.75",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Distributed search engine with full-text, vector, hybrid, and geosearch. One engine, embedded or on a server, with a cross-language .nrsl format.",
|
|
6
6
|
"author": "Delali (https://sondelali.com)",
|
|
@@ -54,6 +54,10 @@
|
|
|
54
54
|
"#platform/pattern-search": {
|
|
55
55
|
"browser": "./src/core/pattern-index/platform.browser.ts",
|
|
56
56
|
"default": "./src/core/pattern-index/platform.ts"
|
|
57
|
+
},
|
|
58
|
+
"#platform/partial-word-search": {
|
|
59
|
+
"browser": "./src/core/partition/partial-words/platform.browser.ts",
|
|
60
|
+
"default": "./src/core/partition/partial-words/platform.ts"
|
|
57
61
|
}
|
|
58
62
|
},
|
|
59
63
|
"sideEffects": false,
|
|
@@ -139,6 +143,10 @@
|
|
|
139
143
|
"import": "./dist/pattern.mjs",
|
|
140
144
|
"types": "./dist/pattern.d.ts"
|
|
141
145
|
},
|
|
146
|
+
"./partial-words": {
|
|
147
|
+
"import": "./dist/partial-words.mjs",
|
|
148
|
+
"types": "./dist/partial-words.d.ts"
|
|
149
|
+
},
|
|
142
150
|
"./languages/*": {
|
|
143
151
|
"import": "./dist/languages/*.mjs",
|
|
144
152
|
"types": "./dist/languages/*.d.ts"
|
|
@@ -200,6 +208,7 @@
|
|
|
200
208
|
"etcd3": "1.1.2",
|
|
201
209
|
"fflate": "0.8.3",
|
|
202
210
|
"jsdom": "28.1.0",
|
|
211
|
+
"re2-wasm": "1.0.2",
|
|
203
212
|
"react": "19.2.4",
|
|
204
213
|
"react-dom": "19.2.4",
|
|
205
214
|
"selfsigned": "5.5.0",
|
|
@@ -231,11 +240,11 @@
|
|
|
231
240
|
}
|
|
232
241
|
},
|
|
233
242
|
"optionalDependencies": {
|
|
234
|
-
"@delali/narsil-native-darwin-arm64": "0.3.1-next.
|
|
235
|
-
"@delali/narsil-native-darwin-x64": "0.3.1-next.
|
|
236
|
-
"@delali/narsil-native-linux-arm64": "0.3.1-next.
|
|
237
|
-
"@delali/narsil-native-linux-x64": "0.3.1-next.
|
|
238
|
-
"@delali/narsil-native-win32-arm64": "0.3.1-next.
|
|
239
|
-
"@delali/narsil-native-win32-x64": "0.3.1-next.
|
|
243
|
+
"@delali/narsil-native-darwin-arm64": "0.3.1-next.75",
|
|
244
|
+
"@delali/narsil-native-darwin-x64": "0.3.1-next.75",
|
|
245
|
+
"@delali/narsil-native-linux-arm64": "0.3.1-next.75",
|
|
246
|
+
"@delali/narsil-native-linux-x64": "0.3.1-next.75",
|
|
247
|
+
"@delali/narsil-native-win32-arm64": "0.3.1-next.75",
|
|
248
|
+
"@delali/narsil-native-win32-x64": "0.3.1-next.75"
|
|
240
249
|
}
|
|
241
250
|
}
|