@delali/narsil 0.3.1-next.74 → 0.3.1-next.76

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 (45) hide show
  1. package/dist/{capabilities-CAMzmkAg.d.ts → capabilities-1lEYL3WK.d.ts} +16 -2
  2. package/dist/{chunk-Z3DQPOJQ.mjs → chunk-356UOTK2.mjs} +1 -1
  3. package/dist/chunk-4344I4MR.mjs +2217 -0
  4. package/dist/{chunk-PO53FV4Q.mjs → chunk-AMGDG4ZJ.mjs} +1 -1
  5. package/dist/{chunk-LX4JERXI.mjs → chunk-BT62MUM5.mjs} +1 -1
  6. package/dist/{chunk-NOZUQM7J.mjs → chunk-BT6BI4GV.mjs} +41 -3
  7. package/dist/{chunk-VKX2BPXD.mjs → chunk-D4EF7J3I.mjs} +127 -20
  8. package/dist/{chunk-BVBIQQKG.mjs → chunk-DFFQOA7S.mjs} +26 -67
  9. package/dist/{chunk-CTOSGRM7.mjs → chunk-G7IP3UDZ.mjs} +6 -5
  10. package/dist/chunk-GES7U2PM.mjs +68 -0
  11. package/dist/{chunk-CUZOX6CN.mjs → chunk-HH6ALOUZ.mjs} +31 -27
  12. package/dist/{chunk-LJYTW7GT.mjs → chunk-IBR6634K.mjs} +1 -1
  13. package/dist/{chunk-I23G3IZC.mjs → chunk-NO3ABFLE.mjs} +2 -63
  14. package/dist/{chunk-T5ZWEWVD.mjs → chunk-PJU6EF22.mjs} +3 -2
  15. package/dist/{chunk-TVFLHM7M.mjs → chunk-PXDY5VRT.mjs} +3 -3
  16. package/dist/{chunk-3DDUNI6N.mjs → chunk-V3B24XR7.mjs} +7 -1
  17. package/dist/{client-C-I70ArH.d.ts → client-ZXcbSViH.d.ts} +2 -2
  18. package/dist/client.d.ts +6 -6
  19. package/dist/{config-C6Iw5rCX.d.ts → config-DHL2KsfD.d.ts} +1 -1
  20. package/dist/{config-DJPH3IQB.d.ts → config-DTe5EbWW.d.ts} +4 -2
  21. package/dist/direct-executor-Q7PNCGZB.mjs +17 -0
  22. package/dist/distribution/coordinator/etcd.mjs +1 -1
  23. package/dist/distribution/coordinator/in-memory.mjs +1 -1
  24. package/dist/distribution.d.ts +5 -5
  25. package/dist/distribution.mjs +22 -15
  26. package/dist/{engine-B8eRPO7m.d.ts → engine-BjPBzWkA.d.ts} +1 -1
  27. package/dist/index.browser.mjs +158 -38
  28. package/dist/index.d.ts +5 -5
  29. package/dist/index.mjs +13 -13
  30. package/dist/invalidation/filesystem.mjs +1 -1
  31. package/dist/{memory-DJEwWoCi.d.ts → memory-DW3OJ0im.d.ts} +105 -24
  32. package/dist/partial-words.mjs +5 -4
  33. package/dist/pattern.mjs +3 -2
  34. package/dist/persistence/durability/checkpoint-worker.mjs +13 -13
  35. package/dist/react.d.ts +6 -6
  36. package/dist/server.d.ts +8 -8
  37. package/dist/server.mjs +34 -11
  38. package/dist/{tasks-BVmAKYBh.d.ts → tasks-BTbwBqar.d.ts} +1 -1
  39. package/dist/{thread-W6DPKEF6.mjs → thread-YOTNJEVY.mjs} +15 -10
  40. package/dist/vector/search-worker.mjs +2 -2
  41. package/dist/workers/entry.mjs +3 -3
  42. package/package.json +8 -7
  43. package/dist/chunk-XW25X6AU.mjs +0 -614
  44. package/dist/chunk-ZKRV5M2P.mjs +0 -75
  45. package/dist/direct-executor-KFAGILJC.mjs +0 -17
@@ -1,17 +1,17 @@
1
- import { validateWorkerConfig, validateIndexName, validatePatternValueLimit, requireSurfaceFormsForPartialFields, validateBM25Params, validatePartitionConfig, executeQuery, queryBindingOf, executePreflight, executeSuggest, executeListDocuments, validateDocId } from './chunk-CTOSGRM7.mjs';
1
+ import { validateWorkerConfig, validateIndexName, validatePatternValueLimit, requireSurfaceFormsForPartialFields, validateBM25Params, validatePartitionConfig, executeQuery, queryBindingOf, executePreflight, executeSuggest, executeListDocuments, validateDocId } from './chunk-G7IP3UDZ.mjs';
2
2
  import { ReplicationMessageTypes } from './chunk-GCM3JFVA.mjs';
