@delali/narsil 0.2.3 → 0.2.4-next.43

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 (36) hide show
  1. package/dist/adapters/filesystem.mjs +1 -1
  2. package/dist/adapters/indexeddb.mjs +1 -1
  3. package/dist/{chunk-MMSWEEZT.mjs → chunk-KEDL6FFZ.mjs} +315 -51
  4. package/dist/{chunk-WU2UZEVD.mjs → chunk-O4Q5JYNK.mjs} +1 -1
  5. package/dist/{chunk-GB2IIJJG.mjs → chunk-TLRUUMVE.mjs} +1 -4
  6. package/dist/{chunk-GRWFY2HI.mjs → chunk-YGQMKTKG.mjs} +120 -36
  7. package/dist/{client-BobVnoIK.d.ts → client-B5uO5jL1.d.ts} +3 -3
  8. package/dist/client.d.ts +8 -8
  9. package/dist/client.mjs +1 -4
  10. package/dist/{config-Byyl1QqH.d.ts → config-B09-cud9.d.ts} +2 -2
  11. package/dist/{config-fLC4lbmg.d.ts → config-NgUCkc6a.d.ts} +2 -2
  12. package/dist/{direct-executor-MSJEVPZU.mjs → direct-executor-7O23GEHE.mjs} +2 -2
  13. package/dist/distribution/coordinator/etcd.d.ts +2 -2
  14. package/dist/distribution/coordinator/etcd.mjs +1 -1
  15. package/dist/distribution/coordinator/in-memory.d.ts +2 -2
  16. package/dist/distribution/transport/grpc.mjs +1 -1
  17. package/dist/distribution.d.ts +8 -8
  18. package/dist/distribution.mjs +705 -272
  19. package/dist/embeddings/openai.mjs +1 -1
  20. package/dist/{engine-BE45D5ZG.d.ts → engine-CjLhdDIm.d.ts} +21 -20
  21. package/dist/index.browser.mjs +436 -91
  22. package/dist/index.d.ts +7 -7
  23. package/dist/index.mjs +4 -4
  24. package/dist/{options-EXYFcem-.d.ts → options-BakECW-r.d.ts} +2 -2
  25. package/dist/persistence/durability/checkpoint-worker.d.ts +1 -1
  26. package/dist/persistence/durability/checkpoint-worker.mjs +4 -4
  27. package/dist/react.d.ts +6 -6
  28. package/dist/react.mjs +1 -4
  29. package/dist/{schema-ZRbk8BgH.d.ts → schema-DXOd96kx.d.ts} +16 -5
  30. package/dist/{search-DHuXwJYk.d.ts → search-BGouJxH4.d.ts} +22 -9
  31. package/dist/server.d.ts +10 -10
  32. package/dist/server.mjs +6 -9
  33. package/dist/{tasks-CnMLpfk-.d.ts → tasks-Bn4R1NPN.d.ts} +1 -1
  34. package/dist/{types-B5Tsaalz.d.ts → types-BTE33VZS.d.ts} +1 -1
  35. package/dist/workers/entry.mjs +2 -2
  36. package/package.json +2 -2
@@ -3,7 +3,7 @@ import { createScalarQuantizer } from './chunk-OBXS7OZM.mjs';
3
3
  import { MAX_M, createVectorStore, createHNSWIndex, createOrdinalFilter, addToOrdinalFilter, removeFromOrdinalFilter, ordinalFilterValues, magnitude, createBoundedMaxHeap, toScore, euclideanDistance, dotProduct, cosineSimilarityWithMagnitudes, ordinalFilterHas, ABSENT_DOCUMENT_RANK } from './chunk-WDL632CN.mjs';
4
4
  import { compareCodePoints, compareComparableKeys, toComparableSortValue, readSortField, compareSortValues, compareComparableValues, SORT_VALUE_MAX_CODE_POINTS } from './chunk-BFIH7OV5.mjs';
5
5
  import { generateId, createRequestId } from './chunk-WTONLDU3.mjs';
6
- import { NarsilError, ErrorCodes, createNarsilError } from './chunk-GB2IIJJG.mjs';
6
+ import { NarsilError, ErrorCodes, createNarsilError } from './chunk-TLRUUMVE.mjs';
7
7
  import { encode, decode } from '@msgpack/msgpack';
8
8
 
9
9
  // src/schema/validator/shared.ts
