Bump welshman

This commit is contained in:
Jon Staab
2024-12-11 16:59:16 -08:00
parent 167cd045f4
commit daf5cc84bd
6 changed files with 58 additions and 54 deletions

70
package-lock.json generated
View File

@@ -28,17 +28,16 @@
"@tiptap/extension-text": "^2.6.6",
"@tiptap/suggestion": "^2.6.4",
"@types/qrcode": "^1.5.5",
"@types/throttle-debounce": "^5.0.2",
"@vite-pwa/assets-generator": "^0.2.6",
"@vite-pwa/sveltekit": "^0.6.6",
"@welshman/app": "~0.0.32",
"@welshman/app": "~0.0.33",
"@welshman/content": "~0.0.13",
"@welshman/dvm": "~0.0.10",
"@welshman/dvm": "~0.0.11",
"@welshman/feeds": "~0.0.26",
"@welshman/lib": "~0.0.28",
"@welshman/net": "~0.0.40",
"@welshman/lib": "~0.0.30",
"@welshman/net": "~0.0.41",
"@welshman/signer": "~0.0.16",
"@welshman/store": "~0.0.12",
"@welshman/store": "~0.0.13",
"@welshman/util": "~0.0.48",
"daisyui": "^4.12.10",
"date-picker-svelte": "^2.13.0",
@@ -52,8 +51,7 @@
"nostr-tools": "^2.7.2",
"prettier-plugin-tailwindcss": "^0.6.5",
"qrcode": "^1.5.4",
"svelte-tiptap": "^1.1.3",
"throttle-debounce": "^5.0.2"
"svelte-tiptap": "^1.1.3"
},
"devDependencies": {
"@capacitor/assets": "^3.0.5",
@@ -4664,17 +4662,18 @@
}
},
"node_modules/@welshman/app": {
"version": "0.0.32",
"resolved": "https://registry.npmjs.org/@welshman/app/-/app-0.0.32.tgz",
"integrity": "sha512-f3JQq4JgR2fCeAOWbjsq1w+tv3U80NhuhAcq1qMBT+DRfHPw/LdYN6U10u+pL2tZbwBbPNs8cTJ/p7Lqy5GJzw==",
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/@welshman/app/-/app-0.0.33.tgz",
"integrity": "sha512-TtyeC/eysNV2hLuD1ST3KaSt1h9nes0Px1v+XP10eh4ckTJ1CE0Ee9Sb7JVTScUSfBuqs3SUX6GM7ZvuGmCnFg==",
"license": "MIT",
"dependencies": {
"@welshman/dvm": "~0.0.10",
"@types/throttle-debounce": "^5.0.2",
"@welshman/dvm": "~0.0.11",
"@welshman/feeds": "~0.0.26",
"@welshman/lib": "~0.0.28",
"@welshman/net": "~0.0.40",
"@welshman/lib": "~0.0.29",
"@welshman/net": "~0.0.41",
"@welshman/signer": "~0.0.16",
"@welshman/store": "~0.0.12",
"@welshman/store": "~0.0.13",
"@welshman/util": "~0.0.48",
"fuse.js": "^7.0.0",
"idb": "^8.0.0",
@@ -4694,13 +4693,14 @@
}
},
"node_modules/@welshman/dvm": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/@welshman/dvm/-/dvm-0.0.10.tgz",
"integrity": "sha512-9MlwSmsFeczt+tirKWBenOaWRy1QzcXj0V4Ibc4O2ZdpGkybR3AI79uYLwAI+TG/pkEzHqY+1i7OXfjhBXqlyw==",
"version": "0.0.11",
"resolved": "https://registry.npmjs.org/@welshman/dvm/-/dvm-0.0.11.tgz",
"integrity": "sha512-V/DPk3wCZhqa1NBWrb2Zcml+kkEKIdW9ORC7s71A2/np1IR+y6Gh1StI5qQUXyEmh/igQocMp+U9tIDect6azg==",
"license": "MIT",
"dependencies": {
"@welshman/lib": "~0.0.21",
"@welshman/net": "~0.0.25",
"@welshman/util": "~0.0.37",
"@welshman/lib": "~0.0.29",
"@welshman/net": "~0.0.41",
"@welshman/util": "~0.0.48",
"nostr-tools": "^2.7.2"
}
},
@@ -4715,25 +4715,23 @@
}
},
"node_modules/@welshman/lib": {
"version": "0.0.28",
"resolved": "https://registry.npmjs.org/@welshman/lib/-/lib-0.0.28.tgz",
"integrity": "sha512-9BJm7j2NtPveUtlyiJ/b/LhW93ShR/7csmWl0nUXTbra6be3/7vz8RpN4xl+tBmnvgkOSFjYw5y+srKMZ5f2YA==",
"version": "0.0.30",
"resolved": "https://registry.npmjs.org/@welshman/lib/-/lib-0.0.30.tgz",
"integrity": "sha512-UeYFh9H3m7NfsokyaOeOCAdp4dg2uv20+XtkDxlaLVMMJDtuePBLJBYQJKuxMavGAJURr4pXt2Xna53hN/R5Lg==",
"license": "MIT",
"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"
"events": "^3.3.0"
}
},
"node_modules/@welshman/net": {
"version": "0.0.40",
"resolved": "https://registry.npmjs.org/@welshman/net/-/net-0.0.40.tgz",
"integrity": "sha512-GdvnxWlzNeARw1v3HfJzFcEGccHj4njFclZFdDfe11qqGZcpNvbDdmJ0gPyY2cCeUnaV+9W7o7DYV9JZwTRUng==",
"version": "0.0.41",
"resolved": "https://registry.npmjs.org/@welshman/net/-/net-0.0.41.tgz",
"integrity": "sha512-0NWF+H03dQNJP9q/2XQRfKDVWQXZxUksJSFm1V4OrlaMjeekg9SOkdmHlYDkiF+otMZYXr3OUkqktslm7I7c8Q==",
"license": "MIT",
"dependencies": {
"@welshman/lib": "~0.0.28",
"@welshman/lib": "~0.0.29",
"@welshman/util": "~0.0.48",
"isomorphic-ws": "^5.0.0",
"ws": "^8.16.0"
@@ -4755,13 +4753,13 @@
}
},
"node_modules/@welshman/store": {
"version": "0.0.12",
"resolved": "https://registry.npmjs.org/@welshman/store/-/store-0.0.12.tgz",
"integrity": "sha512-69ONyeKOIG0Ba1tEoRPW4JnRaag7yargRS2WhXtyYsbfvQErivWBWLgM4wJz9Qovd+RxljssUswJfDHnZ2FCNQ==",
"version": "0.0.13",
"resolved": "https://registry.npmjs.org/@welshman/store/-/store-0.0.13.tgz",
"integrity": "sha512-yWHa9CTgdGzlTeGDOF6vmZ8V9ZUiF7yloxNvxe91NdxRymYdjoSExGIFsbgBxnj2RN6VDMkALdWLRrrTxNArBQ==",
"license": "MIT",
"dependencies": {
"@welshman/lib": "~0.0.23",
"@welshman/util": "~0.0.42",
"@welshman/lib": "~0.0.29",
"@welshman/util": "~0.0.48",
"svelte": "^4.2.18"
}
},

