@delali/narsil 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-SVDEEMO6.mjs → chunk-CU6BVZEU.mjs} +10 -12
- package/dist/{chunk-VWF7RKSF.mjs → chunk-Q4OVNESD.mjs} +20 -4
- package/dist/{direct-executor-KC5O5D2R.mjs → direct-executor-6FOKJKLD.mjs} +1 -1
- package/dist/distribution.mjs +2 -2
- package/dist/index.browser.mjs +26 -24
- package/dist/index.mjs +2 -2
- package/dist/persistence/durability/checkpoint-worker.mjs +2 -2
- package/dist/workers/entry.mjs +1 -1
- package/package.json +10 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getNestedValue, getLanguage, extractVectorFieldsFromSchema, createDirectExecutor, createPartitionRouter, createPartitionManager, createVectorIndex, validateSchema, deserializePayloadV2, tokenize, fanOutQuery, validateRequiredFields, validateVectorPromotion, createPartitionIndex, flattenSchema, fnv1a, detectRuntime, kWayMerge } from './chunk-
|
|
1
|
+
import { getNestedValue, getLanguage, extractVectorFieldsFromSchema, createDirectExecutor, createPartitionRouter, createPartitionManager, createVectorIndex, validateSchema, deserializePayloadV2, tokenize, fanOutQuery, validateRequiredFields, validateVectorPromotion, createPartitionIndex, flattenSchema, fnv1a, detectRuntime, isNodeMainThread, spawnNodeWorker, kWayMerge } from './chunk-Q4OVNESD.mjs';
|
|
2
2
|
import { crc32, crc32Init, crc32Update, crc32Final } from './chunk-KMMJMDUA.mjs';
|
|
3
3
|
import { ErrorCodes, NarsilError } from './chunk-ALB35PRQ.mjs';
|
|
4
4
|
import { generateId, createRequestId, isValidWorkerResponse } from './chunk-HRABJLPB.mjs';
|
|
@@ -287,7 +287,7 @@ function createExecutionPromoter(config) {
|
|
|
287
287
|
return { check, markPromoted, isPromoted };
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
// src/persistence/durability/
|
|
290
|
+
// src/persistence/durability/node-fs.ts
|
|
291
291
|
var cachedFs = null;
|
|
292
292
|
var cachedPath = null;
|
|
293
293
|
async function getFs() {
|
|
@@ -302,6 +302,8 @@ async function getPath() {
|
|
|
302
302
|
}
|
|
303
303
|
return cachedPath;
|
|
304
304
|
}
|
|
305
|
+
|
|
306
|
+
// src/persistence/durability/durable-filesystem.ts
|
|
305
307
|
function validateRelativeKey(key) {
|
|
306
308
|
if (key.length === 0) {
|
|
307
309
|
throw new NarsilError(ErrorCodes.PERSISTENCE_SAVE_FAILED, "Invalid key: empty");
|
|
@@ -569,12 +571,7 @@ var mainThreadResolved = false;
|
|
|
569
571
|
var onMainThread = true;
|
|
570
572
|
async function isOnMainThread() {
|
|
571
573
|
if (!mainThreadResolved) {
|
|
572
|
-
|
|
573
|
-
const workerThreads = await import('worker_threads');
|
|
574
|
-
onMainThread = workerThreads.isMainThread;
|
|
575
|
-
} catch {
|
|
576
|
-
onMainThread = true;
|
|
577
|
-
}
|
|
574
|
+
onMainThread = await isNodeMainThread();
|
|
578
575
|
mainThreadResolved = true;
|
|
579
576
|
}
|
|
580
577
|
return onMainThread;
|
|
@@ -589,8 +586,7 @@ function resolveWorkerEntryPoint() {
|
|
|
589
586
|
}
|
|
590
587
|
async function spawnWorker() {
|
|
591
588
|
try {
|
|
592
|
-
|
|
593
|
-
return new workerThreads.Worker(new URL(resolveWorkerEntryPoint()));
|
|
589
|
+
return await spawnNodeWorker(new URL(resolveWorkerEntryPoint()));
|
|
594
590
|
} catch {
|
|
595
591
|
return null;
|
|
596
592
|
}
|
|
@@ -1269,8 +1265,10 @@ function resolveWorkerEntryPoint2() {
|
|
|
1269
1265
|
}
|
|
1270
1266
|
async function spawnWorker2() {
|
|
1271
1267
|
try {
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1268
|
+
const worker = await spawnNodeWorker(new URL(resolveWorkerEntryPoint2()));
|
|
1269
|
+
if (worker === null) {
|
|
1270
|
+
return null;
|
|
1271
|
+
}
|
|
1274
1272
|
if (typeof worker.unref === "function") {
|
|
1275
1273
|
worker.unref();
|
|
1276
1274
|
}
|
|
@@ -4424,6 +4424,24 @@ function deserializeScalarQuantizer(data, dimensions, ordinalSource) {
|
|
|
4424
4424
|
return quantizer;
|
|
4425
4425
|
}
|
|
4426
4426
|
|
|
4427
|
+
// src/workers/node-worker.ts
|
|
4428
|
+
async function spawnNodeWorker(entryPoint) {
|
|
4429
|
+
try {
|
|
4430
|
+
const workerThreads = await import('worker_threads');
|
|
4431
|
+
return new workerThreads.Worker(entryPoint);
|
|
4432
|
+
} catch {
|
|
4433
|
+
return null;
|
|
4434
|
+
}
|
|
4435
|
+
}
|
|
4436
|
+
async function isNodeMainThread() {
|
|
4437
|
+
try {
|
|
4438
|
+
const workerThreads = await import('worker_threads');
|
|
4439
|
+
return workerThreads.isMainThread;
|
|
4440
|
+
} catch {
|
|
4441
|
+
return true;
|
|
4442
|
+
}
|
|
4443
|
+
}
|
|
4444
|
+
|
|
4427
4445
|
// src/runtime/detect.ts
|
|
4428
4446
|
function detectRuntimeName() {
|
|
4429
4447
|
if ("Bun" in globalThis) {
|
|
@@ -4473,9 +4491,7 @@ async function spawnWorker() {
|
|
|
4473
4491
|
const entryPoint = resolveWorkerEntryPoint();
|
|
4474
4492
|
if (runtime.supportsWorkerThreads) {
|
|
4475
4493
|
try {
|
|
4476
|
-
|
|
4477
|
-
const instance = new workerThreads.Worker(new URL(entryPoint));
|
|
4478
|
-
return instance;
|
|
4494
|
+
return await spawnNodeWorker(new URL(entryPoint));
|
|
4479
4495
|
} catch {
|
|
4480
4496
|
return null;
|
|
4481
4497
|
}
|
|
@@ -5325,4 +5341,4 @@ function createDirectExecutor() {
|
|
|
5325
5341
|
};
|
|
5326
5342
|
}
|
|
5327
5343
|
|
|
5328
|
-
export { MAX_NESTING_DEPTH, clearNormalizationCache, configureNormalizationCache, createDirectExecutor, createPartitionIndex, createPartitionManager, createPartitionRouter, createVectorIndex, deserializePayloadV2, detectRuntime, extractVectorFieldsFromSchema, fanOutQuery, flattenSchema, fnv1a, getLanguage, getNestedValue, getNormalizationCacheSize, kWayMerge, mergePartitionStats, registerLanguage, resetNormalizationCache, tokenize, validateRequiredFields, validateSchema, validateVectorPromotion };
|
|
5344
|
+
export { MAX_NESTING_DEPTH, clearNormalizationCache, configureNormalizationCache, createDirectExecutor, createPartitionIndex, createPartitionManager, createPartitionRouter, createVectorIndex, deserializePayloadV2, detectRuntime, extractVectorFieldsFromSchema, fanOutQuery, flattenSchema, fnv1a, getLanguage, getNestedValue, getNormalizationCacheSize, isNodeMainThread, kWayMerge, mergePartitionStats, registerLanguage, resetNormalizationCache, spawnNodeWorker, tokenize, validateRequiredFields, validateSchema, validateVectorPromotion };
|
package/dist/distribution.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createInMemoryCoordinator } from './chunk-RQLXC2YS.mjs';
|
|
2
2
|
import './chunk-WISGW24C.mjs';
|
|
3
|
-
import { ReplicationMessageTypes, ClusterMessageTypes, DEFAULT_TRANSPORT_CONFIG, TransportError, TransportErrorCodes, MAX_MESSAGE_SIZE_BYTES, createEngineCore, createNarsilFromCore, QueryMessageTypes, applyIndexEntry, applyDeleteEntry, validateEntryPayload, createAckMessage, validateReplicationEntry, MAX_PARTITION_COUNT, MAX_INDEX_NAME_LENGTH, validateIndexName, computeEntryChecksum, createInsyncConfirmMessage, createEntryMessage, getIndexMetadata, validateAckPayload, createInsyncRemoveMessage, validateInsyncConfirmPayload, putIndexMetadata, createForwardMessage } from './chunk-
|
|
4
|
-
import { deserializePayloadV2, createPartitionIndex, getLanguage, fnv1a, mergePartitionStats, MAX_NESTING_DEPTH } from './chunk-
|
|
3
|
+
import { ReplicationMessageTypes, ClusterMessageTypes, DEFAULT_TRANSPORT_CONFIG, TransportError, TransportErrorCodes, MAX_MESSAGE_SIZE_BYTES, createEngineCore, createNarsilFromCore, QueryMessageTypes, applyIndexEntry, applyDeleteEntry, validateEntryPayload, createAckMessage, validateReplicationEntry, MAX_PARTITION_COUNT, MAX_INDEX_NAME_LENGTH, validateIndexName, computeEntryChecksum, createInsyncConfirmMessage, createEntryMessage, getIndexMetadata, validateAckPayload, createInsyncRemoveMessage, validateInsyncConfirmPayload, putIndexMetadata, createForwardMessage } from './chunk-CU6BVZEU.mjs';
|
|
4
|
+
import { deserializePayloadV2, createPartitionIndex, getLanguage, fnv1a, mergePartitionStats, MAX_NESTING_DEPTH } from './chunk-Q4OVNESD.mjs';
|
|
5
5
|
import './chunk-S7RJJMHI.mjs';
|
|
6
6
|
import { crc32 } from './chunk-KMMJMDUA.mjs';
|
|
7
7
|
import './chunk-TW6BXTOL.mjs';
|
package/dist/index.browser.mjs
CHANGED
|
@@ -6176,6 +6176,14 @@ function createHNSWIndex(dimension, store, config, quantizer) {
|
|
|
6176
6176
|
};
|
|
6177
6177
|
}
|
|
6178
6178
|
|
|
6179
|
+
// src/workers/node-worker.browser.ts
|
|
6180
|
+
async function spawnNodeWorker(_entryPoint) {
|
|
6181
|
+
return null;
|
|
6182
|
+
}
|
|
6183
|
+
async function isNodeMainThread() {
|
|
6184
|
+
return true;
|
|
6185
|
+
}
|
|
6186
|
+
|
|
6179
6187
|
// src/runtime/detect.ts
|
|
6180
6188
|
function detectRuntimeName() {
|
|
6181
6189
|
if ("Bun" in globalThis) {
|
|
@@ -6225,9 +6233,7 @@ async function spawnWorker() {
|
|
|
6225
6233
|
const entryPoint = resolveWorkerEntryPoint();
|
|
6226
6234
|
if (runtime.supportsWorkerThreads) {
|
|
6227
6235
|
try {
|
|
6228
|
-
|
|
6229
|
-
const instance = new workerThreads.Worker(new URL(entryPoint));
|
|
6230
|
-
return instance;
|
|
6236
|
+
return await spawnNodeWorker(new URL(entryPoint));
|
|
6231
6237
|
} catch {
|
|
6232
6238
|
return null;
|
|
6233
6239
|
}
|
|
@@ -7115,21 +7121,21 @@ function createExecutionPromoter(config) {
|
|
|
7115
7121
|
return { check, markPromoted, isPromoted };
|
|
7116
7122
|
}
|
|
7117
7123
|
|
|
7118
|
-
// src/persistence/durability/
|
|
7119
|
-
|
|
7120
|
-
|
|
7124
|
+
// src/persistence/durability/node-fs.browser.ts
|
|
7125
|
+
function filesystemUnavailable() {
|
|
7126
|
+
throw new NarsilError(
|
|
7127
|
+
ErrorCodes.CONFIG_INVALID,
|
|
7128
|
+
"Filesystem durability requires a Node.js runtime; use the memory or IndexedDB persistence adapters in the browser"
|
|
7129
|
+
);
|
|
7130
|
+
}
|
|
7121
7131
|
async function getFs() {
|
|
7122
|
-
|
|
7123
|
-
cachedFs = await import('fs/promises');
|
|
7124
|
-
}
|
|
7125
|
-
return cachedFs;
|
|
7132
|
+
return filesystemUnavailable();
|
|
7126
7133
|
}
|
|
7127
7134
|
async function getPath() {
|
|
7128
|
-
|
|
7129
|
-
cachedPath = await import('path');
|
|
7130
|
-
}
|
|
7131
|
-
return cachedPath;
|
|
7135
|
+
return filesystemUnavailable();
|
|
7132
7136
|
}
|
|
7137
|
+
|
|
7138
|
+
// src/persistence/durability/durable-filesystem.ts
|
|
7133
7139
|
function validateRelativeKey(key) {
|
|
7134
7140
|
if (key.length === 0) {
|
|
7135
7141
|
throw new NarsilError(ErrorCodes.PERSISTENCE_SAVE_FAILED, "Invalid key: empty");
|
|
@@ -7442,12 +7448,7 @@ var mainThreadResolved = false;
|
|
|
7442
7448
|
var onMainThread = true;
|
|
7443
7449
|
async function isOnMainThread() {
|
|
7444
7450
|
if (!mainThreadResolved) {
|
|
7445
|
-
|
|
7446
|
-
const workerThreads = await import('worker_threads');
|
|
7447
|
-
onMainThread = workerThreads.isMainThread;
|
|
7448
|
-
} catch {
|
|
7449
|
-
onMainThread = true;
|
|
7450
|
-
}
|
|
7451
|
+
onMainThread = await isNodeMainThread();
|
|
7451
7452
|
mainThreadResolved = true;
|
|
7452
7453
|
}
|
|
7453
7454
|
return onMainThread;
|
|
@@ -7462,8 +7463,7 @@ function resolveWorkerEntryPoint2() {
|
|
|
7462
7463
|
}
|
|
7463
7464
|
async function spawnWorker2() {
|
|
7464
7465
|
try {
|
|
7465
|
-
|
|
7466
|
-
return new workerThreads.Worker(new URL(resolveWorkerEntryPoint2()));
|
|
7466
|
+
return await spawnNodeWorker(new URL(resolveWorkerEntryPoint2()));
|
|
7467
7467
|
} catch {
|
|
7468
7468
|
return null;
|
|
7469
7469
|
}
|
|
@@ -8142,8 +8142,10 @@ function resolveWorkerEntryPoint3() {
|
|
|
8142
8142
|
}
|
|
8143
8143
|
async function spawnWorker3() {
|
|
8144
8144
|
try {
|
|
8145
|
-
const
|
|
8146
|
-
|
|
8145
|
+
const worker = await spawnNodeWorker(new URL(resolveWorkerEntryPoint3()));
|
|
8146
|
+
if (worker === null) {
|
|
8147
|
+
return null;
|
|
8148
|
+
}
|
|
8147
8149
|
if (typeof worker.unref === "function") {
|
|
8148
8150
|
worker.unref();
|
|
8149
8151
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { VERSION, createNarsil } from './chunk-
|
|
2
|
-
export { clearNormalizationCache, configureNormalizationCache, getLanguage, getNormalizationCacheSize, registerLanguage, resetNormalizationCache } from './chunk-
|
|
1
|
+
export { VERSION, createNarsil } from './chunk-CU6BVZEU.mjs';
|
|
2
|
+
export { clearNormalizationCache, configureNormalizationCache, getLanguage, getNormalizationCacheSize, registerLanguage, resetNormalizationCache } from './chunk-Q4OVNESD.mjs';
|
|
3
3
|
export { isSimdAvailable } from './chunk-S7RJJMHI.mjs';
|
|
4
4
|
import './chunk-KMMJMDUA.mjs';
|
|
5
5
|
import './chunk-TW6BXTOL.mjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createDurableDirectory, writeSegmentedCheckpoint } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
import { createDurableDirectory, writeSegmentedCheckpoint } from '../../chunk-CU6BVZEU.mjs';
|
|
2
|
+
import '../../chunk-Q4OVNESD.mjs';
|
|
3
3
|
import '../../chunk-S7RJJMHI.mjs';
|
|
4
4
|
import '../../chunk-KMMJMDUA.mjs';
|
|
5
5
|
import '../../chunk-TW6BXTOL.mjs';
|
package/dist/workers/entry.mjs
CHANGED
|
@@ -15,7 +15,7 @@ async function setup() {
|
|
|
15
15
|
} catch {
|
|
16
16
|
parentPort = null;
|
|
17
17
|
}
|
|
18
|
-
const { createDirectExecutor } = await import('../direct-executor-
|
|
18
|
+
const { createDirectExecutor } = await import('../direct-executor-6FOKJKLD.mjs');
|
|
19
19
|
const executor = createDirectExecutor();
|
|
20
20
|
function buildErrorResponse(requestId, code, message) {
|
|
21
21
|
return { type: "error", requestId, code, message };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delali/narsil",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A distributed full-text search engine with cross-language portable binary format.",
|
|
6
6
|
"author": "Delali (https://sondelali.com)",
|
|
@@ -22,6 +22,14 @@
|
|
|
22
22
|
"#platform/vector-promoter": {
|
|
23
23
|
"browser": "./src/vector/promoter.browser.ts",
|
|
24
24
|
"default": "./src/vector/promoter.ts"
|
|
25
|
+
},
|
|
26
|
+
"#platform/durable-fs": {
|
|
27
|
+
"browser": "./src/persistence/durability/node-fs.browser.ts",
|
|
28
|
+
"default": "./src/persistence/durability/node-fs.ts"
|
|
29
|
+
},
|
|
30
|
+
"#platform/node-worker": {
|
|
31
|
+
"browser": "./src/workers/node-worker.browser.ts",
|
|
32
|
+
"default": "./src/workers/node-worker.ts"
|
|
25
33
|
}
|
|
26
34
|
},
|
|
27
35
|
"sideEffects": false,
|
|
@@ -133,7 +141,7 @@
|
|
|
133
141
|
}
|
|
134
142
|
},
|
|
135
143
|
"scripts": {
|
|
136
|
-
"build": "tsup",
|
|
144
|
+
"build": "tsup && node scripts/check-browser-bundle.mjs",
|
|
137
145
|
"test": "vitest run --exclude='**/vector/recall.test.ts'",
|
|
138
146
|
"test:etcd": "vitest run src/__tests__/distribution/coordinator/etcd-integration/*.test.ts",
|
|
139
147
|
"test:watch": "vitest",
|