import { s } from '../schema'; import type { QuickJSAsyncContext, QuickJSHandle } from 'quickjs-emscripten-core'; import { RuntimeTransport } from './transport'; /** * A reference to a function in the runtime. * * @public * @param Args - The args of the function. * @param Result - The result of the function. * @returns The function reference. */ export type RuntimeFunctionRef = { name: string; description: string; args?: s.HashbrownType; result?: s.HashbrownType; handler: (args: Args, abortSignal: AbortSignal) => Result | Promise; }; /** * Creates a function with an input schema. * * @public * @param cfg - The configuration for the function containing: * - `name`: The name of the function * - `description`: The description of the function * - `args`: The args schema of the function * - `result`: The result schema of the function * - `handler`: The handler of the function * @returns The function reference. */ export declare function createRuntimeFunctionImpl(cfg: { name: string; description: string; args: s.HashbrownType; result: s.HashbrownType; handler: (args: unknown, abort?: AbortSignal) => unknown; } | { name: string; description: string; result: s.HashbrownType; handler: (abort?: AbortSignal) => unknown; } | { name: string; description: string; args: s.HashbrownType; handler: (args: unknown, abort?: AbortSignal) => unknown; } | { name: string; description: string; handler: (abortSignal?: AbortSignal) => unknown; }): RuntimeFunctionRef; export declare function attachFunctionToContext(context: QuickJSAsyncContext, transport: RuntimeTransport, definition: RuntimeFunctionRef>, attachTo: QuickJSHandle, abortSignal: AbortSignal): QuickJSHandle; //# sourceMappingURL=create-runtime-function-impl.d.ts.map