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
+44
View File
@@ -0,0 +1,44 @@
import {uniq} from "@welshman/lib"
import {
BOOKMARKS,
getEventTagValues,
getAddressTagValues,
getTopicTagValues,
getTagValues,
} from "@welshman/util"
import {EncryptableList} from "./List.js"
// NIP-51 kind-10003 bookmark list. Mixed entries (notes via 'e', articles via
// 'a', hashtags via 't', urls via 'r') can be bookmarked publicly (tags) or
// privately (encrypted content); accessors treat both as one merged set.
export class BookmarkList extends EncryptableList {
readonly kind = BOOKMARKS
ids() {
return uniq(getEventTagValues(this.tags()))
}
addresses() {
return uniq(getAddressTagValues(this.tags()))
}
topics() {
return uniq(getTopicTagValues(this.tags()))
}
urls() {
return uniq(getTagValues("r", this.tags()))
}
bookmarkPublicly(tag: string[]) {
return this.addPublicTags(tag)
}
bookmarkPrivately(tag: string[]) {
return this.addPrivateTags(tag)
}
removeBookmark(value: string) {
return this.removeTagsWithValue(value)
}
}