@delali/narsil 0.3.1-next.71 → 0.3.1-next.73

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 (69) hide show
  1. package/README.md +2 -2
  2. package/dist/adapters/filesystem.mjs +1 -1
  3. package/dist/adapters/indexeddb.mjs +1 -1
  4. package/dist/{capabilities-Dt-7B4Wz.d.ts → capabilities-CYeAWYxQ.d.ts} +19 -4
  5. package/dist/{chunk-3JGWULDF.mjs → chunk-2WLD2NFW.mjs} +5 -5
  6. package/dist/{chunk-LMO5TJUS.mjs → chunk-3YKWSO54.mjs} +642 -196
  7. package/dist/{chunk-HWQLTLNG.mjs → chunk-4MQ5F4IL.mjs} +1 -1
  8. package/dist/{chunk-FVLQ63B7.mjs → chunk-AFKH4ZK3.mjs} +30 -6
  9. package/dist/{chunk-653BNMAF.mjs → chunk-AK3BLGCI.mjs} +195 -25
  10. package/dist/{chunk-IOR2K26O.mjs → chunk-CVFAFZSN.mjs} +8000 -4391
  11. package/dist/{chunk-USKFU7J5.mjs → chunk-I64LXKO3.mjs} +1 -1
  12. package/dist/{chunk-OI42GWLR.mjs → chunk-LJYTW7GT.mjs} +57 -11
  13. package/dist/{chunk-2STVUTNA.mjs → chunk-LPBWCHBE.mjs} +194 -13
  14. package/dist/{chunk-YNVIUGF5.mjs → chunk-PU43WDY4.mjs} +4 -2
  15. package/dist/{chunk-M76V3OGJ.mjs → chunk-THMSFOJO.mjs} +1289 -1405
  16. package/dist/{chunk-YJDQ7NLA.mjs → chunk-WVDFG45M.mjs} +93 -95
  17. package/dist/chunk-XW25X6AU.mjs +614 -0
  18. package/dist/chunk-ZKRV5M2P.mjs +75 -0
  19. package/dist/{chunk-P4DSQ6M4.mjs → chunk-ZULSEZCE.mjs} +68 -28
  20. package/dist/{client-COek5GXK.d.ts → client-D698E5ge.d.ts} +77 -26
  21. package/dist/client.d.ts +9 -9
  22. package/dist/client.mjs +45 -22
  23. package/dist/{config-rBpbgTw8.d.ts → config-Bv8etwUZ.d.ts} +11 -4
  24. package/dist/{config-Dfanyqqt.d.ts → config-QXU3HMpq.d.ts} +26 -2
  25. package/dist/direct-executor-5SRDFZAS.mjs +13 -0
  26. package/dist/distribution/coordinator/etcd.d.ts +29 -16
  27. package/dist/distribution/coordinator/etcd.mjs +163 -76
  28. package/dist/distribution/coordinator/in-memory.d.ts +2 -2
  29. package/dist/distribution/coordinator/in-memory.mjs +1 -1
  30. package/dist/distribution/transport/grpc.d.ts +2 -2
  31. package/dist/distribution/transport/grpc.mjs +22 -2
  32. package/dist/distribution/transport/in-memory.d.ts +2 -2
  33. package/dist/distribution/transport/in-memory.mjs +6 -3
  34. package/dist/distribution/transport/tcp.d.ts +2 -2
  35. package/dist/distribution/transport/tcp.mjs +40 -16
  36. package/dist/distribution.d.ts +9 -9
  37. package/dist/distribution.mjs +682 -388
  38. package/dist/embeddings/openai.mjs +1 -1
  39. package/dist/{engine-igk0aMpQ.d.ts → engine-D_OzKZ-6.d.ts} +97 -188
  40. package/dist/index.browser.mjs +11671 -7427
  41. package/dist/index.d.ts +27 -8
  42. package/dist/index.mjs +13 -14
  43. package/dist/invalidation/filesystem.mjs +1 -1
  44. package/dist/{memory-C7UMCMH3.d.ts → memory-B4jMmygw.d.ts} +279 -27
  45. package/dist/pattern-Cledccbl.d.ts +18 -0
  46. package/dist/pattern.d.ts +22 -0
  47. package/dist/pattern.mjs +7 -0
  48. package/dist/persistence/durability/checkpoint-worker.d.ts +41 -17
  49. package/dist/persistence/durability/checkpoint-worker.mjs +24 -16
  50. package/dist/react.d.ts +7 -7
  51. package/dist/react.mjs +1 -1
  52. package/dist/{schema-Bgzr4g7b.d.ts → schema-BBOCdhND.d.ts} +9 -7
  53. package/dist/server.d.ts +11 -11
  54. package/dist/server.mjs +213 -34
  55. package/dist/{tasks-BZt_zes6.d.ts → tasks-DpgCpW1x.d.ts} +3 -3
  56. package/dist/{thread-JEVAYETR.mjs → thread-3LNVA43V.mjs} +94 -27
  57. package/dist/{types-BQDlIvfS.d.ts → types-B3b68nfF.d.ts} +1 -1
  58. package/dist/{types-gOUqhs2F.d.ts → types-BiUmaiWT.d.ts} +1 -1
  59. package/dist/{types-D5OwhtsQ.d.ts → types-Cb9kiY5P.d.ts} +1 -1
  60. package/dist/vector/search-worker.d.ts +1 -1
  61. package/dist/vector/search-worker.mjs +4 -4
  62. package/dist/workers/entry.mjs +4 -4
  63. package/package.json +15 -7
  64. package/dist/chunk-3L4U6EJQ.mjs +0 -49
  65. package/dist/chunk-GIVAGD3Q.mjs +0 -25
  66. package/dist/chunk-IFBKLBGB.mjs +0 -7
  67. package/dist/direct-executor-GYJEKNV5.mjs +0 -12
  68. package/dist/serialization/crc32-worker.d.ts +0 -20
  69. package/dist/serialization/crc32-worker.mjs +0 -62
