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

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 (46) hide show
  1. package/dist/{capabilities-B1wz2Zl0.d.ts → capabilities-Dt-7B4Wz.d.ts} +2 -2
  2. package/dist/{chunk-DD5X23E6.mjs → chunk-2STVUTNA.mjs} +1 -1
  3. package/dist/chunk-3JGWULDF.mjs +256 -0
  4. package/dist/{chunk-6TGZG2TV.mjs → chunk-653BNMAF.mjs} +190 -58
  5. package/dist/{chunk-YA52AC2V.mjs → chunk-FVLQ63B7.mjs} +203 -9
  6. package/dist/{chunk-5JLSTECC.mjs → chunk-GIVAGD3Q.mjs} +1 -1
  7. package/dist/{chunk-AV4IJKD2.mjs → chunk-HWQLTLNG.mjs} +18 -1
  8. package/dist/{chunk-6IT3MH5M.mjs → chunk-IOR2K26O.mjs} +178 -238
  9. package/dist/{chunk-4VU5TWCR.mjs → chunk-LMO5TJUS.mjs} +40 -35
  10. package/dist/{chunk-BEWOA4VV.mjs → chunk-M76V3OGJ.mjs} +508 -401
  11. package/dist/{chunk-YMZCMH5M.mjs → chunk-OI42GWLR.mjs} +17 -1
  12. package/dist/{chunk-2BDG2IWP.mjs → chunk-P4DSQ6M4.mjs} +16 -6
  13. package/dist/{chunk-THYRHHO2.mjs → chunk-YJDQ7NLA.mjs} +1 -1
  14. package/dist/{client-xVrOCYTW.d.ts → client-COek5GXK.d.ts} +3 -3
  15. package/dist/client.d.ts +8 -8
  16. package/dist/{config-CEeSV_Xo.d.ts → config-Dfanyqqt.d.ts} +2 -2
  17. package/dist/{config-CSvCVtB7.d.ts → config-rBpbgTw8.d.ts} +2 -2
  18. package/dist/direct-executor-GYJEKNV5.mjs +12 -0
  19. package/dist/distribution/coordinator/etcd.d.ts +2 -2
  20. package/dist/distribution/coordinator/etcd.mjs +1 -1
  21. package/dist/distribution/coordinator/in-memory.d.ts +2 -2
  22. package/dist/distribution/coordinator/in-memory.mjs +1 -1
  23. package/dist/distribution.d.ts +8 -8
  24. package/dist/distribution.mjs +109 -69
  25. package/dist/{engine-77ErLy8P.d.ts → engine-igk0aMpQ.d.ts} +109 -60
  26. package/dist/index.browser.mjs +1167 -749
  27. package/dist/index.d.ts +7 -7
  28. package/dist/index.mjs +10 -10
  29. package/dist/invalidation/filesystem.mjs +1 -1
  30. package/dist/{memory-CKF-9WLP.d.ts → memory-C7UMCMH3.d.ts} +35 -17
  31. package/dist/persistence/durability/checkpoint-worker.d.ts +2 -1
  32. package/dist/persistence/durability/checkpoint-worker.mjs +10 -10
  33. package/dist/react.d.ts +277 -182
  34. package/dist/react.mjs +189 -45
  35. package/dist/{schema-d5Afu03A.d.ts → schema-Bgzr4g7b.d.ts} +62 -10
  36. package/dist/server.d.ts +10 -10
  37. package/dist/server.mjs +11 -7
  38. package/dist/{tasks-BEiNxDRs.d.ts → tasks-BZt_zes6.d.ts} +3 -1
  39. package/dist/{thread-FLP45EUD.mjs → thread-JEVAYETR.mjs} +6 -6
  40. package/dist/{types-DAK7mnUZ.d.ts → types-gOUqhs2F.d.ts} +1 -1
  41. package/dist/vector/search-worker.d.ts +1 -1
  42. package/dist/vector/search-worker.mjs +2 -2
  43. package/dist/workers/entry.mjs +3 -3
  44. package/package.json +7 -7
  45. package/dist/chunk-VTPLKNWI.mjs +0 -135
  46. package/dist/direct-executor-3ZYXSGFX.mjs +0 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delali/narsil",
3
- "version": "0.3.1-next.69",
3
+ "version": "0.3.1-next.71",
4
4
  "type": "module",
5
5
  "description": "Distributed search engine with full-text, vector, hybrid, and geosearch. One engine, embedded or on a server, with a cross-language .nrsl format.",
6
6
  "author": "Delali (https://sondelali.com)",
