distillate 0.1.1 → 0.2.0

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.
@@ -1,24 +1,83 @@
1
1
  import { t as BytesLike } from "../bytes-DCuYtUVS.cjs";
2
+ import { t as ParamError } from "../params-DnqJBqLS.cjs";
2
3
  //#region src/bloom/bloom.d.ts
4
+ /** Thrown when an operation requires two filters built with identical parameters. */
3
5
  declare class BloomParamMismatchError extends Error {
6
+ /** Discriminates this error from other `Error`s. */
4
7
  override readonly name = "BloomParamMismatchError";
5
8
  }
9
+ /** Low-level Bloom filter parameters. */
6
10
  interface BloomParams {
11
+ /** Number of bits in the filter. */
7
12
  m: number;
13
+ /** Number of hash probes per key. */
8
14
  k: number;
15
+ /** Hash seed; defaults to `0`. */
9
16
  seed?: number;
10
17
  }
18
+ /**
19
+ * A classic Bloom filter: a space-efficient set with a tunable false-positive
20
+ * rate and zero false negatives.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const filter = BloomFilter.create(100_000, 0.01);
25
+ * filter.add("alice");
26
+ * filter.has("alice"); // true
27
+ * filter.has("bob"); // false (or a ~1% false positive)
28
+ * ```
29
+ */
11
30
  declare class BloomFilter {
12
31
  #private;
32
+ /**
33
+ * Creates a filter sized for `n` expected keys at a target false-positive rate.
34
+ *
35
+ * @param n - Expected number of keys.
36
+ * @param epsilon - Target false-positive rate, e.g. `0.01` for 1%.
37
+ * @returns A new, empty filter.
38
+ */
13
39
  static create(n: number, epsilon: number): BloomFilter;
40
+ /**
41
+ * Restores a filter from its {@link BloomFilter.toBytes} serialization.
42
+ *
43
+ * @param bytes - The serialized filter.
44
+ * @returns The reconstructed filter.
45
+ */
14
46
  static fromBytes(bytes: Uint8Array): BloomFilter;
47
+ /**
48
+ * Constructs a filter from low-level {@link BloomParams}. Prefer
49
+ * {@link BloomFilter.create} unless restoring a specific configuration.
50
+ */
15
51
  constructor({ m, k, seed }: BloomParams);
16
52
  /** Analytic design bits-per-key `m / n`. */
17
53
  get bitsPerKey(): number;
54
+ /**
55
+ * Serializes the filter to a portable little-endian byte layout.
56
+ *
57
+ * @returns The serialized filter, readable by {@link BloomFilter.fromBytes}.
58
+ */
18
59
  toBytes(): Uint8Array;
60
+ /**
61
+ * Returns a new filter containing the union of this filter and `other`.
62
+ *
63
+ * @param other - A filter built with identical parameters.
64
+ * @returns A new filter reporting membership for keys in either input.
65
+ * @throws {@link BloomParamMismatchError} if the parameters differ.
66
+ */
19
67
  union(other: BloomFilter): BloomFilter;
68
+ /**
69
+ * Adds a key to the set.
70
+ *
71
+ * @param key - The key to insert, as a string or bytes.
72
+ */
20
73
  add(key: BytesLike): void;
74
+ /**
75
+ * Tests whether a key is in the set.
76
+ *
77
+ * @param key - The key to test.
78
+ * @returns `true` if present (possibly a false positive); `false` guarantees absence.
79
+ */
21
80
  has(key: BytesLike): boolean;
22
81
  }
23
82
  //#endregion
24
- export { BloomFilter, BloomParamMismatchError, type BloomParams };
83
+ export { BloomFilter, BloomParamMismatchError, type BloomParams, ParamError };
@@ -1,24 +1,83 @@
1
1
  import { t as BytesLike } from "../bytes-DCuYtUVS.js";
2
+ import { t as ParamError } from "../params-DnqJBqLS.js";
2
3
  //#region src/bloom/bloom.d.ts
4
+ /** Thrown when an operation requires two filters built with identical parameters. */
3
5
  declare class BloomParamMismatchError extends Error {
6
+ /** Discriminates this error from other `Error`s. */
4
7
  override readonly name = "BloomParamMismatchError";
5
8
  }
9
+ /** Low-level Bloom filter parameters. */
6
10
  interface BloomParams {
11
+ /** Number of bits in the filter. */
7
12
  m: number;
13
+ /** Number of hash probes per key. */
8
14
  k: number;
15
+ /** Hash seed; defaults to `0`. */
9
16
  seed?: number;
10
17
  }
