UNPKG

askexperts

Version:

AskExperts SDK: build and use AI experts - ask them questions and pay with bitcoin on an open protocol

43 lines (42 loc) 1.78 kB
/** * Default implementation of StreamFactory */ import { SimplePool } from "nostr-tools"; import { StreamFactory, StreamWriterInterface } from "./interfaces.js"; import { StreamMetadata, StreamReaderConfig, StreamWriterConfig } from "./types.js"; /** * Default implementation of StreamFactory * Uses the built-in StreamReader and StreamWriter classes */ export declare class DefaultStreamFactory implements StreamFactory { #private; get readerConfig(): StreamReaderConfig | undefined; set readerConfig(c: StreamReaderConfig | undefined); get writerConfig(): StreamWriterConfig | undefined; set writerConfig(c: StreamWriterConfig | undefined); /** * Creates a StreamReader for reading from a stream * * @param metadata - Stream metadata * @param pool - SimplePool instance for relay communication * @param config - Configuration options * @returns Promise resolving to an AsyncIterable of string or Uint8Array */ createReader(metadata: StreamMetadata, pool: SimplePool, config?: StreamReaderConfig): Promise<AsyncIterable<string | Uint8Array>>; /** * Creates a StreamWriter for writing to a stream * * @param metadata - Stream metadata * @param pool - SimplePool instance for relay communication * @param senderPrivkey - Private key for signing stream events * @param config - Configuration options * @returns Promise resolving to a StreamWriterInterface */ createWriter(metadata: StreamMetadata, pool: SimplePool, senderPrivkey: Uint8Array, config?: StreamWriterConfig): Promise<StreamWriterInterface>; } /** * Gets the default StreamFactory instance * * @returns The default StreamFactory instance */ export declare function getStreamFactory(): StreamFactory;