@delali/narsil 0.3.0 → 0.3.1-next.102
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 +9 -8
- package/dist/adapters/filesystem.d.ts +1 -1
- package/dist/adapters/filesystem.mjs +1 -1
- package/dist/adapters/indexeddb.d.ts +1 -1
- package/dist/adapters/indexeddb.mjs +1 -1
- package/dist/adapters/memory.d.ts +1 -1
- package/dist/{adapters-79OIa4xm.d.ts → adapters-BQFQ4PRz.d.ts} +27 -1
- package/dist/browser/chunk-BDOSMEEP.mjs +493 -0
- package/dist/browser/chunk-EJDUFWSO.mjs +602 -0
- package/dist/browser/chunk-HOZW3PKP.mjs +9 -0
- package/dist/browser/chunk-JOVZ6HMT.mjs +4358 -0
- package/dist/browser/chunk-JPTQZWJQ.mjs +10 -0
- package/dist/browser/chunk-KPJMDPHG.mjs +24558 -0
- package/dist/browser/chunk-PGIM3HIM.mjs +2743 -0
- package/dist/browser/chunk-RHG4O77A.mjs +206 -0
- package/dist/browser/chunk-RIJSLY2I.mjs +360 -0
- package/dist/browser/durability-wiring-SRUYT3VV.mjs +3875 -0
- package/dist/browser/module-CBB2ETYP.mjs +3111 -0
- package/dist/browser/release-76MXRPGV.mjs +33 -0
- package/dist/browser/replace-RURXTGVG.mjs +57 -0
- package/dist/browser/restore-queue-EEZQO6RF.mjs +35 -0
- package/dist/browser/runtime-7ZAHCHWR.mjs +557 -0
- package/dist/browser/snapshot-OAAA5UJ7.mjs +1210 -0
- package/dist/browser/write-7D6VIK6O.mjs +208 -0
- package/dist/{capabilities-DSsOGz6F.d.ts → capabilities-ByQRMOx-.d.ts} +68 -7
- package/dist/chunk-2RIRGOUL.mjs +113 -0
- package/dist/chunk-37CD3OKS.mjs +87 -0
- package/dist/chunk-44W3CBNG.mjs +7 -0
- package/dist/chunk-46D6JQIG.mjs +426 -0
- package/dist/{chunk-VMRR3DQU.mjs → chunk-5JNA5SKS.mjs} +546 -35
- package/dist/chunk-747OHOUA.mjs +11 -0
- package/dist/chunk-75XIEF6H.mjs +126 -0
- package/dist/chunk-7X5JST5L.mjs +114 -0
- package/dist/chunk-BOFBLJFZ.mjs +209 -0
- package/dist/{chunk-USKFU7J5.mjs → chunk-BWJVNZPR.mjs} +8 -1
- package/dist/chunk-C7SLA6CM.mjs +19 -0
- package/dist/{chunk-POWOTUKJ.mjs → chunk-CQUMNIIG.mjs} +3 -6
- package/dist/chunk-CVXLLEQ3.mjs +1011 -0
- package/dist/chunk-DJHHF2L5.mjs +17 -0
- package/dist/chunk-E74YLAIG.mjs +24 -0
- package/dist/{chunk-UXNWQZST.mjs → chunk-EMRMGYRE.mjs} +236 -18
- package/dist/chunk-EWZLIYHV.mjs +57 -0
- package/dist/chunk-GBEEG5AN.mjs +35 -0
- package/dist/chunk-GES7U2PM.mjs +68 -0
- package/dist/chunk-HJSN7UYG.mjs +10 -0
- package/dist/chunk-HLPRHOSO.mjs +17 -0
- package/dist/chunk-HMFNFVP7.mjs +14 -0
- package/dist/chunk-J5QP52HA.mjs +1751 -0
- package/dist/{chunk-YNVIUGF5.mjs → chunk-JZVARCRZ.mjs} +3 -28
- package/dist/chunk-KOKM4PQN.mjs +52 -0
- package/dist/{chunk-B2TFROFX.mjs → chunk-KWTW6VTG.mjs} +465 -250
- package/dist/chunk-KZ3NX2P7.mjs +21 -0
- package/dist/chunk-L5ORED7V.mjs +25 -0
- package/dist/{chunk-THYRHHO2.mjs → chunk-LGAMKHA2.mjs} +2009 -2351
- package/dist/chunk-LKOB5COA.mjs +117 -0
- package/dist/chunk-LPQOEU5M.mjs +96 -0
- package/dist/{chunk-3LHGNRYE.mjs → chunk-LXWDQLTW.mjs} +7 -2
- package/dist/{chunk-L6TNPLAR.mjs → chunk-OEYI3KRB.mjs} +270 -108
- package/dist/chunk-OM362BRO.mjs +948 -0
- package/dist/chunk-OZDFA4WC.mjs +67 -0
- package/dist/chunk-P36MUFEJ.mjs +10 -0
- package/dist/chunk-PC2G76VW.mjs +2540 -0
- package/dist/{chunk-GCM3JFVA.mjs → chunk-PNEYIHA4.mjs} +11 -2
- package/dist/chunk-PNFKUCG3.mjs +1130 -0
- package/dist/chunk-Q6XWVUZX.mjs +44 -0
- package/dist/chunk-R27EMH5M.mjs +617 -0
- package/dist/{chunk-YMZCMH5M.mjs → chunk-R6A773WK.mjs} +19 -24
- package/dist/chunk-RF7PLG43.mjs +106 -0
- package/dist/chunk-RFBLQLLZ.mjs +16 -0
- package/dist/{chunk-Y3L5MDRV.mjs → chunk-RFVUDM5E.mjs} +17 -2
- package/dist/chunk-S7FL6UAH.mjs +521 -0
- package/dist/chunk-S7GNDRPS.mjs +651 -0
- package/dist/chunk-SP3NM3ZG.mjs +3537 -0
- package/dist/chunk-U476IXKQ.mjs +10 -0
- package/dist/chunk-UA3AUGNV.mjs +462 -0
- package/dist/chunk-UTG5YNXV.mjs +507 -0
- package/dist/chunk-VI4R6W25.mjs +8484 -0
- package/dist/chunk-WQBCBKY3.mjs +8 -0
- package/dist/{chunk-24RXHMEL.mjs → chunk-WVCOCKBU.mjs} +3794 -7570
- package/dist/chunk-X5CV2E2B.mjs +1 -0
- package/dist/chunk-XADZPPZI.mjs +614 -0
- package/dist/chunk-YEEQHT4V.mjs +212 -0
- package/dist/chunk-YTJCGKM4.mjs +56 -0
- package/dist/chunk-YYQIODMF.mjs +275 -0
- package/dist/chunk-ZI34TVOA.mjs +144 -0
- package/dist/{chunk-OOSIDHA3.mjs → chunk-ZKWYWW4Y.mjs} +1 -1
- package/dist/chunk-ZM7KU4YW.mjs +35 -0
- package/dist/{client-BQK6Tf6A.d.ts → client-BOStAkc5.d.ts} +160 -37
- package/dist/client.d.ts +11 -10
- package/dist/client.mjs +209 -45
- package/dist/{config-DmXULPa-.d.ts → config-Cjvzbs_j.d.ts} +51 -3
- package/dist/config-H6SGzbPH.d.ts +421 -0
- package/dist/direct-executor-ZD64PPEZ.mjs +24 -0
- package/dist/distribution/coordinator/etcd.d.ts +79 -18
- package/dist/distribution/coordinator/etcd.mjs +553 -109
- package/dist/distribution/coordinator/in-memory.d.ts +4 -3
- package/dist/distribution/coordinator/in-memory.mjs +22 -3
- package/dist/distribution/transport/grpc.d.ts +2 -2
- package/dist/distribution/transport/grpc.mjs +79 -14
- package/dist/distribution/transport/in-memory.d.ts +2 -2
- package/dist/distribution/transport/in-memory.mjs +12 -7
- package/dist/distribution/transport/tcp.d.ts +2 -2
- package/dist/distribution/transport/tcp.mjs +50 -28
- package/dist/distribution.d.ts +144 -23
- package/dist/distribution.mjs +14479 -8173
- package/dist/durability-wiring-FEUBR5BT.mjs +3330 -0
- package/dist/embeddings/openai.d.ts +2 -2
- package/dist/embeddings/openai.mjs +22 -133
- package/dist/{engine-CIOyFozK.d.ts → engine-rC0vjjY-.d.ts} +165 -141
- package/dist/{memory-yFaVn2xZ.d.ts → events-DqOIg5xa.d.ts} +645 -136
- package/dist/{types-DAK7mnUZ.d.ts → index-Bkdt8nDw.d.ts} +182 -45
- package/dist/index.browser.mjs +4 -32180
- package/dist/index.d.ts +91 -20
- package/dist/index.mjs +33 -16
- package/dist/invalidation/broadcast-channel.d.ts +1 -1
- package/dist/invalidation/filesystem.d.ts +1 -1
- package/dist/invalidation/filesystem.mjs +2 -1
- package/dist/invalidation/noop.d.ts +1 -1
- package/dist/module-3S65MVCM.mjs +2151 -0
- package/dist/partial-words-DTIHO8G4.d.ts +19 -0
- package/dist/partial-words.d.ts +22 -0
- package/dist/partial-words.mjs +17 -0
- package/dist/pattern-Cledccbl.d.ts +18 -0
- package/dist/pattern.d.ts +22 -0
- package/dist/pattern.mjs +12 -0
- package/dist/persistence/durability/checkpoint-worker.d.ts +119 -72
- package/dist/persistence/durability/checkpoint-worker.mjs +51 -18
- package/dist/react.d.ts +279 -183
- package/dist/react.mjs +201 -48
- package/dist/release-BH3DKW3T.mjs +33 -0
- package/dist/replace-CEO5KJJ3.mjs +57 -0
- package/dist/rerank-K7C4WZFG.mjs +60 -0
- package/dist/rerankers/http.d.ts +50 -0
- package/dist/rerankers/http.mjs +104 -0
- package/dist/restore-queue-KQHA7ZV2.mjs +35 -0
- package/dist/runtime-6Y4ZYXOG.mjs +177 -0
- package/dist/{schema-d5Afu03A.d.ts → schema-4W_7tk1f.d.ts} +81 -11
- package/dist/server.d.ts +13 -12
- package/dist/server.mjs +611 -80
- package/dist/snapshot-QGZPODM5.mjs +799 -0
- package/dist/synonyms-CpOAHPa-.d.ts +52 -0
- package/dist/synonyms.d.ts +22 -0
- package/dist/synonyms.mjs +12 -0
- package/dist/{tasks-CH2Dod8w.d.ts → tasks-CwPTz-tP.d.ts} +10 -3
- package/dist/thread-N3IUGUS3.mjs +697 -0
- package/dist/{types-BQDlIvfS.d.ts → types-2qoitTXg.d.ts} +1 -1
- package/dist/{types-D5OwhtsQ.d.ts → types-Cz5okLml.d.ts} +2 -2
- package/dist/vector/search-worker.d.ts +46 -4
- package/dist/vector/search-worker.mjs +21 -11
- package/dist/workers/entry.mjs +9 -6
- package/dist/write-U5RI7MAX.mjs +241 -0
- package/package.json +55 -9
- package/dist/chunk-3L4U6EJQ.mjs +0 -49
- package/dist/chunk-IFBKLBGB.mjs +0 -7
- package/dist/chunk-ORBLD3EL.mjs +0 -6
- package/dist/chunk-U7KYW4BA.mjs +0 -135
- package/dist/chunk-ZJ4CSAB2.mjs +0 -13
- package/dist/chunk-ZNZBXMP5.mjs +0 -2117
- package/dist/chunk-ZZT3EAUC.mjs +0 -11168
- package/dist/config-BhldZgaK.d.ts +0 -194
- package/dist/direct-executor-ALAVE7FC.mjs +0 -12
- package/dist/serialization/crc32-worker.d.ts +0 -20
- package/dist/serialization/crc32-worker.mjs +0 -62
- package/dist/simd-DW5AtJ6B.d.ts +0 -41
- package/dist/thread-DYHEQRVY.mjs +0 -402
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A two-way rule makes every word in `words` a synonym of every other word in
|
|
3
|
+
* the rule, so a search for any one of them also matches documents that hold
|
|
4
|
+
* the others.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
interface TwoWaySynonymRule {
|
|
9
|
+
/** The rule holds from 2 to 100 words, and each word must analyse to exactly one token. */
|
|
10
|
+
words: string[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A one-way rule adds each word in `synonyms` to a search for `word`, while a
|
|
14
|
+
* search for one of those synonyms gains nothing from the rule.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
interface OneWaySynonymRule {
|
|
19
|
+
/** A search for this word also matches the words in `synonyms`. */
|
|
20
|
+
word: string;
|
|
21
|
+
/** The rule holds from 1 to 99 synonyms, and each one must analyse to exactly one token. */
|
|
22
|
+
synonyms: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* One rule of a synonym set, which {@link IndexConfig.synonyms} and
|
|
26
|
+
* {@link SynonymOperations.updateSynonyms} take as a list.
|
|
27
|
+
*
|
|
28
|
+
* The engine analyses every word with the language, the tokeniser, and the
|
|
29
|
+
* stop words of the index, so a rule that says `jackets` also matches
|
|
30
|
+
* `jacket` wherever the index stems the two alike. A set can hold up to
|
|
31
|
+
* 100,000 rules, 500,000 words, and 4,194,304 bytes of words in UTF-8.
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
type SynonymRule = TwoWaySynonymRule | OneWaySynonymRule;
|
|
36
|
+
/**
|
|
37
|
+
* An app passes an object of this type to {@link registerSynonyms} to give the
|
|
38
|
+
* engine its synonym code, which a search uses to expand each query word with
|
|
39
|
+
* the synonyms that the index's set holds for it.
|
|
40
|
+
*
|
|
41
|
+
* A Node process loads this code by itself. A browser bundle contains it only
|
|
42
|
+
* when the app imports `synonyms` from `@delali/narsil/synonyms`, so a bundler
|
|
43
|
+
* can leave it out of an app whose indexes hold no synonym set.
|
|
44
|
+
*
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
interface SynonymSearch {
|
|
48
|
+
/** The engine checks that this name is `'synonyms'` when an app registers the object. */
|
|
49
|
+
readonly name: 'synonyms';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type { OneWaySynonymRule as O, SynonymSearch as S, TwoWaySynonymRule as T, SynonymRule as a };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { S as SynonymSearch } from './synonyms-CpOAHPa-.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This object contains the synonym code. A browser app has to pass it to
|
|
5
|
+
* {@link registerSynonyms} before the app creates or loads an index that
|
|
6
|
+
* holds a synonym set.
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { registerSynonyms } from '@delali/narsil'
|
|
10
|
+
* import { synonyms } from '@delali/narsil/synonyms'
|
|
11
|
+
*
|
|
12
|
+
* registerSynonyms(synonyms)
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* A Node process loads that code by itself, so only a browser app has to make
|
|
16
|
+
* this call.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
declare const synonyms: SynonymSearch;
|
|
21
|
+
|
|
22
|
+
export { SynonymSearch, synonyms };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { synonymSearchModule } from './chunk-46D6JQIG.mjs';
|
|
2
|
+
import './chunk-X5CV2E2B.mjs';
|
|
3
|
+
import './chunk-7X5JST5L.mjs';
|
|
4
|
+
import './chunk-UTG5YNXV.mjs';
|
|
5
|
+
import './chunk-R6A773WK.mjs';
|
|
6
|
+
import './chunk-YTJCGKM4.mjs';
|
|
7
|
+
import './chunk-BWJVNZPR.mjs';
|
|
8
|
+
|
|
9
|
+
// src/synonyms/index.ts
|
|
10
|
+
var synonyms = synonymSearchModule;
|
|
11
|
+
|
|
12
|
+
export { synonyms };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { M as MemoryStats } from './
|
|
1
|
+
import { M as MemoryStats } from './events-DqOIg5xa.js';
|
|
2
|
+
import { a as SynonymRule } from './synonyms-CpOAHPa-.js';
|
|
2
3
|
|
|
3
4
|
/** Declarative index configuration accepted over HTTP. Function-valued engine
|
|
4
5
|
* options (custom tokenizer, stopWords-as-function, group reducer, embedding
|
|
@@ -68,6 +69,10 @@ interface HttpIndexConfig {
|
|
|
68
69
|
embedding?: CreateIndexEmbedding;
|
|
69
70
|
/** The server rejects a document that omits any of these fields. */
|
|
70
71
|
required?: string[];
|
|
72
|
+
/** The server returns a `DOC_VALIDATION_FAILED` error for a document whose value in a `verbatim` field, or in a field whose type includes `pattern`, is longer than this many code points. Set a whole number from 1 to 65,536, or leave this unset for a limit of 8,192. */
|
|
73
|
+
patternValueLimit?: number;
|
|
74
|
+
/** A search for a word in one of these rules also matches its synonyms, and the server refuses a set beyond 100,000 rules, 500,000 words, or 4,194,304 bytes of words in UTF-8 with `CONFIG_INVALID`. */
|
|
75
|
+
synonyms?: SynonymRule[];
|
|
71
76
|
}
|
|
72
77
|
/**
|
|
73
78
|
* One record an import refused, naming the line it came from and why the
|
|
@@ -84,6 +89,8 @@ interface ImportError {
|
|
|
84
89
|
code: string;
|
|
85
90
|
/** This describes the failure, for a log or a person. */
|
|
86
91
|
message: string;
|
|
92
|
+
/** The server puts the facts that explain the failure here where it has any, such as the `reason` for a line that it refused to parse because parsing the line could fill the heap. */
|
|
93
|
+
details?: Record<string, unknown>;
|
|
87
94
|
}
|
|
88
95
|
/**
|
|
89
96
|
* What one import produced.
|
|
@@ -140,7 +147,7 @@ interface MemoryStatsResponse extends MemoryStats {
|
|
|
140
147
|
*
|
|
141
148
|
* @public
|
|
142
149
|
*/
|
|
143
|
-
type TaskType = 'optimizeVectors' | 'rebalance' | 'restore' | 'import' | 'rebuildAnalysis';
|
|
150
|
+
type TaskType = 'optimizeVectors' | 'rebalance' | 'restore' | 'import' | 'importExport' | 'rebuildAnalysis';
|
|
144
151
|
/**
|
|
145
152
|
* Where a long-running operation stands.
|
|
146
153
|
*
|
|
@@ -205,7 +212,7 @@ interface TaskRecord {
|
|
|
205
212
|
cancelRequestedAt?: number;
|
|
206
213
|
/** How far the work has gone, which an import reports and other task types omit. */
|
|
207
214
|
progress?: TaskProgress;
|
|
208
|
-
/** What the work produced, which an import reports once it finishes. */
|
|
215
|
+
/** What the work produced, which an `import` or `importExport` task reports once it finishes. */
|
|
209
216
|
result?: ImportResult;
|
|
210
217
|
/** This says why the task failed, and a failed task alone carries it. */
|
|
211
218
|
error?: {
|