Bump welshman/net

This commit is contained in:
Jon Staab 2024-06-20 12:12:48 -07:00
parent c9db37c92a
commit e212297396
4 changed files with 24 additions and 31 deletions

33
package-lock.json generated
View File

@ -21,7 +21,7 @@
"@welshman/content": "^0.0.5",
"@welshman/feeds": "^0.0.12",
"@welshman/lib": "^0.0.10",
"@welshman/net": "^0.0.13",
"@welshman/net": "^0.0.14",
"@welshman/util": "^0.0.15",
"bowser": "^2.11.0",
"classnames": "^2.5.1",
@ -4644,37 +4644,16 @@
}
},
"node_modules/@welshman/net": {
"version": "0.0.13",
"resolved": "https://registry.npmjs.org/@welshman/net/-/net-0.0.13.tgz",
"integrity": "sha512-Rx08jQdGNj6Xb0tcXIxVZcMUQO/n0wzdMvHBVu5PI1Kd6nhbj6tgQ47nS+dV1kmlE3pTe8U1l3VOXkW3YdFxpQ==",
"version": "0.0.14",
"resolved": "https://registry.npmjs.org/@welshman/net/-/net-0.0.14.tgz",
"integrity": "sha512-fHW+EEMT/dsxwKrhIEntsZbv7uGtYrdNt/lIbLnc4h0F9n2fdi/3HBMBINbxeUb+3eAindeIuYrCnD72sKpkhA==",
"dependencies": {
"@welshman/lib": "0.0.9",
"@welshman/util": "0.0.14",
"@welshman/lib": "0.0.10",
"@welshman/util": "0.0.15",
"isomorphic-ws": "^5.0.0",
"ws": "^8.16.0"
}
},
"node_modules/@welshman/net/node_modules/@welshman/lib": {
"version": "0.0.9",
"resolved": "https://registry.npmjs.org/@welshman/lib/-/lib-0.0.9.tgz",
"integrity": "sha512-1wR/FtrmGfKWPCLpySyOlQoJ4sBvMvXBjNfQseYeBJNCLrdn4eN3hJc8M3URPaLSLuP4/uB6DD54wntfnJ43kA==",
"dependencies": {
"@scure/base": "^1.1.6",
"@types/events": "^3.0.3",
"@types/throttle-debounce": "^5.0.2",
"events": "^3.3.0",
"throttle-debounce": "^5.0.0"
}
},
"node_modules/@welshman/net/node_modules/@welshman/util": {
"version": "0.0.14",
"resolved": "https://registry.npmjs.org/@welshman/util/-/util-0.0.14.tgz",
"integrity": "sha512-kpSJ3Ve2oQei/wA1Y6ZuhQr1v46dSUzta/YnUIC1sBmamGXpsYlXG4QrKQpqtB15dJyGRhxTILIvJ/529y3LMA==",
"dependencies": {
"@welshman/lib": "0.0.9",
"nostr-tools": "^2.3.2"
}
},
"node_modules/@welshman/util": {
"version": "0.0.15",
"resolved": "https://registry.npmjs.org/@welshman/util/-/util-0.0.15.tgz",

View File

@ -58,7 +58,7 @@
"@welshman/content": "^0.0.5",
"@welshman/feeds": "^0.0.12",
"@welshman/lib": "^0.0.10",
"@welshman/net": "^0.0.13",
"@welshman/net": "^0.0.14",
"@welshman/util": "^0.0.15",
"bowser": "^2.11.0",
"classnames": "^2.5.1",

View File

@ -12,8 +12,9 @@
import PersonBadgeSmall from "src/app/shared/PersonBadgeSmall.svelte"
import {readFeed, readList, displayFeed, mapListToFeed, getSingletonValues} from "src/domain"
import {
repository,
hints,
pubkey,
repository,
addFeedFavorite,
removeFeedFavorite,
userFeedFavorites,
@ -26,6 +27,7 @@
const expandDefinition = boolCtrl()
const event = repository.getEvent(address)
const deleted = repository.isDeleted(event)
const naddr = Address.from(address, hints.Event(event).getUrls()).toNaddr()
const feed = address.startsWith(NAMED_BOOKMARKS)
? mapListToFeed(readList(event))
: readFeed(event)
@ -88,7 +90,7 @@
on:click={toggleFavorite}>
<i class="fa fa-bookmark" class:text-accent={isFavorite} />
</div>
<CopyValueSimple label="Feed address" value={toNostrURI(Address.from(address).toNaddr())} />
<CopyValueSimple label="Feed address" value={toNostrURI(naddr)} />
</div>
</div>
{#if $expandDefinition.enabled}

View File

@ -1537,6 +1537,7 @@ export const onAuth = async (url, challenge) => {
export type MySubscribeRequest = SubscribeRequest & {
onEvent?: (event: TrustedEvent) => void
onEose?: (url: string) => void
onComplete?: () => void
skipCache?: boolean
forcePlatform?: boolean
@ -1581,6 +1582,10 @@ export const subscribe = ({forcePlatform = true, ...request}: MySubscribeRequest
projections.push(await ensureUnwrapped(event))
})
if (request.onEose) {
sub.emitter.on("eose", request.onEose)
}
if (request.onComplete) {
sub.emitter.on("complete", request.onComplete)
}
@ -1619,7 +1624,14 @@ export const subscribePersistent = (request: MySubscribeRequest) => {
export const LOAD_OPTS = {timeout: 3000, closeOnEose: true}
export const load = (request: MySubscribeRequest) => subscribe({...request, ...LOAD_OPTS}).result
export const load = (request: MySubscribeRequest) =>
new Promise(resolve => {
const events = []
const sub = subscribe({...request, ...LOAD_OPTS})
sub.emitter.on("event", (url: string, event: TrustedEvent) => events.push(event))
sub.emitter.on("complete", (url: string) => resolve(events))
})
export const loadOne = (request: MySubscribeRequest) =>
new Promise<TrustedEvent | null>(resolve => {