@@ -223,11 +223,11 @@
223
223
  }
224
224
  },
225
225
  "optionalDependencies": {
226
- "@delali/narsil-native-darwin-arm64": "0.3.1-next.69",
227
- "@delali/narsil-native-darwin-x64": "0.3.1-next.69",
228
- "@delali/narsil-native-linux-arm64": "0.3.1-next.69",
229
- "@delali/narsil-native-linux-x64": "0.3.1-next.69",
230
- "@delali/narsil-native-win32-arm64": "0.3.1-next.69",
231
- "@delali/narsil-native-win32-x64": "0.3.1-next.69"
226
+ "@delali/narsil-native-darwin-arm64": "0.3.1-next.71",
227
+ "@delali/narsil-native-darwin-x64": "0.3.1-next.71",
228
+ "@delali/narsil-native-linux-arm64": "0.3.1-next.71",
229
+ "@delali/narsil-native-linux-x64": "0.3.1-next.71",
230
+ "@delali/narsil-native-win32-arm64": "0.3.1-next.71",
231
+ "@delali/narsil-native-win32-x64": "0.3.1-next.71"
232
232
  }
233
233
  }
@@ -1,135 +0,0 @@
1
- import { MAX_PARTITION_COUNT, MAX_REPLICATION_FACTOR } from './chunk-YA52AC2V.mjs';
2
- import { MAX_INDEX_NAME_LENGTH, INDEX_NAME_PATTERN } from './chunk-5JLSTECC.mjs';
3
- import { NarsilError, ErrorCodes } from './chunk-USKFU7J5.mjs';
4
- import { encode, decode } from '@msgpack/msgpack';
5
-
6
- var INDEX_CONFIG_PREFIX = "_narsil/index/";
7
- var INDEX_CONFIG_SUFFIX = "/config";
8
- function truncateForDisplay(value) {
9
- const str = String(value);
10
- if (str.length > 100) {
11
- return `${str.slice(0, 100)}...`;
12
- }
13
- return str;
14
- }
15
- function validateIndexName(indexName) {
16
- if (indexName.length === 0 || indexName.length > MAX_INDEX_NAME_LENGTH) {
17
- throw new NarsilError(
18
- ErrorCodes.CONTROLLER_METADATA_INVALID,
19
- `Index name must be between 1 and ${MAX_INDEX_NAME_LENGTH} characters`,
20
- { indexName: truncateForDisplay(indexName) }
21
- );
22
- }
23
- if (indexName.includes("\0") || indexName.includes("/") || indexName.includes("\\") || indexName.includes("..")) {
24
- throw new NarsilError(
25
- ErrorCodes.CONTROLLER_METADATA_INVALID,
26
- "Index name contains forbidden characters (/, \\, .., or null bytes)",
27
- { indexName: truncateForDisplay(indexName) }
28
- );
29
- }
30
- if (!INDEX_NAME_PATTERN.test(indexName)) {
31
- throw new NarsilError(
32
- ErrorCodes.CONTROLLER_METADATA_INVALID,
33
- "Index name must start with an alphanumeric character and contain only alphanumeric characters, hyphens, underscores, or dots",
34
- { indexName: truncateForDisplay(indexName) }
35
- );
36
- }
37
- }
38
- function isValidInteger(value) {
39
- return typeof value === "number" && Number.isFinite(value) && Number.isInteger(value);
40
- }
41
- function indexConfigKey(indexName) {
42
- return `${INDEX_CONFIG_PREFIX}${indexName}${INDEX_CONFIG_SUFFIX}`;
43
- }
44
- function isRecord(value) {
45
- return value !== null && typeof value === "object" && !Array.isArray(value);
46
- }
47
- function validateDecodedMetadata(decoded, indexName) {
48
- if (!isRecord(decoded)) {
49
- throw new NarsilError(
50
- ErrorCodes.CONTROLLER_METADATA_INVALID,
51
- `Index metadata for '${indexName}' is not an object`,
52
- { indexName }
53
- );
54
- }
55
- if (typeof decoded.indexUuid !== "string" || decoded.indexUuid.length === 0 || decoded.indexUuid.length > 128) {
56
- throw new NarsilError(
57
- ErrorCodes.CONTROLLER_METADATA_INVALID,
58
- `Index metadata for '${indexName}' has invalid indexUuid`,
59
- { indexName, received: truncateForDisplay(decoded.indexUuid) }
60
- );
61
- }
62
- if (typeof decoded.indexName !== "string") {
63
- throw new NarsilError(
64
- ErrorCodes.CONTROLLER_METADATA_INVALID,
65
- `Index metadata for '${indexName}' has invalid indexName`,
66
- { indexName, received: truncateForDisplay(decoded.indexName) }
67
- );
68
- }
69
- if (!isValidInteger(decoded.partitionCount) || decoded.partitionCount <= 0 || decoded.partitionCount > MAX_PARTITION_COUNT) {
70
- throw new NarsilError(
71
- ErrorCodes.CONTROLLER_METADATA_INVALID,
72
- `Index metadata for '${indexName}' has invalid partitionCount (must be an integer between 1 and ${MAX_PARTITION_COUNT})`,
73
- { indexName, partitionCount: truncateForDisplay(decoded.partitionCount) }
74
- );
75
- }
76
- if (!isValidInteger(decoded.replicationFactor) || decoded.replicationFactor < 0 || decoded.replicationFactor > MAX_REPLICATION_FACTOR) {
77
- throw new NarsilError(
78
- ErrorCodes.CONTROLLER_METADATA_INVALID,
79
- `Index metadata for '${indexName}' has invalid replicationFactor (must be an integer between 0 and ${MAX_REPLICATION_FACTOR})`,
80
- { indexName, replicationFactor: truncateForDisplay(decoded.replicationFactor) }
81
- );
82
- }
83
- if (!isRecord(decoded.constraints)) {
84
- throw new NarsilError(
85
- ErrorCodes.CONTROLLER_METADATA_INVALID,
86
- `Index metadata for '${indexName}' has invalid constraints`,
87
- { indexName }
88
- );
89
- }
90
- const constraints = decoded.constraints;
91
- if (constraints.maxShardsPerNode !== void 0 && constraints.maxShardsPerNode !== null && typeof constraints.maxShardsPerNode !== "number") {
92
- throw new NarsilError(
93
- ErrorCodes.CONTROLLER_METADATA_INVALID,
94
- `Index metadata for '${indexName}' has invalid maxShardsPerNode (must be a number or null)`,
95
- { indexName, maxShardsPerNode: truncateForDisplay(constraints.maxShardsPerNode) }
96
- );
97
- }
98
- return {
99
- indexUuid: decoded.indexUuid,
100
- indexName: decoded.indexName,
101
- partitionCount: decoded.partitionCount,
102
- replicationFactor: decoded.replicationFactor,
103
- constraints: {
104
- zoneAwareness: constraints.zoneAwareness === true,
105
- zoneAttribute: typeof constraints.zoneAttribute === "string" ? constraints.zoneAttribute : "zone",
106
- maxShardsPerNode: typeof constraints.maxShardsPerNode === "number" ? constraints.maxShardsPerNode : null
107
- }
108
- };
109
- }
110
- async function putIndexMetadata(coordinator, metadata) {
111
- validateIndexName(metadata.indexName);
112
- const key = indexConfigKey(metadata.indexName);
113
- const encoded = encode(metadata);
114
- const bytes = new Uint8Array(encoded);
115
- if (await coordinator.compareAndSet(key, null, bytes)) {
116
- return true;
117
- }
118
- const current = await coordinator.get(key);
119
- if (current === null || current.byteLength > 0) {
120
- return false;
121
- }
122
- return coordinator.compareAndSet(key, current, bytes);
123
- }
124
- async function getIndexMetadata(coordinator, indexName) {
125
- validateIndexName(indexName);
126
- const key = indexConfigKey(indexName);
127
- const raw = await coordinator.get(key);
128
- if (raw === null || raw.byteLength === 0) {
129
- return null;
130
- }
131
- const decoded = decode(raw);
132
- return validateDecodedMetadata(decoded, indexName);
133
- }
134
-
135
- export { getIndexMetadata, indexConfigKey, putIndexMetadata, validateIndexName };
@@ -1,12 +0,0 @@
1
- export { createDirectExecutor } from './chunk-BEWOA4VV.mjs';
2
- import './chunk-AV4IJKD2.mjs';
3
- import './chunk-4VU5TWCR.mjs';
4
- import './chunk-6TGZG2TV.mjs';
5
- import './chunk-TGP5M5R7.mjs';
6
- import './chunk-THYRHHO2.mjs';
7
- import './chunk-ZJ4CSAB2.mjs';
8
- import './chunk-YNVIUGF5.mjs';
9
- import './chunk-IFBKLBGB.mjs';
10
- import './chunk-U2BKYEC7.mjs';
11
- import './chunk-YMZCMH5M.mjs';
12
- import './chunk-USKFU7J5.mjs';