@uwdata/mosaic-core
Version:
Scalable and extensible linked data views.
35 lines • 1.81 kB
TypeScript
import type { Coordinator } from './Coordinator.js';
import type { Selection } from './Selection.js';
import type { FilterExpr } from '@uwdata/mosaic-sql';
import { type ClientQuery, MosaicClient } from './MosaicClient.js';
export interface MakeClientOptions {
/** Mosaic coordinator. Defaults to the global coordinator. */
coordinator?: Coordinator;
/** A selection whose predicates are fed into the query function to produce the SQL query. */
selection?: Selection;
/** A flag (default `true`) indicating if the client should initially be enabled or not. */
enabled?: boolean;
/** A flag (default `true`) indicating if client queries can be sped up using pre-aggregated data.
* Should be set to `false` if filtering changes the groupby domain of the query. */
filterStable?: boolean;
/** An async function to prepare the client before running queries. */
prepare?: () => Promise<void>;
/** A function that returns a query from a list of selection predicates. */
query?: (filter: FilterExpr) => ClientQuery;
/** Called by the coordinator to return a query result. */
queryResult?: (data: unknown) => void;
/** Called by the coordinator to inform the client that a query is pending. */
queryPending?: () => void;
/** Called by the coordinator to report a query execution error. */
queryError?: (error: Error) => void;
}
/**
* Make a new client with the given options, and connect the client to the
* provided coordinator.
* @param options The options for making the client.
* @returns The resulting client, along with a method to destroy the client when no longer needed.
*/
export declare function makeClient(options: MakeClientOptions): MosaicClient & {
destroy: () => void;
};
//# sourceMappingURL=make-client.d.ts.map