18
+ /**
19
+ * A classic Bloom filter: a space-efficient set with a tunable false-positive
20
+ * rate and zero false negatives.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const filter = BloomFilter.create(100_000, 0.01);
25
+ * filter.add("alice");
26
+ * filter.has("alice"); // true
27
+ * filter.has("bob"); // false (or a ~1% false positive)
28
+ * ```
29
+ */
11
30
  declare class BloomFilter {
12
31
  #private;
32
+ /**
33
+ * Creates a filter sized for `n` expected keys at a target false-positive rate.
34
+ *
35
+ * @param n - Expected number of keys.
36
+ * @param epsilon - Target false-positive rate, e.g. `0.01` for 1%.
37
+ * @returns A new, empty filter.
38
+ */
13
39
  static create(n: number, epsilon: number): BloomFilter;
40
+ /**
41
+ * Restores a filter from its {@link BloomFilter.toBytes} serialization.
42
+ *
43
+ * @param bytes - The serialized filter.
44
+ * @returns The reconstructed filter.
45
+ */
14
46
  static fromBytes(bytes: Uint8Array): BloomFilter;
47
+ /**
48
+ * Constructs a filter from low-level {@link BloomParams}. Prefer
49
+ * {@link BloomFilter.create} unless restoring a specific configuration.
50
+ */
15
51
  constructor({ m, k, seed }: BloomParams);
16
52
  /** Analytic design bits-per-key `m / n`. */
17
53
  get bitsPerKey(): number;
54
+ /**
55
+ * Serializes the filter to a portable little-endian byte layout.
56
+ *
57
+ * @returns The serialized filter, readable by {@link BloomFilter.fromBytes}.
58
+ */
18
59
  toBytes(): Uint8Array;
60
+ /**
61
+ * Returns a new filter containing the union of this filter and `other`.
62
+ *
63
+ * @param other - A filter built with identical parameters.
64
+ * @returns A new filter reporting membership for keys in either input.
65
+ * @throws {@link BloomParamMismatchError} if the parameters differ.
66
+ */
19
67
  union(other: BloomFilter): BloomFilter;
68
+ /**
69
+ * Adds a key to the set.
70
+ *
71
+ * @param key - The key to insert, as a string or bytes.
72
+ */
20
73
  add(key: BytesLike): void;
74
+ /**
75
+ * Tests whether a key is in the set.
76
+ *
77
+ * @param key - The key to test.
78
+ * @returns `true` if present (possibly a false positive); `false` guarantees absence.
79
+ */
21
80
  has(key: BytesLike): boolean;
22
81
  }
23
82
  //#endregion
24
- export { BloomFilter, BloomParamMismatchError, type BloomParams };
83
+ export { BloomFilter, BloomParamMismatchError, type BloomParams, ParamError };
@@ -1,4 +1,5 @@
1
1
  import { a as probeInto, n as readHeader, r as writeHeader } from "../serialize-5XQ5y_R-.js";
2
+ import { a as assertUint32, i as assertProbability, r as assertPositiveInt, t as ParamError } from "../params-ChTRNxM9.js";
2
3
  //#region src/core/bitset.ts
