aws-v3-sdk 1.0.30 → 2.0.0

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.
@@ -116,6 +116,18 @@ class DocumentClient {
116
116
  })
117
117
  }
118
118
 
119
+ transactWrite (params, callback) {
120
+ const docClient = DynamoDBDocument.from(new DynamoDB())
121
+ docClient.transactWrite(params, function (err, data) {
122
+ if (err) {
123
+ callback(err)
124
+ }
125
+ else {
126
+ callback(null, data)
127
+ }
128
+ })
129
+ }
130
+
119
131
  batchGet (params, callback) {
120
132
  const docClient = DynamoDBDocument.from(ddb)
121
133
 
@@ -321,6 +333,31 @@ class DocumentClient {
321
333
  return Promise.reject(error)
322
334
  })
323
335
  }
336
+
337
+ transactWriteAsync (params, callback) {
338
+ const docClient = DynamoDBDocument.from(new DynamoDB())
339
+ return new Promise((resolve, reject) => {
340
+ docClient.transactWrite(params, (err, response) => {
341
+ if (err || !response) {
342
+ return reject(err)
343
+ }
344
+ if (response) {
345
+ return resolve(response)
346
+ }
347
+ })
348
+ }).then(result => {
349
+ if (callback && typeof callback === 'function') {
350
+ callback(null, result)
351
+ }
352
+ return result
353
+ }).catch(error => {
354
+ if (callback && typeof callback === 'function') {
355
+ callback(error, null)
356
+ }
357
+ return Promise.reject(error)
358
+ })
359
+ }
324
360
  }
325
361
 
362
+
326
363
  module.exports = DocumentClient
package/clients/s3.js CHANGED
@@ -1,4 +1,4 @@
1
- const { S3Client, GetObjectCommand, PutObjectCommand, ListObjectsCommand, DeleteObjectsCommand, CreateMultipartUploadCommand, CompleteMultipartUploadCommand, UploadPartCommand } = require('@aws-sdk/client-s3')
1
+ const { S3Client, GetObjectCommand, PutObjectCommand, HeadObjectCommand, ListObjectsCommand, DeleteObjectsCommand, CreateMultipartUploadCommand, CompleteMultipartUploadCommand, UploadPartCommand } = require('@aws-sdk/client-s3')
2
2
  const { getSignedUrl } = require('@aws-sdk/s3-request-presigner')
3
3
 
4
4
  const { Agent } = require('https')
@@ -147,6 +147,30 @@ class S3 {
147
147
  return Promise.reject(error)
148
148
  })
149
149
  }
150
+
151
+ headObject (params, callback) {
152
+ return new Promise((resolve, reject) => {
153
+ const headObject = new HeadObjectCommand(params)
154
+ client.send(headObject, (err, data) => {
155
+ if (err || !data) {
156
+ resolve(err)
157
+ }
158
+ if (data) {
159
+ resolve(data)
160
+ }
161
+ })
162
+ }).then(result => {
163
+ if (callback && typeof callback === 'function') {
164
+ callback(null, result)
165
+ }
166
+ return result
167
+ }).catch(error => {
168
+ if (callback && typeof callback === 'function') {
169
+ callback(error, null)
170
+ }
171
+ return Promise.reject(error)
172
+ })
173
+ }
150
174
  }
151
175
 
152
176
  module.exports = S3
@@ -52,7 +52,7 @@ exports.sendGetRequest = async (index, query, from, size, sort, _source) => {
52
52
  options.size = size
53
53
  }
54
54
  if (_source) {
55
- options._source = _source
55
+ options._source = size
56
56
  }
57
57
  client.search(options).then(response => {
58
58
  logger.debug(response, { response })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aws-v3-sdk",
3
- "version": "1.0.30",
3
+ "version": "2.0.0",
4
4
  "description": "AWS v3 SDK Utils",
5
5
  "main": "index.js",
6
6
  "scripts": {