Refine domain, integrate into app
tests / tests (push) Failing after 5m14s

This commit is contained in:
Jon Staab
2026-06-19 12:50:34 -07:00
parent 1bd62d3024
commit e2a6ef21cd
115 changed files with 1354 additions and 3176 deletions
+9 -4
View File
@@ -2,6 +2,7 @@ import {tryCatch, batcher, postJson} from "@welshman/lib"
import type {Maybe} from "@welshman/lib"
import {queryProfile, displayNip05} from "@welshman/util"
import type {Handle} from "@welshman/util"
import type {Profile} from "@welshman/domain"
import {deriveDeduplicated} from "@welshman/store"
import {LoadableMapPlugin, projection} from "./base.js"
import type {Projection} from "./base.js"
@@ -60,16 +61,20 @@ export class Handles extends LoadableMapPlugin<Handle> {
loadForPubkey = async (pubkey: string, relays: string[] = []) => {
const $profile = await this.app.use(Profiles).load(pubkey, relays)
return $profile?.nip05 ? this.load($profile.nip05) : undefined
const nip05 = $profile?.nip05()
return nip05 ? this.load(nip05) : undefined
}
forPubkey = (pubkey: string, relays: string[] = []): Projection<Maybe<Handle>> => {
this.loadForPubkey(pubkey, relays)
const read = ([$handlesByNip05, $profile]: [ReadonlyMap<string, Handle>, Maybe<{nip05?: string}>]) => {
if (!$profile?.nip05) return undefined
const read = ([$handlesByNip05, $profile]: [ReadonlyMap<string, Handle>, Maybe<Profile>]) => {
const nip05 = $profile?.nip05()
const handle = $handlesByNip05.get($profile.nip05)
if (!nip05) return undefined
const handle = $handlesByNip05.get(nip05)
if (handle?.pubkey !== pubkey) return undefined