import { Reporter, UploadSummary, UploadFileResult } from './reporter'; import { StorageClient } from './StorageClient'; import type { FileProcessor } from './fileProcessor'; /** 单次上传的目录参数 */ export interface UploadDirectoryOptions { bucket: string; localDir: string; env?: string; pathPrefix?: string; include?: string[]; exclude?: string[]; /** 上传后的文件名在扩展名前拼接文件内容 hash(如 file.js -> file.abc12def.js) */ hash?: boolean; /** 匹配到的 key 强制上传(不跳过),如从 FILE_RE_WHITE_LIST 解析的列表 */ forceUploadPatterns?: string[]; } export interface LocalFile { absolutePath: string; relativePath: string; } /** * 上传流程基类:封装「收集文件 → 过滤 → 逐个上传 → 上报」。 * 子类可覆盖 collectFiles、uploadOneFile 等扩展行为。 */ export declare abstract class UploadService { protected readonly storageClient: StorageClient; protected readonly basePrefix: string; protected readonly cdnBaseUrl?: string | undefined; protected readonly reporter?: Reporter | undefined; protected readonly fileProcessor?: FileProcessor | undefined; protected constructor(storageClient: StorageClient, basePrefix: string, cdnBaseUrl?: string | undefined, reporter?: Reporter | undefined, fileProcessor?: FileProcessor | undefined); uploadDirectory(options: UploadDirectoryOptions): Promise; /** 收集并过滤要上传的文件,子类可覆盖 */ protected collectFiles(localDir: string, include?: string[], exclude?: string[]): Promise; /** 上传单个文件:有 existingKeysSet 时用 Set 判断存在,否则 head;存在则跳过,否则 put;子类可覆盖 */ protected uploadOneFile(file: LocalFile, options: UploadDirectoryOptions, existingKeysSet?: Set): Promise<{ status: 'success' | 'skipped' | 'failed'; key: string; }>; protected buildKey(basePrefix: string, env?: string, pathPrefix?: string, relativePath?: string): string; protected walkDir(rootDir: string, currentDir?: string): Promise; protected reportFile(file: LocalFile, bucket: string, key: string, status: UploadFileResult['status'], error?: Error): Promise; } //# sourceMappingURL=UploadService.d.ts.map