import type EventKind from "./event-kind"; import { NostrLink, type ToNostrEventTag } from "."; import type { ReqFilter, TaggedNostrEvent } from "./nostr"; import type { RequestRouter } from "./request-router"; import type { NostrEvent } from "nostr-social-graph"; /** * A built REQ filter ready for sending to System */ export interface BuiltRawReqFilter { filters: Array; relay: string; syncFrom?: Array; } export interface RequestBuilderOptions { /** * Dont send CLOSE directly after EOSE and allow events to stream in */ leaveOpen?: boolean; /** * Pick N relays per pubkey when using outbox strategy */ outboxPickN?: number; /** * How many milli-seconds to wait to allow grouping */ groupingDelay?: number; /** * Replace the query every time a change in the query is detected * * eg. Live stream chat reactions */ replaceable?: boolean; /*** * If this query should skip the cache system */ skipCache?: boolean; /** * Enable sync module (negentropy/range-sync) * When true, will use sync protocol if cache data is available * When false, will send plain REQ without sync * Default: false */ useSyncModule?: boolean; /** * Extra events to include in the store, added automatically */ extraEvents?: Array; } /** * Nostr REQ builder */ export declare class RequestBuilder { #private; id: string; instance: string; constructor(id: string); get numFilters(): number; get filterBuilders(): RequestFilterBuilder[]; get options(): RequestBuilderOptions | undefined; clear(): void; /** * Add another request builders filters to this one */ add(other: RequestBuilder): void; withFilter(): RequestFilterBuilder; withBareFilter(f: ReqFilter): RequestFilterBuilder; withOptions(opt: RequestBuilderOptions): this; /** * Set relays for all filters in this builder */ withRelays(relays: Array): this; buildRaw(): Array; } /** * Builder class for a single request filter */ export declare class RequestFilterBuilder { #private; constructor(f?: ReqFilter); get filter(): { [key: string]: string | number | boolean | string[] | number[] | undefined; ids?: string[]; authors?: string[]; kinds?: number[]; "#e"?: string[]; "#p"?: string[]; "#t"?: string[]; "#d"?: string[]; "#r"?: string[]; "#a"?: string[]; "#g"?: string[]; search?: string; since?: number; until?: number; limit?: number; relays?: string[]; }; /** * Use a specific relay for this request filter */ relay(u: string | Array): this; ids(ids: Array): this; authors(authors?: Array): this; kinds(kinds?: Array): this; since(since?: number): this; until(until?: number): this; limit(limit?: number): this; tag(key: "e" | "p" | "d" | "t" | "r" | "a" | "g" | string, value?: Array): this; /** * Query by a nostr tag */ tags(tags: Array): this; search(keyword?: string): this; /** * Get event from link */ link(link: NostrLink | ToNostrEventTag): this; /** * Get replies to link with e/a tags */ replyToLink(links: Array): this; /** * Build/expand this filter into a set of relay specific queries */ build(model?: RequestRouter, options?: RequestBuilderOptions): Array; } //# sourceMappingURL=request-builder.d.ts.map