aws-v3-sdk 1.0.27 → 1.0.28

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
 
@@ -323,4 +335,28 @@ class DocumentClient {
323
335
  }
324
336
  }
325
337
 
338
+ transactWriteAsync (params, callback) {
339
+ const docClient = DynamoDBDocument.from(new DynamoDB())
340
+ return new Promise((resolve, reject) => {
341
+ docClient.transactWrite(params, (err, response) => {
342
+ if (err || !response) {
343
+ return reject(err)
344
+ }
345
+ if (response) {
346
+ return resolve(response)
347
+ }
348
+ })
349
+ }).then(result => {
350
+ if (callback && typeof callback === 'function') {
351
+ callback(null, result)
352
+ }
353
+ return result
354
+ }).catch(error => {
355
+ if (callback && typeof callback === 'function') {
356
+ callback(error, null)
357
+ }
358
+ return Promise.reject(error)
359
+ })
360
+ }
361
+
326
362
  module.exports = DocumentClient
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aws-v3-sdk",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "description": "AWS v3 SDK Utils",
5
5
  "main": "index.js",
6
6
  "scripts": {