Bump versions, move getAdapter to context
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/app",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "A collection of svelte stores for use in building nostr client applications.",
|
||||
@@ -27,14 +27,14 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/throttle-debounce": "^5.0.2",
|
||||
"@welshman/dvm": "^0.0.15",
|
||||
"@welshman/feeds": "^0.1.0",
|
||||
"@welshman/lib": "^0.1.0",
|
||||
"@welshman/relay": "^0.1.0",
|
||||
"@welshman/net": "^0.0.49",
|
||||
"@welshman/signer": "^0.1.1",
|
||||
"@welshman/store": "^0.1.0",
|
||||
"@welshman/util": "^0.1.0",
|
||||
"@welshman/dvm": "^0.1.1",
|
||||
"@welshman/feeds": "^0.1.1",
|
||||
"@welshman/lib": "^0.1.1",
|
||||
"@welshman/relay": "^0.1.1",
|
||||
"@welshman/net": "^0.1.1",
|
||||
"@welshman/signer": "^0.1.3",
|
||||
"@welshman/store": "^0.1.2",
|
||||
"@welshman/util": "^0.1.2",
|
||||
"fuse.js": "^7.0.0",
|
||||
"idb": "^8.0.0",
|
||||
"svelte": "^4.2.18",
|
||||
|
||||
@@ -175,7 +175,7 @@ export const getPubkeyRelays = (pubkey: string, mode?: string) => {
|
||||
}
|
||||
}
|
||||
|
||||
export const globalRouterOptions: RouterOptions = {
|
||||
export const routerContext: RouterOptions = {
|
||||
getRelayQuality,
|
||||
getPubkeyRelays,
|
||||
getFallbackRelays: () => ["wss://relay.damus.io/", "wss://nos.lol/"],
|
||||
@@ -191,15 +191,15 @@ export class Router {
|
||||
readonly options: RouterOptions
|
||||
|
||||
static configure(options: RouterOptions) {
|
||||
Object.assign(globalRouterOptions, options)
|
||||
Object.assign(routerContext, options)
|
||||
}
|
||||
|
||||
static get() {
|
||||
return new Router(globalRouterOptions)
|
||||
return new Router(routerContext)
|
||||
}
|
||||
|
||||
constructor(options: RouterOptions) {
|
||||
this.options = mergeLeft(options, globalRouterOptions)
|
||||
this.options = mergeLeft(options, routerContext)
|
||||
}
|
||||
|
||||
// Utilities derived from options
|
||||
@@ -420,7 +420,7 @@ type FilterSelectionRule = (filter: Filter) => FilterScenario[]
|
||||
export const getFilterSelectionsForSearch = (filter: Filter) => {
|
||||
if (!filter.search) return []
|
||||
|
||||
const relays = globalRouterOptions.getSearchRelays?.() || []
|
||||
const relays = routerContext.getSearchRelays?.() || []
|
||||
|
||||
return [{filter, scenario: Router.get().FromRelays(relays).weight(10)}]
|
||||
}
|
||||
@@ -441,7 +441,7 @@ export const getFilterSelectionsForIndexedKinds = (filter: Filter) => {
|
||||
|
||||
if (kinds.length === 0) return []
|
||||
|
||||
const relays = globalRouterOptions.getIndexerRelays?.() || []
|
||||
const relays = routerContext.getIndexerRelays?.() || []
|
||||
|
||||
return [
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/content",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "A collection of utilities for parsing nostr note content.",
|
||||
@@ -30,7 +30,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "^7.0.2",
|
||||
"@welshman/lib": "^0.1.0",
|
||||
"@welshman/lib": "^0.1.1",
|
||||
"nostr-tools": "^2.7.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/dvm",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "A collection of utilities for building nostr DVMs.",
|
||||
@@ -27,9 +27,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@noble/hashes": "^1.6.1",
|
||||
"@welshman/lib": "^0.1.0",
|
||||
"@welshman/net": "^0.0.49",
|
||||
"@welshman/util": "^0.1.0",
|
||||
"@welshman/signer": "^0.1.1"
|
||||
"@welshman/lib": "^0.1.1",
|
||||
"@welshman/net": "^0.1.1",
|
||||
"@welshman/util": "^0.1.2",
|
||||
"@welshman/signer": "^0.1.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/editor",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "A batteries-included nostr editor.",
|
||||
@@ -40,8 +40,8 @@
|
||||
"@tiptap/extension-text": "^2.11.5",
|
||||
"@tiptap/pm": "^2.11.5",
|
||||
"@tiptap/suggestion": "^2.11.5",
|
||||
"@welshman/lib": "^0.1.0",
|
||||
"@welshman/util": "^0.1.0",
|
||||
"@welshman/lib": "^0.1.1",
|
||||
"@welshman/util": "^0.1.2",
|
||||
"nostr-editor": "^0.0.4-pre.13",
|
||||
"nostr-tools": "^2.10.4",
|
||||
"tippy.js": "^6.3.7"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/feeds",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "Utilities for building dynamic nostr feeds.",
|
||||
@@ -26,7 +26,7 @@
|
||||
"fix": "gts fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@welshman/lib": "^0.1.0",
|
||||
"@welshman/util": "^0.1.0"
|
||||
"@welshman/lib": "^0.1.1",
|
||||
"@welshman/util": "^0.1.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/net",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "Utilities for connecting with nostr relays.",
|
||||
@@ -26,9 +26,9 @@
|
||||
"fix": "gts fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@welshman/lib": "^0.1.0",
|
||||
"@welshman/util": "^0.1.0",
|
||||
"@welshman/relay": "^0.1.0",
|
||||
"@welshman/lib": "^0.1.1",
|
||||
"@welshman/util": "^0.1.2",
|
||||
"@welshman/relay": "^0.1.1",
|
||||
"isomorphic-ws": "^5.0.0",
|
||||
"typed-emitter": "^2.1.0"
|
||||
}
|
||||
|
||||
@@ -99,9 +99,7 @@ export class MockAdapter extends AbstractAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
export type AdapterContext = Partial<NetContext> & {
|
||||
getAdapter?: (url: string, context: AdapterContext) => AbstractAdapter
|
||||
}
|
||||
export type AdapterContext = Partial<NetContext>
|
||||
|
||||
export const getAdapter = (url: string, adapterContext: AdapterContext = {}) => {
|
||||
const context = mergeRight(netContext, adapterContext as any)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {Repository} from "@welshman/relay"
|
||||
import {verifyEvent, TrustedEvent, SignedEvent} from "@welshman/util"
|
||||
import {AbstractAdapter} from "./adapter.js"
|
||||
import {Pool} from "./pool.js"
|
||||
|
||||
export type NetContext = {
|
||||
@@ -7,6 +8,7 @@ export type NetContext = {
|
||||
repository: Repository
|
||||
isEventValid: (event: TrustedEvent, url: string) => boolean
|
||||
isEventDeleted: (event: TrustedEvent, url: string) => boolean
|
||||
getAdapter?: (url: string, context: NetContext) => AbstractAdapter
|
||||
}
|
||||
|
||||
export const netContext: NetContext = {
|
||||
|
||||
@@ -124,8 +124,8 @@ export class SingleRequest extends (EventEmitter as new () => TypedEmitter<Singl
|
||||
}
|
||||
|
||||
// Timeout our subscription
|
||||
if (this.options.timeout) {
|
||||
setTimeout(() => this.close(), this.options.timeout)
|
||||
if (this.options.timeout || this.options.autoClose) {
|
||||
setTimeout(() => this.close(), this.options.timeout || 10000)
|
||||
}
|
||||
|
||||
// Start asynchronously so the caller can set up listeners
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/relay",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "An in-memory nostr relay implementation.",
|
||||
@@ -26,7 +26,7 @@
|
||||
"fix": "gts fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@welshman/lib": "^0.1.0",
|
||||
"@welshman/util": "^0.1.0"
|
||||
"@welshman/lib": "^0.1.1",
|
||||
"@welshman/util": "^0.1.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/signer",
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.3",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "A nostr signer implemenation supporting several login methods.",
|
||||
@@ -31,9 +31,9 @@
|
||||
"dependencies": {
|
||||
"@noble/curves": "^1.7.0",
|
||||
"@noble/hashes": "^1.6.1",
|
||||
"@welshman/lib": "^0.1.0",
|
||||
"@welshman/net": "^0.0.49",
|
||||
"@welshman/util": "^0.1.0",
|
||||
"@welshman/lib": "^0.1.1",
|
||||
"@welshman/net": "^0.1.1",
|
||||
"@welshman/util": "^0.1.2",
|
||||
"nostr-tools": "^2.7.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/store",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "A collection of utilities based on svelte/store for use with welshman",
|
||||
@@ -26,9 +26,9 @@
|
||||
"fix": "gts fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@welshman/lib": "^0.1.0",
|
||||
"@welshman/util": "^0.1.0",
|
||||
"@welshman/relay": "^0.1.0",
|
||||
"@welshman/lib": "^0.1.1",
|
||||
"@welshman/util": "^0.1.2",
|
||||
"@welshman/relay": "^0.1.1",
|
||||
"svelte": "^4.2.18"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@welshman/util",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
"description": "A collection of nostr-related utilities.",
|
||||
@@ -30,7 +30,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/ws": "^8.5.13",
|
||||
"@welshman/lib": "^0.1.0",
|
||||
"@welshman/lib": "^0.1.1",
|
||||
"nostr-tools": "^2.7.2",
|
||||
"nostr-wasm": "^0.1.0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user