@sqb/nestjs 4.9.1 → 4.10.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/cjs/sqb-core.module.js +3 -6
- package/cjs/sqb.module.js +2 -1
- package/esm/sqb-core.module.js +4 -7
- package/esm/sqb.module.js +2 -1
- package/package.json +12 -18
- package/esm/index.d.ts +0 -5
- package/esm/sqb-core.module.d.ts +0 -14
- package/esm/sqb.constants.d.ts +0 -2
- package/esm/sqb.decorators.d.ts +0 -1
- package/esm/sqb.interface.d.ts +0 -50
- package/esm/sqb.module.d.ts +0 -6
- package/esm/sqb.utils.d.ts +0 -11
package/cjs/sqb-core.module.js
CHANGED
|
@@ -7,13 +7,10 @@ const crypto = tslib_1.__importStar(require("crypto"));
|
|
|
7
7
|
const rxjs_1 = require("rxjs");
|
|
8
8
|
const rxjs = tslib_1.__importStar(require("rxjs"));
|
|
9
9
|
const common_1 = require("@nestjs/common");
|
|
10
|
-
const core_1 = require("@nestjs/core");
|
|
11
10
|
const connect_1 = require("@sqb/connect");
|
|
12
11
|
const sqb_constants_js_1 = require("./sqb.constants.js");
|
|
13
12
|
const sqb_utils_js_1 = require("./sqb.utils.js");
|
|
14
|
-
let SqbCoreModule =
|
|
15
|
-
options;
|
|
16
|
-
moduleRef;
|
|
13
|
+
let SqbCoreModule = SqbCoreModule_1 = class SqbCoreModule {
|
|
17
14
|
constructor(options, moduleRef) {
|
|
18
15
|
this.options = options;
|
|
19
16
|
this.moduleRef = moduleRef;
|
|
@@ -115,9 +112,9 @@ let SqbCoreModule = exports.SqbCoreModule = SqbCoreModule_1 = class SqbCoreModul
|
|
|
115
112
|
}
|
|
116
113
|
}
|
|
117
114
|
};
|
|
115
|
+
exports.SqbCoreModule = SqbCoreModule;
|
|
118
116
|
exports.SqbCoreModule = SqbCoreModule = SqbCoreModule_1 = tslib_1.__decorate([
|
|
119
117
|
(0, common_1.Global)(),
|
|
120
118
|
(0, common_1.Module)({}),
|
|
121
|
-
tslib_1.__param(0, (0, common_1.Inject)(sqb_constants_js_1.SQB_MODULE_OPTIONS))
|
|
122
|
-
tslib_1.__metadata("design:paramtypes", [Object, core_1.ModuleRef])
|
|
119
|
+
tslib_1.__param(0, (0, common_1.Inject)(sqb_constants_js_1.SQB_MODULE_OPTIONS))
|
|
123
120
|
], SqbCoreModule);
|
package/cjs/sqb.module.js
CHANGED
|
@@ -5,7 +5,7 @@ exports.SqbModule = void 0;
|
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const common_1 = require("@nestjs/common");
|
|
7
7
|
const sqb_core_module_js_1 = require("./sqb-core.module.js");
|
|
8
|
-
let SqbModule =
|
|
8
|
+
let SqbModule = SqbModule_1 = class SqbModule {
|
|
9
9
|
static forRoot(options) {
|
|
10
10
|
return {
|
|
11
11
|
module: SqbModule_1,
|
|
@@ -19,6 +19,7 @@ let SqbModule = exports.SqbModule = SqbModule_1 = class SqbModule {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
+
exports.SqbModule = SqbModule;
|
|
22
23
|
exports.SqbModule = SqbModule = SqbModule_1 = tslib_1.__decorate([
|
|
23
24
|
(0, common_1.Module)({})
|
|
24
25
|
], SqbModule);
|
package/esm/sqb-core.module.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
var SqbCoreModule_1;
|
|
2
|
-
import { __decorate,
|
|
2
|
+
import { __decorate, __param } from "tslib";
|
|
3
3
|
import * as crypto from 'crypto';
|
|
4
4
|
import { defer } from 'rxjs';
|
|
5
5
|
import * as rxjs from 'rxjs';
|
|
6
6
|
import { Global, Inject, Module } from '@nestjs/common';
|
|
7
|
-
import { ModuleRef } from '@nestjs/core';
|
|
8
7
|
import { SqbClient } from '@sqb/connect';
|
|
9
8
|
import { SQB_MODULE_ID, SQB_MODULE_OPTIONS, } from './sqb.constants.js';
|
|
10
9
|
import { getSQBToken, handleRetry, } from './sqb.utils.js';
|
|
11
|
-
|
|
12
|
-
options;
|
|
13
|
-
moduleRef;
|
|
10
|
+
let SqbCoreModule = SqbCoreModule_1 = class SqbCoreModule {
|
|
14
11
|
constructor(options, moduleRef) {
|
|
15
12
|
this.options = options;
|
|
16
13
|
this.moduleRef = moduleRef;
|
|
@@ -115,6 +112,6 @@ export let SqbCoreModule = SqbCoreModule_1 = class SqbCoreModule {
|
|
|
115
112
|
SqbCoreModule = SqbCoreModule_1 = __decorate([
|
|
116
113
|
Global(),
|
|
117
114
|
Module({}),
|
|
118
|
-
__param(0, Inject(SQB_MODULE_OPTIONS))
|
|
119
|
-
__metadata("design:paramtypes", [Object, ModuleRef])
|
|
115
|
+
__param(0, Inject(SQB_MODULE_OPTIONS))
|
|
120
116
|
], SqbCoreModule);
|
|
117
|
+
export { SqbCoreModule };
|
package/esm/sqb.module.js
CHANGED
|
@@ -2,7 +2,7 @@ var SqbModule_1;
|
|
|
2
2
|
import { __decorate } from "tslib";
|
|
3
3
|
import { Module } from '@nestjs/common';
|
|
4
4
|
import { SqbCoreModule } from './sqb-core.module.js';
|
|
5
|
-
|
|
5
|
+
let SqbModule = SqbModule_1 = class SqbModule {
|
|
6
6
|
static forRoot(options) {
|
|
7
7
|
return {
|
|
8
8
|
module: SqbModule_1,
|
|
@@ -19,3 +19,4 @@ export let SqbModule = SqbModule_1 = class SqbModule {
|
|
|
19
19
|
SqbModule = SqbModule_1 = __decorate([
|
|
20
20
|
Module({})
|
|
21
21
|
], SqbModule);
|
|
22
|
+
export { SqbModule };
|
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.10.0",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Eray Hanoglu <e.hanoglu@panates.com>",
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"url": "https://github.com/sqbjs/sqb.git",
|
|
14
14
|
"directory": "packages/nestjs"
|
|
15
15
|
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"module": "./esm/index.js",
|
|
18
|
+
"main": "./cjs/index.js",
|
|
19
|
+
"types": "./types/index.d.ts",
|
|
16
20
|
"scripts": {
|
|
17
21
|
"compile": "tsc",
|
|
18
22
|
"prebuild": "npm run lint && npm run clean",
|
|
@@ -32,31 +36,21 @@
|
|
|
32
36
|
"reflect-metadata": "^0.1.13"
|
|
33
37
|
},
|
|
34
38
|
"devDependencies": {
|
|
35
|
-
"@nestjs/common": "^10.
|
|
36
|
-
"@nestjs/core": "^10.
|
|
37
|
-
"@nestjs/platform-express": "^10.
|
|
38
|
-
"@nestjs/testing": "^10.
|
|
39
|
-
"postgresql-client": "^2.
|
|
39
|
+
"@nestjs/common": "^10.2.8",
|
|
40
|
+
"@nestjs/core": "^10.2.8",
|
|
41
|
+
"@nestjs/platform-express": "^10.2.8",
|
|
42
|
+
"@nestjs/testing": "^10.2.8",
|
|
43
|
+
"postgresql-client": "^2.10.1",
|
|
40
44
|
"rxjs": "^7.8.1",
|
|
41
45
|
"supertest": "^6.3.3"
|
|
42
46
|
},
|
|
43
47
|
"peerDependencies": {
|
|
44
48
|
"@nestjs/common": ">=7.4.0",
|
|
45
49
|
"@nestjs/core": ">=7.4.0",
|
|
46
|
-
"@sqb/builder": "^4.
|
|
47
|
-
"@sqb/connect": "^4.
|
|
50
|
+
"@sqb/builder": "^4.10.0",
|
|
51
|
+
"@sqb/connect": "^4.10.0",
|
|
48
52
|
"rxjs": ">=6.6.0"
|
|
49
53
|
},
|
|
50
|
-
"type": "module",
|
|
51
|
-
"types": "esm/index.d.ts",
|
|
52
|
-
"exports": {
|
|
53
|
-
".": {
|
|
54
|
-
"require": "./cjs/index.js",
|
|
55
|
-
"default": "./esm/index.js"
|
|
56
|
-
},
|
|
57
|
-
"./cjs": "./cjs/index.js",
|
|
58
|
-
"./esm": "./esm/index.js"
|
|
59
|
-
},
|
|
60
54
|
"engines": {
|
|
61
55
|
"node": ">=16.0",
|
|
62
56
|
"npm": ">=7.0.0"
|
package/esm/index.d.ts
DELETED
package/esm/sqb-core.module.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DynamicModule, OnApplicationShutdown } from '@nestjs/common';
|
|
2
|
-
import { ModuleRef } from '@nestjs/core';
|
|
3
|
-
import { SqbModuleAsyncOptions, SqbModuleOptions } from './sqb.interface.js';
|
|
4
|
-
export declare class SqbCoreModule implements OnApplicationShutdown {
|
|
5
|
-
private readonly options;
|
|
6
|
-
private readonly moduleRef;
|
|
7
|
-
constructor(options: SqbModuleOptions, moduleRef: ModuleRef);
|
|
8
|
-
static forRoot(options?: SqbModuleOptions): DynamicModule;
|
|
9
|
-
static forRootAsync(options: SqbModuleAsyncOptions): DynamicModule;
|
|
10
|
-
onApplicationShutdown(): Promise<void>;
|
|
11
|
-
private static createAsyncProviders;
|
|
12
|
-
private static createAsyncOptionsProvider;
|
|
13
|
-
private static createConnection;
|
|
14
|
-
}
|
package/esm/sqb.constants.d.ts
DELETED
package/esm/sqb.decorators.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const InjectSQB: (name?: string) => ParameterDecorator;
|
package/esm/sqb.interface.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Type } from '@nestjs/common';
|
|
2
|
-
import { ModuleMetadata } from '@nestjs/common/interfaces';
|
|
3
|
-
import { ClientConfiguration } from '@sqb/connect';
|
|
4
|
-
export type SqbModuleOptions = {
|
|
5
|
-
/**
|
|
6
|
-
* Connection name
|
|
7
|
-
*/
|
|
8
|
-
name?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Number of times to retry connecting
|
|
11
|
-
* Default: 10
|
|
12
|
-
*/
|
|
13
|
-
retryAttempts?: number;
|
|
14
|
-
/**
|
|
15
|
-
* Delay between connection retry attempts (ms)
|
|
16
|
-
* Default: 3000
|
|
17
|
-
*/
|
|
18
|
-
retryDelay?: number;
|
|
19
|
-
/**
|
|
20
|
-
* Function that determines whether the module should
|
|
21
|
-
* attempt to connect upon failure.
|
|
22
|
-
*
|
|
23
|
-
* @param err error that was thrown
|
|
24
|
-
* @returns whether to retry connection or not
|
|
25
|
-
*/
|
|
26
|
-
toRetry?: (err: any) => boolean;
|
|
27
|
-
/**
|
|
28
|
-
* If `true`, connection will not be closed on application shutdown.
|
|
29
|
-
*/
|
|
30
|
-
keepConnectionAlive?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* If `true`, will show verbose error messages on each connection retry.
|
|
33
|
-
*/
|
|
34
|
-
verboseRetryLog?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Number of ms to wait closing connection on shutdown
|
|
37
|
-
* Default: 10
|
|
38
|
-
*/
|
|
39
|
-
shutdownWaitMs?: number;
|
|
40
|
-
} & ClientConfiguration;
|
|
41
|
-
export interface SqbOptionsFactory {
|
|
42
|
-
createSqbOptions(connectionName?: string): Promise<SqbModuleOptions> | SqbModuleOptions;
|
|
43
|
-
}
|
|
44
|
-
export interface SqbModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
|
|
45
|
-
name?: string;
|
|
46
|
-
useExisting?: Type<SqbOptionsFactory>;
|
|
47
|
-
useClass?: Type<SqbOptionsFactory>;
|
|
48
|
-
useFactory?: (...args: any[]) => Promise<SqbModuleOptions> | SqbModuleOptions;
|
|
49
|
-
inject?: any[];
|
|
50
|
-
}
|
package/esm/sqb.module.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DynamicModule } from '@nestjs/common';
|
|
2
|
-
import { SqbModuleAsyncOptions, SqbModuleOptions } from './sqb.interface.js';
|
|
3
|
-
export declare class SqbModule {
|
|
4
|
-
static forRoot(options?: SqbModuleOptions): DynamicModule;
|
|
5
|
-
static forRootAsync(options: SqbModuleAsyncOptions): DynamicModule;
|
|
6
|
-
}
|
package/esm/sqb.utils.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { Type } from '@nestjs/common';
|
|
3
|
-
import { SqbClient } from '@sqb/connect';
|
|
4
|
-
/**
|
|
5
|
-
* This function returns a Connection injection token for the given connection name.
|
|
6
|
-
* @param {string | symbol} [name=SQB_DEFAULT_CONNECTION] This optional parameter is either
|
|
7
|
-
* a SqbClient, or a ConnectionOptions or a string.
|
|
8
|
-
* @returns {string | symbol} The Connection injection token.
|
|
9
|
-
*/
|
|
10
|
-
export declare function getSQBToken(name?: string | symbol | Type<SqbClient>): string | symbol | Type<SqbClient>;
|
|
11
|
-
export declare function handleRetry(connectionName?: string | symbol | Type<SqbClient>, retryAttempts?: number, retryDelay?: number, verboseRetryLog?: boolean, toRetry?: (err: any) => boolean): <T>(source: Observable<T>) => Observable<T>;
|