@mikro-orm/mysql 7.2.0-dev.3 → 7.2.0-dev.4
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/MySqlConnection.d.ts +1 -0
- package/MySqlConnection.js +8 -2
- package/package.json +5 -5
package/MySqlConnection.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { type Routine, type Transaction } from '@mikro-orm/core';
|
|
|
4
4
|
import { AbstractSqlConnection, type TransactionEventBroadcaster } from '@mikro-orm/sql';
|
|
5
5
|
/** MySQL database connection using the `mysql2` driver. */
|
|
6
6
|
export declare class MySqlConnection extends AbstractSqlConnection {
|
|
7
|
+
#private;
|
|
7
8
|
createKyselyDialect(overrides: PoolOptions): Promise<MysqlDialect>;
|
|
8
9
|
mapOptions(overrides: PoolOptions): PoolOptions;
|
|
9
10
|
callRoutine<T>(routine: Routine, args?: Record<string, unknown>, ctx?: Transaction): Promise<T>;
|
package/MySqlConnection.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { MysqlDialect } from 'kysely';
|
|
2
|
-
import { createPool } from 'mysql2';
|
|
1
|
+
import { MysqlDialect, } from 'kysely';
|
|
2
|
+
import { createConnection, createPool } from 'mysql2';
|
|
3
3
|
import { Utils, AbstractSqlConnection, } from '@mikro-orm/sql';
|
|
4
4
|
/** MySQL database connection using the `mysql2` driver. */
|
|
5
5
|
export class MySqlConnection extends AbstractSqlConnection {
|
|
6
|
+
// Kysely sends `cancel query`/`kill session` over this connection rather than over the pool, so an
|
|
7
|
+
// abort doesn't have to wait for an idle pool connection — or, inside a transaction, for the very
|
|
8
|
+
// query it is meant to cancel. Postgres gets one from its pool by default, mysql2 does not.
|
|
9
|
+
static #controlConnection = createConnection;
|
|
6
10
|
async createKyselyDialect(overrides) {
|
|
7
11
|
const options = this.mapOptions(overrides);
|
|
8
12
|
const password = options.password;
|
|
@@ -33,12 +37,14 @@ export class MySqlConnection extends AbstractSqlConnection {
|
|
|
33
37
|
};
|
|
34
38
|
return new MysqlDialect({
|
|
35
39
|
pool,
|
|
40
|
+
controlConnection: MySqlConnection.#controlConnection,
|
|
36
41
|
onCreateConnection: this.options.onCreateConnection ?? this.config.get('onCreateConnection'),
|
|
37
42
|
onReserveConnection: this.options.onReserveConnection ?? this.config.get('onReserveConnection'),
|
|
38
43
|
});
|
|
39
44
|
}
|
|
40
45
|
return new MysqlDialect({
|
|
41
46
|
pool: createPool(options),
|
|
47
|
+
controlConnection: MySqlConnection.#controlConnection,
|
|
42
48
|
onCreateConnection: this.options.onCreateConnection ?? this.config.get('onCreateConnection'),
|
|
43
49
|
onReserveConnection: this.options.onReserveConnection ?? this.config.get('onReserveConnection'),
|
|
44
50
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/mysql",
|
|
3
|
-
"version": "7.2.0-dev.
|
|
3
|
+
"version": "7.2.0-dev.4",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -47,16 +47,16 @@
|
|
|
47
47
|
"copy": "node ../../scripts/copy.mjs"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@mikro-orm/sql": "7.2.0-dev.
|
|
50
|
+
"@mikro-orm/sql": "7.2.0-dev.4",
|
|
51
51
|
"kysely": "0.29.4",
|
|
52
|
-
"mysql2": "3.23.
|
|
52
|
+
"mysql2": "3.23.2",
|
|
53
53
|
"sqlstring": "2.3.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@mikro-orm/core": "^7.1.
|
|
56
|
+
"@mikro-orm/core": "^7.1.11"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@mikro-orm/core": "7.2.0-dev.
|
|
59
|
+
"@mikro-orm/core": "7.2.0-dev.4"
|
|
60
60
|
},
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">= 22.17.0"
|