@@ -628,7 +628,7 @@ function wireToMetadata(raw) {
628
628
  if (isPositiveInteger2(promotion.threshold)) {
629
629
  restored.threshold = promotion.threshold;
630
630
  }
631
- if (isPositiveInteger2(promotion.filter_threshold)) {
631
+ if (isSelectivityRatio(promotion.filter_threshold)) {
632
632
  restored.filterThreshold = promotion.filter_threshold;
633
633
  }
634
634
  if (Object.keys(hnswConfig).length > 0) {
@@ -655,6 +655,9 @@ function isNonNegativeInteger(value) {
655
655
  function isPositiveInteger2(value) {
656
656
  return typeof value === "number" && Number.isInteger(value) && value >= 1;
657
657
  }
658
+ function isSelectivityRatio(value) {
659
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 1;
660
+ }
658
661
  function isWatermarkFraction(value) {
659
662
  return typeof value === "number" && value > 0 && value <= 1;
660
663
  }
@@ -8205,7 +8208,7 @@ function applySorting(hits, sort, sortKeyOf) {
8205
8208
  }
8206
8209
 
8207
8210
  // src/search/cursor.ts
8208
- var CURSOR_VERSION = 2;
8211
+ var CURSOR_VERSION = 3;
8209
8212
  var MAX_CURSOR_LENGTH = 40960;
8210
8213
  var MAX_SORT_FIELDS = 8;
8211
8214
  var MAX_SORT_FIELD_NAME_LENGTH = 255;
@@ -8260,6 +8263,7 @@ function encodePageCursor(cursor) {
8260
8263
  } else if (cursor.score !== null) {
8261
8264
  payload.s = cursor.score;
8262
8265
  }
8266
+ payload.q = cursor.binding;
8263
8267
  return encodeCursorText(JSON.stringify(payload));
8264
8268
  }
8265
8269
  function decodeSortKey(value, cursor) {
@@ -8304,8 +8308,11 @@ function decodePageCursor(cursor) {
8304
8308
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
8305
8309
  throw invalidCursor(cursor, "expected an object");
8306
8310
  }
8307
- const { v, a, s, k, o } = parsed;
8311
+ const { v, a, s, k, o, q } = parsed;
8308
8312
  if (v !== CURSOR_VERSION) throw invalidCursor(cursor, `unsupported cursor version ${String(v)}`);
8313
+ if (typeof q !== "string" || !/^[0-9a-f]{8}$/.test(q)) {
8314
+ throw invalidCursor(cursor, '"q" must be 8 lowercase hex digits');
8315
+ }
8309
8316
  if (typeof a !== "string" || a.length === 0) throw invalidCursor(cursor, '"a" must be a non-empty string');
8310
8317
  if (exceedsCodePoints(a, MAX_ANCHOR_CODE_POINTS)) {
8311
8318
  throw invalidCursor(cursor, '"a" is too long to be a document id');
@@ -8323,10 +8330,14 @@ function decodePageCursor(cursor) {
8323
8330
  anchor: a,
8324
8331
  score: typeof s === "number" ? s : null,
8325
8332
  sortKey,
8326
- sortSignature: typeof o === "string" ? o : null
8333
+ sortSignature: typeof o === "string" ? o : null,
8334
+ binding: q
8327
8335
  };
8328
8336
  }
8329
- function requireMatchingCursor(cursor, encoded, signature, scoreAnchored) {
8337
+ function requireMatchingCursor(cursor, encoded, signature, scoreAnchored, binding) {
8338
+ if (cursor.binding !== binding) {
8339
+ throw invalidCursor(encoded, "the cursor belongs to a different query");
8340
+ }
8330
8341
  if (signature !== null) {
8331
8342
  if (cursor.sortSignature !== signature) {
8332
8343
  throw invalidCursor(encoded, "the cursor belongs to a different sort order");
@@ -8360,6 +8371,12 @@ function requireWithinResultWindow(limit, offset) {
8360
8371
  { limit, offset, window: RESULT_WINDOW }
8361
8372
  );
8362
8373
  }
8374
+ function lastOrganicResult(sliced, pinnedIds) {
8375
+ for (let i = sliced.length - 1; i >= 0; i--) {
8376
+ if (pinnedIds === void 0 || !pinnedIds.has(sliced[i].id)) return sliced[i];
8377
+ }
8378
+ return void 0;
8379
+ }
8363
8380
  function ordersAfterAnchor(result, anchor, sort) {
8364
8381
  if (sort !== void 0 && anchor.sortKey !== null) {
8365
8382
  const comparison = compareSortValues(sort.sortKeyOf(result.id), anchor.sortKey, sort.directions) || compareCodePoints(result.id, anchor.anchor);
@@ -8370,10 +8387,10 @@ function ordersAfterAnchor(result, anchor, sort) {
8370
8387
  if (result.score < anchor.score) return true;
8371
8388
  return result.score === anchor.score && compareCodePoints(result.id, anchor.anchor) > 0;
8372
8389
  }
8373
- function applyPagination(results, limit, offset, cursor, sort) {
8390
+ function applyPagination(results, limit, offset, binding, cursor, sort, pinnedIds) {
8374
8391
  const decoded = cursor ? decodePageCursor(cursor) : null;
8375
8392
  if (decoded !== null && cursor !== void 0) {
8376
- requireMatchingCursor(decoded, cursor, sort?.signature ?? null, true);
8393
+ requireMatchingCursor(decoded, cursor, sort?.signature ?? null, true, binding);
8377
8394
  }
8378
8395
  if (limit <= 0) {
8379
8396
  return { paginated: [] };
@@ -8392,18 +8409,20 @@ function applyPagination(results, limit, offset, cursor, sort) {
8392
8409
  const sliced = results.slice(afterOffset, afterOffset + limit);
8393
8410
  let nextCursor;
8394
8411
  const hasMore = afterOffset + limit < results.length;
8395
- if (hasMore && sliced.length > 0) {
8396
- const lastResult = sliced[sliced.length - 1];
8412
+ const lastResult = lastOrganicResult(sliced, pinnedIds);
8413
+ if (hasMore && lastResult !== void 0) {
8397
8414
  nextCursor = sort !== void 0 ? encodePageCursor({
8398
8415
  anchor: lastResult.id,
8399
8416
  score: null,
8400
8417
  sortKey: sort.sortKeyOf(lastResult.id).map(toComparableSortValue),
8401
- sortSignature: sort.signature
8418
+ sortSignature: sort.signature,
8419
+ binding
8402
8420
  }) : encodePageCursor({
8403
8421
  anchor: lastResult.id,
8404
8422
  score: lastResult.score ?? null,
8405
8423
  sortKey: null,
8406
- sortSignature: null
8424
+ sortSignature: null,
8425
+ binding
8407
8426
  });
8408
8427
  }
8409
8428
  return { paginated: sliced, nextCursor };
@@ -8603,9 +8622,24 @@ function queryTermSatisfied(queryToken, indexTokens, tolerance, exact) {
8603
8622
  return false;
8604
8623
  }
8605
8624
 
8625
+ // src/partitioning/partition-selection.ts
8626
+ function partitionsIn(manager, partitionIds) {
8627
+ if (partitionIds === void 0) {
8628
+ return manager.getAllPartitions();
8629
+ }
8630
+ const partitions = [];
8631
+ for (const partitionId of partitionIds) {
8632
+ const partition = manager.partitionAt(partitionId);
8633
+ if (partition !== void 0) {
8634
+ partitions.push(partition);
8635
+ }
8636
+ }
8637
+ return partitions;
8638
+ }
8639
+
8606
8640
  // src/partitioning/fan-out.ts
8607
8641
  async function fanOutQuery(manager, params, language, schema, config, searchOptions) {
8608
- const partitions = config.partitionIds ? config.partitionIds.map((id) => manager.partitionAt(id)).filter((p) => p !== void 0) : manager.getAllPartitions();
8642
+ const partitions = partitionsIn(manager, config.partitionIds);
8609
8643
  if (partitions.length === 0) {
8610
8644
  return { scored: [], totalMatched: 0 };
8611
8645
  }
@@ -9093,12 +9127,24 @@ function createPartitionManager(indexName, config, language, router, initialPart
9093
9127
  return manager;
9094
9128
  }
9095
9129
 
9130
+ // src/partitioning/match-count.ts
9131
+ function countsWithoutScores(params) {
9132
+ return params.minScore === void 0 && (params.termMatch === void 0 || params.termMatch === "any");
9133
+ }
9134
+ function fanOutMatchCount(manager, params, language, schema, options) {
9135
+ let count = 0;
9136
+ for (const partition of partitionsIn(manager, options?.partitionIds)) {
9137
+ const matches = fulltextMatches(partition, params, language, schema, options?.searchOptions);
9138
+ if (matches !== null) count += matches.count;
9139
+ }
9140
+ return count;
9141
+ }
9142
+
9096
9143
  // src/core/hash.ts
9097
9144
  var FNV_OFFSET_BASIS = 2166136261;
9098
9145
  var FNV_PRIME = 16777619;
9099
9146
  var encoder3 = new TextEncoder();
9100
- function fnv1a(input) {
9101
- const bytes = encoder3.encode(input);
9147
+ function fnv1aBytes(bytes) {
9102
9148
  let hash = FNV_OFFSET_BASIS;
9103
9149
  for (let i = 0; i < bytes.length; i++) {
9104
9150
  hash ^= bytes[i];
@@ -9106,6 +9152,9 @@ function fnv1a(input) {
9106
9152
  }
9107
9153
  return hash >>> 0;
9108
9154
  }
9155
+ function fnv1a(input) {
9156
+ return fnv1aBytes(encoder3.encode(input));
9157
+ }
9109
9158
 
9110
9159
  // src/partitioning/router.ts
9111
9160
  function createPartitionRouter() {
@@ -9424,20 +9473,43 @@ function resolveWorkerCount(requested) {
9424
9473
  }
9425
9474
  function createWorkerPool(config) {
9426
9475
  const workerCount = resolveWorkerCount(config.count);
9427
- const workers = [];
9476
+ const workers = /* @__PURE__ */ new Map();
9477
+ const deadSlots = /* @__PURE__ */ new Set();
9428
9478
  const indexAssignment = /* @__PURE__ */ new Map();
9429
9479
  let isShutdown = false;
9480
+ function handleWorkerDeath(slotIndex, error) {
9481
+ if (isShutdown || deadSlots.has(slotIndex)) {
9482
+ return;
9483
+ }
9484
+ deadSlots.add(slotIndex);
9485
+ const slot = workers.get(slotIndex);
9486
+ const indexNames = slot ? [...slot.indexes].sort() : [];
9487
+ workers.delete(slotIndex);
9488
+ config.onWorkerCrash?.(slotIndex, indexNames, error);
9489
+ }
9430
9490
  function ensureWorker(slotIndex) {
9431
- if (!workers[slotIndex]) {
9432
- workers[slotIndex] = {
9433
- executor: config.workerFactory(slotIndex),
9491
+ if (deadSlots.has(slotIndex)) {
9492
+ return void 0;
9493
+ }
9494
+ let slot = workers.get(slotIndex);
9495
+ if (!slot) {
9496
+ slot = {
9497
+ executor: config.workerFactory(slotIndex, (error) => handleWorkerDeath(slotIndex, error)),
9434
9498
  indexes: /* @__PURE__ */ new Set()
9435
9499
  };
9500
+ workers.set(slotIndex, slot);
9436
9501
  }
9437
- return workers[slotIndex];
9502
+ return slot;
9438
9503
  }
9439
9504
  function assignSlot(indexName) {
9440
- return fnv1a(indexName) % workerCount;
9505
+ const preferred = fnv1a(indexName) % workerCount;
9506
+ for (let probe = 0; probe < workerCount; probe++) {
9507
+ const candidate = (preferred + probe) % workerCount;
9508
+ if (!deadSlots.has(candidate)) {
9509
+ return candidate;
9510
+ }
9511
+ }
9512
+ throw new NarsilError(ErrorCodes.WORKER_CRASHED, `Every worker in the pool has crashed`);
9441
9513
  }
9442
9514
  function addIndex(indexName) {
9443
9515
  if (isShutdown) {
@@ -9448,6 +9520,9 @@ function createWorkerPool(config) {
9448
9520
  }
9449
9521
  const slotIndex = assignSlot(indexName);
9450
9522
  const slot = ensureWorker(slotIndex);
9523
+ if (!slot) {
9524
+ throw new NarsilError(ErrorCodes.WORKER_CRASHED, `Worker ${slotIndex} for index "${indexName}" has crashed`);
9525
+ }
9451
9526
  slot.indexes.add(indexName);
9452
9527
  indexAssignment.set(indexName, slotIndex);
9453
9528
  }
@@ -9456,10 +9531,7 @@ function createWorkerPool(config) {
9456
9531
  if (slotIndex === void 0) {
9457
9532
  return;
9458
9533
  }
9459
- const slot = workers[slotIndex];
9460
- if (slot) {
9461
- slot.indexes.delete(indexName);
9462
- }
9534
+ workers.get(slotIndex)?.indexes.delete(indexName);
9463
9535
  indexAssignment.delete(indexName);
9464
9536
  }
9465
9537
  function getExecutor(indexName) {
@@ -9470,15 +9542,22 @@ function createWorkerPool(config) {
9470
9542
  if (slotIndex === void 0) {
9471
9543
  throw new NarsilError(ErrorCodes.INDEX_NOT_FOUND, `Index "${indexName}" is not registered in the worker pool`);
9472
9544
  }
9473
- return workers[slotIndex].executor;
9545
+ const slot = workers.get(slotIndex);
9546
+ if (slot) {
9547
+ return slot.executor;
9548
+ }
9549
+ for (const survivor of workers.values()) {
9550
+ if (survivor.indexes.has(indexName)) {
9551
+ return survivor.executor;
9552
+ }
9553
+ }
9554
+ throw new NarsilError(ErrorCodes.WORKER_CRASHED, `Every worker holding index "${indexName}" has crashed`);
9474
9555
  }
9475
9556
  async function getMemoryStats() {
9476
9557
  const indices = [];
9477
9558
  const pending = [];
9478
- for (let i = 0; i < workers.length; i++) {
9479
- const slot = workers[i];
9480
- if (!slot) continue;
9481
- indices.push(i);
9559
+ for (const [slotIndex, slot] of workers) {
9560
+ indices.push(slotIndex);
9482
9561
  pending.push(
9483
9562
  slot.executor.execute({ type: "memoryReport", requestId: createRequestId() }).catch(() => null)
9484
9563
  );
@@ -9501,7 +9580,7 @@ function createWorkerPool(config) {
9501
9580
  return;
9502
9581
  }
9503
9582
  isShutdown = true;
9504
- const shutdownPromises = workers.filter(Boolean).map((slot) => {
9583
+ const shutdownPromises = [...workers.values()].map((slot) => {
9505
9584
  const timeoutPromise = new Promise((resolve) => {
9506
9585
  setTimeout(resolve, 5e3);
9507
9586
  });
@@ -9511,17 +9590,16 @@ function createWorkerPool(config) {
9511
9590
  indexAssignment.clear();
9512
9591
  }
9513
9592
  function getAllExecutors() {
9514
- return workers.filter(Boolean).map((slot) => slot.executor);
9593
+ return [...workers.values()].map((slot) => slot.executor);
9515
9594
  }
9516
9595
  function addIndexToAll(indexName) {
9517
9596
  if (isShutdown) {
9518
9597
  throw new NarsilError(ErrorCodes.WORKER_CRASHED, "Worker pool has been shut down");
9519
9598
  }
9520
9599
  for (let i = 0; i < workerCount; i++) {
9521
- const slot = ensureWorker(i);
9522
- slot.indexes.add(indexName);
9600
+ ensureWorker(i)?.indexes.add(indexName);
9523
9601
  }
9524
- indexAssignment.set(indexName, 0);
9602
+ indexAssignment.set(indexName, assignSlot(indexName));
9525
9603
  }
9526
9604
  return {
9527
9605
  getExecutor,
@@ -10774,6 +10852,12 @@ function createDirectExecutor() {
10774
10852
  }
10775
10853
  case "preflight": {
10776
10854
  const entry = requireIndex(action.indexName);
10855
+ if (countsWithoutScores(action.params)) {
10856
+ const count = fanOutMatchCount(entry.manager, action.params, entry.language, entry.config.schema, {
10857
+ searchOptions: entry.searchOptions
10858
+ });
10859
+ return { count };
10860
+ }
10777
10861
  const result = await fanOutQuery(
10778
10862
  entry.manager,
10779
10863
  action.params,
@@ -10861,4 +10945,4 @@ function createDirectExecutor() {
10861
10945
  };
10862
10946
  }
10863
10947
 
10864
- export { DEFAULT_PAGE_SIZE, FIELD_FILTER_OPERATORS, FILTER_EXPRESSION_KEYS, MAX_CURSOR_LENGTH, MAX_NESTING_DEPTH, applyPagination, applyProjection, applySorting, buildCompactedSegmentPayload, clampRowCount, clearNormalizationCache, collectQueryTermStats, configureNormalizationCache, createDirectExecutor, createFrozenSegment, createPartitionIndex, createPartitionManager, createPartitionRouter, createSharedFrozenSegment, createVectorIndex, createWorkerPool, decodePageCursor, deserializeMetadata, deserializePayloadV1, deserializePayloadV2, detectRuntime, encodePageCursor, extractVectorFieldsFromSchema, fanOutQuery, flattenSchema, fnv1a, freezeSegmentShared, fulltextMatches, getLanguage, getNestedValue, getNormalizationCacheSize, getStopWords, getTokenizer, hasStopWords, hasTokenizer, isCompositePartition, isNodeMainThread, isTextFieldType, kWayMerge, mergeFacets, mergePartitionStats, normalizeSort, pruneStatsToQueryTerms, readSortValues, registerLanguage, registerStopWords, registerTokenizer, requireMatchingCursor, requireSortableFields, requireWithinResultWindow, resetNormalizationCache, resolveIndexAnalysis, resolveProjection, serializeMetadata, sortSignatureOf, spawnNodeWorker, tokenize, validateDocument, validateDocumentStrict, validateRequiredFields, validateSchema, validateVectorPromotion };
10948
+ export { DEFAULT_PAGE_SIZE, FIELD_FILTER_OPERATORS, FILTER_EXPRESSION_KEYS, MAX_CURSOR_LENGTH, MAX_NESTING_DEPTH, RESULT_WINDOW, applyPagination, applyProjection, applySorting, buildCompactedSegmentPayload, clampRowCount, clearNormalizationCache, collectQueryTermStats, configureNormalizationCache, countsWithoutScores, createDirectExecutor, createFrozenSegment, createPartitionIndex, createPartitionManager, createPartitionRouter, createSharedFrozenSegment, createVectorIndex, createWorkerPool, decodePageCursor, deserializeMetadata, deserializePayloadV1, deserializePayloadV2, detectRuntime, encodePageCursor, extractVectorFieldsFromSchema, fanOutMatchCount, fanOutQuery, flattenSchema, fnv1a, fnv1aBytes, freezeSegmentShared, fulltextMatches, getLanguage, getNestedValue, getNormalizationCacheSize, getStopWords, getTokenizer, hasStopWords, hasTokenizer, isCompositePartition, isNodeMainThread, isTextFieldType, kWayMerge, mergeFacets, mergePartitionStats, normalizeSort, partitionsIn, pruneStatsToQueryTerms, readSortValues, registerLanguage, registerStopWords, registerTokenizer, requireMatchingCursor, requireSortableFields, requireWithinResultWindow, resetNormalizationCache, resolveIndexAnalysis, resolveProjection, serializeMetadata, sortSignatureOf, spawnNodeWorker, tokenize, validateDocument, validateDocumentStrict, validateRequiredFields, validateSchema, validateVectorPromotion };
@@ -1,6 +1,6 @@
1
- import { V as VectorMaintenanceResult, M as MemoryStats, B as BatchResult, L as ListParams, g as ListResult, I as IndexInfo, f as IndexStats, P as PartitionStatsResult, Q as QueryParams, e as QueryResult, h as PreflightResult, i as SuggestParams, j as SuggestResult } from './search-DHuXwJYk.js';
2
- import { P as PartitionConfig, A as AnyDocument, a as InsertOptions } from './schema-ZRbk8BgH.js';
3
- import { e as TaskRecord, b as ImportResult, H as HttpIndexConfig, c as TaskListQuery, T as TaskListPage } from './tasks-CnMLpfk-.js';
1
+ import { V as VectorMaintenanceResult, M as MemoryStats, B as BatchResult, L as ListParams, g as ListResult, I as IndexInfo, f as IndexStats, P as PartitionStatsResult, Q as QueryParams, e as QueryResult, h as PreflightResult, i as SuggestParams, j as SuggestResult } from './search-BGouJxH4.js';
2
+ import { P as PartitionConfig, A as AnyDocument, a as InsertOptions } from './schema-DXOd96kx.js';
3
+ import { e as TaskRecord, b as ImportResult, H as HttpIndexConfig, c as TaskListQuery, T as TaskListPage } from './tasks-Bn4R1NPN.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 } from './search-DHuXwJYk.js';
2
- export { A as ASYNC_IMPORT_CAPABILITY, E as ErrorEnvelope, R as REBUILD_ANALYSIS_CAPABILITY, S as SERVER_CAPABILITIES, T as TASK_CANCEL_CAPABILITY, a as TASK_FILTER_CAPABILITY } from './options-EXYFcem-.js';
3
- export { C as CapabilitiesResponse, a as CreateIndexEmbedding, H as HttpIndexConfig, I as ImportError, b as ImportResult, T as TaskListPage, c as TaskListQuery, d as TaskProgress, e as TaskRecord, f as TaskStatus, g as TaskType } from './tasks-CnMLpfk-.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-BobVnoIK.js';
5
- import './schema-ZRbk8BgH.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 } from './search-BGouJxH4.js';
2
+ export { A as ASYNC_IMPORT_CAPABILITY, E as ErrorEnvelope, R as REBUILD_ANALYSIS_CAPABILITY, S as SERVER_CAPABILITIES, T as TASK_CANCEL_CAPABILITY, a as TASK_FILTER_CAPABILITY } from './options-BakECW-r.js';
3
+ export { C as CapabilitiesResponse, a as CreateIndexEmbedding, H as HttpIndexConfig, I as ImportError, b as ImportResult, T as TaskListPage, c as TaskListQuery, d as TaskProgress, e as TaskRecord, f as TaskStatus, g as TaskType } from './tasks-Bn4R1NPN.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-B5uO5jL1.js';
5
+ import './schema-DXOd96kx.js';
6
6
  import './adapters-79OIa4xm.js';
7
- import './config-fLC4lbmg.js';
8
- import './config-Byyl1QqH.js';
9
- import './types-B5Tsaalz.js';
7
+ import './config-NgUCkc6a.js';
8
+ import './config-B09-cud9.js';
9
+ import './types-BTE33VZS.js';
10
10
  import './types-D5OwhtsQ.js';
package/dist/client.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  // src/errors.ts
2
2
  var ErrorCodes = {
3
3
  SCHEMA_INVALID_TYPE: "SCHEMA_INVALID_TYPE",
4
- SCHEMA_MISSING_FIELD: "SCHEMA_MISSING_FIELD",
5
4
  SCHEMA_DEPTH_EXCEEDED: "SCHEMA_DEPTH_EXCEEDED",
6
5
  SCHEMA_INVALID_VECTOR_DIMENSION: "SCHEMA_INVALID_VECTOR_DIMENSION",
7
6
  SCHEMA_INVALID_GEOPOINT: "SCHEMA_INVALID_GEOPOINT",
@@ -23,7 +22,6 @@ var ErrorCodes = {
23
22
  PERSISTENCE_WAL_CORRUPT: "PERSISTENCE_WAL_CORRUPT",
24
23
  PERSISTENCE_FSYNC_FAILED: "PERSISTENCE_FSYNC_FAILED",
25
24
  SEARCH_INVALID_FIELD: "SEARCH_INVALID_FIELD",
26
- SEARCH_INVALID_VECTOR_SIZE: "SEARCH_INVALID_VECTOR_SIZE",
27
25
  VECTOR_DIMENSION_MISMATCH: "VECTOR_DIMENSION_MISMATCH",
28
26
  SEARCH_INVALID_FILTER: "SEARCH_INVALID_FILTER",
29
27
  SEARCH_INVALID_MODE: "SEARCH_INVALID_MODE",
@@ -47,8 +45,6 @@ var ErrorCodes = {
47
45
  ALLOCATION_NO_DATA_NODES: "ALLOCATION_NO_DATA_NODES",
48
46
  ALLOCATION_INVALID_CONFIG: "ALLOCATION_INVALID_CONFIG",
49
47
  ALLOCATION_FAILED: "ALLOCATION_FAILED",
50
- CONTROLLER_LEASE_LOST: "CONTROLLER_LEASE_LOST",
51
- CONTROLLER_NOT_ACTIVE: "CONTROLLER_NOT_ACTIVE",
52
48
  CONTROLLER_METADATA_INVALID: "CONTROLLER_METADATA_INVALID",
53
49
  NODE_BOOTSTRAP_FAILED: "NODE_BOOTSTRAP_FAILED",
54
50
  NODE_ALREADY_JOINED: "NODE_ALREADY_JOINED",
@@ -104,6 +100,7 @@ var ServerErrorCodes = {
104
100
  TASK_NOT_FOUND: "TASK_NOT_FOUND",
105
101
  TASK_NOT_CANCELLABLE: "TASK_NOT_CANCELLABLE",
106
102
  TASK_OWNED_BY_ANOTHER_INSTANCE: "TASK_OWNED_BY_ANOTHER_INSTANCE",
103
+ TASK_INTERRUPTED: "TASK_INTERRUPTED",
107
104
  TOO_MANY_REQUESTS: "TOO_MANY_REQUESTS",
108
105
  HOOK_ERROR: "HOOK_ERROR",
109
106
  INTERNAL_ERROR: "INTERNAL_ERROR"
@@ -1,6 +1,6 @@
1
1
  import { P as PersistenceAdapter, I as InvalidationAdapter, E as EmbeddingAdapter } from './adapters-79OIa4xm.js';
2
- import { Q as QueryParams, e as QueryResult } from './search-DHuXwJYk.js';
3
- import { I as IndexConfig, A as AnyDocument } from './schema-ZRbk8BgH.js';
2
+ import { Q as QueryParams, e as QueryResult } from './search-BGouJxH4.js';
3
+ import { I as IndexConfig, A as AnyDocument } from './schema-DXOd96kx.js';
4
4
 
5
5
  /**
6
6
  * Hooks that run alongside the engine's own work, which is how you add
@@ -1,5 +1,5 @@
1
- import { N as NarsilConfig } from './config-Byyl1QqH.js';
2
- import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './types-B5Tsaalz.js';
1
+ import { N as NarsilConfig } from './config-B09-cud9.js';
2
+ import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './types-BTE33VZS.js';
3
3
  import { N as NodeTransport } from './types-D5OwhtsQ.js';
4
4
 
5
5
  /**
@@ -1,8 +1,8 @@
1
- export { createDirectExecutor } from './chunk-GRWFY2HI.mjs';
1
+ export { createDirectExecutor } from './chunk-YGQMKTKG.mjs';
2
2
  import './chunk-TGP5M5R7.mjs';
3
3
  import './chunk-OBXS7OZM.mjs';
4
4
  import './chunk-WDL632CN.mjs';
5
5
  import './chunk-U2BKYEC7.mjs';
6
6
  import './chunk-BFIH7OV5.mjs';
7
7
  import './chunk-WTONLDU3.mjs';
8
- import './chunk-GB2IIJJG.mjs';
8
+ import './chunk-TLRUUMVE.mjs';
@@ -1,5 +1,5 @@
1
- import { C as ClusterCoordinator } from '../../types-B5Tsaalz.js';
2
- import '../../schema-ZRbk8BgH.js';
1
+ import { C as ClusterCoordinator } from '../../types-BTE33VZS.js';
2
+ import '../../schema-DXOd96kx.js';
3
3
  import '../../adapters-79OIa4xm.js';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { compareCodePoints } from '../../chunk-BFIH7OV5.mjs';
2
- import { NarsilError, ErrorCodes } from '../../chunk-GB2IIJJG.mjs';
2
+ import { NarsilError, ErrorCodes } from '../../chunk-TLRUUMVE.mjs';
3
3
  import { decode, encode } from '@msgpack/msgpack';
4
4
 
5
5
  // src/distribution/coordinator/etcd/types.ts
@@ -1,5 +1,5 @@
1
- import { C as ClusterCoordinator } from '../../types-B5Tsaalz.js';
2
- import '../../schema-ZRbk8BgH.js';
1
+ import { C as ClusterCoordinator } from '../../types-BTE33VZS.js';
2
+ import '../../schema-DXOd96kx.js';
3
3
  import '../../adapters-79OIa4xm.js';
4
4
 
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { decodeTransportMessage, encodeTransportMessage } from '../../chunk-PM52SMBT.mjs';
2
2
  import { TransportError, TransportErrorCodes, MAX_MESSAGE_SIZE_BYTES } from '../../chunk-JQUL2T6I.mjs';
3
- import { NarsilError, ErrorCodes } from '../../chunk-GB2IIJJG.mjs';
3
+ import { NarsilError, ErrorCodes } from '../../chunk-TLRUUMVE.mjs';
4
4
 
5
5
  // src/distribution/transport/grpc/codec.ts
6
6
  var FIELD_ONE_LENGTH_DELIMITED_KEY = 10;
@@ -1,12 +1,12 @@
1
- import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-fLC4lbmg.js';
2
- export { c as ClusterControllerConfig, d as ClusterNodeInfo, e as ClusterQueryConfig, N as NodeReadiness, R as ReplicationConfig } from './config-fLC4lbmg.js';
3
- import { N as NarsilEventMap, a as Narsil } from './engine-BE45D5ZG.js';
4
- import { B as BatchResult, L as ListParams, g as ListResult, i as SuggestParams, j as SuggestResult, Q as QueryParams, h as PreflightResult, f as IndexStats, P as PartitionStatsResult, M as MemoryStats, e as QueryResult } from './search-DHuXwJYk.js';
5
- import { I as IndexConfig, A as AnyDocument, a as InsertOptions } from './schema-ZRbk8BgH.js';
6
- import { b as NodeCapacity, N as NodeRole } from './types-B5Tsaalz.js';
7
- 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-B5Tsaalz.js';
1
+ import { a as CreateIndexOptions, C as ClusterNamespace, b as ClusterNodeConfig } from './config-NgUCkc6a.js';
2
+ export { c as ClusterControllerConfig, d as ClusterNodeInfo, e as ClusterQueryConfig, N as NodeReadiness, R as ReplicationConfig } from './config-NgUCkc6a.js';
3
+ import { N as NarsilEventMap, a as Narsil } from './engine-CjLhdDIm.js';
4
+ import { B as BatchResult, L as ListParams, g as ListResult, i as SuggestParams, j as SuggestResult, Q as QueryParams, h as PreflightResult, f as IndexStats, P as PartitionStatsResult, M as MemoryStats, e as QueryResult } from './search-BGouJxH4.js';
5
+ import { I as IndexConfig, A as AnyDocument, a as InsertOptions } from './schema-DXOd96kx.js';
6
+ import { b as NodeCapacity, N as NodeRole } from './types-BTE33VZS.js';
7
+ 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-BTE33VZS.js';
8
8
  export { L as ListenHandler, N as NodeTransport, R as RespondFn, T as TransportConfig, a as TransportMessage } from './types-D5OwhtsQ.js';
9
- import './config-Byyl1QqH.js';
9
+ import './config-B09-cud9.js';
10
10
  import './adapters-79OIa4xm.js';
11
11
 
12
12
  /**