import type { ReplicacheImpl } from '../../../../replicache/src/replicache-impl.ts';
import type { ReadonlyJSONValue } from '../../../../shared/src/json.ts';
import { type ReadonlyTDigest } from '../../../../shared/src/tdigest.ts';
import * as valita from '../../../../shared/src/valita.ts';
import type { AnalyzeQueryResult } from '../../../../zero-protocol/src/analyze-query-result.ts';
import type { AST } from '../../../../zero-protocol/src/ast.ts';
import type { Row } from '../../../../zero-protocol/src/data.ts';
import { type InspectDownBody, type ServerMetrics as ServerMetricsJSON } from '../../../../zero-protocol/src/inspect-down.ts';
import type { AnalyzeQueryOptions, InspectUpBody } from '../../../../zero-protocol/src/inspect-up.ts';
import type { ClientMetricMap, ServerMetricMap } from '../../../../zql/src/query/metrics-delegate.ts';
import type { QueryDelegate } from '../../../../zql/src/query/query-delegate.ts';
import type { AnyQuery } from '../../../../zql/src/query/query.ts';
import type { MutatorDefs } from '../replicache-types.ts';
import { Client } from './client.ts';
import { type Lazy } from './inspector.ts';
import { Query } from './query.ts';
export type GetWebSocket = () => Promise<WebSocket>;
export type Metrics = {
    readonly [K in keyof (ClientMetricMap & ServerMetricMap)]: ReadonlyTDigest;
};
type DistributiveOmit<T, K extends string> = T extends object ? Omit<T, K> : never;
export declare function rpc<T extends InspectDownBody>(socket: WebSocket, arg: DistributiveOmit<InspectUpBody, 'id'>, downSchema: valita.Type<T>): Promise<T['value']>;
export declare function mergeMetrics(clientMetrics: ClientMetrics | undefined, serverMetrics: ServerMetricsJSON | null | undefined): ClientMetrics & ServerMetrics;
export declare function inspectorMetrics(delegate: ExtendedInspectorDelegate): Promise<Metrics>;
export declare function inspectorClients(delegate: ExtendedInspectorDelegate): Promise<Client[]>;
export declare function inspectorClientsWithQueries(delegate: ExtendedInspectorDelegate): Promise<Client[]>;
export declare function clientGroupClients(delegate: ExtendedInspectorDelegate, clientGroupID: Promise<string> | string): Promise<Client[]>;
export declare function clientGroupClientsWithQueries(delegate: ExtendedInspectorDelegate, clientGroupID: Promise<string> | string): Promise<Client[]>;
export declare function clientGroupQueries(delegate: ExtendedInspectorDelegate): Promise<Query[]>;
export declare function clientMap(delegate: ExtendedInspectorDelegate, clientID: string): Promise<Map<string, ReadonlyJSONValue>>;
export declare function clientRows(delegate: ExtendedInspectorDelegate, clientID: string, tableName: string): Promise<Row[]>;
export declare function serverVersion(delegate: ExtendedInspectorDelegate): Promise<string>;
export declare function clientQueries(delegate: ExtendedInspectorDelegate, clientID: string): Promise<Query[]>;
export declare function analyzeQuery(delegate: ExtendedInspectorDelegate, query: AnyQuery, options?: AnalyzeQueryOptions): Promise<AnalyzeQueryResult>;
export interface InspectorDelegate {
    getQueryMetrics(hash: string): ClientMetrics | undefined;
    getAST(queryID: string): AST | undefined;
    readonly metrics: ClientMetrics;
    mapClientASTToServer(ast: AST): AST;
}
export interface ExtendedInspectorDelegate extends InspectorDelegate {
    readonly rep: Rep;
    readonly getSocket: () => Promise<WebSocket>;
    readonly queryDelegate: QueryDelegate;
    lazy: Promise<Lazy>;
}
export type Rep = ReplicacheImpl<MutatorDefs>;
export type ClientMetrics = {
    readonly [K in keyof ClientMetricMap]: ReadonlyTDigest;
};
export type ServerMetrics = {
    readonly [K in keyof ServerMetricMap]: ReadonlyTDigest;
};
export {};
//# sourceMappingURL=lazy-inspector.d.ts.map