///
import Operation from "../metadata/operation.js";
import { HTTPRequest } from "./http.js";
import { GenericProperties, Struct } from "./struct.js";
export type Submission = {
operation: Operation;
request: HTTPRequest;
};
/**
* ClientConfig is the configuration of a client
*/
export type ClientConfig = {
/**
* The endpoint to connect to. This should be the base URL of the service. E.g("http://localhost:3000/svc1")
*/
endpoint?: string;
requestConfigurators?: RequestConfigurationHook[];
};
/**
* Returns a copy of original with any overrides applied. If overrides is null, the original is returned.
* @param a is the original configuration
* @param more is the configuration to add more to the original.
* @returns
*/
export declare function MergeClientConfig(a?: ClientConfig, more?: ClientConfig): ClientConfig;
/**
* Called before every request to allow the caller to configure the request
*/
export type RequestConfigurationHook = (sub: Submission) => Promise;
export default class Client {
private readonly endpoint;
private readonly requestConfigurators;
constructor(config: ClientConfig);
private configureRequest;
postOperation(operation: Operation, inputProps: GenericProperties, abortController: AbortController): Promise;
/**
* Executes an operation and returns its single result
* @param operation
* @param input
* @returns the output struct of the operation
*/
execute(operation: Operation, inputProps: GenericProperties): Promise;
/**
* Execute an operation and stream the results to the provided awaited callback.
* The returned promise resolves when the stream is complete.
* @param operation
* @param input
* @param outputCallback returns a promise that resolves when the given output has been processed and the next output can be streamed
* @throws Error if the operation fails or the stream fails. The stream will be aborted if the callback throws an error which is the recommended way to stop the stream.
*/
stream(operation: Operation, input: GenericProperties, outputCallback: (struct: GenericProperties) => Promise): Promise;
}