import { Reporter, UploadSummary, UploadFileResult } from './reporter'; import { StorageClient } from './StorageClient'; import type { FileProcessor } from './fileProcessor'; /** 单次上传的运行配置(纯数据,无实例) */ export interface UploadRunConfig { env?: string; bucket: string; basePrefix: string; pathPrefix?: string; localDir: string; include?: string[]; exclude?: string[]; /** CDN 加速根地址,配置后可为每个文件生成 accessUrl */ cdnBaseUrl?: string; } /** 上传流程依赖的服务(仅包含实例,由上层注入) */ export interface UploadServices { storageClient: StorageClient; reporter?: Reporter; /** 上传前对文件内容的处理器,未配置则直接上传原内容 */ fileProcessor?: FileProcessor; } /** @deprecated 使用 UploadRunConfig + UploadServices 替代 */ export type UploadContext = UploadRunConfig & UploadServices; /** 本地文件信息:绝对路径与相对路径 */ export interface LocalFile { absolutePath: string; relativePath: string; } /** * 上传流程模板(Template Method)。 * 只接收「运行配置」与「服务实例」两类参数,便于阅读与维护。 */ export declare abstract class UploadFlowTemplate { protected readonly config: UploadRunConfig; protected readonly services: UploadServices; protected constructor(config: UploadRunConfig, services: UploadServices); /** 执行完整上传流程 */ execute(): Promise; protected abstract collectFiles(): Promise; protected abstract uploadFiles(files: LocalFile[]): Promise; /** 使用 include/exclude 过滤文件列表 */ protected filterFiles(files: LocalFile[]): LocalFile[]; /** * 构造远端 key:basePrefix / env / pathPrefix / relativePath。 */ protected buildKey(relativePath: string): string; /** 递归遍历目录,收集所有文件的绝对路径与相对路径 */ protected walkDir(rootDir: string, currentDir?: string): Promise; /** 将单个文件的上传结果交给 Reporter */ protected reportFileResult(result: UploadFileResult): Promise; } //# sourceMappingURL=UploadFlowTemplate.d.ts.map