@@ -322,17 +322,15 @@ class NamespaceGCP {
322322 dbg . log0 ( 'NamespaceGCP.create_object_upload:' , this . bucket , inspect ( params ) ) ;
323323 const Tagging = params . tagging && params . tagging . map ( tag => tag . key + '=' + tag . value ) . join ( '&' ) ;
324324
325- /** @type {import('@aws-sdk/client-s3').CreateMultipartUploadRequest } */
326- const mp_upload_input = {
327- Bucket : this . bucket ,
328- Key : params . key ,
329- ContentType : params . content_type ,
330- StorageClass : params . storage_class ,
331- Metadata : params . xattr ,
332- Tagging
333- } ;
334- const mp_upload_cmd = new CreateMultipartUploadCommand ( mp_upload_input ) ;
335- const res = await this . s3_client . send ( mp_upload_cmd ) ;
325+ const res = await this . s3_client . send (
326+ new CreateMultipartUploadCommand ( {
327+ Bucket : this . bucket ,
328+ Key : params . key ,
329+ ContentType : params . content_type ,
330+ StorageClass : params . storage_class ,
331+ Metadata : params . xattr ,
332+ Tagging
333+ } ) ) ;
336334
337335 dbg . log0 ( 'NamespaceGCP.create_object_upload:' , this . bucket , inspect ( params ) , 'res' , inspect ( res ) ) ;
338336 return { obj_id : res . UploadId } ;
@@ -344,18 +342,16 @@ class NamespaceGCP {
344342 let res ;
345343 if ( params . copy_source ) {
346344 const { copy_source, copy_source_range } = s3_utils . format_copy_source ( params . copy_source ) ;
347- /** @type {import('@aws-sdk/client-s3').UploadPartCopyRequest } */
348- const request = {
349- Bucket : this . bucket ,
350- Key : params . key ,
351- UploadId : params . obj_id ,
352- PartNumber : params . num ,
353- CopySource : copy_source ,
354- CopySourceRange : copy_source_range ,
355- } ;
356345
357- const command = new UploadPartCopyCommand ( request ) ;
358- res = await this . s3_client . send ( command ) ;
346+ res = await this . s3_client . send (
347+ new UploadPartCopyCommand ( {
348+ Bucket : this . bucket ,
349+ Key : params . key ,
350+ UploadId : params . obj_id ,
351+ PartNumber : params . num ,
352+ CopySource : copy_source ,
353+ CopySourceRange : copy_source_range ,
354+ } ) ) ;
359355 etag = s3_utils . parse_etag ( res . CopyPartResult . ETag ) ;
360356 } else {
361357 let count = 1 ;
@@ -368,19 +364,17 @@ class NamespaceGCP {
368364 // clear count for next updates
369365 count = 0 ;
370366 } ) ;
371- /** @type {import('@aws-sdk/client-s3').UploadPartRequest } */
372- const request = {
373- Bucket : this . bucket ,
374- Key : params . key ,
375- UploadId : params . obj_id ,
376- PartNumber : params . num ,
377- Body : params . source_stream . pipe ( count_stream ) ,
378- ContentMD5 : params . md5_b64 ,
379- ContentLength : params . size ,
380- } ;
381367 try {
382- const command = new UploadPartCommand ( request ) ;
383- res = await this . s3_client . send ( command ) ;
368+ res = await this . s3_client . send (
369+ new UploadPartCommand ( {
370+ Bucket : this . bucket ,
371+ Key : params . key ,
372+ UploadId : params . obj_id ,
373+ PartNumber : params . num ,
374+ Body : params . source_stream . pipe ( count_stream ) ,
375+ ContentMD5 : params . md5_b64 ,
376+ ContentLength : params . size ,
377+ } ) ) ;
384378 } catch ( err ) {
385379 fix_error_object ( err ) ;
386380 object_sdk . rpc_client . pool . update_issues_report ( {
@@ -399,16 +393,14 @@ class NamespaceGCP {
399393 async list_multiparts ( params , object_sdk ) {
400394 dbg . log0 ( 'NamespaceGCP.list_multiparts:' , this . bucket , inspect ( params ) ) ;
401395
402- /** @type {import('@aws-sdk/client-s3').ListPartsRequest } */
403- const request = {
404- Bucket : this . bucket ,
405- Key : params . key ,
406- UploadId : params . obj_id ,
407- MaxParts : params . max ,
408- PartNumberMarker : params . num_marker ,
409- } ;
410- const command = new ListPartsCommand ( request ) ;
411- const res = await this . s3_client . send ( command ) ;
396+ const res = await this . s3_client . send (
397+ new ListPartsCommand ( {
398+ Bucket : this . bucket ,
399+ Key : params . key ,
400+ UploadId : params . obj_id ,
401+ MaxParts : params . max ,
402+ PartNumberMarker : params . num_marker ,
403+ } ) ) ;
412404
413405 dbg . log0 ( 'NamespaceGCP.list_multiparts:' , this . bucket , inspect ( params ) , 'res' , inspect ( res ) ) ;
414406 return {
@@ -426,20 +418,18 @@ class NamespaceGCP {
426418 async complete_object_upload ( params , object_sdk ) {
427419 dbg . log0 ( 'NamespaceGCP.complete_object_upload:' , this . bucket , inspect ( params ) ) ;
428420
429- /** @type {import('@aws-sdk/client-s3').CompleteMultipartUploadRequest } */
430- const request = {
431- Bucket : this . bucket ,
432- Key : params . key ,
433- UploadId : params . obj_id ,
434- MultipartUpload : {
435- Parts : _ . map ( params . multiparts , p => ( {
436- PartNumber : p . num ,
437- ETag : `"${ p . etag } "` ,
438- } ) )
439- }
440- } ;
441- const command = new CompleteMultipartUploadCommand ( request ) ;
442- const res = await this . s3_client . send ( command ) ;
421+ const res = await this . s3_client . send (
422+ new CompleteMultipartUploadCommand ( {
423+ Bucket : this . bucket ,
424+ Key : params . key ,
425+ UploadId : params . obj_id ,
426+ MultipartUpload : {
427+ Parts : _ . map ( params . multiparts , p => ( {
428+ PartNumber : p . num ,
429+ ETag : `"${ p . etag } "` ,
430+ } ) )
431+ }
432+ } ) ) ;
443433
444434 dbg . log0 ( 'NamespaceGCP.complete_object_upload:' , this . bucket , inspect ( params ) , 'res' , inspect ( res ) ) ;
445435 const etag = s3_utils . parse_etag ( res . ETag ) ;
@@ -448,14 +438,13 @@ class NamespaceGCP {
448438
449439 async abort_object_upload ( params , object_sdk ) {
450440 dbg . log0 ( 'NamespaceGCP.abort_object_upload:' , this . bucket , inspect ( params ) ) ;
451- /** @type {import('@aws-sdk/client-s3').AbortMultipartUploadRequest } */
452- const request = {
453- Bucket : this . bucket ,
454- Key : params . key ,
455- UploadId : params . obj_id ,
456- } ;
457- const command = new AbortMultipartUploadCommand ( request ) ;
458- const res = await this . s3_client . send ( command ) ;
441+
442+ const res = await this . s3_client . send (
443+ new AbortMultipartUploadCommand ( {
444+ Bucket : this . bucket ,
445+ Key : params . key ,
446+ UploadId : params . obj_id ,
447+ } ) ) ;
459448
460449 dbg . log0 ( 'NamespaceGCP.abort_object_upload:' , this . bucket , inspect ( params ) , 'res' , inspect ( res ) ) ;
461450 }
0 commit comments