@delali/narsil 0.3.0 → 0.3.1-next.101
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-DiGlB6Sr.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-DffQlmRq.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
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { N as NarsilConfig } from './config-DmXULPa-.js';
|
|
2
|
-
import { A as AllocationTable, N as NodeRole, a as NodeRegistration, C as ClusterCoordinator, b as NodeCapacity } from './types-DAK7mnUZ.js';
|
|
3
|
-
import { N as NodeTransport } from './types-D5OwhtsQ.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* How much replication history a primary keeps, and how many replicas have to
|
|
7
|
-
* confirm a write before it is acknowledged.
|
|
8
|
-
*
|
|
9
|
-
* A replica that falls further behind than the retained log recovers from a
|
|
10
|
-
* whole snapshot instead of replaying entries, so a larger retention trades
|
|
11
|
-
* memory for cheaper recovery.
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
interface ReplicationConfig {
|
|
16
|
-
/** A primary keeps this many bytes of replication log before it drops the oldest entries. */
|
|
17
|
-
logRetentionBytes: number;
|
|
18
|
-
/** This many replicas must acknowledge a write before the primary reports it as done. */
|
|
19
|
-
waitForActiveReplicas: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Everything {@link createClusterNode} needs to join a node to a cluster.
|
|
24
|
-
*
|
|
25
|
-
* The coordinator and the transport are the two pieces you choose: the
|
|
26
|
-
* coordinator holds the cluster's shared state, and the transport carries
|
|
27
|
-
* messages between nodes.
|
|
28
|
-
*
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
interface ClusterNodeConfig {
|
|
32
|
-
/** This node reads and writes the cluster's shared state here. Every node in a cluster must point at the same one. */
|
|
33
|
-
coordinator: ClusterCoordinator;
|
|
34
|
-
/** This node reaches its peers through this transport. */
|
|
35
|
-
transport: NodeTransport;
|
|
36
|
-
/** Peers reach this node at this address, as the transport writes it. */
|
|
37
|
-
address: string;
|
|
38
|
-
/** This node holds these roles in the cluster, and holds data alone by default. */
|
|
39
|
-
roles?: NodeRole[];
|
|
40
|
-
/** This identifies the node across the cluster. The package generates an id by default, which a restart changes. */
|
|
41
|
-
nodeId?: string;
|
|
42
|
-
/** This node offers this much capacity, which the allocator weighs. It offers {@link DEFAULT_CAPACITY} by default. */
|
|
43
|
-
capacity?: NodeCapacity;
|
|
44
|
-
/** These settings configure the engine this node runs locally, such as its persistence and durability. */
|
|
45
|
-
engine?: NarsilConfig;
|
|
46
|
-
/** These replication settings override the engine's own, and anything you leave out keeps its value. */
|
|
47
|
-
replication?: Partial<ReplicationConfig>;
|
|
48
|
-
/** These settings govern how this node gathers each search from the cluster, and anything you leave out keeps its default. */
|
|
49
|
-
query?: ClusterQueryConfig;
|
|
50
|
-
/** These settings govern how this node stands for controller election, and anything you leave out keeps its default. */
|
|
51
|
-
controller?: ClusterControllerConfig;
|
|
52
|
-
/** This receives the failures the node reports while running on its own, away from any call you made. */
|
|
53
|
-
onError?: (error: Error) => void;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* How long this node's turn as controller survives a fault, and how often it
|
|
57
|
-
* stands for election again.
|
|
58
|
-
*
|
|
59
|
-
* A cluster fails over no faster than the lease it grants the controller, so a
|
|
60
|
-
* demonstration lowers both figures and a busy cluster leaves them alone. Every
|
|
61
|
-
* controller-capable node in a cluster should carry the same pair.
|
|
62
|
-
*
|
|
63
|
-
* @public
|
|
64
|
-
*/
|
|
65
|
-
interface ClusterControllerConfig {
|
|
66
|
-
/**
|
|
67
|
-
* The controller lease survives this many milliseconds without a renewal, so
|
|
68
|
-
* a controller that loses the coordinator keeps its claim for that long. The
|
|
69
|
-
* active controller renews the lease every third of this, and a standby takes
|
|
70
|
-
* the lease over up to {@link ClusterControllerConfig.standbyRetryMs} after it
|
|
71
|
-
* expires. It is 15000 milliseconds where you name none.
|
|
72
|
-
*/
|
|
73
|
-
leaseTtlMs?: number;
|
|
74
|
-
/**
|
|
75
|
-
* A node that holds no lease stands for election again after this many
|
|
76
|
-
* milliseconds, whether the lease was taken or the coordinator refused the
|
|
77
|
-
* attempt. It is 5000 milliseconds where you name none.
|
|
78
|
-
*/
|
|
79
|
-
standbyRetryMs?: number;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* How this node answers a search when one of the nodes it asked runs slowly or
|
|
83
|
-
* drops out.
|
|
84
|
-
*
|
|
85
|
-
* The defaults let a search answer from the nodes that did reply, so set
|
|
86
|
-
* `allowPartialResults` to false where a caller must never act on an
|
|
87
|
-
* incomplete count. Every search reports what it read in
|
|
88
|
-
* {@link QueryResult.coverage} whichever way you set these.
|
|
89
|
-
*
|
|
90
|
-
* @public
|
|
91
|
-
*/
|
|
92
|
-
interface ClusterQueryConfig {
|
|
93
|
-
/**
|
|
94
|
-
* Set this true and a search returns the hits the reachable nodes gave,
|
|
95
|
-
* counting the rest in {@link QueryResult.coverage}, which is what a node
|
|
96
|
-
* does by default. Set it false and one partition that times out, errors, or
|
|
97
|
-
* has no active copy fails the whole search with `QUERY_PARTIAL_FAILURE`.
|
|
98
|
-
*/
|
|
99
|
-
allowPartialResults?: boolean;
|
|
100
|
-
/** A search waits this many milliseconds for each node before it counts that node's partitions as timed out, which is 5000 milliseconds where you name none. */
|
|
101
|
-
partitionTimeout?: number;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* How an index is spread across the cluster when a node creates it.
|
|
105
|
-
*
|
|
106
|
-
* @public
|
|
107
|
-
*/
|
|
108
|
-
interface CreateIndexOptions {
|
|
109
|
-
/** The cluster splits the index into this many partitions, and into {@link DEFAULT_PARTITION_COUNT} by default. */
|
|
110
|
-
partitionCount?: number;
|
|
111
|
-
/** The cluster keeps this many copies of each partition, and {@link DEFAULT_REPLICATION_FACTOR} by default. */
|
|
112
|
-
replicationFactor?: number;
|
|
113
|
-
/**
|
|
114
|
-
* The creation returns once every partition is in service or once this many milliseconds have passed, which is
|
|
115
|
-
* 30000 where you name none. It returns either way, so a write sent after the deadline may be refused with
|
|
116
|
-
* `QUERY_ROUTING_FAILED` while the controller is still allocating. Pass 0 to return as soon as the schema is
|
|
117
|
-
* published.
|
|
118
|
-
*/
|
|
119
|
-
waitForServingMs?: number;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Where a node stands between starting and shutting down, which is what a
|
|
123
|
-
* readiness probe reads.
|
|
124
|
-
*
|
|
125
|
-
* A node reports `STARTING` until it holds a registration. It reports
|
|
126
|
-
* `JOINING` while it bootstraps a partition the controller gave it, and
|
|
127
|
-
* `SERVING` once it serves every one of them. It reports `LEAVING` from the
|
|
128
|
-
* moment shutdown begins.
|
|
129
|
-
*
|
|
130
|
-
* @public
|
|
131
|
-
*/
|
|
132
|
-
type NodeReadiness = 'STARTING' | 'JOINING' | 'SERVING' | 'LEAVING';
|
|
133
|
-
/**
|
|
134
|
-
* The cluster-facing side of a node, which is where you look at the cluster
|
|
135
|
-
* rather than at the data.
|
|
136
|
-
*
|
|
137
|
-
* @public
|
|
138
|
-
*/
|
|
139
|
-
interface ClusterNamespace {
|
|
140
|
-
/**
|
|
141
|
-
* Reads how one index is spread across the cluster.
|
|
142
|
-
*
|
|
143
|
-
* @param indexName - The index to describe.
|
|
144
|
-
* @returns Its allocation, or `null` when the index has none yet.
|
|
145
|
-
*/
|
|
146
|
-
getAllocation(indexName: string): Promise<AllocationTable | null>;
|
|
147
|
-
/**
|
|
148
|
-
* Describes this node.
|
|
149
|
-
*
|
|
150
|
-
* @returns Its id, its roles, and where it stands.
|
|
151
|
-
*/
|
|
152
|
-
getNodeInfo(): ClusterNodeInfo;
|
|
153
|
-
/**
|
|
154
|
-
* Reports whether this node is the cluster's active controller, which is the
|
|
155
|
-
* one node making allocation decisions.
|
|
156
|
-
*
|
|
157
|
-
* @returns True while this node holds the controller lease.
|
|
158
|
-
*/
|
|
159
|
-
isControllerActive(): boolean;
|
|
160
|
-
/**
|
|
161
|
-
* Reports whether this node serves work, which is what a readiness probe
|
|
162
|
-
* answers with.
|
|
163
|
-
*
|
|
164
|
-
* @returns The node's readiness as it stands.
|
|
165
|
-
*/
|
|
166
|
-
getReadiness(): NodeReadiness;
|
|
167
|
-
/**
|
|
168
|
-
* Lists the nodes the coordinator holds a registration for.
|
|
169
|
-
*
|
|
170
|
-
* @returns One registration per node, as each node published it.
|
|
171
|
-
*/
|
|
172
|
-
listNodes(): Promise<NodeRegistration[]>;
|
|
173
|
-
/**
|
|
174
|
-
* Names the node holding the controller lease.
|
|
175
|
-
*
|
|
176
|
-
* @returns Its id, or `null` while no node holds the lease.
|
|
177
|
-
*/
|
|
178
|
-
getControllerNodeId(): Promise<string | null>;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* What one node reports about itself.
|
|
182
|
-
*
|
|
183
|
-
* @public
|
|
184
|
-
*/
|
|
185
|
-
interface ClusterNodeInfo {
|
|
186
|
-
/** This identifies the node across the cluster. */
|
|
187
|
-
nodeId: string;
|
|
188
|
-
/** The node holds these roles in the cluster. */
|
|
189
|
-
roles: ReadonlyArray<NodeRole>;
|
|
190
|
-
/** This says where the node stands, from joining through to shut down. */
|
|
191
|
-
status: string;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export type { ClusterNamespace as C, NodeReadiness as N, ReplicationConfig as R, CreateIndexOptions as a, ClusterNodeConfig as b, ClusterControllerConfig as c, ClusterNodeInfo as d, ClusterQueryConfig as e };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { createDirectExecutor } from './chunk-ZZT3EAUC.mjs';
|
|
2
|
-
import './chunk-AV4IJKD2.mjs';
|
|
3
|
-
import './chunk-ZNZBXMP5.mjs';
|
|
4
|
-
import './chunk-L6TNPLAR.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';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
interface ChecksumRequest {
|
|
2
|
-
buffer: ArrayBuffer;
|
|
3
|
-
byteOffset: number;
|
|
4
|
-
byteLength: number;
|
|
5
|
-
}
|
|
6
|
-
interface ChecksumResponse {
|
|
7
|
-
type: 'success';
|
|
8
|
-
checksum: number;
|
|
9
|
-
buffer: ArrayBuffer;
|
|
10
|
-
byteOffset: number;
|
|
11
|
-
byteLength: number;
|
|
12
|
-
}
|
|
13
|
-
interface ChecksumError {
|
|
14
|
-
type: 'error';
|
|
15
|
-
message: string;
|
|
16
|
-
}
|
|
17
|
-
type ChecksumWorkerMessage = ChecksumResponse | ChecksumError;
|
|
18
|
-
declare function handleRequest(raw: unknown): ChecksumResponse;
|
|
19
|
-
|
|
20
|
-
export { type ChecksumError, type ChecksumRequest, type ChecksumResponse, type ChecksumWorkerMessage, handleRequest };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { crc32 } from '../chunk-3L4U6EJQ.mjs';
|
|
2
|
-
import '../chunk-IFBKLBGB.mjs';
|
|
3
|
-
|
|
4
|
-
// src/serialization/crc32-worker.ts
|
|
5
|
-
function handleRequest(raw) {
|
|
6
|
-
const request = raw;
|
|
7
|
-
if (!(request.buffer instanceof ArrayBuffer)) {
|
|
8
|
-
throw new Error("Checksum request is missing a transferable buffer");
|
|
9
|
-
}
|
|
10
|
-
const { byteOffset, byteLength } = request;
|
|
11
|
-
if (!Number.isInteger(byteOffset) || !Number.isInteger(byteLength) || byteOffset < 0 || byteLength < 0) {
|
|
12
|
-
throw new Error("Checksum request has an invalid range");
|
|
13
|
-
}
|
|
14
|
-
if (byteOffset + byteLength > request.buffer.byteLength) {
|
|
15
|
-
throw new Error("Checksum request range exceeds the buffer bounds");
|
|
16
|
-
}
|
|
17
|
-
const checksum = crc32(new Uint8Array(request.buffer, byteOffset, byteLength));
|
|
18
|
-
return { type: "success", checksum, buffer: request.buffer, byteOffset, byteLength };
|
|
19
|
-
}
|
|
20
|
-
async function setupAsync() {
|
|
21
|
-
let parentPort = null;
|
|
22
|
-
try {
|
|
23
|
-
const workerThreads = await import('worker_threads');
|
|
24
|
-
parentPort = workerThreads.parentPort ?? null;
|
|
25
|
-
} catch {
|
|
26
|
-
parentPort = null;
|
|
27
|
-
}
|
|
28
|
-
if (parentPort) {
|
|
29
|
-
const port = parentPort;
|
|
30
|
-
port.on("message", (raw) => {
|
|
31
|
-
try {
|
|
32
|
-
const result = handleRequest(raw);
|
|
33
|
-
port.postMessage(result, [result.buffer]);
|
|
34
|
-
} catch (err) {
|
|
35
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
36
|
-
port.postMessage({ type: "error", message });
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const globalSelf = typeof self !== "undefined" ? self : void 0;
|
|
42
|
-
if (globalSelf && typeof globalSelf.postMessage === "function") {
|
|
43
|
-
const webSelf = globalSelf;
|
|
44
|
-
webSelf.onmessage = (event) => {
|
|
45
|
-
try {
|
|
46
|
-
const result = handleRequest(event.data);
|
|
47
|
-
webSelf.postMessage(result, [result.buffer]);
|
|
48
|
-
} catch (err) {
|
|
49
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
50
|
-
webSelf.postMessage({ type: "error", message });
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function setupWorker() {
|
|
56
|
-
setupAsync().catch((err) => {
|
|
57
|
-
console.error("Checksum worker setup failed:", err);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
setupWorker();
|
|
61
|
-
|
|
62
|
-
export { handleRequest };
|
package/dist/simd-DW5AtJ6B.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reports whether the runtime loaded the SIMD module that speeds up vector
|
|
3
|
-
* distance work.
|
|
4
|
-
*
|
|
5
|
-
* Vector search works either way, so read this to explain a difference in
|
|
6
|
-
* search latency between two hosts rather than to decide whether to search.
|
|
7
|
-
*
|
|
8
|
-
* @returns True once the SIMD module has loaded.
|
|
9
|
-
*
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
declare function isSimdAvailable(): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* The distance kernels bound to one memory, which read their operands at byte
|
|
15
|
-
* offsets inside that memory so that a caller measures against a vector where
|
|
16
|
-
* it already lies.
|
|
17
|
-
*
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
interface ArenaSimd {
|
|
21
|
-
/** The kernels read every operand out of this memory. */
|
|
22
|
-
memory: WebAssembly.Memory;
|
|
23
|
-
/** Returns the dot product of two float32 vectors at the given byte offsets. */
|
|
24
|
-
dot_product: (ptrA: number, ptrB: number, len: number) => number;
|
|
25
|
-
/** Returns the length of the float32 vector at the given byte offset. */
|
|
26
|
-
magnitude: (ptr: number, len: number) => number;
|
|
27
|
-
/** Returns the squared euclidean distance between two float32 vectors at the given byte offsets. */
|
|
28
|
-
squared_euclidean_distance: (ptrA: number, ptrB: number, len: number) => number;
|
|
29
|
-
/** Returns the integer dot product of two byte code vectors at the given byte offsets. */
|
|
30
|
-
dot_u8: (ptrA: number, ptrB: number, len: number) => number;
|
|
31
|
-
/** Returns the integer squared distance between two byte code vectors at the given byte offsets. */
|
|
32
|
-
sqdist_u8: (ptrA: number, ptrB: number, len: number) => number;
|
|
33
|
-
/** Returns the sum of level products of two 4-bit codes at the given byte offsets, each holding two levels per byte. */
|
|
34
|
-
osq_dot_nibbles_4x4: (ptrA: number, ptrB: number, bytes: number) => number;
|
|
35
|
-
/** Returns the sum of level products of a 1-bit or 2-bit code and a query staged as four bit planes. Each plane spans `planeBytes`, with one bit for each of the code's lowest level bits. */
|
|
36
|
-
osq_dot_bits: (ptrDoc: number, ptrPlanes: number, planeBytes: number, docBits: number) => number;
|
|
37
|
-
/** Returns the sum of level products of two 1-bit codes or two 2-bit codes at the given byte offsets. */
|
|
38
|
-
osq_dot_bits_pair: (ptrA: number, ptrB: number, bytes: number, bits: number) => number;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export { type ArenaSimd as A, isSimdAvailable as i };
|