@delali/narsil 0.3.1-next.180 → 0.3.1-next.183

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 (101) hide show
  1. package/dist/browser/{chunk-JHFBQKUF.mjs → chunk-ZZUXMJIK.mjs} +12 -14
  2. package/dist/browser/{durability-config-SGB5ZP5K.mjs → durability-config-75NSFCQN.mjs} +6 -3
  3. package/dist/browser/{optional-writes-TB34FYUW.mjs → optional-writes-IQFTXANH.mjs} +2 -0
  4. package/dist/browser/{storage-leaf-QFXIWDFK.mjs → storage-leaf-2CO6SQ7R.mjs} +859 -250
  5. package/dist/{capabilities-BQIdsaWy.d.ts → capabilities-DAHXphRn.d.ts} +2 -2
  6. package/dist/{chunk-QFJMRB7D.mjs → chunk-2DK74OQL.mjs} +1 -1
  7. package/dist/{chunk-F3FDHXCJ.mjs → chunk-3OEXOSWI.mjs} +251 -50
  8. package/dist/{chunk-GO6TRSJ6.mjs → chunk-632ABEIR.mjs} +1 -1
  9. package/dist/{chunk-34IOOYXA.mjs → chunk-6ICOWB6I.mjs} +1 -1
  10. package/dist/{chunk-XNFBYAXI.mjs → chunk-C3EINJNJ.mjs} +1 -1
  11. package/dist/{chunk-JCWC75NH.mjs → chunk-C77OBNPP.mjs} +1 -1
  12. package/dist/{chunk-YPV2L7M5.mjs → chunk-CKS4QQEC.mjs} +3 -3
  13. package/dist/{chunk-2C3BXZGA.mjs → chunk-CWXR7OP4.mjs} +18 -20
  14. package/dist/{chunk-BIIROQ5Q.mjs → chunk-EGWBZSHK.mjs} +2 -2
  15. package/dist/{chunk-XQQKETAF.mjs → chunk-F2UOTRY7.mjs} +2 -2
  16. package/dist/{chunk-XTSFRWAS.mjs → chunk-FIXUVFUC.mjs} +3 -3
  17. package/dist/{chunk-Y27E2MGC.mjs → chunk-GGG5R4CU.mjs} +1 -1
  18. package/dist/{chunk-2KWTQ2P7.mjs → chunk-JVR5KMO4.mjs} +2 -2
  19. package/dist/{chunk-XITVDRRH.mjs → chunk-M3H7CTIC.mjs} +6 -6
  20. package/dist/{chunk-YXZDTKQS.mjs → chunk-MCAJOLVK.mjs} +2 -2
  21. package/dist/{chunk-QDZJM7NI.mjs → chunk-MSIN4NM3.mjs} +3 -1
  22. package/dist/{chunk-UISV46WX.mjs → chunk-NPXORGMK.mjs} +2 -2
  23. package/dist/{chunk-R7PLSVK3.mjs → chunk-OQANB7SJ.mjs} +1 -1
  24. package/dist/{chunk-KHJPMZE2.mjs → chunk-PK3BGGHO.mjs} +1 -1
  25. package/dist/{chunk-ISJ35523.mjs → chunk-PXEGKQHS.mjs} +2 -2
  26. package/dist/{chunk-LOQHA6QK.mjs → chunk-SA7U67XF.mjs} +2 -2
  27. package/dist/{chunk-JDIATDPY.mjs → chunk-T3YI4KN6.mjs} +1 -1
  28. package/dist/{chunk-ZB5X5WAK.mjs → chunk-TTTBE4TB.mjs} +10 -5
  29. package/dist/{chunk-A4XYDUVN.mjs → chunk-V7F5DOSC.mjs} +2 -2
  30. package/dist/{chunk-26E5MO3Y.mjs → chunk-WUWSUJ2X.mjs} +4 -4
  31. package/dist/{chunk-XFOL77WH.mjs → chunk-YWSIRKKQ.mjs} +1 -1
  32. package/dist/{chunk-7FC2ZILY.mjs → chunk-ZVZ2V2PZ.mjs} +37 -67
  33. package/dist/{client-CeUxvIvd.d.ts → client-DpqtT2XG.d.ts} +3 -3
  34. package/dist/client.d.ts +6 -6
  35. package/dist/{config-DehU-VGL.d.ts → config-C687-reW.d.ts} +11 -1
  36. package/dist/{config-CIpLXXxm.d.ts → config-D9WR3MhO.d.ts} +1 -1
  37. package/dist/{direct-executor-2WQSGBN3.mjs → direct-executor-JXYIL4OQ.mjs} +1 -1
  38. package/dist/distribution.d.ts +4 -4
  39. package/dist/distribution.mjs +391 -138
  40. package/dist/{durability-config-XV4XR7Y4.mjs → durability-config-NWU2G2SJ.mjs} +6 -3
  41. package/dist/{engine-P-4xhUe4.d.ts → engine-De6JzTW8.d.ts} +123 -72
  42. package/dist/index.browser.mjs +1 -1
  43. package/dist/index.d.ts +4 -4
  44. package/dist/index.mjs +1 -1
  45. package/dist/index.react-native.mjs +1 -1
  46. package/dist/{long-query-thread-AAYTLYZK.mjs → long-query-thread-HPKGRYWM.mjs} +10 -10
  47. package/dist/{optional-writes-N2DFWWZ3.mjs → optional-writes-QE7QUI45.mjs} +5 -3
  48. package/dist/{paged-partition-archive-X7L27E5Z.mjs → paged-partition-archive-IK2UOY2G.mjs} +9 -9
  49. package/dist/partial-words.browser.mjs +1 -1
  50. package/dist/partial-words.mjs +1 -1
  51. package/dist/persistence/durability/checkpoint-worker.d.ts +9 -0
  52. package/dist/persistence/durability/checkpoint-worker.mjs +23 -12
  53. package/dist/{query-actions-2JOLPELC.mjs → query-actions-COEFVUH3.mjs} +1 -1
  54. package/dist/query-suggestions/merge-worker.mjs +4 -4
  55. package/dist/query-suggestions.browser.mjs +1 -1
  56. package/dist/query-suggestions.d.ts +1 -1
  57. package/dist/query-suggestions.mjs +2 -2
  58. package/dist/react-native/chunks/{chunk-F4MIGBBP.mjs → chunk-6A5XE2MA.mjs} +18 -20
  59. package/dist/react-native/chunks/{chunk-H344ZXRH.mjs → chunk-DN2GVVR4.mjs} +1 -1
  60. package/dist/react-native/chunks/{chunk-GVWLACAT.mjs → chunk-DZ4FQW5K.mjs} +2 -2
  61. package/dist/react-native/chunks/{chunk-57R74JWC.mjs → chunk-G4YYO5TC.mjs} +1 -1
  62. package/dist/react-native/chunks/{chunk-F6BJYCF2.mjs → chunk-UPN4NUXU.mjs} +1 -1
  63. package/dist/react-native/chunks/{chunk-GGBATERA.mjs → chunk-XNIH3WIB.mjs} +1 -1
  64. package/dist/react-native/chunks/{durability-config-3IOXIPYZ.mjs → durability-config-RVTWSXPH.mjs} +6 -3
  65. package/dist/react-native/chunks/{optional-writes-TXTJ6HUZ.mjs → optional-writes-YZ7WTR7V.mjs} +4 -2
  66. package/dist/react-native/chunks/{restore-queue-SZLWIL3B.mjs → restore-queue-IGKD6Q2Y.mjs} +4 -4
  67. package/dist/react-native/chunks/{segment-codec-leaf-WMUZ5P4F.mjs → segment-codec-leaf-JTTGDT3G.mjs} +2 -2
  68. package/dist/react-native/chunks/{segment-merge-leaf-Q2OEJIQ3.mjs → segment-merge-leaf-D5ZFJRUB.mjs} +3 -3
  69. package/dist/react-native/chunks/{storage-leaf-OXYV6O6P.mjs → storage-leaf-ZKIM6IF6.mjs} +864 -255
  70. package/dist/react-native/chunks/{store-leaf-ZMDXYK4E.mjs → store-leaf-PHBOTT5J.mjs} +3 -3
  71. package/dist/react-native/chunks/{suggestions-leaf-FIMGQZ2T.mjs → suggestions-leaf-R7MIH6Q3.mjs} +3 -3
  72. package/dist/react-native/chunks/{worker-copies-72TGFYQB.mjs → worker-copies-U35KPVJ7.mjs} +2 -2
  73. package/dist/react-native/partial-words.mjs +1 -1
  74. package/dist/react-native/query-suggestions.mjs +1 -1
  75. package/dist/react-native/sync.mjs +1 -1
  76. package/dist/react-native/synonyms.mjs +1 -1
  77. package/dist/react.d.ts +7 -7
  78. package/dist/{rerank-E2HFKKGJ.mjs → rerank-LYL3D7LU.mjs} +1 -1
  79. package/dist/{restore-queue-PUVBN6L3.mjs → restore-queue-LF4DTVJC.mjs} +4 -4
  80. package/dist/{segment-codec-leaf-24Z3MMQI.mjs → segment-codec-leaf-ACALKS2C.mjs} +2 -2
  81. package/dist/{segment-merge-leaf-FQQDU45E.mjs → segment-merge-leaf-SKMPASFK.mjs} +2 -2
  82. package/dist/server.d.ts +8 -8
  83. package/dist/server.mjs +16 -16
  84. package/dist/{storage-leaf-KIA7XO6Y.mjs → storage-leaf-OJ55R4C5.mjs} +588 -158
  85. package/dist/{store-leaf-ESVLL4JO.mjs → store-leaf-CWHHEDRK.mjs} +3 -3
  86. package/dist/{suggestions-leaf-FXF4AHAY.mjs → suggestions-leaf-ZTU3ZTWJ.mjs} +5 -5
  87. package/dist/sync/filesystem.d.ts +2 -2
  88. package/dist/sync/filesystem.mjs +6 -6
  89. package/dist/sync/indexeddb.d.ts +2 -2
  90. package/dist/sync.browser.mjs +1 -1
  91. package/dist/sync.d.ts +3 -3
  92. package/dist/sync.mjs +1 -1
  93. package/dist/synonyms.browser.mjs +1 -1
  94. package/dist/synonyms.mjs +1 -1
  95. package/dist/{tasks-CXtQ3Zpp.d.ts → tasks-X2IJQc8J.d.ts} +2 -2
  96. package/dist/{thread-OWXVP2ZA.mjs → thread-BEGFRULV.mjs} +9 -9
  97. package/dist/{types-CDN70Y_C.d.ts → types-D0YasjoX.d.ts} +1 -1
  98. package/dist/{worker-copies-XXX7PF4J.mjs → worker-copies-373P6IYZ.mjs} +4 -4
  99. package/dist/workers/entry.mjs +7 -7
  100. package/openapi.json +32 -0
  101. package/package.json +7 -7
