import type { ConnectionOptions } from '../connection.ts'; import { type JsonRpcErrorObject } from './json-rpc-client.ts'; /** * Error thrown by the catalog client when an operation call returns a JSON-RPC * error. Carries the wire `code` so hand-authored commands can distinguish * version-skew (operation absent on an older server) from domain faults without * reaching past the generated client to build HTTP requests directly. */ export declare class CatalogClientError extends Error { readonly code: number; readonly data: unknown; readonly operationName: string; constructor(operationName: string, error: JsonRpcErrorObject); /** True when the server did not recognize the operation (version skew). */ get isUnknownOperation(): boolean; } type CatalogOperationTypes = Record; export type CatalogWeftClient = { readonly [Name in keyof Operations]: (input: Operations[Name]['input']) => Promise; }; export type WeftClientConnection = ConnectionOptions; /** * Transport seam for the catalog client. Every generated operation method * resolves to one call into a `CatalogTransport`, which carries the operation * name plus its validated input and returns the operation's result. * * The HTTP transport ({@link httpJsonRpcTransport}) speaks JSON-RPC over the * wire; an in-process transport routes the same calls straight into a local * `Engine` so the embedded `LocalClient` and the remote CLI/`HttpClient` share * one generated surface instead of drifting apart. */ export type CatalogTransport = (operationName: string, input: unknown) => Promise; /** Generated metadata needed to map a typed client operation onto REST. */ export type ClientRestOperationBinding = { readonly method: string; readonly path: string; readonly inputSources: Readonly>; readonly success: { readonly kind: 'json'; readonly status: number; } | { readonly kind: 'empty'; readonly status: number; }; }; /** * Build a catalog client from a list of operation names and a transport. Each * name becomes a method that forwards its input through the transport, so the * full catalog is reachable without hand-authoring a method per operation. */ export declare function createCatalogWeftClient(operationNames: readonly (keyof Operations & string)[], transport: CatalogTransport): CatalogWeftClient; /** * Transport that dispatches catalog operations as JSON-RPC requests to a * remote Weft server, resolving the connection (server URL + token) per call. */ export declare function httpJsonRpcTransport(connectionOptions?: WeftClientConnection): CatalogTransport; export {};