refactor: upgrade nip17

This commit is contained in:
2024-04-29 17:41:11 +01:00
parent c775236438
commit 87144d9395
15 changed files with 97 additions and 33 deletions

View File

@ -29,6 +29,18 @@ export class ProfileCacheRelayWorker extends EventEmitter<CacheEvents> implement
this.#log(`Loaded %d/%d in %d ms`, this.#cache.size, this.#keys.size, (unixNowMs() - start).toLocaleString());
}
async search(q: string) {
const profiles = await this.#relay.query([
"REQ",
"profiles-search",
{
kinds: [0],
search: q
},
]);
return removeUndefined(profiles.map(mapEventToProfile));
}
keysOnTable(): string[] {
return [...this.#keys];
}