/// /// import type { Request, Response } from "./http/types.js"; import type { Transport } from "@connectrpc/connect"; import type { TypedArray } from "@encore.dev/internal-runtime/compat/types"; /** * The runtime interface is used by this package to interact with the javascript runtime * we are running in. * * There are two implementations of this interface, one in `@encore.dev/bun-runtime` and one in * `@encore.dev/node-runtime`. */ export interface Runtime { /** * The name of the runtime */ name: string; /** * Starts an HTTP server on the given port * * @param host The host to start the server on * @param port The port to start the server on * @param handler The handler to use for the server * * @returns The URL of the server */ startHTTPServer(host: string, port: number, handler: (req: Request, res: Response) => void): URL; /** * Returns the value of the given environment variable * * @param {string} name * @returns {string | undefined} */ env(name: string): string | undefined; /** * Creates a ConnectRPC transport for use by the sidecar-api package * @returns {Transport} */ apiTransport(): Transport; /** * Writes the given object to stdout as a JSON line */ objToStderr(obj: unknown): void; /** * Fills the array with cryptographically secure random values */ getRandomValues(array: T): T; } /** * Injects the runtime object */ export declare function inject(r: Runtime): void; /** * Returns the runtime object for this javascript runtime */ export declare function runtime(): Runtime;