@@ -148,6 +148,14 @@ export declare namespace conf {
148
148
useHttpsDomain ?: boolean ;
149
149
150
150
/**
151
+ * 在使用前需要提前开通加速域名
152
+ * 详见:https://developer.qiniu.com/kodo/12656/transfer-acceleration
153
+ * @default false
154
+ */
155
+ accelerateUploading ?: boolean ;
156
+
157
+ /**
158
+ * @deprecated 实际已无加速上传能力,使用 accelerateUploading 代替
151
159
* @default true
152
160
*/
153
161
useCdnDomain ?: boolean ;
@@ -181,10 +189,15 @@ export declare namespace conf {
181
189
}
182
190
class Config {
183
191
useHttpsDomain : boolean ;
192
+ accelerateUploading : boolean ;
193
+ /**
194
+ * @deprecated 实际已无加速上传能力,使用 accelerateUploading 代替
195
+ */
184
196
useCdnDomain : boolean ;
185
197
ucEndpointsProvider ?: httpc . EndpointsProvider | null ;
186
198
queryRegionsEndpointsProvider ?: httpc . EndpointsProvider | null ;
187
199
regionsProvider ?: httpc . RegionsProvider | null ;
200
+ regionsQueryResultCachePath ?: string | null ;
188
201
zone ?: Zone | null ;
189
202
zoneExpire ?: number ;
190
203
@@ -337,7 +350,7 @@ export declare namespace form_up {
337
350
export declare namespace resume_up {
338
351
type UploadResult = {
339
352
data : any ;
340
- resp : IncomingMessage ;
353
+ resp : Omit < IncomingMessage , 'url' > & { requestUrls : string [ ] } ;
341
354
}
342
355
343
356
class ResumeUploader {
@@ -412,13 +425,14 @@ export declare namespace resume_up {
412
425
413
426
/**
414
427
* @default null
428
+ * @deprecated 使用 `resumeRecorder` 与 `resumeKey` 代替
415
429
*/
416
- resumeRecordFile ?: string
430
+ resumeRecordFile ?: string | null
417
431
418
432
/**
419
433
* @default null
420
434
*/
421
- progressCallback ?: ( uploadBytes : number , totalBytes : number ) => void
435
+ progressCallback ?: ( ( uploadBytes : number , totalBytes : number ) => void ) | null
422
436
423
437
/**
424
438
* @default v1
@@ -435,6 +449,18 @@ export declare namespace resume_up {
435
449
*/
436
450
metadata ?: Record < string , string >
437
451
452
+ /**
453
+ * 断点续传记录器,请通过 `createResumeRecorder` 或 `createResumeRecorderSync` 获取,优先级比 `resumeRecordFile` 低
454
+ * @default null
455
+ */
456
+ resumeRecorder ?: ResumeRecorder
457
+
458
+ /**
459
+ * 断点续传记录文件的具体文件名,不设置时会由当次上传自动生成
460
+ * @default null
461
+ */
462
+ resumeKey ?: string | null
463
+
438
464
/**
439
465
* 上传可选参数
440
466
* @param fname 请求体中的文件的名称
@@ -445,11 +471,32 @@ export declare namespace resume_up {
445
471
* @param partSize 分片上传v2必传字段 默认大小为4MB 分片大小范围为1 MB - 1 GB
446
472
* @param version 分片上传版本 目前支持v1/v2版本 默认v1
447
473
* @param metadata 元数据设置,参数名称必须以 x-qn-meta-${name}: 开头
474
+ * @param resumeRecorder 断点续传记录器,请通过 `createResumeRecorder` 或 `createResumeRecorderSync` 获取,优先级比 `resumeRecordFile` 低
475
+ * @param resumeKey 断点续传记录文件的具体文件名,不设置时会由当次上传自动生成,推荐不设置
448
476
*/
449
477
constructor ( fname ?: string , params ?: Record < string , string > , mimeType ?: string , resumeRecordFile ?: string ,
450
478
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 {
452
488
}
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
453
500
}
454
501
455
502
export declare namespace util {
@@ -514,8 +561,22 @@ export declare namespace util {
514
561
* @param requestURI 回调的URL中的requestURI
515
562
* @param reqBody 回调的URL中的requestURI 请求Body,仅当请求的ContentType为application/x-www-form-urlencoded时才需要传入该参数
516
563
* @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 请求头部
517
568
*/
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 ;
519
580
}
520
581
521
582
export declare namespace httpc {
@@ -531,7 +592,7 @@ export declare namespace httpc {
531
592
// responseWrapper.js
532
593
interface ResponseWrapperOptions < T = any > {
533
594
data : T ;
534
- resp : IncomingMessage ;
595
+ resp : Omit < IncomingMessage , 'url' > & { requestUrls : string [ ] } ;
535
596
}
536
597
537
598
interface ResponseError {
@@ -541,7 +602,7 @@ export declare namespace httpc {
541
602
542
603
class ResponseWrapper < T = any > {
543
604
data : T extends void ? undefined | ResponseError : T & ResponseError ;
544
- resp : IncomingMessage ;
605
+ resp : Omit < IncomingMessage , 'url' > & { requestUrls : string [ ] } ;
545
606
constructor ( options : ResponseWrapperOptions ) ;
546
607
ok ( ) : boolean ;
547
608
needRetry ( ) : boolean ;
@@ -643,17 +704,17 @@ export declare namespace httpc {
643
704
middlewares ?: middleware . Middleware [ ] ;
644
705
}
645
706
646
- interface GetOptions < T = any > extends ReqOpts < T > {
707
+ interface GetOptions < T = any > extends Omit < ReqOpts < T > , 'urllibOptions' > {
647
708
params : Record < string , string > ;
648
709
headers : Record < string , string > ;
649
710
}
650
711
651
- interface PostOptions < T = any > extends ReqOpts < T > {
712
+ interface PostOptions < T = any > extends Omit < ReqOpts < T > , 'urllibOptions' > {
652
713
data : string | Buffer | Readable ;
653
714
headers : Record < string , string > ;
654
715
}
655
716
656
- interface PutOptions < T = any > extends ReqOpts < T > {
717
+ interface PutOptions < T = any > extends Omit < ReqOpts < T > , 'urllibOptions' > {
657
718
data : string | Buffer | Readable ;
658
719
headers : Record < string , string >
659
720
}
@@ -664,9 +725,9 @@ export declare namespace httpc {
664
725
middlewares : middleware . Middleware [ ] ;
665
726
constructor ( options : HttpClientOptions )
666
727
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 >
670
731
}
671
732
672
733
// endpoint.js
@@ -688,12 +749,15 @@ export declare namespace httpc {
688
749
getValue ( options ?: { scheme ?: string } ) : string ;
689
750
690
751
getEndpoints ( ) : Promise < httpc . Endpoint [ ] > ;
752
+
753
+ clone ( ) : Endpoint ;
691
754
}
692
755
693
756
// region.js
694
757
enum SERVICE_NAME {
695
758
UC = 'uc' ,
696
759
UP = 'up' ,
760
+ UP_ACC = 'up_acc' ,
697
761
IO = 'io' ,
698
762
RS = 'rs' ,
699
763
RSF = 'rsf' ,
@@ -764,6 +828,7 @@ export declare namespace httpc {
764
828
class Region implements RegionsProvider {
765
829
static fromZone ( zone : conf . Zone , options ?: RegionFromZoneOptions ) : Region ;
766
830
static fromRegionId ( regionId : string , options ?: RegionFromRegionIdOptions ) : Region ;
831
+ static merge ( ...r : Region [ ] ) : Region ;
767
832
768
833
// non-unique
769
834
regionId ?: string ;
@@ -777,6 +842,10 @@ export declare namespace httpc {
777
842
778
843
getRegions ( ) : Promise < httpc . Region [ ] > ;
779
844
845
+ clone ( ) : Region ;
846
+
847
+ merge ( ...r : Region [ ] ) : Region ;
848
+
780
849
get isLive ( ) : boolean ;
781
850
}
782
851
@@ -1288,6 +1357,32 @@ export declare namespace rs {
1288
1357
* @param callbackFunc
1289
1358
*/
1290
1359
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 > >
1291
1386
1292
1387
/**
1293
1388
* 获取空间详情
0 commit comments