@mikro-orm/mysql 6.4.7-dev.0 → 7.0.0-dev.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/MySqlConnection.d.ts +7 -0
- package/MySqlConnection.js +44 -0
- package/MySqlDriver.d.ts +2 -1
- package/MySqlDriver.js +2 -1
- package/README.md +0 -2
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.mjs +10 -12
- package/package.json +5 -5
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MysqlDialect } from 'kysely';
|
|
2
|
+
import { type PoolOptions } from 'mysql2';
|
|
3
|
+
import { AbstractSqlConnection } from '@mikro-orm/knex';
|
|
4
|
+
export declare class MySqlConnection extends AbstractSqlConnection {
|
|
5
|
+
createKyselyDialect(overrides: PoolOptions): MysqlDialect;
|
|
6
|
+
mapOptions(overrides: PoolOptions): PoolOptions;
|
|
7
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MySqlConnection = void 0;
|
|
4
|
+
const kysely_1 = require("kysely");
|
|
5
|
+
const mysql2_1 = require("mysql2");
|
|
6
|
+
const knex_1 = require("@mikro-orm/knex");
|
|
7
|
+
class MySqlConnection extends knex_1.AbstractSqlConnection {
|
|
8
|
+
createKyselyDialect(overrides) {
|
|
9
|
+
const options = this.mapOptions(overrides);
|
|
10
|
+
const password = options.password;
|
|
11
|
+
if (typeof password === 'function') {
|
|
12
|
+
return new kysely_1.MysqlDialect({
|
|
13
|
+
pool: async () => (0, mysql2_1.createPool)({
|
|
14
|
+
...options,
|
|
15
|
+
password: await password(),
|
|
16
|
+
}),
|
|
17
|
+
onCreateConnection: this.options.onCreateConnection ?? this.config.get('onCreateConnection'),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return new kysely_1.MysqlDialect({
|
|
21
|
+
pool: (0, mysql2_1.createPool)(options),
|
|
22
|
+
onCreateConnection: this.options.onCreateConnection ?? this.config.get('onCreateConnection'),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
mapOptions(overrides) {
|
|
26
|
+
const ret = { ...this.getConnectionOptions() };
|
|
27
|
+
const pool = this.config.get('pool');
|
|
28
|
+
knex_1.Utils.defaultValue(ret, 'connectionLimit', pool?.max);
|
|
29
|
+
knex_1.Utils.defaultValue(ret, 'idleTimeout', pool?.idleTimeoutMillis);
|
|
30
|
+
if (this.config.get('multipleStatements')) {
|
|
31
|
+
ret.multipleStatements = this.config.get('multipleStatements');
|
|
32
|
+
}
|
|
33
|
+
if (this.config.get('forceUtcTimezone')) {
|
|
34
|
+
ret.timezone = 'Z';
|
|
35
|
+
}
|
|
36
|
+
if (this.config.get('timezone')) {
|
|
37
|
+
ret.timezone = this.config.get('timezone');
|
|
38
|
+
}
|
|
39
|
+
ret.supportBigNumbers = true;
|
|
40
|
+
ret.dateStrings = true;
|
|
41
|
+
return knex_1.Utils.mergeConfig(ret, overrides);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.MySqlConnection = MySqlConnection;
|
package/MySqlDriver.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Configuration, type EntityDictionary, type FilterQuery, type NativeInsertUpdateManyOptions, type QueryResult, type UpsertManyOptions } from '@mikro-orm/core';
|
|
2
|
-
import { AbstractSqlDriver,
|
|
2
|
+
import { AbstractSqlDriver, MySqlPlatform } from '@mikro-orm/knex';
|
|
3
|
+
import { MySqlConnection } from './MySqlConnection';
|
|
3
4
|
export declare class MySqlDriver extends AbstractSqlDriver<MySqlConnection, MySqlPlatform> {
|
|
4
5
|
protected autoIncrementIncrement?: number;
|
|
5
6
|
constructor(config: Configuration);
|
package/MySqlDriver.js
CHANGED
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MySqlDriver = void 0;
|
|
4
4
|
const core_1 = require("@mikro-orm/core");
|
|
5
5
|
const knex_1 = require("@mikro-orm/knex");
|
|
6
|
+
const MySqlConnection_1 = require("./MySqlConnection");
|
|
6
7
|
class MySqlDriver extends knex_1.AbstractSqlDriver {
|
|
7
8
|
autoIncrementIncrement;
|
|
8
9
|
constructor(config) {
|
|
9
|
-
super(config, new knex_1.MySqlPlatform(),
|
|
10
|
+
super(config, new knex_1.MySqlPlatform(), MySqlConnection_1.MySqlConnection, ['kysely', 'mysql2']);
|
|
10
11
|
}
|
|
11
12
|
async getAutoIncrementIncrement(ctx) {
|
|
12
13
|
if (this.autoIncrementIncrement == null) {
|
package/README.md
CHANGED
|
@@ -183,7 +183,6 @@ yarn add @mikro-orm/core @mikro-orm/mariadb # for mysql/mariadb
|
|
|
183
183
|
yarn add @mikro-orm/core @mikro-orm/postgresql # for postgresql
|
|
184
184
|
yarn add @mikro-orm/core @mikro-orm/mssql # for mssql
|
|
185
185
|
yarn add @mikro-orm/core @mikro-orm/sqlite # for sqlite
|
|
186
|
-
yarn add @mikro-orm/core @mikro-orm/better-sqlite # for better-sqlite
|
|
187
186
|
yarn add @mikro-orm/core @mikro-orm/libsql # for libsql
|
|
188
187
|
```
|
|
189
188
|
|
|
@@ -196,7 +195,6 @@ npm i -s @mikro-orm/core @mikro-orm/mariadb # for mysql/mariadb
|
|
|
196
195
|
npm i -s @mikro-orm/core @mikro-orm/postgresql # for postgresql
|
|
197
196
|
npm i -s @mikro-orm/core @mikro-orm/mssql # for mssql
|
|
198
197
|
npm i -s @mikro-orm/core @mikro-orm/sqlite # for sqlite
|
|
199
|
-
npm i -s @mikro-orm/core @mikro-orm/better-sqlite # for better-sqlite
|
|
200
198
|
npm i -s @mikro-orm/core @mikro-orm/libsql # for libsql
|
|
201
199
|
```
|
|
202
200
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -18,6 +18,7 @@ exports.defineConfig = exports.MikroORM = void 0;
|
|
|
18
18
|
/* istanbul ignore file */
|
|
19
19
|
__exportStar(require("@mikro-orm/knex"), exports);
|
|
20
20
|
__exportStar(require("./MySqlDriver"), exports);
|
|
21
|
+
__exportStar(require("./MySqlConnection"), exports);
|
|
21
22
|
var MySqlMikroORM_1 = require("./MySqlMikroORM");
|
|
22
23
|
Object.defineProperty(exports, "MikroORM", { enumerable: true, get: function () { return MySqlMikroORM_1.MySqlMikroORM; } });
|
|
23
24
|
Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return MySqlMikroORM_1.defineMySqlConfig; } });
|
package/index.mjs
CHANGED
|
@@ -19,12 +19,10 @@ export const ArrayType = mod.ArrayType;
|
|
|
19
19
|
export const BaseEntity = mod.BaseEntity;
|
|
20
20
|
export const BaseSqliteConnection = mod.BaseSqliteConnection;
|
|
21
21
|
export const BaseSqlitePlatform = mod.BaseSqlitePlatform;
|
|
22
|
-
export const BaseSqliteSchemaHelper = mod.BaseSqliteSchemaHelper;
|
|
23
22
|
export const BeforeCreate = mod.BeforeCreate;
|
|
24
23
|
export const BeforeDelete = mod.BeforeDelete;
|
|
25
24
|
export const BeforeUpdate = mod.BeforeUpdate;
|
|
26
25
|
export const BeforeUpsert = mod.BeforeUpsert;
|
|
27
|
-
export const BetterSqliteKnexDialect = mod.BetterSqliteKnexDialect;
|
|
28
26
|
export const BigIntType = mod.BigIntType;
|
|
29
27
|
export const BlobType = mod.BlobType;
|
|
30
28
|
export const BooleanType = mod.BooleanType;
|
|
@@ -112,14 +110,12 @@ export const JSON_KEY_OPERATORS = mod.JSON_KEY_OPERATORS;
|
|
|
112
110
|
export const JoinType = mod.JoinType;
|
|
113
111
|
export const JsonProperty = mod.JsonProperty;
|
|
114
112
|
export const JsonType = mod.JsonType;
|
|
115
|
-
export const
|
|
116
|
-
export const LibSqlKnexDialect = mod.LibSqlKnexDialect;
|
|
113
|
+
export const Kysely = mod.Kysely;
|
|
117
114
|
export const LoadStrategy = mod.LoadStrategy;
|
|
118
115
|
export const LockMode = mod.LockMode;
|
|
119
116
|
export const LockWaitTimeoutException = mod.LockWaitTimeoutException;
|
|
120
117
|
export const ManyToMany = mod.ManyToMany;
|
|
121
118
|
export const ManyToOne = mod.ManyToOne;
|
|
122
|
-
export const MariaDbKnexDialect = mod.MariaDbKnexDialect;
|
|
123
119
|
export const MediumIntType = mod.MediumIntType;
|
|
124
120
|
export const MemoryCacheAdapter = mod.MemoryCacheAdapter;
|
|
125
121
|
export const MetadataDiscovery = mod.MetadataDiscovery;
|
|
@@ -129,14 +125,14 @@ export const MetadataStorage = mod.MetadataStorage;
|
|
|
129
125
|
export const MetadataValidator = mod.MetadataValidator;
|
|
130
126
|
export const MikroORM = mod.MikroORM;
|
|
131
127
|
export const MongoNamingStrategy = mod.MongoNamingStrategy;
|
|
132
|
-
export const
|
|
133
|
-
export const MsSqlKnexDialect = mod.MsSqlKnexDialect;
|
|
128
|
+
export const MsSqlNativeQueryBuilder = mod.MsSqlNativeQueryBuilder;
|
|
134
129
|
export const MySqlConnection = mod.MySqlConnection;
|
|
135
130
|
export const MySqlDriver = mod.MySqlDriver;
|
|
136
131
|
export const MySqlExceptionConverter = mod.MySqlExceptionConverter;
|
|
137
|
-
export const
|
|
132
|
+
export const MySqlNativeQueryBuilder = mod.MySqlNativeQueryBuilder;
|
|
138
133
|
export const MySqlPlatform = mod.MySqlPlatform;
|
|
139
134
|
export const MySqlSchemaHelper = mod.MySqlSchemaHelper;
|
|
135
|
+
export const NativeQueryBuilder = mod.NativeQueryBuilder;
|
|
140
136
|
export const NodeState = mod.NodeState;
|
|
141
137
|
export const NonUniqueFieldNameException = mod.NonUniqueFieldNameException;
|
|
142
138
|
export const NotFoundError = mod.NotFoundError;
|
|
@@ -156,7 +152,7 @@ export const PlainObject = mod.PlainObject;
|
|
|
156
152
|
export const Platform = mod.Platform;
|
|
157
153
|
export const PopulateHint = mod.PopulateHint;
|
|
158
154
|
export const PopulatePath = mod.PopulatePath;
|
|
159
|
-
export const
|
|
155
|
+
export const PostgreSqlNativeQueryBuilder = mod.PostgreSqlNativeQueryBuilder;
|
|
160
156
|
export const PrimaryKey = mod.PrimaryKey;
|
|
161
157
|
export const PrimaryKeyProp = mod.PrimaryKeyProp;
|
|
162
158
|
export const Property = mod.Property;
|
|
@@ -168,6 +164,7 @@ export const QueryOperator = mod.QueryOperator;
|
|
|
168
164
|
export const QueryOrder = mod.QueryOrder;
|
|
169
165
|
export const QueryOrderNumeric = mod.QueryOrderNumeric;
|
|
170
166
|
export const QueryType = mod.QueryType;
|
|
167
|
+
export const Raw = mod.Raw;
|
|
171
168
|
export const RawQueryFragment = mod.RawQueryFragment;
|
|
172
169
|
export const ReadOnlyException = mod.ReadOnlyException;
|
|
173
170
|
export const Ref = mod.Ref;
|
|
@@ -189,8 +186,9 @@ export const SmallIntType = mod.SmallIntType;
|
|
|
189
186
|
export const SqlEntityManager = mod.SqlEntityManager;
|
|
190
187
|
export const SqlEntityRepository = mod.SqlEntityRepository;
|
|
191
188
|
export const SqlSchemaGenerator = mod.SqlSchemaGenerator;
|
|
192
|
-
export const
|
|
193
|
-
export const
|
|
189
|
+
export const SqliteExceptionConverter = mod.SqliteExceptionConverter;
|
|
190
|
+
export const SqliteNativeQueryBuilder = mod.SqliteNativeQueryBuilder;
|
|
191
|
+
export const SqliteSchemaHelper = mod.SqliteSchemaHelper;
|
|
194
192
|
export const StringType = mod.StringType;
|
|
195
193
|
export const SyntaxErrorException = mod.SyntaxErrorException;
|
|
196
194
|
export const TableExistsException = mod.TableExistsException;
|
|
@@ -224,7 +222,7 @@ export const equals = mod.equals;
|
|
|
224
222
|
export const getOnConflictFields = mod.getOnConflictFields;
|
|
225
223
|
export const getOnConflictReturningFields = mod.getOnConflictReturningFields;
|
|
226
224
|
export const helper = mod.helper;
|
|
227
|
-
export const
|
|
225
|
+
export const isRaw = mod.isRaw;
|
|
228
226
|
export const parseJsonSafe = mod.parseJsonSafe;
|
|
229
227
|
export const raw = mod.raw;
|
|
230
228
|
export const ref = mod.ref;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/mysql",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-dev.0",
|
|
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
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://mikro-orm.io",
|
|
48
48
|
"engines": {
|
|
49
|
-
"node": ">=
|
|
49
|
+
"node": ">= 22.11.0"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "yarn clean && yarn compile && yarn copy && yarn run -T gen-esm-wrapper index.js index.mjs",
|
|
@@ -58,13 +58,13 @@
|
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@mikro-orm/knex": "
|
|
61
|
+
"@mikro-orm/knex": "7.0.0-dev.0",
|
|
62
62
|
"mysql2": "3.12.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@mikro-orm/core": "^6.4.
|
|
65
|
+
"@mikro-orm/core": "^6.4.5"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@mikro-orm/core": "
|
|
68
|
+
"@mikro-orm/core": "7.0.0-dev.0"
|
|
69
69
|
}
|
|
70
70
|
}
|