loopback-connector
Advanced tools
Comparing version 4.7.0 to 4.8.0
@@ -0,1 +1,7 @@ | ||
2019-06-28, Version 4.8.0 | ||
========================= | ||
* chore: add promise support (Biniam Admikew) | ||
2019-05-03, Version 4.7.0 | ||
@@ -2,0 +8,0 @@ ========================= |
@@ -12,2 +12,3 @@ // Copyright IBM Corp. 2015,2019. All Rights Reserved. | ||
var uuid = require('uuid'); | ||
const {createPromiseCallback} = require('./utils'); | ||
@@ -50,3 +51,9 @@ module.exports = Transaction; | ||
Transaction.prototype.commit = function(cb) { | ||
return this.connector.commit(this.connection, cb); | ||
cb = cb || createPromiseCallback(); | ||
if (cb.promise) { | ||
this.connector.commit(this.connection, cb); | ||
return cb.promise; | ||
} else { | ||
return this.connector.commit(this.connection, cb); | ||
} | ||
}; | ||
@@ -60,3 +67,9 @@ | ||
Transaction.prototype.rollback = function(cb) { | ||
return this.connector.rollback(this.connection, cb); | ||
cb = cb || createPromiseCallback(); | ||
if (cb.promise) { | ||
this.connector.rollback(this.connection, cb); | ||
return cb.promise; | ||
} else { | ||
return this.connector.rollback(this.connection, cb); | ||
} | ||
}; | ||
@@ -75,2 +88,3 @@ | ||
} | ||
cb = cb || createPromiseCallback(); | ||
if (typeof options === 'string') { | ||
@@ -125,2 +139,3 @@ options = {isolationLevel: options}; | ||
}); | ||
if (cb.promise) return cb.promise; | ||
}; |
{ | ||
"name": "loopback-connector", | ||
"version": "4.7.0", | ||
"version": "4.8.0", | ||
"description": "Building blocks for LoopBack connectors", | ||
@@ -34,3 +34,4 @@ "engines": { | ||
"devDependencies": { | ||
"chai": "^4.1.2", | ||
"chai": "^4.2.0", | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^4.19.1", | ||
@@ -37,0 +38,0 @@ "eslint-config-loopback": "^10.0.0", |
385764
3235
6