Upgrade welshman to 0.10.2
This commit is contained in:
parent
00413df68f
commit
7eb1c8c141
13 changed files with 41 additions and 34 deletions
|
|
@ -13,7 +13,7 @@ import {
|
|||
import type {EventTemplate, HashedEvent, SignedEvent, StampedEvent} from "@welshman/util"
|
||||
import {Nip59} from "@welshman/signer"
|
||||
import {DirectMessage, EventWriter, Profile} from "@welshman/domain"
|
||||
import type {BaseEventReader, ConfiguredKind, KindFactory} from "@welshman/domain"
|
||||
import type {BaseEventReader, ConfiguredKind, EventQuery, KindFactory} from "@welshman/domain"
|
||||
import type {RoomOptions, TestRelay} from "../zooid/types"
|
||||
import type {Zooid} from "../zooid/relay"
|
||||
import type {TenantName} from "../zooid/config"
|
||||
|
|
@ -81,9 +81,9 @@ export type SeededSpace = {
|
|||
// This space's domain kinds, bound to a resolver that answers with its url, so a writer built
|
||||
// here renders its relay hints as this space. For everything `event()` takes a template for:
|
||||
// `space.event(user, () => space.kind(Article).writer().setTitle("x").renderTemplate())`.
|
||||
kind<R extends BaseEventReader, W extends EventWriter<R>>(
|
||||
factory: KindFactory<R, W>,
|
||||
): ConfiguredKind<R, W>
|
||||
kind<R extends BaseEventReader, W extends EventWriter<R>, Q extends EventQuery>(
|
||||
factory: KindFactory<R, W, Q>,
|
||||
): ConfiguredKind<R, W, Q>
|
||||
}
|
||||
|
||||
export type SeedSpaceOptions = {
|
||||
|
|
@ -209,8 +209,9 @@ export const seedSpace = ({zooid, enqueue, startedAt, name}: SeedSpaceOptions):
|
|||
created_at: createdAt,
|
||||
}))
|
||||
|
||||
const kind = <R extends BaseEventReader, W extends EventWriter<R>>(factory: KindFactory<R, W>) =>
|
||||
factory.configure(context)
|
||||
const kind = <R extends BaseEventReader, W extends EventWriter<R>, Q extends EventQuery>(
|
||||
factory: KindFactory<R, W, Q>,
|
||||
) => factory.configure(context)
|
||||
|
||||
// Every wrap is published over the sender's own connection, since a gift wrap's author is an
|
||||
// ephemeral key nobody in this process can authenticate as. zooid stores it anyway, authorizing a
|
||||
|
|
|
|||
20
package.json
20
package.json
|
|
@ -82,16 +82,16 @@
|
|||
"@types/throttle-debounce": "^5.0.2",
|
||||
"@vite-pwa/assets-generator": "^1.0.2",
|
||||
"@vite-pwa/sveltekit": "^1.1.0",
|
||||
"@welshman/app": "^0.9.10",
|
||||
"@welshman/content": "^0.9.10",
|
||||
"@welshman/domain": "^0.9.10",
|
||||
"@welshman/editor": "^0.9.10",
|
||||
"@welshman/feeds": "^0.9.10",
|
||||
"@welshman/lib": "^0.9.10",
|
||||
"@welshman/net": "^0.9.10",
|
||||
"@welshman/signer": "^0.9.10",
|
||||
"@welshman/store": "^0.9.10",
|
||||
"@welshman/util": "^0.9.10",
|
||||
"@welshman/app": "^0.10.2",
|
||||
"@welshman/content": "^0.10.2",
|
||||
"@welshman/domain": "^0.10.2",
|
||||
"@welshman/editor": "^0.10.2",
|
||||
"@welshman/feeds": "^0.10.2",
|
||||
"@welshman/lib": "^0.10.2",
|
||||
"@welshman/net": "^0.10.2",
|
||||
"@welshman/signer": "^0.10.2",
|
||||
"@welshman/store": "^0.10.2",
|
||||
"@welshman/util": "^0.10.2",
|
||||
"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.
|
|
@ -7,6 +7,7 @@ import {
|
|||
isRelayUrl,
|
||||
makeEvent,
|
||||
normalizeRelayUrl,
|
||||
relay,
|
||||
FOLLOWS,
|
||||
MESSAGING_RELAYS,
|
||||
PROFILE,
|
||||
|
|
@ -101,7 +102,7 @@ export const deriveRelayAuthError = (url: string) =>
|
|||
})
|
||||
|
||||
export const publishJoinRequest = (url: string, claim?: string) => {
|
||||
const eventWriter = writer(RelayJoin).forceRelays(url)
|
||||
const eventWriter = writer(RelayJoin).forceRoutes(relay(url))
|
||||
|
||||
if (claim) {
|
||||
eventWriter.setClaim(claim)
|
||||
|
|
@ -111,7 +112,7 @@ export const publishJoinRequest = (url: string, claim?: string) => {
|
|||
}
|
||||
|
||||
export const publishLeaveRequest = (url: string) =>
|
||||
command(writer(RelayLeave).forceRelays(url)).then(publish)
|
||||
command(writer(RelayLeave).forceRoutes(relay(url))).then(publish)
|
||||
|
||||
// A relay answers a re-sent request with "duplicate:" and a membership it already has with
|
||||
// "already a member" — both leave us where we wanted to be, so only anything else is a refusal.
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
import type {Snippet} from "svelte"
|
||||
import {writable} from "svelte/store"
|
||||
import {randomId} from "@welshman/lib"
|
||||
import {relay} from "@welshman/util"
|
||||
import {publish} from "@welshman/app"
|
||||
import {TimeEvent} from "@welshman/domain"
|
||||
import {preventDefault} from "@lib/html"
|
||||
|
|
@ -100,7 +101,7 @@
|
|||
if (h) {
|
||||
eventWriter.setRoom(url, h)
|
||||
} else {
|
||||
eventWriter.forceRelays(url)
|
||||
eventWriter.forceRoutes(relay(url))
|
||||
}
|
||||
|
||||
const calendarThunk = await command(eventWriter).then(publish)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<script lang="ts">
|
||||
import type {Snippet} from "svelte"
|
||||
import {removeUndefined, randomId, uniq} from "@welshman/lib"
|
||||
import {relay} from "@welshman/util"
|
||||
import {publish} from "@welshman/app"
|
||||
import {Classified} from "@welshman/domain"
|
||||
import {isMobile, preventDefault} from "@lib/html"
|
||||
|
|
@ -112,7 +113,7 @@
|
|||
if (h) {
|
||||
eventWriter.setRoom(url, h)
|
||||
} else {
|
||||
eventWriter.forceRelays(url)
|
||||
eventWriter.forceRoutes(relay(url))
|
||||
}
|
||||
|
||||
const classifiedThunk = await command(eventWriter).then(publish)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<script lang="ts">
|
||||
import {writable} from "svelte/store"
|
||||
import {relay} from "@welshman/util"
|
||||
import {ZapGoal} from "@welshman/domain"
|
||||
import {publish} from "@welshman/app"
|
||||
import {isMobile, preventDefault} from "@lib/html"
|
||||
|
|
@ -84,7 +85,7 @@
|
|||
.setUrls([url])
|
||||
.setProtected(protect)
|
||||
.addTags(...ed.storage.nostr.getEditorTags())
|
||||
.forceRelays(url)
|
||||
.forceRoutes(relay(url))
|
||||
|
||||
if (h) {
|
||||
eventWriter.setRoom(url, h)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<script lang="ts">
|
||||
import {insertAt, now, randomId, removeAt, removeUndefined, spec} from "@welshman/lib"
|
||||
import {relay} from "@welshman/util"
|
||||
import {publish} from "@welshman/app"
|
||||
import {Poll} from "@welshman/domain"
|
||||
import type {PollType} from "@welshman/domain"
|
||||
|
|
@ -139,7 +140,7 @@
|
|||
if (h) {
|
||||
eventWriter.setRoom(url, h)
|
||||
} else {
|
||||
eventWriter.forceRelays(url)
|
||||
eventWriter.forceRoutes(relay(url))
|
||||
}
|
||||
|
||||
const pollThunk = await command(eventWriter).then(publish)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
import {onDestroy} from "svelte"
|
||||
import {formatTimestampRelative} from "@welshman/lib"
|
||||
import type {TrustedEvent} from "@welshman/util"
|
||||
import {POLL_RESPONSE, tagSpec, tagValues} from "@welshman/util"
|
||||
import {POLL_RESPONSE, tagSpec, tagValues, relay} from "@welshman/util"
|
||||
import {Poll, PollResponse} from "@welshman/domain"
|
||||
import type {Thunk} from "@welshman/app"
|
||||
import PollOption from "@app/components/PollOption.svelte"
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
activeThunk = undefined
|
||||
|
||||
if (selection.length > 0) {
|
||||
const eventWriter = writer(PollResponse).forceRelays(url).setPollId(event.id)
|
||||
const eventWriter = writer(PollResponse).forceRoutes(relay(url)).setPollId(event.id)
|
||||
|
||||
for (const id of selection) {
|
||||
eventWriter.addSelection(id)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<script lang="ts">
|
||||
import {writable} from "svelte/store"
|
||||
import {relay} from "@welshman/util"
|
||||
import {Thread} from "@welshman/domain"
|
||||
import {publish} from "@welshman/app"
|
||||
import {isMobile, preventDefault} from "@lib/html"
|
||||
|
|
@ -74,7 +75,7 @@
|
|||
.setTitle(title)
|
||||
.setProtected(protect)
|
||||
.addTags(...ed.storage.nostr.getEditorTags())
|
||||
.forceRelays(url)
|
||||
.forceRoutes(relay(url))
|
||||
|
||||
if (h) {
|
||||
eventWriter.setRoom(url, h)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import {
|
|||
appPolicyWraps,
|
||||
} from "@welshman/app"
|
||||
import type {AppPolicy, DerivedPlugin, Plugin, Session} from "@welshman/app"
|
||||
import type {BaseEventReader, EventWriter, KindFactory} from "@welshman/domain"
|
||||
import type {BaseEventReader, EventQuery, EventWriter, KindFactory} from "@welshman/domain"
|
||||
import {DEFAULT_RELAYS, DEFAULT_SEARCH_RELAYS, DUFFLEPUD_URL, INDEXER_RELAYS} from "@app/env"
|
||||
|
||||
// Flotilla's own policies (ingest, sockets, storage) can't be imported here — they depend on
|
||||
|
|
@ -172,12 +172,12 @@ export const userSearchRelayUrls = withGetter(
|
|||
)
|
||||
|
||||
// The domain entry points, since almost every read or write goes through one of them.
|
||||
export const reader = <R extends BaseEventReader, W extends EventWriter<R>>(
|
||||
factory: KindFactory<R, W>,
|
||||
export const reader = <R extends BaseEventReader, W extends EventWriter<R>, Q extends EventQuery>(
|
||||
factory: KindFactory<R, W, Q>,
|
||||
) => domain.get().reader(factory)
|
||||
|
||||
export const writer = <R extends BaseEventReader, W extends EventWriter<R>>(
|
||||
factory: KindFactory<R, W>,
|
||||
export const writer = <R extends BaseEventReader, W extends EventWriter<R>, Q extends EventQuery>(
|
||||
factory: KindFactory<R, W, Q>,
|
||||
seed?: R,
|
||||
) => domain.get().writer(factory, seed)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import {derived} from "svelte/store"
|
||||
import {APP_DATA, tagSpec, tagValues} from "@welshman/util"
|
||||
import {APP_DATA, tagSpec, tagValues, relay} from "@welshman/util"
|
||||
import {AppData} from "@welshman/domain"
|
||||
import {Domain} from "@welshman/app"
|
||||
import {app} from "@app/core"
|
||||
|
|
@ -27,7 +27,7 @@ export const setFeaturedContent = async (url: string, content: string[]) => {
|
|||
.get()
|
||||
.use(Domain)
|
||||
.writer(AppData)
|
||||
.forceRelays(url)
|
||||
.forceRoutes(relay(url))
|
||||
.setIdentifier(FEATURED_CONTENT_D)
|
||||
.addTags(...tags)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
import {page} from "$app/stores"
|
||||
import {goto} from "$app/navigation"
|
||||
import {now, randomId} from "@welshman/lib"
|
||||
import {getAddress} from "@welshman/util"
|
||||
import {getAddress, relay} from "@welshman/util"
|
||||
import {Article} from "@welshman/domain"
|
||||
import {publish} from "@welshman/app"
|
||||
import {isMobile} from "@lib/html"
|
||||
|
|
@ -118,7 +118,7 @@
|
|||
.setPublishedAt(now())
|
||||
.setProtected(protect)
|
||||
.addTags(...ed.storage.nostr.getEditorTags())
|
||||
.forceRelays(url)
|
||||
.forceRoutes(relay(url))
|
||||
|
||||
if (summary) {
|
||||
eventWriter.setSummary(summary)
|
||||
|
|
|
|||
Loading…
Reference in a new issue