@elsikora/nestjs-typeorm-aws-connector 1.2.0 β†’ 1.2.2

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
@@ -39,33 +39,33 @@ Example of both modules working together:
39
39
 
40
40
  ```typescript
41
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
- ]
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
69
  })
70
70
  export class AppModule {}
71
71
  ```
@@ -78,16 +78,16 @@ NestJS-TypeORM-AWS-Connector is a powerful integration module that provides seam
78
78
 
79
79
  ## Features
80
80
 
81
- | | Feature | Description |
82
- |----|------------------------|--------------------------------------------------------------------------------------------------------------------|
83
- | πŸ”„ | **Connection Rotation** | Automatic connection rotation to prevent stale connections and ensure optimal database performance |
84
- | 🏊 | **Connection Pooling** | Configurable connection pool with customizable size and timeout settings |
85
- | ⚑️ | **Performance** | Optimized database connections with configurable timeouts and idle connection management |
86
- | πŸ”§ | **Easy Configuration** | Flexible configuration options through both static and async module registration |
87
- | 🎯 | **Type Safety** | Full TypeScript support with strong typing for all configuration options |
88
- | πŸ“Š | **Multiple Databases** | Support for different database types (PostgreSQL, MySQL, etc.) through EDatabaseType enum |
89
- | πŸ” | **Verbose Logging** | Optional verbose mode for detailed logging of database operations |
90
- | πŸ”„ | **Auto-Sync Schema** | Optional automatic schema synchronization with database |
81
+ | | Feature | Description |
82
+ | --- | ----------------------- | -------------------------------------------------------------------------------------------------- |
83
+ | πŸ”„ | **Connection Rotation** | Automatic connection rotation to prevent stale connections and ensure optimal database performance |
84
+ | 🏊 | **Connection Pooling** | Configurable connection pool with customizable size and timeout settings |
85
+ | ⚑️ | **Performance** | Optimized database connections with configurable timeouts and idle connection management |
86
+ | πŸ”§ | **Easy Configuration** | Flexible configuration options through both static and async module registration |
87
+ | 🎯 | **Type Safety** | Full TypeScript support with strong typing for all configuration options |
88
+ | πŸ“Š | **Multiple Databases** | Support for different database types (PostgreSQL, MySQL, etc.) through EDatabaseType enum |
89
+ | πŸ” | **Verbose Logging** | Optional verbose mode for detailed logging of database operations |
90
+ | πŸ”„ | **Auto-Sync Schema** | Optional automatic schema synchronization with database |
91
91
 
92
92
  ## Installation
93
93
 
@@ -100,30 +100,30 @@ npm install @elsikora/nestjs-typeorm-aws-connector
100
100
  ### Async Configuration
101
101
 
102
102
  ```typescript
103
- import { TypeOrmAwsConnectorModule, EDatabaseType } from '@elsikora/nestjs-typeorm-aws-connector';
103
+ import { TypeOrmAwsConnectorModule, EDatabaseType } from "@elsikora/nestjs-typeorm-aws-connector";
104
104
 
105
105
  @Module({
106
- imports: [
107
- TypeOrmAwsConnectorModule.registerAsync({
108
- imports: [ConfigModule],
109
- inject: [ConfigService],
110
- useFactory: async () => ({
111
- connectionTimeoutMs: 30_000,
112
- databaseName: "app",
113
- entities: [Bank],
114
- idleTimeoutMs: 30_000,
115
- isVerbose: true,
116
- poolSize: 10,
117
- port: 5432,
118
- rotation: {
119
- intervalMs: 5000,
120
- isEnabled: true,
121
- },
122
- shouldSynchronize: true,
123
- type: EDatabaseType.POSTGRES,
124
- }),
125
- }),
126
- ]
106
+ imports: [
107
+ TypeOrmAwsConnectorModule.registerAsync({
108
+ imports: [ConfigModule],
109
+ inject: [ConfigService],
110
+ useFactory: async () => ({
111
+ connectionTimeoutMs: 30_000,
112
+ databaseName: "app",
113
+ entities: [Bank],
114
+ idleTimeoutMs: 30_000,
115
+ isVerbose: true,
116
+ poolSize: 10,
117
+ port: 5432,
118
+ rotation: {
119
+ intervalMs: 5000,
120
+ isEnabled: true,
121
+ },
122
+ shouldSynchronize: true,
123
+ type: EDatabaseType.POSTGRES,
124
+ }),
125
+ }),
126
+ ],
127
127
  })
128
128
  export class AppModule {}
129
129
  ```
@@ -131,49 +131,48 @@ export class AppModule {}
131
131
  ### Static Configuration
132
132
 
133
133
  ```typescript
134
- import {TypeOrmAwsConnectorModule, EDatabaseType} from '@elsikora/nestjs-typeorm-aws-connector';
134
+ import { TypeOrmAwsConnectorModule, EDatabaseType } from "@elsikora/nestjs-typeorm-aws-connector";
135
135
 
136
136
  @Module({
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
- ]
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
+ ],
154
154
  })
155
- export class AppModule {
156
- }
155
+ export class AppModule {}
157
156
  ```
158
157
 
159
158
  ### Integration with TypeORM
160
159
 
