typeorm-transactional-cls-hooked
Advanced tools
Comparing version 0.1.11 to 0.1.12
@@ -0,1 +1,7 @@ | ||
## 0.1.12 | ||
* Using connectionName as string | ()=>string [#44](https://github.com/odavid/typeorm-transactional-cls-hooked/issues/44) | ||
## 0.1.11 | ||
* Move @types/cls-hooked to dependencies [#42](https://github.com/odavid/typeorm-transactional-cls-hooked/issues/42) | ||
## 0.1.10 | ||
@@ -2,0 +8,0 @@ * dist folder missing in package version 0.1.9 [#33](https://github.com/odavid/typeorm-transactional-cls-hooked/issues/33) |
import { IsolationLevel } from './IsolationLevel'; | ||
import { Propagation } from './Propagation'; | ||
export declare function Transactional(options?: { | ||
connectionName?: string; | ||
connectionName?: string | (() => string | undefined); | ||
propagation?: Propagation; | ||
isolationLevel?: IsolationLevel; | ||
}): MethodDecorator; |
@@ -45,5 +45,2 @@ "use strict"; | ||
function Transactional(options) { | ||
var connectionName = options && options.connectionName ? options.connectionName : 'default'; | ||
var propagation = options && options.propagation ? options.propagation : Propagation_1.Propagation.REQUIRED; | ||
var isolationLevel = options && options.isolationLevel; | ||
return function (target, methodName, descriptor) { | ||
@@ -61,2 +58,9 @@ var originalMethod = descriptor.value; | ||
} | ||
var tempConnectionName = options && options.connectionName ? options.connectionName : 'default'; | ||
if (typeof tempConnectionName !== 'string') { | ||
tempConnectionName = tempConnectionName() || 'default'; | ||
} | ||
var connectionName = tempConnectionName; | ||
var propagation = options && options.propagation ? options.propagation : Propagation_1.Propagation.REQUIRED; | ||
var isolationLevel = options && options.isolationLevel; | ||
var runOriginal = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { | ||
@@ -63,0 +67,0 @@ return [2, originalMethod.apply(this, args.slice())]; |
{ | ||
"name": "typeorm-transactional-cls-hooked", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"description": "A Transactional Method Decorator for typeorm that uses cls-hooked to handle and propagate transactions between different repositories and service methods. Inpired by Spring Trasnactional Annotation and Sequelize CLS", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -110,2 +110,3 @@ # typeorm-transactional-cls-hooked | ||
- The decorator can take a `connectionName` as argument (by default it is `default`) | ||
- In some cases, where the connectionName should be dynamically evaluated, the value of connectionName can be a function that returns a string. | ||
- The decorator can take an optional `propagation` as argument to define the [propagation behaviour](#transaction-propagation) | ||
@@ -112,0 +113,0 @@ - The decorator can take an optional `isolationLevel` as argument to define the [isolation level](#isolation-levels) (by default it will use your database driver's default isolation level.) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50002
35
537
175