import type { CircuitBreakerResponse } from '@devvit/shared-types/CircuitBreaker.js'; import type { AppConsole, AppLog } from '../console/AppConsole.js'; import type { RuntimeLite } from '../runtime/RuntimeLite.js'; import type { CommandMessageLike, ResponseMessageLike } from './Commands.js'; /** * The environment container a BrowserLiteWorker executes in. Optional props are * expected to be populated by the implementation directly into the box. * * onmessage() / postMessage() approximate a MessagePort. */ export type WorkerBox = { /** * Halt local execution and retry on the server * @param method optional method name that caused the circuit break */ circuitBreak(method?: string | undefined): never; /** * Allow clearing circuit break errors from within the app for advanced * functionality like hooks. See CircuitBreakApp for an example. */ clearCircuitBreak(): void; CircuitBreakerResponse?: typeof CircuitBreakerResponse; /** * The runtime console. SandboxedRuntimeLite may route both runtime and app * logs to `globalThis.console` or separate app logs to a second QueueLogger * console. UnsandboxedRuntimeLite only has one shared console, either * `globalThis.console` or a QueueLogger. */ console: AppConsole & { logs?: AppLog[]; }; /** Runtime diagnostic logging setting. Does not impact app logging. */ debugLogging?: boolean; close(): void; /** Runtime diagnostic logger. Does not impact app logging. */ log: (...args: unknown[]) => void; onmessage?: ((ev: Partial>) => Promise) | null; onunhandledrejection?: ((ev: PromiseRejectionEvent) => void) | null; postMessage(msg: ResponseMessageLike): void; protos?: typeof import('@devvit/protos'); require?(id: string): unknown; runtime?: RuntimeLite; } & Pick; //# sourceMappingURL=WorkerBox.d.ts.map