orange-orm 4.1.2 → 4.1.4
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/README.md +2 -2
- package/docs/changelog.md +4 -0
- package/package.json +1 -1
- package/src/client/index.mjs +7 -7
- package/src/client/netAdapter.js +6 -6
- package/src/hostLocal.js +7 -4
- package/src/mssql/newDatabase.js +8 -4
- package/src/mySql/newDatabase.js +6 -2
- package/src/oracle/newDatabase.js +8 -4
- package/src/pg/newDatabase.js +8 -2
- package/src/sap/newDatabase.js +6 -2
- package/src/sqlite/newDatabase.js +6 -2
- package/src/table/begin.js +5 -1
- package/src/table/commit.js +3 -1
- package/src/tedious/newDatabase.js +9 -4
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<img src="./docs/orange.svg" alt="Orange ORM Logo" width="250"/>
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
|
-
The ultimate Object Relational Mapper for Node.js and Typescript, offering seamless integration with a variety of popular databases. Whether you're building applications in TypeScript or JavaScript
|
|
5
|
+
The ultimate Object Relational Mapper for Node.js and Typescript, offering seamless integration with a variety of popular databases. Whether you're building applications in TypeScript or JavaScript, including both CommonJS and ECMAScript, Orange ORM has got you covered.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.org/package/orange-orm)
|
|
8
8
|
[](https://github.com/alfateam/orange-orm/actions)
|
|
@@ -20,7 +20,7 @@ The ultimate Object Relational Mapper for Node.js and Typescript, offering seaml
|
|
|
20
20
|
- **Active Record**: With a concise and expressive syntax, Orange enables you to interact with your database using the [*Active Record Pattern*](https://en.wikipedia.org/wiki/Active_record_pattern).
|
|
21
21
|
- **No Code Generation Required**: Enjoy full IntelliSense, even in table mappings, without the need for cumbersome code generation.
|
|
22
22
|
- **TypeScript and JavaScript Support**: Orange fully supports both TypeScript and JavaScript, allowing you to leverage the benefits of static typing and modern ECMAScript features.
|
|
23
|
-
- **Works in the Browser**: You can securely use Orange in the browser by utilizing the Express.js plugin, which serves to safeguard sensitive database credentials from exposure at the client level. This method mirrors a traditional REST API, augmented with advanced TypeScript tooling for enhanced functionality.
|
|
23
|
+
- **Works in the Browser**: You can securely use Orange in the browser by utilizing the Express.js plugin, which serves to safeguard sensitive database credentials from exposure at the client level and protect against SQL injection. This method mirrors a traditional REST API, augmented with advanced TypeScript tooling for enhanced functionality.
|
|
24
24
|
|
|
25
25
|
## Supported Databases
|
|
26
26
|
|
package/docs/changelog.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
## Changelog
|
|
2
|
+
__4.1.4__
|
|
3
|
+
Better error message when running over http.
|
|
4
|
+
__4.1.3__
|
|
5
|
+
Do not use transaction in readonly operations. [#109](https://github.com/alfateam/orange-orm/issues/109)
|
|
2
6
|
__4.1.2__
|
|
3
7
|
Bugfix with composite primary key with hasMany relation. [#106](https://github.com/alfateam/orange-orm/issues/106)
|
|
4
8
|
__4.1.1__
|
package/package.json
CHANGED
package/src/client/index.mjs
CHANGED
|
@@ -4842,8 +4842,8 @@ function httpAdapter(baseURL, path, axiosInterceptor) {
|
|
|
4842
4842
|
return res.data;
|
|
4843
4843
|
}
|
|
4844
4844
|
catch (e) {
|
|
4845
|
-
if (e.response?.data)
|
|
4846
|
-
throw new Error(e.response
|
|
4845
|
+
if (typeof e.response?.data === 'string')
|
|
4846
|
+
throw new Error(e.response.data.replace(/^Error: /, ''));
|
|
4847
4847
|
else
|
|
4848
4848
|
throw e;
|
|
4849
4849
|
}
|
|
@@ -4857,9 +4857,9 @@ function httpAdapter(baseURL, path, axiosInterceptor) {
|
|
|
4857
4857
|
const res = await axios.request(path, { headers, method: 'patch', data: body });
|
|
4858
4858
|
return res.data;
|
|
4859
4859
|
}
|
|
4860
|
-
catch (e) {
|
|
4861
|
-
if (e.response?.data)
|
|
4862
|
-
throw new Error(e.response
|
|
4860
|
+
catch (e) {
|
|
4861
|
+
if (typeof e.response?.data === 'string')
|
|
4862
|
+
throw new Error(e.response.data.replace(/^Error: /, ''));
|
|
4863
4863
|
else
|
|
4864
4864
|
throw e;
|
|
4865
4865
|
}
|
|
@@ -4874,8 +4874,8 @@ function httpAdapter(baseURL, path, axiosInterceptor) {
|
|
|
4874
4874
|
return res.data;
|
|
4875
4875
|
}
|
|
4876
4876
|
catch (e) {
|
|
4877
|
-
if (e.response?.data)
|
|
4878
|
-
throw new Error(e.response
|
|
4877
|
+
if (typeof e.response?.data === 'string')
|
|
4878
|
+
throw new Error(e.response.data.replace(/^Error: /, ''));
|
|
4879
4879
|
else throw e;
|
|
4880
4880
|
}
|
|
4881
4881
|
}
|
package/src/client/netAdapter.js
CHANGED
|
@@ -22,8 +22,8 @@ function httpAdapter(baseURL, path, axiosInterceptor) {
|
|
|
22
22
|
return res.data;
|
|
23
23
|
}
|
|
24
24
|
catch (e) {
|
|
25
|
-
if (e.response?.data)
|
|
26
|
-
throw new Error(e.response
|
|
25
|
+
if (typeof e.response?.data === 'string')
|
|
26
|
+
throw new Error(e.response.data.replace(/^Error: /, ''));
|
|
27
27
|
else
|
|
28
28
|
throw e;
|
|
29
29
|
}
|
|
@@ -38,8 +38,8 @@ function httpAdapter(baseURL, path, axiosInterceptor) {
|
|
|
38
38
|
return res.data;
|
|
39
39
|
}
|
|
40
40
|
catch (e) {
|
|
41
|
-
if (e.response?.data)
|
|
42
|
-
throw new Error(e.response
|
|
41
|
+
if (typeof e.response?.data === 'string')
|
|
42
|
+
throw new Error(e.response.data.replace(/^Error: /, ''));
|
|
43
43
|
else
|
|
44
44
|
throw e;
|
|
45
45
|
}
|
|
@@ -54,8 +54,8 @@ function httpAdapter(baseURL, path, axiosInterceptor) {
|
|
|
54
54
|
return res.data;
|
|
55
55
|
}
|
|
56
56
|
catch (e) {
|
|
57
|
-
if (e.response?.data)
|
|
58
|
-
throw new Error(e.response
|
|
57
|
+
if (typeof e.response?.data === 'string')
|
|
58
|
+
throw new Error(e.response.data.replace(/^Error: /, ''));
|
|
59
59
|
else throw e;
|
|
60
60
|
}
|
|
61
61
|
}
|
package/src/hostLocal.js
CHANGED
|
@@ -3,7 +3,7 @@ let getMeta = require('./hostExpress/getMeta');
|
|
|
3
3
|
let setSessionSingleton = require('./table/setSessionSingleton');
|
|
4
4
|
let executeQuery = require('./query');
|
|
5
5
|
let hostExpress = require('./hostExpress');
|
|
6
|
-
|
|
6
|
+
const readonlyOps = ['getManyDto', 'getMany', 'aggregate', 'count'];
|
|
7
7
|
// { db, table, defaultConcurrency,
|
|
8
8
|
// concurrency,
|
|
9
9
|
// customFilters,
|
|
@@ -20,7 +20,7 @@ function hostLocal() {
|
|
|
20
20
|
return getMeta(table);
|
|
21
21
|
|
|
22
22
|
}
|
|
23
|
-
async function patch(body,_req, _res) {
|
|
23
|
+
async function patch(body, _req, _res) {
|
|
24
24
|
if (!table) {
|
|
25
25
|
const error = new Error('Table is not exposed');
|
|
26
26
|
// @ts-ignore
|
|
@@ -65,7 +65,10 @@ function hostLocal() {
|
|
|
65
65
|
else
|
|
66
66
|
db = dbPromise;
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
if (readonlyOps.includes(body.path))
|
|
69
|
+
await db.transaction({ readonly: true }, fn);
|
|
70
|
+
else
|
|
71
|
+
await db.transaction(fn);
|
|
69
72
|
}
|
|
70
73
|
return result;
|
|
71
74
|
|
|
@@ -101,7 +104,7 @@ function hostLocal() {
|
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
function express(client, options) {
|
|
104
|
-
return hostExpress(client, options
|
|
107
|
+
return hostExpress(client, options);
|
|
105
108
|
}
|
|
106
109
|
|
|
107
110
|
return c;
|
package/src/mssql/newDatabase.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let createDomain = require('../createDomain');
|
|
2
2
|
let newTransaction = require('./newTransaction');
|
|
3
|
-
let
|
|
3
|
+
let _begin = require('../table/begin');
|
|
4
4
|
let commit = require('../table/commit');
|
|
5
5
|
let rollback = require('../table/rollback');
|
|
6
6
|
let newPool = require('./newPool');
|
|
@@ -19,11 +19,11 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
19
19
|
throw new Error('Connection string cannot be empty');
|
|
20
20
|
var pool;
|
|
21
21
|
if (!poolOptions)
|
|
22
|
-
pool = newPool.bind(null,connectionString, poolOptions);
|
|
22
|
+
pool = newPool.bind(null, connectionString, poolOptions);
|
|
23
23
|
else
|
|
24
24
|
pool = newPool(connectionString, poolOptions);
|
|
25
25
|
|
|
26
|
-
let c = {poolFactory: pool, hostLocal, express};
|
|
26
|
+
let c = { poolFactory: pool, hostLocal, express };
|
|
27
27
|
|
|
28
28
|
c.transaction = function(options, fn) {
|
|
29
29
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -53,6 +53,10 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
53
53
|
return result;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
function begin() {
|
|
57
|
+
return _begin(options?.readonly);
|
|
58
|
+
}
|
|
59
|
+
|
|
56
60
|
function run() {
|
|
57
61
|
let p;
|
|
58
62
|
let transaction = newTransaction(domain, pool);
|
|
@@ -69,7 +73,7 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
69
73
|
c.createTransaction = function() {
|
|
70
74
|
let domain = createDomain();
|
|
71
75
|
let transaction = newTransaction(domain, pool);
|
|
72
|
-
let p = domain.run(() => new Promise(transaction).then(
|
|
76
|
+
let p = domain.run(() => new Promise(transaction).then(_begin));
|
|
73
77
|
|
|
74
78
|
function run(fn) {
|
|
75
79
|
return p.then(domain.run.bind(domain, fn));
|
package/src/mySql/newDatabase.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let createDomain = require('../createDomain');
|
|
2
2
|
let newTransaction = require('./newTransaction');
|
|
3
|
-
let
|
|
3
|
+
let _begin = require('../table/begin');
|
|
4
4
|
let commit = require('../table/commit');
|
|
5
5
|
let rollback = require('../table/rollback');
|
|
6
6
|
let newPool = require('./newPool');
|
|
@@ -52,6 +52,10 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
52
52
|
return result;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
function begin() {
|
|
56
|
+
return _begin(options?.readonly);
|
|
57
|
+
}
|
|
58
|
+
|
|
55
59
|
function run() {
|
|
56
60
|
let p;
|
|
57
61
|
let transaction = newTransaction(domain, pool);
|
|
@@ -68,7 +72,7 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
68
72
|
c.createTransaction = function() {
|
|
69
73
|
let domain = createDomain();
|
|
70
74
|
let transaction = newTransaction(domain, pool);
|
|
71
|
-
let p = domain.run(() => new Promise(transaction).then(
|
|
75
|
+
let p = domain.run(() => new Promise(transaction).then(_begin));
|
|
72
76
|
|
|
73
77
|
function run(fn) {
|
|
74
78
|
return p.then(domain.run.bind(domain, fn));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let createDomain = require('../createDomain');
|
|
2
2
|
let newTransaction = require('./newTransaction');
|
|
3
|
-
let
|
|
3
|
+
let _begin = require('../table/begin');
|
|
4
4
|
let commit = require('../table/commit');
|
|
5
5
|
let rollback = require('../table/rollback');
|
|
6
6
|
let newPool = require('./newPool');
|
|
@@ -19,11 +19,11 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
19
19
|
throw new Error('Connection string cannot be empty');
|
|
20
20
|
var pool;
|
|
21
21
|
if (!poolOptions)
|
|
22
|
-
pool = newPool.bind(null,connectionString, poolOptions);
|
|
22
|
+
pool = newPool.bind(null, connectionString, poolOptions);
|
|
23
23
|
else
|
|
24
24
|
pool = newPool(connectionString, poolOptions);
|
|
25
25
|
|
|
26
|
-
let c = {poolFactory: pool, hostLocal, express};
|
|
26
|
+
let c = { poolFactory: pool, hostLocal, express };
|
|
27
27
|
|
|
28
28
|
c.transaction = function(options, fn) {
|
|
29
29
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -41,6 +41,10 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
41
41
|
else
|
|
42
42
|
return domain.run(run);
|
|
43
43
|
|
|
44
|
+
function begin() {
|
|
45
|
+
return _begin(options?.readonly);
|
|
46
|
+
}
|
|
47
|
+
|
|
44
48
|
async function runInTransaction() {
|
|
45
49
|
let result;
|
|
46
50
|
let transaction = newTransaction(domain, pool);
|
|
@@ -69,7 +73,7 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
69
73
|
c.createTransaction = function() {
|
|
70
74
|
let domain = createDomain();
|
|
71
75
|
let transaction = newTransaction(domain, pool);
|
|
72
|
-
let p = domain.run(() => new Promise(transaction).then(
|
|
76
|
+
let p = domain.run(() => new Promise(transaction).then(_begin));
|
|
73
77
|
|
|
74
78
|
function run(fn) {
|
|
75
79
|
return p.then(domain.run.bind(domain, fn));
|
package/src/pg/newDatabase.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let createDomain = require('../createDomain');
|
|
2
2
|
let newTransaction = require('./newTransaction');
|
|
3
|
-
let
|
|
3
|
+
let _begin = require('../table/begin');
|
|
4
4
|
let commit = require('../table/commit');
|
|
5
5
|
let rollback = require('../table/rollback');
|
|
6
6
|
let newPool = require('./newPool');
|
|
@@ -48,6 +48,8 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
48
48
|
else
|
|
49
49
|
return domain.run(run);
|
|
50
50
|
|
|
51
|
+
|
|
52
|
+
|
|
51
53
|
async function runInTransaction() {
|
|
52
54
|
let result;
|
|
53
55
|
let transaction = newTransaction(domain, pool);
|
|
@@ -61,6 +63,10 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
61
63
|
return result;
|
|
62
64
|
}
|
|
63
65
|
|
|
66
|
+
function begin() {
|
|
67
|
+
return _begin(options?.readonly);
|
|
68
|
+
}
|
|
69
|
+
|
|
64
70
|
function run() {
|
|
65
71
|
let p;
|
|
66
72
|
let transaction = newTransaction(domain, pool);
|
|
@@ -84,7 +90,7 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
84
90
|
c.createTransaction = function(options) {
|
|
85
91
|
let domain = createDomain();
|
|
86
92
|
let transaction = newTransaction(domain, pool);
|
|
87
|
-
let p = domain.run(() => new Promise(transaction).then(
|
|
93
|
+
let p = domain.run(() => new Promise(transaction).then(_begin).then(negotiateSchema));
|
|
88
94
|
|
|
89
95
|
function run(fn) {
|
|
90
96
|
return p.then(domain.run.bind(domain, fn));
|
package/src/sap/newDatabase.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let createDomain = require('../createDomain');
|
|
2
2
|
let newTransaction = require('./newTransaction');
|
|
3
|
-
let
|
|
3
|
+
let _begin = require('../table/begin');
|
|
4
4
|
let commit = require('../table/commit');
|
|
5
5
|
let rollback = require('../table/rollback');
|
|
6
6
|
let newPool = require('./newPool');
|
|
@@ -41,6 +41,10 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
41
41
|
else
|
|
42
42
|
return domain.run(run);
|
|
43
43
|
|
|
44
|
+
function begin() {
|
|
45
|
+
return _begin(options?.readonly);
|
|
46
|
+
}
|
|
47
|
+
|
|
44
48
|
async function runInTransaction() {
|
|
45
49
|
let result;
|
|
46
50
|
let transaction = newTransaction(domain, pool);
|
|
@@ -69,7 +73,7 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
69
73
|
c.createTransaction = function() {
|
|
70
74
|
let domain = createDomain();
|
|
71
75
|
let transaction = newTransaction(domain, pool);
|
|
72
|
-
let p = domain.run(() => new Promise(transaction).then(
|
|
76
|
+
let p = domain.run(() => new Promise(transaction).then(_begin));
|
|
73
77
|
|
|
74
78
|
function run(fn) {
|
|
75
79
|
return p.then(domain.run.bind(domain, fn));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let createDomain = require('../createDomain');
|
|
2
2
|
let newTransaction = require('./newTransaction');
|
|
3
|
-
let
|
|
3
|
+
let _begin = require('../table/begin');
|
|
4
4
|
let commit = require('../table/commit');
|
|
5
5
|
let rollback = require('../table/rollback');
|
|
6
6
|
let newPool = require('./newPool');
|
|
@@ -41,6 +41,10 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
41
41
|
else
|
|
42
42
|
return domain.run(run);
|
|
43
43
|
|
|
44
|
+
function begin() {
|
|
45
|
+
return _begin(options?.readonly);
|
|
46
|
+
}
|
|
47
|
+
|
|
44
48
|
async function runInTransaction() {
|
|
45
49
|
let result;
|
|
46
50
|
let transaction = newTransaction(domain, pool);
|
|
@@ -69,7 +73,7 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
69
73
|
c.createTransaction = function() {
|
|
70
74
|
let domain = createDomain();
|
|
71
75
|
let transaction = newTransaction(domain, pool);
|
|
72
|
-
let p = domain.run(() => new Promise(transaction).then(
|
|
76
|
+
let p = domain.run(() => new Promise(transaction).then(_begin));
|
|
73
77
|
|
|
74
78
|
function run(fn) {
|
|
75
79
|
return p.then(domain.run.bind(domain, fn));
|
package/src/table/begin.js
CHANGED
|
@@ -2,8 +2,12 @@ let beginCommand = require('./commands/beginCommand');
|
|
|
2
2
|
let executeQuery = require('./executeQueries/executeQuery');
|
|
3
3
|
let setSessionSingleton = require('./setSessionSingleton');
|
|
4
4
|
|
|
5
|
-
function begin() {
|
|
5
|
+
function begin(readonly) {
|
|
6
6
|
setSessionSingleton('changes', []);
|
|
7
|
+
if (readonly) {
|
|
8
|
+
setSessionSingleton('readonly', true);
|
|
9
|
+
return Promise.resolve();
|
|
10
|
+
}
|
|
7
11
|
return executeQuery(beginCommand());
|
|
8
12
|
}
|
|
9
13
|
|
package/src/table/commit.js
CHANGED
|
@@ -3,6 +3,7 @@ let pushCommand = require('./commands/pushCommand');
|
|
|
3
3
|
let executeChanges = require('./executeQueries/executeChanges');
|
|
4
4
|
let releaseDbClient = require('./releaseDbClient');
|
|
5
5
|
let popChanges = require('./popChanges');
|
|
6
|
+
const getSessionSingleton = require('./getSessionSingleton');
|
|
6
7
|
|
|
7
8
|
function commit(result) {
|
|
8
9
|
return popAndPushChanges()
|
|
@@ -19,7 +20,8 @@ function commit(result) {
|
|
|
19
20
|
await executeChanges(changes);
|
|
20
21
|
changes = popChanges();
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
if (!getSessionSingleton('readonly'))
|
|
24
|
+
pushCommand(commitCommand);
|
|
23
25
|
return executeChanges(popChanges());
|
|
24
26
|
}
|
|
25
27
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let createDomain = require('../createDomain');
|
|
2
2
|
let newTransaction = require('./newTransaction');
|
|
3
|
-
let
|
|
3
|
+
let _begin = require('../table/begin');
|
|
4
4
|
let commit = require('../table/commit');
|
|
5
5
|
let rollback = require('../table/rollback');
|
|
6
6
|
let newPool = require('./newPool');
|
|
@@ -19,11 +19,11 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
19
19
|
throw new Error('Connection string cannot be empty');
|
|
20
20
|
var pool;
|
|
21
21
|
if (!poolOptions)
|
|
22
|
-
pool = newPool.bind(null,connectionString, poolOptions);
|
|
22
|
+
pool = newPool.bind(null, connectionString, poolOptions);
|
|
23
23
|
else
|
|
24
24
|
pool = newPool(connectionString, poolOptions);
|
|
25
25
|
|
|
26
|
-
let c = {poolFactory: pool, hostLocal, express};
|
|
26
|
+
let c = { poolFactory: pool, hostLocal, express };
|
|
27
27
|
|
|
28
28
|
c.transaction = function(options, fn) {
|
|
29
29
|
if ((arguments.length === 1) && (typeof options === 'function')) {
|
|
@@ -41,6 +41,10 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
41
41
|
else
|
|
42
42
|
return domain.run(run);
|
|
43
43
|
|
|
44
|
+
function begin() {
|
|
45
|
+
return _begin(options?.readonly);
|
|
46
|
+
}
|
|
47
|
+
|
|
44
48
|
async function runInTransaction() {
|
|
45
49
|
let result;
|
|
46
50
|
let transaction = newTransaction(domain, pool);
|
|
@@ -53,6 +57,7 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
53
57
|
return result;
|
|
54
58
|
}
|
|
55
59
|
|
|
60
|
+
|
|
56
61
|
function run() {
|
|
57
62
|
let p;
|
|
58
63
|
let transaction = newTransaction(domain, pool);
|
|
@@ -69,7 +74,7 @@ function newDatabase(connectionString, poolOptions) {
|
|
|
69
74
|
c.createTransaction = function() {
|
|
70
75
|
let domain = createDomain();
|
|
71
76
|
let transaction = newTransaction(domain, pool);
|
|
72
|
-
let p = domain.run(() => new Promise(transaction).then(
|
|
77
|
+
let p = domain.run(() => new Promise(transaction).then(_begin));
|
|
73
78
|
|
|
74
79
|
function run(fn) {
|
|
75
80
|
return p.then(domain.run.bind(domain, fn));
|