@@ -148,6 +148,14 @@ export declare namespace conf {
148148 useHttpsDomain ?: boolean ;
149149
150150 /**
151+ * 在使用前需要提前开通加速域名
152+ * 详见:https://developer.qiniu.com/kodo/12656/transfer-acceleration
153+ * @default false
154+ */
155+ accelerateUploading ?: boolean ;
156+
157+ /**
158+ * @deprecated 实际已无加速上传能力,使用 accelerateUploading 代替
151159 * @default true
152160 */
153161 useCdnDomain ?: boolean ;
@@ -181,10 +189,15 @@ export declare namespace conf {
181189 }
182190 class Config {
183191 useHttpsDomain : boolean ;
192+ accelerateUploading : boolean ;
193+ /**
194+ * @deprecated 实际已无加速上传能力,使用 accelerateUploading 代替
195+ */
184196 useCdnDomain : boolean ;
185197 ucEndpointsProvider ?: httpc . EndpointsProvider | null ;
186198 queryRegionsEndpointsProvider ?: httpc . EndpointsProvider | null ;
187199 regionsProvider ?: httpc . RegionsProvider | null ;
200+ regionsQueryResultCachePath ?: string | null ;
188201 zone ?: Zone | null ;
189202 zoneExpire ?: number ;
190203
@@ -337,7 +350,7 @@ export declare namespace form_up {
337350export declare namespace resume_up {
338351 type UploadResult = {
339352 data : any ;
340- resp : IncomingMessage ;
353+ resp : Omit < IncomingMessage , 'url' > & { requestUrls : string [ ] } ;
341354 }
342355
343356 class ResumeUploader {
@@ -412,13 +425,14 @@ export declare namespace resume_up {
412425
413426 /**
414427 * @default null
428+ * @deprecated 使用 `resumeRecorder` 与 `resumeKey` 代替
415429 */
416- resumeRecordFile ?: string
430+ resumeRecordFile ?: string | null
417431
418432 /**
419433 * @default null
420434 */
421- progressCallback ?: ( uploadBytes : number , totalBytes : number ) => void
435+ progressCallback ?: ( ( uploadBytes : number , totalBytes : number ) => void ) | null
422436
423437 /**
424438 * @default v1
@@ -435,6 +449,18 @@ export declare namespace resume_up {
435449 */
436450 metadata ?: Record < string , string >
437451
452+ /**
453+ * 断点续传记录器,请通过 `createResumeRecorder` 或 `createResumeRecorderSync` 获取,优先级比 `resumeRecordFile` 低
454+ * @default null
455+ */
456+ resumeRecorder ?: ResumeRecorder
457+
458+ /**
459+ * 断点续传记录文件的具体文件名,不设置时会由当次上传自动生成
460+ * @default null
461+ */
462+ resumeKey ?: string | null
463+
438464 /**
439465 * 上传可选参数
440466 * @param fname 请求体中的文件的名称
@@ -445,11 +471,32 @@ export declare namespace resume_up {
445471 * @param partSize 分片上传v2必传字段 默认大小为4MB 分片大小范围为1 MB - 1 GB
446472 * @param version 分片上传版本 目前支持v1/v2版本 默认v1
447473 * @param metadata 元数据设置,参数名称必须以 x-qn-meta-${name}: 开头
474+ * @param resumeRecorder 断点续传记录器,请通过 `createResumeRecorder` 或 `createResumeRecorderSync` 获取,优先级比 `resumeRecordFile` 低
475+ * @param resumeKey 断点续传记录文件的具体文件名,不设置时会由当次上传自动生成,推荐不设置
448476 */
449477 constructor ( fname ?: string , params ?: Record < string , string > , mimeType ?: string , resumeRecordFile ?: string ,
450478 progressCallback ?: ( uploadBytes : number , totalBytes : number ) => void ,
451- partSize ?:number , version ?:string , metadata ?: Record < string , string > ) ;
479+ partSize ?:number , version ?:string , metadata ?: Record < string , string > ,
480+ resumeRecorder ?: ResumeRecorder , resumeKey ?: string ) ;
481+ }
482+
483+ /**
484+ * 历史原因其方法当前仅支持了同步调用这一不推荐的使用方式,暂不公开具体内部信息,仅供 TypeScript 类型检查使用。
485+ * 实际不存在这个类,未来会变更为 interface。
486+ */
487+ abstract class ResumeRecorder {
452488 }
489+
490+ /**
491+ *
492+ * @param baseDirPath 默认值为 `os.tmpdir()`,该方法若 baseDirPath 不存在将自动创建
493+ */
494+ function createResumeRecorder ( baseDirPath ?: string ) : Promise < ResumeRecorder >
495+
496+ /**
497+ * `createResumeRecorder` 的同步版本,不推荐使用
498+ */
499+ function createResumeRecorderSync ( baseDirPath ?: string ) : ResumeRecorder
453500}
454501
455502export declare namespace util {
@@ -514,8 +561,22 @@ export declare namespace util {
514561 * @param requestURI 回调的URL中的requestURI
515562 * @param reqBody 回调的URL中的requestURI 请求Body,仅当请求的ContentType为application/x-www-form-urlencoded时才需要传入该参数
516563 * @param callbackAuth 回调时请求的Authorization头部值
564+ * @param extra 当回调为 Qiniu 签名时需要传入
565+ * @param extra.reqMethod 请求方法,例如 GET,POST
566+ * @param extra.reqContentType 请求类型,例如 application/json 或者 application/x-www-form-urlencoded
567+ * @param extra.reqHeaders 请求头部
517568 */
518- function isQiniuCallback ( mac : auth . digest . Mac , requestURI : string , reqBody : string | null , callbackAuth : string ) : boolean ;
569+ function isQiniuCallback (
570+ mac : auth . digest . Mac ,
571+ requestURI : string ,
572+ reqBody : string | null ,
573+ callbackAuth : string ,
574+ extra ?: {
575+ reqMethod : string ,
576+ reqContentType ?: string ,
577+ reqHeaders ?: Record < string , string >
578+ }
579+ ) : boolean ;
519580}
520581
521582export declare namespace httpc {
@@ -531,7 +592,7 @@ export declare namespace httpc {
531592 // responseWrapper.js
532593 interface ResponseWrapperOptions < T = any > {
533594 data : T ;
534- resp : IncomingMessage ;
595+ resp : Omit < IncomingMessage , 'url' > & { requestUrls : string [ ] } ;
535596 }
536597
537598 interface ResponseError {
@@ -541,7 +602,7 @@ export declare namespace httpc {
541602
542603 class ResponseWrapper < T = any > {
543604 data : T extends void ? undefined | ResponseError : T & ResponseError ;
544- resp : IncomingMessage ;
605+ resp : Omit < IncomingMessage , 'url' > & { requestUrls : string [ ] } ;
545606 constructor ( options : ResponseWrapperOptions ) ;
546607 ok ( ) : boolean ;
547608 needRetry ( ) : boolean ;
@@ -643,17 +704,17 @@ export declare namespace httpc {
643704 middlewares ?: middleware . Middleware [ ] ;
644705 }
645706
646- interface GetOptions < T = any > extends ReqOpts < T > {
707+ interface GetOptions < T = any > extends Omit < ReqOpts < T > , 'urllibOptions' > {
647708 params : Record < string , string > ;
648709 headers : Record < string , string > ;
649710 }
650711
651- interface PostOptions < T = any > extends ReqOpts < T > {
712+ interface PostOptions < T = any > extends Omit < ReqOpts < T > , 'urllibOptions' > {
652713 data : string | Buffer | Readable ;
653714 headers : Record < string , string > ;
654715 }
655716
656- interface PutOptions < T = any > extends ReqOpts < T > {
717+ interface PutOptions < T = any > extends Omit < ReqOpts < T > , 'urllibOptions' > {
657718 data : string | Buffer | Readable ;
658719 headers : Record < string , string >
659720 }
@@ -664,9 +725,9 @@ export declare namespace httpc {
664725 middlewares : middleware . Middleware [ ] ;
665726 constructor ( options : HttpClientOptions )
666727 sendRequest ( requestOptions : ReqOpts ) : Promise < ResponseWrapper >
667- get ( getOptions : GetOptions ) : Promise < ResponseWrapper >
668- post ( postOptions : PostOptions ) : Promise < ResponseWrapper >
669- put ( putOptions : PutOptions ) : Promise < ResponseWrapper >
728+ get ( getOptions : GetOptions , urllibOptions ?: RequestOptions ) : Promise < ResponseWrapper >
729+ post ( postOptions : PostOptions , urllibOptions ?: RequestOptions ) : Promise < ResponseWrapper >
730+ put ( putOptions : PutOptions , urllibOptions ?: RequestOptions ) : Promise < ResponseWrapper >
670731 }
671732
672733 // endpoint.js
@@ -688,12 +749,15 @@ export declare namespace httpc {
688749 getValue ( options ?: { scheme ?: string } ) : string ;
689750
690751 getEndpoints ( ) : Promise < httpc . Endpoint [ ] > ;
752+
753+ clone ( ) : Endpoint ;
691754 }
692755
693756 // region.js
694757 enum SERVICE_NAME {
695758 UC = 'uc' ,
696759 UP = 'up' ,
760+ UP_ACC = 'up_acc' ,
697761 IO = 'io' ,
698762 RS = 'rs' ,
699763 RSF = 'rsf' ,
@@ -764,6 +828,7 @@ export declare namespace httpc {
764828 class Region implements RegionsProvider {
765829 static fromZone ( zone : conf . Zone , options ?: RegionFromZoneOptions ) : Region ;
766830 static fromRegionId ( regionId : string , options ?: RegionFromRegionIdOptions ) : Region ;
831+ static merge ( ...r : Region [ ] ) : Region ;
767832
768833 // non-unique
769834 regionId ?: string ;
@@ -777,6 +842,10 @@ export declare namespace httpc {
777842
778843 getRegions ( ) : Promise < httpc . Region [ ] > ;
779844
845+ clone ( ) : Region ;
846+
847+ merge ( ...r : Region [ ] ) : Region ;
848+
780849 get isLive ( ) : boolean ;
781850 }
782851
@@ -1288,6 +1357,32 @@ export declare namespace rs {
12881357 * @param callbackFunc
12891358 */
12901359 listBucket ( callbackFunc ?: callback ) : Promise < httpc . ResponseWrapper < GetBucketsResult > >
1360+ listBucket ( options : { shared : string , tagCondition : Record < string , string > } , callbackFunc ?: callback ) : Promise < httpc . ResponseWrapper < GetBucketsResult > >
1361+
1362+ /**
1363+ * 创建空间
1364+ * @param bucket 空间名
1365+ * @param options 选项
1366+ * @param options.regionId 区域 ID
1367+ * @param callbackFunc 回调函数
1368+ */
1369+ createBucket (
1370+ bucket : string ,
1371+ options : {
1372+ regionId : string
1373+ } ,
1374+ callbackFunc ?: callback
1375+ ) : Promise < httpc . ResponseWrapper < void > >
1376+
1377+ /**
1378+ * 删除空间
1379+ * @param bucket 空间名
1380+ * @param callbackFunc 回调函数
1381+ */
1382+ deleteBucket (
1383+ bucket : string ,
1384+ callbackFunc ?: callback
1385+ ) : Promise < httpc . ResponseWrapper < void > >
12911386
12921387 /**
12931388 * 获取空间详情
0 commit comments