@mikro-orm/core 7.0.12-dev.7 → 7.1.0-dev.1

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/MikroORM.d.ts CHANGED
@@ -5,7 +5,7 @@ import { Configuration, type Options } from './utils/Configuration.js';
5
5
  import type { EntityManager } from './EntityManager.js';
6
6
  import type { AnyEntity, Constructor, EntityClass, EntityMetadata, EntityName, IEntityGenerator, IMigrator, ISeedManager } from './typings.js';
7
7
  /** @internal */
8
- export declare function loadOptionalDependencies(options: Partial<Options>): Promise<void>;
8
+ export declare function loadOptionalDependencies(options: Partial<Options<any, any, any>>): Promise<void>;
9
9
  /**
10
10
  * The main class used to configure and bootstrap the ORM.
11
11
  *
@@ -34,7 +34,7 @@ export declare function loadOptionalDependencies(options: Partial<Options>): Pro
34
34
  * await em.flush();
35
35
  * ```
36
36
  */
37
- export declare class MikroORM<Driver extends IDatabaseDriver = IDatabaseDriver, EM extends Driver[typeof EntityManagerType] & EntityManager<Driver> = Driver[typeof EntityManagerType] & EntityManager<Driver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> {
37
+ export declare class MikroORM<Driver extends IDatabaseDriver = IDatabaseDriver, EM extends Driver[typeof EntityManagerType] & EntityManager<Driver> = Driver[typeof EntityManagerType] & EntityManager<Driver>, Entities extends readonly (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> {
38
38
  #private;
39
39
  /** The global EntityManager instance. If you are using `RequestContext` helper, it will automatically pick the request specific context under the hood */
40
40
  em: EM & {
@@ -48,7 +48,7 @@ export declare class MikroORM<Driver extends IDatabaseDriver = IDatabaseDriver,
48
48
  * Initialize the ORM, load entity metadata, create EntityManager and connect to the database.
49
49
  * If you omit the `options` parameter, your CLI config will be used.
50
50
  */
51
- static init<D extends IDatabaseDriver = IDatabaseDriver, EM extends D[typeof EntityManagerType] & EntityManager<D> = D[typeof EntityManagerType] & EntityManager<D>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Partial<Options<D, EM, Entities>>): Promise<MikroORM<D, EM, Entities>>;
51
+ static init<D extends IDatabaseDriver = IDatabaseDriver, EM extends D[typeof EntityManagerType] & 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>>;
52
52
  /**
53
53
  * Synchronous variant of the `init` method with some limitations:
54
54
  * - folder-based discovery not supported
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/core",
3
- "version": "7.0.12-dev.7",
3
+ "version": "7.1.0-dev.1",
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",
package/typings.d.ts CHANGED
@@ -1053,6 +1053,14 @@ export interface IMigrator {
1053
1053
  * Removes event handler.
1054
1054
  */
1055
1055
  off(event: MigratorEvent, listener: (event: MigrationInfo) => MaybePromise<void>): IMigrator;
1056
+ /**
1057
+ * Marks a migration as executed without actually running it.
1058
+ */
1059
+ logMigration(name: string): Promise<void>;
1060
+ /**
1061
+ * Removes a migration from the executed list without reverting it.
1062
+ */
1063
+ unlogMigration(name: string): Promise<void>;
1056
1064
  /**
1057
1065
  * @internal
1058
1066
  */
@@ -71,6 +71,14 @@ export declare abstract class AbstractMigrator<D extends IDatabaseDriver> implem
71
71
  */
72
72
  down(options?: string | string[] | Omit<MigrateOptions, 'from'>): Promise<MigrationInfo[]>;
73
73
  abstract getStorage(): IMigratorStorage;
74
+ /**
75
+ * @inheritDoc
76
+ */
77
+ logMigration(name: string): Promise<void>;
78
+ /**
79
+ * @inheritDoc
80
+ */
81
+ unlogMigration(name: string): Promise<void>;
74
82
  protected init(): Promise<void>;
75
83
  protected initPaths(): Promise<void>;
76
84
  protected initServices(): void;
@@ -63,6 +63,22 @@ export class AbstractMigrator {
63
63
  async down(options) {
64
64
  return this.runMigrations('down', options);
65
65
  }
66
+ /**
67
+ * @inheritDoc
68
+ */
69
+ async logMigration(name) {
70
+ await this.init();
71
+ await this.storage.ensureTable?.();
72
+ await this.storage.logMigration({ name });
73
+ }
74
+ /**
75
+ * @inheritDoc
76
+ */
77
+ async unlogMigration(name) {
78
+ await this.init();
79
+ await this.storage.ensureTable?.();
80
+ await this.storage.unlogMigration({ name });
81
+ }
66
82
  async init() {
67
83
  if (this.initialized) {
68
84
  return;
@@ -18,7 +18,7 @@ import type { MikroORM } from '../MikroORM.js';
18
18
  /** Holds and validates all ORM configuration options, providing access to drivers, loggers, cache adapters, and other services. */
19
19
  export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager<D> = D[typeof EntityManagerType] & EntityManager<D>> {
20
20
  #private;
21
- constructor(options: Partial<Options>, validate?: boolean);
21
+ constructor(options: Partial<Options<any, any, any>>, validate?: boolean);
22
22
  /** Returns the database platform instance. */
23
23
  getPlatform(): ReturnType<D['getPlatform']>;
24
24
  /**
@@ -99,7 +99,7 @@ export declare class Configuration<D extends IDatabaseDriver = IDatabaseDriver,
99
99
  /**
100
100
  * Type helper to make it easier to use `mikro-orm.config.js`.
101
101
  */
102
- export declare function defineConfig<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager<D> = EntityManager<D>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Partial<Options<D, EM, Entities>>): Partial<Options<D, EM, Entities>>;
102
+ export declare function defineConfig<D extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager<D> = EntityManager<D>, Entities extends readonly (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Partial<Options<D, EM, Entities>>): Partial<Options<D, EM, Entities>>;
103
103
  /**
104
104
  * Connection configuration options for database connections.
105
105
  * @see https://mikro-orm.io/docs/configuration#connection
@@ -352,7 +352,7 @@ export interface MetadataDiscoveryOptions {
352
352
  * MikroORM configuration options.
353
353
  * @see https://mikro-orm.io/docs/configuration
354
354
  */
355
- export interface Options<Driver extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager<Driver> & Driver[typeof EntityManagerType] = EntityManager<Driver> & Driver[typeof EntityManagerType], Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> extends ConnectionOptions {
355
+ export interface Options<Driver extends IDatabaseDriver = IDatabaseDriver, EM extends EntityManager<Driver> & Driver[typeof EntityManagerType] = EntityManager<Driver> & Driver[typeof EntityManagerType], Entities extends readonly (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> extends ConnectionOptions {
356
356
  /** Connection pool configuration. */
357
357
  pool: PoolConfig;
358
358
  /**
package/utils/Utils.js CHANGED
@@ -141,7 +141,7 @@ export function parseJsonSafe(value) {
141
141
  /** Collection of general-purpose utility methods used throughout the ORM. */
142
142
  export class Utils {
143
143
  static PK_SEPARATOR = '~~~';
144
- static #ORM_VERSION = '7.0.12-dev.7';
144
+ static #ORM_VERSION = '7.1.0-dev.1';
145
145
  /**
146
146
  * Checks if the argument is instance of `Object`. Returns false for arrays.
147
147
  */