Upgrade NLib, remove unnecessary generics

This commit is contained in:
Alex Gleason 2024-01-23 17:18:44 -06:00
parent ea8df5b791
commit 2369030ff0
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
5 changed files with 7 additions and 6 deletions

View File

@ -83,16 +83,17 @@ export { EventEmitter } from 'npm:tseep@^1.1.3';
export { default as stringifyStable } from 'npm:fast-stable-stringify@^1.0.0';
// @deno-types="npm:@types/debug@^4.1.12"
export { default as Debug } from 'npm:debug@^4.3.4';
export { NSet } from 'https://gitlab.com/soapbox-pub/nset/-/raw/b3c5601612f9bd277626198c5534e0796e003884/mod.ts';
export {
LNURL,
type LNURLDetails,
type MapCache,
NCache,
NIP05,
type NostrEvent,
type NostrFilter,
NSet,
type NStore,
type NStoreOpts,
} from 'https://gitlab.com/soapbox-pub/nlib/-/raw/057ecc6e2ce813db6e2279288fbfd08c5b53cc0c/mod.ts';
} from 'https://gitlab.com/soapbox-pub/nlib/-/raw/554ec56cd92ff0a65e8b74765da3b854f50e4a2a/mod.ts';
export type * as TypeFest from 'npm:type-fest@^4.3.0';

View File

@ -38,7 +38,7 @@ class Memorelay implements NStore {
if (!filters.length) return Promise.resolve([]);
/** Event results to return. */
const results = new NSet<NostrEvent>();
const results = new NSet();
/** Number of times an event has been added to results for each filter. */
const filterUsages: number[] = [];

View File

@ -40,7 +40,7 @@ class Optimizer implements NStore {
if (!filters.length) return Promise.resolve([]);
const { limit = Infinity } = opts;
const results = new NSet<DittoEvent>();
const results = new NSet();
// Filters with IDs are immutable, so we can take them straight from the cache if we have them.
for (let i = 0; i < filters.length; i++) {

View File

@ -53,7 +53,7 @@ class PoolStore implements NStore {
if (!filters.length) return Promise.resolve([]);
return new Promise((resolve, reject) => {
const results = new NSet<NostrEvent>();
const results = new NSet();
const unsub = this.#pool.subscribe(
filters,

View File

@ -56,7 +56,7 @@ class SearchStore implements NStore {
opts?.signal?.addEventListener('abort', close, { once: true });
sub.eoseSignal.addEventListener('abort', close, { once: true });
const events = new NSet<DittoEvent>();
const events = new NSet();
for await (const event of sub) {
events.add(event);