@sqb/nestjs 4.11.3 → 4.12.0
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 +9 -24
- package/cjs/sqb-core.module.js +3 -3
- package/cjs/sqb.module.js +2 -2
- package/cjs/sqb.utils.js +3 -7
- package/esm/sqb-core.module.js +5 -5
- package/esm/sqb.module.js +2 -2
- package/esm/sqb.utils.js +3 -7
- package/package.json +12 -11
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
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
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,40 +39,25 @@ $ npm install @sqb/nestjs --save
|
|
|
39
39
|
|
|
40
40
|
## Node Compatibility
|
|
41
41
|
|
|
42
|
-
-
|
|
42
|
+
- node >= 16.x
|
|
43
43
|
|
|
44
44
|
### License
|
|
45
45
|
|
|
46
46
|
SQB is available under [MIT](LICENSE) license.
|
|
47
47
|
|
|
48
48
|
[npm-image]: https://img.shields.io/npm/v/@sqb/nestjs.svg
|
|
49
|
-
|
|
50
49
|
[npm-url]: https://npmjs.org/package/@sqb/nestjs
|
|
51
|
-
|
|
52
50
|
[travis-image]: https://img.shields.io/travis/sqbjs/@sqb/nestjs/master.svg
|
|
53
|
-
|
|
54
51
|
[travis-url]: https://travis-ci.org/sqbjs/@sqb/nestjs
|
|
55
|
-
|
|
56
52
|
[coveralls-image]: https://img.shields.io/coveralls/sqbjs/@sqb/nestjs/master.svg
|
|
57
|
-
|
|
58
53
|
[coveralls-url]: https://coveralls.io/r/sqbjs/@sqb/nestjs
|
|
59
|
-
|
|
60
54
|
[downloads-image]: https://img.shields.io/npm/dm/@sqb/nestjs.svg
|
|
61
|
-
|
|
62
55
|
[downloads-url]: https://npmjs.org/package/@sqb/nestjs
|
|
63
|
-
|
|
64
56
|
[gitter-image]: https://badges.gitter.im/sqbjs/@sqb/nestjs.svg
|
|
65
|
-
|
|
66
57
|
[gitter-url]: https://gitter.im/sqbjs/@sqb/nestjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
|
67
|
-
|
|
68
58
|
[dependencies-image]: https://david-dm.org/sqbjs/@sqb/nestjs/status.svg
|
|
69
|
-
|
|
70
|
-
[dependencies-url]:https://david-dm.org/sqbjs/@sqb/nestjs
|
|
71
|
-
|
|
59
|
+
[dependencies-url]: https://david-dm.org/sqbjs/@sqb/nestjs
|
|
72
60
|
[devdependencies-image]: https://david-dm.org/sqbjs/@sqb/nestjs/dev-status.svg
|
|
73
|
-
|
|
74
|
-
[devdependencies-url]:https://david-dm.org/sqbjs/@sqb/nestjs?type=dev
|
|
75
|
-
|
|
61
|
+
[devdependencies-url]: https://david-dm.org/sqbjs/@sqb/nestjs?type=dev
|
|
76
62
|
[quality-image]: http://npm.packagequality.com/shield/@sqb/nestjs.png
|
|
77
|
-
|
|
78
63
|
[quality-url]: http://packagequality.com/#?package=@sqb/nestjs
|
package/cjs/sqb-core.module.js
CHANGED
|
@@ -35,7 +35,7 @@ let SqbCoreModule = SqbCoreModule_1 = class SqbCoreModule {
|
|
|
35
35
|
const connectionProvider = {
|
|
36
36
|
provide: (0, sqb_utils_js_1.getSQBToken)(options.name),
|
|
37
37
|
inject: [sqb_constants_js_1.SQB_MODULE_OPTIONS],
|
|
38
|
-
useFactory: async (sqbOptions) => this.createConnection(sqbOptions)
|
|
38
|
+
useFactory: async (sqbOptions) => this.createConnection(sqbOptions),
|
|
39
39
|
};
|
|
40
40
|
const asyncProviders = this.createAsyncProviders(options);
|
|
41
41
|
return {
|
|
@@ -65,8 +65,8 @@ let SqbCoreModule = SqbCoreModule_1 = class SqbCoreModule {
|
|
|
65
65
|
this.createAsyncOptionsProvider(options),
|
|
66
66
|
{
|
|
67
67
|
provide: options.useClass,
|
|
68
|
-
useClass: options.useClass
|
|
69
|
-
}
|
|
68
|
+
useClass: options.useClass,
|
|
69
|
+
},
|
|
70
70
|
];
|
|
71
71
|
throw new Error('Invalid configuration. Must provide useFactory, useClass or useExisting');
|
|
72
72
|
}
|
package/cjs/sqb.module.js
CHANGED
|
@@ -9,13 +9,13 @@ let SqbModule = SqbModule_1 = class SqbModule {
|
|
|
9
9
|
static forRoot(options) {
|
|
10
10
|
return {
|
|
11
11
|
module: SqbModule_1,
|
|
12
|
-
imports: [sqb_core_module_js_1.SqbCoreModule.forRoot(options)]
|
|
12
|
+
imports: [sqb_core_module_js_1.SqbCoreModule.forRoot(options)],
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
static forRootAsync(options) {
|
|
16
16
|
return {
|
|
17
17
|
module: SqbModule_1,
|
|
18
|
-
imports: [sqb_core_module_js_1.SqbCoreModule.forRootAsync(options)]
|
|
18
|
+
imports: [sqb_core_module_js_1.SqbCoreModule.forRootAsync(options)],
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
};
|
package/cjs/sqb.utils.js
CHANGED
|
@@ -20,16 +20,12 @@ function getSQBToken(name) {
|
|
|
20
20
|
}
|
|
21
21
|
exports.getSQBToken = getSQBToken;
|
|
22
22
|
function handleRetry(connectionName, retryAttempts = 9, retryDelay = 3000, verboseRetryLog = false, toRetry) {
|
|
23
|
-
return (source) => source.pipe((0, operators_1.retryWhen)(
|
|
23
|
+
return (source) => source.pipe((0, operators_1.retryWhen)(e => e.pipe((0, operators_1.scan)((errorCount, error) => {
|
|
24
24
|
if (toRetry && !toRetry(error)) {
|
|
25
25
|
throw error;
|
|
26
26
|
}
|
|
27
|
-
const connectionInfo = !connectionName || connectionName === connect_1.SqbClient
|
|
28
|
-
|
|
29
|
-
: ` (${String(connectionName)})`;
|
|
30
|
-
const verboseMessage = verboseRetryLog
|
|
31
|
-
? ` Message: ${error.message}.`
|
|
32
|
-
: '';
|
|
27
|
+
const connectionInfo = !connectionName || connectionName === connect_1.SqbClient ? 'default' : ` (${String(connectionName)})`;
|
|
28
|
+
const verboseMessage = verboseRetryLog ? ` Message: ${error.message}.` : '';
|
|
33
29
|
logger.error(`Unable to connect to the database ${connectionInfo}.${verboseMessage} Retrying (${errorCount + 1})...`, error.stack);
|
|
34
30
|
if (errorCount + 1 >= retryAttempts) {
|
|
35
31
|
throw error;
|
package/esm/sqb-core.module.js
CHANGED
|
@@ -6,8 +6,8 @@ import * as rxjs from 'rxjs';
|
|
|
6
6
|
import { Global, Inject, Module } from '@nestjs/common';
|
|
7
7
|
import { ModuleRef } from '@nestjs/core';
|
|
8
8
|
import { SqbClient } from '@sqb/connect';
|
|
9
|
-
import { SQB_MODULE_ID, SQB_MODULE_OPTIONS
|
|
10
|
-
import { getSQBToken, handleRetry
|
|
9
|
+
import { SQB_MODULE_ID, SQB_MODULE_OPTIONS } from './sqb.constants.js';
|
|
10
|
+
import { getSQBToken, handleRetry } from './sqb.utils.js';
|
|
11
11
|
let SqbCoreModule = SqbCoreModule_1 = class SqbCoreModule {
|
|
12
12
|
constructor(options, moduleRef) {
|
|
13
13
|
this.options = options;
|
|
@@ -32,7 +32,7 @@ let SqbCoreModule = SqbCoreModule_1 = class SqbCoreModule {
|
|
|
32
32
|
const connectionProvider = {
|
|
33
33
|
provide: getSQBToken(options.name),
|
|
34
34
|
inject: [SQB_MODULE_OPTIONS],
|
|
35
|
-
useFactory: async (sqbOptions) => this.createConnection(sqbOptions)
|
|
35
|
+
useFactory: async (sqbOptions) => this.createConnection(sqbOptions),
|
|
36
36
|
};
|
|
37
37
|
const asyncProviders = this.createAsyncProviders(options);
|
|
38
38
|
return {
|
|
@@ -62,8 +62,8 @@ let SqbCoreModule = SqbCoreModule_1 = class SqbCoreModule {
|
|
|
62
62
|
this.createAsyncOptionsProvider(options),
|
|
63
63
|
{
|
|
64
64
|
provide: options.useClass,
|
|
65
|
-
useClass: options.useClass
|
|
66
|
-
}
|
|
65
|
+
useClass: options.useClass,
|
|
66
|
+
},
|
|
67
67
|
];
|
|
68
68
|
throw new Error('Invalid configuration. Must provide useFactory, useClass or useExisting');
|
|
69
69
|
}
|
package/esm/sqb.module.js
CHANGED
|
@@ -6,13 +6,13 @@ let SqbModule = SqbModule_1 = class SqbModule {
|
|
|
6
6
|
static forRoot(options) {
|
|
7
7
|
return {
|
|
8
8
|
module: SqbModule_1,
|
|
9
|
-
imports: [SqbCoreModule.forRoot(options)]
|
|
9
|
+
imports: [SqbCoreModule.forRoot(options)],
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
static forRootAsync(options) {
|
|
13
13
|
return {
|
|
14
14
|
module: SqbModule_1,
|
|
15
|
-
imports: [SqbCoreModule.forRootAsync(options)]
|
|
15
|
+
imports: [SqbCoreModule.forRootAsync(options)],
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
};
|
package/esm/sqb.utils.js
CHANGED
|
@@ -16,16 +16,12 @@ export function getSQBToken(name) {
|
|
|
16
16
|
return `${name}_SqbConnection`;
|
|
17
17
|
}
|
|
18
18
|
export function handleRetry(connectionName, retryAttempts = 9, retryDelay = 3000, verboseRetryLog = false, toRetry) {
|
|
19
|
-
return (source) => source.pipe(retryWhen(
|
|
19
|
+
return (source) => source.pipe(retryWhen(e => e.pipe(scan((errorCount, error) => {
|
|
20
20
|
if (toRetry && !toRetry(error)) {
|
|
21
21
|
throw error;
|
|
22
22
|
}
|
|
23
|
-
const connectionInfo = !connectionName || connectionName === SqbClient
|
|
24
|
-
|
|
25
|
-
: ` (${String(connectionName)})`;
|
|
26
|
-
const verboseMessage = verboseRetryLog
|
|
27
|
-
? ` Message: ${error.message}.`
|
|
28
|
-
: '';
|
|
23
|
+
const connectionInfo = !connectionName || connectionName === SqbClient ? 'default' : ` (${String(connectionName)})`;
|
|
24
|
+
const verboseMessage = verboseRetryLog ? ` Message: ${error.message}.` : '';
|
|
29
25
|
logger.error(`Unable to connect to the database ${connectionInfo}.${verboseMessage} Retrying (${errorCount + 1})...`, error.stack);
|
|
30
26
|
if (errorCount + 1 >= retryAttempts) {
|
|
31
27
|
throw error;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqb/nestjs",
|
|
3
3
|
"description": "Nestjs module for data connection using SQB",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.12.0",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Eray Hanoglu <e.hanoglu@panates.com>",
|
|
@@ -30,23 +30,24 @@
|
|
|
30
30
|
"clean": "npm run clean:src | npm run clean:dist | npm run clean:cover",
|
|
31
31
|
"clean:src": "ts-cleanup -s src --all",
|
|
32
32
|
"clean:dist": "rimraf ../../build/postgres",
|
|
33
|
-
"clean:cover": "rimraf ../../coverage/postgres"
|
|
33
|
+
"clean:cover": "rimraf ../../coverage/postgres",
|
|
34
|
+
"format": "prettier . --write --log-level=warn"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
|
-
"@nestjs/common": "^10.3.
|
|
37
|
-
"@nestjs/core": "^10.3.
|
|
38
|
-
"@nestjs/platform-express": "^10.3.
|
|
39
|
-
"@nestjs/testing": "^10.3.
|
|
40
|
-
"postgresql-client": "^2.
|
|
37
|
+
"@nestjs/common": "^10.3.9",
|
|
38
|
+
"@nestjs/core": "^10.3.9",
|
|
39
|
+
"@nestjs/platform-express": "^10.3.9",
|
|
40
|
+
"@nestjs/testing": "^10.3.9",
|
|
41
|
+
"postgresql-client": "^2.11.0",
|
|
41
42
|
"rxjs": "^7.8.1",
|
|
42
|
-
"supertest": "^
|
|
43
|
+
"supertest": "^7.0.0"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
46
|
"@nestjs/common": ">=7.4.0",
|
|
46
47
|
"@nestjs/core": ">=7.4.0",
|
|
47
|
-
"@sqb/builder": "^4.
|
|
48
|
-
"@sqb/connect": "^4.
|
|
49
|
-
"reflect-metadata": "^0.
|
|
48
|
+
"@sqb/builder": "^4.12.0",
|
|
49
|
+
"@sqb/connect": "^4.12.0",
|
|
50
|
+
"reflect-metadata": "^0.2.2",
|
|
50
51
|
"rxjs": ">=6.6.0"
|
|
51
52
|
},
|
|
52
53
|
"engines": {
|