aws-v3-sdk 1.0.19 → 1.0.21

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.
@@ -273,7 +273,7 @@ class DocumentClient {
273
273
  batchGetAsync (params, callback) {
274
274
  return new Promise((resolve, reject) => {
275
275
  const docClient = DynamoDBDocument.from(new DynamoDB())
276
- docClient.batchGet(params, function (err, data) {
276
+ docClient.batchGet(params, function (err, response) {
277
277
  if (err) reject(err)
278
278
  else {
279
279
  return resolve(response)
package/clients/s3.js CHANGED
@@ -1,4 +1,4 @@
1
- const { S3Client, GetObjectCommand, PutObjectCommand, ListObjectsCommand, DeleteObjectsCommand, CreateMultipartUploadCommand, CompleteMultipartUploadCommand } = require('@aws-sdk/client-s3')
1
+ const { S3Client, GetObjectCommand, PutObjectCommand, ListObjectsCommand, DeleteObjectsCommand, CreateMultipartUploadCommand, CompleteMultipartUploadCommand, UploadPartCommand } = require('@aws-sdk/client-s3')
2
2
  const { getSignedUrl } = require('@aws-sdk/s3-request-presigner')
3
3
  const client = new S3Client({})
4
4
 
@@ -23,6 +23,15 @@ class S3 {
23
23
  }).catch(err => {
24
24
  resolve(err)
25
25
  })
26
+ } else if (type === 'uploadPart') {
27
+ const Expires = params.Expires
28
+ delete params.Expires
29
+ const command = new UploadPartCommand(params)
30
+ getSignedUrl(client, command, { expiresIn: Expires }).then(url => {
31
+ resolve(url)
32
+ }).catch(err => {
33
+ resolve(err)
34
+ })
26
35
  }
27
36
  }).then(result => {
28
37
  if (callback && typeof callback === 'function') {
package/clients/sqs.js CHANGED
@@ -2,67 +2,23 @@ const { SQSClient, ReceiveMessageCommand, DeleteMessageCommand, SendMessageComma
2
2
  const snsClient = new SQSClient();
3
3
 
4
4
  class SQS {
5
- sendMessage (params, callback) {
6
- return new Promise((resolve, reject) => {
5
+ async sendMessage (params, callback) {
7
6
  const command = new SendMessageCommand(params)
8
- const response = snsClient.send(command).then(response=>{
9
- resolve(response)
10
- }).catch(err=>{
11
- reject(err)
12
- })
13
- }).then(result => {
14
- if (callback && typeof callback === 'function') {
15
- callback(null, result)
16
- }
17
- return result
18
- }).catch(error => {
19
- if (callback && typeof callback === 'function') {
20
- callback(error, null)
21
- }
22
- return Promise.reject(error)
23
- })
7
+ const response = await snsClient.send(command)
8
+ return response
24
9
  }
25
10
 
26
- receiveMessage (params, callback) {
27
- return new Promise((resolve, reject) => {
28
- const command = new ReceiveMessageCommand(params)
29
- const response = snsClient.send(command).then(response=>{
30
- resolve(response)
31
- }).catch(err=>{
32
- reject(err)
33
- })
34
- }).then(result => {
35
- if (callback && typeof callback === 'function') {
36
- callback(null, result)
37
- }
38
- return result
39
- }).catch(error => {
40
- if (callback && typeof callback === 'function') {
41
- callback(error, null)
42
- }
43
- return Promise.reject(error)
44
- })
45
- }
11
+ async receiveMessage (params, callback) {
12
+ const command = new ReceiveMessageCommand(params)
13
+ const response = await snsClient.send(command)
14
+ return response
15
+ }
16
+
46
17
 
47
- deleteMessage (params, callback) {
48
- return new Promise((resolve, reject) => {
18
+ async deleteMessage (params, callback) {
49
19
  const command = new DeleteMessageCommand(params)
50
- const response = snsClient.send(command).then(response=>{
51
- resolve(response)
52
- }).catch(err=>{
53
- reject(err)
54
- })
55
- }).then(result => {
56
- if (callback && typeof callback === 'function') {
57
- callback(null, result)
58
- }
59
- return result
60
- }).catch(error => {
61
- if (callback && typeof callback === 'function') {
62
- callback(error, null)
63
- }
64
- return Promise.reject(error)
65
- })
20
+ const response = await snsClient.send(command)
21
+ return response
66
22
  }
67
23
  }
68
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aws-v3-sdk",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "AWS v3 SDK Utils",
5
5
  "main": "index.js",
6
6
  "scripts": {