@mikro-orm/sql 7.1.0-dev.26 → 7.1.0-dev.27

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.
@@ -57,7 +57,9 @@ export class AbstractSqlDriver extends DatabaseDriver {
57
57
  const populate = this.autoJoinOneToOneOwner(meta, options.populate, options.fields);
58
58
  const joinedProps = this.joinedProps(meta, populate, options);
59
59
  const schema = this.getSchemaName(meta, options);
60
- const qb = this.createQueryBuilder(meta.class, options.ctx, connectionType, false, options.logging, undefined, options.em).withSchema(schema);
60
+ const qb = this.createQueryBuilder(meta.class, options.ctx, connectionType, false, options.logging, undefined, options.em)
61
+ .withSchema(schema)
62
+ .cache(false);
61
63
  const fields = this.buildFields(meta, populate, joinedProps, qb, qb.alias, options, schema);
62
64
  const orderBy = this.buildOrderBy(qb, meta, populate, options);
63
65
  const populateWhere = this.buildPopulateWhere(meta, joinedProps, options);
@@ -0,0 +1,23 @@
1
+ import { type AnyEntity, type EntityClass, type EntityManager, type EntityManagerType, type EntitySchema, type IDatabaseDriver, MikroORM, type Options } from '@mikro-orm/core';
2
+ import type { AbstractSqlDriver } from './AbstractSqlDriver.js';
3
+ import type { SqlEntityManager } from './SqlEntityManager.js';
4
+ /** Configuration options shared by all SQL drivers. */
5
+ export type SqlOptions<D extends AbstractSqlDriver = AbstractSqlDriver, EM extends SqlEntityManager<D> = SqlEntityManager<D>, Entities extends readonly (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> = Partial<Options<D, EM, Entities>>;
6
+ /**
7
+ * Creates a type-safe configuration object for any SQL driver. The driver class
8
+ * must be passed via `options.driver` (e.g. `SqliteDriver`, `MySqlDriver`, …).
9
+ */
10
+ export declare function defineSqlConfig<D extends AbstractSqlDriver = AbstractSqlDriver, EM extends SqlEntityManager<D> = SqlEntityManager<D>, Entities extends readonly (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Partial<Options<D, EM, Entities>>): Partial<Options<D, EM, Entities>>;
11
+ /**
12
+ * Generic entry point for SQL drivers. Use this when consuming `@mikro-orm/sql`
13
+ * directly with a Kysely dialect; for the bundled driver packages prefer
14
+ * `@mikro-orm/sqlite`, `@mikro-orm/postgresql`, etc.
15
+ *
16
+ * @inheritDoc
17
+ */
18
+ export declare class SqlMikroORM<D extends AbstractSqlDriver = AbstractSqlDriver, EM extends SqlEntityManager<D> = SqlEntityManager<D>, Entities extends readonly (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> extends MikroORM<D, EM, Entities> {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static init<D extends IDatabaseDriver = AbstractSqlDriver, EM extends EntityManager<D> = D[typeof EntityManagerType] & EntityManager<D>, Entities extends readonly (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Partial<Options<D, EM, Entities>>): Promise<MikroORM<D, EM, Entities>>;
23
+ }
package/SqlMikroORM.js ADDED
@@ -0,0 +1,23 @@
1
+ import { defineConfig, MikroORM, } from '@mikro-orm/core';
2
+ /**
3
+ * Creates a type-safe configuration object for any SQL driver. The driver class
4
+ * must be passed via `options.driver` (e.g. `SqliteDriver`, `MySqlDriver`, …).
5
+ */
6
+ export function defineSqlConfig(options) {
7
+ return defineConfig(options);
8
+ }
9
+ /**
10
+ * Generic entry point for SQL drivers. Use this when consuming `@mikro-orm/sql`
11
+ * directly with a Kysely dialect; for the bundled driver packages prefer
12
+ * `@mikro-orm/sqlite`, `@mikro-orm/postgresql`, etc.
13
+ *
14
+ * @inheritDoc
15
+ */
16
+ export class SqlMikroORM extends MikroORM {
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static async init(options) {
21
+ return super.init(options);
22
+ }
23
+ }
package/index.d.ts CHANGED
@@ -17,3 +17,5 @@ export type * from './typings.js';
17
17
  export * from './plugin/index.js';
18
18
  export { SqlEntityManager as EntityManager } from './SqlEntityManager.js';
19
19
  export { SqlEntityRepository as EntityRepository } from './SqlEntityRepository.js';
20
+ export * from './SqlMikroORM.js';
21
+ export { SqlMikroORM as MikroORM, type SqlOptions as Options, defineSqlConfig as defineConfig } from './SqlMikroORM.js';
package/index.js CHANGED
@@ -16,3 +16,5 @@ export * from './dialects/index.js';
16
16
  export * from './plugin/index.js';
17
17
  export { SqlEntityManager as EntityManager } from './SqlEntityManager.js';
18
18
  export { SqlEntityRepository as EntityRepository } from './SqlEntityRepository.js';
19
+ export * from './SqlMikroORM.js';
20
+ export { SqlMikroORM as MikroORM, defineSqlConfig as defineConfig } from './SqlMikroORM.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/sql",
3
- "version": "7.1.0-dev.26",
3
+ "version": "7.1.0-dev.27",
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",
@@ -53,7 +53,7 @@
53
53
  "@mikro-orm/core": "^7.0.13"
54
54
  },
55
55
  "peerDependencies": {
56
- "@mikro-orm/core": "7.1.0-dev.26"
56
+ "@mikro-orm/core": "7.1.0-dev.27"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">= 22.17.0"