UNPKG

@primexop/pbk

Version:

Primexop Backend Kit - A powerful TypeScript utility for managing backend projects with features like B2F Portal integration, cross-project validation, and Next.js support

66 lines (65 loc) 2.17 kB
import { Ora } from 'ora'; /** * Creates and starts a spinner with the given text * @param text The text to display next to the spinner * @returns The spinner instance */ export declare function startProgress(text: string): Ora; /** * Updates the spinner text * @param spinner The spinner instance * @param text The new text to display */ export declare function updateProgress(spinner: Ora, text: string): void; /** * Stops the spinner with a success message * @param spinner The spinner instance * @param text The success message */ export declare function successProgress(spinner: Ora, text: string): void; /** * Stops the spinner with a failure message * @param spinner The spinner instance * @param text The failure message */ export declare function failProgress(spinner: Ora, text: string): void; /** * Shows a spinner for a promise * @param text The text to display * @param promise The promise to track * @param successText The text to display on success * @param failText The text to display on failure * @returns The result of the promise */ export declare function withProgress<T>(text: string, promise: Promise<T>, successText?: string, failText?: string): Promise<T>; /** * Creates a progress manager for tracking multiple tasks * @returns An object with methods to manage multiple tasks with progress */ export declare function createMultiProgress(): { /** * Start the progress tracking * @param text The initial text to display */ start: (text?: string) => void; /** * Sets the total number of tasks * @param count The total number of tasks */ setTotal: (count: number) => void; /** * Increment the completed tasks counter * @param successText Optional text to display for the completed task */ incrementCompleted: (successText?: string) => void; /** * Increment the failed tasks counter * @param failText Optional text to display for the failed task */ incrementFailed: (failText?: string) => void; /** * Complete the progress tracking * @param text The final text to display */ complete: (text?: string) => void; };