import { UIDLGlobalStateDefinition, UIDLDataSource, UIDLFilterConfigEntry } from '@teleporthq/teleport-types'; /** * Checks whether a query string references {{Current User.*}} dynamic variables. */ export declare const queryReferencesCurrentUser: (query: string) => boolean; /** * Extracts {{Current User.*}} variable fields from a query string. * Returns a list of field names (e.g., ['id', 'email']). */ export declare const extractCurrentUserFields: (query: string) => string[]; /** * Validates a raw SQL query is SELECT-only. */ export declare const isSelectOnlyQuery: (query: string) => boolean; export interface CsvColumnLabel { id: string; label: string; } /** * The columns that turn a CSV source's rows into the shape the editor reads. * The generated CSV fetcher keys every row by column id (`col_0`), while the * editor keys the same rows by column label — so every field of a state bound * to the file was designed against the label. Null for any other source, or a * file without column metadata (whose rows the editor reads as parsed). */ export declare const getCsvColumnLabels: (dataSource: UIDLDataSource) => CsvColumnLabel[] | null; /** * Code that re-keys `rowsVar`'s rows from column id to column label, leaving * anything that is not a list untouched. */ export declare const buildCsvRelabelCode: (rowsVar: string, columns: CsvColumnLabel[]) => string; /** * Separates static and dynamic filters from a filterConfig array. */ export declare const separateFilters: (filterConfig: UIDLFilterConfigEntry[]) => { staticFilters: UIDLFilterConfigEntry[]; dynamicFilters: UIDLFilterConfigEntry[]; }; /** * Gets the table name from a refPath (first element). */ export declare const getTableNameFromRefPath: (refPath: Array) => string | null; /** * Builds the refPath extraction code for accessing nested data. * E.g., refPath = ['table', 0, 'name'] → 'data?.[0]?.name' */ export declare const buildRefPathAccessCode: (dataVar: string, refPath: Array) => string; /** * Wraps mapping function execution with error handling. * Returns code that defines and calls the mapping function with fallback. */ export declare const buildMappingFunctionCode: (mappingFunction: string, inputVar: string, resultVar: string) => string; export interface GlobalStateFetchConfig { name: string; definition: UIDLGlobalStateDefinition; dataSource: UIDLDataSource; tableName: string; fileName: string; fetcherImportName: string; hasQuery: boolean; hasDynamicFilters: boolean; needsCurrentUser: boolean; } /** * Collects fetch configurations for all data-source-bound global state definitions. */ export declare const collectGlobalStateFetchConfigs: (definitions: Record, dataSources: Record) => GlobalStateFetchConfig[]; /** * Generates the API route code for a raw SQL query data source. * Delegates to the shared raw query fetcher generator. */ export declare const generateRawQueryApiRoute: (dataSource: UIDLDataSource, query: string, staffRoles?: string[], withRevocation?: boolean) => string; //# sourceMappingURL=data-source-utils.d.ts.map