import { type Observable } from "rxjs"; import type { Event } from "../event"; import type { ModuleConfig } from "./types"; export type { ClientConfig, Fn, InferClientConfig, Mod, ModuleConfig, MyceliumWorker, WorkerConfig, } from "./types"; /** * Creates a worker instance that exposes a module via RPC. * * @remarks * This function sets up the message listeners for the worker (Dedicated or Shared) * and handles the connection lifecycle. It returns the event stream which contains * the client configuration. * * @template C - The module configuration type. * @param config - The worker configuration containing the module implementation. * @returns The worker instance. * * @example * ```ts * const api = { * hello: () => "world" * }; * * expose(api); * ``` */ export declare function expose(config: C): Promise>> & { $config: C; }; /** * Sets up the communication port for a connected client. * * @remarks * This function initializes the message stream for a specific port * and sets up the request handling logic. * * @template C - The module configuration type. * @param event - The connection event (MessageEvent). * @param config - The worker configuration. */ export declare function setupPort(event: MessageEvent, config: C): Observable>;