appwrite-utils-cli
Version:
Appwrite Utility Functions to help with database management, data conversion, data import, migrations, and much more. Meant to be used as a CLI tool, I do not recommend installing this in frontend environments.
63 lines (62 loc) • 2.03 kB
TypeScript
export interface ProgressOptions {
title?: string;
showETA?: boolean;
showSpeed?: boolean;
showPercentage?: boolean;
width?: number;
format?: string;
}
export declare class ProgressManager {
private static instances;
private bar;
private startTime;
private totalItems;
private completed;
private id;
private title;
private constructor();
static create(id: string, total: number, options?: ProgressOptions): ProgressManager;
static get(id: string): ProgressManager | undefined;
update(current: number, detail?: string): void;
increment(amount?: number, detail?: string): void;
setTotal(total: number): void;
stop(showSummary?: boolean): void;
fail(error: string): void;
getStats(): {
completed: number;
total: number;
percentage: number;
duration: number;
rate: number;
remaining: number;
eta: number;
};
static stopAll(): void;
}
export declare class MultiProgressManager {
private multiBar;
private bars;
private startTime;
constructor(options?: ProgressOptions);
addTask(id: string, total: number, title: string): void;
updateTask(id: string, current: number, detail?: string): void;
incrementTask(id: string, amount?: number, detail?: string): void;
completeTask(id: string): void;
failTask(id: string, error: string): void;
stop(showSummary?: boolean): void;
getTaskStats(id: string): {
completed: number;
total: number;
percentage: number;
remaining: number;
} | null;
getAllStats(): Map<string, any>;
}
export declare const ProgressUtils: {
withProgress<T>(id: string, total: number, title: string, operation: (progress: ProgressManager) => Promise<T>): Promise<T>;
processArrayWithProgress<T, R>(items: T[], processor: (item: T, index: number) => Promise<R>, options?: {
title?: string;
batchSize?: number;
showDetail?: boolean;
}): Promise<R[]>;
};