import { CLIProgressManager } from '@contentstack/cli-utilities'; import { ExportConfig, ModuleClassParams } from '../../types'; export type ApiOptions = { uid?: string; url?: string; module: ApiModuleType; queryParam?: Record; resolve: (value: any) => void; reject: (error: any) => void; additionalInfo?: Record; }; export type CompleteProgressOptions = { moduleName?: string; customSuccessMessage?: string; customWarningMessage?: string; context?: Record; }; export type EnvType = { module: string; totalCount: number; apiBatches?: number[]; concurrencyLimit: number; apiParams?: ApiOptions; }; export type CustomPromiseHandlerInput = { index: number; batchIndex: number; element?: Record; apiParams?: ApiOptions; isLastRequest: boolean; }; export type CustomPromiseHandler = (input: CustomPromiseHandlerInput) => Promise; export type ApiModuleType = 'stack' | 'asset' | 'assets' | 'entry' | 'entries' | 'content-type' | 'content-types' | 'stacks' | 'versioned-entries' | 'download-asset' | 'export-taxonomy'; export default abstract class BaseClass { readonly client: any; exportConfig: ExportConfig; protected progressManager: CLIProgressManager | null; protected currentModuleName: string; constructor({ exportConfig, stackAPIClient }: Omit); static printFinalSummary(): void; /** * Create simple progress manager */ protected createSimpleProgress(moduleName: string, total?: number): CLIProgressManager; /** * Create nested progress manager */ protected createNestedProgress(moduleName: string): CLIProgressManager; /** * Complete progress manager */ protected completeProgress(success?: boolean, error?: string): void; /** * Complete progress and log success/warning message based on errors * Checks the progress manager's failure count to determine if errors occurred * @param options - Options object containing: * - moduleName: The module name to generate the message (e.g., 'Assets', 'Entries') * If not provided, uses this.currentModuleName * - customSuccessMessage: Optional custom success message. If not provided, generates: "{moduleName} have been exported successfully!" * - customWarningMessage: Optional custom warning message. If not provided, generates: "{moduleName} have been exported with some errors. Please check the logs at: {sessionLogPath}" * - context: Optional context for logging */ protected completeProgressWithMessage(options?: CompleteProgressOptions): void; protected withLoadingSpinner(message: string, action: () => Promise): Promise; get stack(): any; delay(ms: number): Promise; makeConcurrentCall(env: EnvType, promisifyHandler?: CustomPromiseHandler): Promise; /** * @method logMsgAndWaitIfRequired * @param module string * @param start number * @param batchNo number * @returns Promise */ logMsgAndWaitIfRequired(module: string, start: number, batchNo: number): Promise; /** * Wraps a caller-supplied resolve/reject callback so that if the callback itself throws * (e.g. a bug while writing/logging the result), the failure is caught right here and * always recorded via handleAndLogError, instead of turning into a rejected promise that * a caller further up the chain may or may not notice. */ private guardCallback; /** * @method makeAPICall * @param {Record} options - Api related params * @param {Record} isLastRequest - Boolean * @returns Promise */ makeAPICall({ module: moduleName, reject, resolve, url, uid, additionalInfo, queryParam }: ApiOptions, isLastRequest?: boolean): Promise; protected applyQueryFilters(requestObject: any, moduleName: string): any; }