Add since to reqs that get re-opened to avoid re-downloading and gaps in active subscriptions. Also add some getters for event stores and event sort utils

This commit is contained in:
Jon Staab
2025-12-04 15:16:56 -08:00
parent 7b96e52349
commit d81ec62d2b
5 changed files with 126 additions and 75 deletions
+5 -1
View File
@@ -1,7 +1,7 @@
import {verifiedSymbol, verifyEvent as verifyEventPure} from "nostr-tools/pure"
import {setNostrWasm, verifyEvent as verifyEventWasm} from "nostr-tools/wasm"
import {initNostrWasm} from "nostr-wasm"
import {mapVals, lte, first, pick, now} from "@welshman/lib"
import {mapVals, sortBy, lte, first, pick, now} from "@welshman/lib"
import {getReplyTags, getCommentTags, getReplyTagValues, getCommentTagValues} from "./Tags.js"
import {getAddress, Address} from "./Address.js"
import {
@@ -195,3 +195,7 @@ export const isChildOf = (child: EventTemplate, parent: HashedEvent) => {
return getIdAndAddress(parent).some(x => idsAndAddrs.includes(x))
}
export const sortEventsAsc = (events: Iterable<TrustedEvent>) => sortBy(e => e.created_at, events)
export const sortEventsDesc = (events: Iterable<TrustedEvent>) => sortBy(e => -e.created_at, events)