Add domain object classes for nostr event types
tests / tests (push) Failing after 5m6s

Build out @welshman/domain on top of the DomainObject/EncryptableList base
patterns, porting domain-object use cases from @welshman/util and flotilla
that weren't yet represented.

New classes:
- Relay lists: RelayList (NIP-65 read/write markers), Blocked/Search/Messaging
  relay lists, RelaySet (NIP-51 30002 named set)
- Server lists: Blossom, FileServer
- NIP-51 lists: Follow, Pin, Bookmark, Community, Channel, Room, Feed, Topic,
  Emoji
- Zaps: ZapRequest, ZapReceipt, ZapGoal
- NIP-89 handlers: Handler, HandlerRecommendation
- Rooms/groups (NIP-29): RoomMeta, RoomAdmins, RoomMembers, RoomMembershipOp,
  Room create/delete/join/leave, RoomCreatePermission, RelayMembers,
  RelayMembershipOp, Relay join/leave/invite
- Content: Poll, PollResponse, Thread, Comment, Classified, CalendarEvent,
  Report, Feed, Settings

Also fix unfinished accessors in Profile, method-call bugs in MuteList, and
correct RelayList.set{Read,Write}Relays to preserve a relay's complementary
read/write capability instead of dropping modeless entries.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V67tPYdvh1qCkjEBhJGZUR
This commit is contained in:
2026-06-18 21:16:27 +00:00
parent 925f540640
commit 99f5233e05
47 changed files with 3072 additions and 9 deletions
+32
View File
@@ -0,0 +1,32 @@
import {uniq} from "@welshman/lib"
import {BLOSSOM_SERVERS, getTagValues, normalizeRelayUrl} from "@welshman/util"
import {EncryptableList} from "./List.js"
// Blossom BUD-03 user server list (kind 10063). Server endpoints are stored as
// `["server", url]` tags (NOT the `r`/`relay` tags used by relay lists), so the
// generic relay-tag helpers would miss them. Effectively public-only.
export class BlossomServerList extends EncryptableList {
readonly kind = BLOSSOM_SERVERS
servers() {
return uniq(getTagValues("server", this.tags()).map(normalizeRelayUrl))
}
includes(url: string) {
return this.servers().includes(url)
}
addServer(url: string) {
return this.addPublicTags(["server", normalizeRelayUrl(url)])
}
removeServer(url: string) {
return this.removeTagsWithValue(url)
}
setServers(urls: string[]) {
this.keepTagsWithKey("server")
return this.addPublicTags(...urls.map(url => ["server", normalizeRelayUrl(url)]))
}
}