161
160
  ```typescript
162
- import { TypeOrmModule } from '@nestjs/typeorm';
163
- import { TypeOrmAwsConnectorService } from '@elsikora/nestjs-typeorm-aws-connector';
161
+ import { TypeOrmModule } from "@nestjs/typeorm";
162
+ import { TypeOrmAwsConnectorService } from "@elsikora/nestjs-typeorm-aws-connector";
164
163
 
165
164
  @Module({
166
- imports: [
167
- TypeOrmModule.forRootAsync({
168
- inject: [TypeOrmAwsConnectorService],
169
- useFactory: async (databaseService: TypeOrmAwsConnectorService) => {
170
- const options = await databaseService.getTypeOrmOptions();
171
- return {
172
- ...options,
173
- };
174
- },
175
- }),
176
- ]
165
+ imports: [
166
+ TypeOrmModule.forRootAsync({
167
+ inject: [TypeOrmAwsConnectorService],
168
+ useFactory: async (databaseService: TypeOrmAwsConnectorService) => {
169
+ const options = await databaseService.getTypeOrmOptions();
170
+ return {
171
+ ...options,
172
+ };
173
+ },
174
+ }),
175
+ ],
177
176
  })
178
177
  export class AppModule {}
179
178
  ```
@@ -181,7 +180,7 @@ export class AppModule {}
181
180
  ## Configuration Options
182
181
 
183
182
  | Option | Type | Required | Default | Description |
184
- |----------------------|-----------------------|----------|-----------------------------|----------------------------------------------|
183
+ | -------------------- | --------------------- | -------- | --------------------------- | -------------------------------------------- |
185
184
  | type | EDatabaseType | Yes | - | Database type (POSTGRES, MYSQL, etc.) |
186
185
  | databaseName | string | Yes | - | Name of the database to connect to |
187
186
  | port | number | Yes | - | Database port number |
@@ -201,8 +200,8 @@ The module supports multiple database types through the `EDatabaseType` enum:
201
200
 
202
201
  ```typescript
203
202
  enum EDatabaseType {
204
- POSTGRES = 'postgres',
205
- MYSQL = 'mysql',
203
+ POSTGRES = "postgres",
204
+ MYSQL = "mysql",
206
205
  }
207
206
  ```
208
207
 
@@ -227,16 +226,18 @@ The module includes built-in error handling for common database connection issue
227
226
  ## Best Practices
228
227
 
229
228
  1. **Connection Pooling**
230
- - Set appropriate `poolSize` based on your application's needs
231
- - Monitor pool usage in production
229
+
230
+ - Set appropriate `poolSize` based on your application's needs
231
+ - Monitor pool usage in production
232
232
 
233
233
  2. **Connection Rotation**
234
- - Enable rotation for long-running applications
235
- - Adjust `rotation.intervalMs` based on your workload
234
+
235
+ - Enable rotation for long-running applications
236
+ - Adjust `rotation.intervalMs` based on your workload
236
237
 
237
238
  3. **Timeouts**
238
- - Set reasonable `connectionTimeoutMs` and `idleTimeoutMs`
239
- - Consider your application's specific requirements
239
+ - Set reasonable `connectionTimeoutMs` and `idleTimeoutMs`
240
+ - Consider your application's specific requirements
240
241
 
241
242
  ## Contributing
242
243
 
@@ -59,7 +59,7 @@ let TypeOrmAwsConnectorService = TypeOrmAwsConnectorService_1 = class TypeOrmAws
59
59
  },
60
60
  entities: this.databaseConfig.entities,
61
61
  };
62
- this.logger.debug(`TypeORM options сформированы: ${JSON.stringify(options)}`);
62
+ this.logger.debug(`TypeORM options were successfully created`);
63
63
  return options;
64
64
  }
65
65
  };
@@ -1 +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,IAAM,0BAA0B,kCAAhC,MAAM,0BAA0B;IAGtC,YACkB,aAA4B,EAC5B,2BAAwD,EAEzE,cAA2D;QAH1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;YACf,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,IAAW;YACrC,IAAI;YACJ,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI;YAC9B,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,YAAY;YAC1C,oBAAoB,EAAE,IAAI,CAAC,cAAc,CAAC,oBAAoB,IAAI,kBAA8B,CAAC,yBAAyB;YAC1H,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,SAAS,IAAI,kBAA8B,CAAC,UAAU;YACnF,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,iBAAiB,IAAI,kBAA8B,CAAC,cAAc;YACnG,KAAK,EAAE;gBACN,uBAAuB,EAAE,IAAI,CAAC,cAAc,CAAC,mBAAmB,IAAI,kBAA8B,CAAC,qBAAqB;gBACxH,iBAAiB,EAAE,IAAI,CAAC,cAAc,CAAC,aAAa,IAAI,kBAA8B,CAAC,eAAe;gBACtG,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ,IAAI,kBAA8B,CAAC,YAAY;aAChF;YACD,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,QAAQ;SACtC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iCAAiC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAE9E,OAAO,OAAO,CAAC;IAChB,CAAC;CACD,CAAA;AAzDY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,mBAAU,GAAE;IAOV,WAAA,IAAA,eAAM,EAAC,4CAAwB,CAAC,CAAA;qCAFD,sBAAa;QACC,+DAA2B;GAL9D,0BAA0B,CAyDtC"}
1
+ {"version":3,"file":"typeorm-aws-connector.service.js","sourceRoot":"","sources":["../../../src/modules/typeorm-aws-connector/typeorm-aws-connector.service.ts"],"names":[],"mappings":";;;;;;;;;;;;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