@ultipa-graph/ultipa-driver
Version:
NodeJS SDK for Ultipa GQL
51 lines (50 loc) • 1.79 kB
TypeScript
/**
* Query service handles GQL query execution.
*/
import { ServiceContext } from './service-context';
import { Response } from '../response';
import { QueryConfig } from '../client';
/**
* Query service for executing GQL queries.
*/
export declare class QueryService {
private ctx;
constructor(ctx: ServiceContext);
/**
* Calculate timeout with the following priority:
* 1. QueryConfig.timeout (highest priority) - explicitly specified timeout
* 2. Context deadline (medium priority) - remaining time from context deadline
* 3. client.config.timeout (default) - default timeout from client config
*
* @param config Optional query configuration
* @returns Timeout in milliseconds
*/
private calculateTimeout;
/**
* Execute a GQL query and return the result.
*
* Falls back to GqlStream + client-side aggregation when the server
* rejects the result set as too large for non-streaming RPC
* (RESOURCE_EXHAUSTED with "use streaming API" detail).
*/
gql(query: string, config?: QueryConfig): Promise<Response>;
/**
* Run GqlStream and aggregate chunks into a single Response.
*
* Used as fallback from gql() when the server rejects the result set
* as too large for non-streaming RPC.
*/
private gqlStreamCollect;
/**
* Execute a GQL query and stream the results.
*/
gqlStream(query: string, config?: QueryConfig, callback?: (response: Response) => void): Promise<void>;
/**
* Return the execution plan for a query.
*/
explain(query: string, config?: QueryConfig): Promise<string>;
/**
* Execute a query with profiling and return statistics.
*/
profile(query: string, config?: QueryConfig): Promise<string>;
}