@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
25 lines (24 loc) • 1.64 kB
TypeScript
import type { QueryArgumentsWithType, SupportedQueryTypes } from '../query';
import type { BaseQueryFormat } from '../base-query-format';
import type { StrictOmit } from 'ts-essentials';
/** @see CompoundQueryFormat */
export type VirtualCompoundConstraint<SubQueryType extends SupportedQueryTypes> = keyof StrictOmit<QueryArgumentsWithType<SubQueryType>, 'type'>;
/**
* Virtual Query Format.
* Grouping query parameters of the same type (re-specified in the `query` field).
*/
export interface CompoundQueryFormat<SubQueryType extends SupportedQueryTypes, CommonArguments extends VirtualCompoundConstraint<SubQueryType>> extends BaseQueryFormat {
readonly type: 'compound';
readonly query: SubQueryType;
/** defaults to use the same arguments for all queries */
readonly commonArguments: Pick<QueryArgumentsWithType<SubQueryType>, CommonArguments>;
/**
* You do not have to re-state the type, this is automatically filled with the type for 'query'
* Additionally all arguments given in `commonArguments` are now enforced optional.
*/
readonly arguments: ReadonlyArray<StrictOmit<StrictOmit<QueryArgumentsWithType<SubQueryType>, 'type'>, CommonArguments> & Partial<QueryArgumentsWithType<SubQueryType>>>;
}
/**
* Execute a single, virtual compound query in terms of unfolding the contained queries.
*/
export declare function executeCompoundQueries<SubQueryType extends SupportedQueryTypes, CommonArguments extends VirtualCompoundConstraint<SubQueryType> = VirtualCompoundConstraint<SubQueryType>>(query: CompoundQueryFormat<SubQueryType, CommonArguments>): QueryArgumentsWithType<SubQueryType>[];