@cloudbase/manager-node 4.11.0-alpha.2 → 4.11.0-alpha.4
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/lib/database/index.js +79 -0
- package/lib/environment.js +5 -0
- package/lib/index.js +3 -0
- package/lib/mysql/index.js +551 -0
- package/lib/mysql/types/account.js +2 -0
- package/lib/mysql/types/backup.js +2 -0
- package/lib/mysql/types/base.js +2 -0
- package/lib/mysql/types/index.js +19 -0
- package/lib/storage/index.js +424 -10
- package/package.json +1 -1
- package/types/database/index.d.ts +112 -0
- package/types/environment.d.ts +3 -0
- package/types/index.d.ts +2 -0
- package/types/mysql/index.d.ts +261 -0
- package/types/mysql/types/account.d.ts +160 -0
- package/types/mysql/types/backup.d.ts +161 -0
- package/types/mysql/types/base.d.ts +579 -0
- package/types/mysql/types/index.d.ts +3 -0
- package/types/storage/index.d.ts +151 -3
package/types/storage/index.d.ts
CHANGED
|
@@ -66,6 +66,82 @@ export interface IStorageAclRule {
|
|
|
66
66
|
/** 写权限规则,true 表示所有用户可写,字符串表示自定义规则表达式 */
|
|
67
67
|
write: boolean | string;
|
|
68
68
|
}
|
|
69
|
+
/** 复制文件选项 */
|
|
70
|
+
export interface ICopyOptions {
|
|
71
|
+
/** 源路径(云端路径,如 images/a.jpg) */
|
|
72
|
+
sourcePath: string;
|
|
73
|
+
/** 目标路径(云端路径,如 backup/a.jpg) */
|
|
74
|
+
destPath: string;
|
|
75
|
+
/** 是否强制覆盖已存在的文件 */
|
|
76
|
+
force?: boolean;
|
|
77
|
+
/** 是否跳过已存在的文件 */
|
|
78
|
+
skipExisting?: boolean;
|
|
79
|
+
}
|
|
80
|
+
/** 复制目录选项 */
|
|
81
|
+
export interface ICopyDirectoryOptions extends ICopyOptions {
|
|
82
|
+
/** 包含模式(glob 格式) */
|
|
83
|
+
include?: string | string[];
|
|
84
|
+
/** 排除模式(glob 格式) */
|
|
85
|
+
exclude?: string | string[];
|
|
86
|
+
/** 并发数,默认 20 */
|
|
87
|
+
parallel?: number;
|
|
88
|
+
/** 进度回调 */
|
|
89
|
+
onProgress?: (info: ICopyProgress) => void;
|
|
90
|
+
}
|
|
91
|
+
/** 复制进度信息 */
|
|
92
|
+
export interface ICopyProgress {
|
|
93
|
+
/** 已复制数量 */
|
|
94
|
+
copied: number;
|
|
95
|
+
/** 已跳过数量 */
|
|
96
|
+
skipped: number;
|
|
97
|
+
/** 总数量 */
|
|
98
|
+
total: number;
|
|
99
|
+
/** 当前正在处理的文件 */
|
|
100
|
+
currentFile: string;
|
|
101
|
+
}
|
|
102
|
+
/** 复制结果状态 */
|
|
103
|
+
export type CopyStatus = 'copied' | 'skipped' | 'failed';
|
|
104
|
+
/** 复制结果 */
|
|
105
|
+
export interface ICopyResult {
|
|
106
|
+
/** 是否成功 */
|
|
107
|
+
success: boolean;
|
|
108
|
+
/** 源路径 */
|
|
109
|
+
sourcePath: string;
|
|
110
|
+
/** 目标路径 */
|
|
111
|
+
destPath: string;
|
|
112
|
+
/** 文件大小 (bytes) */
|
|
113
|
+
size?: number;
|
|
114
|
+
/** 复制状态 */
|
|
115
|
+
status: CopyStatus;
|
|
116
|
+
/** 失败时的错误信息 */
|
|
117
|
+
error?: string;
|
|
118
|
+
}
|
|
119
|
+
/** 搜索文件选项 */
|
|
120
|
+
export interface ISearchOptions {
|
|
121
|
+
/** 搜索模式(glob 或正则表达式) */
|
|
122
|
+
pattern: string;
|
|
123
|
+
/** 搜索目录路径(不指定则搜索根目录) */
|
|
124
|
+
path?: string;
|
|
125
|
+
/** 是否为正则表达式 */
|
|
126
|
+
isRegex?: boolean;
|
|
127
|
+
/** 文件类型过滤(如 jpg, png) */
|
|
128
|
+
fileType?: string;
|
|
129
|
+
/** 限制数量,默认 100 */
|
|
130
|
+
limit?: number;
|
|
131
|
+
/** 是否包含详细信息 */
|
|
132
|
+
includeDetails?: boolean;
|
|
133
|
+
}
|
|
134
|
+
/** 搜索结果 */
|
|
135
|
+
export interface ISearchResult {
|
|
136
|
+
/** 文件路径(云端路径) */
|
|
137
|
+
key: string;
|
|
138
|
+
/** 类型:file 或 directory */
|
|
139
|
+
type: 'file' | 'directory';
|
|
140
|
+
/** 文件大小 (bytes),仅文件有效 */
|
|
141
|
+
size?: number;
|
|
142
|
+
/** 最后修改时间 (ISO 格式),仅文件有效 */
|
|
143
|
+
lastModified?: string;
|
|
144
|
+
}
|
|
69
145
|
type OnProgress = (progressData: IProgressData) => void;
|
|
70
146
|
type OnFileFinish = (error: Error, res: any, fileData: any) => void;
|
|
71
147
|
export declare class StorageService {
|
|
@@ -227,9 +303,23 @@ export declare class StorageService {
|
|
|
227
303
|
* ADMINWRITE:所有用户可读,仅管理员可写
|
|
228
304
|
* ADMINONLY:仅管理员可读写
|
|
229
305
|
* CUSTOM:自定义安全规则
|
|
230
|
-
*
|
|
231
|
-
|
|
232
|
-
|
|
306
|
+
*
|
|
307
|
+
* @param options.withRule 是否返回自定义安全规则,默认 false 以保持向后兼容
|
|
308
|
+
* @returns 不传参数时返回 AclType(向后兼容),传入 { withRule: true } 时返回 { acl: AclType, rule?: IStorageAclRule }
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* // 向后兼容的简单用法(返回 AclType)
|
|
312
|
+
* const acl = await storage.getStorageAcl()
|
|
313
|
+
* if (acl === 'READONLY') { ... }
|
|
314
|
+
*
|
|
315
|
+
* // 获取自定义安全规则(返回对象)
|
|
316
|
+
* const result = await storage.getStorageAcl({ withRule: true })
|
|
317
|
+
* console.log(result.acl, result.rule)
|
|
318
|
+
*/
|
|
319
|
+
getStorageAcl(): Promise<AclType>;
|
|
320
|
+
getStorageAcl(options: {
|
|
321
|
+
withRule: true;
|
|
322
|
+
}): Promise<{
|
|
233
323
|
acl: AclType;
|
|
234
324
|
rule?: IStorageAclRule;
|
|
235
325
|
}>;
|
|
@@ -270,6 +360,16 @@ export declare class StorageService {
|
|
|
270
360
|
* @returns {Promise<IListFileInfo[]>}
|
|
271
361
|
*/
|
|
272
362
|
walkCloudDirCustom(options: IWalkCloudDirOptions): Promise<IListFileInfo[]>;
|
|
363
|
+
/**
|
|
364
|
+
* 列出指定目录下的文件和子目录(不递归,只列当前层)
|
|
365
|
+
* 使用 COS Delimiter 参数实现
|
|
366
|
+
* @param {string} dirPath 目录路径,空字符串表示根目录
|
|
367
|
+
* @returns {Promise<{ files: IListFileInfo[], directories: string[] }>}
|
|
368
|
+
*/
|
|
369
|
+
listCurrentDirectory(dirPath?: string): Promise<{
|
|
370
|
+
files: IListFileInfo[];
|
|
371
|
+
directories: string[];
|
|
372
|
+
}>;
|
|
273
373
|
/**
|
|
274
374
|
* 遍历本地文件夹
|
|
275
375
|
* 忽略不包含 dir 路径,即如果 ignore 匹配 dir,dir 也不会被忽略
|
|
@@ -300,6 +400,54 @@ export declare class StorageService {
|
|
|
300
400
|
* @memberof StorageService
|
|
301
401
|
*/
|
|
302
402
|
getBucket(options: IGetBucketOpions): Promise<any>;
|
|
403
|
+
/**
|
|
404
|
+
* 复制单个文件
|
|
405
|
+
* @param options.sourcePath 源文件路径(云端路径,如 images/a.jpg)
|
|
406
|
+
* @param options.destPath 目标文件路径(云端路径,如 backup/a.jpg)
|
|
407
|
+
* @param options.force 是否强制覆盖
|
|
408
|
+
* @param options.skipExisting 是否跳过已存在的文件
|
|
409
|
+
* @returns 复制结果
|
|
410
|
+
*/
|
|
411
|
+
copyFile(options: ICopyOptions): Promise<ICopyResult>;
|
|
412
|
+
/**
|
|
413
|
+
* 复制目录
|
|
414
|
+
* 遍历源目录下的所有文件,并行复制到目标目录
|
|
415
|
+
* @param options.sourcePath 源目录路径
|
|
416
|
+
* @param options.destPath 目标目录路径
|
|
417
|
+
* @param options.include 包含模式(glob 格式)
|
|
418
|
+
* @param options.exclude 排除模式(glob 格式)
|
|
419
|
+
* @param options.force 是否强制覆盖
|
|
420
|
+
* @param options.skipExisting 是否跳过已存在的文件
|
|
421
|
+
* @param options.parallel 并发数,默认 20
|
|
422
|
+
* @param options.onProgress 进度回调
|
|
423
|
+
* @returns 复制结果数组
|
|
424
|
+
*/
|
|
425
|
+
copyDirectory(options: ICopyDirectoryOptions): Promise<ICopyResult[]>;
|
|
426
|
+
/**
|
|
427
|
+
* 移动文件(复制后删除源文件)
|
|
428
|
+
* 注意:移动操作是「复制 + 删除」的两步操作,如果删除失败,文件会同时存在于源和目标位置
|
|
429
|
+
* @param options 与 copyFile 相同的选项
|
|
430
|
+
* @returns 移动结果,如果删除源文件失败会在 error 字段说明
|
|
431
|
+
*/
|
|
432
|
+
moveFile(options: ICopyOptions): Promise<ICopyResult>;
|
|
433
|
+
/**
|
|
434
|
+
* 移动目录(复制后删除源目录)
|
|
435
|
+
* 注意:移动操作是「复制 + 删除」的两步操作,如果部分删除失败,文件会同时存在于源和目标位置
|
|
436
|
+
* @param options 与 copyDirectory 相同的选项
|
|
437
|
+
* @returns 移动结果数组,删除失败的文件会在对应结果的 error 字段说明
|
|
438
|
+
*/
|
|
439
|
+
moveDirectory(options: ICopyDirectoryOptions): Promise<ICopyResult[]>;
|
|
440
|
+
/**
|
|
441
|
+
* 搜索文件和目录(只搜索当前目录,不递归)
|
|
442
|
+
* @param options.pattern 搜索模式(支持 glob 或正则表达式)
|
|
443
|
+
* @param options.path 搜索目录路径(不指定则搜索根目录)
|
|
444
|
+
* @param options.isRegex 是否为正则表达式模式
|
|
445
|
+
* @param options.fileType 文件类型过滤
|
|
446
|
+
* @param options.limit 限制返回数量,默认 100
|
|
447
|
+
* @param options.includeDetails 是否包含详细信息(大小、修改时间)
|
|
448
|
+
* @returns 搜索结果数组(包含文件和目录)
|
|
449
|
+
*/
|
|
450
|
+
searchFiles(options: ISearchOptions): Promise<ISearchResult[]>;
|
|
303
451
|
/**
|
|
304
452
|
* 获取 COS 配置
|
|
305
453
|
*/
|