/** * data transforms * * @packageDocumentation */ /** * @beta */ export declare interface Action { type: ActionType; field: string | null; as: string | null; options?: FillNullOptions; } /** * @beta */ export declare type ActionType = AggregationType | ConversionType | FillType; /** * * @param rows - 数据 * @param options - 参数 * * @public */ export declare function aggregate(rows: RowData[], options: AggregateParams): RowData[]; /** * @public */ export declare interface AggregateParams { as: string[]; fields?: string[]; groupBy?: string | string[]; op: Operations[]; } /** * @beta */ export declare const AGGREGATION: ["sum", "max", "min", "average", "avg", "median", "count", "distinct", "countd"]; /** * @beta */ export declare type AggregationType = typeof AGGREGATION[number]; /** * @beta */ export declare function autoSchema(data: RowData[], renameOption?: RenameOption): TransformSchema[]; /** * @beta */ export declare function autoTransform(data: RowData[], renameOption?: RenameOption): AutoTransformResult; /** * @beta */ export declare interface AutoTransformResult { result: RowData; schemas: TransformSchema[]; } /** * @beta */ export declare const CONVERSION: ["toString", "toFloat", "toInt"]; /** * @beta */ export declare type ConversionType = typeof CONVERSION[number]; /** * @beta */ export declare const FILL: ["fillNull", "removeNull"]; /** * @beta */ export declare type FillNullOptions = FillNullOptionsBySmart | FillNullOptionsByAgg | FillNullOptionsByValue; /** * @beta */ export declare interface FillNullOptionsByAgg { type: Extract; cfg: { agg: AggregationType; }; } /** * @beta */ export declare interface FillNullOptionsBySmart { type: Extract; } /** * @beta */ export declare interface FillNullOptionsByValue { type: Extract; cfg: { value: string | number; }; } /** * @beta */ export declare type FillNullType = 'bySmart' | 'byAgg' | 'byValue'; /** * @beta */ export declare type FillType = typeof FILL[number]; /** * aggregate operation * @public */ export declare type Operations = 'sum' | 'average' | 'avg' | 'mean' | 'min' | 'max' | 'median' | 'variance' | 'stdevp' | 'stdev' | 'mode' | 'product' | 'count' | 'distinct' | 'countd' | 'valid'; /** * @beta */ export declare function parse(data: RowData[], schemas: TransformSchema | TransformSchema[]): RowData[]; /** * @beta */ export declare type RenameOption = boolean | 'origin' | 'brackets' | 'underline' | Function; /** * 数据行 * @public */ export declare type RowData = Record; /** * @beta */ export declare interface TransformSchema { groupBy?: string[]; actions: Action[]; } export { }