aws-v3-sdk 1.0.24 → 1.0.26
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/cognito.js +6 -8
- package/clients/dynamo/DocumentClient.js +15 -9
- package/clients/lambda.js +9 -2
- package/clients/s3.js +9 -1
- package/clients/sns.js +13 -5
- package/clients/sqs.js +19 -13
- package/package.json +1 -1
package/clients/cognito.js
CHANGED
|
@@ -15,7 +15,7 @@ class CognitoIdentityServiceProvider {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
async adminCreateUser (params, callback) {
|
|
18
|
-
const command = new AdminCreateUserCommand(params)
|
|
18
|
+
const command = new AdminCreateUserCommand(params)
|
|
19
19
|
this.client.send(command).then(data => {
|
|
20
20
|
callback(null, data)
|
|
21
21
|
}).catch(err => {
|
|
@@ -24,7 +24,7 @@ class CognitoIdentityServiceProvider {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
async adminSetUserMFAPreference (params, callback) {
|
|
27
|
-
const command = new AdminSetUserMFAPreferenceCommand(params)
|
|
27
|
+
const command = new AdminSetUserMFAPreferenceCommand(params)
|
|
28
28
|
this.client.send(command).then(data => {
|
|
29
29
|
callback(null, data)
|
|
30
30
|
}).catch(err => {
|
|
@@ -33,7 +33,7 @@ class CognitoIdentityServiceProvider {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
async adminDeleteUser (params, callback) {
|
|
36
|
-
const command = new AdminDeleteUserCommand(params)
|
|
36
|
+
const command = new AdminDeleteUserCommand(params)
|
|
37
37
|
this.client.send(command).then(data => {
|
|
38
38
|
callback(null, data)
|
|
39
39
|
}).catch(err => {
|
|
@@ -42,7 +42,7 @@ class CognitoIdentityServiceProvider {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
async adminEnableUser (params, callback) {
|
|
45
|
-
const command = new AdminEnableUserCommand(params)
|
|
45
|
+
const command = new AdminEnableUserCommand(params)
|
|
46
46
|
this.client.send(command).then(data => {
|
|
47
47
|
callback(null, data)
|
|
48
48
|
}).catch(err => {
|
|
@@ -50,9 +50,8 @@ class CognitoIdentityServiceProvider {
|
|
|
50
50
|
})
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
54
53
|
async adminDisableUser (params, callback) {
|
|
55
|
-
const command = new AdminDisableUserCommand(params)
|
|
54
|
+
const command = new AdminDisableUserCommand(params)
|
|
56
55
|
this.client.send(command).then(data => {
|
|
57
56
|
callback(null, data)
|
|
58
57
|
}).catch(err => {
|
|
@@ -61,14 +60,13 @@ class CognitoIdentityServiceProvider {
|
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
async adminUserGlobalSignOut (params, callback) {
|
|
64
|
-
const command = new AdminUserGlobalSignOutCommand(params)
|
|
63
|
+
const command = new AdminUserGlobalSignOutCommand(params)
|
|
65
64
|
this.client.send(command).then(data => {
|
|
66
65
|
callback(null, data)
|
|
67
66
|
}).catch(err => {
|
|
68
67
|
callback(err)
|
|
69
68
|
})
|
|
70
69
|
}
|
|
71
|
-
|
|
72
70
|
}
|
|
73
71
|
|
|
74
72
|
module.exports = CognitoIdentityServiceProvider
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
const { DynamoDB, DynamoDBClient } = require('@aws-sdk/client-dynamodb')
|
|
2
2
|
const { DynamoDBDocument, DynamoDBDocumentClient, GetCommand, BatchWriteCommand, PutCommand, QueryCommand, ScanCommand, DeleteCommand } = require('@aws-sdk/lib-dynamodb')
|
|
3
|
-
const ddb = new DynamoDBClient()
|
|
4
|
-
const documentClient = DynamoDBDocumentClient.from(ddb)
|
|
5
3
|
|
|
4
|
+
const { Agent } = require('https')
|
|
5
|
+
const { NodeHttpHandler } = require('@aws-sdk/node-http-handler')
|
|
6
|
+
|
|
7
|
+
const ddb = new DynamoDBClient({
|
|
8
|
+
requestHandler: new NodeHttpHandler({
|
|
9
|
+
httpsAgent: new Agent({ keepAlive: false })
|
|
10
|
+
})
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const documentClient = DynamoDBDocumentClient.from(ddb)
|
|
6
14
|
class DocumentClient {
|
|
7
15
|
get (params, callback) {
|
|
8
16
|
const getCommand = new GetCommand(params)
|
|
@@ -60,7 +68,7 @@ class DocumentClient {
|
|
|
60
68
|
}
|
|
61
69
|
|
|
62
70
|
delete (params, callback) {
|
|
63
|
-
const docClient = DynamoDBDocument.from(
|
|
71
|
+
const docClient = DynamoDBDocument.from(ddb)
|
|
64
72
|
docClient.delete(params, (err, response) => {
|
|
65
73
|
if (err) {
|
|
66
74
|
return callback(err)
|
|
@@ -109,7 +117,7 @@ class DocumentClient {
|
|
|
109
117
|
}
|
|
110
118
|
|
|
111
119
|
batchGet (params, callback) {
|
|
112
|
-
const docClient = DynamoDBDocument.from(
|
|
120
|
+
const docClient = DynamoDBDocument.from(ddb)
|
|
113
121
|
|
|
114
122
|
docClient.batchGet(params, function (err, data) {
|
|
115
123
|
if (err) callback(err)
|
|
@@ -180,7 +188,6 @@ class DocumentClient {
|
|
|
180
188
|
return resolve(null)
|
|
181
189
|
}
|
|
182
190
|
})
|
|
183
|
-
|
|
184
191
|
}).then(result => {
|
|
185
192
|
if (callback && typeof callback === 'function') {
|
|
186
193
|
callback(null, result)
|
|
@@ -225,7 +232,7 @@ class DocumentClient {
|
|
|
225
232
|
|
|
226
233
|
deleteAsync (params, callback) {
|
|
227
234
|
return new Promise((resolve, reject) => {
|
|
228
|
-
const docClient = DynamoDBDocument.from(
|
|
235
|
+
const docClient = DynamoDBDocument.from(ddb)
|
|
229
236
|
docClient.delete(params, (err, response) => {
|
|
230
237
|
if (err) {
|
|
231
238
|
return resolve(err)
|
|
@@ -248,7 +255,7 @@ class DocumentClient {
|
|
|
248
255
|
|
|
249
256
|
updateAsync (params, callback) {
|
|
250
257
|
return new Promise((resolve, reject) => {
|
|
251
|
-
const docClient = DynamoDBDocument.from(
|
|
258
|
+
const docClient = DynamoDBDocument.from(ddb)
|
|
252
259
|
docClient.update(params, (err, response) => {
|
|
253
260
|
if (err) {
|
|
254
261
|
return resolve(err)
|
|
@@ -269,10 +276,9 @@ class DocumentClient {
|
|
|
269
276
|
})
|
|
270
277
|
}
|
|
271
278
|
|
|
272
|
-
|
|
273
279
|
batchGetAsync (params, callback) {
|
|
274
280
|
return new Promise((resolve, reject) => {
|
|
275
|
-
const docClient = DynamoDBDocument.from(
|
|
281
|
+
const docClient = DynamoDBDocument.from(ddb)
|
|
276
282
|
docClient.batchGet(params, function (err, response) {
|
|
277
283
|
if (err) reject(err)
|
|
278
284
|
else {
|
package/clients/lambda.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
const { LambdaClient, InvokeCommand, InvokeAsyncCommand } = require('@aws-sdk/client-lambda')
|
|
2
2
|
const { toUtf8, fromUtf8 } = require('@aws-sdk/util-utf8-node')
|
|
3
3
|
|
|
4
|
+
const { Agent } = require('https')
|
|
5
|
+
const { NodeHttpHandler } = require('@aws-sdk/node-http-handler')
|
|
6
|
+
|
|
7
|
+
const keepAliveOptions = new NodeHttpHandler({
|
|
8
|
+
httpsAgent: new Agent({ keepAlive: false })
|
|
9
|
+
})
|
|
10
|
+
|
|
4
11
|
class Lambda {
|
|
5
12
|
constructor (region, session) {
|
|
6
13
|
if (region && session) {
|
|
7
|
-
this.client = new LambdaClient({ region, credentials: session })
|
|
14
|
+
this.client = new LambdaClient({ region, credentials: session, requestHandler: keepAliveOptions })
|
|
8
15
|
} else {
|
|
9
|
-
this.client = new LambdaClient()
|
|
16
|
+
this.client = new LambdaClient({ requestHandler: keepAliveOptions })
|
|
10
17
|
}
|
|
11
18
|
}
|
|
12
19
|
|
package/clients/s3.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
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
|
+
|
|
4
|
+
const { Agent } = require('https')
|
|
5
|
+
const { NodeHttpHandler } = require('@aws-sdk/node-http-handler')
|
|
6
|
+
|
|
7
|
+
const client = new S3Client({
|
|
8
|
+
requestHandler: new NodeHttpHandler({
|
|
9
|
+
httpsAgent: new Agent({ keepAlive: false })
|
|
10
|
+
})
|
|
11
|
+
})
|
|
4
12
|
|
|
5
13
|
class S3 {
|
|
6
14
|
getSignedUrl (type, params, callback) {
|
package/clients/sns.js
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
const { SNSClient, PublishCommand } = require(
|
|
2
|
-
|
|
1
|
+
const { SNSClient, PublishCommand } = require('@aws-sdk/client-sns')
|
|
2
|
+
|
|
3
|
+
const { Agent } = require('https')
|
|
4
|
+
const { NodeHttpHandler } = require('@aws-sdk/node-http-handler')
|
|
5
|
+
|
|
6
|
+
const snsClient = new SNSClient({
|
|
7
|
+
requestHandler: new NodeHttpHandler({
|
|
8
|
+
httpsAgent: new Agent({ keepAlive: false })
|
|
9
|
+
})
|
|
10
|
+
})
|
|
3
11
|
|
|
4
12
|
class SNS {
|
|
5
13
|
publish (params, callback) {
|
|
6
14
|
return new Promise((resolve, reject) => {
|
|
7
|
-
|
|
8
|
-
|
|
15
|
+
const publishCommand = new PublishCommand(params)
|
|
16
|
+
snsClient.send(publishCommand).then(response => {
|
|
9
17
|
resolve(response)
|
|
10
|
-
}).catch(err=>{
|
|
18
|
+
}).catch(err => {
|
|
11
19
|
reject(err)
|
|
12
20
|
})
|
|
13
21
|
}).then(result => {
|
package/clients/sqs.js
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
const { SQSClient, ReceiveMessageCommand, DeleteMessageCommand, SendMessageCommand } = require(
|
|
2
|
-
const snsClient = new SQSClient();
|
|
1
|
+
const { SQSClient, ReceiveMessageCommand, DeleteMessageCommand, SendMessageCommand } = require('@aws-sdk/client-sqs')
|
|
3
2
|
|
|
3
|
+
const { Agent } = require('https')
|
|
4
|
+
const { NodeHttpHandler } = require('@aws-sdk/node-http-handler')
|
|
5
|
+
|
|
6
|
+
const sqsClient = new SQSClient({
|
|
7
|
+
requestHandler: new NodeHttpHandler({
|
|
8
|
+
httpsAgent: new Agent({ keepAlive: false })
|
|
9
|
+
})
|
|
10
|
+
})
|
|
4
11
|
class SQS {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
async sendMessage (params, callback) {
|
|
13
|
+
const command = new SendMessageCommand(params)
|
|
14
|
+
const response = await sqsClient.send(command)
|
|
15
|
+
return response
|
|
9
16
|
}
|
|
10
17
|
|
|
11
18
|
async receiveMessage (params, callback) {
|
|
12
19
|
const command = new ReceiveMessageCommand(params)
|
|
13
|
-
const response = await
|
|
20
|
+
const response = await sqsClient.send(command)
|
|
14
21
|
return response
|
|
15
|
-
}
|
|
16
|
-
|
|
22
|
+
}
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
async deleteMessage (params, callback) {
|
|
25
|
+
const command = new DeleteMessageCommand(params)
|
|
26
|
+
const response = await sqsClient.send(command)
|
|
27
|
+
return response
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
30
|
|