import type { ClientProvider } from "./client.js"; import type { Codec } from "./codec.js"; import type { WorkerContext } from "./context.js"; import type { Event } from "./event.js"; import type { Listener } from "./listener.js"; import type { OAuth2Config } from "./oauth2.js"; import type { RetryPolicy } from "./retry.js"; import type { Subscriber } from "./subscriber.js"; export type Handler = ((ctx: WorkerContext, event: Event) => Promise | void) | ((event: Event) => Promise | void); export type ContextualHandler = (ctx: WorkerContext, event: Event) => Promise | void; export type Middleware = (next: ContextualHandler) => ContextualHandler; export interface Logger { printf?: (format: string, ...args: unknown[]) => void; Printf?: (format: string, ...args: unknown[]) => void; } export interface WorkerOptions { subscriber?: Subscriber; topics?: string[]; codec?: Codec; logger?: Logger; concurrency?: number; middleware?: Middleware[]; retry?: RetryPolicy; retryCount?: number; listeners?: Listener[]; clientProvider?: ClientProvider; endpoint?: string; apiKey?: string; oauth2Config?: OAuth2Config; tenantId?: string; defaultDriverId?: string; validateTopics?: boolean; } export type WorkerOption = (worker: Worker) => void; export declare class Worker { private readonly topicHandlers; private readonly topicDrivers; private readonly typeHandlers; private readonly ruleHandlers; private readonly allowedTopics; private readonly driverSubs; private readonly topics; private subscriber?; private codec; private retry; private retryCount; private logger; private middleware; private listeners; private clientProvider?; private semaphore; private endpoint; private apiKey; private oauth2Config?; private tenantId; private defaultDriverId; private validate; constructor(opts?: WorkerOptions); static new(...options: WorkerOption[]): Worker; HandleTopic(topic: string, handler: Handler): void; HandleTopic(topic: string, driverId: string, handler: Handler): void; handleTopic(topic: string, handler: Handler): void; handleTopic(topic: string, driverId: string, handler: Handler): void; handleType(eventType: string, handler: Handler): void; HandleType(eventType: string, handler: Handler): void; handleRule(ruleId: string, handler: Handler): void; HandleRule(ruleId: string, handler: Handler): void; run(ctx?: WorkerContext | AbortSignal): Promise; Run(ctx?: WorkerContext | AbortSignal): Promise; close(): Promise; Close(): Promise; apply(options: WorkerOptions): void; Apply(options: WorkerOptions): void; private addTopics; private runWithSubscriber; private runDriverSubscribers; private runTopicSubscriber; private topicsByDriver; private buildDriverSubscribers; private validateTopics; private prepareRuleSubscriptions; private handleMessage; private wrap; private buildContext; private resolveContext; private notifyStart; private notifyExit; private notifyMessageStart; private notifyMessageFinish; private notifyError; private driversClient; private rulesClient; private eventLogsClient; private apiClientOptions; private updateEventLogStatus; private bindClientProvider; } export declare function New(...options: WorkerOption[]): Worker; export declare function WithSubscriber(subscriber: Subscriber): WorkerOption; export declare function WithTopics(...topics: string[]): WorkerOption; export declare function WithConcurrency(concurrency: number): WorkerOption; export declare function WithCodec(codec: Codec): WorkerOption; export declare function WithMiddleware(...middleware: Middleware[]): WorkerOption; export declare function WithRetry(retry: RetryPolicy): WorkerOption; export declare function WithRetryCount(retryCount: number): WorkerOption; export declare function WithLogger(logger: Logger): WorkerOption; export declare function WithClientProvider(clientProvider: ClientProvider): WorkerOption; export declare function WithListener(listener: Listener): WorkerOption; export declare function WithEndpoint(endpoint: string): WorkerOption; export declare function WithAPIKey(apiKey: string): WorkerOption; export declare function WithOAuth2Config(oauth2Config: OAuth2Config): WorkerOption; export declare function WithTenant(tenantId: string): WorkerOption; export declare function WithDefaultDriver(driverId: string): WorkerOption; export declare function WithValidateTopics(validate: boolean): WorkerOption; //# sourceMappingURL=worker.d.ts.map