View File

@@ -56,17 +56,16 @@
"@tiptap/extension-text": "^2.6.6",
"@tiptap/suggestion": "^2.6.4",
"@types/qrcode": "^1.5.5",
"@types/throttle-debounce": "^5.0.2",
"@vite-pwa/assets-generator": "^0.2.6",
"@vite-pwa/sveltekit": "^0.6.6",
"@welshman/app": "~0.0.32",
"@welshman/app": "~0.0.33",
"@welshman/content": "~0.0.13",
"@welshman/dvm": "~0.0.10",
"@welshman/dvm": "~0.0.11",
"@welshman/feeds": "~0.0.26",
"@welshman/lib": "~0.0.28",
"@welshman/net": "~0.0.40",
"@welshman/lib": "~0.0.30",
"@welshman/net": "~0.0.41",
"@welshman/signer": "~0.0.16",
"@welshman/store": "~0.0.12",
"@welshman/store": "~0.0.13",
"@welshman/util": "~0.0.48",
"daisyui": "^4.12.10",
"date-picker-svelte": "^2.13.0",
@@ -80,7 +79,6 @@
"nostr-tools": "^2.7.2",
"prettier-plugin-tailwindcss": "^0.6.5",
"qrcode": "^1.5.4",
"svelte-tiptap": "^1.1.3",
"throttle-debounce": "^5.0.2"
"svelte-tiptap": "^1.1.3"
}
}

