UNPKG

drizzle-cube

Version:

Drizzle ORM-first semantic layer with Cube.js compatibility. Type-safe analytics and dashboards with SQL injection protection.

57 lines (56 loc) 2.62 kB
import { AnalysisBuilderState, AIState } from '../components/AnalysisBuilder/types'; import { ChartType, ChartAxisConfig, ChartDisplayConfig } from '../types'; import { ServerFunnelQuery } from '../types/funnel'; import { AnalysisType, AnalysisConfig } from '../types/analysisConfig'; interface UseAnalysisAIOptions { /** Current state for snapshotting */ state: AnalysisBuilderState; /** Set state function for applying AI-generated queries */ setState: (updater: (prev: AnalysisBuilderState) => AnalysisBuilderState) => void; /** Current chart type */ chartType: ChartType; /** Set chart type */ setChartType: (type: ChartType) => void; /** Current chart config */ chartConfig: ChartAxisConfig; /** Set chart config */ setChartConfig: (config: ChartAxisConfig) => void; /** Current display config */ displayConfig: ChartDisplayConfig; /** Set display config */ setDisplayConfig: (config: ChartDisplayConfig) => void; /** Set whether user manually selected chart */ setUserManuallySelectedChart: (value: boolean) => void; /** Set active view */ setActiveView: (view: 'table' | 'chart') => void; /** AI endpoint URL */ aiEndpoint?: string; /** Current analysis type */ analysisType?: AnalysisType; /** Set analysis type (for switching to funnel mode) */ setAnalysisType?: (type: AnalysisType) => void; /** Load funnel config from ServerFunnelQuery */ loadFunnelFromServerQuery?: (query: ServerFunnelQuery) => void; /** Get full AnalysisConfig for snapshotting (for complete undo) */ getFullConfig?: () => AnalysisConfig; /** Load full AnalysisConfig (for restoring on cancel) */ loadFullConfig?: (config: AnalysisConfig) => void; } interface UseAnalysisAIResult { /** Current AI state */ aiState: AIState; /** Open the AI panel */ handleOpenAI: () => void; /** Close the AI panel */ handleCloseAI: () => void; /** Update the AI prompt */ handleAIPromptChange: (prompt: string) => void; /** Generate query from AI */ handleGenerateAI: () => Promise<void>; /** Accept the AI-generated query */ handleAcceptAI: () => void; /** Cancel and restore previous state */ handleCancelAI: () => void; } export declare function useAnalysisAI({ state, setState, chartType, setChartType, chartConfig, setChartConfig, displayConfig, setDisplayConfig, setUserManuallySelectedChart, setActiveView, aiEndpoint, analysisType, setAnalysisType, loadFunnelFromServerQuery, getFullConfig, loadFullConfig }: UseAnalysisAIOptions): UseAnalysisAIResult; export {};