/** * Internal helpers shared across concurrency implementations. * * @internal */ import { TaskWorkerError } from './errors'; import type { RpcWorkerModule, TaskWorkerErrorCode, WorkerModule, WorkerTaskHandler } from './types'; /** * Shared worker message protocol identifiers. * * These are duplicated verbatim inside the inline `Blob` worker scripts (which * must be fully self-contained strings); the constants keep the main-thread and * module-worker (`exposeTask` / `exposeRpc`) sides in sync with them. * * @internal */ export declare const WORKER_RUN_MESSAGE = "bq:run"; /** @internal */ export declare const WORKER_RPC_MESSAGE = "bq:rpc"; /** @internal */ export declare const WORKER_RESULT_MESSAGE = "bq:result"; /** @internal */ export declare const WORKER_ERROR_MESSAGE = "bq:error"; /** @internal */ export interface SerializedWorkerError { /** Untrusted serialized worker payload; validate against TaskWorkerErrorCode before use. */ code?: string; message?: string; name?: string; stack?: string; } /** @internal */ export declare const isTaskWorkerErrorCode: (code: string | undefined) => code is TaskWorkerErrorCode; /** @internal */ export declare const normalizeTimeout: (timeout?: number) => number | undefined; /** @internal */ export declare const validateTaskHandler: (handler: WorkerTaskHandler) => string; /** @internal */ export declare const createWorkerInstance: (scriptSource: string, name?: string) => Worker; /** @internal Runtime brand marking a {@link WorkerModule} / {@link RpcWorkerModule}. */ export declare const WORKER_MODULE_BRAND: unique symbol; /** @internal Detects a CSP-safe module descriptor produced by `defineWorker()`. */ export declare const isWorkerModuleDescriptor: (value: unknown) => value is WorkerModule | RpcWorkerModule; /** @internal Instantiates a CSP-safe module worker addressed by URL (no eval/blob). */ export declare const createModuleWorkerInstance: (module: WorkerModule | RpcWorkerModule, name?: string) => Worker; /** @internal */ export declare const restoreWorkerError: (payload: SerializedWorkerError | undefined) => TaskWorkerError; //# sourceMappingURL=internal.d.ts.map