/** * 附件上传的宿主环境:后端地址、传输层与接口路径。 * qc-ui 不依赖具体的 HTTP 库,宿主把自己的 POST 实现与地址前缀注入进来。 * * @author nokecy */ /** 附件服务的接口路径(相对于 `serverUrl()`)。`validate` 沿用后端的拼写 `valiate`。 */ export interface AttachmentEndpoints { /** 普通文件上传(单文件与分块共用) */ upload: string; /** 普通文件分块合并后的校验 */ validate: string; /** 视频分块上传 */ uploadVideoChunk: string; /** 视频上传完成后的确认 */ confirmVideo: string; /** 按 blobName 下载,blobName 直接拼在末尾 */ downloadByBlobName: string; } export declare const defaultAttachmentEndpoints: AttachmentEndpoints; /** `post` 的第三个参数,约定与 axios 一致。 */ export interface AttachmentPostConfig { headers?: Record; onUploadProgress?: (event: any) => void; } /** 宿主注入的环境。 */ export interface AttachmentEnv { /** 后端地址前缀,如 `() => window.serverUrl.apiServerUrl`;与路径直接拼接,不加斜杠 */ serverUrl: () => string; /** 发 POST 请求(multipart 或 JSON),约定与 `axios.post` 一致,返回含 `data` 的响应 */ post: (url: string, data: any, config?: AttachmentPostConfig) => Promise<{ data: any; }>; /** 每次请求附带的请求头(例如防伪令牌),请求时才读取 */ getHeaders?: () => Record; /** 覆盖默认的接口路径 */ endpoints?: Partial; } export declare const resolveEndpoints: (env: AttachmentEnv) => AttachmentEndpoints; /** 按 blobName 拼出下载地址。 */ export declare const getBlobDownloadUrl: (env: AttachmentEnv, blobName: string) => string;