Upgrade to welshman 0.11.0
This commit is contained in:
parent
7cb3feeeb3
commit
6b5947ae0e
29 changed files with 48 additions and 43 deletions
|
|
@ -314,7 +314,7 @@ data every page needs lives in `src/app/sync.ts`.
|
|||
|
||||
**One entity, or a handful of lists:** call plugin `load` in `onMount`, and toast on failure, as
|
||||
`people/[npub]/+page.svelte` does for the profile, relay list, follow, pin, room and messaging
|
||||
lists before loading the author's outbox with `$network.load`.
|
||||
lists before loading the author's outbox with `$network.loadLenient`.
|
||||
|
||||
**A detail page:** `deriveEvent(address, [url])` loads when nothing local matches. While it is
|
||||
empty, seven pages show a spinner that turns into a failure message:
|
||||
|
|
|
|||
20
package.json
20
package.json
|
|
@ -91,16 +91,16 @@
|
|||
"@types/throttle-debounce": "^5.0.2",
|
||||
"@vite-pwa/assets-generator": "^1.0.2",
|
||||
"@vite-pwa/sveltekit": "^1.1.0",
|
||||
"@welshman/app": "^0.10.9",
|
||||
"@welshman/content": "^0.10.9",
|
||||
"@welshman/domain": "^0.10.9",
|
||||
"@welshman/editor": "^0.10.9",
|
||||
"@welshman/feeds": "^0.10.9",
|
||||
"@welshman/lib": "^0.10.9",
|
||||
"@welshman/net": "^0.10.9",
|
||||
"@welshman/signer": "^0.10.9",
|
||||
"@welshman/store": "^0.10.9",
|
||||
"@welshman/util": "^0.10.9",
|
||||
"@welshman/app": "^0.11.0",
|
||||
"@welshman/content": "^0.11.0",
|
||||
"@welshman/domain": "^0.11.0",
|
||||
"@welshman/editor": "^0.11.0",
|
||||
"@welshman/feeds": "^0.11.0",
|
||||
"@welshman/lib": "^0.11.0",
|
||||
"@welshman/net": "^0.11.0",
|
||||
"@welshman/signer": "^0.11.0",
|
||||
"@welshman/store": "^0.11.0",
|
||||
"@welshman/util": "^0.11.0",
|
||||
"cheerio": "^1.2.0",
|
||||
"compressorjs-next": "^1.1.2",
|
||||
"dompurify": "^3.4.13",
|
||||
|
|
|
|||
BIN
pnpm-lock.yaml
BIN
pnpm-lock.yaml
Binary file not shown.
|
|
@ -336,7 +336,7 @@ export const toggleVideoPrimaryTile = (key: string) => {
|
|||
}
|
||||
|
||||
export const loadCallParticipants = (url: string, h: string) =>
|
||||
network.get().load({
|
||||
network.get().loadLenient({
|
||||
relays: [url],
|
||||
filters: [{kinds: [LIVEKIT_PARTICIPANTS], "#d": [h]}],
|
||||
})
|
||||
|
|
|
|||
|
|
@ -48,15 +48,16 @@ export class Commands extends RelayScopedDerivedPlugin<CommandReader> {
|
|||
const [url, address] = splitCommandKey(key)
|
||||
const {pubkey, identifier} = Address.from(address)
|
||||
|
||||
return this.app
|
||||
.use(Network)
|
||||
.load({relays: [url], filters: [{kinds: [COMMAND], authors: [pubkey], "#d": [identifier]}]})
|
||||
return this.app.use(Network).loadComplete({
|
||||
relays: [url],
|
||||
filters: [{kinds: [COMMAND], authors: [pubkey], "#d": [identifier]}],
|
||||
})
|
||||
}
|
||||
|
||||
ensureLoaded = (url: string) => {
|
||||
if (!this.pulled.has(url)) {
|
||||
this.pulled.add(url)
|
||||
this.app.use(Network).load({relays: [url], filters: [{kinds: [COMMAND]}]})
|
||||
this.app.use(Network).loadLenient({relays: [url], filters: [{kinds: [COMMAND]}]})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@
|
|||
history.back()
|
||||
|
||||
if (shareToChat) {
|
||||
publishRoomQuote({url, h, parent: calendarThunk.event, protect})
|
||||
publishRoomQuote({url, h, parent: calendarThunk.options.event, protect})
|
||||
}
|
||||
|
||||
pushToast({message: "Your event has been saved!"})
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
const isOwn = event.pubkey === $user.pubkey
|
||||
const profileDisplay = $profiles.display(event.pubkey).$
|
||||
const thunks = $app.use(Thunks).history
|
||||
const thunk = $app.use(Thunks).merge($thunks.filter(t => t.event.id === event.id))
|
||||
const thunk = $app.use(Thunks).merge($thunks.filter(t => t.options.event.id === event.id))
|
||||
const colorValue = colorFor(event.pubkey)
|
||||
|
||||
const reply = () => replyTo(event)
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@
|
|||
history.back()
|
||||
|
||||
if (shareToChat) {
|
||||
publishRoomQuote({url, h, parent: classifiedThunk.event, protect})
|
||||
publishRoomQuote({url, h, parent: classifiedThunk.options.event, protect})
|
||||
}
|
||||
} finally {
|
||||
loading = false
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
mergedRelays.set(urls)
|
||||
|
||||
if (!$quote) {
|
||||
$network.load({filters: getIdFilters([idOrAddress]), relays: urls})
|
||||
$network.loadLenient({filters: getIdFilters([idOrAddress]), relays: urls})
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@
|
|||
history.back()
|
||||
|
||||
if (shareToChat) {
|
||||
publishRoomQuote({url, h, parent: goalThunk.event, protect})
|
||||
publishRoomQuote({url, h, parent: goalThunk.options.event, protect})
|
||||
}
|
||||
} finally {
|
||||
loading = false
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
back()
|
||||
} else {
|
||||
pushToast({message: "Shelf created!"})
|
||||
navigate(makeLibraryPath(url, getAddress(thunk.event)))
|
||||
navigate(makeLibraryPath(url, getAddress(thunk.options.event)))
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@
|
|||
history.back()
|
||||
|
||||
if (shareToChat) {
|
||||
publishRoomQuote({url, h, parent: pollThunk.event, protect})
|
||||
publishRoomQuote({url, h, parent: pollThunk.options.event, protect})
|
||||
}
|
||||
} finally {
|
||||
loading = false
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
onDestroy(context.cleanup)
|
||||
|
||||
const events = $network.load({
|
||||
const events = $network.loadComplete({
|
||||
relays: [url],
|
||||
filters: [{authors: [pubkey], kinds: [NOTE], limit}],
|
||||
})
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
{/if}
|
||||
<div class="card card-sm">
|
||||
{#if etag}
|
||||
{#await $network.load({relays: [url, LOCAL_RELAY_URL], filters: getIdFilters([etag[1]])})}
|
||||
{#await $network.loadComplete( {relays: [url, LOCAL_RELAY_URL], filters: getIdFilters( [etag[1]], )}, )}
|
||||
<p>Loading</p>
|
||||
{:then reportedEvents}
|
||||
{#if reportedEvents.length === 0}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
const message = await thunk.waitForError()
|
||||
|
||||
if (message) {
|
||||
$app.repository.removeEvent(thunk.event.id)
|
||||
$app.repository.removeEvent(thunk.options.event.id)
|
||||
pushToast({theme: "error", message})
|
||||
} else {
|
||||
await $roomLists.removeRoom(h, url).then(publish)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
)
|
||||
|
||||
try {
|
||||
const events = await $network.load({relays, filters, signal: controller.signal})
|
||||
const events = await $network.loadComplete({relays, filters, signal: controller.signal})
|
||||
|
||||
results = sortEventsDesc(uniqBy((e: TrustedEvent) => e.id, [...events, ...results]))
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
history.back()
|
||||
|
||||
if (shareToChat) {
|
||||
publishRoomQuote({url, h: room, parent: thunk.event, protect})
|
||||
publishRoomQuote({url, h: room, parent: thunk.options.event, protect})
|
||||
}
|
||||
} finally {
|
||||
loading = false
|
||||
|
|
|
|||
|
|
@ -23,7 +23,11 @@
|
|||
const retry = (url: string) => {
|
||||
for (const child of $thunks.flatten([thunk])) {
|
||||
if (child.options.relays.includes(url)) {
|
||||
const retried = $thunks.publish({...child.options, event: child.event, relays: [url]})
|
||||
const retried = $thunks.publish({
|
||||
...child.options,
|
||||
event: child.options.event,
|
||||
relays: [url],
|
||||
})
|
||||
|
||||
if (showToastOnRetry) {
|
||||
pushToast({
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@
|
|||
const {relays, invoice, filters} = await requestInvoice()
|
||||
|
||||
await payInvoice(invoice)
|
||||
await $network.load({relays, filters})
|
||||
await $network.loadLenient({relays, filters})
|
||||
|
||||
pushToast({message: "Zap successfully sent!"})
|
||||
back()
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ export const makeFeedContext = ({
|
|||
}
|
||||
|
||||
const loadFrom = async (urls: string[], events: TrustedEvent[]) => {
|
||||
const context = await network.get().load({
|
||||
const context = await network.get().loadComplete({
|
||||
relays: urls,
|
||||
signal: controller.signal,
|
||||
filters: [
|
||||
|
|
@ -156,7 +156,7 @@ export const makeFeedContext = ({
|
|||
})
|
||||
|
||||
if (context.length > 0) {
|
||||
network.get().load({
|
||||
network.get().loadLenient({
|
||||
relays: urls,
|
||||
signal: controller.signal,
|
||||
filters: getReplyFilters(context, {kinds: [DELETE]}),
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export const derivePinnedEvents = (pubkey: string): Readable<TrustedEvent[]> =>
|
|||
.get()
|
||||
.resolver.relays([outbox(pubkey)])
|
||||
.then($relays =>
|
||||
network.get().load({relays: $relays, filters, signal: controller.signal}),
|
||||
network.get().loadLenient({relays: $relays, filters, signal: controller.signal}),
|
||||
)
|
||||
|
||||
const unsubscribe = deriveEvents(filters).subscribe(set)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export const deriveEvent = (idOrAddress: string, relays: string[] = []) =>
|
|||
repository: $app.repository,
|
||||
includeDeleted: true,
|
||||
onDerive: (filters: Filter[], hints: string[]) =>
|
||||
$app.use(Network).load({filters, relays: hints}),
|
||||
$app.use(Network).loadLenient({filters, relays: hints}),
|
||||
})(idOrAddress, relays),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export const deriveRoomPinnedEvents = (url: string, h: string): Readable<Trusted
|
|||
|
||||
const filters = getIdFilters($pins)
|
||||
|
||||
network.get().load({relays: [url], filters, signal: controller.signal})
|
||||
network.get().loadLenient({relays: [url], filters, signal: controller.signal})
|
||||
|
||||
return deriveEventsForUrl(url, filters).subscribe($events => {
|
||||
const byPin = new Map(
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ const syncUserData = () => {
|
|||
if (authors.length > 0) {
|
||||
const scenario = await router.get().resolve(authors.map(author => outbox(author)))
|
||||
|
||||
network.get().load({
|
||||
network.get().loadLenient({
|
||||
filters: [{kinds: [FOLLOWS, MUTES], authors}],
|
||||
relays: scenario.limit(8).getUrls(),
|
||||
})
|
||||
|
|
@ -295,7 +295,7 @@ const syncSpace = (url: string) => {
|
|||
// Which sections a space offers is a question about its whole history rather than about the
|
||||
// recent window above — a space whose newest poll is a year old still has polls. One event
|
||||
// per kind answers it.
|
||||
network.get().load({
|
||||
network.get().loadLenient({
|
||||
relays: [url],
|
||||
signal: controller.signal,
|
||||
filters: CONTENT_KINDS.map(kind => ({kinds: [kind], limit: 1})),
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ export const thunksByEventId = derived(
|
|||
const byId = new Map<string, Thunk[]>()
|
||||
|
||||
for (const thunk of $history) {
|
||||
pushToMapKey(byId, thunk.event.id, thunk)
|
||||
pushToMapKey(byId, thunk.options.event.id, thunk)
|
||||
}
|
||||
|
||||
// Hand back the array from last time wherever an event's thunks are unchanged. A row derives
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
let found = false
|
||||
|
||||
$network.load({
|
||||
$network.loadComplete({
|
||||
relays: [LOCAL_RELAY_URL, ...data.relays],
|
||||
filters: getIdFilters([type === "nevent" ? data.id : Address.fromNaddr(bech32).toString()]),
|
||||
onEvent: (event: TrustedEvent) => {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
filters.push({kinds: [FOLLOWS], "#p": [pubkey], limit: 500})
|
||||
}
|
||||
|
||||
$network.load({
|
||||
$network.loadLenient({
|
||||
relays: await $router.resolver.relays([outbox(pubkey)]),
|
||||
filters,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -145,10 +145,10 @@
|
|||
}
|
||||
|
||||
draftKey.clear()
|
||||
goto(makeArticlePath(url, getAddress(thunk.event)))
|
||||
goto(makeArticlePath(url, getAddress(thunk.options.event)))
|
||||
|
||||
if (shareToChat) {
|
||||
publishRoomQuote({url, h, parent: thunk.event, protect})
|
||||
publishRoomQuote({url, h, parent: thunk.options.event, protect})
|
||||
}
|
||||
} finally {
|
||||
loading = false
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@
|
|||
const controller = new AbortController()
|
||||
|
||||
$network
|
||||
.load({relays: [url], filters: [{kinds: [PINBOARD, PIN]}], signal: controller.signal})
|
||||
.loadLenient({relays: [url], filters: [{kinds: [PINBOARD, PIN]}], signal: controller.signal})
|
||||
.then(() => {
|
||||
loading = false
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue