@mikro-orm/mariadb 7.0.0-dev.9 → 7.0.0-dev.91

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.
@@ -1,19 +1,18 @@
1
- import { MikroORM, type Options, type IDatabaseDriver, type EntityManager, type EntityManagerType } from '@mikro-orm/core';
1
+ import { type AnyEntity, type EntityClass, type EntitySchema, MikroORM, type Options, type IDatabaseDriver, type EntityManager, type EntityManagerType } from '@mikro-orm/core';
2
2
  import type { SqlEntityManager } from '@mikro-orm/mysql';
3
3
  import { MariaDbDriver } from './MariaDbDriver.js';
4
+ export type MariaDbOptions<EM extends SqlEntityManager<MariaDbDriver> = SqlEntityManager<MariaDbDriver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> = Options<MariaDbDriver, EM, Entities>;
5
+ export declare function defineMariaDbConfig<EM extends SqlEntityManager<MariaDbDriver> = SqlEntityManager<MariaDbDriver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Options<MariaDbDriver, EM, Entities>): Options<MariaDbDriver, EM, Entities>;
4
6
  /**
5
7
  * @inheritDoc
6
8
  */
7
- export declare class MariaDbMikroORM<EM extends EntityManager = SqlEntityManager> extends MikroORM<MariaDbDriver, EM> {
8
- private static DRIVER;
9
+ export declare class MariaDbMikroORM<EM extends SqlEntityManager<MariaDbDriver> = SqlEntityManager<MariaDbDriver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> extends MikroORM<MariaDbDriver, EM, Entities> {
9
10
  /**
10
11
  * @inheritDoc
11
12
  */
12
- static init<D extends IDatabaseDriver = MariaDbDriver, EM extends EntityManager = D[typeof EntityManagerType] & EntityManager>(options?: Options<D, EM>): Promise<MikroORM<D, EM>>;
13
+ static init<D extends IDatabaseDriver = MariaDbDriver, EM extends EntityManager<D> = D[typeof EntityManagerType] & EntityManager<D>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Options<D, EM, Entities>): Promise<MikroORM<D, EM, Entities>>;
13
14
  /**
14
15
  * @inheritDoc
15
16
  */
16
- static initSync<D extends IDatabaseDriver = MariaDbDriver, EM extends EntityManager = D[typeof EntityManagerType] & EntityManager>(options: Options<D, EM>): MikroORM<D, EM>;
17
+ constructor(options: Options<MariaDbDriver, EM, Entities>);
17
18
  }
18
- export type MariaDbOptions = Options<MariaDbDriver>;
19
- export declare function defineMariaDbConfig(options: MariaDbOptions): Options<MariaDbDriver, SqlEntityManager<MariaDbDriver> & EntityManager<IDatabaseDriver<import("@mikro-orm/core").Connection>>>;
@@ -1,24 +1,22 @@
1
1
  import { defineConfig, MikroORM, } from '@mikro-orm/core';
2
2
  import { MariaDbDriver } from './MariaDbDriver.js';
3
+ export function defineMariaDbConfig(options) {
4
+ return defineConfig({ driver: MariaDbDriver, ...options });
5
+ }
3
6
  /**
4
7
  * @inheritDoc
5
8
  */
