import { JRPCRequest } from "../interfaces.js"; import { MiddlewareContext } from "./MiddlewareContext.js"; import { DeepCloned } from "./v2interfaces.js"; /** * Create a deep clone of a value as follows: * - Assumes acyclical objects * - Does not copy property descriptors (i.e. uses mutable defaults) * - Ignores non-enumerable properties * - Ignores getters and setters * * @throws If the value is an object with a circular reference. * @param value - The value to clone. * @returns The cloned value. */ export declare const deepClone: (value: Type) => DeepCloned; /** * Make a JSON-RPC request from a legacy request. Clones the params to avoid * freezing them, which could cause errors in an involved legacy engine. * * @param req - The legacy request to make a request from. * @returns The JSON-RPC request. */ export declare function fromLegacyRequest(req: Request): Request; /** * Make a middleware context from a legacy request by copying over all non-JSON-RPC * properties from the request to the context object. * * @param req - The legacy request to make a context from. * @returns The middleware context. */ export declare function makeContext>(req: Request): MiddlewareContext; /** * Copies non-JSON-RPC string properties from the request to the context. * * For compatibility with our problematic practice of appending non-standard * fields to requests for inter-middleware communication in the legacy engine. * * **ATTN:** Only string properties that do not already exist in the context * are copied. * * @param req - The request to propagate the context from. * @param context - The context to propagate to. */ export declare function propagateToContext(req: Record, context: MiddlewareContext>): void; /** * Copies non-JSON-RPC string properties from the context to the request. * * For compatibility with our problematic practice of appending non-standard * fields to requests for inter-middleware communication in the legacy engine. * * **ATTN:** Only string properties are copied. * * @param req - The request to propagate the context to. * @param context - The context to propagate from. */ export declare function propagateToRequest(req: Record, context: MiddlewareContext): void; /** * Copies non-JSON-RPC string properties from the context to the request. * * Clone the original request object and propagate the context to the cloned request. * * **ATTN:** Only string properties are copied. * * @param req - The request to propagate the context to. * @param context - The context to propagate from. * @returns The mutable cloned request. */ export declare function propagateToMutableRequest>(req: Record, context: MiddlewareContext): ReturnedMutableRequest;