forked from coracle/flotilla
Bump welshman
This commit is contained in:
Generated
+41
-35
@@ -23,12 +23,12 @@
|
|||||||
"@tiptap/extension-text": "^2.6.6",
|
"@tiptap/extension-text": "^2.6.6",
|
||||||
"@tiptap/suggestion": "^2.6.4",
|
"@tiptap/suggestion": "^2.6.4",
|
||||||
"@types/throttle-debounce": "^5.0.2",
|
"@types/throttle-debounce": "^5.0.2",
|
||||||
"@welshman/app": "^0.0.1",
|
"@welshman/app": "^0.0.4",
|
||||||
"@welshman/lib": "^0.0.15",
|
"@welshman/lib": "^0.0.17",
|
||||||
"@welshman/net": "^0.0.20",
|
"@welshman/net": "^0.0.21",
|
||||||
"@welshman/signer": "^0.0.4",
|
"@welshman/signer": "^0.0.5",
|
||||||
"@welshman/store": "^0.0.4",
|
"@welshman/store": "^0.0.5",
|
||||||
"@welshman/util": "^0.0.28",
|
"@welshman/util": "^0.0.30",
|
||||||
"daisyui": "^4.12.10",
|
"daisyui": "^4.12.10",
|
||||||
"fuse.js": "^7.0.0",
|
"fuse.js": "^7.0.0",
|
||||||
"idb": "^8.0.0",
|
"idb": "^8.0.0",
|
||||||
@@ -1654,19 +1654,25 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@welshman/app": {
|
"node_modules/@welshman/app": {
|
||||||
"version": "0.0.1",
|
"version": "0.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@welshman/app/-/app-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@welshman/app/-/app-0.0.4.tgz",
|
||||||
"integrity": "sha512-3vvbfOwMhY6iSyswhTlmL1TCkHVF7nlpxUVvbNpgS4KD2gIs4YFr9WqAlSL4x1Ebjdm0EE3KakCr3YodP5kIOg==",
|
"integrity": "sha512-Xouy66xz1tnMjlDAlxtKF+1lHVJyM2sRiC6RONDmt75HXUnuvMX19sssRy4AFwb8jychBr8EMjYanVX2EV1Sow==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@welshman/lib": "0.0.15",
|
"@welshman/lib": "0.0.17",
|
||||||
"@welshman/util": "0.0.28",
|
"@welshman/net": "0.0.21",
|
||||||
"svelte": "^4.2.18"
|
"@welshman/signer": "0.0.5",
|
||||||
|
"@welshman/store": "0.0.5",
|
||||||
|
"@welshman/util": "0.0.30",
|
||||||
|
"fuse.js": "^7.0.0",
|
||||||
|
"idb": "^8.0.0",
|
||||||
|
"svelte": "^4.2.18",
|
||||||
|
"throttle-debounce": "^5.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@welshman/lib": {
|
"node_modules/@welshman/lib": {
|
||||||
"version": "0.0.15",
|
"version": "0.0.17",
|
||||||
"resolved": "https://registry.npmjs.org/@welshman/lib/-/lib-0.0.15.tgz",
|
"resolved": "https://registry.npmjs.org/@welshman/lib/-/lib-0.0.17.tgz",
|
||||||
"integrity": "sha512-3sKbLHq+G57Cc1E9rRx1QeaNo+Oy/rE+bko7SJBq+p9L65xOxXal8rfrlCoiyKWiJLIkDMwSWtitCWjYR2DP8w==",
|
"integrity": "sha512-C0yelgMD6F5hgIcDjflJ+1Qg9/yvodtxSE00p1DZgkTn0s/7znvxraYpQInQdhqp8vJ8r+3coR3YagrRdm9+LA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@scure/base": "^1.1.6",
|
"@scure/base": "^1.1.6",
|
||||||
"@types/events": "^3.0.3",
|
"@types/events": "^3.0.3",
|
||||||
@@ -1676,43 +1682,43 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@welshman/net": {
|
"node_modules/@welshman/net": {
|
||||||
"version": "0.0.20",
|
"version": "0.0.21",
|
||||||
"resolved": "https://registry.npmjs.org/@welshman/net/-/net-0.0.20.tgz",
|
"resolved": "https://registry.npmjs.org/@welshman/net/-/net-0.0.21.tgz",
|
||||||
"integrity": "sha512-GPoQ3cuPV5t9gqhRoKQ2xxyVejdbQLqyXY6OxwXwtuSikbWt4Y9QWw/CwENn2doQ2JnE1lVkIoO7xwHJxPcPlQ==",
|
"integrity": "sha512-BOWRevNJjyNHshxr0eFn/yBjjVIuvofyy/Q+eYuLLTRwolFkqmaiN8xuG3wFndPi5z2uuC87Ay4PmRTzp+kCSg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@welshman/lib": "0.0.15",
|
"@welshman/lib": "0.0.17",
|
||||||
"@welshman/util": "0.0.28",
|
"@welshman/util": "0.0.30",
|
||||||
"isomorphic-ws": "^5.0.0",
|
"isomorphic-ws": "^5.0.0",
|
||||||
"ws": "^8.16.0"
|
"ws": "^8.16.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@welshman/signer": {
|
"node_modules/@welshman/signer": {
|
||||||
"version": "0.0.4",
|
"version": "0.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/@welshman/signer/-/signer-0.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@welshman/signer/-/signer-0.0.5.tgz",
|
||||||
"integrity": "sha512-CX6mdLDkbtOQ8jXo0RNhAmBflZ52j896BPZJRbMXk0B9yC8L7df//gPOimAYy+ffZV7NOb495LaBsrwfvJhKcw==",
|
"integrity": "sha512-i3SUEF4yAb8up2qk6hdLyRytnkRt5W+5KyrbN1RmFcQpDC/foa3nYO+Q0mydwXIX3h6HAV7MzO8vi9tHWJ30Ww==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@welshman/lib": "0.0.15",
|
"@welshman/lib": "0.0.17",
|
||||||
"@welshman/net": "0.0.20",
|
"@welshman/net": "0.0.21",
|
||||||
"@welshman/util": "0.0.28",
|
"@welshman/util": "0.0.30",
|
||||||
"nostr-tools": "^2.7.2"
|
"nostr-tools": "^2.7.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@welshman/store": {
|
"node_modules/@welshman/store": {
|
||||||
"version": "0.0.4",
|
"version": "0.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/@welshman/store/-/store-0.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@welshman/store/-/store-0.0.5.tgz",
|
||||||
"integrity": "sha512-bdI89bONcJugBS7rqoLxxZfWPSHaJVOH11ohnA8uhZX7PwuWtNwUHAwwsl3YTBUMyB1Vfp5P4rsdC7LEmAQloA==",
|
"integrity": "sha512-AH8TsaZ63s4ln4NBO2/DjtmBFPZlxXnDiyV3wScj6Ts0vahZCinlrL8pAIfLzvZ2QvjcnFiPf081kghhr3Baaw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@welshman/lib": "0.0.15",
|
"@welshman/lib": "0.0.17",
|
||||||
"@welshman/util": "0.0.28",
|
"@welshman/util": "0.0.30",
|
||||||
"svelte": "^4.2.18"
|
"svelte": "^4.2.18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@welshman/util": {
|
"node_modules/@welshman/util": {
|
||||||
"version": "0.0.28",
|
"version": "0.0.30",
|
||||||
"resolved": "https://registry.npmjs.org/@welshman/util/-/util-0.0.28.tgz",
|
"resolved": "https://registry.npmjs.org/@welshman/util/-/util-0.0.30.tgz",
|
||||||
"integrity": "sha512-2U77yGM1cc9UeM8L8YQvqxSClv9x1q9u94rJYajGV0LJx3O0Iog4gRlb8aPei8fSHst92JemcqF45ghrFTCeeQ==",
|
"integrity": "sha512-CYLtaXfCod5Xo/OCXPUGYKwT+fRwm5DU7ASqcGwPuB/vadDodT/OJPSmrMH9Pq63VY9xK4gX/I2ma/rKRokdpg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@welshman/lib": "0.0.15",
|
"@welshman/lib": "0.0.17",
|
||||||
"nostr-tools": "^2.7.2"
|
"nostr-tools": "^2.7.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
+6
-6
@@ -48,12 +48,12 @@
|
|||||||
"@tiptap/extension-text": "^2.6.6",
|
"@tiptap/extension-text": "^2.6.6",
|
||||||
"@tiptap/suggestion": "^2.6.4",
|
"@tiptap/suggestion": "^2.6.4",
|
||||||
"@types/throttle-debounce": "^5.0.2",
|
"@types/throttle-debounce": "^5.0.2",
|
||||||
"@welshman/app": "^0.0.1",
|
"@welshman/lib": "^0.0.17",
|
||||||
"@welshman/lib": "^0.0.15",
|
"@welshman/util": "^0.0.30",
|
||||||
"@welshman/net": "^0.0.20",
|
"@welshman/store": "^0.0.5",
|
||||||
"@welshman/signer": "^0.0.4",
|
"@welshman/net": "^0.0.21",
|
||||||
"@welshman/store": "^0.0.4",
|
"@welshman/signer": "^0.0.5",
|
||||||
"@welshman/util": "^0.0.28",
|
"@welshman/app": "^0.0.4",
|
||||||
"daisyui": "^4.12.10",
|
"daisyui": "^4.12.10",
|
||||||
"fuse.js": "^7.0.0",
|
"fuse.js": "^7.0.0",
|
||||||
"idb": "^8.0.0",
|
"idb": "^8.0.0",
|
||||||
|
|||||||
+7
-21
@@ -11,7 +11,7 @@ import {PublishStatus} from "@welshman/net"
|
|||||||
import {
|
import {
|
||||||
pubkey,
|
pubkey,
|
||||||
repository,
|
repository,
|
||||||
loadOne,
|
load,
|
||||||
makeThunk,
|
makeThunk,
|
||||||
publishThunk,
|
publishThunk,
|
||||||
loadProfile,
|
loadProfile,
|
||||||
@@ -56,26 +56,12 @@ export const makeIMeta = (url: string, data: Record<string, string>) => [
|
|||||||
|
|
||||||
// Loaders
|
// Loaders
|
||||||
|
|
||||||
export const loadUserData = async (pubkey: string, hints: string[] = []) => {
|
export const loadUserData = (pubkey: string, hints: string[] = []) =>
|
||||||
const relaySelections = await loadRelaySelections(pubkey, INDEXER_RELAYS)
|
Promise.all([
|
||||||
const relays = uniq([
|
loadProfile(pubkey),
|
||||||
...getRelayTagValues(relaySelections?.tags || []),
|
loadFollows(pubkey),
|
||||||
...INDEXER_RELAYS,
|
loadMutes(pubkey),
|
||||||
...hints,
|
|
||||||
])
|
])
|
||||||
const membership = await loadGroupMembership(pubkey, relays)
|
|
||||||
const promises = [
|
|
||||||
loadProfile(pubkey, relays),
|
|
||||||
loadFollows(pubkey, relays),
|
|
||||||
loadMutes(pubkey, relays),
|
|
||||||
]
|
|
||||||
|
|
||||||
for (const [_, nom, url] of getGroupTags(membership?.event.tags || [])) {
|
|
||||||
promises.push(loadGroup(nom, [url]))
|
|
||||||
}
|
|
||||||
|
|
||||||
await Promise.all(promises)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Updates
|
// Updates
|
||||||
|
|
||||||
@@ -110,7 +96,7 @@ export const sendJoinRequest = async (nom: string, url: string): Promise<[boolea
|
|||||||
|
|
||||||
if (message.includes("already a member")) return [true, ""]
|
if (message.includes("already a member")) return [true, ""]
|
||||||
if (status !== PublishStatus.Success) return [false, message]
|
if (status !== PublishStatus.Success) return [false, message]
|
||||||
if (await loadOne({filters, relays})) return [true, ""]
|
if (await load({filters, relays})) return [true, ""]
|
||||||
|
|
||||||
return [
|
return [
|
||||||
false,
|
false,
|
||||||
|
|||||||
+14
-3
@@ -1,7 +1,7 @@
|
|||||||
import type {FuseResult} from "fuse.js"
|
import type {FuseResult} from "fuse.js"
|
||||||
import {get, derived} from "svelte/store"
|
import {get, derived} from "svelte/store"
|
||||||
import type {Maybe} from "@welshman/lib"
|
import type {Maybe} from "@welshman/lib"
|
||||||
import {max, between, groupBy, pushToMapKey, nthEq, stripProtocol, indexBy} from "@welshman/lib"
|
import {setContext, max, between, groupBy, pushToMapKey, nthEq, stripProtocol, indexBy} from "@welshman/lib"
|
||||||
import {
|
import {
|
||||||
getIdFilters,
|
getIdFilters,
|
||||||
getIdentifier,
|
getIdentifier,
|
||||||
@@ -16,7 +16,6 @@ import {
|
|||||||
} from "@welshman/util"
|
} from "@welshman/util"
|
||||||
import type {TrustedEvent} from "@welshman/util"
|
import type {TrustedEvent} from "@welshman/util"
|
||||||
import {
|
import {
|
||||||
env,
|
|
||||||
pubkey,
|
pubkey,
|
||||||
repository,
|
repository,
|
||||||
createSearch,
|
createSearch,
|
||||||
@@ -28,6 +27,9 @@ import {
|
|||||||
profilesByPubkey,
|
profilesByPubkey,
|
||||||
loadRelaySelections,
|
loadRelaySelections,
|
||||||
getWriteRelayUrls,
|
getWriteRelayUrls,
|
||||||
|
getDefaultAppContext,
|
||||||
|
getDefaultNetContext,
|
||||||
|
makeRouter,
|
||||||
} from "@welshman/app"
|
} from "@welshman/app"
|
||||||
import type {Relay} from "@welshman/app"
|
import type {Relay} from "@welshman/app"
|
||||||
import type {SubscribeRequest} from "@welshman/net"
|
import type {SubscribeRequest} from "@welshman/net"
|
||||||
@@ -46,7 +48,16 @@ export const DUFFLEPUD_URL = "https://dufflepud.onrender.com"
|
|||||||
|
|
||||||
export const REACTION_KINDS = [REACTION, ZAP_RESPONSE]
|
export const REACTION_KINDS = [REACTION, ZAP_RESPONSE]
|
||||||
|
|
||||||
Object.assign(env, {DUFFLEPUD_URL})
|
setContext({
|
||||||
|
net: getDefaultNetContext(),
|
||||||
|
app: getDefaultAppContext({
|
||||||
|
dufflepudUrl: DUFFLEPUD_URL,
|
||||||
|
indexerRelays: INDEXER_RELAYS,
|
||||||
|
requestTimeout: 5000,
|
||||||
|
router: makeRouter(),
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
export const deriveEvent = (idOrAddress: string, hints: string[] = []) => {
|
export const deriveEvent = (idOrAddress: string, hints: string[] = []) => {
|
||||||
let attempted = false
|
let attempted = false
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
publishStatusData,
|
publishStatusData,
|
||||||
plaintext,
|
plaintext,
|
||||||
freshness,
|
freshness,
|
||||||
|
storageAdapters,
|
||||||
} from "@welshman/app"
|
} from "@welshman/app"
|
||||||
import type {PublishStatusData, PublishStatusDataByUrlById} from "@welshman/app"
|
import type {PublishStatusData, PublishStatusDataByUrlById} from "@welshman/app"
|
||||||
import {createEventStore, adapter} from "@welshman/store"
|
import {createEventStore, adapter} from "@welshman/store"
|
||||||
@@ -59,7 +60,7 @@
|
|||||||
onMount(() => {
|
onMount(() => {
|
||||||
Object.assign(window, {get, state})
|
Object.assign(window, {get, state})
|
||||||
|
|
||||||
ready = initStorage(3, {
|
ready = initStorage('flotilla', 3, {
|
||||||
events: {
|
events: {
|
||||||
keyPath: "id",
|
keyPath: "id",
|
||||||
store: createEventStore(repository),
|
store: createEventStore(repository),
|
||||||
@@ -72,67 +73,9 @@
|
|||||||
keyPath: "nip05",
|
keyPath: "nip05",
|
||||||
store: handles,
|
store: handles,
|
||||||
},
|
},
|
||||||
publishStatus: {
|
publishStatus: storageAdapters.fromObjectStore(publishStatusData),
|
||||||
keyPath: "id",
|
freshness: storageAdapters.fromObjectStore(freshness),
|
||||||
store: adapter({
|
plaintext: storageAdapters.fromObjectStore(plaintext),
|
||||||
store: publishStatusData,
|
|
||||||
forward: ($psd: PublishStatusDataByUrlById) => {
|
|
||||||
const data = []
|
|
||||||
|
|
||||||
for (const itemsByUrl of Object.values($psd)) {
|
|
||||||
for (const item of Object.values(itemsByUrl)) {
|
|
||||||
data.push(item)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return data
|
|
||||||
},
|
|
||||||
backward: (data: PublishStatusData[]) => {
|
|
||||||
const result: PublishStatusDataByUrlById = {}
|
|
||||||
|
|
||||||
for (const item of data) {
|
|
||||||
result[item.id] = result[item.id] || {}
|
|
||||||
result[item.id][item.url] = item
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
freshness: {
|
|
||||||
keyPath: "key",
|
|
||||||
store: adapter({
|
|
||||||
store: freshness,
|
|
||||||
forward: ($freshness: Record<string, number>) =>
|
|
||||||
Object.entries($freshness).map(([key, ts]) => ({key, ts})),
|
|
||||||
backward: (data: any[]) => {
|
|
||||||
const result: Record<string, number> = {}
|
|
||||||
|
|
||||||
for (const {key, ts} of data) {
|
|
||||||
result[key] = ts
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
plaintext: {
|
|
||||||
keyPath: "id",
|
|
||||||
store: adapter({
|
|
||||||
store: plaintext,
|
|
||||||
forward: ($plaintext: Record<string, string>) =>
|
|
||||||
Object.entries($plaintext).map(([id, plaintext]) => ({id, plaintext})),
|
|
||||||
backward: (data: any[]) => {
|
|
||||||
const result: Record<string, string> = {}
|
|
||||||
|
|
||||||
for (const {id, plaintext} of data) {
|
|
||||||
result[id] = plaintext
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
}).then(() => sleep(300)) // Wait an extra few ms because of repository throttle
|
}).then(() => sleep(300)) // Wait an extra few ms because of repository throttle
|
||||||
|
|
||||||
dialog.addEventListener("close", () => {
|
dialog.addEventListener("close", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user