Bump versions, move getAdapter to context
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user