Skip to content

Commit db3cf7e

Browse files
committed
wip(feathers-import-export): Fix sonar issue : Promise-returning method provided where a void return was expected by extended/implemented type 'Writable'. #13
style(feathers-s3): fixed typo
1 parent 58675bf commit db3cf7e

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

packages/feathers-import-export/src/import.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ class ServiceWriteStream extends Writable {
1919
async _write (chunk, encoding, next) {
2020
this.chunkCount++
2121
this.objectCount += Array.isArray(chunk) ? chunk.length : 1
22-
if (this.data.transform) {
23-
if (typeof this.data.transform === 'function') chunk = await this.transform(chunk, this.data)
24-
else chunk = transform(chunk, this.data.transform)
22+
const process = async () => {
23+
if (this.data.transform) {
24+
if (typeof this.data.transform === 'function') { chunk = await this.transform(chunk, this.data) } else { chunk = transform(chunk, this.data.transform) }
25+
}
26+
await this.data.service.create(chunk)
2527
}
26-
await this.data.service.create(chunk)
27-
next()
28+
process().then(() => next()).catch(next)
2829
}
2930
}
3031

packages/feathers-s3/src/server/service.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ import _ from 'lodash'
77
import createDebug from 'debug'
88
import { BadRequest } from '@feathersjs/errors'
99
import {
10-
S3Client, ListObjectsCommand, GetObjectCommand, PutObjectCommand, DeleteObjectCommand, DeleteObjectsCommand,
11-
CreateMultipartUploadCommand, UploadPartCommand, CompleteMultipartUploadCommand
10+
S3Client,
11+
ListObjectsCommand,
12+
GetObjectCommand,
13+
PutObjectCommand,
14+
DeleteObjectCommand,
15+
DeleteObjectsCommand,
16+
CreateMultipartUploadCommand,
17+
UploadPartCommand,
18+
CompleteMultipartUploadCommand
1219
} from '@aws-sdk/client-s3'
1320
import { getSignedUrl } from '@aws-sdk/s3-request-presigner'
1421

@@ -179,7 +186,7 @@ export class Service {
179186
}
180187

181188
async completeMultipartUpload (data, params) {
182-
// check paylod
189+
// check payload
183190
if (!data.id) throw new BadRequest('completeMultipartUpload: mising \'data.id\'')
184191
if (!data.uploadId && !data.UploadId) throw new BadRequest('completeMultipartUpload: missing \'data.[U|u]ploadId\'')
185192
if (!data.parts) throw new BadRequest('completeMultipartUpload: missing \'data.parts\'')

0 commit comments

Comments
 (0)