3
- import { WIRE_BATCH_BUDGET, resolveVectorText, bindEngineCore, restoredConfigFields, restoredEmbedding, collectRequiredFieldFailures, embedChunkDocuments, providedDocId, requireDocumentObject, admitInsert, asBatchInsertError, requireMatchingDocId, embedDocumentFields, assertDocumentCarriesMappedVectors, admitBufferedUpsert, createPendingAdmissions, recordPendingAdmission } from './chunk-LX4JERXI.mjs';
4
- import { NATIVE_CRC32_MIN_BYTES, generateId, decodeEveryStoredDocument, createSharedFrozenSegment, shareSegmentArrays, splitWorkerBudget, resolveWorkerCount, createDirectExecutor, createPartitionRouter, requirePatternSearchFor, requirePartialWordSearchFor, MAX_FILE_BYTES, resolveWorkerEntry, missingWorkerEntry, readHeapStatistics, nodeThreadId, CHECKSUM_YIELD_CHUNK_BYTES, createPartitionManager, buildSegmentPayload, resolvePartitionInsertOptions, createFrozenSegment, resolveRequestThreadCount, vectorsPerFile, vectorsToBytes, VECTOR_FILE_PAYLOAD_VERSION, deadBitsWhere, NO_LIVE_VECTOR_AT_POSITION, createPartitionIndex, selectionKeeps, decodeMapWithoutFields, isCompositePartition, segmentArraysOf, mergeSegmentContents, survivorDocumentsOf, partitionStateOf, VECTOR_FILE_MAX_VECTORS, deadBytesFor, resolveIndexAnalysis, mergeFrozenSegments, workerResourceLimits, decodeVectorIndexParts, bytesToVectors, freezeSegmentShared, DEFAULT_BACKPRESSURE_LIMIT, DEFAULT_REQUEST_TIMEOUT_MS, SHUTDOWN_TIMEOUT_MS, decodeVectorFilePayload, decodeVectorGraphPartPayload, assembleGraphParts, countDead, encodeSegmentState, CONSECUTIVE_TIMEOUTS_BEFORE_DEATH, VALID_HNSW_METRICS, spawnNodeWorker, decodeVectorGraphPayload, graphPartsOfEarlierPayload, decodeStoredDocument, isDead } from './chunk-BVBIQQKG.mjs';
5
- import { collectQueryTermStats, mergePartitionStats, oversampledFacetConfig, fnv1a, kWayMerge, mergeFacets, setNestedValue } from './chunk-VKX2BPXD.mjs';
3
+ import { WIRE_BATCH_BUDGET, resolveVectorText, bindEngineCore, restoredConfigFields, restoredEmbedding, collectRequiredFieldFailures, embedChunkDocuments, providedDocId, requireDocumentObject, admitInsert, asBatchInsertError, requireMatchingDocId, embedDocumentFields, assertDocumentCarriesMappedVectors, admitBufferedUpsert, createPendingAdmissions, recordPendingAdmission } from './chunk-BT62MUM5.mjs';
4
+ import { NATIVE_CRC32_MIN_BYTES, generateId, decodeEveryStoredDocument, createSharedFrozenSegment, shareSegmentArrays, splitWorkerBudget, resolveWorkerCount, createDirectExecutor, createPartitionRouter, requirePartialWordSearchFor, MAX_FILE_BYTES, resolveWorkerEntry, missingWorkerEntry, readHeapStatistics, nodeThreadId, CHECKSUM_YIELD_CHUNK_BYTES, createPartitionManager, buildSegmentPayload, resolvePartitionInsertOptions, createFrozenSegment, resolveRequestThreadCount, vectorsPerFile, vectorsToBytes, VECTOR_FILE_PAYLOAD_VERSION, deadBitsWhere, NO_LIVE_VECTOR_AT_POSITION, createPartitionIndex, selectionKeeps, decodeMapWithoutFields, isCompositePartition, segmentArraysOf, mergeSegmentContents, survivorDocumentsOf, partitionStateOf, VECTOR_FILE_MAX_VECTORS, deadBytesFor, resolveIndexAnalysis, mergeFrozenSegments, workerResourceLimits, decodeVectorIndexParts, bytesToVectors, freezeSegmentShared, DEFAULT_BACKPRESSURE_LIMIT, DEFAULT_REQUEST_TIMEOUT_MS, SHUTDOWN_TIMEOUT_MS, decodeVectorFilePayload, decodeVectorGraphPartPayload, assembleGraphParts, countDead, encodeSegmentState, CONSECUTIVE_TIMEOUTS_BEFORE_DEATH, VALID_HNSW_METRICS, spawnNodeWorker, decodeVectorGraphPayload, graphPartsOfEarlierPayload, decodeStoredDocument, isDead } from './chunk-DFFQOA7S.mjs';
5
+ import { requirePatternSearchFor, collectQueryTermStats, mergePartitionStats, oversampledFacetConfig, fnv1a, availablePatternSearch, kWayMerge, mergeFacets, PATTERN_HOST, setNestedValue } from './chunk-D4EF7J3I.mjs';
6
6
  import { detectRuntime, getLanguage } from './chunk-4MQ5F4IL.mjs';
7
- import { MAX_INDEX_CONFIGURATION_BYTES, STATISTICS_BROADCAST_INTERVAL_MS, MAX_SWEEP_INTERVAL_MS, MIN_SWEEP_INTERVAL_MS, HEAP_PRESSURE_WARNING_FRACTION, MAX_EXPORT_LINE_BYTES, IMPORT_BATCH_DOCUMENTS, FOREIGN_STATS_TTL_MS, MAX_IMPORT_REFUSALS_REPORTED, BATCH_CHUNK_SIZE, MIN_DOCUMENTS_FOR_SEGMENTS, HEAP_PRESSURE_REARM_FRACTION, EXPORT_CHUNK_BYTES } from './chunk-3DDUNI6N.mjs';
8
- import { releaseLocksHeldBy } from './chunk-PO53FV4Q.mjs';
7
+ import { MAX_INDEX_CONFIGURATION_BYTES, STATISTICS_BROADCAST_INTERVAL_MS, MAX_SWEEP_INTERVAL_MS, MIN_SWEEP_INTERVAL_MS, HEAP_PRESSURE_WARNING_FRACTION, MAX_EXPORT_LINE_BYTES, IMPORT_BATCH_DOCUMENTS, FOREIGN_STATS_TTL_MS, MAX_IMPORT_REFUSALS_REPORTED, BATCH_CHUNK_SIZE, MIN_DOCUMENTS_FOR_SEGMENTS, HEAP_PRESSURE_REARM_FRACTION, EXPORT_CHUNK_BYTES } from './chunk-V3B24XR7.mjs';
8
+ import { releaseLocksHeldBy } from './chunk-AMGDG4ZJ.mjs';
9
9
  import { requireSearchBackendSettings } from './chunk-2E35UM3G.mjs';
10
- import { DEFAULT_PATTERN_WORK_CAP, MATCHER_STATE_BUDGET_BYTES, MATCHER_SIMULATION_BYTES_PER_POSITION, MATCHER_STATE_OVERHEAD_BYTES, PATTERN_TEST_OPERATORS, MATCHER_CODE_POINT_BYTES } from './chunk-ZKRV5M2P.mjs';
11
- import { getNestedValue, parseVectorDimension } from './chunk-I23G3IZC.mjs';
12
- import { extractVectorFieldsFromSchema, messagePackUpperBoundBytes, validateSchema, requireCreatableSchema, validateVectorPromotion, validateVectorStorage, raiseEarlierReleaseGraphSetting, flattenSchema, isSingleStringFieldType, requireValidFieldTypes, encodeDocument, VECTOR_PATTERN, schemaFieldsOf, MAX_DOCUMENT_NESTING_DEPTH, isQuantizationMode, isStorageMode, validateRequiredFields, requireDocumentWithinSizeLimit, validateDocument, validateDocumentStrict } from './chunk-Z3DQPOJQ.mjs';
10
+ import { DEFAULT_PATTERN_WORK_CAP, MATCHER_STATE_BUDGET_BYTES, PATTERN_TEST_OPERATORS, PATTERN_EXPRESSION_OPERATORS, MATCHER_CODE_POINT_BYTES, MATCHER_SIMULATION_BYTES_PER_POSITION, MATCHER_STATE_OVERHEAD_BYTES } from './chunk-4344I4MR.mjs';
11
+ import { getNestedValue, parseVectorDimension } from './chunk-NO3ABFLE.mjs';
12
+ import { extractVectorFieldsFromSchema, messagePackUpperBoundBytes, validateSchema, requireCreatableSchema, validateVectorPromotion, validateVectorStorage, raiseEarlierReleaseGraphSetting, flattenSchema, isSingleStringFieldType, requireValidFieldTypes, encodeDocument, VECTOR_PATTERN, schemaFieldsOf, MAX_DOCUMENT_NESTING_DEPTH, isQuantizationMode, isStorageMode, validateRequiredFields, requireDocumentWithinSizeLimit, validateDocument, validateDocumentStrict } from './chunk-356UOTK2.mjs';
13
13
  import { MIN_M } from './chunk-KEHK2O6P.mjs';
