@tylix/orm 0.4.1 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tylix/orm",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "test": "node --test src/**/*.test.js"
17
17
  },
18
18
  "dependencies": {
19
- "@tylix/shared": "^0.4.0",
19
+ "@tylix/shared": "^0.5.0",
20
20
  "mongodb": "^6.5.0",
21
21
  "mysql2": "^3.23.1",
22
22
  "pg": "^8.11.0"
@@ -31,10 +31,19 @@ export class MysqlAdapter extends DatabaseAdapter {
31
31
  this.connection = null
32
32
  }
33
33
 
34
- async connect() {
35
- this.connection = await mysql.createConnection(this.config)
36
- return this
37
- }
34
+ async connect() {
35
+ this.connection = mysql.createPool({
36
+ ...this.config,
37
+ waitForConnections: true,
38
+ connectionLimit: 10,
39
+ queueLimit: 0,
40
+ enableKeepAlive: true,
41
+ keepAliveInitialDelay: 10000,
42
+ })
43
+ const conn = await this.connection.getConnection() // fail fast on bad credentials
44
+ conn.release()
45
+ return this
46
+ }
38
47
 
39
48
  async close() {
40
49
  if (this.connection) {