@@ -1,6 +1,14 @@
1
- import { P as PartitionConfig, d as ScoringMode, V as VectorIndexConfig } from '../../schema-Bgzr4g7b.js';
1
+ import { P as PartitionConfig, d as ScoringMode, V as VectorIndexConfig } from '../../schema-BBOCdhND.js';
2
2
  import '../../adapters-79OIa4xm.js';
3
3
 
4
+ interface PatternIndexArrays {
5
+ fieldPath: string;
6
+ docIds: Uint32Array;
7
+ runs: Uint32Array;
8
+ offsets: Uint32Array;
9
+ postings: Uint32Array;
10
+ }
11
+
4
12
  interface IndexMetadata {
5
13
  indexName: string;
6
14
  /** Number of documents represented by the last completed checkpoint. */
@@ -60,7 +68,7 @@ interface SegmentPayload {
60
68
  postingOffsets: Uint32Array;
61
69
  postingDocIds: Uint32Array;
62
70
  postingFrequencies: Uint16Array;
63
- postingFieldIndices: Uint8Array;
71
+ postingFieldIndices: Uint16Array;
64
72
  positionOffsets: Uint32Array | null;
65
73
  positionValues: Uint32Array | null;
66
74
  fieldLengthNames: string[];
@@ -90,13 +98,19 @@ interface SegmentPayload {
90
98
  latitudes: Float64Array;
91
99
  longitudes: Float64Array;
92
100
  }>;
101
+ pattern: PatternIndexArrays[];
102
+ sizes: Array<{
103
+ fieldPath: string;
104
+ docIds: Uint32Array;
105
+ values: Float64Array;
106
+ }>;
93
107
  }
94
108
 
95
109
  interface SegmentPostingColumns {
96
110
  postingOffsets: Uint32Array;
97
111
  postingDocIds: Uint32Array;
98
112
  postingFrequencies: Uint16Array;
99
- postingFieldIndices: Uint8Array;
113
+ postingFieldIndices: Uint16Array;
100
114
  positionOffsets: Uint32Array | null;
101
115
  positionValues: Uint32Array | null;
102
116
  }
@@ -110,12 +124,15 @@ interface SegmentColumns extends SegmentPostingColumns {
110
124
  boolean: SegmentPayload['boolean'];
111
125
  enums: SegmentPayload['enums'];
112
126
  geo: SegmentPayload['geo'];
127
+ pattern: SegmentPayload['pattern'];
128
+ sizes: SegmentPayload['sizes'];
113
129
  surfaceForms: SerializedSurfaceForms | null;
114
130
  }
115
131
 
116
132
  interface EncodedDocumentTableData {
117
133
  blob: Uint8Array;
118
134
  offsets: Uint32Array;
135
+ discardedFields?: readonly string[];
119
136
  }
120
137
 
121
138
  interface ExternalIdTableData {
@@ -146,27 +163,19 @@ interface SharedSegmentSnapshot extends Omit<SegmentColumns, 'surfaceForms'> {
146
163
  surfaceTable: SurfaceTableData | null;
147
164
  }
148
165
 
149
- interface CapturedFrozenSegment {
150
- snapshot: SharedSegmentSnapshot;
151
- tombstonedDocIds: string[];
152
- }
153
- interface CapturedWholePartition {
154
- partitionId: number;
155
- totalPartitions: number;
156
- docCount: number;
157
- liveTail: Uint8Array | null;
158
- frozen: CapturedFrozenSegment[];
159
- }
160
-
161
166
  interface PartitionCheckpoint {
162
167
  partitionId: number;
163
168
  lastSeqNo: number;
164
169
  primaryTerm: number;
165
170
  }
166
171
 
167
- interface SegmentRef {
168
- id: number;
172
+ interface FileRef {
169
173
  key: string;
174
+ bytes: number;
175
+ checksum: number;
176
+ }
177
+ interface SegmentRef extends FileRef {
178
+ id: number;
170
179
  docCount: number;
171
180
  tombstoneCount: number;
172
181
  }
@@ -176,6 +185,20 @@ interface PartitionManifestEntry {
176
185
  segments: SegmentRef[];
177
186
  }
178
187
 
188
+ interface CapturedSegment {
189
+ snapshot: SharedSegmentSnapshot;
190
+ keep: Uint8Array;
191
+ }
192
+ interface CapturedWholePartition {
193
+ partitionId: number;
194
+ docCount: number;
195
+ segments: CapturedSegment[];
196
+ }
197
+
198
+ interface PriorCheckpoint {
199
+ checkpoint: PartitionCheckpoint[];
200
+ partitions: PartitionManifestEntry[];
201
+ }
179
202
  interface CheckpointSegmentsWritten {
180
203
  checkpoint: PartitionCheckpoint[];
181
204
  partitions: PartitionManifestEntry[];
@@ -186,6 +209,7 @@ interface CheckpointWorkerRequest {
186
209
  metadata: IndexMetadata;
187
210
  targets: PartitionCheckpoint[];
188
211
  compactionThreshold: number;
212
+ prior: PriorCheckpoint | null;
189
213
  capturedPartitions?: CapturedWholePartition[];
190
214
  }
191
215
  interface CheckpointWorkerSuccess {
@@ -1,27 +1,34 @@
1
- import { CHECKPOINT_WORKER_HEARTBEAT_MS, createDurableDirectory, writeCheckpointSegments } from '../../chunk-IOR2K26O.mjs';
1
+ import { CHECKPOINT_WORKER_HEARTBEAT_MS, createDurableDirectory, writeCheckpointSegments, directoryCheckpointStore } from '../../chunk-CVFAFZSN.mjs';
2
2
  import '../../chunk-GCM3JFVA.mjs';
3
- import '../../chunk-FVLQ63B7.mjs';
4
- import '../../chunk-M76V3OGJ.mjs';
5
- import '../../chunk-HWQLTLNG.mjs';
6
- import '../../chunk-P4DSQ6M4.mjs';
7
- import '../../chunk-GIVAGD3Q.mjs';
8
- import '../../chunk-LMO5TJUS.mjs';
9
- import '../../chunk-653BNMAF.mjs';
3
+ import '../../chunk-AFKH4ZK3.mjs';
4
+ import '../../chunk-THMSFOJO.mjs';
5
+ import '../../chunk-4MQ5F4IL.mjs';
6
+ import '../../chunk-ZULSEZCE.mjs';
7
+ import '../../chunk-3YKWSO54.mjs';
8
+ import '../../chunk-AK3BLGCI.mjs';
10
9
  import '../../chunk-TGP5M5R7.mjs';
11
- import '../../chunk-YJDQ7NLA.mjs';
10
+ import '../../chunk-WVDFG45M.mjs';
12
11
  import '../../chunk-ZJ4CSAB2.mjs';
13
- import '../../chunk-YNVIUGF5.mjs';
14
- import '../../chunk-3L4U6EJQ.mjs';
15
- import '../../chunk-IFBKLBGB.mjs';
12
+ import '../../chunk-PU43WDY4.mjs';
13
+ import '../../chunk-XW25X6AU.mjs';
14
+ import '../../chunk-ZKRV5M2P.mjs';
16
15
  import '../../chunk-U2BKYEC7.mjs';
17
- import '../../chunk-OI42GWLR.mjs';
16
+ import '../../chunk-LJYTW7GT.mjs';
18
17
  import '../../chunk-POWOTUKJ.mjs';
19
- import '../../chunk-USKFU7J5.mjs';
18
+ import '../../chunk-I64LXKO3.mjs';
20
19
 
21
20
  // src/persistence/durability/rebuild.ts
22
- async function rebuildSegmentsFromDurable(root, metadata, targets, compactionThreshold, capturedPartitions = []) {
21
+ async function rebuildSegmentsFromDurable(root, metadata, targets, compactionThreshold, prior, capturedPartitions = []) {
23
22
  const directory = createDurableDirectory(root);
24
- return writeCheckpointSegments({ directory, metadata, targets, compactionThreshold, capturedPartitions });
23
+ return writeCheckpointSegments({
24
+ store: directoryCheckpointStore(directory),
25
+ directory,
26
+ metadata,
27
+ targets,
28
+ compactionThreshold,
29
+ prior,
30
+ capturedPartitions
31
+ });
25
32
  }
26
33
 
27
34
  // src/persistence/durability/checkpoint-worker.ts
@@ -47,6 +54,7 @@ async function handleRequest(raw) {
47
54
  request.metadata,
48
55
  request.targets,
49
56
  request.compactionThreshold,
57
+ request.prior ?? null,
50
58
  request.capturedPartitions
51
59
  );
52
60
  return { type: "success", segments };
package/dist/react.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { N as NarsilError, L as ListParams, g as ListResult, I as IndexInfo, f as IndexStats, Q as QueryParams, h as PreflightResult, e as QueryResult, j as SuggestParams, k as SuggestResult } from './memory-C7UMCMH3.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-C7UMCMH3.js';
3
- import { e as TaskRecord, d as TaskProgress, b as ImportResult, c as TaskListQuery, T as TaskListPage } from './tasks-BZt_zes6.js';
4
- export { I as ImportError, f as TaskStatus, g as TaskType } from './tasks-BZt_zes6.js';
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-B4jMmygw.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-B4jMmygw.js';
3
+ import { e as TaskRecord, d as TaskProgress, b as ImportResult, c as TaskListQuery, T as TaskListPage } from './tasks-DpgCpW1x.js';
4
+ export { I as ImportError, f as TaskStatus, g as TaskType } from './tasks-DpgCpW1x.js';
5
5
  import { ReactNode, ReactElement } from 'react';
6
- import { a as Narsil } from './engine-igk0aMpQ.js';
7
- import { N as NarsilClient, I as ImportSource } from './client-COek5GXK.js';
8
- import { A as AnyDocument } from './schema-Bgzr4g7b.js';
6
+ import { N as Narsil } from './engine-D_OzKZ-6.js';
7
+ import { N as NarsilClient, I as ImportSource } from './client-D698E5ge.js';
8
+ import { A as AnyDocument } from './schema-BBOCdhND.js';
9
9
  import './adapters-79OIa4xm.js';
10
10
 
11
11
  /**
package/dist/react.mjs CHANGED
@@ -33,6 +33,7 @@ var ErrorCodes = {
33
33
  SEARCH_INVALID_MODE: "SEARCH_INVALID_MODE",
34
34
  SEARCH_INVALID_CURSOR: "SEARCH_INVALID_CURSOR",
35
35
  SEARCH_RESULT_WINDOW_EXCEEDED: "SEARCH_RESULT_WINDOW_EXCEEDED",
36
+ SEARCH_WORK_CAP_EXCEEDED: "SEARCH_WORK_CAP_EXCEEDED",
36
37
  LANGUAGE_NOT_SUPPORTED: "LANGUAGE_NOT_SUPPORTED",
37
38
  ENVELOPE_VERSION_MISMATCH: "ENVELOPE_VERSION_MISMATCH",
38
39
  ENVELOPE_INVALID_MAGIC: "ENVELOPE_INVALID_MAGIC",
@@ -73,7 +74,6 @@ var ErrorCodes = {
73
74
  SNAPSHOT_SYNC_UNAUTHORIZED: "SNAPSHOT_SYNC_UNAUTHORIZED",
74
75
  SNAPSHOT_SYNC_REQUEST_INVALID: "SNAPSHOT_SYNC_REQUEST_INVALID",
75
76
  SNAPSHOT_SYNC_INDEX_NOT_FOUND: "SNAPSHOT_SYNC_INDEX_NOT_FOUND",
76
- SNAPSHOT_SYNC_TOO_LARGE: "SNAPSHOT_SYNC_TOO_LARGE",
77
77
  SNAPSHOT_SYNC_CAPACITY_EXHAUSTED: "SNAPSHOT_SYNC_CAPACITY_EXHAUSTED",
78
78
  SNAPSHOT_SYNC_SNAPSHOT_FAILED: "SNAPSHOT_SYNC_SNAPSHOT_FAILED",
79
79
  SNAPSHOT_SYNC_DECODE_FAILED: "SNAPSHOT_SYNC_DECODE_FAILED",
@@ -18,12 +18,13 @@ type AnyDocument = Record<string, unknown> & {
18
18
  *
19
19
  * The engine can sort by a field whose type includes `sortable`. On a single
20
20
  * `string` field with that option, the engine can also test a text range with
21
- * `gt`, `gte`, `lt`, `lte`, or `between`. The engine raises
22
- * `DOC_VALIDATION_FAILED` for a value longer than
23
- * {@link IndexConfig.patternValueLimit} in a field whose type includes
24
- * `pattern`. A later release will add pattern search and partial-word search,
25
- * which will test the fields whose types include `pattern` and `partial`
26
- * respectively.
21
+ * `gt`, `gte`, `lt`, `lte`, or `between`. The engine keeps a pattern index for
22
+ * a field whose type includes `pattern`. It answers `contains`, `eq`, `ne`,
23
+ * `in`, `nin`, `startsWith`, and `endsWith` on that field from the index,
24
+ * comparing case folds for any of those tests that sets `caseFold`. The engine
25
+ * raises `DOC_VALIDATION_FAILED` for a value longer than
26
+ * {@link IndexConfig.patternValueLimit} in such a field. A later release will
27
+ * add partial-word search for the fields whose types include `partial`.
27
28
  *
28
29
  * @public
29
30
  */
@@ -51,7 +52,8 @@ type FieldOptionChain<Remaining extends string> = {
51
52
  * The engine stores and compares a `verbatim` value exactly as written, as one
52
53
  * piece of text. Because the engine keeps that value whole, it leaves the
53
54
  * field out of keyword search, although it can test the whole value in a
54
- * filter.
55
+ * filter. The engine keeps a pattern index for every `verbatim` field, so it
56
+ * can also test such a field with `contains` and `caseFold`.
55
57
  *
56
58
  * Add the {@link TextFieldOption} options to a `string` or `string[]` type, or
57
59
  * `sortable` alone to a `verbatim` or `verbatim[]` type, as in
package/dist/server.d.ts CHANGED
@@ -1,15 +1,15 @@
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-C7UMCMH3.js';
2
- import { b as ServerOptions, N as NarsilServer } from './capabilities-Dt-7B4Wz.js';
3
- export { A as ASYNC_IMPORT_CAPABILITY, C as CorsOptions, 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-Dt-7B4Wz.js';
4
- import { a as Narsil } from './engine-igk0aMpQ.js';
5
- import { d as TaskProgress, b as ImportResult, h as TaskStore, e as TaskRecord } from './tasks-BZt_zes6.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-BZt_zes6.js';
7
- import './schema-Bgzr4g7b.js';
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-B4jMmygw.js';
2
+ import { b as ServerOptions, N as NarsilServer } from './capabilities-CYeAWYxQ.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-CYeAWYxQ.js';
4
+ import { N as Narsil } from './engine-D_OzKZ-6.js';
5
+ import { d as TaskProgress, b as ImportResult, h as TaskStore, e as TaskRecord } from './tasks-DpgCpW1x.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-DpgCpW1x.js';
7
+ import './schema-BBOCdhND.js';
8
8
  import './adapters-79OIa4xm.js';
9
- import './config-rBpbgTw8.js';
10
- import './config-Dfanyqqt.js';
11
- import './types-gOUqhs2F.js';
12
- import './types-D5OwhtsQ.js';
9
+ import './config-Bv8etwUZ.js';
10
+ import './config-QXU3HMpq.js';
11
+ import './types-BiUmaiWT.js';
12
+ import './types-Cb9kiY5P.js';
13
13
 
14
14
  /**
15
15
  * What a running task reports back while it works, and how it learns that a