14
- import { compareCodePoints, foldedCodePointCount, codePointCount } from './chunk-LJYTW7GT.mjs';
14
+ import { compareCodePoints, foldedCodePointCount, codePointCount } from './chunk-IBR6634K.mjs';
15
15
  import { createRequestId, isValidWorkerResponse, threadSlotOfWorker } from './chunk-POWOTUKJ.mjs';
16
16
  import { ErrorCodes, NarsilError } from './chunk-I64LXKO3.mjs';
17
17
  import { encode, decode } from '@msgpack/msgpack';
@@ -10228,57 +10228,61 @@ var POSITIONS_PER_WORD = 32;
10228
10228
  function positionWords(positions) {
10229
10229
  return Math.max(1, Math.ceil(positions / POSITIONS_PER_WORD));
10230
10230
  }
10231
- function automatonBytes(positions) {
10232
- return 2 * positionWords(positions) * Uint32Array.BYTES_PER_ELEMENT + positions * MATCHER_CODE_POINT_BYTES;
10233
- }
10234
10231
  function smallestMatcherBytes(positions) {
10235
- return automatonBytes(positions) + positions * MATCHER_SIMULATION_BYTES_PER_POSITION + MATCHER_STATE_OVERHEAD_BYTES + positions * Uint32Array.BYTES_PER_ELEMENT;
10232
+ return 2 * positionWords(positions) * Uint32Array.BYTES_PER_ELEMENT + positions * MATCHER_CODE_POINT_BYTES + positions * MATCHER_SIMULATION_BYTES_PER_POSITION + MATCHER_STATE_OVERHEAD_BYTES + positions * Uint32Array.BYTES_PER_ELEMENT;
10236
10233
  }
