5e142e4db4
tests / tests (push) Failing after 5m10s
Iterate on @welshman/domain following review: - base: add `group`/`protect`/`expires` behavior tags (parsed in base, emitted via addBehaviorTags before hashing) and an `extraTags` passthrough (opt-in via reservedTagKeys) so tag carry-over lives in one place; migrate Handler, Comment, Thread onto it. Comment gains nested root/parent ref structs + setters. - List: fix inverted keepTags; add clearTags/clearPublicTags/clearPrivateTags and use them in the relay/server list setters. - RelayList: preserve complementary read/write capability instead of dropping modeless entries. - Split Relay/Room membership ops into per-kind classes (RelayAddMember/ RelayRemoveMember, RoomAddMember/RoomRemoveMember) over a shared base. - TimeEvent (renamed from CalendarEvent): derive "D" day tags in toTemplate. - Feed: default to an empty feed, fail parse when the "feed" tag is missing. - RelaySet added; CommunityList renamed to GroupList; predicate bare add/remove mutators; RoomMeta uses randomId; PollResponse.selections drops pollType. - Remove ChannelList, FileServerList, Settings, and event-asserting getAddress/ display accessors. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V67tPYdvh1qCkjEBhJGZUR
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import {uniqBy} from "@welshman/lib"
|
|
import {MESSAGING_RELAYS, getTagValues, normalizeRelayUrl} from "@welshman/util"
|
|
import {EncryptableList} from "./List.js"
|
|
|
|
// NIP-17 kind-10050 messaging/inbox relays. Entries are marker-less
|
|
// ['relay', url] tags (NOT NIP-65 'r' tags with read/write markers, and the
|
|
// RelayMode.Messaging marker is not used per-tag here). `urls()` drives where
|
|
// encrypted DM gift-wraps are sent and fetched, so it stays a flat, normalized
|
|
// set. Identical structure to BlockedRelayList/SearchRelayList.
|
|
export class MessagingRelayList extends EncryptableList {
|
|
readonly kind = MESSAGING_RELAYS
|
|
|
|
urls() {
|
|
return uniqBy(normalizeRelayUrl, getTagValues("relay", this.tags()))
|
|
}
|
|
|
|
addRelay(url: string) {
|
|
return this.addPublicTags(["relay", normalizeRelayUrl(url)])
|
|
}
|
|
|
|
removeRelay(url: string) {
|
|
return this.removeTagsWithValue(url)
|
|
}
|
|
|
|
setRelays(urls: string[]) {
|
|
this.clearTags()
|
|
|
|
return this.addPublicTags(...urls.map(url => ["relay", normalizeRelayUrl(url)]))
|
|
}
|
|
}
|