export declare const INIT = "INIT"; export declare const SUBSCRIBE = "SUBSCRIBE"; export declare const UNSUBSCRIBE = "UNSUBSCRIBE"; export declare const UPDATED = "UPDATED"; export declare const SNAPSHOT = "SNAPSHOT"; export declare const EXIT = "EXIT"; export declare const TERMINATE = "TERMINATE"; declare const DUMP = "DUMP"; declare const INC = "INC"; declare const KEYS = "KEYS"; export type ActorContext = ReturnType; export type Letter = { to: string; from?: string; tag: string; data: any; timeout: number; reply: (data: any) => void; reject: (error: any) => void; }; export type HandlerFn = (ctx: ActorContext, letter: Letter, data: any) => Promise | void; export type SpawnFn = (address?: string) => void; export interface ActorHandlers { [INIT]?: (ctx: ActorContext) => Promise | void; [SUBSCRIBE]?: HandlerFn; [UNSUBSCRIBE]?: HandlerFn; [UPDATED]?: HandlerFn; [SNAPSHOT]?: HandlerFn; [EXIT]?: HandlerFn; [TERMINATE]?: HandlerFn; [DUMP]?: HandlerFn; [INC]?: HandlerFn; [KEYS]?: HandlerFn; [key: string]: HandlerFn | undefined; } export declare function send(addr: string, tag: string, data?: Record | null, opts?: { expectReply?: true; timeout?: number; from?: string; }): Promise; export declare function send(addr: string, tag: string, data?: Record | null, opts?: { expectReply?: false; timeout?: number; from?: string; }): Promise; export declare const kill: (addr: string) => void; export declare const spawn: (fnOrHandlers: ((ctx: ActorContext) => Promise) | Handlers, rawAddr?: string | number | null) => string; declare const createCtx: (addr: string) => { self: () => string; receive: () => Promise; send: (to: string | null | undefined, tag: string, data?: any, opts?: Record) => Promise | undefined; sendSelf: (tag: string, data?: any, opts?: Record) => void; broadcast: (tag: string, data: any, opts?: Record) => void; subscribe: (sub?: string | null) => false | Set; unsubscribe: (sub?: string | null) => boolean; subscriberCount: () => number; hasSubs: () => boolean; put: (key: string, value: T) => void; get: (key: string, fallback?: T | undefined) => any; delete: (key: string) => void; update: (key: string, fn: (x: T) => U) => void; keys: () => string[]; all: () => Record; where: (pattern: RegExp) => {}; merge: (data?: Record) => void; fatalError: (error: Error) => void; }; export declare function subscriber(address: string, spawnFn: SpawnFn, callback: (data: T | null, error: Error | null) => void): () => Promise; export declare function snapshoter(address: string, spawnFn: SpawnFn): Promise; export {};