import { JRPCBase, JRPCFailure, JRPCNotification, JRPCParams, JRPCRequest, JRPCSuccess, Json } from "../jrpc/interfaces.js"; export type DeferredPromise = { promise: Promise; resolve: (value: Type) => void; reject: (error: unknown) => void; }; /** * Validates that a value is JSON-serializable. * * @param value - The value to validate. * @returns Whether the value is valid JSON. */ export declare function isValidJson(value: unknown): value is Json; /** * JSON-stringifies a value with 2-space indentation. * * @param value - The value to stringify. * @returns The stringified value. */ export declare function stringify(value: unknown): string; /** * Type guard to check if a JRPC message is a notification (no `id` property). */ export declare function isJRPCNotification(request: JRPCNotification | JRPCRequest): request is JRPCNotification; /** * Type guard to check if a JRPC message is a request (has `id` property). */ export declare function isJRPCRequest(request: JRPCNotification | JRPCRequest): request is JRPCRequest; /** * V2-compatible type guard to check if a JSON-RPC message is a request (has `id` property). * Unlike {@link isJRPCRequest}, this also accepts `Readonly<>` wrapped messages. */ export declare function isRequest(message: (JRPCNotification | JRPCRequest) | Readonly | JRPCRequest>): message is JRPCRequest; /** * V2-compatible type guard to check if a JSON-RPC message is a notification (no `id` property). * Unlike {@link isJRPCNotification}, this does NOT treat `{ id: undefined }` as a notification. */ export declare function isNotification(message: JRPCNotification | JRPCRequest): message is JRPCNotification; /** * Checks whether the given request has a valid (non-empty string) `method`. */ export declare function isValidMethod(request: Partial): boolean; /** * Type guard to check if a JRPC response is a success (has `result`). */ export declare function isJRPCSuccess(response: JRPCBase): response is JRPCSuccess; /** * Type guard to check if a JRPC response is a failure (has `error`). */ export declare function isJRPCFailure(response: JRPCBase): response is JRPCFailure; /** * The implementation of static `isInstance` methods for classes that have them. * * @param value - The value to check. * @param symbol - The symbol property to check for. * @returns Whether the value has `{ [symbol]: true }` in its prototype chain. */ export declare function isInstance(value: unknown, symbol: symbol): value is { [key: symbol]: true; }; /** * Gets an ID that is guaranteed to be unique so long as no more than * 4_294_967_295 (uint32 max) IDs are created, or the IDs are rapidly turned * over. * * @returns The unique ID. */ export declare function getUniqueId(): number; /** * {@link Iterable} type guard. * * @param value - The value to check. * @returns Whether the value is an {@link Iterable}. */ export declare function isIterable(value: Iterable | Record): value is Iterable; /** * Like Object.entries(), but includes symbol-keyed properties. * * @template KeyValues - The type of the keys and values in the object. * @param keyValues - The object to convert. * @returns The array of entries, including symbol-keyed properties. */ export declare function entriesFromKeyValues>(keyValues: KeyValues): [keyof KeyValues, KeyValues[keyof KeyValues]][];