@sqb/nestjs 4.19.4 → 4.19.6

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 CHANGED
@@ -18,12 +18,12 @@ SQB is an extensible, multi-dialect SQL query builder and Database connection wr
18
18
 
19
19
  ## Main goals
20
20
 
21
- - Single code base for any sql based database
22
- - Powerful and simplified query coding scheme
23
- - Fast applications with low memory requirements
24
- - Let applications work with large data tables efficiently
25
- - Support latest JavaScript language standards
26
- - Lightweight and extensible framework.
21
+ - Single code base for any sql based database
22
+ - Powerful and simplified query coding scheme
23
+ - Fast applications with low memory requirements
24
+ - Let applications work with large data tables efficiently
25
+ - Support latest JavaScript language standards
26
+ - Lightweight and extensible framework.
27
27
 
28
28
  You can report bugs and discuss features on the [GitHub issues](https://github.com/sqbjs/sqb/issues) page
29
29
 
@@ -39,7 +39,7 @@ $ npm install @sqb/nestjs --save
39
39
 
40
40
  ## Node Compatibility
41
41
 
42
- - node >= 16.x
42
+ - node >= 16.x
43
43
 
44
44
  ### License
45
45
 
@@ -95,19 +95,11 @@ let SqbCoreModule = SqbCoreModule_1 = class SqbCoreModule {
95
95
  // @ts-ignore
96
96
  if (rxjs.lastValueFrom) {
97
97
  // @ts-ignore
98
- return await rxjs.lastValueFrom((0, rxjs_1.defer)(async () => {
99
- const client = new connect_1.SqbClient(options);
100
- await client.test();
101
- return client;
102
- }).pipe((0, sqb_utils_js_1.handleRetry)(connectionToken, options.retryAttempts, options.retryDelay, options.verboseRetryLog, options.toRetry)));
98
+ return await rxjs.lastValueFrom((0, rxjs_1.defer)(async () => new connect_1.SqbClient(options)).pipe((0, sqb_utils_js_1.handleRetry)(connectionToken, options.retryAttempts, options.retryDelay, options.verboseRetryLog, options.toRetry)));
103
99
  }
104
100
  // NestJS 7
105
101
  // @ts-ignore
106
- return await (0, rxjs_1.defer)(async () => {
107
- const client = new connect_1.SqbClient(options);
108
- await client.test();
109
- return client;
110
- })
102
+ return await (0, rxjs_1.defer)(async () => new connect_1.SqbClient(options))
111
103
  .pipe((0, sqb_utils_js_1.handleRetry)(connectionToken, options.retryAttempts, options.retryDelay, options.verboseRetryLog, options.toRetry))
112
104
  .toPromise();
113
105
  }
package/cjs/sqb.utils.js CHANGED
@@ -24,8 +24,12 @@ function handleRetry(connectionName, retryAttempts = 9, retryDelay = 3000, verbo
24
24
  if (toRetry && !toRetry(error)) {
25
25
  throw error;
26
26
  }
27
- const connectionInfo = !connectionName || connectionName === connect_1.SqbClient ? 'default' : ` (${String(connectionName)})`;
28
- const verboseMessage = verboseRetryLog ? ` Message: ${error.message}.` : '';
27
+ const connectionInfo = !connectionName || connectionName === connect_1.SqbClient
28
+ ? 'default'
29
+ : ` (${String(connectionName)})`;
30
+ const verboseMessage = verboseRetryLog
31
+ ? ` Message: ${error.message}.`
32
+ : '';
29
33
  logger.error(`Unable to connect to the database ${connectionInfo}.${verboseMessage} Retrying (${errorCount + 1})...`, error.stack);
30
34
  if (errorCount + 1 >= retryAttempts) {
31
35
  throw error;
@@ -1,6 +1,6 @@
1
1
  var SqbCoreModule_1;
2
2
  import { __decorate, __metadata, __param } from "tslib";
3
- import { Global, Inject, Module } from '@nestjs/common';
3
+ import { Global, Inject, Module, } from '@nestjs/common';
4
4
  import { ModuleRef } from '@nestjs/core';
5
5
  import { SqbClient } from '@sqb/connect';
6
6
  import * as crypto from 'crypto';
@@ -92,19 +92,11 @@ let SqbCoreModule = SqbCoreModule_1 = class SqbCoreModule {
92
92
  // @ts-ignore
93
93
  if (rxjs.lastValueFrom) {
94
94
  // @ts-ignore
95
- return await rxjs.lastValueFrom(defer(async () => {
96
- const client = new SqbClient(options);
97
- await client.test();
98
- return client;
99
- }).pipe(handleRetry(connectionToken, options.retryAttempts, options.retryDelay, options.verboseRetryLog, options.toRetry)));
95
+ return await rxjs.lastValueFrom(defer(async () => new SqbClient(options)).pipe(handleRetry(connectionToken, options.retryAttempts, options.retryDelay, options.verboseRetryLog, options.toRetry)));
100
96
  }
101
97
  // NestJS 7
102
98
  // @ts-ignore
103
- return await defer(async () => {
104
- const client = new SqbClient(options);
105
- await client.test();
106
- return client;
107
- })
99
+ return await defer(async () => new SqbClient(options))
108
100
  .pipe(handleRetry(connectionToken, options.retryAttempts, options.retryDelay, options.verboseRetryLog, options.toRetry))
109
101
  .toPromise();
110
102
  }
package/esm/sqb.utils.js CHANGED
@@ -20,8 +20,12 @@ export function handleRetry(connectionName, retryAttempts = 9, retryDelay = 3000
20
20
  if (toRetry && !toRetry(error)) {
21
21
  throw error;
22
22
  }
23
- const connectionInfo = !connectionName || connectionName === SqbClient ? 'default' : ` (${String(connectionName)})`;
24
- const verboseMessage = verboseRetryLog ? ` Message: ${error.message}.` : '';
23
+ const connectionInfo = !connectionName || connectionName === SqbClient
24
+ ? 'default'
25
+ : ` (${String(connectionName)})`;
26
+ const verboseMessage = verboseRetryLog
27
+ ? ` Message: ${error.message}.`
28
+ : '';
25
29
  logger.error(`Unable to connect to the database ${connectionInfo}.${verboseMessage} Retrying (${errorCount + 1})...`, error.stack);
26
30
  if (errorCount + 1 >= retryAttempts) {
27
31
  throw error;
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@sqb/nestjs",
3
3
  "description": "Nestjs module for data connection using SQB",
4
- "version": "4.19.4",
4
+ "version": "4.19.6",
5
5
  "author": "Panates",
6
6
  "license": "Apache-2.0",
7
7
  "dependencies": {
8
- "tslib": "^2.8.0"
8
+ "tslib": "^2.8.1"
9
9
  },
10
10
  "peerDependencies": {
11
11
  "@nestjs/common": ">=7.4.0",
12
12
  "@nestjs/core": ">=7.4.0",
13
- "@sqb/builder": "^4.19.4",
14
- "@sqb/connect": "^4.19.4",
13
+ "@sqb/builder": "^4.19.6",
14
+ "@sqb/connect": "^4.19.6",
15
15
  "reflect-metadata": "^0.2.2",
16
16
  "rxjs": ">=6.6.0"
17
17
  },
@@ -58,5 +58,8 @@
58
58
  "sqb",
59
59
  "nestjs",
60
60
  "nest"
61
- ]
61
+ ],
62
+ "publishConfig": {
63
+ "access": "public"
64
+ }
62
65
  }