import { EnvInfo, ExternalStorage } from '../interfaces'; export interface IStorageConfig { env: string; region: string; bucket: string; basePath: string; } /** * 逻辑路径 → COS 物理 Key:共享桶环境拼上 basePath 前缀,basePath 为空时原样返回 * cloudPath 为空或为 '/' 时返回 `${basePath}/`,即共享桶内本环境的根目录 */ export declare function toPhysicalKey(basePath: string, cloudPath?: string): string; /** * COS 物理 Key → 逻辑路径:去掉 basePath 前缀,basePath 为空或 Key 不在前缀下时原样返回 */ export declare function toLogicalPath(basePath: string, key: string): string; /** * 解析环境的有效云存储配置 * 共享桶环境(Storages[0].ExternalStorage.Enabled 为 true)下,BasePath 从 ExternalStorage 读取,桶名、地域在顶层为空时回退到 ExternalStorage; * 普通环境保持读取 Storages[0].Bucket / Region,basePath 为空串 */ export declare function resolveStorageConfig(envConfig: EnvInfo): IStorageConfig; /** * 按共享桶规则解析有效桶,云存储(Storages)与静态托管(DescribeStaticStore)共用 * * 是否共享桶只看 ExternalStorage.Enabled,不看顶层 Bucket 是否为空: * 目前线上共享桶环境的顶层 Bucket 均返回空串,但接口定义并未保证这一点, * 若后端回填桶名而 basePath 仍按「Bucket 为空」判定,文件会静默写到桶根目录, * 造成同一共享桶内跨环境污染。因此 basePath 只由 Enabled + BasePath 决定, * 桶名则优先用顶层 Bucket,为空时回退到 ExternalStorage.BucketName。 */ export declare function resolveBucketConfig(options: { envId: string; bucket: string; region: string; externalStorage?: ExternalStorage; }): { bucket: string; region: string; basePath: string; };