applesauce-core
Advanced tools
Comparing version 0.0.0-next-20250130155410 to 0.0.0-next-20250130174055
import { NostrEvent } from "nostr-tools"; | ||
export declare const ContactsRelaysSymbol: unique symbol; | ||
export declare function relaysFromContactsEvent(event: NostrEvent): Map<string, "all" | "inbox" | "outbox"> | null; | ||
export declare function getRelaysFromContactsEvent(event: NostrEvent): Map<string, "all" | "inbox" | "outbox"> | null; |
import { getOrComputeCachedValue } from "./cache.js"; | ||
import { safeRelayUrl } from "./relays.js"; | ||
export const ContactsRelaysSymbol = Symbol.for("contacts-relays"); | ||
export function relaysFromContactsEvent(event) { | ||
export function getRelaysFromContactsEvent(event) { | ||
return getOrComputeCachedValue(event, ContactsRelaysSymbol, () => { | ||
@@ -6,0 +6,0 @@ try { |
@@ -13,1 +13,2 @@ import { NostrEvent } from "nostr-tools"; | ||
export declare function safeRelayUrls(urls: Iterable<string>): string[]; | ||
export declare function mergeRelaySets(...sources: (Iterable<string> | undefined)[]): string[]; |
@@ -32,1 +32,14 @@ export const SeenRelaysSymbol = Symbol.for("seen-relays"); | ||
} | ||
export function mergeRelaySets(...sources) { | ||
const set = new Set(); | ||
for (const src of sources) { | ||
if (!src) | ||
continue; | ||
for (const url of src) { | ||
const safe = safeRelayUrl(url); | ||
if (safe) | ||
set.add(safe); | ||
} | ||
} | ||
return Array.from(set); | ||
} |
{ | ||
"name": "applesauce-core", | ||
"version": "0.0.0-next-20250130155410", | ||
"version": "0.0.0-next-20250130174055", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "type": "module", |
168594
4157