6
9
  export class MariaDbMikroORM extends MikroORM {
7
- static DRIVER = MariaDbDriver;
8
10
  /**
9
11
  * @inheritDoc
10
12
  */
11
13
  static async init(options) {
12
- return super.init(options);
14
+ return super.init(defineMariaDbConfig(options));
13
15
  }
14
16
  /**
15
17
  * @inheritDoc
16
18
  */
17
- static initSync(options) {
18
- return super.initSync(options);
19
+ constructor(options) {
20
+ super(defineMariaDbConfig(options));
19
21
  }
20
22
  }
21
- /* v8 ignore next 3 */
22
- export function defineMariaDbConfig(options) {
23
- return defineConfig({ driver: MariaDbDriver, ...options });
24
- }
@@ -41,7 +41,7 @@ export class MariaDbQueryBuilder extends QueryBuilder {
41
41
  // @ts-ignore
42
42
  subQuery.finalized = true;
43
43
  const innerQuery = subQuery.as(this.mainAlias.aliasName).clear('select').select(pks);
44
- /* v8 ignore start */
44
+ /* v8 ignore next */
45
45
  if (addToSelect.length > 0) {
46
46
  addToSelect.forEach(prop => {
47
47
  const field = this._fields.find(field => {
@@ -62,7 +62,6 @@ export class MariaDbQueryBuilder extends QueryBuilder {
62
62
  }
63
63
  });
64
64
  }
65
- /* v8 ignore stop */
66
65
  // multiple sub-queries are needed to get around mysql limitations with order by + limit + where in + group by (o.O)
67
66
  // https://stackoverflow.com/questions/17892762/mysql-this-version-of-mysql-doesnt-yet-support-limit-in-all-any-some-subqu
68
67
  const subSubQuery = this.platform.createNativeQueryBuilder();
@@ -86,7 +85,7 @@ export class MariaDbQueryBuilder extends QueryBuilder {
86
85
  addPath(this._populate);
87
86
  for (const [key, join] of Object.entries(this._joins)) {
88
87
  const path = join.path?.replace(/\[populate]|\[pivot]|:ref/g, '').replace(new RegExp(`^${meta.className}.`), '');
89
- /* v8 ignore next 3 */
88
+ /* v8 ignore next */
90
89
  if (!populate.has(path ?? '') && !orderByAliases.includes(join.alias)) {
91
90
  delete this._joins[key];
92
91
  }
@@ -55,7 +55,7 @@ export class MariaDbSchemaHelper extends MySqlSchemaHelper {
55
55
  numeric_precision as numeric_precision,
56
56
  numeric_scale as numeric_scale,
57
57
  ifnull(datetime_precision, character_maximum_length) length
58
- from information_schema.columns where table_schema = database() and table_name in (${tables.map(t => this.platform.quoteValue(t.table_name))})
58
+ from information_schema.columns where table_schema = database() and table_name in (${tables.map(t => this.platform.quoteValue(t.table_name)).join(', ')})
59
59
  order by ordinal_position`;
60
60
  const allColumns = await connection.execute(sql);
61
61
  const str = (val) => val != null ? '' + val : val;
@@ -122,7 +122,7 @@ export class MariaDbSchemaHelper extends MySqlSchemaHelper {
122
122
  tc.check_clause as expression,
123
123
  /*M!100510 case when tc.level = 'Column' then tc.constraint_name else */ null /*M!100510 end */ as column_name
124
124
  from information_schema.check_constraints tc
125
- where tc.table_name in (${tables.map(t => this.platform.quoteValue(t.table_name))}) and tc.constraint_schema = database()
125
+ where tc.table_name in (${tables.map(t => this.platform.quoteValue(t.table_name)).join(', ')}) and tc.constraint_schema = database()
126
126
  order by tc.constraint_name`;
127
127
  }
128
128
  wrap(val, type) {
package/README.md CHANGED
@@ -11,7 +11,6 @@ TypeScript ORM for Node.js based on Data Mapper, [Unit of Work](https://mikro-or
11
11
  [![Chat on discord](https://img.shields.io/discord/1214904142443839538?label=discord&color=blue)](https://discord.gg/w8bjxFHS7X)
12
12
  [![Downloads](https://img.shields.io/npm/dm/@mikro-orm/core.svg)](https://www.npmjs.com/package/@mikro-orm/core)
13
13
  [![Coverage Status](https://img.shields.io/coveralls/mikro-orm/mikro-orm.svg)](https://coveralls.io/r/mikro-orm/mikro-orm?branch=master)
14
- [![Maintainability](https://api.codeclimate.com/v1/badges/27999651d3adc47cfa40/maintainability)](https://codeclimate.com/github/mikro-orm/mikro-orm/maintainability)
15
14
  [![Build Status](https://github.com/mikro-orm/mikro-orm/workflows/tests/badge.svg?branch=master)](https://github.com/mikro-orm/mikro-orm/actions?workflow=tests)
16
15
 
17
16
  ## 🤔 Unit of What?
@@ -141,7 +140,7 @@ There is also auto-generated [CHANGELOG.md](CHANGELOG.md) file based on commit m
141
140
  - [Composite and Foreign Keys as Primary Key](https://mikro-orm.io/docs/composite-keys)
142
141
  - [Filters](https://mikro-orm.io/docs/filters)
143
142
  - [Using `QueryBuilder`](https://mikro-orm.io/docs/query-builder)
144
- - [Preloading Deeply Nested Structures via populate](https://mikro-orm.io/docs/nested-populate)
143
+ - [Populating relations](https://mikro-orm.io/docs/populating-relations)
145
144
  - [Property Validation](https://mikro-orm.io/docs/property-validation)
146
145
  - [Lifecycle Hooks](https://mikro-orm.io/docs/events#hooks)
147
146
  - [Vanilla JS Support](https://mikro-orm.io/docs/usage-with-js)
@@ -382,6 +381,8 @@ See also the list of contributors who [participated](https://github.com/mikro-or
382
381
 
383
382
  Please ⭐️ this repository if this project helped you!
384
383
 
384
+ > If you'd like to support my open-source work, consider sponsoring me directly at [github.com/sponsors/b4nan](https://github.com/sponsors/b4nan).
385
+
385
386
  ## 📝 License
386
387
 
387
388
  Copyright © 2018 [Martin Adámek](https://github.com/b4nan).
package/index.d.ts CHANGED
@@ -2,4 +2,4 @@ export * from '@mikro-orm/mysql';
2
2
  export * from './MariaDbSchemaHelper.js';
3
3
  export * from './MariaDbPlatform.js';
4
4
  export * from './MariaDbDriver.js';
5
- export { MariaDbMikroORM as MikroORM, MariaDbOptions as Options, defineMariaDbConfig as defineConfig, } from './MariaDbMikroORM.js';
5
+ export { MariaDbMikroORM as MikroORM, type MariaDbOptions as Options, defineMariaDbConfig as defineConfig, } from './MariaDbMikroORM.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mikro-orm/mariadb",
3
3
  "type": "module",
4
- "version": "7.0.0-dev.9",
4
+ "version": "7.0.0-dev.91",
5
5
  "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.",
6
6
  "exports": {
7
7
  "./package.json": "./package.json",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://mikro-orm.io",
40
40
  "engines": {
41
- "node": ">= 22.11.0"
41
+ "node": ">= 22.17.0"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "yarn clean && yarn compile && yarn copy",
@@ -50,14 +50,14 @@
50
50
  "access": "public"
51
51
  },
52
52
  "dependencies": {
53
- "@mikro-orm/mysql": "7.0.0-dev.9"
53
+ "@mikro-orm/mysql": "7.0.0-dev.91"
54
54
  },
55
55
  "devDependencies": {
56
- "@mikro-orm/core": "^6.4.13",
57
- "kysely": "0.28.0"
56
+ "@mikro-orm/core": "^6.6.2",
57
+ "kysely": "0.28.8"
58
58
  },
59
59
  "peerDependencies": {
60
- "@mikro-orm/core": "7.0.0-dev.9",
60
+ "@mikro-orm/core": "7.0.0-dev.91",
61
61
  "kysely": "*"
62
62
  }
63
63
  }