anote-server-libs 0.9.3 → 0.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anote-server-libs",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "description": "Helpers for express-TS servers",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -4,6 +4,7 @@ exports.withTransactionConfig = void 0;
4
4
  exports.withTransaction = withTransaction;
5
5
  const utils_1 = require("./utils");
6
6
  exports.withTransactionConfig = {
7
+ logQueries: false,
7
8
  timeoutMillis: 15000
8
9
  };
9
10
  function withTransaction(repo, logger, previousMethod, lock, commitIfLost = true) {
@@ -32,7 +33,7 @@ function withTransaction(repo, logger, previousMethod, lock, commitIfLost = true
32
33
  const dbClient = c1 || c2;
33
34
  clearTimeout(connectTimeoutHandler);
34
35
  utils_1.utils.logger = logger;
35
- if (logger.level === 'debug') {
36
+ if (exports.withTransactionConfig.logQueries) {
36
37
  const originalQuery = dbClient.query.bind(dbClient);
37
38
  dbClient.query = (...args) => {
38
39
  logger.debug('SQL [Client %d] QUERY: %s', dbClient.processID, args[0]);
@@ -10,6 +10,7 @@ export const enum SystemLock {
10
10
  }
11
11
 
12
12
  export const withTransactionConfig = {
13
+ logQueries: false,
13
14
  timeoutMillis: 15000
14
15
  };
15
16
 
@@ -38,7 +39,7 @@ export function withTransaction(repo: BaseModelRepository, logger: Logger, previ
38
39
  clearTimeout(connectTimeoutHandler);
39
40
  // On error, will rollback...
40
41
  utils.logger = logger;
41
- if(logger.level === 'debug') {
42
+ if(withTransactionConfig.logQueries) {
42
43
  const originalQuery = dbClient.query.bind(dbClient);
43
44
  dbClient.query = (...args: any[]) => {
44
45
  logger.debug('SQL [Client %d] QUERY: %s', dbClient.processID, args[0]);