import { Context, Handler } from 'hono'; import './utils-3rsE0JvI.cjs'; import { z } from 'zod/v4'; declare const EncodingSchema: z.ZodEnum<{ json: "json"; cbor: "cbor"; bare: "bare"; }>; /** * Encoding used to communicate between the client & actor. */ type Encoding = z.infer; /** Stringifies with compat for values that BARE & CBOR supports. */ declare function jsonStringifyCompat(input: any, space?: string | number): string; /** Parses JSON with compat for values that BARE & CBOR supports. */ declare function jsonParseCompat(input: string): any; /** * Joins multiple abort signals into one. * * The returned signal aborts when the first input signal aborts. * Uses `AbortSignal.any(...)` when available, with a runtime fallback. * * @experimental */ declare function joinSignals(...signals: Array): AbortSignal; /** * Returns a promise that resolves after the given number of milliseconds. * * @experimental */ declare function sleep(ms: number): Promise; /** * Creates a fixed-rate interval tick function that can be awaited in a loop. * * @example * const tick = interval(100); * while (!c.aborted) { * await tick(); * if (c.aborted) break; * // ... game logic * } * * @experimental */ declare function interval(ms: number): () => Promise; declare const VERSION: string; /** * Builds the HTTP user agent used by this library. * * @experimental */ declare function httpUserAgent(): string; type UpgradeWebSocket = (createEvents: (c: Context) => any) => Handler; type GetUpgradeWebSocket = () => UpgradeWebSocket; /** * Reads an environment variable from Deno or Node runtimes. * * @experimental */ declare function getEnvUniversal(key: string): string | undefined; /** * Traces a debug value and returns it. * * @experimental */ declare function dbg(x: T): T; /** * Converts various ArrayBuffer-like types to Uint8Array. * Handles ArrayBuffer, ArrayBufferView (including typed arrays), and passes through existing Uint8Array. * * @param data - The ArrayBuffer or ArrayBufferView to convert * @returns A Uint8Array view of the data * * @experimental */ declare function toUint8Array(data: ArrayBuffer | ArrayBufferView): Uint8Array; type LongTimeoutHandle = { abort: () => void; }; /** * Polyfill for Promise.withResolvers(). * * This is specifically for Cloudflare Workers. Their implementation of Promise.withResolvers does not work correctly. * * @experimental */ declare function promiseWithResolvers(onReject: (reason?: any) => void): { promise: Promise; resolve: (value: T | PromiseLike) => void; reject: (reason?: any) => void; }; /** * Sets a timeout that supports delays larger than the JavaScript timer limit. * * @experimental */ declare function setLongTimeout(listener: () => void, after: number): LongTimeoutHandle; /** * A tiny utility that coalesces/enqueues async operations so only the latest * queued task runs per cycle, while callers receive a promise that resolves * when the task for the cycle they joined has completed. */ declare class SinglePromiseQueue { #private; /** The currently running promise of #drainLoop. Do not await this, instead await `pending` to await the current cycle. */ runningDrainLoop?: Promise; /** Queue the next operation and return a promise that resolves when it flushes. */ enqueue(op: () => Promise): Promise; } /** * Converts a Buffer or Uint8Array into an ArrayBuffer view. * * @experimental */ declare function bufferToArrayBuffer(buf: Buffer | Uint8Array): ArrayBuffer; /** * Properly combines a base URL endpoint with a path, preserving any base path in the endpoint. * * @example * combineUrlPath("http://localhost:8787/rivet", "/actors/action") * // Returns: "http://localhost:8787/rivet/actors/action" * * @example * combineUrlPath("http://localhost:8787/rivet", "/actors?type=foo", { namespace: "test" }) * // Returns: "http://localhost:8787/rivet/actors?type=foo&namespace=test" * * @param endpoint The base URL endpoint that may contain a path component * @param path The path to append to the endpoint (may include query parameters) * @param queryParams Optional additional query parameters to append * @returns The properly combined URL string * * @experimental */ declare function combineUrlPath(endpoint: string, path: string, queryParams?: Record): string; /** * Compares two ArrayBuffer values by byte content. * * @experimental */ declare function arrayBuffersEqual(buf1: ArrayBuffer, buf2: ArrayBuffer): boolean; declare const EXTRA_ERROR_LOG: { issues: string; support: string; version: string; }; type Runtime = "deno" | "bun" | "node"; /** * Detects the current JavaScript runtime from the user agent. * * @experimental */ declare function detectRuntime(): Runtime; type DeepReadonly = { readonly [K in keyof T]: T[K] extends object ? DeepReadonly : T[K]; }; type DeepMutable = { -readonly [K in keyof T]: T[K] extends object ? DeepMutable : T[K]; }; export { type DeepMutable as D, type Encoding as E, type GetUpgradeWebSocket as G, type LongTimeoutHandle as L, type Runtime as R, SinglePromiseQueue as S, type UpgradeWebSocket as U, VERSION as V, type DeepReadonly as a, EXTRA_ERROR_LOG as b, arrayBuffersEqual as c, bufferToArrayBuffer as d, combineUrlPath as e, dbg as f, detectRuntime as g, getEnvUniversal as h, httpUserAgent as i, interval as j, joinSignals as k, jsonParseCompat as l, jsonStringifyCompat as m, sleep as n, promiseWithResolvers as p, setLongTimeout as s, toUint8Array as t };