3
4
  var BitSetRangeError = class extends RangeError {
4
5
  name = "BitSetRangeError";
@@ -47,9 +48,23 @@ function optimal(n, epsilon) {
47
48
  //#endregion
48
49
  //#region src/bloom/bloom.ts
49
50
  const TYPE = 1;
51
+ /** Thrown when an operation requires two filters built with identical parameters. */
50
52
  var BloomParamMismatchError = class extends Error {
53
+ /** Discriminates this error from other `Error`s. */
51
54
  name = "BloomParamMismatchError";
52
55
  };
56
+ /**
57
+ * A classic Bloom filter: a space-efficient set with a tunable false-positive
58
+ * rate and zero false negatives.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * const filter = BloomFilter.create(100_000, 0.01);
63
+ * filter.add("alice");
64
+ * filter.has("alice"); // true
65
+ * filter.has("bob"); // false (or a ~1% false positive)
66
+ * ```
67
+ */
53
68
  var BloomFilter = class BloomFilter {
54
69
  #bits;
55
70
  #m;
@@ -57,11 +72,26 @@ var BloomFilter = class BloomFilter {
57
72
  #seed;
58
73
  #scratch;
59
74
  #n;
75
+ /**
76
+ * Creates a filter sized for `n` expected keys at a target false-positive rate.
77
+ *
78
+ * @param n - Expected number of keys.
79
+ * @param epsilon - Target false-positive rate, e.g. `0.01` for 1%.
80
+ * @returns A new, empty filter.
81
+ */
60
82
  static create(n, epsilon) {
83
+ assertPositiveInt(n, "n");
84
+ assertProbability(epsilon, "epsilon");
61
85
  const f = new BloomFilter(optimal(n, epsilon));
62
86
  f.#n = n;
63
87
  return f;
64
88
  }
89
+ /**
90
+ * Restores a filter from its {@link BloomFilter.toBytes} serialization.
91
+ *
92
+ * @param bytes - The serialized filter.
93
+ * @returns The reconstructed filter.
94
+ */
65
95
  static fromBytes(bytes) {
66
96
  const { body } = readHeader(bytes);
67
97
  const dv = new DataView(body.buffer, body.byteOffset, body.byteLength);
@@ -76,7 +106,14 @@ var BloomFilter = class BloomFilter {
76
106
  f.#bits.bytes.set(body.subarray(9));
77
107
  return f;
78
108
  }
109
+ /**
110
+ * Constructs a filter from low-level {@link BloomParams}. Prefer
111
+ * {@link BloomFilter.create} unless restoring a specific configuration.
112
+ */
79
113
  constructor({ m, k, seed = 0 }) {
114
+ assertPositiveInt(m, "m");
115
+ assertPositiveInt(k, "k");
116
+ assertUint32(seed, "seed");
80
117
  this.#bits = new BitSet(m);
81
118
  this.#m = m;
82
119
  this.#k = k;
@@ -88,6 +125,11 @@ var BloomFilter = class BloomFilter {
88
125
  get bitsPerKey() {
89
126
  return this.#m / this.#n;
90
127
  }
128
+ /**
129
+ * Serializes the filter to a portable little-endian byte layout.
130
+ *
131
+ * @returns The serialized filter, readable by {@link BloomFilter.fromBytes}.
132
+ */
91
133
  toBytes() {
92
134
  const payload = this.#bits.bytes;
93
135
  const body = new Uint8Array(9 + payload.length);
@@ -102,6 +144,13 @@ var BloomFilter = class BloomFilter {
102
144
  flags: 0
103
145
  }, body);
104
146
  }
147
+ /**
148
+ * Returns a new filter containing the union of this filter and `other`.
149
+ *
150
+ * @param other - A filter built with identical parameters.
151
+ * @returns A new filter reporting membership for keys in either input.
152
+ * @throws {@link BloomParamMismatchError} if the parameters differ.
153
+ */
105
154
  union(other) {
106
155
  if (this.#m !== other.#m || this.#k !== other.#k || this.#seed !== other.#seed) throw new BloomParamMismatchError("cannot union Bloom filters whose parameters do not match");
107
156
  const a = this.#bits.bytes;
@@ -116,10 +165,21 @@ var BloomFilter = class BloomFilter {
116
165
  r.#bits.bytes.set(merged);
117
166
  return r;
118
167
  }
168
+ /**
169
+ * Adds a key to the set.
170
+ *
171
+ * @param key - The key to insert, as a string or bytes.
172
+ */
119
173
  add(key) {
120
174
  probeInto(key, this.#k, this.#m, this.#seed, this.#scratch);
121
175
  for (let i = 0; i < this.#k; i++) this.#bits.set(this.#scratch[i] ?? 0);
122
176
  }
177
+ /**
178
+ * Tests whether a key is in the set.
179
+ *
180
+ * @param key - The key to test.
181
+ * @returns `true` if present (possibly a false positive); `false` guarantees absence.
182
+ */
123
183
  has(key) {
124
184
  probeInto(key, this.#k, this.#m, this.#seed, this.#scratch);
125
185
  for (let i = 0; i < this.#k; i++) if (!this.#bits.get(this.#scratch[i] ?? 0)) return false;
@@ -127,4 +187,4 @@ var BloomFilter = class BloomFilter {
127
187
  }
128
188
  };
129
189
  //#endregion
130
- export { BloomFilter, BloomParamMismatchError };
190
+ export { BloomFilter, BloomParamMismatchError, ParamError };
@@ -4,7 +4,9 @@ const require_serialize = require("../serialize-CHHDM4TQ.cjs");
4
4
  const ARITY = 3;
5
5
  const TYPE_FUSE8 = 3;
6
6
  const TYPE_FUSE16 = 4;
7
+ /** Thrown when binary fuse construction fails to converge on the key set. */
7
8
  var BinaryFuseBuildError = class extends Error {
9
+ /** Discriminates this error from other `Error`s. */
8
10
  name = "BinaryFuseBuildError";
9
11
  };
10
12
  let RLO = 0;
@@ -231,6 +233,10 @@ function fuseStateFromBytes(bytes, expectedType) {
231
233
  size
232
234
  };
233
235
  }
236
+ /**
237
+ * Shared behavior for the static binary fuse filters: an immutable,
238
+ * space-efficient membership filter built once from a fixed key set.
239
+ */
234
240
  var BinaryFuse = class {
235
241
  #fp;
236
242
  #seed;
@@ -247,12 +253,19 @@ var BinaryFuse = class {
247
253
  this.#segCountLen = state.params.segCountLen;
248
254
  this.#size = state.size;
249
255
  }
256
+ /** Number of distinct keys the filter was built from. */
250
257
  get size() {
251
258
  return this.#size;
252
259
  }
260
+ /** Actual bits stored per key (`0` for an empty filter). */
253
261
  get bitsPerKey() {
254
262
  return this.#size === 0 ? 0 : this.#fp.byteLength * 8 / this.#size;
255
263
  }
264
+ /**
265
+ * Serializes the filter to a portable little-endian byte layout.
266
+ *
267
+ * @returns The serialized filter, readable by the matching `fromBytes`.
268
+ */
256
269
  toBytes() {
257
270
  const laneBytes = new Uint8Array(this.#fp.buffer, this.#fp.byteOffset, this.#fp.byteLength);
258
271
  const body = new Uint8Array(16 + laneBytes.length);
@@ -268,6 +281,12 @@ var BinaryFuse = class {
268
281
  flags: 0
269
282
  }, body);
270
283
  }
284
+ /**
285
+ * Tests whether a key is in the set.
286
+ *
287
+ * @param key - The key to test.
288
+ * @returns `true` if present (possibly a false positive); `false` guarantees absence.
289
+ */
271
290
  has(key) {
272
291
  if (this.#fp.length === 0) return false;
273
292
  require_serialize.hash128KeyInto(key, 0, scratchHash);
@@ -282,18 +301,65 @@ var BinaryFuse = class {
282
301
  return ((mlo ^ mhi) & mask) === (((this.#fp[p0] ?? 0) ^ (this.#fp[p1] ?? 0) ^ (this.#fp[p2] ?? 0)) & mask);
283
302
  }
284
303
  };
304
+ /**
305
+ * A static 8-bit binary fuse filter: built once from a key set, then immutable.
306
+ * The most space-efficient option (~9 bits/key at ~0.39% false-positive rate).
307
+ *
308
+ * @example
309
+ * ```ts
310
+ * const filter = BinaryFuse8.from(["alice", "bob", "carol"]);
311
+ * filter.has("alice"); // true
312
+ * filter.size; // 3
313
+ * ```
314
+ */
285
315
  var BinaryFuse8 = class BinaryFuse8 extends BinaryFuse {
316
+ /**
317
+ * Builds a filter from the given keys; duplicates are ignored.
318
+ *
319
+ * @param keys - The complete set of keys to store.
320
+ * @returns A new immutable filter.
321
+ * @throws {@link BinaryFuseBuildError} if construction fails to converge.
322
+ */
286
323
  static from(keys) {
287
324
  return new BinaryFuse8(buildState(keys, (n) => new Uint8Array(n)));
288
325
  }
326
+ /**
327
+ * Restores a filter from its {@link BinaryFuse8.toBytes} serialization.
328
+ *
329
+ * @param bytes - The serialized filter.
330
+ * @returns The reconstructed filter.
331
+ */
289
332
  static fromBytes(bytes) {
290
333
  return new BinaryFuse8(fuseStateFromBytes(bytes, TYPE_FUSE8));
291
334
  }
292
335
  };
336
+ /**
337
+ * A static 16-bit binary fuse filter: like {@link BinaryFuse8} but twice the
338
+ * space (~18 bits/key) for a far lower false-positive rate (~1/65536).
339
+ *
340
+ * @example
341
+ * ```ts
342
+ * const filter = BinaryFuse16.from(["alice", "bob", "carol"]);
343
+ * filter.has("alice"); // true
344
+ * ```
345
+ */
293
346
  var BinaryFuse16 = class BinaryFuse16 extends BinaryFuse {
347
+ /**
348
+ * Builds a filter from the given keys; duplicates are ignored.
349
+ *
350
+ * @param keys - The complete set of keys to store.
351
+ * @returns A new immutable filter.
352
+ * @throws {@link BinaryFuseBuildError} if construction fails to converge.
353
+ */
294
354
  static from(keys) {
295
355
  return new BinaryFuse16(buildState(keys, (n) => new Uint16Array(n)));
296
356
  }
357
+ /**
358
+ * Restores a filter from its {@link BinaryFuse16.toBytes} serialization.
359
+ *
360
+ * @param bytes - The serialized filter.
361
+ * @returns The reconstructed filter.
362
+ */
297
363
  static fromBytes(bytes) {
298
364
  return new BinaryFuse16(fuseStateFromBytes(bytes, TYPE_FUSE16));
299
365
  }
@@ -1,6 +1,8 @@
1
1
  import { t as BytesLike } from "../bytes-DCuYtUVS.cjs";
2
2
  //#region src/fuse/fuse.d.ts
3
+ /** Thrown when binary fuse construction fails to converge on the key set. */
3
4
  declare class BinaryFuseBuildError extends Error {
5
+ /** Discriminates this error from other `Error`s. */
4
6
  override readonly name = "BinaryFuseBuildError";
5
7
  }
6
8
  interface FuseParams {
@@ -15,20 +17,84 @@ interface FuseState {
15
17
  params: FuseParams;
16
18
  size: number;
17
19
  }
20
+ /**
21
+ * Shared behavior for the static binary fuse filters: an immutable,
22
+ * space-efficient membership filter built once from a fixed key set.
23
+ */
18
24
  declare abstract class BinaryFuse {
19
25
  #private;
20
26
  protected constructor(state: FuseState);
27
+ /** Number of distinct keys the filter was built from. */
21
28
  get size(): number;
29
+ /** Actual bits stored per key (`0` for an empty filter). */
22
30
  get bitsPerKey(): number;
31
+ /**
32
+ * Serializes the filter to a portable little-endian byte layout.
33
+ *
34
+ * @returns The serialized filter, readable by the matching `fromBytes`.
35
+ */
23
36
  toBytes(): Uint8Array;
37
+ /**
38
+ * Tests whether a key is in the set.
39
+ *
40
+ * @param key - The key to test.
41
+ * @returns `true` if present (possibly a false positive); `false` guarantees absence.
42
+ */
24
43
  has(key: BytesLike): boolean;
25
44
  }
45
+ /**
46
+ * A static 8-bit binary fuse filter: built once from a key set, then immutable.
47
+ * The most space-efficient option (~9 bits/key at ~0.39% false-positive rate).
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const filter = BinaryFuse8.from(["alice", "bob", "carol"]);
52
+ * filter.has("alice"); // true
53
+ * filter.size; // 3
54
+ * ```
55
+ */
26
56
  declare class BinaryFuse8 extends BinaryFuse {
57
+ /**
58
+ * Builds a filter from the given keys; duplicates are ignored.
59
+ *
60
+ * @param keys - The complete set of keys to store.
61
+ * @returns A new immutable filter.
62
+ * @throws {@link BinaryFuseBuildError} if construction fails to converge.
63
+ */
27
64
  static from(keys: Iterable<BytesLike>): BinaryFuse8;
65
+ /**
66
+ * Restores a filter from its {@link BinaryFuse8.toBytes} serialization.
67
+ *
68
+ * @param bytes - The serialized filter.
69
+ * @returns The reconstructed filter.
70
+ */
28
71
  static fromBytes(bytes: Uint8Array): BinaryFuse8;
29
72
  }
73
+ /**
74
+ * A static 16-bit binary fuse filter: like {@link BinaryFuse8} but twice the
75
+ * space (~18 bits/key) for a far lower false-positive rate (~1/65536).
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * const filter = BinaryFuse16.from(["alice", "bob", "carol"]);
80
+ * filter.has("alice"); // true
81
+ * ```
82
+ */
30
83
  declare class BinaryFuse16 extends BinaryFuse {
84
+ /**
85
+ * Builds a filter from the given keys; duplicates are ignored.
86
+ *
87
+ * @param keys - The complete set of keys to store.
88
+ * @returns A new immutable filter.
89
+ * @throws {@link BinaryFuseBuildError} if construction fails to converge.
90
+ */
31
91
  static from(keys: Iterable<BytesLike>): BinaryFuse16;
92
+ /**
93
+ * Restores a filter from its {@link BinaryFuse16.toBytes} serialization.
94
+ *
95
+ * @param bytes - The serialized filter.
96
+ * @returns The reconstructed filter.
97
+ */
32
98
  static fromBytes(bytes: Uint8Array): BinaryFuse16;
33
99
  }
34
100
  //#endregion
@@ -1,6 +1,8 @@
1
1
  import { t as BytesLike } from "../bytes-DCuYtUVS.js";
2
2
  //#region src/fuse/fuse.d.ts
3
+ /** Thrown when binary fuse construction fails to converge on the key set. */
3
4
  declare class BinaryFuseBuildError extends Error {
5
+ /** Discriminates this error from other `Error`s. */
4
6
  override readonly name = "BinaryFuseBuildError";
5
7
  }
6
8
  interface FuseParams {
@@ -15,20 +17,84 @@ interface FuseState {
15
17
  params: FuseParams;
16
18
  size: number;
17
19
  }
20
+ /**
21
+ * Shared behavior for the static binary fuse filters: an immutable,
22
+ * space-efficient membership filter built once from a fixed key set.
23
+ */
18
24
  declare abstract class BinaryFuse {
19
25
  #private;
20
26
  protected constructor(state: FuseState);
27
+ /** Number of distinct keys the filter was built from. */
21
28
  get size(): number;
29
+ /** Actual bits stored per key (`0` for an empty filter). */
22
30
  get bitsPerKey(): number;
31
+ /**
32
+ * Serializes the filter to a portable little-endian byte layout.
33
+ *
34
+ * @returns The serialized filter, readable by the matching `fromBytes`.
35
+ */
23
36
  toBytes(): Uint8Array;
37
+ /**
38
+ * Tests whether a key is in the set.
39
+ *
40
+ * @param key - The key to test.
41
+ * @returns `true` if present (possibly a false positive); `false` guarantees absence.
42
+ */
24
43
  has(key: BytesLike): boolean;
25
44
  }
45
+ /**
46
+ * A static 8-bit binary fuse filter: built once from a key set, then immutable.
47
+ * The most space-efficient option (~9 bits/key at ~0.39% false-positive rate).
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const filter = BinaryFuse8.from(["alice", "bob", "carol"]);
52
+ * filter.has("alice"); // true
53
+ * filter.size; // 3
54
+ * ```
55
+ */
26
56
  declare class BinaryFuse8 extends BinaryFuse {
57
+ /**
58
+ * Builds a filter from the given keys; duplicates are ignored.
59
+ *
60
+ * @param keys - The complete set of keys to store.
61
+ * @returns A new immutable filter.
62
+ * @throws {@link BinaryFuseBuildError} if construction fails to converge.
63
+ */
27
64
  static from(keys: Iterable<BytesLike>): BinaryFuse8;
65
+ /**
66
+ * Restores a filter from its {@link BinaryFuse8.toBytes} serialization.
67
+ *
68
+ * @param bytes - The serialized filter.
69
+ * @returns The reconstructed filter.
70
+ */
28
71
  static fromBytes(bytes: Uint8Array): BinaryFuse8;
29
72
  }
73
+ /**
74
+ * A static 16-bit binary fuse filter: like {@link BinaryFuse8} but twice the
75
+ * space (~18 bits/key) for a far lower false-positive rate (~1/65536).
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * const filter = BinaryFuse16.from(["alice", "bob", "carol"]);
80
+ * filter.has("alice"); // true
81
+ * ```
82
+ */
30
83
  declare class BinaryFuse16 extends BinaryFuse {
84
+ /**
85
+ * Builds a filter from the given keys; duplicates are ignored.
86
+ *
87
+ * @param keys - The complete set of keys to store.
88
+ * @returns A new immutable filter.
89
+ * @throws {@link BinaryFuseBuildError} if construction fails to converge.
90
+ */
31
91
  static from(keys: Iterable<BytesLike>): BinaryFuse16;
92
+ /**
93
+ * Restores a filter from its {@link BinaryFuse16.toBytes} serialization.
94
+ *
95
+ * @param bytes - The serialized filter.
96
+ * @returns The reconstructed filter.
97
+ */
32
98
  static fromBytes(bytes: Uint8Array): BinaryFuse16;
33
99
  }
34
100
  //#endregion