export type MetricFlowCliSource = 'env' | 'managed' | 'path'; export interface MetricFlowCliResolution { bin: string; source: MetricFlowCliSource; version: string; } export declare class MetricFlowUnavailableError extends Error { constructor(message: string); } export interface MetricFlowQueryRequest { projectRoot: string; dbtProjectPath?: string; profilesDir?: string; metrics: string[]; dimensions: string[]; timeDimension?: { name: string; granularity: string; }; filters?: Array<{ dimension?: string; operator?: string; values?: string[]; expression?: string; }>; orderBy?: Array<{ name: string; direction?: 'asc' | 'desc'; }>; limit?: number; savedQuery?: string; } export declare function managedMetricFlowRuntimeRoot(projectRoot: string): string; export declare function managedMetricFlowBin(projectRoot: string): string; export declare function resolveMetricFlowCli(projectRoot?: string): MetricFlowCliResolution | null; export interface MetricFlowCompileResult { sql: string; command: string[]; stdout: string; stderr: string; } export interface MetricFlowDimension { /** Entity-qualified group-by name exactly as MetricFlow addresses it. */ qualifiedName: string; /** Queryable grains, when MetricFlow reports them (time dimensions). */ granularities?: string[]; } interface MetricFlowDimensionListRequest { projectRoot: string; dbtProjectPath?: string; profilesDir?: string; metrics: string[]; } /** * Ask MetricFlow itself which dimensions a metric set can be grouped by, via * `mf list dimensions --metrics X,Y`. This is the EXACT truth for the executing * engine — entity-qualified names and real queryable grains — which the native * reachable-table heuristic can only approximate. Tolerant to output-format * drift across MetricFlow versions: unrecognized lines are ignored and a parse * that yields nothing returns [] so the caller falls back to native. */ export declare function listMetricFlowDimensions(request: MetricFlowDimensionListRequest): MetricFlowDimension[]; /** Parse `mf list dimensions` stdout into qualified names + grains. Kept * separate + exported so its format tolerance is unit-testable without mf. */ export declare function parseMetricFlowDimensionList(stdout: string): MetricFlowDimension[]; export type MetricFlowCompileMode = 'legacy-compile' | 'explain'; /** dbt-metricflow 0.13 removed `mf query --compile`. Its quiet explain mode * emits only the compiled SQL and does not print the result table. Keep the * legacy flag for existing user-managed MetricFlow installations. */ export declare function metricFlowCompileMode(version: string): MetricFlowCompileMode; export declare function resolveDbtProjectRoot(projectRoot: string, configuredPath?: string): string; export declare function hasDbtSemanticManifest(projectRoot: string, configuredPath?: string): boolean; /** Check whether the configured MetricFlow executable is callable. */ export declare function hasMetricFlowCli(projectRoot?: string): boolean; export declare function compileMetricFlowQuery(request: MetricFlowQueryRequest): MetricFlowCompileResult; /** * Parse a MetricFlow "does not match any of the available group-by-items" * failure and rewrite the failing bare names to the qualified names MetricFlow * itself suggested. Returns the corrected request, or null when the failure is * not a group-by resolution problem or no suggestion unambiguously matches. * * Selection rule per failing input: among the suggested qualified names whose * final segment equals the input (`…__`), take the one with the fewest * entity hops; ties on hop count → null (genuinely ambiguous, do not guess). */ export declare function repairMetricFlowGroupBy(request: MetricFlowQueryRequest, output: string): MetricFlowQueryRequest | null; export {}; //# sourceMappingURL=metricflow.d.ts.map