@@ -11575,8 +11575,7 @@ function assembleFrozenSegment(segmentId, source, documentSource, sharedSnapshot
11575
11575
  if (ordinal === void 0 || tombstones.has(ordinal)) return void 0;
11576
11576
  return removals.spellingsOf(ordinal);
11577
11577
  },
11578
- prepareTombstone(docId, removedSpellings, analysis) {
11579
- const ordinal = docStore.getInternalId(docId);
11578
+ prepareTombstone(docId, removedSpellings, analysis, ordinal = docStore.getInternalId(docId)) {
11580
11579
  if (ordinal === void 0 || tombstones.has(ordinal)) return void 0;
11581
11580
  const publishTombstone = tombstones.prepare(ordinal);
11582
11581
  const strings4 = analysis === void 0 ? null : prepareFrozenStrings(
@@ -12383,7 +12382,7 @@ var loadSegmentCodec = segmentCodec.load;
12383
12382
 
12384
12383
  // src/engine/optional-writes-code.ts
12385
12384
  var optionalWrites = codeLoader(async () => {
12386
- const [segmentCodec2, code7] = await Promise.all([loadSegmentCodec(), import('./optional-writes-TB34FYUW.mjs')]);
12385
+ const [segmentCodec2, code7] = await Promise.all([loadSegmentCodec(), import('./optional-writes-IQFTXANH.mjs')]);
12387
12386
  code7.bindOptionalWritesHost(optionalCodeHost(), segmentCodec2);
12388
12387
  return code7;
12389
12388
  }, "write");
@@ -19282,7 +19281,7 @@ var storageCode = codeLoader(async () => {
19282
19281
  loadSegmentMerge(),
19283
19282
  loadSuggestionStore(),
19284
19283
  loadVectorCore(),
19285
- import('./storage-leaf-QFXIWDFK.mjs')
19284
+ import('./storage-leaf-2CO6SQ7R.mjs')
19286
19285
  ]);
19287
19286
  code7.bindStorageHost(optionalCodeHost(), digest2, msgpack, segmentCodec2, segmentMerge2, suggestionStore2, vectorCore2);
19288
19287
  return code7;
@@ -20226,7 +20225,8 @@ var DURABILITY_CONFIG_KEYS = {
20226
20225
  segmentMaxBytes: true,
20227
20226
  checkpointIntervalMs: true,
20228
20227
  checkpointMutationThreshold: true,
20229
- compactionThreshold: true
20228
+ compactionThreshold: true,
20229
+ rewriteBytesPerCheckpoint: true
20230
20230
  };
20231
20231
  var WORKER_CONFIG_KEYS = {
20232
20232
  enabled: true,
@@ -21068,7 +21068,7 @@ function createAnalysisRebuildCoordinator(config, deps) {
21068
21068
 
21069
21069
  // src/engine/durability-config-code.ts
21070
21070
  var durabilityConfig = codeLoader(
21071
- () => import('./durability-config-SGB5ZP5K.mjs').then((code7) => {
21071
+ () => import('./durability-config-75NSFCQN.mjs').then((code7) => {
21072
21072
  code7.bindDurabilityConfigHost(optionalCodeHost());
21073
21073
  return code7;
21074
21074
  }),
@@ -21787,12 +21787,6 @@ async function createEngineCore(config, hooks, capacityScope = "index") {
21787
21787
  queueDiskAdoption: orchestrator.queueDiskAdoption,
21788
21788
  awaitCopiesOfIndex: (indexName) => orchestrator.awaitReplication(indexName),
21789
21789
  publishCheckpointedPartitions: (indexName, partitions) => invalidation?.publishPartitions(indexName, partitions) ?? Promise.resolve(),
21790
- recordCheckpoint(indexName, documentCount, partitionCount) {
21791
- const entry = indexRegistry.get(indexName);
21792
- if (entry === void 0) return;
21793
- entry.documentCount = documentCount;
21794
- entry.partitionCount = partitionCount;
21795
- },
21796
21790
  engineCore: () => engineCore
21797
21791
  });
21798
21792
  const invalidationCode = config?.invalidation === void 0 ? null : durabilityWiring ?? await loadStorageCode();
@@ -23196,6 +23190,8 @@ function createNarsilFromCore(core2, config) {
23196
23190
  documentCount: manager?.countDocuments() ?? entry.documentCount,
23197
23191
  partitionCount: manager?.partitionCount ?? entry.partitionCount,
23198
23192
  estimatedMemoryBytes: manager?.estimateMemoryBytes() ?? 0,
23193
+ savedBytes: entry.storedSizes?.savedBytes,
23194
+ logBytes: entry.storedSizes?.logBytes,
23199
23195
  language: entry.language.name,
23200
23196
  schema: entry.config.schema,
23201
23197
  heldSearchStates: manager?.heldSearchStates ?? 0
@@ -23203,8 +23199,10 @@ function createNarsilFromCore(core2, config) {
23203
23199
  },
23204
23200
  getPartitionStats(indexName) {
23205
23201
  guardShutdown();
23206
- requireIndex(indexName);
23207
- return executor.getManager(indexName)?.getPartitionStats() ?? [];
23202
+ const entry = requireIndex(indexName);
23203
+ const stats = executor.getManager(indexName)?.getPartitionStats() ?? [];
23204
+ entry.storedSizes?.addTo(stats);
23205
+ return stats;
23208
23206
  },
23209
23207
  insert(indexName, document, docId, options) {
23210
23208
  return withCountedWrite(indexName, () => insertDocument(mutationCtx, indexName, document, docId, options));
@@ -11,12 +11,14 @@ var WAL_ONLY_FIELDS = ["directory", "mode", "flushIntervalMs", "segmentMaxBytes"
11
11
  function configError(message) {
12
12
  return new NarsilError(ErrorCodes.CONFIG_INVALID, message);
13
13
  }
14
- function requireKnob(name, value, minimum) {
14
+ function requireKnob(name, value, minimum, whole = false) {
15
15
  if (value === void 0) {
16
16
  return;
17
17
  }
18
- if (typeof value !== "number" || !Number.isFinite(value) || value < minimum) {
19
- throw configError(`durability.${name} must be a finite number of at least ${minimum}, got ${String(value)}`);
18
+ if (typeof value !== "number" || !(whole ? Number.isSafeInteger(value) : Number.isFinite(value)) || value < minimum) {
19
+ throw configError(
20
+ `durability.${name} must be ${whole ? "an integer" : "a finite number"} of at least ${minimum}, got ${String(value)}`
21
+ );
20
22
  }
21
23
  }
22
24
  function requireValidDurabilityConfig(durability) {
@@ -36,6 +38,7 @@ function requireValidDurabilityConfig(durability) {
36
38
  );
37
39
  }
38
40
  requireKnob("compactionThreshold", durability.compactionThreshold, 1);
41
+ requireKnob("rewriteBytesPerCheckpoint", durability.rewriteBytesPerCheckpoint, 1, true);
39
42
  if (durability.tier === "snapshot") {
40
43
  for (const field of WAL_ONLY_FIELDS) {
41
44
  if (durability[field] !== void 0) {
@@ -1963,6 +1963,7 @@ async function createIndexFromMetadata(deps, metadata, loadData) {
1963
1963
  throw recoveryFailure(metadata, err);
1964
1964
  }
1965
1965
  deps.indexRegistry.set(metadata.indexName, {
1966
+ storedSizes: deps.indexRegistry.get(metadata.indexName)?.storedSizes,
1966
1967
  config: indexConfig,
1967
1968
  language,
1968
1969
  embeddingAdapter: embedding.adapter,
@@ -1971,6 +1972,7 @@ async function createIndexFromMetadata(deps, metadata, loadData) {
1971
1972
  indexUuid: metadata.indexUuid ?? null,
1972
1973
  heldPartitions: metadata.heldPartitions ?? null,
1973
1974
  documentCount: metadata.documentCount ?? 0,
1975
+ savedBytes: metadata.savedBytes,
1974
1976
  partitionCount,
1975
1977
  analysisRevision: metadata.analysisRevision ?? null,
1976
1978
  arrayPositionGap: metadata.arrayPositionGap ?? null,