@delali/narsil 0.3.1-next.79 → 0.3.1-next.82
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/README.md +3 -3
- package/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/{capabilities-1lEYL3WK.d.ts → capabilities-CAdkp2P-.d.ts} +2 -2
- package/dist/{chunk-XSZTF4ZQ.mjs → chunk-2453RJYK.mjs} +2 -2
- package/dist/{chunk-DFW3U5UW.mjs → chunk-4CWHWOBI.mjs} +24 -195
- package/dist/{chunk-R6WBLBTC.mjs → chunk-4D6OH4EF.mjs} +10 -46
- package/dist/{chunk-RTR44V2A.mjs → chunk-4VBG6PEH.mjs} +586 -4
- package/dist/{chunk-Y3L5MDRV.mjs → chunk-5XNIRLFC.mjs} +2 -2
- package/dist/{chunk-2E35UM3G.mjs → chunk-B3UOQJD3.mjs} +1 -1
- package/dist/{chunk-PJWG547Z.mjs → chunk-GNYXCLJS.mjs} +5 -5
- package/dist/{chunk-55WEJKWT.mjs → chunk-IH3GKNDQ.mjs} +197 -93
- package/dist/{chunk-AMGDG4ZJ.mjs → chunk-IN5CH4P2.mjs} +3 -3
- package/dist/{chunk-PXDQFYD5.mjs → chunk-KJ7LB3TR.mjs} +24 -140
- package/dist/chunk-LS5IRM23.mjs +140 -0
- package/dist/{chunk-4MQ5F4IL.mjs → chunk-OLXM65YH.mjs} +1 -1
- package/dist/{chunk-IBR6634K.mjs → chunk-R6A773WK.mjs} +2 -69
- package/dist/{chunk-4344I4MR.mjs → chunk-SREPGC6O.mjs} +336 -13
- package/dist/{chunk-I64LXKO3.mjs → chunk-TPJU7NDJ.mjs} +1 -0
- package/dist/chunk-WQBCBKY3.mjs +8 -0
- package/dist/{chunk-P2BEMMOD.mjs → chunk-XYDP7CCJ.mjs} +151 -204
- package/dist/{chunk-Z3BXCZXS.mjs → chunk-XZF4LZ3X.mjs} +5 -3
- package/dist/chunk-YTJCGKM4.mjs +56 -0
- package/dist/chunk-ZCKPRCYI.mjs +30 -0
- package/dist/{client-ZXcbSViH.d.ts → client-CKUtkLz3.d.ts} +2 -2
- package/dist/client.d.ts +7 -7
- package/dist/client.mjs +1 -0
- package/dist/{config-DHL2KsfD.d.ts → config-BuIkeM5C.d.ts} +39 -3
- package/dist/{config-DTe5EbWW.d.ts → config-CSDEPraV.d.ts} +1 -1
- package/dist/direct-executor-JVXDR5Y5.mjs +19 -0
- package/dist/distribution/coordinator/etcd.d.ts +1 -1
- package/dist/distribution/coordinator/etcd.mjs +3 -2
- package/dist/distribution/coordinator/in-memory.d.ts +1 -1
- package/dist/distribution/coordinator/in-memory.mjs +2 -1
- package/dist/distribution/transport/grpc.mjs +1 -1
- package/dist/distribution.d.ts +7 -7
- package/dist/distribution.mjs +759 -65
- package/dist/embeddings/openai.mjs +1 -1
- package/dist/{engine-BjPBzWkA.d.ts → engine-DMNZJAUq.d.ts} +1 -1
- package/dist/{types-ChrVy4lH.d.ts → index-DzONZUKE.d.ts} +79 -37
- package/dist/index.browser.mjs +138 -539
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +17 -15
- package/dist/invalidation/filesystem.mjs +2 -1
- package/dist/{memory-DW3OJ0im.d.ts → memory-BPKNx9Tl.d.ts} +1288 -1287
- package/dist/partial-words.mjs +6 -5
- package/dist/pattern.mjs +5 -2
- package/dist/persistence/durability/checkpoint-worker.d.ts +7 -7
- package/dist/persistence/durability/checkpoint-worker.mjs +17 -15
- package/dist/react.d.ts +6 -6
- package/dist/react.mjs +1 -0
- package/dist/server.d.ts +9 -9
- package/dist/server.mjs +21 -13
- package/dist/{tasks-BTbwBqar.d.ts → tasks-DGyz586z.d.ts} +1 -1
- package/dist/{thread-XBDVXKUE.mjs → thread-33M5AOEI.mjs} +13 -10
- package/dist/vector/search-worker.mjs +5 -4
- package/dist/workers/entry.mjs +5 -5
- package/package.json +13 -7
- package/dist/chunk-IOZPBNSG.mjs +0 -55
- package/dist/chunk-WFVOBZS4.mjs +0 -485
- package/dist/direct-executor-WB2HKU4N.mjs +0 -17
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// src/filters/constants.ts
|
|
2
|
+
var MAX_FILTER_DEPTH = 30;
|
|
3
|
+
var MAX_FILTER_TESTS = 1024;
|
|
4
|
+
var FILTER_OPERAND_COPY_DEPTH = 3;
|
|
5
|
+
var MAX_FILTER_ARRAY_SIZE = 65536;
|
|
6
|
+
var GEO_UNIT_METRES = { km: 1e3, mi: 1609.344, m: 1 };
|
|
7
|
+
|
|
8
|
+
export { FILTER_OPERAND_COPY_DEPTH, GEO_UNIT_METRES, MAX_FILTER_ARRAY_SIZE, MAX_FILTER_DEPTH, MAX_FILTER_TESTS };
|
|
@@ -1,10 +1,115 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { getFlatSchema, tokenize, getFieldValueByInternalId, getFieldValueForDoc } from './chunk-
|
|
4
|
-
import {
|
|
1
|
+
import { PATTERN_EXPRESSION_OPERATORS, PATTERN_TEST_OPERATORS, PATTERN_ELEMENT_OPERATORS, requireTextRangeField, isFiniteNumber, invalid, requireFieldKind, kindOfValue, requireListLength, isObjectRecord, patternSearchModule, DEFAULT_PATTERN_WORK_CAP, bitsetIsEmpty, createBitSet, bitsetSet, PATTERN_WORK_FLUSH_UNITS, MATCHER_STATE_BUDGET_BYTES } from './chunk-SREPGC6O.mjs';
|
|
2
|
+
import { GEO_UNIT_METRES, MAX_FILTER_DEPTH, MAX_FILTER_TESTS, FILTER_OPERAND_COPY_DEPTH } from './chunk-WQBCBKY3.mjs';
|
|
3
|
+
import { getFlatSchema, tokenize, partialWordSearchModule, getFieldValueByInternalId, getFieldValueForDoc } from './chunk-4VBG6PEH.mjs';
|
|
4
|
+
import { isLatitude, MAX_LATITUDE_DEGREES, isLongitude, MAX_LONGITUDE_DEGREES, MIN_POLYGON_POINTS, partialFieldsOf, schemaFieldsOf, flattenSchema, MAX_SORT_FIELDS, MAX_SORT_FIELD_NAME_LENGTH, MAX_CURSOR_LENGTH, MAX_CURSOR_ANCHOR_CODE_POINTS, RESULT_WINDOW, DEFAULT_FUZZY_PREFIX_LENGTH, EARTH_RADIUS_METERS, RADIUS_BOX_MARGIN_RATIO, RADIUS_BOX_MARGIN_RADIANS, FULL_TURN_DEGREES, ANTIMERIDIAN_SPAN_DEGREES, DEFAULT_PAGE_SIZE, DEG_TO_RAD, LOCATION_CODE_BITS_PER_AXIS, PREFIX_MAX_EXPANSIONS, MAX_COVERING_CELLS } from './chunk-KJ7LB3TR.mjs';
|
|
5
5
|
import { fuzzyTermMatches } from './chunk-GES7U2PM.mjs';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { parsedTypeOf, isStringValuedBase, withSortableOption, isGeopointOrVectorType, PROTOTYPE_POLLUTION_KEYS, isWordIndexedFieldType } from './chunk-LS5IRM23.mjs';
|
|
7
|
+
import { singleFoldTable, appendFoldedCodePoint, sortModeOf, defaultSortMode, SORT_VALUE_MAX_CODE_POINTS, toReducedSortValue, readSortField, compareComparableKeys, toComparableSortValue, isSortMode, SORT_MODES, compareSortValues } from './chunk-R6A773WK.mjs';
|
|
8
|
+
import { compareCodePoints, exceedsCodePoints, codePointCount, holdsUnpairedSurrogate } from './chunk-YTJCGKM4.mjs';
|
|
9
|
+
import { NarsilError, ErrorCodes } from './chunk-TPJU7NDJ.mjs';
|
|
10
|
+
|
|
11
|
+
// src/core/partition/partial-words/platform.ts
|
|
12
|
+
function platformPartialWordSearch() {
|
|
13
|
+
return partialWordSearchModule;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/core/partition/partial-words/registry.ts
|
|
17
|
+
var registered = null;
|
|
18
|
+
var MODULE_FUNCTIONS = [
|
|
19
|
+
"createGrowingSlot",
|
|
20
|
+
"createFrozenSlot",
|
|
21
|
+
"buildTable",
|
|
22
|
+
"expand",
|
|
23
|
+
"countSpelling",
|
|
24
|
+
"encodeSpellings",
|
|
25
|
+
"spellingCountsOf",
|
|
26
|
+
"highlightMatcher",
|
|
27
|
+
"addTermMembers",
|
|
28
|
+
"highlightWords"
|
|
29
|
+
];
|
|
30
|
+
function isPartialWordSearchModule(value) {
|
|
31
|
+
if (value === null || typeof value !== "object" || value.name !== "partialWords") return false;
|
|
32
|
+
return MODULE_FUNCTIONS.every((name) => typeof Reflect.get(value, name) === "function");
|
|
33
|
+
}
|
|
34
|
+
function registerPartialWordSearch(module) {
|
|
35
|
+
if (!isPartialWordSearchModule(module)) {
|
|
36
|
+
throw new NarsilError(
|
|
37
|
+
ErrorCodes.CONFIG_INVALID,
|
|
38
|
+
'Pass registerPartialWordSearch the partialWordSearch object that "@delali/narsil/partial-words" exports'
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
registered = module;
|
|
42
|
+
}
|
|
43
|
+
function availablePartialWordSearch() {
|
|
44
|
+
return registered ?? platformPartialWordSearch();
|
|
45
|
+
}
|
|
46
|
+
var PARTIAL_WORD_IMPORT_ADVICE = `Add import { partialWordSearch } from '@delali/narsil/partial-words', then call registerPartialWordSearch(partialWordSearch) before you create or load an index with a partial field`;
|
|
47
|
+
function partialWordModule() {
|
|
48
|
+
const module = availablePartialWordSearch();
|
|
49
|
+
if (module !== null) return module;
|
|
50
|
+
throw new NarsilError(
|
|
51
|
+
ErrorCodes.CONFIG_INVALID,
|
|
52
|
+
`This bundle contains no partial-word search code. ${PARTIAL_WORD_IMPORT_ADVICE}`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
function requirePartialWordSearchFor(schema) {
|
|
56
|
+
const fields = partialFieldsOf(schema);
|
|
57
|
+
if (fields.length === 0 || availablePartialWordSearch() !== null) return;
|
|
58
|
+
throw new NarsilError(
|
|
59
|
+
ErrorCodes.CONFIG_INVALID,
|
|
60
|
+
`The type of field "${fields[0]}" includes "partial", but this bundle contains no partial-word search code. ${PARTIAL_WORD_IMPORT_ADVICE}`,
|
|
61
|
+
{ field: fields[0] }
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
var EMPTY_GROWING_SLOT = {
|
|
65
|
+
readerFor: () => null,
|
|
66
|
+
spellings: () => null,
|
|
67
|
+
bytes: () => 0,
|
|
68
|
+
afterDocument: () => void 0,
|
|
69
|
+
afterMerge: () => void 0,
|
|
70
|
+
forgetSpellings: () => void 0,
|
|
71
|
+
clear: () => void 0
|
|
72
|
+
};
|
|
73
|
+
var EMPTY_FROZEN_SLOT = {
|
|
74
|
+
readerFor: () => null,
|
|
75
|
+
spellings: () => null,
|
|
76
|
+
bytes: () => 0,
|
|
77
|
+
afterRemoval: () => void 0,
|
|
78
|
+
tableOfEveryDocument: () => null,
|
|
79
|
+
countKeptSpellings: () => void 0
|
|
80
|
+
};
|
|
81
|
+
function createGrowingPartialWords(view) {
|
|
82
|
+
return availablePartialWordSearch()?.createGrowingSlot(view) ?? EMPTY_GROWING_SLOT;
|
|
83
|
+
}
|
|
84
|
+
function createFrozenPartialWords(initial, tokenTable, documents) {
|
|
85
|
+
return availablePartialWordSearch()?.createFrozenSlot(initial, tokenTable, documents) ?? EMPTY_FROZEN_SLOT;
|
|
86
|
+
}
|
|
87
|
+
function buildPartialWordTableFrom(source, tokenTable) {
|
|
88
|
+
return availablePartialWordSearch()?.buildTable(source, tokenTable) ?? null;
|
|
89
|
+
}
|
|
90
|
+
function expandPartialWords(subs, analysis, requests) {
|
|
91
|
+
const module = availablePartialWordSearch();
|
|
92
|
+
return module === null ? requests.map(() => []) : module.expand(subs, analysis, requests);
|
|
93
|
+
}
|
|
94
|
+
function countPartialSpelling(counts, token, spelling, change) {
|
|
95
|
+
partialWordModule().countSpelling(counts, token, spelling, change);
|
|
96
|
+
}
|
|
97
|
+
function encodePartialSpellingsOf(fields, counts) {
|
|
98
|
+
return partialWordModule().encodeSpellings(fields, counts);
|
|
99
|
+
}
|
|
100
|
+
function partialSpellingsOfDocuments(documents, analysis) {
|
|
101
|
+
const module = partialWordModule();
|
|
102
|
+
return module.encodeSpellings(analysis.fields, module.spellingCountsOf(documents, analysis));
|
|
103
|
+
}
|
|
104
|
+
function partialWordHighlighter(text, language, partial) {
|
|
105
|
+
return partialWordModule().highlightMatcher(text, language, partial);
|
|
106
|
+
}
|
|
107
|
+
function addPartialWordMembers(query, expand, groupOf) {
|
|
108
|
+
partialWordModule().addTermMembers(query, expand, groupOf);
|
|
109
|
+
}
|
|
110
|
+
function partialWordsToHighlight(queryTokens, written) {
|
|
111
|
+
return partialWordModule().highlightWords(queryTokens, written);
|
|
112
|
+
}
|
|
8
113
|
|
|
9
114
|
// src/core/pattern-index/platform.ts
|
|
10
115
|
function platformPatternSearch() {
|
|
@@ -12,9 +117,23 @@ function platformPatternSearch() {
|
|
|
12
117
|
}
|
|
13
118
|
|
|
14
119
|
// src/core/pattern-index/registry.ts
|
|
15
|
-
var
|
|
120
|
+
var registered2 = null;
|
|
121
|
+
var MODULE_FUNCTIONS2 = [
|
|
122
|
+
"createIndex",
|
|
123
|
+
"readArrays",
|
|
124
|
+
"mergeArrays",
|
|
125
|
+
"matchInto",
|
|
126
|
+
"checkExpression",
|
|
127
|
+
"expressionFootprint",
|
|
128
|
+
"largestFootprint",
|
|
129
|
+
"checkOperands",
|
|
130
|
+
"evaluateTests",
|
|
131
|
+
"serializeIndex",
|
|
132
|
+
"decodeIndex"
|
|
133
|
+
];
|
|
16
134
|
function isPatternSearchModule(value) {
|
|
17
|
-
|
|
135
|
+
if (value === null || typeof value !== "object" || value.name !== "pattern") return false;
|
|
136
|
+
return MODULE_FUNCTIONS2.every((name) => typeof Reflect.get(value, name) === "function");
|
|
18
137
|
}
|
|
19
138
|
function registerPatternSearch(module) {
|
|
20
139
|
if (!isPatternSearchModule(module)) {
|
|
@@ -23,10 +142,10 @@ function registerPatternSearch(module) {
|
|
|
23
142
|
'registerPatternSearch takes the patternSearch object that "@delali/narsil/pattern" exports'
|
|
24
143
|
);
|
|
25
144
|
}
|
|
26
|
-
|
|
145
|
+
registered2 = module;
|
|
27
146
|
}
|
|
28
147
|
function availablePatternSearch() {
|
|
29
|
-
return
|
|
148
|
+
return registered2 ?? platformPatternSearch();
|
|
30
149
|
}
|
|
31
150
|
function requirePatternSearchFor(schema) {
|
|
32
151
|
for (const { path, pattern } of schemaFieldsOf(schema)) {
|
|
@@ -597,58 +716,6 @@ var FIELD_FILTER_OPERATORS = [
|
|
|
597
716
|
"polygon"
|
|
598
717
|
];
|
|
599
718
|
|
|
600
|
-
// src/filters/operands/checks.ts
|
|
601
|
-
function operandKindOf(type) {
|
|
602
|
-
if (type === void 0) return void 0;
|
|
603
|
-
if (type === "number" || type === "number[]") return "number";
|
|
604
|
-
if (type === "boolean" || type === "boolean[]") return "boolean";
|
|
605
|
-
if (type === "geopoint") return "geopoint";
|
|
606
|
-
if (type.startsWith("vector[")) return "vector";
|
|
607
|
-
return "text";
|
|
608
|
-
}
|
|
609
|
-
function isFiniteNumber(value) {
|
|
610
|
-
return typeof value === "number" && Number.isFinite(value);
|
|
611
|
-
}
|
|
612
|
-
function kindOfValue(value) {
|
|
613
|
-
if (isFiniteNumber(value)) return "number";
|
|
614
|
-
if (typeof value === "boolean") return "boolean";
|
|
615
|
-
if (typeof value === "string") return "text";
|
|
616
|
-
return void 0;
|
|
617
|
-
}
|
|
618
|
-
function isObjectRecord(value) {
|
|
619
|
-
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
620
|
-
}
|
|
621
|
-
function invalid(message, fieldPath, operator) {
|
|
622
|
-
throw new NarsilError(ErrorCodes.SEARCH_INVALID_FILTER, message, { fieldPath, operator });
|
|
623
|
-
}
|
|
624
|
-
function requireFieldKind(fieldPath, operator, type, accepted) {
|
|
625
|
-
const kind = operandKindOf(type);
|
|
626
|
-
if (kind === void 0 || accepted.includes(kind)) return;
|
|
627
|
-
invalid(
|
|
628
|
-
`The engine applies "${operator}" to ${accepted.join(" or ")} fields alone, and the schema declares field "${fieldPath}" as "${type}"`,
|
|
629
|
-
fieldPath,
|
|
630
|
-
operator
|
|
631
|
-
);
|
|
632
|
-
}
|
|
633
|
-
function requireTextRangeField(fieldPath, operator, type) {
|
|
634
|
-
const parsed = parsedTypeOf(type);
|
|
635
|
-
if (parsed?.sortable && (parsed.base === "string" || parsed.base === "verbatim")) return;
|
|
636
|
-
const declared = type === void 0 ? `the schema has no field "${fieldPath}"` : `field "${fieldPath}" has type "${type}"`;
|
|
637
|
-
invalid(
|
|
638
|
-
`The engine applies "${operator}" with a text bound to a "string" or "verbatim" field whose type includes "sortable", but ${declared}`,
|
|
639
|
-
fieldPath,
|
|
640
|
-
operator
|
|
641
|
-
);
|
|
642
|
-
}
|
|
643
|
-
function requireListLength(fieldPath, operator, values) {
|
|
644
|
-
if (values.length <= MAX_FILTER_ARRAY_SIZE) return;
|
|
645
|
-
invalid(
|
|
646
|
-
`"${operator}" on field "${fieldPath}" holds ${values.length} values, while a filter list holds at most ${MAX_FILTER_ARRAY_SIZE}`,
|
|
647
|
-
fieldPath,
|
|
648
|
-
operator
|
|
649
|
-
);
|
|
650
|
-
}
|
|
651
|
-
|
|
652
719
|
// src/geo/cells.ts
|
|
653
720
|
var AXIS_CELLS = 2 ** LOCATION_CODE_BITS_PER_AXIS;
|
|
654
721
|
function axisCell(value, lowest, span) {
|
|
@@ -1028,24 +1095,7 @@ function requireSizeOperands(fieldPath, filter, type) {
|
|
|
1028
1095
|
}
|
|
1029
1096
|
|
|
1030
1097
|
// src/core/pattern-index/host.ts
|
|
1031
|
-
var
|
|
1032
|
-
var foldSources = null;
|
|
1033
|
-
function sourcesByFold() {
|
|
1034
|
-
if (foldSources !== null) return foldSources;
|
|
1035
|
-
const sources = /* @__PURE__ */ new Map();
|
|
1036
|
-
const add = (source, folded) => {
|
|
1037
|
-
const known = sources.get(folded);
|
|
1038
|
-
if (known === void 0) sources.set(folded, [source]);
|
|
1039
|
-
else known.push(source);
|
|
1040
|
-
};
|
|
1041
|
-
for (const [source, folded] of singleFoldTable()) add(source, folded);
|
|
1042
|
-
foldSources = sources;
|
|
1043
|
-
return sources;
|
|
1044
|
-
}
|
|
1045
|
-
function singleFoldSources(folded) {
|
|
1046
|
-
return sourcesByFold().get(folded) ?? NO_SOURCES;
|
|
1047
|
-
}
|
|
1048
|
-
var PATTERN_HOST = { appendFoldedCodePoint, singleFoldSources };
|
|
1098
|
+
var PATTERN_HOST = { appendFoldedCodePoint, singleFolds: singleFoldTable };
|
|
1049
1099
|
function patternIndexOf(indexes, fieldPath) {
|
|
1050
1100
|
let index = indexes.get(fieldPath);
|
|
1051
1101
|
if (index === void 0) {
|
|
@@ -1065,50 +1115,14 @@ function requirePatternField(fieldPath, operator, type) {
|
|
|
1065
1115
|
operator
|
|
1066
1116
|
);
|
|
1067
1117
|
}
|
|
1068
|
-
function requireTextLength(fieldPath, operator, text) {
|
|
1069
|
-
if (!exceedsCodePoints(text, MAX_PATTERN_TEXT_CODE_POINTS)) return;
|
|
1070
|
-
invalid(
|
|
1071
|
-
`The text of "${operator}" on pattern field "${fieldPath}" holds more than ${MAX_PATTERN_TEXT_CODE_POINTS} code points`,
|
|
1072
|
-
fieldPath,
|
|
1073
|
-
operator
|
|
1074
|
-
);
|
|
1075
|
-
}
|
|
1076
|
-
function requirePatternText(fieldPath, operator, text, caseFold) {
|
|
1077
|
-
requireTextLength(fieldPath, operator, text);
|
|
1078
|
-
if (caseFold && foldedCodePointCount(text) > MAX_PATTERN_POSITIONS) {
|
|
1079
|
-
invalid(
|
|
1080
|
-
`The text of "${operator}" on pattern field "${fieldPath}" has a case fold of more than ${MAX_PATTERN_POSITIONS} code points, while a pattern holds at most ${MAX_PATTERN_POSITIONS} positions`,
|
|
1081
|
-
fieldPath,
|
|
1082
|
-
operator
|
|
1083
|
-
);
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
var ELEMENT_OPERATORS2 = ["matchesAny", "containsAll"];
|
|
1087
1118
|
var PATTERN_OPERAND_KEYS = [
|
|
1088
1119
|
"contains",
|
|
1089
1120
|
"caseFold",
|
|
1090
1121
|
"tolerance",
|
|
1091
1122
|
...PATTERN_EXPRESSION_OPERATORS,
|
|
1092
1123
|
...PATTERN_TEST_OPERATORS,
|
|
1093
|
-
...
|
|
1124
|
+
...PATTERN_ELEMENT_OPERATORS
|
|
1094
1125
|
];
|
|
1095
|
-
function requireExpressions(fieldPath, filter, type) {
|
|
1096
|
-
for (const operator of PATTERN_EXPRESSION_OPERATORS) {
|
|
1097
|
-
const pattern = filter[operator];
|
|
1098
|
-
if (pattern === void 0) continue;
|
|
1099
|
-
if (typeof pattern !== "string")
|
|
1100
|
-
invalid(`"${operator}" on field "${fieldPath}" must be a string`, fieldPath, operator);
|
|
1101
|
-
requirePatternField(fieldPath, operator, type);
|
|
1102
|
-
requireTextLength(fieldPath, operator, pattern);
|
|
1103
|
-
requirePatternSearch(fieldPath).checkExpression(
|
|
1104
|
-
operator,
|
|
1105
|
-
pattern,
|
|
1106
|
-
filter.caseFold === true,
|
|
1107
|
-
fieldPath,
|
|
1108
|
-
PATTERN_HOST
|
|
1109
|
-
);
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
1126
|
function requirePatternOperands(fieldPath, filter, type) {
|
|
1113
1127
|
if (filter.contains !== void 0) {
|
|
1114
1128
|
if (typeof filter.contains !== "string") {
|
|
@@ -1122,50 +1136,16 @@ function requirePatternOperands(fieldPath, filter, type) {
|
|
|
1122
1136
|
}
|
|
1123
1137
|
requirePatternField(fieldPath, "caseFold", type);
|
|
1124
1138
|
}
|
|
1125
|
-
|
|
1139
|
+
for (const operator of PATTERN_EXPRESSION_OPERATORS) {
|
|
1140
|
+
const pattern = filter[operator];
|
|
1141
|
+
if (pattern === void 0) continue;
|
|
1142
|
+
if (typeof pattern !== "string")
|
|
1143
|
+
invalid(`"${operator}" on field "${fieldPath}" must be a string`, fieldPath, operator);
|
|
1144
|
+
requirePatternField(fieldPath, operator, type);
|
|
1145
|
+
}
|
|
1126
1146
|
if (filter.tolerance !== void 0) requirePatternField(fieldPath, "tolerance", type);
|
|
1127
1147
|
if (parsedTypeOf(type)?.pattern !== true) return;
|
|
1128
|
-
|
|
1129
|
-
for (const operator of PATTERN_TEST_OPERATORS) {
|
|
1130
|
-
const operand = filter[operator];
|
|
1131
|
-
if (typeof operand === "string") requirePatternText(fieldPath, operator, operand, caseFold);
|
|
1132
|
-
if (!Array.isArray(operand)) continue;
|
|
1133
|
-
for (const text of operand) {
|
|
1134
|
-
if (typeof text === "string") requirePatternText(fieldPath, operator, text, caseFold);
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
for (const operator of ELEMENT_OPERATORS2) {
|
|
1138
|
-
const operand = filter[operator];
|
|
1139
|
-
if (!Array.isArray(operand)) continue;
|
|
1140
|
-
for (const text of operand) {
|
|
1141
|
-
if (typeof text === "string") requirePatternText(fieldPath, operator, text, false);
|
|
1142
|
-
}
|
|
1143
|
-
}
|
|
1144
|
-
requireTolerance(fieldPath, filter);
|
|
1145
|
-
}
|
|
1146
|
-
function requireTolerance(fieldPath, filter) {
|
|
1147
|
-
const { tolerance, eq } = filter;
|
|
1148
|
-
if (tolerance === void 0) return;
|
|
1149
|
-
if (!isPatternTolerance(tolerance)) {
|
|
1150
|
-
invalid(`"tolerance" on field "${fieldPath}" must be 0, 1, 2, or "auto"`, fieldPath, "tolerance");
|
|
1151
|
-
}
|
|
1152
|
-
if (typeof eq !== "string") {
|
|
1153
|
-
invalid(
|
|
1154
|
-
`"tolerance" applies only to an "eq" test, while the filter on field "${fieldPath}" sets no "eq" with text`,
|
|
1155
|
-
fieldPath,
|
|
1156
|
-
"tolerance"
|
|
1157
|
-
);
|
|
1158
|
-
}
|
|
1159
|
-
if (tolerance === 0 || tolerance === "auto") return;
|
|
1160
|
-
const text = foldTypoText(eq, PATTERN_HOST);
|
|
1161
|
-
const requiredRuns = typoRunsNeeded(tolerance, text.longestFold);
|
|
1162
|
-
const distinctRuns = distinctTypoRunCount(text, requiredRuns);
|
|
1163
|
-
if (distinctRuns >= requiredRuns) return;
|
|
1164
|
-
throw new NarsilError(
|
|
1165
|
-
ErrorCodes.SEARCH_INVALID_FILTER,
|
|
1166
|
-
`A tolerance of ${tolerance} on "eq" of pattern field "${fieldPath}" needs ${requiredRuns} distinct runs of three code points in the case fold of the text, while the text holds ${distinctRuns}. Lengthen the text, lower the tolerance, or set it to "auto"`,
|
|
1167
|
-
{ fieldPath, operator: "tolerance", requiredRuns, distinctRuns }
|
|
1168
|
-
);
|
|
1148
|
+
requirePatternSearch(fieldPath).checkOperands(fieldPath, filter, PATTERN_HOST);
|
|
1169
1149
|
}
|
|
1170
1150
|
function requireWellFormedOperand(fieldPath, operator, text) {
|
|
1171
1151
|
if (typeof text !== "string" || !holdsUnpairedSurrogate(text)) return;
|
|
@@ -1751,18 +1731,6 @@ function addCompletions(groups, partition, lastToken, typedPrefix) {
|
|
|
1751
1731
|
group.members.push({ token: completion, factor, partialFactor: factor });
|
|
1752
1732
|
}
|
|
1753
1733
|
}
|
|
1754
|
-
function addPartialWords(group, added) {
|
|
1755
|
-
const membersByToken = /* @__PURE__ */ new Map();
|
|
1756
|
-
for (const member of group.members) membersByToken.set(member.token, member);
|
|
1757
|
-
for (const word of added) {
|
|
1758
|
-
const member = membersByToken.get(word.token);
|
|
1759
|
-
if (member === void 0) {
|
|
1760
|
-
group.members.push({ token: word.token, factor: 0, partialFactor: word.factor });
|
|
1761
|
-
} else if (word.factor > member.partialFactor) {
|
|
1762
|
-
member.partialFactor = word.factor;
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
1734
|
function partialWordAnalysisOf(fields, language, analysis) {
|
|
1767
1735
|
return {
|
|
1768
1736
|
fields,
|
|
@@ -1781,29 +1749,6 @@ function searchesAPartialField(params, partialFields) {
|
|
|
1781
1749
|
}
|
|
1782
1750
|
return false;
|
|
1783
1751
|
}
|
|
1784
|
-
function partialWordRequests(params, queryTokens, written, prefixToken) {
|
|
1785
|
-
const eligible = [];
|
|
1786
|
-
for (const queryToken of queryTokens) {
|
|
1787
|
-
const word = written.get(queryToken.position);
|
|
1788
|
-
if (word === void 0 || codePointCount(word) < PARTIAL_WORD_MIN_CODE_POINTS) continue;
|
|
1789
|
-
eligible.push({ token: queryToken.token, written: word });
|
|
1790
|
-
if (eligible.length === PARTIAL_WORDS_ADDED_PER_QUERY) break;
|
|
1791
|
-
}
|
|
1792
|
-
const count = eligible.length;
|
|
1793
|
-
if (count === 0) return [];
|
|
1794
|
-
const evenShare = Math.floor(PARTIAL_WORDS_ADDED_PER_QUERY / count);
|
|
1795
|
-
const remainder = PARTIAL_WORDS_ADDED_PER_QUERY % count;
|
|
1796
|
-
return eligible.map((entry, order) => ({
|
|
1797
|
-
token: entry.token,
|
|
1798
|
-
request: {
|
|
1799
|
-
written: entry.written,
|
|
1800
|
-
ownToken: entry.token,
|
|
1801
|
-
share: evenShare + (order < remainder ? 1 : 0),
|
|
1802
|
-
tolerance: entry.token === prefixToken ? 0 : params.tolerance ?? 0,
|
|
1803
|
-
prefixLength: params.prefixLength ?? DEFAULT_FUZZY_PREFIX_LENGTH
|
|
1804
|
-
}
|
|
1805
|
-
}));
|
|
1806
|
-
}
|
|
1807
1752
|
function resolveTermGroups(partition, params, language, schema, queryTokens, lastToken, analysis) {
|
|
1808
1753
|
const term = params.term;
|
|
1809
1754
|
if (term === void 0 || params.exact === true) return {};
|
|
@@ -1816,16 +1761,18 @@ function resolveTermGroups(partition, params, language, schema, queryTokens, las
|
|
|
1816
1761
|
if (usesPrefix) addCompletions(groups, partition, lastToken, written.get(lastToken.position));
|
|
1817
1762
|
const prefixToken = groups.has(lastToken.token) ? lastToken.token : void 0;
|
|
1818
1763
|
if (usesPartialWords) {
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1764
|
+
addPartialWordMembers(
|
|
1765
|
+
{
|
|
1766
|
+
queryTokens,
|
|
1767
|
+
written,
|
|
1768
|
+
prefixToken,
|
|
1769
|
+
tolerance: params.tolerance ?? 0,
|
|
1770
|
+
prefixLength: params.prefixLength,
|
|
1771
|
+
analysis: partialWordAnalysisOf(partialFields, language, analysis)
|
|
1772
|
+
},
|
|
1773
|
+
(partialAnalysis, requests) => partition.expandPartialWords(partialAnalysis, requests),
|
|
1774
|
+
(token, typoMatches) => groupFor(groups, token, typoMatches)
|
|
1823
1775
|
);
|
|
1824
|
-
for (let at = 0; at < requests.length; at++) {
|
|
1825
|
-
if (added[at].length === 0) continue;
|
|
1826
|
-
const token = requests[at].token;
|
|
1827
|
-
addPartialWords(groupFor(groups, token, token !== prefixToken), added[at]);
|
|
1828
|
-
}
|
|
1829
1776
|
}
|
|
1830
1777
|
const termGroups = [...groups.values()];
|
|
1831
1778
|
if (termGroups.length === 0) return {};
|
|
@@ -2320,4 +2267,4 @@ function setNestedValue(obj, path, value) {
|
|
|
2320
2267
|
current[segments[segments.length - 1]] = value;
|
|
2321
2268
|
}
|
|
2322
2269
|
|
|
2323
|
-
export { FIELD_FILTER_OPERATORS, FILTER_EXPRESSION_KEYS, PATTERN_HOST, applyPagination, applyProjection, applySorting, availablePatternSearch, clampRowCount, cloneProjected, collectQueryTermStats, computeFacets, countsWithoutScores, coveringRanges, createPatternWorkMeter, decodePageCursor, encodePageCursor, everyValueFacetConfig, fanOutMatchCount, fanOutQuery, filterTestCount, fnv1a, fnv1aBytes, fnv1aUint32s, fulltextMatches, joinPatternWorkMeter, kWayMerge, locationCode, mergeFacets, mergePartitionStats, normalizeSort, oversampledFacetConfig, oversampledShardSize, partitionsIn, patternIndexOf, polygonBoxes, polygonContainment, projectionKeepsField, pruneStatsToQueryTerms, radiusBoxes, readSortValues, registerPatternSearch, requireMatchingCursor, requirePatternSearch, requirePatternSearchFor, requireSortableFields, requireWithinResultWindow, resolveProjection, sanitizeGlobalStats, setNestedValue, sortModesOf, sortSignatureEntry, sortSignatureOf, undeclaredFieldOnStrictIndex, undeclaredFilterField, validatedFilterOf };
|
|
2270
|
+
export { FIELD_FILTER_OPERATORS, FILTER_EXPRESSION_KEYS, PATTERN_HOST, applyPagination, applyProjection, applySorting, availablePatternSearch, buildPartialWordTableFrom, clampRowCount, cloneProjected, collectQueryTermStats, computeFacets, countPartialSpelling, countsWithoutScores, coveringRanges, createFrozenPartialWords, createGrowingPartialWords, createPatternWorkMeter, decodePageCursor, encodePageCursor, encodePartialSpellingsOf, everyValueFacetConfig, expandPartialWords, fanOutMatchCount, fanOutQuery, filterTestCount, fnv1a, fnv1aBytes, fnv1aUint32s, fulltextMatches, joinPatternWorkMeter, kWayMerge, locationCode, mergeFacets, mergePartitionStats, normalizeSort, oversampledFacetConfig, oversampledShardSize, partialSpellingsOfDocuments, partialWordHighlighter, partialWordsToHighlight, partitionsIn, patternIndexOf, polygonBoxes, polygonContainment, projectionKeepsField, pruneStatsToQueryTerms, radiusBoxes, readSortValues, registerPartialWordSearch, registerPatternSearch, requireMatchingCursor, requirePartialWordSearchFor, requirePatternSearch, requirePatternSearchFor, requireSortableFields, requireWithinResultWindow, resolveProjection, sanitizeGlobalStats, setNestedValue, sortModesOf, sortSignatureEntry, sortSignatureOf, undeclaredFieldOnStrictIndex, undeclaredFilterField, validatedFilterOf };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { nativeSearchCoreIsEnabled, loadNativeCore } from './chunk-B3UOQJD3.mjs';
|
|
2
|
+
import { MAX_FILTER_DEPTH } from './chunk-WQBCBKY3.mjs';
|
|
3
|
+
import { MAX_SORT_FIELDS } from './chunk-KJ7LB3TR.mjs';
|
|
4
|
+
import { NarsilError, ServerErrorCodes, ErrorCodes } from './chunk-TPJU7NDJ.mjs';
|
|
4
5
|
import { mkdtemp, open, rm } from 'fs/promises';
|
|
5
6
|
import { tmpdir } from 'os';
|
|
6
7
|
import path from 'path';
|
|
@@ -150,6 +151,7 @@ var STATUS_BY_CODE = {
|
|
|
150
151
|
QUERY_NODE_TIMEOUT: 503,
|
|
151
152
|
QUERY_NO_ACTIVE_REPLICA: 503,
|
|
152
153
|
CLUSTER_OPERATION_UNSUPPORTED: 501,
|
|
154
|
+
CLUSTER_WRITE_BLOCKED: 429,
|
|
153
155
|
REPLICATION_ENTRY_INVALID: 503,
|
|
154
156
|
REPLICATION_INSYNC_REMOVAL_FAILED: 503,
|
|
155
157
|
REPLICATION_ROLLBACK_FAILED: 503,
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// src/core/ordering/code-points.ts
|
|
2
|
+
function exceedsCodePoints(value, maximum) {
|
|
3
|
+
if (value.length <= maximum) return false;
|
|
4
|
+
let counted = 0;
|
|
5
|
+
let i = 0;
|
|
6
|
+
while (i < value.length) {
|
|
7
|
+
const unit = value.charCodeAt(i);
|
|
8
|
+
if (unit >= 55296 && unit < 56320 && i + 1 < value.length) {
|
|
9
|
+
const low = value.charCodeAt(i + 1);
|
|
10
|
+
if (low >= 56320 && low < 57344) i++;
|
|
11
|
+
}
|
|
12
|
+
i++;
|
|
13
|
+
counted++;
|
|
14
|
+
if (counted > maximum) return true;
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
var SURROGATE_UNIT = /[\ud800-\udfff]/;
|
|
19
|
+
function holdsUnpairedSurrogate(value) {
|
|
20
|
+
if (!SURROGATE_UNIT.test(value)) return false;
|
|
21
|
+
for (let i = 0; i < value.length; i++) {
|
|
22
|
+
const unit = value.charCodeAt(i);
|
|
23
|
+
if (unit < 55296 || unit >= 57344) continue;
|
|
24
|
+
if (unit >= 56320) return true;
|
|
25
|
+
const low = value.charCodeAt(i + 1);
|
|
26
|
+
if (!(low >= 56320 && low < 57344)) return true;
|
|
27
|
+
i++;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
function codePointCount(value) {
|
|
32
|
+
let counted = 0;
|
|
33
|
+
for (let i = 0; i < value.length; i++) {
|
|
34
|
+
const unit = value.charCodeAt(i);
|
|
35
|
+
if (unit >= 55296 && unit < 56320 && i + 1 < value.length) {
|
|
36
|
+
const low = value.charCodeAt(i + 1);
|
|
37
|
+
if (low >= 56320 && low < 57344) i++;
|
|
38
|
+
}
|
|
39
|
+
counted++;
|
|
40
|
+
}
|
|
41
|
+
return counted;
|
|
42
|
+
}
|
|
43
|
+
function adjustUtf16Unit(unit) {
|
|
44
|
+
if (unit < 55296) return unit;
|
|
45
|
+
if (unit < 57344) return unit + 8192;
|
|
46
|
+
return unit - 2048;
|
|
47
|
+
}
|
|
48
|
+
function compareCodePoints(a, b) {
|
|
49
|
+
const shorter = a.length < b.length ? a.length : b.length;
|
|
50
|
+
let i = 0;
|
|
51
|
+
while (i < shorter && a.charCodeAt(i) === b.charCodeAt(i)) i++;
|
|
52
|
+
if (i === shorter) return a.length - b.length;
|
|
53
|
+
return adjustUtf16Unit(a.charCodeAt(i)) - adjustUtf16Unit(b.charCodeAt(i));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { codePointCount, compareCodePoints, exceedsCodePoints, holdsUnpairedSurrogate };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DEFAULT_PAGE_SIZE } from './chunk-KJ7LB3TR.mjs';
|
|
2
|
+
|
|
3
|
+
// src/engine/constants.ts
|
|
4
|
+
var MIN_DOCUMENTS_FOR_SEGMENTS = 64;
|
|
5
|
+
var BATCH_CHUNK_SIZE = 1e3;
|
|
6
|
+
var DEFAULT_LIMIT = DEFAULT_PAGE_SIZE;
|
|
7
|
+
var DEFAULT_OFFSET = 0;
|
|
8
|
+
var INDEX_NAME_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
|
|
9
|
+
var ABSOLUTE_WINDOWS_PATH_PATTERN = /^[a-zA-Z]:[\\/]/;
|
|
10
|
+
var MODULE_URL_SCHEME_PATTERN = /^(file|https?|data|node):/;
|
|
11
|
+
var MAX_INDEX_NAME_LENGTH = 255;
|
|
12
|
+
var MAX_DOC_ID_LENGTH = 512;
|
|
13
|
+
var EXPORT_CHUNK_BYTES = 1048576;
|
|
14
|
+
var MAX_EXPORT_LINE_BYTES = 117443592;
|
|
15
|
+
var MAX_INDEX_CONFIGURATION_BYTES = 16777216;
|
|
16
|
+
var IMPORT_BATCH_DOCUMENTS = 1e3;
|
|
17
|
+
var MAX_IMPORT_REFUSALS_REPORTED = 1e3;
|
|
18
|
+
var MIN_SWEEP_INTERVAL_MS = 100;
|
|
19
|
+
var MAX_SWEEP_INTERVAL_MS = 6e4;
|
|
20
|
+
var HEAP_PRESSURE_WARNING_FRACTION = 0.9;
|
|
21
|
+
var HEAP_PRESSURE_REARM_FRACTION = 0.8;
|
|
22
|
+
var STATISTICS_BROADCAST_INTERVAL_MS = 5e3;
|
|
23
|
+
var FOREIGN_STATS_TTL_MS = 6e4;
|
|
24
|
+
var DEFAULT_SUGGEST_LIMIT = 10;
|
|
25
|
+
var MAX_SUGGEST_LIMIT = 100;
|
|
26
|
+
var SUGGEST_OVERSAMPLE_FACTOR = 1.5;
|
|
27
|
+
var SUGGEST_OVERSAMPLE_PADDING = 10;
|
|
28
|
+
var MAX_SUGGEST_SCATTER_LIMIT = Math.ceil(MAX_SUGGEST_LIMIT * SUGGEST_OVERSAMPLE_FACTOR) + SUGGEST_OVERSAMPLE_PADDING;
|
|
29
|
+
|
|
30
|
+
export { ABSOLUTE_WINDOWS_PATH_PATTERN, BATCH_CHUNK_SIZE, DEFAULT_LIMIT, DEFAULT_OFFSET, 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_DOC_ID_LENGTH, MAX_EXPORT_LINE_BYTES, MAX_IMPORT_REFUSALS_REPORTED, MAX_INDEX_CONFIGURATION_BYTES, MAX_INDEX_NAME_LENGTH, MAX_SUGGEST_LIMIT, MAX_SUGGEST_SCATTER_LIMIT, MAX_SWEEP_INTERVAL_MS, MIN_DOCUMENTS_FOR_SEGMENTS, MIN_SWEEP_INTERVAL_MS, MODULE_URL_SCHEME_PATTERN, 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-
|
|
3
|
-
import { e as TaskRecord, M as MemoryStatsResponse, b as ImportResult, H as HttpIndexConfig, c as TaskListQuery, T as TaskListPage } from './tasks-
|
|
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-BPKNx9Tl.js';
|
|
3
|
+
import { e as TaskRecord, M as MemoryStatsResponse, b as ImportResult, H as HttpIndexConfig, c as TaskListQuery, T as TaskListPage } from './tasks-DGyz586z.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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-BPKNx9Tl.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-CAdkp2P-.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-DGyz586z.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-CKUtkLz3.js';
|
|
5
5
|
import './schema-DgyDijhf.js';
|
|
6
6
|
import './adapters-79OIa4xm.js';
|
|
7
|
-
import './config-
|
|
8
|
-
import './config-
|
|
9
|
-
import './
|
|
7
|
+
import './config-BuIkeM5C.js';
|
|
8
|
+
import './config-CSDEPraV.js';
|
|
9
|
+
import './index-DzONZUKE.js';
|
|
10
10
|
import './types-Cb9kiY5P.js';
|
package/dist/client.mjs
CHANGED
|
@@ -47,6 +47,7 @@ var ErrorCodes = {
|
|
|
47
47
|
QUERY_NODE_TIMEOUT: "QUERY_NODE_TIMEOUT",
|
|
48
48
|
QUERY_NO_ACTIVE_REPLICA: "QUERY_NO_ACTIVE_REPLICA",
|
|
49
49
|
CLUSTER_OPERATION_UNSUPPORTED: "CLUSTER_OPERATION_UNSUPPORTED",
|
|
50
|
+
CLUSTER_WRITE_BLOCKED: "CLUSTER_WRITE_BLOCKED",
|
|
50
51
|
ALLOCATION_NO_DATA_NODES: "ALLOCATION_NO_DATA_NODES",
|
|
51
52
|
ALLOCATION_INVALID_CONFIG: "ALLOCATION_INVALID_CONFIG",
|
|
52
53
|
ALLOCATION_FAILED: "ALLOCATION_FAILED",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NarsilConfig } from './config-
|
|
2
|
-
import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './
|
|
1
|
+
import { N as NarsilConfig } from './config-CSDEPraV.js';
|
|
2
|
+
import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './index-DzONZUKE.js';
|
|
3
3
|
import { N as NodeTransport } from './types-Cb9kiY5P.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -56,9 +56,45 @@ interface ClusterNodeConfig {
|
|
|
56
56
|
query?: ClusterQueryConfig;
|
|
57
57
|
/** These settings govern how this node stands for controller election, and anything you leave out keeps its default. */
|
|
58
58
|
controller?: ClusterControllerConfig;
|
|
59
|
+
/** These settings govern when this node's memory blocks writes across the cluster, and anything you leave out keeps its default. */
|
|
60
|
+
memory?: ClusterMemoryConfig;
|
|
59
61
|
/** This receives the failures the node reports while running on its own, away from any call you made. */
|
|
60
62
|
onError?: (error: Error) => void;
|
|
61
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* When this node counts as full, which is what makes the cluster refuse inserts and updates to every index with a
|
|
66
|
+
* copy on the node.
|
|
67
|
+
*
|
|
68
|
+
* The node measures its process memory against the container's limit, or the host's memory where no container sets
|
|
69
|
+
* one, and its main thread's heap against the heap limit, once a second. It counts as full once either figure passes
|
|
70
|
+
* `blockWritesAbove` of its limit, and as clear again once both fall below `resumeWritesBelow`, so that a node hovering
|
|
71
|
+
* at the threshold does not switch writes on and off. Removes and searches go through while the node is full, which is
|
|
72
|
+
* how an operator frees memory.
|
|
73
|
+
*
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
interface ClusterMemoryConfig {
|
|
77
|
+
/**
|
|
78
|
+
* The node counts as full once either memory figure passes this fraction of its limit. It must lie above
|
|
79
|
+
* `resumeWritesBelow` and at most 1, and it is 0.9 where you name none.
|
|
80
|
+
*/
|
|
81
|
+
blockWritesAbove?: number;
|
|
82
|
+
/**
|
|
83
|
+
* A full node counts as clear again once both memory figures fall below this fraction of their limits. It must lie
|
|
84
|
+
* above 0 and below `blockWritesAbove`, and it is 0.8 where you name none.
|
|
85
|
+
*/
|
|
86
|
+
resumeWritesBelow?: number;
|
|
87
|
+
/**
|
|
88
|
+
* The node holds at most this fraction of its heap limit in the documents of inserts and updates that it has
|
|
89
|
+
* accepted and not yet finished, counting both the writes that clients send it and the writes that other nodes
|
|
90
|
+
* forward to it as primary. It refuses a write whose documents would carry that total past the limit with
|
|
91
|
+
* `CLUSTER_WRITE_BLOCKED`, and the error's details include the reason `write_bytes_in_flight`. It never refuses a
|
|
92
|
+
* replicated entry or a remove. The fraction must lie above 0 and at most 1, and it is 0.02 where you name none,
|
|
93
|
+
* which is low because indexing a document can take many times the size of its text in heap. A value of 1 allows
|
|
94
|
+
* writes in flight up to the whole heap limit.
|
|
95
|
+
*/
|
|
96
|
+
inFlightWriteFraction?: number;
|
|
97
|
+
}
|
|
62
98
|
/**
|
|
63
99
|
* How long this node's turn as controller survives a fault, and how often it
|
|
64
100
|
* stands for election again.
|
|
@@ -198,4 +234,4 @@ interface ClusterNodeInfo {
|
|
|
198
234
|
status: string;
|
|
199
235
|
}
|
|
200
236
|
|
|
201
|
-
export type { ClusterNamespace as C, NodeReadiness as N, ReplicationConfig as R, CreateIndexOptions as a, ClusterNodeConfig as b, ClusterControllerConfig as c,
|
|
237
|
+
export type { ClusterNamespace as C, NodeReadiness as N, ReplicationConfig as R, CreateIndexOptions as a, ClusterNodeConfig as b, ClusterControllerConfig as c, ClusterMemoryConfig as d, ClusterNodeInfo as e, ClusterQueryConfig as f };
|