system-worker progress

This commit is contained in:
2024-01-09 09:28:48 +00:00
parent 24e145a0a0
commit bbdfb43834
10 changed files with 124 additions and 53 deletions

View File

@ -20,6 +20,7 @@ import {
UsersRelays,
SnortSystemDb,
EventExt,
QueryLike,
} from ".";
import { EventsCache } from "./cache/events";
import { RelayCache, RelayMetadataLoader } from "./outbox-model";
@ -224,16 +225,16 @@ export class NostrSystem extends EventEmitter<NostrSystemEvents> implements Syst
this.#pool.disconnect(address);
}
GetQuery(id: string): Query | undefined {
return this.#queryManager.get(id);
GetQuery(id: string): QueryLike | undefined {
return this.#queryManager.get(id) as QueryLike;
}
Fetch(req: RequestBuilder, cb?: (evs: ReadonlyArray<TaggedNostrEvent>) => void) {
return this.#queryManager.fetch(req, cb);
}
Query<T extends NoteStore>(type: { new (): T }, req: RequestBuilder): Query {
return this.#queryManager.query(type, req);
Query<T extends NoteStore>(type: { new (): T }, req: RequestBuilder): QueryLike {
return this.#queryManager.query(type, req) as QueryLike;
}
async #sendQuery(q: Query, qSend: BuiltRawReqFilter) {