@cloudbase/manager-node 5.8.0-beta.2 → 5.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/lib/env/index.js +27 -0
- package/lib/function/index.js +98 -91
- package/lib/hosting/index.js +21 -1
- package/lib/storage/helper.js +52 -0
- package/lib/storage/index.js +449 -5
- package/package.json +2 -2
- package/types/env/index.d.ts +17 -1
- package/types/env/type.d.ts +257 -3
- package/types/function/index.d.ts +36 -36
- package/types/hosting/index.d.ts +8 -0
- package/types/storage/helper.d.ts +20 -0
- package/types/storage/index.d.ts +124 -2
- package/types/storage/type.d.ts +115 -0
package/types/storage/type.d.ts
CHANGED
|
@@ -288,6 +288,121 @@ export interface IUploadObjectBySignHttpOptions {
|
|
|
288
288
|
export interface IUploadObjectBySignHttpResult {
|
|
289
289
|
Key: string;
|
|
290
290
|
}
|
|
291
|
+
/** 本地 manifest 条目:待发布文件的内容摘要 */
|
|
292
|
+
export interface ILocalManifestItem {
|
|
293
|
+
/** 云端 Key */
|
|
294
|
+
key: string;
|
|
295
|
+
/** 本地文件内容 MD5(32 位小写十六进制) */
|
|
296
|
+
md5: string;
|
|
297
|
+
/** 文件大小(字节) */
|
|
298
|
+
size: number;
|
|
299
|
+
/** 本地文件绝对路径 */
|
|
300
|
+
localPath: string;
|
|
301
|
+
}
|
|
302
|
+
/** 远端 manifest 条目:远端 COS 对象信息 */
|
|
303
|
+
export interface IRemoteManifestItem {
|
|
304
|
+
/** 云端 Key */
|
|
305
|
+
key: string;
|
|
306
|
+
/** 对象 ETag(去除首尾引号后) */
|
|
307
|
+
etag: string;
|
|
308
|
+
/** 对象大小(字节) */
|
|
309
|
+
size: number;
|
|
310
|
+
}
|
|
311
|
+
/** manifest 差异结果:用于回滚判定与发布后清理 */
|
|
312
|
+
export interface IManifestDiffResult {
|
|
313
|
+
/** 本地有、远端无 —— 本次新增 */
|
|
314
|
+
added: string[];
|
|
315
|
+
/** 本地有、远端也有 —— 本次覆盖 */
|
|
316
|
+
overwritten: string[];
|
|
317
|
+
/** 远端有、本地无 —— 可作为 prune 候选 */
|
|
318
|
+
removed: string[];
|
|
319
|
+
}
|
|
320
|
+
/** manifest 校验结果:用于发布后确认远端内容是否与本地一致 */
|
|
321
|
+
export interface IManifestVerifyResult {
|
|
322
|
+
/** 是否校验通过 */
|
|
323
|
+
ok: boolean;
|
|
324
|
+
/** 本地有但远端不存在的 Key */
|
|
325
|
+
missing: string[];
|
|
326
|
+
/** 远端存在但摘要或大小不匹配的 Key */
|
|
327
|
+
mismatched: string[];
|
|
328
|
+
}
|
|
329
|
+
/** 上传进度回调(与 StorageService 上传回调语义一致) */
|
|
330
|
+
export type IConsistentUploadProgress = (progressData: {
|
|
331
|
+
loaded: number;
|
|
332
|
+
total: number;
|
|
333
|
+
speed: number;
|
|
334
|
+
percent: number;
|
|
335
|
+
}) => void;
|
|
336
|
+
/** 单文件上传完成回调(与 StorageService 的 onFileFinish 语义一致) */
|
|
337
|
+
export type IConsistentUploadFileFinish = (error: Error, res: any, fileData: any) => void;
|
|
338
|
+
/** 一致性发布上传选项 */
|
|
339
|
+
export interface IConsistentUploadOptions {
|
|
340
|
+
/** 本地待发布目录(绝对或相对路径) */
|
|
341
|
+
localPath: string;
|
|
342
|
+
/** 云端目标前缀,无前导斜杠(如 'dist');为空表示桶根 */
|
|
343
|
+
cloudPath?: string;
|
|
344
|
+
/** 目标桶 */
|
|
345
|
+
bucket: string;
|
|
346
|
+
/** 目标地域 */
|
|
347
|
+
region: string;
|
|
348
|
+
/** 忽略规则,语义与现有 uploadDirectoryCustom 的 ignore 一致 */
|
|
349
|
+
ignore?: string | string[];
|
|
350
|
+
/** 是否获取文件 fileId */
|
|
351
|
+
fileId?: boolean;
|
|
352
|
+
/** 并发数量 */
|
|
353
|
+
parallel?: number;
|
|
354
|
+
/** 重试次数 */
|
|
355
|
+
retryCount?: number;
|
|
356
|
+
/** 重试时间间隔(毫秒) */
|
|
357
|
+
retryInterval?: number;
|
|
358
|
+
/** 上传进度回调 */
|
|
359
|
+
onProgress?: IConsistentUploadProgress;
|
|
360
|
+
/** 单文件上传完成回调(error / res / fileData,与普通上传语义一致) */
|
|
361
|
+
onFileFinish?: IConsistentUploadFileFinish;
|
|
362
|
+
/** 发布后校验远端与本地产物一致 */
|
|
363
|
+
verify?: boolean;
|
|
364
|
+
/** 安全发布:发布前快照备份 + 失败自动回滚 */
|
|
365
|
+
safe?: boolean;
|
|
366
|
+
/**
|
|
367
|
+
* ⚠️ 危险参数:发布后清理远端多余文件。
|
|
368
|
+
* 会删除云端 cloudPath 下、本地构建中不存在的全部文件。
|
|
369
|
+
* 若误传错误的 localPath/cloudPath,整个目录都会被判定为冗余而删除。
|
|
370
|
+
* 发布成功后备份默认保留,prune 误删的文件可从备份前缀人工恢复;
|
|
371
|
+
* 调用方(CLI)必须经用户二次确认后才可开启。
|
|
372
|
+
*/
|
|
373
|
+
prune?: boolean;
|
|
374
|
+
/**
|
|
375
|
+
* 入口文件列表。
|
|
376
|
+
* 为相对 localPath 的相对路径,如 'index.html'、'admin/index.html'。
|
|
377
|
+
* 未指定时默认识别所有层级下的 index.html。
|
|
378
|
+
*/
|
|
379
|
+
entries?: string[];
|
|
380
|
+
}
|
|
381
|
+
/** 远端多余文件清理结果 */
|
|
382
|
+
export interface IPruneResult {
|
|
383
|
+
/** 成功删除的云端 Key */
|
|
384
|
+
deletedKeys: string[];
|
|
385
|
+
/** 删除失败的文件及原因 */
|
|
386
|
+
failedKeys: {
|
|
387
|
+
key: string;
|
|
388
|
+
error: string;
|
|
389
|
+
}[];
|
|
390
|
+
}
|
|
391
|
+
/** 一致性发布结果 */
|
|
392
|
+
export interface IConsistentUploadResult {
|
|
393
|
+
/** 本次成功上传的云端 Key */
|
|
394
|
+
uploadedKeys: string[];
|
|
395
|
+
/** 是否执行了发布后校验 */
|
|
396
|
+
verified: boolean;
|
|
397
|
+
/**
|
|
398
|
+
* 发布前备份前缀,仅 safe 开启时返回,如 .cloudbase-backup/1724073600000/。
|
|
399
|
+
* 备份一律不由编排自动清理(发布成功与回滚后均保留):prune 误删或需要
|
|
400
|
+
* 人工核查时可从中恢复;调用方确认无误后应通过 cleanupBackup 显式清理。
|
|
401
|
+
*/
|
|
402
|
+
backupPrefix?: string;
|
|
403
|
+
/** 远端多余文件清理结果,仅 prune 开启时存在 */
|
|
404
|
+
prune?: IPruneResult;
|
|
405
|
+
}
|
|
291
406
|
/** 下载方法,仅支持 GET / HEAD */
|
|
292
407
|
export type IDownloadObjectHttpMethod = 'GET' | 'HEAD';
|
|
293
408
|
/** 下载对象公共参数 */
|