View File

@@ -1,11 +1,11 @@
import type {Unsubscriber} from "svelte/store"
import {sleep, partition, assoc, now, sortBy} from "@welshman/lib"
import {sleep, partition, assoc, now} from "@welshman/lib"
import {MESSAGE, DELETE, THREAD, COMMENT} from "@welshman/util"
import type {SubscribeRequestWithHandlers, Subscription} from "@welshman/net"
import {SubscriptionEvent} from "@welshman/net"
import type {AppSyncOpts} from "@welshman/app"
import {subscribe, load, pull, repository, hasNegentropy} from "@welshman/app"
import {userRoomsByUrl, LEGACY_MESSAGE, GENERAL} from "@app/state"
import {subscribe, load, pull, hasNegentropy} from "@welshman/app"
import {userRoomsByUrl, LEGACY_MESSAGE, GENERAL, getEventsForUrl} from "@app/state"
// Utils
@@ -15,14 +15,14 @@ export const pullConservatively = ({relays, filters}: AppSyncOpts) => {
// Since pulling from relays without negentropy is expensive, limit how many
// duplicates we repeatedly download
if (dumb.length > 0) {
const events = sortBy(e => -e.created_at, repository.query(filters))
for (const url of dumb) {
const events = getEventsForUrl(url, filters)
if (events.length > 100) {
filters = filters.map(assoc("since", events[10]!.created_at))
}
promises.push(pull({relays: dumb, filters}))
promises.push(pull({relays: [url], filters}))
}
return Promise.all(promises)

View File

@@ -251,6 +251,16 @@ export const getUrlsForEvent = derived([trackerStore, thunks], ([$tracker, $thun
}
})
export const getEventsForUrl = (url: string, filters: Filter[]) => {
const $getUrlsForEvent = get(getUrlsForEvent)
const $events = repository.query(filters)
return sortBy(
e => -e.created_at,
$events.filter(e => $getUrlsForEvent(e.id).includes(url)),
)
}
export const deriveEventsForUrl = (url: string, filters: Filter[]) =>
derived([deriveEvents(repository, {filters}), getUrlsForEvent], ([$events, $getUrlsForEvent]) =>
sortBy(

View File

@@ -1,8 +1,7 @@
<script lang="ts">
import {throttle} from "throttle-debounce"
import {type Instance} from "tippy.js"
import type {NativeEmoji} from "emoji-picker-element/shared"
import {between} from "@welshman/lib"
import {between, throttle} from "@welshman/lib"
import Button from "@lib/components/Button.svelte"
import Tippy from "@lib/components/Tippy.svelte"
import EmojiPicker from "@lib/components/EmojiPicker.svelte"

View File

@@ -1,9 +1,8 @@
<svelte:options accessors />
<script lang="ts">
import {throttle} from "throttle-debounce"
import {fly, slide} from "svelte/transition"
import {clamp} from "@welshman/lib"
import {clamp, throttle} from "@welshman/lib"
import Icon from "@lib/components/Icon.svelte"
import {theme} from "@app/theme"