10237
- function widestPatternSplit(positions) {
10238
- return Math.max(1, Math.floor(MATCHER_STATE_BUDGET_BYTES / smallestMatcherBytes(positions)));
10234
+ function widestPatternSplit(footprintBytes) {
10235
+ return Math.max(1, Math.floor(MATCHER_STATE_BUDGET_BYTES / Math.max(1, footprintBytes)));
10239
10236
  }
10240
10237
 
10241
10238
  // src/core/pattern-index/query-positions.ts
10242
10239
  function isRecord4(value) {
10243
10240
  return value !== null && typeof value === "object" && !Array.isArray(value);
10244
10241
  }
10245
- function textPositions(text, caseFold) {
10246
- if (typeof text !== "string") return 0;
10247
- return caseFold ? foldedCodePointCount(text) : codePointCount(text);
10242
+ function literalFootprint(text, caseFold) {
10243
+ if (typeof text !== "string") return null;
10244
+ return smallestMatcherBytes(caseFold ? foldedCodePointCount(text) : codePointCount(text));
10248
10245
  }
10249
10246
  function larger(left, right) {
10250
10247
  if (left === null) return right;
10251
10248
  if (right === null) return left;
10252
10249
  return Math.max(left, right);
10253
10250
  }
10254
- function largestTestOf(filter) {
10251
+ function largestTestOf(filter, module) {
10255
10252
  const caseFold = filter.caseFold === true;
10256
10253
  let largest = null;
10257
10254
  for (const operator of PATTERN_TEST_OPERATORS) {
10258
10255
  const operand = filter[operator];
10259
10256
  if (operand === void 0) continue;
10260
10257
  const texts = Array.isArray(operand) ? operand : [operand];
10261
- for (const text of texts) largest = larger(largest, textPositions(text, caseFold));
10258
+ for (const text of texts) largest = larger(largest, literalFootprint(text, caseFold));
10259
+ }
10260
+ for (const operator of PATTERN_EXPRESSION_OPERATORS) {
10261
+ const pattern = filter[operator];
10262
+ if (typeof pattern !== "string") continue;
10263
+ largest = larger(largest, module.expressionFootprint(operator, pattern, caseFold, PATTERN_HOST));
10262
10264
  }
10263
10265
  return largest;
10264
10266
  }
10265
- function largestIn(expression, patternFields) {
10267
+ function largestIn(expression, patternFields, module) {
10266
10268
  let largest = null;
10267
10269
  if (isRecord4(expression.fields)) {
10268
10270
  for (const [fieldPath, filter] of Object.entries(expression.fields)) {
10269
- if (patternFields.has(fieldPath) && isRecord4(filter)) largest = larger(largest, largestTestOf(filter));
10271
+ if (patternFields.has(fieldPath) && isRecord4(filter)) largest = larger(largest, largestTestOf(filter, module));
10270
10272
  }
10271
10273
  }
10272
10274
  const nested = [...expression.and ?? [], ...expression.or ?? []];
10273
10275
  if (expression.not !== void 0) nested.push(expression.not);
10274
- for (const child of nested) largest = larger(largest, largestIn(child, patternFields));
10276
+ for (const child of nested) largest = larger(largest, largestIn(child, patternFields, module));
10275
10277
  return largest;
10276
10278
  }
10277
- function largestPatternTest(expression, schema) {
10279
+ function largestPatternFootprint(expression, schema) {
10278
10280
  if (expression === void 0) return null;
10281
+ const module = availablePatternSearch();
10282
+ if (module === null) return null;
10279
10283
  const patternFields = /* @__PURE__ */ new Set();
10280
10284
  for (const { path, pattern } of schemaFieldsOf(schema)) if (pattern) patternFields.add(path);
10281
- return patternFields.size === 0 ? null : largestIn(expression, patternFields);
10285
+ return patternFields.size === 0 ? null : largestIn(expression, patternFields, module);
10282
10286
  }
10283
10287
 
10284
10288
  // src/engine/orchestration/search.ts
@@ -10345,7 +10349,7 @@ function isWorkCapError(err) {
10345
10349
  function patternSplitWidth(state, indexName, params) {
10346
10350
  const schema = state.indexRegistry.get(indexName)?.config.schema;
10347
10351
  if (schema === void 0) return Number.POSITIVE_INFINITY;
10348
- const largest = largestPatternTest(params.filters, schema);
10352
+ const largest = largestPatternFootprint(params.filters, schema);
10349
10353
  if (largest === null) return Number.POSITIVE_INFINITY;
10350
10354
  if (typeof SharedArrayBuffer !== "function") return 1;
10351
10355
  return widestPatternSplit(largest);
@@ -290,4 +290,4 @@ function compareSortValues(aValues, bValues, directions) {
290
290
  return 0;
291
291
  }
292
292
 
293
- export { SORT_MODES, SORT_VALUE_MAX_CODE_POINTS, appendFoldedCodePoint, codePointCount, compareCodePoints, compareComparableKeys, compareComparableValues, compareSortValues, defaultSortMode, exceedsCodePoints, foldedCodePointCount, holdsUnpairedSurrogate, isSortMode, readSortField, sortModeOf, toComparableSortValue, toReducedSortValue, truncateSortString };
293
+ export { SORT_MODES, SORT_VALUE_MAX_CODE_POINTS, appendFoldedCodePoint, codePointCount, compareCodePoints, compareComparableKeys, compareComparableValues, compareSortValues, defaultSortMode, exceedsCodePoints, foldedCodePointCount, holdsUnpairedSurrogate, isSortMode, readSortField, singleFoldTable, sortModeOf, toComparableSortValue, toReducedSortValue, truncateSortString };
@@ -1,4 +1,4 @@
1
- import { isWordIndexedBase, flattenSchema } from './chunk-Z3DQPOJQ.mjs';
1
+ import { isWordIndexedBase, flattenSchema } from './chunk-356UOTK2.mjs';
2
2
  import { createNarsilError, ErrorCodes } from './chunk-I64LXKO3.mjs';
3
3
 
4
4
  // src/core/tokenizer/constants.ts
@@ -457,67 +457,6 @@ function* tokenizeIterator(text, language, options) {
457
457
  }
458
458
  }
459
459
 
460
- // src/core/fuzzy.ts
461
- var FIRST_SURROGATE = 55296;
462
- var LAST_SURROGATE = 57343;
463
- var LAST_BASIC_PLANE_CODE_POINT = 65535;
464
- function hasSurrogate(text) {
465
- for (let index = 0; index < text.length; index++) {
466
- const unit = text.charCodeAt(index);
467
- if (unit >= FIRST_SURROGATE && unit <= LAST_SURROGATE) return true;
468
- }
469
- return false;
470
- }
471
- function fuzzyPrefixOf(queryTerm, prefixLength) {
472
- let end = 0;
473
- for (let counted = 0; counted < prefixLength && end < queryTerm.length; counted++) {
474
- const codePoint = queryTerm.codePointAt(end);
475
- end += codePoint !== void 0 && codePoint > LAST_BASIC_PLANE_CODE_POINT ? 2 : 1;
476
- }
477
- return queryTerm.slice(0, end);
478
- }
479
- function fuzzyTermMatches(queryTerm, indexTerm, tolerance, prefixLength) {
480
- if (queryTerm === indexTerm) return true;
481
- if (tolerance <= 0) return false;
482
- if (!indexTerm.startsWith(fuzzyPrefixOf(queryTerm, prefixLength))) return false;
483
- return boundedLevenshtein(queryTerm, indexTerm, tolerance).withinTolerance;
484
- }
485
- function boundedLevenshtein(a, b, tolerance) {
486
- if (tolerance < 0) return { distance: -1, withinTolerance: false };
487
- if (a === b) return { distance: 0, withinTolerance: true };
488
- if (hasSurrogate(a) || hasSurrogate(b)) return bandedDistance(Array.from(a), Array.from(b), tolerance);
489
- return bandedDistance(a, b, tolerance);
490
- }
491
- function bandedDistance(a, b, tolerance) {
492
- const m = a.length;
493
- const n = b.length;
494
- const beyond = tolerance + 1;
495
- if (Math.abs(m - n) > tolerance) return { distance: beyond, withinTolerance: false };
496
- let previous = new Uint32Array(n + 1).fill(beyond);
497
- let current = new Uint32Array(n + 1).fill(beyond);
498
- const firstRowEnd = Math.min(n, tolerance);
499
- for (let j = 0; j <= firstRowEnd; j++) previous[j] = j;
500
- for (let i = 1; i <= m; i++) {
501
- const low = Math.max(1, i - tolerance);
502
- const high = Math.min(n, i + tolerance);
503
- current[low - 1] = low === 1 ? i : beyond;
504
- let rowMin = current[low - 1];
505
- const character = a[i - 1];
506
- for (let j = low; j <= high; j++) {
507
- const substitution = previous[j - 1] + (character === b[j - 1] ? 0 : 1);
508
- const cell = Math.min(previous[j] + 1, current[j - 1] + 1, substitution, beyond);
509
- current[j] = cell;
510
- if (cell < rowMin) rowMin = cell;
511
- }
512
- if (rowMin > tolerance) return { distance: beyond, withinTolerance: false };
513
- const finished = previous;
514
- previous = current;
515
- current = finished;
516
- }
517
- const distance = previous[n];
518
- return { distance, withinTolerance: distance <= tolerance };
519
- }
520
-
521
460
  // src/core/partition/utils.ts
522
461
  function getOrCreateFieldNameIndex(table, fieldName) {
523
462
  const existing = table.indexMap.get(fieldName);
@@ -590,4 +529,4 @@ function getFieldValueByInternalId(docStore, internalId, fieldPath) {
590
529
  return getFieldValueForDoc(docStore, externalId, fieldPath);
591
530
  }
592
531
 
593
- export { boundedLevenshtein, clearNormalizationCache, configureNormalizationCache, fuzzyPrefixOf, fuzzyTermMatches, getFieldValueByInternalId, getFieldValueForDoc, getFlatSchema, getNestedValue, getNormalizationCacheSize, getOrCreateFieldNameIndex, parseVectorDimension, resetNormalizationCache, textFieldsChanged, tokenize, tokenizeIterator, tokenizeOptions, visitTokens };
532
+ export { clearNormalizationCache, configureNormalizationCache, getFieldValueByInternalId, getFieldValueForDoc, getFlatSchema, getNestedValue, getNormalizationCacheSize, getOrCreateFieldNameIndex, parseVectorDimension, resetNormalizationCache, textFieldsChanged, tokenize, tokenizeIterator, tokenizeOptions, visitTokens };
@@ -1,5 +1,6 @@
1
- import { tokenizeOptions, getNestedValue, tokenizeIterator, fuzzyTermMatches } from './chunk-I23G3IZC.mjs';
2
- import { compareCodePoints } from './chunk-LJYTW7GT.mjs';
1
+ import { tokenizeOptions, getNestedValue, tokenizeIterator } from './chunk-NO3ABFLE.mjs';
2
+ import { fuzzyTermMatches } from './chunk-GES7U2PM.mjs';
3
+ import { compareCodePoints } from './chunk-IBR6634K.mjs';
3
4
 
4
5
  // src/core/partition/suggestions.ts
5
6
  function verbatimOccurrences(state, token) {
@@ -1,7 +1,7 @@
1
- import { readSharedConfigFields, restoredEmbedding, restoredPartitionConfig, MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR } from './chunk-LX4JERXI.mjs';
1
+ import { readSharedConfigFields, restoredEmbedding, restoredPartitionConfig, MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR } from './chunk-BT62MUM5.mjs';
2
2
  import { getLanguage } from './chunk-4MQ5F4IL.mjs';
3
- import { MAX_INDEX_NAME_LENGTH, INDEX_NAME_PATTERN } from './chunk-3DDUNI6N.mjs';
4
- import { compareCodePoints } from './chunk-LJYTW7GT.mjs';
3
+ import { MAX_INDEX_NAME_LENGTH, INDEX_NAME_PATTERN } from './chunk-V3B24XR7.mjs';
4
+ import { compareCodePoints } from './chunk-IBR6634K.mjs';
5
5
  import { NarsilError, ErrorCodes } from './chunk-I64LXKO3.mjs';
6
6
  import { encode, decode } from '@msgpack/msgpack';
7
7
 
@@ -1,3 +1,9 @@
1
+ // src/filters/constants.ts
2
+ var MAX_FILTER_DEPTH = 30;
3
+ var MAX_FILTER_TESTS = 1024;
4
+ var MAX_FILTER_ARRAY_SIZE = 65536;
5
+ var GEO_UNIT_METRES = { km: 1e3, mi: 1609.344, m: 1 };
6
+
1
7
  // src/search/constants.ts
2
8
  var RESULT_WINDOW = 1e4;
3
9
  var DEFAULT_PAGE_SIZE = 10;
@@ -45,4 +51,4 @@ var SUGGEST_OVERSAMPLE_FACTOR = 1.5;
45
51
  var SUGGEST_OVERSAMPLE_PADDING = 10;
46
52
  var MAX_SUGGEST_SCATTER_LIMIT = Math.ceil(MAX_SUGGEST_LIMIT * SUGGEST_OVERSAMPLE_FACTOR) + SUGGEST_OVERSAMPLE_PADDING;
47
53
 
48
- export { ABSOLUTE_WINDOWS_PATH_PATTERN, BATCH_CHUNK_SIZE, DEFAULT_FUZZY_PREFIX_LENGTH, DEFAULT_LIMIT, DEFAULT_LINEAR_ALPHA, DEFAULT_MAX_PER_GROUP, DEFAULT_OFFSET, DEFAULT_PAGE_SIZE, DEFAULT_RANK_CONSTANT, DEFAULT_SUGGEST_LIMIT, EXPORT_CHUNK_BYTES, FOREIGN_STATS_TTL_MS, HEAP_PRESSURE_REARM_FRACTION, HEAP_PRESSURE_WARNING_FRACTION, IMPORT_BATCH_DOCUMENTS, INDEX_NAME_PATTERN, MAX_CURSOR_ANCHOR_CODE_POINTS, MAX_CURSOR_LENGTH, MAX_DOC_ID_LENGTH, MAX_EXPORT_LINE_BYTES, MAX_IMPORT_REFUSALS_REPORTED, MAX_INDEX_CONFIGURATION_BYTES, MAX_INDEX_NAME_LENGTH, MAX_LINEAR_ALPHA, MAX_PREFIX_LENGTH, MAX_SORT_FIELDS, MAX_SORT_FIELD_NAME_LENGTH, MAX_SUGGEST_LIMIT, MAX_SUGGEST_SCATTER_LIMIT, MAX_SWEEP_INTERVAL_MS, MAX_TOLERANCE, MIN_DOCUMENTS_FOR_SEGMENTS, MIN_LINEAR_ALPHA, MIN_RANK_CONSTANT, MIN_SWEEP_INTERVAL_MS, MODULE_URL_SCHEME_PATTERN, PARTIAL_WORDS_ADDED_PER_QUERY, PARTIAL_WORD_MIN_CODE_POINTS, PREFIX_MAX_EXPANSIONS, RESULT_WINDOW, STATISTICS_BROADCAST_INTERVAL_MS, SUGGEST_OVERSAMPLE_FACTOR, SUGGEST_OVERSAMPLE_PADDING };
54
+ export { ABSOLUTE_WINDOWS_PATH_PATTERN, BATCH_CHUNK_SIZE, DEFAULT_FUZZY_PREFIX_LENGTH, DEFAULT_LIMIT, DEFAULT_LINEAR_ALPHA, DEFAULT_MAX_PER_GROUP, DEFAULT_OFFSET, DEFAULT_PAGE_SIZE, DEFAULT_RANK_CONSTANT, DEFAULT_SUGGEST_LIMIT, EXPORT_CHUNK_BYTES, FOREIGN_STATS_TTL_MS, GEO_UNIT_METRES, HEAP_PRESSURE_REARM_FRACTION, HEAP_PRESSURE_WARNING_FRACTION, IMPORT_BATCH_DOCUMENTS, INDEX_NAME_PATTERN, MAX_CURSOR_ANCHOR_CODE_POINTS, MAX_CURSOR_LENGTH, MAX_DOC_ID_LENGTH, MAX_EXPORT_LINE_BYTES, MAX_FILTER_ARRAY_SIZE, MAX_FILTER_DEPTH, MAX_FILTER_TESTS, MAX_IMPORT_REFUSALS_REPORTED, MAX_INDEX_CONFIGURATION_BYTES, MAX_INDEX_NAME_LENGTH, MAX_LINEAR_ALPHA, MAX_PREFIX_LENGTH, MAX_SORT_FIELDS, MAX_SORT_FIELD_NAME_LENGTH, MAX_SUGGEST_LIMIT, MAX_SUGGEST_SCATTER_LIMIT, MAX_SWEEP_INTERVAL_MS, MAX_TOLERANCE, MIN_DOCUMENTS_FOR_SEGMENTS, MIN_LINEAR_ALPHA, MIN_RANK_CONSTANT, MIN_SWEEP_INTERVAL_MS, MODULE_URL_SCHEME_PATTERN, PARTIAL_WORDS_ADDED_PER_QUERY, PARTIAL_WORD_MIN_CODE_POINTS, PREFIX_MAX_EXPANSIONS, RESULT_WINDOW, STATISTICS_BROADCAST_INTERVAL_MS, SUGGEST_OVERSAMPLE_FACTOR, SUGGEST_OVERSAMPLE_PADDING };
@@ -1,6 +1,6 @@
1
1
  import { P as PartitionConfig, A as AnyDocument, a as InsertOptions, W as WriteOptions } from './schema-DgyDijhf.js';
2
- import { V as VectorMaintenanceResult, B as BatchResult, L as ListParams, h as ListResult, I as IndexInfo, g as IndexStats, P as PartitionStatsResult, Q as QueryParams, e as QueryResult, j as PreflightResult, k as SuggestParams, l as SuggestResult } from './memory-DJEwWoCi.js';
3
- import { e as TaskRecord, M as MemoryStatsResponse, b as ImportResult, H as HttpIndexConfig, c as TaskListQuery, T as TaskListPage } from './tasks-BVmAKYBh.js';
2
+ import { V as VectorMaintenanceResult, B as BatchResult, L as ListParams, h as ListResult, I as IndexInfo, g as IndexStats, P as PartitionStatsResult, Q as QueryParams, e as QueryResult, j as PreflightResult, k as SuggestParams, l as SuggestResult } from './memory-DW3OJ0im.js';
3
+ import { e as TaskRecord, M as MemoryStatsResponse, b as ImportResult, H as HttpIndexConfig, c as TaskListQuery, T as TaskListPage } from './tasks-BTbwBqar.js';
4
4
 
5
5
  /**
6
6
  * This is the `fetch` implementation the client sends every request through.
package/dist/client.d.ts CHANGED
@@ -1,10 +1,10 @@
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-DJEwWoCi.js';
2
- export { A as ASYNC_IMPORT_CAPABILITY, D as DOCUMENT_EXPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, R as REBUILD_ANALYSIS_CAPABILITY, S as SERVER_CAPABILITIES, T as TASK_CANCEL_CAPABILITY, a as TASK_FILTER_CAPABILITY } from './capabilities-CAMzmkAg.js';
3
- export { C as CapabilitiesResponse, a as CreateIndexEmbedding, H as HttpIndexConfig, I as ImportError, b as ImportResult, M as MemoryStatsResponse, T as TaskListPage, c as TaskListQuery, d as TaskProgress, e as TaskRecord, f as TaskStatus, g as TaskType } from './tasks-BVmAKYBh.js';
4
- export { A as AdminOperations, B as BulkOperations, D as DocumentOperations, F as FetchFunction, I as ImportSource, a as IndexOperations, N as NarsilClient, b as NarsilClientOptions, P as PutResult, R as RequestOptions, S as SearchOperations, c as ServerOperations, d as ServerVersion, T as TaskOperations, W as WaitForTaskOptions, e as createNarsilClient } from './client-C-I70ArH.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-DW3OJ0im.js';
2
+ export { A as ASYNC_IMPORT_CAPABILITY, D as DOCUMENT_EXPORT_CAPABILITY, E as ErrorEnvelope, I as INDEX_LIFECYCLE_CAPABILITY, R as REBUILD_ANALYSIS_CAPABILITY, S as SERVER_CAPABILITIES, T as TASK_CANCEL_CAPABILITY, a as TASK_FILTER_CAPABILITY } from './capabilities-1lEYL3WK.js';
3
+ export { C as CapabilitiesResponse, a as CreateIndexEmbedding, H as HttpIndexConfig, I as ImportError, b as ImportResult, M as MemoryStatsResponse, T as TaskListPage, c as TaskListQuery, d as TaskProgress, e as TaskRecord, f as TaskStatus, g as TaskType } from './tasks-BTbwBqar.js';
4
+ export { A as AdminOperations, B as BulkOperations, D as DocumentOperations, F as FetchFunction, I as ImportSource, a as IndexOperations, N as NarsilClient, b as NarsilClientOptions, P as PutResult, R as RequestOptions, S as SearchOperations, c as ServerOperations, d as ServerVersion, T as TaskOperations, W as WaitForTaskOptions, e as createNarsilClient } from './client-ZXcbSViH.js';
5
5
  import './schema-DgyDijhf.js';
6
6
  import './adapters-79OIa4xm.js';
7
- import './config-C6Iw5rCX.js';
8
- import './config-DJPH3IQB.js';
7
+ import './config-DHL2KsfD.js';
8
+ import './config-DTe5EbWW.js';
9
9
  import './types-ChrVy4lH.js';
10
10
  import './types-Cb9kiY5P.js';
@@ -1,4 +1,4 @@
1
- import { N as NarsilConfig } from './config-DJPH3IQB.js';
1
+ import { N as NarsilConfig } from './config-DTe5EbWW.js';
2
2
  import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './types-ChrVy4lH.js';
3
3
  import { N as NodeTransport } from './types-Cb9kiY5P.js';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { P as PersistenceAdapter, I as InvalidationAdapter, E as EmbeddingAdapter } from './adapters-79OIa4xm.js';
2
- import { Q as QueryParams, e as QueryResult, f as NarsilEventHandlers } from './memory-DJEwWoCi.js';
2
+ import { Q as QueryParams, e as QueryResult, f as NarsilEventHandlers } from './memory-DW3OJ0im.js';
3
3
  import { I as IndexConfig, A as AnyDocument } from './schema-DgyDijhf.js';
4
4
 
5
5
  /**
@@ -214,7 +214,9 @@ interface NarsilConfig {
214
214
  * each step of its matcher. For a text whose case fold is shorter than three
215
215
  * code points, it counts each document that it checks as an entry that it
216
216
  * reads. It counts an `in` or `nin` test as one `eq` test for each distinct
217
- * value in its list. Once the count passes the cap, the engine throws
217
+ * value in its list. For an `eq` test with a `tolerance`, it also adds one
218
+ * unit for each cell that it fills in the table of edit distances between
219
+ * the text and a value. Once the count passes the cap, the engine throws
218
220
  * `SEARCH_WORK_CAP_EXCEEDED`. The cap
219
221
  * defaults to 25,000,000 units. For any value other than a whole number from
220
222
  * 1 to `Number.MAX_SAFE_INTEGER`, {@link createNarsil} throws
@@ -0,0 +1,17 @@
1
+ export { createDirectExecutor } from './chunk-DFFQOA7S.mjs';
2
+ import './chunk-D4EF7J3I.mjs';
3
+ import './chunk-4MQ5F4IL.mjs';
4
+ import './chunk-V3B24XR7.mjs';
5
+ import './chunk-TGP5M5R7.mjs';
6
+ import './chunk-AMGDG4ZJ.mjs';
7
+ import './chunk-ZJ4CSAB2.mjs';
8
+ import './chunk-2E35UM3G.mjs';
9
+ import './chunk-4344I4MR.mjs';
10
+ import './chunk-PJU6EF22.mjs';
11
+ import './chunk-NO3ABFLE.mjs';
12
+ import './chunk-356UOTK2.mjs';
13
+ import './chunk-KEHK2O6P.mjs';
14
+ import './chunk-GES7U2PM.mjs';
15
+ import './chunk-U2BKYEC7.mjs';
16
+ import './chunk-IBR6634K.mjs';
17
+ import './chunk-I64LXKO3.mjs';
@@ -1,5 +1,5 @@
1
1
  import { MAX_NODE_ID_LENGTH, MAX_WATCHERS } from '../../chunk-ORBLD3EL.mjs';
2
- import { compareCodePoints } from '../../chunk-LJYTW7GT.mjs';
2
+ import { compareCodePoints } from '../../chunk-IBR6634K.mjs';
3
3
  import { NarsilError, ErrorCodes } from '../../chunk-I64LXKO3.mjs';
4
4
  import { decode, encode } from '@msgpack/msgpack';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { NODE_HEARTBEAT_TTL_MS } from '../../chunk-ORBLD3EL.mjs';
2
- import { compareCodePoints } from '../../chunk-LJYTW7GT.mjs';
2
+ import { compareCodePoints } from '../../chunk-IBR6634K.mjs';
3
3
 
4
4
  // src/distribution/coordinator/in-memory.ts
5
5
  var NODE_HEARTBEAT_PREFIX = "_narsil/node/";
@@ -1,12 +1,12 @@
1
- import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-C6Iw5rCX.js';
2
- export { c as ClusterControllerConfig, d as ClusterNodeInfo, e as ClusterQueryConfig, N as NodeReadiness, R as ReplicationConfig } from './config-C6Iw5rCX.js';
3
- import { B as BatchResult, L as ListParams, h as ListResult, k as SuggestParams, l as SuggestResult, Q as QueryParams, j as PreflightResult, g as IndexStats, P as PartitionStatsResult, M as MemoryStats, m as NarsilEventMap, e as QueryResult } from './memory-DJEwWoCi.js';
1
+ import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-DHL2KsfD.js';
2
+ export { c as ClusterControllerConfig, d as ClusterNodeInfo, e as ClusterQueryConfig, N as NodeReadiness, R as ReplicationConfig } from './config-DHL2KsfD.js';
3
+ import { B as BatchResult, L as ListParams, h as ListResult, k as SuggestParams, l as SuggestResult, Q as QueryParams, j as PreflightResult, g as IndexStats, P as PartitionStatsResult, M as MemoryStats, m as NarsilEventMap, e as QueryResult } from './memory-DW3OJ0im.js';
4
4
  import { I as IndexConfig, A as AnyDocument, a as InsertOptions } from './schema-DgyDijhf.js';
5
5
  import { b as NodeCapacity, N as NodeRole } from './types-ChrVy4lH.js';
6
6
  export { c as AllocationConstraints, d as AllocationEvent, A as AllocationTable, C as ClusterCoordinator, e as NodeEvent, a as NodeRegistration, P as PartitionAssignment, f as PartitionState, S as SchemaEvent, U as UnassignedReason } from './types-ChrVy4lH.js';
7
- import { N as Narsil } from './engine-B8eRPO7m.js';
7
+ import { N as Narsil } from './engine-BjPBzWkA.js';
8
8
  export { L as ListenHandler, N as NodeTransport, R as RespondFn, T as TransportConfig, a as TransportMessage } from './types-Cb9kiY5P.js';
9
- import './config-DJPH3IQB.js';
9
+ import './config-DTe5EbWW.js';
10
10
  import './adapters-79OIa4xm.js';
11
11
 
12
12
  /**
@@ -1,25 +1,25 @@
1
1
  import { MAX_MESSAGE_SIZE_BYTES } from './chunk-UNEEFTEU.mjs';
2
- import { validateIndexName, indexConfigKey, withPartitionCount, indexSettingsOf, putIndexMetadata, getIndexMetadata, getClusterIndexConfig } from './chunk-TVFLHM7M.mjs';
3
- import { requireKnownConfig, resolveRunnableConfig, createEngineCore, startEngineCore, createNarsilFromCore, runEngineQueryStats, runEngineListDocuments, runEngineSuggest, runEnginePreflight, runEngineQuery, createEngineIndex, buildArchiveFromMemory, indexMetadataOf, encodeIndexConfiguration, archiveStream, applyIndexEntry, applyDeleteEntry, requireConfigurationWithinSizeLimit, validateEntryBatchPayload, createAckMessage, validateEntryPayload, validateForwardBatchPayload, createForwardBatchResultMessage, memoryCheckpointStore, readSnapshotArchive, createByteReader, openChecksummedEnvelope, loadPartitionSegments, readListedFile, createForwardBatchMessage, validateForwardBatchResultPayload, createForwardMessage, validateReplicationEntry, crc32Init, crc32Final, crc32Update, computeEntryChecksum, createEntryMessage, createEntryBatchMessage, createInsyncConfirmMessage, validateAckPayload, createInsyncRemoveMessage, validateInsyncConfirmPayload, createInsyncAddMessage } from './chunk-CUZOX6CN.mjs';
4
- import { now, listBindingOf, requireSurfaceFormsForPartialFields, queryBindingOf, hitsKeptPerGroup, clampLimit, resolveHybridFusion, dedupePinnedEntries, foldGroupReducer } from './chunk-CTOSGRM7.mjs';
2
+ import { validateIndexName, indexConfigKey, withPartitionCount, indexSettingsOf, putIndexMetadata, getIndexMetadata, getClusterIndexConfig } from './chunk-PXDY5VRT.mjs';
3
+ import { requireKnownConfig, resolveRunnableConfig, createEngineCore, startEngineCore, createNarsilFromCore, runEngineQueryStats, runEngineListDocuments, runEngineSuggest, runEnginePreflight, runEngineQuery, createEngineIndex, buildArchiveFromMemory, indexMetadataOf, encodeIndexConfiguration, archiveStream, applyIndexEntry, applyDeleteEntry, requireConfigurationWithinSizeLimit, validateEntryBatchPayload, createAckMessage, validateEntryPayload, validateForwardBatchPayload, createForwardBatchResultMessage, memoryCheckpointStore, readSnapshotArchive, createByteReader, openChecksummedEnvelope, loadPartitionSegments, readListedFile, createForwardBatchMessage, validateForwardBatchResultPayload, createForwardMessage, validateReplicationEntry, crc32Init, crc32Final, crc32Update, computeEntryChecksum, createEntryMessage, createEntryBatchMessage, createInsyncConfirmMessage, validateAckPayload, createInsyncRemoveMessage, validateInsyncConfirmPayload, createInsyncAddMessage } from './chunk-HH6ALOUZ.mjs';
4
+ import { now, listBindingOf, requireSurfaceFormsForPartialFields, queryBindingOf, hitsKeptPerGroup, clampLimit, resolveHybridFusion, dedupePinnedEntries, foldGroupReducer } from './chunk-G7IP3UDZ.mjs';
5
5
  import { ReplicationMessageTypes, TransportErrorCodes, ClusterMessageTypes, QueryMessageTypes, TransportError } from './chunk-GCM3JFVA.mjs';
6
- import { providedDocId, MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR, WIRE_BATCH_BUDGET } from './chunk-LX4JERXI.mjs';
7
- import { generateId, decodeVectorFilePayload, bytesToVectors, isDead, FILTER_EXPRESSION_KEYS, FIELD_FILTER_OPERATORS } from './chunk-BVBIQQKG.mjs';
8
- import { oversampledShardSize, resolveProjection, clampRowCount, sortSignatureOf, requireMatchingCursor, decodePageCursor, normalizeSort, sortModesOf, encodePageCursor, applyProjection, readSortValues, requireWithinResultWindow, fnv1a, sortSignatureEntry, MAX_FILTER_DEPTH, filterTestCount, MAX_FILTER_TESTS, fnv1aUint32s, mergePartitionStats, MAX_FILTER_ARRAY_SIZE } from './chunk-VKX2BPXD.mjs';
6
+ import { providedDocId, MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR, WIRE_BATCH_BUDGET } from './chunk-BT62MUM5.mjs';
7
+ import { generateId, decodeVectorFilePayload, bytesToVectors, isDead, FILTER_EXPRESSION_KEYS, FIELD_FILTER_OPERATORS } from './chunk-DFFQOA7S.mjs';
8
+ import { oversampledShardSize, resolveProjection, clampRowCount, sortSignatureOf, requireMatchingCursor, decodePageCursor, normalizeSort, sortModesOf, encodePageCursor, applyProjection, readSortValues, requireWithinResultWindow, fnv1a, sortSignatureEntry, filterTestCount, fnv1aUint32s, mergePartitionStats } from './chunk-D4EF7J3I.mjs';
9
9
  import { getLanguage } from './chunk-4MQ5F4IL.mjs';
10
- import { DEFAULT_SUGGEST_LIMIT, MAX_SUGGEST_LIMIT, DEFAULT_PAGE_SIZE, MAX_SUGGEST_SCATTER_LIMIT, MAX_INDEX_NAME_LENGTH, MAX_SORT_FIELDS, MAX_DOC_ID_LENGTH, MAX_CURSOR_LENGTH, MAX_TOLERANCE, SUGGEST_OVERSAMPLE_FACTOR, SUGGEST_OVERSAMPLE_PADDING, INDEX_NAME_PATTERN, MAX_PREFIX_LENGTH, RESULT_WINDOW } from './chunk-3DDUNI6N.mjs';
10
+ import { DEFAULT_SUGGEST_LIMIT, MAX_SUGGEST_LIMIT, DEFAULT_PAGE_SIZE, MAX_SUGGEST_SCATTER_LIMIT, MAX_INDEX_NAME_LENGTH, MAX_FILTER_DEPTH, MAX_FILTER_TESTS, MAX_SORT_FIELDS, MAX_DOC_ID_LENGTH, MAX_CURSOR_LENGTH, MAX_TOLERANCE, SUGGEST_OVERSAMPLE_FACTOR, SUGGEST_OVERSAMPLE_PADDING, INDEX_NAME_PATTERN, MAX_PREFIX_LENGTH, RESULT_WINDOW, MAX_FILTER_ARRAY_SIZE } from './chunk-V3B24XR7.mjs';
11
11
  import './chunk-TGP5M5R7.mjs';
12
- import './chunk-PO53FV4Q.mjs';
12
+ import './chunk-AMGDG4ZJ.mjs';
13
13
  import { MIN_OVERSAMPLE } from './chunk-ZJ4CSAB2.mjs';
14
14
  import './chunk-2E35UM3G.mjs';
15
- import './chunk-XW25X6AU.mjs';
16
- import './chunk-ZKRV5M2P.mjs';
17
- import './chunk-T5ZWEWVD.mjs';
18
- import './chunk-I23G3IZC.mjs';
19
- import { validateSchema, requireCreatableSchema, encodeDocument, MAX_STORED_VECTOR_DIMENSION, MIN_POLYGON_POINTS, isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MAX_NESTING_DEPTH } from './chunk-Z3DQPOJQ.mjs';
15
+ import { isPatternTolerance } from './chunk-4344I4MR.mjs';
16
+ import './chunk-PJU6EF22.mjs';
17
+ import './chunk-NO3ABFLE.mjs';
18
+ import { validateSchema, requireCreatableSchema, encodeDocument, MAX_STORED_VECTOR_DIMENSION, MIN_POLYGON_POINTS, isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MAX_NESTING_DEPTH } from './chunk-356UOTK2.mjs';
20
19
  import './chunk-KEHK2O6P.mjs';
20
+ import './chunk-GES7U2PM.mjs';
21
21
  import './chunk-U2BKYEC7.mjs';
22
- import { compareCodePoints, toComparableSortValue, compareComparableKeys, isSortMode, SORT_MODES, exceedsCodePoints, compareSortValues } from './chunk-LJYTW7GT.mjs';
22
+ import { compareCodePoints, toComparableSortValue, compareComparableKeys, isSortMode, SORT_MODES, exceedsCodePoints, compareSortValues } from './chunk-IBR6634K.mjs';
23
23
  import './chunk-POWOTUKJ.mjs';
24
24
  import { ErrorCodes, NarsilError, describeError } from './chunk-I64LXKO3.mjs';
25
25
  import { encode, decode } from '@msgpack/msgpack';
@@ -6601,6 +6601,7 @@ function validateFetchResultPayload(decoded) {
6601
6601
 
6602
6602
  // src/distribution/query/validators/filters.ts
6603
6603
  var GEO_UNITS = ["km", "mi", "m"];
6604
+ var TEXT_OPERATORS = /* @__PURE__ */ new Set(["startsWith", "endsWith", "contains", "wildcard", "regex"]);
6604
6605
  function throwTooLong(value, fieldLabel, errorCode) {
6605
6606
  throwInvalid(
6606
6607
  errorCode,
@@ -6773,7 +6774,7 @@ function validateLeafOperator(opKey, opValue, leafLabel, errorCode) {
6773
6774
  validateBetween(opValue, opLabel, errorCode);
6774
6775
  return;
6775
6776
  }
6776
- if (opKey === "startsWith" || opKey === "endsWith" || opKey === "contains") {
6777
+ if (TEXT_OPERATORS.has(opKey)) {
6777
6778
  validateBoundedString(opValue, opLabel, errorCode);
6778
6779
  return;
6779
6780
  }
@@ -6781,6 +6782,12 @@ function validateLeafOperator(opKey, opValue, leafLabel, errorCode) {
6781
6782
  validateBooleanOperand(opValue, opLabel, errorCode);
6782
6783
  return;
6783
6784
  }
6785
+ if (opKey === "tolerance") {
6786
+ if (!isPatternTolerance(opValue)) {
6787
+ throwInvalid(errorCode, `Invalid payload: "${opLabel}" must be 0, 1, 2, or "auto"`);
6788
+ }
6789
+ return;
6790
+ }
6784
6791
  if (opKey === "in" || opKey === "nin") {
6785
6792
  validateStringList(opValue, opLabel, errorCode);
6786
6793
  return;
@@ -1,5 +1,5 @@
1
1
  import { E as EmbeddingAdapter } from './adapters-79OIa4xm.js';
2
- import { B as BatchResult, I as IndexInfo, g as IndexStats, P as PartitionStatsResult, L as ListParams, h as ListResult, Q as QueryParams, e as QueryResult, j as PreflightResult, k as SuggestParams, l as SuggestResult, D as DocumentImportResult, M as MemoryStats, V as VectorMaintenanceResult, m as NarsilEventMap } from './memory-DJEwWoCi.js';
2
+ import { B as BatchResult, I as IndexInfo, g as IndexStats, P as PartitionStatsResult, L as ListParams, h as ListResult, Q as QueryParams, e as QueryResult, j as PreflightResult, k as SuggestParams, l as SuggestResult, D as DocumentImportResult, M as MemoryStats, V as VectorMaintenanceResult, m as NarsilEventMap } from './memory-DW3OJ0im.js';
3
3
  import { A as AnyDocument, a as InsertOptions, W as WriteOptions, I as IndexConfig, P as PartitionConfig } from './schema-DgyDijhf.js';
4
4
 
5
5
  /**