import { DATE_FIELD_PATTERNS, NAME_FIELD_PATTERNS } from "../constants.js";
import { Field, Table as Table$1 } from "apache-arrow";
//#region src/js/arrow/arrow-client.d.ts
declare class ArrowClient {
/**
* Processes an Arrow IPC buffer into a Table.
* Lazily loads the Apache Arrow library on first use.
*
* @param buffer - The Arrow IPC format buffer
* @returns Promise resolving to an Arrow Table
*/
static processArrowBuffer(buffer: Uint8Array): Promise
;
/**
* Fetches Arrow data from a URL and processes it into a Table.
* Convenience method that combines fetchArrow and processArrowBuffer.
*
* @param url - URL to fetch Arrow data from
* @param headers - Optional HTTP headers to include in the request
* @returns Promise resolving to an Arrow Table
* @example
* ```typescript
* const table = await ArrowClient.fetchAndProcessArrow('/api/data/arrow');
* console.log(`Loaded ${table.numRows} rows`);
* ```
*/
static fetchAndProcessArrow(url: string, headers?: Record): Promise;
/**
* Extracts field metadata (name and type) from an Arrow Table.
*
* @param table - Arrow Table to extract fields from
* @returns Array of field metadata objects
* @example
* ```typescript
* const fields = ArrowClient.extractArrowFields(table);
* // [{ name: "date", type: Date32 }, { name: "value", type: Float64 }]
* ```
*/
static extractArrowFields(table: Table$1): {
name: string;
type: any;
}[];
/**
* Extracts all columns from an Arrow Table as JavaScript arrays.
* Each column is converted to a native JavaScript array.
*
* @param table - Arrow Table to extract columns from
* @returns Object mapping column names to arrays
* @example
* ```typescript
* const columns = ArrowClient.extractArrowColumns(table);
* // { date: ["2024-01-01", "2024-01-02"], value: [100, 200] }
* ```
*/
static extractArrowColumns(table: Table$1): Record;
/**
* Extracts chart data from Arrow table.
* Uses get(i) to properly handle complex types like Decimal128.
* Applies decimal scaling for DECIMAL types.
*
* Note: This method assumes Arrow has been loaded (via processArrowBuffer).
*
* @returns xData for axis, yDataMap for series data
*/
static extractChartData(table: Table$1, xKey: string, yKeys: string[]): {
xData: (string | number)[];
yDataMap: Record;
};
/**
* Automatically detect which fields to use for chart axes from an Arrow table
* Uses the schema's type information for accurate field detection
*
* Note: This method assumes Arrow has been loaded (via processArrowBuffer).
*
* @param table - Arrow Table to analyze
* @param orientation - Chart orientation ("vertical" for time-series, "horizontal" for categorical)
* @returns Object containing the detected fields
* @example
* // Time-series data
* detectFieldsFromArrow(timeSeriesTable)
* // { xField: "date", yFields: ["revenue", "cost"], chartType: "timeseries" }
*
* // Categorical data
* detectFieldsFromArrow(categoricalTable)
* // { xField: "app_name", yFields: ["totalSpend"], chartType: "categorical" }
*/
static detectFieldsFromArrow(table: Table$1, orientation?: "vertical" | "horizontal"): DetectedFields & {
chartType: "timeseries" | "categorical";
};
/**
* Fetches raw Arrow IPC data from a URL.
*
* @param url - URL to fetch Arrow data from
* @param headers - Optional HTTP headers to include in the request
* @returns Promise resolving to the raw Arrow buffer as Uint8Array
* @example
* ```typescript
* const buffer = await ArrowClient.fetchArrow('/api/data/arrow');
* const table = await ArrowClient.processArrowBuffer(buffer);
* ```
*/
static fetchArrow(url: string, headers?: Record): Promise;
}
interface DetectedFields {
/** X field */
xField: string;
/** Y fields */
yFields: string[];
}
//#endregion
export { ArrowClient, DetectedFields, type Field, type Table$1 as Table };
//# sourceMappingURL=arrow-client.d.ts.map