hotfix types.

This commit is contained in:
fiatjaf 2023-04-18 15:29:28 -03:00
parent 9241089997
commit bf7e00d32a
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1
3 changed files with 5 additions and 7 deletions

View File

@ -25,6 +25,7 @@ export type AddressPointer = {
export type DecodeResult =
| {type: 'nprofile'; data: ProfilePointer}
| {type: 'nrelay'; data: string}
| {type: 'nevent'; data: EventPointer}
| {type: 'naddr'; data: AddressPointer}
| {type: 'nsec'; data: string}

View File

@ -2,7 +2,7 @@ import {Relay, relayInit} from './relay'
import {normalizeURL} from './utils'
import {Filter} from './filter'
import {Event} from './event'
import {SubscriptionOptions, Sub, Pub} from './relay'
import {SubscriptionOptions, Sub, Pub, CountPayload} from './relay'
export class SimplePool {
private _conn: {[url: string]: Relay}
@ -53,7 +53,7 @@ export class SimplePool {
}
let subs: Sub[] = []
let eventListeners: Set<(event: Event) => void> = new Set()
let eventListeners: Set<any> = new Set()
let eoseListeners: Set<() => void> = new Set()
let eosesMissing = relays.length

View File

@ -11,7 +11,7 @@ type RelayEvent = {
notice: (msg: string) => void | Promise<void>
auth: (challenge: string) => void | Promise<void>
}
type CountPayload = {
export type CountPayload = {
count: number
}
type SubEvent = {
@ -371,10 +371,7 @@ export function relayInit(
resolve(event)
})
}),
count: (
filters: Filter[],
opts?: SubscriptionOptions
): Promise<CountPayload | null> =>
count: (filters: Filter[]): Promise<CountPayload | null> =>
new Promise(resolve => {
let s = sub(filters, {...sub, verb: 'COUNT'})
let timeout = setTimeout(() => {