aws-v3-sdk 1.0.19 → 1.0.20
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.
- package/clients/sqs.js +12 -56
- package/package.json +1 -1
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
|
-
|
|
6
|
-
return new Promise((resolve, reject) => {
|
|
5
|
+
async sendMessage (params, callback) {
|
|
7
6
|
const command = new SendMessageCommand(params)
|
|
8
|
-
const response = snsClient.send(command)
|
|
9
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
48
|
-
return new Promise((resolve, reject) => {
|
|
18
|
+
async deleteMessage (params, callback) {
|
|
49
19
|
const command = new DeleteMessageCommand(params)
|
|
50
|
-
const response = snsClient.send(command)
|
|
51
|
-
|
|
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
|
|