Migrate collections to new stores, change some conventions
This commit is contained in:
@@ -9,11 +9,11 @@ removeRelay(url: string, mode: RelayMode): Promise<Thunk>
|
||||
addRelay(url: string, mode: RelayMode): Promise<Thunk>
|
||||
```
|
||||
|
||||
## Inbox Relay Management (NIP 17)
|
||||
## Messaging Relay Management (NIP 17)
|
||||
|
||||
```typescript
|
||||
removeInboxRelay(url: string): Promise<Thunk>
|
||||
addInboxRelay(url: string): Promise<Thunk>
|
||||
removeMessagingRelay(url: string): Promise<Thunk>
|
||||
addMessagingRelay(url: string): Promise<Thunk>
|
||||
```
|
||||
|
||||
## Profile Management (NIP 01)
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ defaultSocketPolicies.push(
|
||||
|
||||
// This will fetch the user's profile automatically, and return a store that updates
|
||||
// automatically. Several different stores exist that are ready to go, including handles,
|
||||
// zappers, relaySelections, relays, follows, mutes.
|
||||
// zappers, relayLists, relays, follows, mutes.
|
||||
const profile = deriveProfile(pubkey.get())
|
||||
|
||||
// Publish is done using thunks, which optimistically publish to the local database, deferring
|
||||
|
||||
@@ -59,8 +59,8 @@ pins → pinsByPubkey → derivePins → loadPins
|
||||
|
||||
// Relays
|
||||
relays → relaysByUrl → deriveRelay → loadRelay
|
||||
relaySelections → relaySelectionsByPubkey → deriveRelaySelections → loadRelaySelections
|
||||
inboxRelaySelections → inboxRelaySelectionsByPubkey → deriveInboxRelaySelections → loadInboxRelaySelections
|
||||
relayLists → relayListsByPubkey → deriveRelayLists → loadRelayLists
|
||||
messagingRelayLists → messagingRelayListsByPubkey → deriveMessagingRelayLists → loadMessagingRelayLists
|
||||
|
||||
// Identity
|
||||
handles → handlesByNip05 → deriveHandle → loadHandle
|
||||
|
||||
@@ -57,8 +57,8 @@ Several thunk factories are provided for common or more complicated scenarios li
|
||||
|
||||
- `removeRelay(url: string, mode: RelayMode)`
|
||||
- `addRelay(url: string, mode: RelayMode)`
|
||||
- `removeInboxRelay(url: string)`
|
||||
- `addInboxRelay(url: string)`
|
||||
- `removeMessagingRelay(url: string)`
|
||||
- `addMessagingRelay(url: string)`
|
||||
- `setProfile(profile: Profile)`
|
||||
- `unfollow(value: string)`
|
||||
- `follow(tag: string[])`
|
||||
|
||||
+8
-8
@@ -39,10 +39,10 @@ export const userMutes: Store<List | undefined>
|
||||
export const userPins: Store<List | undefined>
|
||||
|
||||
// User relay selections
|
||||
export const userRelaySelections: Store<List | undefined>
|
||||
export const userRelayLists: Store<List | undefined>
|
||||
|
||||
// User inbox relay selections
|
||||
export const userInboxRelaySelections: Store<List | undefined>
|
||||
// User messaging relay selections
|
||||
export const userMessagingRelayLists: Store<List | undefined>
|
||||
|
||||
// User blossom servers
|
||||
export const userBlossomServers: Store<List | undefined>
|
||||
@@ -66,10 +66,10 @@ function loadUserMutes(relays?: string[], force?: boolean): Promise<void>
|
||||
function loadUserPins(relays?: string[], force?: boolean): Promise<void>
|
||||
|
||||
// Load user relay selections
|
||||
function loadUserRelaySelections(relays?: string[], force?: boolean): Promise<void>
|
||||
function loadUserRelayLists(relays?: string[], force?: boolean): Promise<void>
|
||||
|
||||
// Load user inbox relay selections
|
||||
function loadUserInboxRelaySelections(relays?: string[], force?: boolean): Promise<void>
|
||||
// Load user messaging relay selections
|
||||
function loadUserMessagingRelayLists(relays?: string[], force?: boolean): Promise<void>
|
||||
|
||||
// Load user blossom servers
|
||||
function loadUserBlossomServers(relays?: string[], force?: boolean): Promise<void>
|
||||
@@ -94,13 +94,13 @@ const follows = userFollows.get()
|
||||
|
||||
### Manual Loading
|
||||
```typescript
|
||||
import { loadUserMutes, loadUserRelaySelections } from '@welshman/app'
|
||||
import { loadUserMutes, loadUserRelayLists } from '@welshman/app'
|
||||
|
||||
// Load user mutes from specific relays
|
||||
await loadUserMutes(['wss://relay1.com', 'wss://relay2.com'])
|
||||
|
||||
// Force refresh user relay selections
|
||||
await loadUserRelaySelections([], true)
|
||||
await loadUserRelayLists([], true)
|
||||
|
||||
// Load from default relays
|
||||
await loadUserProfile()
|
||||
|
||||
Reference in New Issue
Block a user