@elsikora/nestjs-typeorm-aws-connector 1.0.1 → 1.2.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 +89 -41
- package/dist/index.d.ts +6 -4
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/modules/typeorm-aws-connector/index.d.ts +3 -0
- package/dist/modules/{database → typeorm-aws-connector}/index.js +2 -2
- package/dist/modules/typeorm-aws-connector/index.js.map +1 -0
- package/dist/modules/{database → typeorm-aws-connector}/rotator/rotator.service.d.ts +2 -2
- package/dist/modules/{database → typeorm-aws-connector}/rotator/rotator.service.js +3 -2
- package/dist/modules/typeorm-aws-connector/rotator/rotator.service.js.map +1 -0
- package/dist/modules/typeorm-aws-connector/typeorm-aws-connector.module.d.ts +7 -0
- package/dist/modules/{database/database.module.js → typeorm-aws-connector/typeorm-aws-connector.module.js} +15 -15
- package/dist/modules/typeorm-aws-connector/typeorm-aws-connector.module.js.map +1 -0
- package/dist/modules/{database/database.service.d.ts → typeorm-aws-connector/typeorm-aws-connector.service.d.ts} +4 -3
- package/dist/modules/{database/database.service.js → typeorm-aws-connector/typeorm-aws-connector.service.js} +16 -15
- package/dist/modules/typeorm-aws-connector/typeorm-aws-connector.service.js.map +1 -0
- package/dist/shared/constant/typeorm-aws-connector/constant.d.ts +11 -0
- package/dist/shared/constant/typeorm-aws-connector/constant.js +21 -0
- package/dist/shared/constant/typeorm-aws-connector/constant.js.map +1 -0
- package/dist/shared/enum/relation-load-strategy.enum.d.ts +4 -0
- package/dist/shared/enum/relation-load-strategy.enum.js +9 -0
- package/dist/shared/enum/relation-load-strategy.enum.js.map +1 -0
- package/dist/shared/interface/{database → typeorm-aws-connector}/config.interface.d.ts +3 -1
- package/dist/shared/interface/typeorm-aws-connector/config.interface.js.map +1 -0
- package/dist/shared/interface/typeorm-aws-connector/module-async-options.interface.d.ts +7 -0
- package/dist/shared/interface/typeorm-aws-connector/module-async-options.interface.js.map +1 -0
- package/dist/shared/interface/typeorm-aws-connector/module-options.interface.d.ts +2 -0
- package/dist/shared/interface/typeorm-aws-connector/module-options.interface.js.map +1 -0
- package/dist/shared/provider/typeorm-aws-connector/database.provider.d.ts +4 -0
- package/dist/shared/provider/typeorm-aws-connector/database.provider.js.map +1 -0
- package/dist/shared/type/database/config-rotation.type.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -3
- package/dist/modules/database/database.module.d.ts +0 -7
- package/dist/modules/database/database.module.js.map +0 -1
- package/dist/modules/database/database.service.js.map +0 -1
- package/dist/modules/database/index.d.ts +0 -3
- package/dist/modules/database/index.js.map +0 -1
- package/dist/modules/database/rotator/rotator.service.js.map +0 -1
- package/dist/shared/constant/database/constant.d.ts +0 -15
- package/dist/shared/constant/database/constant.js +0 -30
- package/dist/shared/constant/database/constant.js.map +0 -1
- package/dist/shared/interface/database/config.interface.js.map +0 -1
- package/dist/shared/interface/database/module-async-options.interface.d.ts +0 -7
- package/dist/shared/interface/database/module-async-options.interface.js.map +0 -1
- package/dist/shared/interface/database/module-options.interface.d.ts +0 -2
- package/dist/shared/interface/database/module-options.interface.js.map +0 -1
- package/dist/shared/provider/database/database.provider.d.ts +0 -4
- package/dist/shared/provider/database/database.provider.js.map +0 -1
- /package/dist/shared/interface/{database → typeorm-aws-connector}/config.interface.js +0 -0
- /package/dist/shared/interface/{database → typeorm-aws-connector}/module-async-options.interface.js +0 -0
- /package/dist/shared/interface/{database → typeorm-aws-connector}/module-options.interface.js +0 -0
- /package/dist/shared/provider/{database → typeorm-aws-connector}/database.provider.js +0 -0
package/README.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://i.ibb.co/rtBYhTH/Untitled-1.png" width="500" alt="project-logo">
|
|
3
|
+
</p>
|
|
1
4
|
<p align="center">
|
|
2
5
|
<h1 align="center">NestJS TypeORM AWS Connector</h1>
|
|
3
6
|
</p>
|
|
@@ -24,6 +27,51 @@
|
|
|
24
27
|
<img src="https://img.shields.io/badge/TypeORM-FE0902.svg?style=for-the-badge&logo=TypeORM&logoColor=white" alt="TypeORM">
|
|
25
28
|
</p>
|
|
26
29
|
|
|
30
|
+
## ⚠️ Important Prerequisites
|
|
31
|
+
|
|
32
|
+
This module requires `@elsikora/nestjs-aws-parameter-store-config` to function properly. Before using this module, please:
|
|
33
|
+
|
|
34
|
+
1. Install and configure `@elsikora/nestjs-aws-parameter-store-config`
|
|
35
|
+
2. Familiarize yourself with its documentation and setup
|
|
36
|
+
3. Ensure it's properly configured in your NestJS application
|
|
37
|
+
|
|
38
|
+
Example of both modules working together:
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
@Module({
|
|
42
|
+
imports: [
|
|
43
|
+
// First, configure Parameter Store
|
|
44
|
+
ParameterStoreConfigModule.registerAsync({
|
|
45
|
+
imports: [ConfigModule],
|
|
46
|
+
inject: [ConfigService],
|
|
47
|
+
useFactory: (config: ConfigService) => ({
|
|
48
|
+
application: config.get<string>("APPLICATION"),
|
|
49
|
+
config: {
|
|
50
|
+
region: config.get<string>("AWS_REGION"),
|
|
51
|
+
},
|
|
52
|
+
decryptParameters: true,
|
|
53
|
+
environment: config.get<string>("ENVIRONMENT"),
|
|
54
|
+
recursiveLoading: true,
|
|
55
|
+
}),
|
|
56
|
+
}),
|
|
57
|
+
// Then, configure Database module
|
|
58
|
+
TypeOrmAwsConnectorModule.registerAsync({
|
|
59
|
+
imports: [ConfigModule],
|
|
60
|
+
inject: [ConfigService],
|
|
61
|
+
useFactory: async () => ({
|
|
62
|
+
connectionTimeoutMs: 30_000,
|
|
63
|
+
databaseName: "app",
|
|
64
|
+
entities: [Bank],
|
|
65
|
+
// ... other options
|
|
66
|
+
}),
|
|
67
|
+
}),
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
export class AppModule {}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
For more information about the Parameter Store configuration, please refer to the [@elsikora/nestjs-aws-parameter-store-config documentation](https://github.com/ElsiKora/NestJS-AWS-Parameter-Store-Config).
|
|
74
|
+
|
|
27
75
|
## Overview
|
|
28
76
|
|
|
29
77
|
NestJS-TypeORM-AWS-Connector is a powerful integration module that provides seamless database connectivity for NestJS applications using TypeORM with AWS infrastructure. It supports automatic connection management, connection pooling, and rotation features specifically designed for AWS environments. The module simplifies database configuration and management while providing robust options for customization and optimization.
|
|
@@ -52,12 +100,11 @@ npm install @elsikora/nestjs-typeorm-aws-connector
|
|
|
52
100
|
### Async Configuration
|
|
53
101
|
|
|
54
102
|
```typescript
|
|
55
|
-
import {
|
|
56
|
-
import { EDatabaseType } from '@elsikora/nestjs-typeorm-aws-connector/dist/shared/enum/database/type.enum';
|
|
103
|
+
import { TypeOrmAwsConnectorModule, EDatabaseType } from '@elsikora/nestjs-typeorm-aws-connector';
|
|
57
104
|
|
|
58
105
|
@Module({
|
|
59
106
|
imports: [
|
|
60
|
-
|
|
107
|
+
TypeOrmAwsConnectorModule.registerAsync({
|
|
61
108
|
imports: [ConfigModule],
|
|
62
109
|
inject: [ConfigService],
|
|
63
110
|
useFactory: async () => ({
|
|
@@ -84,42 +131,42 @@ export class AppModule {}
|
|
|
84
131
|
### Static Configuration
|
|
85
132
|
|
|
86
133
|
```typescript
|
|
87
|
-
import {
|
|
88
|
-
import { EDatabaseType } from '@elsikora/nestjs-typeorm-aws-connector/dist/shared/enum/database/type.enum';
|
|
134
|
+
import {TypeOrmAwsConnectorModule, EDatabaseType} from '@elsikora/nestjs-typeorm-aws-connector';
|
|
89
135
|
|
|
90
136
|
@Module({
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
137
|
+
imports: [
|
|
138
|
+
TypeOrmAwsConnectorModule.register({
|
|
139
|
+
connectionTimeoutMs: 30_000,
|
|
140
|
+
databaseName: "app",
|
|
141
|
+
entities: [Bank],
|
|
142
|
+
idleTimeoutMs: 30_000,
|
|
143
|
+
isVerbose: true,
|
|
144
|
+
poolSize: 10,
|
|
145
|
+
port: 5432,
|
|
146
|
+
rotation: {
|
|
147
|
+
intervalMs: 5000,
|
|
148
|
+
isEnabled: true,
|
|
149
|
+
},
|
|
150
|
+
shouldSynchronize: true,
|
|
151
|
+
type: EDatabaseType.POSTGRES,
|
|
152
|
+
}),
|
|
153
|
+
]
|
|
108
154
|
})
|
|
109
|
-
export class AppModule {
|
|
155
|
+
export class AppModule {
|
|
156
|
+
}
|
|
110
157
|
```
|
|
111
158
|
|
|
112
159
|
### Integration with TypeORM
|
|
113
160
|
|
|
114
161
|
```typescript
|
|
115
162
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
116
|
-
import {
|
|
163
|
+
import { TypeOrmAwsConnectorService } from '@elsikora/nestjs-typeorm-aws-connector';
|
|
117
164
|
|
|
118
165
|
@Module({
|
|
119
166
|
imports: [
|
|
120
167
|
TypeOrmModule.forRootAsync({
|
|
121
|
-
inject: [
|
|
122
|
-
useFactory: async (databaseService:
|
|
168
|
+
inject: [TypeOrmAwsConnectorService],
|
|
169
|
+
useFactory: async (databaseService: TypeOrmAwsConnectorService) => {
|
|
123
170
|
const options = await databaseService.getTypeOrmOptions();
|
|
124
171
|
return {
|
|
125
172
|
...options,
|
|
@@ -133,19 +180,20 @@ export class AppModule {}
|
|
|
133
180
|
|
|
134
181
|
## Configuration Options
|
|
135
182
|
|
|
136
|
-
| Option
|
|
137
|
-
|
|
138
|
-
| type
|
|
139
|
-
| databaseName
|
|
140
|
-
| port
|
|
141
|
-
| entities
|
|
142
|
-
| poolSize
|
|
143
|
-
| connectionTimeoutMs| number
|
|
144
|
-
| idleTimeoutMs
|
|
145
|
-
| isVerbose
|
|
146
|
-
| shouldSynchronize
|
|
147
|
-
|
|
|
148
|
-
| rotation.
|
|
183
|
+
| Option | Type | Required | Default | Description |
|
|
184
|
+
|----------------------|-----------------------|----------|-----------------------------|----------------------------------------------|
|
|
185
|
+
| type | EDatabaseType | Yes | - | Database type (POSTGRES, MYSQL, etc.) |
|
|
186
|
+
| databaseName | string | Yes | - | Name of the database to connect to |
|
|
187
|
+
| port | number | Yes | - | Database port number |
|
|
188
|
+
| entities | Entity[] | Yes | - | Array of entity classes to be loaded |
|
|
189
|
+
| poolSize | number | false | 10 | Maximum number of connections in the pool |
|
|
190
|
+
| connectionTimeoutMs | number | false | 30000 | Connection timeout in milliseconds |
|
|
191
|
+
| idleTimeoutMs | number | false | 30000 | Idle connection timeout in milliseconds |
|
|
192
|
+
| isVerbose | boolean | false | false | Enable verbose logging |
|
|
193
|
+
| shouldSynchronize | boolean | false | false | Automatically synchronize database schema |
|
|
194
|
+
| relationLoadStrategy | ERelationLoadStrategy | Yes | ERelationLoadStrategy.QUERY | Relation load strategy (QUERY, JOIN) |
|
|
195
|
+
| rotation.isEnabled | boolean | No | false | Enable connection rotation |
|
|
196
|
+
| rotation.intervalMs | number | No | 3600000 | Connection rotation interval in milliseconds |
|
|
149
197
|
|
|
150
198
|
## Database Types
|
|
151
199
|
|
|
@@ -160,9 +208,9 @@ enum EDatabaseType {
|
|
|
160
208
|
|
|
161
209
|
## Services
|
|
162
210
|
|
|
163
|
-
###
|
|
211
|
+
### TypeormAwsConnectorService
|
|
164
212
|
|
|
165
|
-
The `
|
|
213
|
+
The `TypeormAwsConnectorService` provides methods for managing database connections and configurations:
|
|
166
214
|
|
|
167
215
|
- `getTypeOrmOptions()`: Returns TypeORM configuration options
|
|
168
216
|
- Other utility methods for connection management
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export * from "./modules/
|
|
2
|
-
export * from "./shared/constant/
|
|
3
|
-
export type * from "./shared/interface/
|
|
4
|
-
export * from "./shared/provider/
|
|
1
|
+
export * from "./modules/typeorm-aws-connector";
|
|
2
|
+
export * from "./shared/constant/typeorm-aws-connector/constant";
|
|
3
|
+
export type * from "./shared/interface/typeorm-aws-connector/config.interface";
|
|
4
|
+
export * from "./shared/provider/typeorm-aws-connector/database.provider";
|
|
5
5
|
export type * from "./shared/type/database/config-rotation.type";
|
|
6
|
+
export * from "./shared/enum/database/type.enum";
|
|
7
|
+
export * from "./shared/enum/relation-load-strategy.enum";
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./modules/
|
|
18
|
-
__exportStar(require("./shared/constant/
|
|
19
|
-
__exportStar(require("./shared/provider/
|
|
17
|
+
__exportStar(require("./modules/typeorm-aws-connector"), exports);
|
|
18
|
+
__exportStar(require("./shared/constant/typeorm-aws-connector/constant"), exports);
|
|
19
|
+
__exportStar(require("./shared/provider/typeorm-aws-connector/database.provider"), exports);
|
|
20
|
+
__exportStar(require("./shared/enum/database/type.enum"), exports);
|
|
21
|
+
__exportStar(require("./shared/enum/relation-load-strategy.enum"), exports);
|
|
20
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kEAAgD;AAChD,mFAAgE;AAEhE,4FAAyE;AAEzE,mEAAiD;AACjD,4EAA0D"}
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./typeorm-aws-connector.module"), exports);
|
|
18
|
+
__exportStar(require("./typeorm-aws-connector.service"), exports);
|
|
19
19
|
__exportStar(require("./rotator/rotator.service"), exports);
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/typeorm-aws-connector/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAC/C,kEAAgD;AAChD,4DAA0C"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { OnModuleInit } from "@nestjs/common";
|
|
2
2
|
import { SchedulerRegistry } from "@nestjs/schedule";
|
|
3
3
|
import { DataSource } from "typeorm";
|
|
4
|
-
import {
|
|
4
|
+
import { ITypeOrmAwsConnectorConfig } from "../../../shared/interface/typeorm-aws-connector/config.interface";
|
|
5
5
|
export declare class RotatorService implements OnModuleInit {
|
|
6
6
|
private readonly dataSource;
|
|
7
7
|
private readonly databaseConfig;
|
|
8
8
|
private readonly schedulerRegistry;
|
|
9
9
|
private readonly logger;
|
|
10
|
-
constructor(dataSource: DataSource, databaseConfig:
|
|
10
|
+
constructor(dataSource: DataSource, databaseConfig: ITypeOrmAwsConnectorConfig, schedulerRegistry: SchedulerRegistry);
|
|
11
11
|
onModuleInit(): void;
|
|
12
12
|
rotateDatabaseConnection(): Promise<void>;
|
|
13
13
|
}
|
|
@@ -17,7 +17,8 @@ exports.RotatorService = void 0;
|
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
18
|
const schedule_1 = require("@nestjs/schedule");
|
|
19
19
|
const typeorm_1 = require("typeorm");
|
|
20
|
-
const database_provider_1 = require("../../../shared/provider/
|
|
20
|
+
const database_provider_1 = require("../../../shared/provider/typeorm-aws-connector/database.provider");
|
|
21
|
+
const constant_1 = require("../../../shared/constant/typeorm-aws-connector/constant");
|
|
21
22
|
let RotatorService = RotatorService_1 = class RotatorService {
|
|
22
23
|
constructor(dataSource, databaseConfig, schedulerRegistry) {
|
|
23
24
|
this.dataSource = dataSource;
|
|
@@ -27,7 +28,7 @@ let RotatorService = RotatorService_1 = class RotatorService {
|
|
|
27
28
|
}
|
|
28
29
|
onModuleInit() {
|
|
29
30
|
if (this.databaseConfig.rotation?.isEnabled) {
|
|
30
|
-
const intervalMs = this.databaseConfig.rotation.intervalMs;
|
|
31
|
+
const intervalMs = this.databaseConfig.rotation.intervalMs || constant_1.default.DB_CONNECTION_ROTATION_INTERVAL;
|
|
31
32
|
const interval = setInterval(() => {
|
|
32
33
|
this.rotateDatabaseConnection();
|
|
33
34
|
}, intervalMs);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rotator.service.js","sourceRoot":"","sources":["../../../../src/modules/typeorm-aws-connector/rotator/rotator.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA0E;AAC1E,+CAAqD;AACrD,qCAAmF;AACnF,wGAAoG;AAEpG,sFAA6F;AAGtF,IAAM,cAAc,sBAApB,MAAM,cAAc;IAG1B,YACkB,UAAsB,EAEvC,cAA2D,EAC1C,iBAAoC;QAHpC,eAAU,GAAV,UAAU,CAAY;QAEtB,mBAAc,GAAd,cAAc,CAA4B;QAC1C,sBAAiB,GAAjB,iBAAiB,CAAmB;QANrC,WAAM,GAAG,IAAI,eAAM,CAAC,gBAAc,CAAC,IAAI,CAAC,CAAC;IAOvD,CAAC;IAEJ,YAAY;QACX,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC;YAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,UAAU,IAAI,kBAA8B,CAAC,+BA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ADJ,oBAAU,UAGH,4BAAiB;GAP1C,cAAc,CA6C1B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DynamicModule } from "@nestjs/common";
|
|
2
|
+
import { ITypeOrmAwsConnectorModuleAsyncOptions } from "../../shared/interface/typeorm-aws-connector/module-async-options.interface";
|
|
3
|
+
import { ITypeOrmAwsConnectorModuleOptions } from "../../shared/interface/typeorm-aws-connector/module-options.interface";
|
|
4
|
+
export declare class TypeOrmAwsConnectorModule {
|
|
5
|
+
static register(config: ITypeOrmAwsConnectorModuleOptions): DynamicModule;
|
|
6
|
+
static registerAsync(options: ITypeOrmAwsConnectorModuleAsyncOptions): Promise<DynamicModule>;
|
|
7
|
+
}
|
|
@@ -5,22 +5,22 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
-
var
|
|
8
|
+
var TypeOrmAwsConnectorModule_1;
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
10
|
+
exports.TypeOrmAwsConnectorModule = void 0;
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
|
12
12
|
const schedule_1 = require("@nestjs/schedule");
|
|
13
|
-
const
|
|
13
|
+
const typeorm_aws_connector_service_1 = require("./typeorm-aws-connector.service");
|
|
14
14
|
const rotator_service_1 = require("./rotator/rotator.service");
|
|
15
|
-
const database_provider_1 = require("../../shared/provider/
|
|
16
|
-
let
|
|
15
|
+
const database_provider_1 = require("../../shared/provider/typeorm-aws-connector/database.provider");
|
|
16
|
+
let TypeOrmAwsConnectorModule = TypeOrmAwsConnectorModule_1 = class TypeOrmAwsConnectorModule {
|
|
17
17
|
static register(config) {
|
|
18
18
|
const providers = [
|
|
19
19
|
{
|
|
20
20
|
provide: database_provider_1.DATABASE_CONFIG_PROVIDER,
|
|
21
21
|
useValue: config,
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
typeorm_aws_connector_service_1.TypeOrmAwsConnectorService,
|
|
24
24
|
];
|
|
25
25
|
const isRotationEnabled = config.rotation?.isEnabled;
|
|
26
26
|
const imports = [];
|
|
@@ -32,14 +32,14 @@ let DatabaseModule = DatabaseModule_1 = class DatabaseModule {
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
35
|
-
module:
|
|
35
|
+
module: TypeOrmAwsConnectorModule_1,
|
|
36
36
|
imports,
|
|
37
37
|
providers,
|
|
38
|
-
exports: [
|
|
38
|
+
exports: [typeorm_aws_connector_service_1.TypeOrmAwsConnectorService, ...(isRotationEnabled ? [rotator_service_1.RotatorService] : [])],
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
static async registerAsync(options) {
|
|
42
|
-
const providers = [(0, database_provider_1.createDatabaseConfigProvider)(options),
|
|
42
|
+
const providers = [(0, database_provider_1.createDatabaseConfigProvider)(options), typeorm_aws_connector_service_1.TypeOrmAwsConnectorService];
|
|
43
43
|
const imports = [...(options.imports || [])];
|
|
44
44
|
const config = await options.useFactory(...(options.inject || []));
|
|
45
45
|
const isRotationEnabled = config.rotation?.isEnabled;
|
|
@@ -48,16 +48,16 @@ let DatabaseModule = DatabaseModule_1 = class DatabaseModule {
|
|
|
48
48
|
providers.push(rotator_service_1.RotatorService);
|
|
49
49
|
}
|
|
50
50
|
return {
|
|
51
|
-
module:
|
|
51
|
+
module: TypeOrmAwsConnectorModule_1,
|
|
52
52
|
imports,
|
|
53
53
|
providers,
|
|
54
|
-
exports: [
|
|
54
|
+
exports: [typeorm_aws_connector_service_1.TypeOrmAwsConnectorService, ...(isRotationEnabled ? [rotator_service_1.RotatorService] : [])],
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
exports.
|
|
59
|
-
exports.
|
|
58
|
+
exports.TypeOrmAwsConnectorModule = TypeOrmAwsConnectorModule;
|
|
59
|
+
exports.TypeOrmAwsConnectorModule = TypeOrmAwsConnectorModule = TypeOrmAwsConnectorModule_1 = __decorate([
|
|
60
60
|
(0, common_1.Global)(),
|
|
61
61
|
(0, common_1.Module)({})
|
|
62
|
-
],
|
|
63
|
-
//# sourceMappingURL=
|
|
62
|
+
], TypeOrmAwsConnectorModule);
|
|
63
|
+
//# sourceMappingURL=typeorm-aws-connector.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeorm-aws-connector.module.js","sourceRoot":"","sources":["../../../src/modules/typeorm-aws-connector/typeorm-aws-connector.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAyE;AACzE,+CAAkD;AAElD,mFAA0G;AAC1G,+DAAwF;AACxF,qGAAkI;AAK3H,IAAM,yBAAyB,iCAA/B,MAAM,yBAAyB;IACrC,MAAM,CAAC,QAAQ,CAAC,MAAyC;QACxD,MAAM,SAAS,GAAoB;YAClC;gBACC,OAAO,EAAE,4CAAwB;gBACjC,QAAQ,EAAE,MAAM;aAChB;YACD,0DAA0B;SAC1B,CAAC;QAEF,MAAM,iBAAiB,GAAG,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC;QACrD,MAAM,OAAO,GAAe,EAAE,CAAC;QAE/B,IAAI,iBAAiB,EAAE,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,yBAAc,CAAC,OAAO,EAAE,CAAC,CAAC;YACvC,SAAS,CAAC,IAAI,CAAC;gBACd,OAAO,EAAE,gCAAc;gBACvB,QAAQ,EAAE,gCAAc;aACxB,CAAC,CAAC;QACJ,CAAC;QAED,OAAO;YACN,MAAM,EAAE,2BAAyB;YACjC,OAAO;YACP,SAAS;YACT,OAAO,EAAE,CAAC,0DAA0B,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,gCAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SACrF,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,OAA+C;QACzE,MAAM,SAAS,GAAG,CAAC,IAAA,gDAA4B,EAAC,OAAO,CAAC,EAAE,0DAA0B,CAAC,CAAC;QAEtF,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;QAE7C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;QACnE,MAAM,iBAAiB,GAAG,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC;QAErD,IAAI,iBAAiB,EAAE,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,yBAAc,CAAC,OAAO,EAAE,CAAC,CAAC;YACvC,SAAS,CAAC,IAAI,CAAC,gCAAc,CAAC,CAAC;QAChC,CAAC;QAED,OAAO;YACN,MAAM,EAAE,2BAAyB;YACjC,OAAO;YACP,SAAS;YACT,OAAO,EAAE,CAAC,0DAA0B,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,gCAAc,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SACrF,CAAC;IACH,CAAC;CACD,CAAA;AAjDY,8DAAyB;oCAAzB,yBAAyB;IAFrC,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,yBAAyB,CAiDrC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ConfigService } from "@nestjs/config";
|
|
2
2
|
import { ParameterStoreConfigService } from "@elsikora/nestjs-aws-parameter-store-config";
|
|
3
|
-
import { IDatabaseConfig } from "../../shared/interface/database/config.interface";
|
|
4
3
|
import { IAwsSecretsManagerItem } from "../../shared/interface/aws/secrets-manager/item.interface";
|
|
5
|
-
|
|
4
|
+
import { ITypeOrmAwsConnectorConfig } from "../../shared/interface/typeorm-aws-connector/config.interface";
|
|
5
|
+
export declare class TypeOrmAwsConnectorService {
|
|
6
6
|
private readonly configService;
|
|
7
7
|
private readonly parameterStoreConfigService;
|
|
8
8
|
private readonly databaseConfig;
|
|
9
9
|
private readonly logger;
|
|
10
|
-
constructor(configService: ConfigService, parameterStoreConfigService: ParameterStoreConfigService, databaseConfig:
|
|
10
|
+
constructor(configService: ConfigService, parameterStoreConfigService: ParameterStoreConfigService, databaseConfig: ITypeOrmAwsConnectorConfig);
|
|
11
11
|
getCredentials(): Promise<IAwsSecretsManagerItem>;
|
|
12
12
|
getTypeOrmOptions(): Promise<{
|
|
13
13
|
type: any;
|
|
@@ -16,6 +16,7 @@ export declare class DatabaseService {
|
|
|
16
16
|
username: string;
|
|
17
17
|
password: string;
|
|
18
18
|
database: string;
|
|
19
|
+
relationLoadStrategy: import("../..").ERelationLoadStrategy;
|
|
19
20
|
logging: boolean;
|
|
20
21
|
synchronize: boolean;
|
|
21
22
|
extra: {
|
|
@@ -11,27 +11,27 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var
|
|
14
|
+
var TypeOrmAwsConnectorService_1;
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.
|
|
16
|
+
exports.TypeOrmAwsConnectorService = void 0;
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
18
|
const config_1 = require("@nestjs/config");
|
|
19
19
|
const nestjs_aws_parameter_store_config_1 = require("@elsikora/nestjs-aws-parameter-store-config");
|
|
20
20
|
const client_secrets_manager_1 = require("@aws-sdk/client-secrets-manager");
|
|
21
|
-
const database_provider_1 = require("../../shared/provider/
|
|
22
|
-
|
|
21
|
+
const database_provider_1 = require("../../shared/provider/typeorm-aws-connector/database.provider");
|
|
22
|
+
const constant_1 = require("../../shared/constant/typeorm-aws-connector/constant");
|
|
23
|
+
let TypeOrmAwsConnectorService = TypeOrmAwsConnectorService_1 = class TypeOrmAwsConnectorService {
|
|
23
24
|
constructor(configService, parameterStoreConfigService, databaseConfig) {
|
|
24
25
|
this.configService = configService;
|
|
25
26
|
this.parameterStoreConfigService = parameterStoreConfigService;
|
|
26
27
|
this.databaseConfig = databaseConfig;
|
|
27
|
-
this.logger = new common_1.Logger(
|
|
28
|
+
this.logger = new common_1.Logger(TypeOrmAwsConnectorService_1.name);
|
|
28
29
|
}
|
|
29
30
|
async getCredentials() {
|
|
30
31
|
this.logger.debug("Asking credentials from AWS Secrets Manager...");
|
|
31
32
|
const region = this.configService.get("AWS_REGION");
|
|
32
33
|
const client = new client_secrets_manager_1.SecretsManagerClient({ region });
|
|
33
34
|
const secretId = this.parameterStoreConfigService.get(`/${this.configService.get("APPLICATION")}/elastic-beanstalk/${this.configService.get("APPLICATION")}-reaper-api/aws-secrets-manager/database-credentials-secret-id`);
|
|
34
|
-
console.log("SECRETID", secretId, `/${this.configService.get("APPLICATION")}/elastic-beanstalk/${this.configService.get("APPLICATION")}-reaper-api/aws-secrets-manager/database-credentials-secret-id`);
|
|
35
35
|
const response = await client.send(new client_secrets_manager_1.GetSecretValueCommand({
|
|
36
36
|
SecretId: secretId,
|
|
37
37
|
VersionStage: "AWSCURRENT",
|
|
@@ -49,12 +49,13 @@ let DatabaseService = DatabaseService_1 = class DatabaseService {
|
|
|
49
49
|
username: credentials.username,
|
|
50
50
|
password: credentials.password,
|
|
51
51
|
database: this.databaseConfig.databaseName,
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
relationLoadStrategy: this.databaseConfig.relationLoadStrategy || constant_1.default.DB_RELATION_LOAD_STRATEGY,
|
|
53
|
+
logging: this.databaseConfig.isVerbose || constant_1.default.DB_LOGGING,
|
|
54
|
+
synchronize: this.databaseConfig.shouldSynchronize || constant_1.default.DB_SYNCHRONIZE,
|
|
54
55
|
extra: {
|
|
55
|
-
connectionTimeoutMillis: this.databaseConfig.connectionTimeoutMs ||
|
|
56
|
-
idleTimeoutMillis: this.databaseConfig.idleTimeoutMs ||
|
|
57
|
-
max: this.databaseConfig.poolSize ||
|
|
56
|
+
connectionTimeoutMillis: this.databaseConfig.connectionTimeoutMs || constant_1.default.DB_CONNECTION_TIMEOUT,
|
|
57
|
+
idleTimeoutMillis: this.databaseConfig.idleTimeoutMs || constant_1.default.DB_IDLE_TIMEOUT,
|
|
58
|
+
max: this.databaseConfig.poolSize || constant_1.default.DB_POOL_SIZE,
|
|
58
59
|
},
|
|
59
60
|
entities: this.databaseConfig.entities,
|
|
60
61
|
};
|
|
@@ -62,11 +63,11 @@ let DatabaseService = DatabaseService_1 = class DatabaseService {
|
|
|
62
63
|
return options;
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
|
-
exports.
|
|
66
|
-
exports.
|
|
66
|
+
exports.TypeOrmAwsConnectorService = TypeOrmAwsConnectorService;
|
|
67
|
+
exports.TypeOrmAwsConnectorService = TypeOrmAwsConnectorService = TypeOrmAwsConnectorService_1 = __decorate([
|
|
67
68
|
(0, common_1.Injectable)(),
|
|
68
69
|
__param(2, (0, common_1.Inject)(database_provider_1.DATABASE_CONFIG_PROVIDER)),
|
|
69
70
|
__metadata("design:paramtypes", [config_1.ConfigService,
|
|
70
71
|
nestjs_aws_parameter_store_config_1.ParameterStoreConfigService, Object])
|
|
71
|
-
],
|
|
72
|
-
//# sourceMappingURL=
|
|
72
|
+
], TypeOrmAwsConnectorService);
|
|
73
|
+
//# sourceMappingURL=typeorm-aws-connector.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeorm-aws-connector.service.js","sourceRoot":"","sources":["../../../src/modules/typeorm-aws-connector/typeorm-aws-connector.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4D;AAC5D,2CAA+C;AAC/C,mGAA0F;AAC1F,4EAA8F;AAC9F,qGAAoG;AAGpG,mFAA6F;AAGtF,IA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
1
|
+
import { ERelationLoadStrategy } from "../../enum/relation-load-strategy.enum";
|
|
2
|
+
declare const TYPEORM_AWS_CONNECTOR_CONSTANT: {
|
|
3
|
+
readonly DB_CONNECTION_ROTATION_INTERVAL: number;
|
|
4
|
+
readonly DB_CONNECTION_TIMEOUT: number;
|
|
5
|
+
readonly DB_IDLE_TIMEOUT: number;
|
|
6
|
+
readonly DB_LOGGING: boolean;
|
|
7
|
+
readonly DB_POOL_SIZE: number;
|
|
8
|
+
readonly DB_RELATION_LOAD_STRATEGY: ERelationLoadStrategy;
|
|
9
|
+
readonly DB_SYNCHRONIZE: boolean;
|
|
10
|
+
};
|
|
11
|
+
export default TYPEORM_AWS_CONNECTOR_CONSTANT;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const relation_load_strategy_enum_1 = require("../../enum/relation-load-strategy.enum");
|
|
4
|
+
const DB_CONNECTION_TIMEOUT = 30_000;
|
|
5
|
+
const DB_IDLE_TIMEOUT = 30_000;
|
|
6
|
+
const DB_POOL_SIZE = 10;
|
|
7
|
+
const DB_RELATION_LOAD_STRATEGY = relation_load_strategy_enum_1.ERelationLoadStrategy.QUERY;
|
|
8
|
+
const DB_SYNCHRONIZE = false;
|
|
9
|
+
const DB_LOGGING = false;
|
|
10
|
+
const DB_CONNECTION_ROTATION_INTERVAL = 1000 * 60 * 60;
|
|
11
|
+
const TYPEORM_AWS_CONNECTOR_CONSTANT = {
|
|
12
|
+
DB_CONNECTION_ROTATION_INTERVAL,
|
|
13
|
+
DB_CONNECTION_TIMEOUT,
|
|
14
|
+
DB_IDLE_TIMEOUT,
|
|
15
|
+
DB_LOGGING,
|
|
16
|
+
DB_POOL_SIZE,
|
|
17
|
+
DB_RELATION_LOAD_STRATEGY,
|
|
18
|
+
DB_SYNCHRONIZE,
|
|
19
|
+
};
|
|
20
|
+
exports.default = TYPEORM_AWS_CONNECTOR_CONSTANT;
|
|
21
|
+
//# sourceMappingURL=constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../../../../src/shared/constant/typeorm-aws-connector/constant.ts"],"names":[],"mappings":";;AAAA,wFAAiF;AAEjF,MAAM,qBAAqB,GAAW,MAAM,CAAC;AAC7C,MAAM,eAAe,GAAW,MAAM,CAAC;AACvC,MAAM,YAAY,GAAW,EAAE,CAAC;AAChC,MAAM,yBAAyB,GAA0B,mDAAqB,CAAC,KAAK,CAAC;AACrF,MAAM,cAAc,GAAY,KAAK,CAAC;AACtC,MAAM,UAAU,GAAY,KAAK,CAAC;AAClC,MAAM,+BAA+B,GAAW,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC;AAE/D,MAAM,8BAA8B,GAQhC;IACH,+BAA+B;IAC/B,qBAAqB;IACrB,eAAe;IACf,UAAU;IACV,YAAY;IACZ,yBAAyB;IACzB,cAAc;CACL,CAAC;AAEX,kBAAe,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ERelationLoadStrategy = void 0;
|
|
4
|
+
var ERelationLoadStrategy;
|
|
5
|
+
(function (ERelationLoadStrategy) {
|
|
6
|
+
ERelationLoadStrategy["JOIN"] = "join";
|
|
7
|
+
ERelationLoadStrategy["QUERY"] = "query";
|
|
8
|
+
})(ERelationLoadStrategy || (exports.ERelationLoadStrategy = ERelationLoadStrategy = {}));
|
|
9
|
+
//# sourceMappingURL=relation-load-strategy.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation-load-strategy.enum.js","sourceRoot":"","sources":["../../../src/shared/enum/relation-load-strategy.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAChC,sCAAa,CAAA;IACb,wCAAe,CAAA;AAChB,CAAC,EAHW,qBAAqB,qCAArB,qBAAqB,QAGhC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { IDatabaseConfigRotation } from "../../type/database/config-rotation.type";
|
|
2
2
|
import type { EDatabaseType } from "../../enum/database/type.enum";
|
|
3
3
|
import type { EntitySchema, MixedList } from "typeorm";
|
|
4
|
-
|
|
4
|
+
import type { ERelationLoadStrategy } from "../../enum/relation-load-strategy.enum";
|
|
5
|
+
export interface ITypeOrmAwsConnectorConfig {
|
|
5
6
|
type: EDatabaseType;
|
|
6
7
|
port: number;
|
|
7
8
|
databaseName: string;
|
|
9
|
+
relationLoadStrategy?: ERelationLoadStrategy;
|
|
8
10
|
isVerbose?: boolean;
|
|
9
11
|
shouldSynchronize?: boolean;
|
|
10
12
|
connectionTimeoutMs?: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.interface.js","sourceRoot":"","sources":["../../../../src/shared/interface/typeorm-aws-connector/config.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ITypeOrmAwsConnectorModuleOptions } from "../../interface/typeorm-aws-connector/module-options.interface";
|
|
2
|
+
export interface ITypeOrmAwsConnectorModuleAsyncOptions {
|
|
3
|
+
useFactory: (...arguments_: Array<any>) => Promise<ITypeOrmAwsConnectorModuleOptions> | ITypeOrmAwsConnectorModuleOptions;
|
|
4
|
+
inject?: Array<any>;
|
|
5
|
+
imports?: Array<any>;
|
|
6
|
+
enableRotation?: boolean;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-async-options.interface.js","sourceRoot":"","sources":["../../../../src/shared/interface/typeorm-aws-connector/module-async-options.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-options.interface.js","sourceRoot":"","sources":["../../../../src/shared/interface/typeorm-aws-connector/module-options.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Provider } from "@nestjs/common";
|
|
2
|
+
import type { ITypeOrmAwsConnectorModuleAsyncOptions } from "../../interface/typeorm-aws-connector/module-async-options.interface";
|
|
3
|
+
export declare const DATABASE_CONFIG_PROVIDER = "DATABASE_CONFIG_PROVIDER";
|
|
4
|
+
export declare function createDatabaseConfigProvider(options: ITypeOrmAwsConnectorModuleAsyncOptions): Provider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.provider.js","sourceRoot":"","sources":["../../../../src/shared/provider/typeorm-aws-connector/database.provider.ts"],"names":[],"mappings":";;;AAMA,oEAMC;AARY,QAAA,wBAAwB,GAAG,0BAA0B,CAAC;AAEnE,SAAgB,4BAA4B,CAAC,OAA+C;IAC3F,OAAO;QACN,OAAO,EAAE,gCAAwB;QACjC,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;KAC5B,CAAC;AACH,CAAC"}
|