@yandjin-mikro-orm/migrations-mongodb 6.1.4-rc-sti-changes-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.
@@ -0,0 +1,10 @@
1
+ import { MigrationGenerator } from './MigrationGenerator';
2
+ export declare class JSMigrationGenerator extends MigrationGenerator {
3
+ /**
4
+ * @inheritDoc
5
+ */
6
+ generateMigrationFile(className: string, diff: {
7
+ up: string[];
8
+ down: string[];
9
+ }): string;
10
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JSMigrationGenerator = void 0;
4
+ const MigrationGenerator_1 = require("./MigrationGenerator");
5
+ class JSMigrationGenerator extends MigrationGenerator_1.MigrationGenerator {
6
+ /**
7
+ * @inheritDoc
8
+ */
9
+ generateMigrationFile(className, diff) {
10
+ let ret = `'use strict';\n`;
11
+ ret += `Object.defineProperty(exports, '__esModule', { value: true });\n`;
12
+ ret += `const { Migration } = require('@mikro-orm/migrations-mongodb');\n\n`;
13
+ ret += `class ${className} extends Migration {\n\n`;
14
+ ret += ` async up() {\n`;
15
+ /* istanbul ignore next */
16
+ diff.up.forEach(sql => ret += this.createStatement(sql, 4));
17
+ ret += ` }\n\n`;
18
+ /* istanbul ignore next */
19
+ if (diff.down.length > 0) {
20
+ ret += ` async down() {\n`;
21
+ diff.down.forEach(sql => ret += this.createStatement(sql, 4));
22
+ ret += ` }\n\n`;
23
+ }
24
+ ret += `}\n`;
25
+ ret += `exports.${className} = ${className};\n`;
26
+ return ret;
27
+ }
28
+ }
29
+ exports.JSMigrationGenerator = JSMigrationGenerator;
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Martin Adámek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/Migration.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import type { Configuration, Transaction, EntityName } from "@yandjin-mikro-orm/core";
2
+ import type { MongoDriver } from "@yandjin-mikro-orm/mongodb";
3
+ import type { Collection, ClientSession, Document } from "mongodb";
4
+ export declare abstract class Migration {
5
+ protected readonly driver: MongoDriver;
6
+ protected readonly config: Configuration;
7
+ protected ctx?: Transaction<ClientSession>;
8
+ constructor(driver: MongoDriver, config: Configuration);
9
+ abstract up(): Promise<void>;
10
+ down(): Promise<void>;
11
+ isTransactional(): boolean;
12
+ reset(): void;
13
+ setTransactionContext(ctx: Transaction): void;
14
+ getCollection<T extends Document>(entityName: EntityName<any>): Collection<T>;
15
+ }
package/Migration.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Migration = void 0;
4
+ class Migration {
5
+ driver;
6
+ config;
7
+ ctx;
8
+ constructor(driver, config) {
9
+ this.driver = driver;
10
+ this.config = config;
11
+ }
12
+ async down() {
13
+ throw new Error("This migration cannot be reverted");
14
+ }
15
+ isTransactional() {
16
+ return true;
17
+ }
18
+ reset() {
19
+ this.ctx = undefined;
20
+ }
21
+ setTransactionContext(ctx) {
22
+ this.ctx = ctx;
23
+ }
24
+ getCollection(entityName) {
25
+ return this.driver.getConnection().getCollection(entityName);
26
+ }
27
+ }
28
+ exports.Migration = Migration;
@@ -0,0 +1,26 @@
1
+ import { type IMigrationGenerator, type MigrationsOptions, type NamingStrategy } from "@yandjin-mikro-orm/core";
2
+ import type { MongoDriver } from "@yandjin-mikro-orm/mongodb";
3
+ export declare abstract class MigrationGenerator implements IMigrationGenerator {
4
+ protected readonly driver: MongoDriver;
5
+ protected readonly namingStrategy: NamingStrategy;
6
+ protected readonly options: MigrationsOptions;
7
+ constructor(driver: MongoDriver, namingStrategy: NamingStrategy, options: MigrationsOptions);
8
+ /**
9
+ * @inheritDoc
10
+ */
11
+ generate(diff: {
12
+ up: string[];
13
+ down: string[];
14
+ }, path?: string, name?: string): Promise<[string, string]>;
15
+ /**
16
+ * @inheritDoc
17
+ */
18
+ createStatement(query: string, padLeft: number): string;
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ abstract generateMigrationFile(className: string, diff: {
23
+ up: string[];
24
+ down: string[];
25
+ }): string;
26
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MigrationGenerator = void 0;
4
+ const core_1 = require("@yandjin-mikro-orm/core");
5
+ const fs_extra_1 = require("fs-extra");
6
+ /* istanbul ignore next */
7
+ class MigrationGenerator {
8
+ driver;
9
+ namingStrategy;
10
+ options;
11
+ constructor(driver, namingStrategy, options) {
12
+ this.driver = driver;
13
+ this.namingStrategy = namingStrategy;
14
+ this.options = options;
15
+ }
16
+ /**
17
+ * @inheritDoc
18
+ */
19
+ async generate(diff, path, name) {
20
+ /* istanbul ignore next */
21
+ const defaultPath = this.options.emit === "ts" && this.options.pathTs
22
+ ? this.options.pathTs
23
+ : this.options.path;
24
+ path = core_1.Utils.normalizePath(this.driver.config.get("baseDir"), path ?? defaultPath);
25
+ await (0, fs_extra_1.ensureDir)(path);
26
+ const timestamp = new Date().toISOString().replace(/[-T:]|\.\d{3}z$/gi, "");
27
+ const className = this.namingStrategy.classToMigrationName(timestamp, name);
28
+ const fileName = `${this.options.fileName(timestamp, name)}.${this.options.emit}`;
29
+ const ret = this.generateMigrationFile(className, diff);
30
+ await (0, fs_extra_1.writeFile)(path + "/" + fileName, ret, { flush: true });
31
+ return [ret, fileName];
32
+ }
33
+ /**
34
+ * @inheritDoc
35
+ */
36
+ createStatement(query, padLeft) {
37
+ if (query) {
38
+ const padding = " ".repeat(padLeft);
39
+ return `${padding}console.log('${query}');\n`;
40
+ }
41
+ return "\n";
42
+ }
43
+ }
44
+ exports.MigrationGenerator = MigrationGenerator;
@@ -0,0 +1,13 @@
1
+ import type { MigrationsOptions, Transaction } from "@yandjin-mikro-orm/core";
2
+ import type { MongoDriver } from "@yandjin-mikro-orm/mongodb";
3
+ import type { Migration } from "./Migration";
4
+ export declare class MigrationRunner {
5
+ protected readonly driver: MongoDriver;
6
+ protected readonly options: MigrationsOptions;
7
+ private readonly connection;
8
+ private masterTransaction?;
9
+ constructor(driver: MongoDriver, options: MigrationsOptions);
10
+ run(migration: Migration, method: "up" | "down"): Promise<void>;
11
+ setMasterMigration(trx: Transaction): void;
12
+ unsetMasterMigration(): void;
13
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MigrationRunner = void 0;
4
+ class MigrationRunner {
5
+ driver;
6
+ options;
7
+ connection;
8
+ masterTransaction;
9
+ constructor(driver, options) {
10
+ this.driver = driver;
11
+ this.options = options;
12
+ this.connection = this.driver.getConnection();
13
+ }
14
+ async run(migration, method) {
15
+ migration.reset();
16
+ if (!this.options.transactional || !migration.isTransactional()) {
17
+ await migration[method]();
18
+ }
19
+ else if (this.masterTransaction) {
20
+ migration.setTransactionContext(this.masterTransaction);
21
+ await migration[method]();
22
+ }
23
+ else {
24
+ await this.connection.transactional(async (tx) => {
25
+ migration.setTransactionContext(tx);
26
+ await migration[method]();
27
+ }, { ctx: this.masterTransaction });
28
+ }
29
+ }
30
+ setMasterMigration(trx) {
31
+ this.masterTransaction = trx;
32
+ }
33
+ unsetMasterMigration() {
34
+ delete this.masterTransaction;
35
+ }
36
+ }
37
+ exports.MigrationRunner = MigrationRunner;
@@ -0,0 +1,20 @@
1
+ import type { MigrationsOptions, Transaction } from "@yandjin-mikro-orm/core";
2
+ import type { MongoDriver } from "@yandjin-mikro-orm/mongodb";
3
+ import type { MigrationParams, UmzugStorage } from "umzug";
4
+ import type { MigrationRow } from "./typings";
5
+ export declare class MigrationStorage implements UmzugStorage {
6
+ protected readonly driver: MongoDriver;
7
+ protected readonly options: MigrationsOptions;
8
+ private masterTransaction?;
9
+ constructor(driver: MongoDriver, options: MigrationsOptions);
10
+ executed(): Promise<string[]>;
11
+ logMigration(params: MigrationParams<any>): Promise<void>;
12
+ unlogMigration(params: MigrationParams<any>): Promise<void>;
13
+ getExecutedMigrations(): Promise<MigrationRow[]>;
14
+ setMasterMigration(trx: Transaction): void;
15
+ unsetMasterMigration(): void;
16
+ /**
17
+ * @internal
18
+ */
19
+ getMigrationName(name: string): string;
20
+ }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.MigrationStorage = void 0;
27
+ const path = __importStar(require("path"));
28
+ class MigrationStorage {
29
+ driver;
30
+ options;
31
+ masterTransaction;
32
+ constructor(driver, options) {
33
+ this.driver = driver;
34
+ this.options = options;
35
+ }
36
+ async executed() {
37
+ const migrations = await this.getExecutedMigrations();
38
+ return migrations.map(({ name }) => `${this.getMigrationName(name)}`);
39
+ }
40
+ async logMigration(params) {
41
+ const tableName = this.options.tableName;
42
+ const name = this.getMigrationName(params.name);
43
+ await this.driver.nativeInsert(tableName, { name, executed_at: new Date() }, { ctx: this.masterTransaction });
44
+ }
45
+ async unlogMigration(params) {
46
+ const tableName = this.options.tableName;
47
+ const withoutExt = this.getMigrationName(params.name);
48
+ await this.driver.nativeDelete(tableName, { name: { $in: [params.name, withoutExt] } }, { ctx: this.masterTransaction });
49
+ }
50
+ async getExecutedMigrations() {
51
+ const tableName = this.options.tableName;
52
+ return this.driver.find(tableName, {}, { ctx: this.masterTransaction, orderBy: { _id: "asc" } });
53
+ }
54
+ setMasterMigration(trx) {
55
+ this.masterTransaction = trx;
56
+ }
57
+ unsetMasterMigration() {
58
+ delete this.masterTransaction;
59
+ }
60
+ /**
61
+ * @internal
62
+ */
63
+ getMigrationName(name) {
64
+ const parsedName = path.parse(name);
65
+ if ([".js", ".ts"].includes(parsedName.ext)) {
66
+ // strip extension
67
+ return parsedName.name;
68
+ }
69
+ return name;
70
+ }
71
+ }
72
+ exports.MigrationStorage = MigrationStorage;
package/Migrator.d.ts ADDED
@@ -0,0 +1,56 @@
1
+ import { type MigrationParams, type RunnableMigration } from "umzug";
2
+ import { type Constructor, type IMigrator, type MikroORM } from "@yandjin-mikro-orm/core";
3
+ import type { EntityManager } from "@yandjin-mikro-orm/mongodb";
4
+ import type { Migration } from "./Migration";
5
+ import { MigrationStorage } from "./MigrationStorage";
6
+ import type { MigrateOptions, MigrationResult, MigrationRow, UmzugMigration } from "./typings";
7
+ export declare class Migrator implements IMigrator {
8
+ private readonly em;
9
+ private umzug;
10
+ private runner;
11
+ private storage;
12
+ private generator;
13
+ private readonly driver;
14
+ private readonly config;
15
+ private readonly options;
16
+ private readonly absolutePath;
17
+ constructor(em: EntityManager);
18
+ static register(orm: MikroORM): void;
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ createMigration(path?: string, blank?: boolean, initial?: boolean, name?: string): Promise<MigrationResult>;
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ checkMigrationNeeded(): Promise<boolean>;
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ createInitialMigration(path?: string): Promise<MigrationResult>;
31
+ private createUmzug;
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ getExecutedMigrations(): Promise<MigrationRow[]>;
36
+ /**
37
+ * @inheritDoc
38
+ */
39
+ getPendingMigrations(): Promise<UmzugMigration[]>;
40
+ /**
41
+ * @inheritDoc
42
+ */
43
+ up(options?: string | string[] | MigrateOptions): Promise<UmzugMigration[]>;
44
+ /**
45
+ * @inheritDoc
46
+ */
47
+ down(options?: string | string[] | MigrateOptions): Promise<UmzugMigration[]>;
48
+ getStorage(): MigrationStorage;
49
+ protected resolve(params: MigrationParams<any>): RunnableMigration<any>;
50
+ protected initialize(MigrationClass: Constructor<Migration>, name: string): RunnableMigration<any>;
51
+ private getMigrationFilename;
52
+ private prefix;
53
+ private runMigrations;
54
+ private runInTransaction;
55
+ private ensureMigrationsDirExists;
56
+ }
package/Migrator.js ADDED
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Migrator = void 0;
4
+ const umzug_1 = require("umzug");
5
+ const path_1 = require("path");
6
+ const fs_extra_1 = require("fs-extra");
7
+ const core_1 = require("@yandjin-mikro-orm/core");
8
+ const MigrationRunner_1 = require("./MigrationRunner");
9
+ const MigrationStorage_1 = require("./MigrationStorage");
10
+ const TSMigrationGenerator_1 = require("./TSMigrationGenerator");
11
+ const JSMigrationGenerator_1 = require("./JSMigrationGenerator");
12
+ class Migrator {
13
+ em;
14
+ umzug;
15
+ runner;
16
+ storage;
17
+ generator;
18
+ driver;
19
+ config;
20
+ options;
21
+ absolutePath;
22
+ constructor(em) {
23
+ this.em = em;
24
+ this.driver = this.em.getDriver();
25
+ this.config = this.em.config;
26
+ this.options = this.config.get("migrations");
27
+ /* istanbul ignore next */
28
+ const key = this.config.get("tsNode", core_1.Utils.detectTsNode()) && this.options.pathTs
29
+ ? "pathTs"
30
+ : "path";
31
+ this.absolutePath = core_1.Utils.absolutePath(this.options[key], this.config.get("baseDir"));
32
+ this.createUmzug();
33
+ }
34
+ static register(orm) {
35
+ orm.config.registerExtension("@mikro-orm/migrator", () => new Migrator(orm.em));
36
+ }
37
+ /**
38
+ * @inheritDoc
39
+ */
40
+ async createMigration(path, blank = false, initial = false, name) {
41
+ await this.ensureMigrationsDirExists();
42
+ const diff = { up: [], down: [] };
43
+ const migration = await this.generator.generate(diff, path, name);
44
+ return {
45
+ fileName: migration[1],
46
+ code: migration[0],
47
+ diff,
48
+ };
49
+ }
50
+ /**
51
+ * @inheritDoc
52
+ */
53
+ async checkMigrationNeeded() {
54
+ return true;
55
+ }
56
+ /**
57
+ * @inheritDoc
58
+ */
59
+ async createInitialMigration(path) {
60
+ return this.createMigration(path);
61
+ }
62
+ createUmzug() {
63
+ this.runner = new MigrationRunner_1.MigrationRunner(this.driver, this.options);
64
+ this.storage = new MigrationStorage_1.MigrationStorage(this.driver, this.options);
65
+ let migrations = {
66
+ glob: (0, path_1.join)(this.absolutePath, this.options.glob).replace(/\\/g, "/"),
67
+ resolve: (params) => this.resolve(params),
68
+ };
69
+ /* istanbul ignore next */
70
+ if (this.options.migrationsList) {
71
+ migrations = this.options.migrationsList.map((migration) => this.initialize(migration.class, migration.name));
72
+ }
73
+ this.umzug = new umzug_1.Umzug({
74
+ storage: this.storage,
75
+ logger: undefined,
76
+ migrations,
77
+ });
78
+ if (!this.options.silent) {
79
+ const logger = this.config.get("logger");
80
+ this.umzug.on("migrating", (event) => logger(`Processing '${event.name}'`));
81
+ this.umzug.on("migrated", (event) => logger(`Applied '${event.name}'`));
82
+ this.umzug.on("reverting", (event) => logger(`Processing '${event.name}'`));
83
+ this.umzug.on("reverted", (event) => logger(`Reverted '${event.name}'`));
84
+ }
85
+ /* istanbul ignore next */
86
+ if (this.options.generator) {
87
+ this.generator = new this.options.generator(this.driver, this.config.getNamingStrategy(), this.options);
88
+ }
89
+ else if (this.options.emit === "js" || this.options.emit === "cjs") {
90
+ this.generator = new JSMigrationGenerator_1.JSMigrationGenerator(this.driver, this.config.getNamingStrategy(), this.options);
91
+ }
92
+ else {
93
+ this.generator = new TSMigrationGenerator_1.TSMigrationGenerator(this.driver, this.config.getNamingStrategy(), this.options);
94
+ }
95
+ }
96
+ /**
97
+ * @inheritDoc
98
+ */
99
+ async getExecutedMigrations() {
100
+ await this.ensureMigrationsDirExists();
101
+ return this.storage.getExecutedMigrations();
102
+ }
103
+ /**
104
+ * @inheritDoc
105
+ */
106
+ async getPendingMigrations() {
107
+ await this.ensureMigrationsDirExists();
108
+ return this.umzug.pending();
109
+ }
110
+ /**
111
+ * @inheritDoc
112
+ */
113
+ async up(options) {
114
+ return this.runMigrations("up", options);
115
+ }
116
+ /**
117
+ * @inheritDoc
118
+ */
119
+ async down(options) {
120
+ return this.runMigrations("down", options);
121
+ }
122
+ getStorage() {
123
+ return this.storage;
124
+ }
125
+ resolve(params) {
126
+ const createMigrationHandler = async (method) => {
127
+ const migration = await core_1.Utils.dynamicImport(params.path);
128
+ const MigrationClass = Object.values(migration)[0];
129
+ const instance = new MigrationClass(this.driver, this.config);
130
+ await this.runner.run(instance, method);
131
+ };
132
+ return {
133
+ name: this.storage.getMigrationName(params.name),
134
+ up: () => createMigrationHandler("up"),
135
+ down: () => createMigrationHandler("down"),
136
+ };
137
+ }
138
+ /* istanbul ignore next */
139
+ initialize(MigrationClass, name) {
140
+ const instance = new MigrationClass(this.driver, this.config);
141
+ return {
142
+ name: this.storage.getMigrationName(name),
143
+ up: () => this.runner.run(instance, "up"),
144
+ down: () => this.runner.run(instance, "down"),
145
+ };
146
+ }
147
+ getMigrationFilename(name) {
148
+ name = name.replace(/\.[jt]s$/, "");
149
+ return name.match(/^\d{14}$/) ? this.options.fileName(name) : name;
150
+ }
151
+ prefix(options) {
152
+ if (core_1.Utils.isString(options) || Array.isArray(options)) {
153
+ return {
154
+ migrations: core_1.Utils.asArray(options).map((name) => this.getMigrationFilename(name)),
155
+ };
156
+ }
157
+ if (!options) {
158
+ return {};
159
+ }
160
+ if (options.migrations) {
161
+ options.migrations = options.migrations.map((name) => this.getMigrationFilename(name));
162
+ }
163
+ if (options.transaction) {
164
+ delete options.transaction;
165
+ }
166
+ ["from", "to"]
167
+ .filter((k) => options[k])
168
+ .forEach((k) => (options[k] = this.getMigrationFilename(options[k])));
169
+ return options;
170
+ }
171
+ async runMigrations(method, options) {
172
+ await this.ensureMigrationsDirExists();
173
+ if (!this.options.transactional || !this.options.allOrNothing) {
174
+ return this.umzug[method](this.prefix(options));
175
+ }
176
+ if (core_1.Utils.isObject(options) && options.transaction) {
177
+ return this.runInTransaction(options.transaction, method, options);
178
+ }
179
+ return this.driver
180
+ .getConnection()
181
+ .transactional((trx) => this.runInTransaction(trx, method, options));
182
+ }
183
+ async runInTransaction(trx, method, options) {
184
+ this.runner.setMasterMigration(trx);
185
+ this.storage.setMasterMigration(trx);
186
+ const ret = await this.umzug[method](this.prefix(options));
187
+ this.runner.unsetMasterMigration();
188
+ this.storage.unsetMasterMigration();
189
+ return ret;
190
+ }
191
+ async ensureMigrationsDirExists() {
192
+ if (!this.options.migrationsList) {
193
+ await (0, fs_extra_1.ensureDir)(this.absolutePath);
194
+ }
195
+ }
196
+ }
197
+ exports.Migrator = Migrator;
package/README.md ADDED
@@ -0,0 +1,383 @@
1
+ <h1 align="center">
2
+ <a href="https://mikro-orm.io"><img src="https://raw.githubusercontent.com/mikro-orm/mikro-orm/master/docs/static/img/logo-readme.svg?sanitize=true" alt="MikroORM" /></a>
3
+ </h1>
4
+
5
+ TypeScript ORM for Node.js based on Data Mapper, [Unit of Work](https://mikro-orm.io/docs/unit-of-work/) and [Identity Map](https://mikro-orm.io/docs/identity-map/) patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite databases.
6
+
7
+ > Heavily inspired by [Doctrine](https://www.doctrine-project.org/) and [Hibernate](https://hibernate.org/).
8
+
9
+ [![NPM version](https://img.shields.io/npm/v/@mikro-orm/core.svg)](https://www.npmjs.com/package/@mikro-orm/core)
10
+ [![NPM dev version](https://img.shields.io/npm/v/@mikro-orm/core/next.svg)](https://www.npmjs.com/package/@mikro-orm/core)
11
+ [![Chat on slack](https://img.shields.io/badge/chat-on%20slack-blue.svg)](https://join.slack.com/t/mikroorm/shared_invite/enQtNTM1ODYzMzM4MDk3LWM4ZDExMjU5ZDhmNjA2MmM3MWMwZmExNjhhNDdiYTMwNWM0MGY5ZTE3ZjkyZTMzOWExNDgyYmMzNDE1NDI5NjA)
12
+ [![Downloads](https://img.shields.io/npm/dm/@mikro-orm/core.svg)](https://www.npmjs.com/package/@mikro-orm/core)
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
+ [![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
+
17
+ ## 🤔 Unit of What?
18
+
19
+ You might be asking: _What the hell is Unit of Work and why should I care about it?_
20
+
21
+ > Unit of Work maintains a list of objects (_entities_) affected by a business transaction
22
+ > and coordinates the writing out of changes. [(Martin Fowler)](https://www.martinfowler.com/eaaCatalog/unitOfWork.html)
23
+
24
+ > Identity Map ensures that each object (_entity_) gets loaded only once by keeping every
25
+ > loaded object in a map. Looks up objects using the map when referring to them.
26
+ > [(Martin Fowler)](https://www.martinfowler.com/eaaCatalog/identityMap.html)
27
+
28
+ So what benefits does it bring to us?
29
+
30
+ ### Implicit Transactions
31
+
32
+ First and most important implication of having Unit of Work is that it allows handling transactions automatically.
33
+
34
+ When you call `em.flush()`, all computed changes are queried inside a database transaction (if supported by given driver). This means that you can control the boundaries of transactions simply by calling `em.persistLater()` and once all your changes are ready, calling `flush()` will run them inside a transaction.
35
+
36
+ > You can also control the transaction boundaries manually via `em.transactional(cb)`.
37
+
38
+ ```typescript
39
+ const user = await em.findOneOrFail(User, 1);
40
+ user.email = 'foo@bar.com';
41
+ const car = new Car();
42
+ user.cars.add(car);
43
+
44
+ // thanks to bi-directional cascading we only need to persist user entity
45
+ // flushing will create a transaction, insert new car and update user with new email
46
+ // as user entity is managed, calling flush() is enough
47
+ await em.flush();
48
+ ```
49
+
50
+ ### ChangeSet based persistence
51
+
52
+ MikroORM allows you to implement your domain/business logic directly in the entities. To maintain always valid entities, you can use constructors to mark required properties. Let's define the `User` entity used in previous example:
53
+
54
+ ```typescript
55
+ @Entity()
56
+ export class User {
57
+
58
+ @PrimaryKey()
59
+ id!: number;
60
+
61
+ @Property()
62
+ name!: string;
63
+
64
+ @OneToOne(() => Address)
65
+ address?: Address;
66
+
67
+ @ManyToMany(() => Car)
68
+ cars = new Collection<Car>(this);
69
+
70
+ constructor(name: string) {
71
+ this.name = name;
72
+ }
73
+
74
+ }
75
+ ```
76
+
77
+ Now to create new instance of the `User` entity, we are forced to provide the `name`:
78
+
79
+ ```typescript
80
+ const user = new User('John Doe'); // name is required to create new user instance
81
+ user.address = new Address('10 Downing Street'); // address is optional
82
+ ```
83
+
84
+ Once your entities are loaded, make a number of synchronous actions on your entities,
85
+ then call `em.flush()`. This will trigger computing of change sets. Only entities
86
+ (and properties) that were changed will generate database queries, if there are no changes,
87
+ no transaction will be started.
88
+
89
+ ```typescript
90
+ const user = await em.findOneOrFail(User, 1, {
91
+ populate: ['cars', 'address.city'],
92
+ });
93
+ user.title = 'Mr.';
94
+ user.address.street = '10 Downing Street'; // address is 1:1 relation of Address entity
95
+ user.cars.getItems().forEach(car => car.forSale = true); // cars is 1:m collection of Car entities
96
+ const car = new Car('VW');
97
+ user.cars.add(car);
98
+
99
+ // now we can flush all changes done to managed entities
100
+ await em.flush();
101
+ ```
102
+
103
+ `em.flush()` will then execute these queries from the example above:
104
+
105
+ ```sql
106
+ begin;
107
+ update "user" set "title" = 'Mr.' where "id" = 1;
108
+ update "user_address" set "street" = '10 Downing Street' where "id" = 123;
109
+ update "car"
110
+ set "for_sale" = case
111
+ when ("id" = 1) then true
112
+ when ("id" = 2) then true
113
+ when ("id" = 3) then true
114
+ else "for_sale" end
115
+ where "id" in (1, 2, 3)
116
+ insert into "car" ("brand", "owner") values ('VW', 1);
117
+ commit;
118
+ ```
119
+
120
+ ### Identity Map
121
+
122
+ Thanks to Identity Map, you will always have only one instance of given entity in one context. This allows for some optimizations (skipping loading of already loaded entities), as well as comparison by identity (`ent1 === ent2`).
123
+
124
+ ## 📖 Documentation
125
+
126
+ MikroORM documentation, included in this repo in the root directory, is built with [Docusaurus](https://docusaurus.io) and publicly hosted on GitHub Pages at https://mikro-orm.io.
127
+
128
+ There is also auto-generated [CHANGELOG.md](CHANGELOG.md) file based on commit messages (via `semantic-release`).
129
+
130
+ ## ✨ Core Features
131
+
132
+ - [Clean and Simple Entity Definition](https://mikro-orm.io/docs/defining-entities)
133
+ - [Identity Map](https://mikro-orm.io/docs/identity-map)
134
+ - [Entity References](https://mikro-orm.io/docs/entity-references)
135
+ - [Using Entity Constructors](https://mikro-orm.io/docs/entity-constructors)
136
+ - [Modelling Relationships](https://mikro-orm.io/docs/relationships)
137
+ - [Collections](https://mikro-orm.io/docs/collections)
138
+ - [Unit of Work](https://mikro-orm.io/docs/unit-of-work)
139
+ - [Transactions](https://mikro-orm.io/docs/transactions)
140
+ - [Cascading persist and remove](https://mikro-orm.io/docs/cascading)
141
+ - [Composite and Foreign Keys as Primary Key](https://mikro-orm.io/docs/composite-keys)
142
+ - [Filters](https://mikro-orm.io/docs/filters)
143
+ - [Using `QueryBuilder`](https://mikro-orm.io/docs/query-builder)
144
+ - [Preloading Deeply Nested Structures via populate](https://mikro-orm.io/docs/nested-populate)
145
+ - [Property Validation](https://mikro-orm.io/docs/property-validation)
146
+ - [Lifecycle Hooks](https://mikro-orm.io/docs/lifecycle-hooks)
147
+ - [Vanilla JS Support](https://mikro-orm.io/docs/usage-with-js)
148
+ - [Schema Generator](https://mikro-orm.io/docs/schema-generator)
149
+ - [Entity Generator](https://mikro-orm.io/docs/entity-generator)
150
+
151
+ ## 📦 Example Integrations
152
+
153
+ You can find example integrations for some popular frameworks in the [`mikro-orm-examples` repository](https://github.com/mikro-orm/mikro-orm-examples):
154
+
155
+ ### TypeScript Examples
156
+
157
+ - [Express + MongoDB](https://github.com/mikro-orm/express-ts-example-app)
158
+ - [Nest + MySQL](https://github.com/mikro-orm/nestjs-example-app)
159
+ - [RealWorld example app (Nest + MySQL)](https://github.com/mikro-orm/nestjs-realworld-example-app)
160
+ - [Koa + SQLite](https://github.com/mikro-orm/koa-ts-example-app)
161
+ - [GraphQL + PostgreSQL](https://github.com/driescroons/mikro-orm-graphql-example)
162
+ - [Inversify + PostgreSQL](https://github.com/PodaruDragos/inversify-example-app)
163
+ - [NextJS + MySQL](https://github.com/jonahallibone/mikro-orm-nextjs)
164
+ - [Accounts.js REST and GraphQL authentication + SQLite](https://github.com/darkbasic/mikro-orm-accounts-example)
165
+ - [Nest + Shopify + PostgreSQL + GraphQL](https://github.com/Cloudshelf/Shopify_CSConnector)
166
+
167
+ ### JavaScript Examples
168
+
169
+ - [Express + SQLite](https://github.com/mikro-orm/express-js-example-app)
170
+
171
+ ## 🚀 Quick Start
172
+
173
+ First install the module via `yarn` or `npm` and do not forget to install the database driver as well:
174
+
175
+ > Since v4, you should install the driver package, but not the db connector itself, e.g. install `@mikro-orm/sqlite`, but not `sqlite3` as that is already included in the driver package.
176
+
177
+ ```sh
178
+ yarn add @mikro-orm/core @mikro-orm/mongodb # for mongo
179
+ yarn add @mikro-orm/core @mikro-orm/mysql # for mysql/mariadb
180
+ yarn add @mikro-orm/core @mikro-orm/mariadb # for mysql/mariadb
181
+ yarn add @mikro-orm/core @mikro-orm/postgresql # for postgresql
182
+ yarn add @mikro-orm/core @mikro-orm/sqlite # for sqlite
183
+ ```
184
+
185
+ or
186
+
187
+ ```sh
188
+ npm i -s @mikro-orm/core @mikro-orm/mongodb # for mongo
189
+ npm i -s @mikro-orm/core @mikro-orm/mysql # for mysql/mariadb
190
+ npm i -s @mikro-orm/core @mikro-orm/mariadb # for mysql/mariadb
191
+ npm i -s @mikro-orm/core @mikro-orm/postgresql # for postgresql
192
+ npm i -s @mikro-orm/core @mikro-orm/sqlite # for sqlite
193
+ ```
194
+
195
+ Next, if you want to use decorators for your entity definition, you will need to enable support for [decorators](https://www.typescriptlang.org/docs/handbook/decorators.html) as well as `esModuleInterop` in `tsconfig.json` via:
196
+
197
+ ```json
198
+ "experimentalDecorators": true,
199
+ "emitDecoratorMetadata": true,
200
+ "esModuleInterop": true,
201
+ ```
202
+
203
+ Alternatively, you can use [`EntitySchema`](https://mikro-orm.io/docs/entity-schema).
204
+
205
+ Then call `MikroORM.init` as part of bootstrapping your app:
206
+
207
+ > To access driver specific methods like `em.createQueryBuilder()` we need to specify the driver type when calling `MikroORM.init()`. Alternatively we can cast the `orm.em` to `EntityManager` exported from the driver package:
208
+ >
209
+ > ```ts
210
+ > import { EntityManager } from '@mikro-orm/postgresql';
211
+ > const em = orm.em as EntityManager;
212
+ > const qb = em.createQueryBuilder(...);
213
+ > ```
214
+
215
+ ```typescript
216
+ import type { PostgreSqlDriver } from '@mikro-orm/postgresql'; // or any other SQL driver package
217
+
218
+ const orm = await MikroORM.init<PostgreSqlDriver>({
219
+ entities: ['./dist/entities'], // path to your JS entities (dist), relative to `baseDir`
220
+ dbName: 'my-db-name',
221
+ type: 'postgresql',
222
+ });
223
+ console.log(orm.em); // access EntityManager via `em` property
224
+ ```
225
+
226
+ There are more ways to configure your entities, take a look at [installation page](https://mikro-orm.io/docs/installation/).
227
+
228
+ > Read more about all the possible configuration options in [Advanced Configuration](https://mikro-orm.io/docs/configuration) section.
229
+
230
+ Then you will need to fork entity manager for each request so their [identity maps](https://mikro-orm.io/docs/identity-map/) will not collide. To do so, use the `RequestContext` helper:
231
+
232
+ ```typescript
233
+ const app = express();
234
+
235
+ app.use((req, res, next) => {
236
+ RequestContext.create(orm.em, next);
237
+ });
238
+ ```
239
+
240
+ > You should register this middleware as the last one just before request handlers and before any of your custom middleware that is using the ORM. There might be issues when you register it before request processing middleware like `queryParser` or `bodyParser`, so definitely register the context after them.
241
+
242
+ More info about `RequestContext` is described [here](https://mikro-orm.io/docs/identity-map/#request-context).
243
+
244
+ Now you can start defining your entities (in one of the `entities` folders). This is how simple entity can look like in mongo driver:
245
+
246
+ **`./entities/MongoBook.ts`**
247
+
248
+ ```typescript
249
+ @Entity()
250
+ export class MongoBook {
251
+
252
+ @PrimaryKey()
253
+ _id: ObjectID;
254
+
255
+ @SerializedPrimaryKey()
256
+ id: string;
257
+
258
+ @Property()
259
+ title: string;
260
+
261
+ @ManyToOne(() => Author)
262
+ author: Author;
263
+
264
+ @ManyToMany(() => BookTag)
265
+ tags = new Collection<BookTag>(this);
266
+
267
+ constructor(title: string, author: Author) {
268
+ this.title = title;
269
+ this.author = author;
270
+ }
271
+
272
+ }
273
+ ```
274
+
275
+ For SQL drivers, you can use `id: number` PK:
276
+
277
+ **`./entities/SqlBook.ts`**
278
+
279
+ ```typescript
280
+ @Entity()
281
+ export class SqlBook {
282
+
283
+ @PrimaryKey()
284
+ id: number;
285
+
286
+ }
287
+ ```
288
+
289
+ Or if you want to use UUID primary keys:
290
+
291
+ **`./entities/UuidBook.ts`**
292
+
293
+ ```typescript
294
+ import { v4 } from 'uuid';
295
+
296
+ @Entity()
297
+ export class UuidBook {
298
+
299
+ @PrimaryKey()
300
+ uuid = v4();
301
+
302
+ }
303
+ ```
304
+
305
+ More information can be found in [defining entities section](https://mikro-orm.io/docs/defining-entities/) in docs.
306
+
307
+ When you have your entities defined, you can start using ORM either via `EntityManager` or via `EntityRepository`s.
308
+
309
+ To save entity state to database, you need to persist it. Persist takes care or deciding whether to use `insert` or `update` and computes appropriate change-set. Entity references that are not persisted yet (does not have identifier) will be cascade persisted automatically.
310
+
311
+ ```typescript
312
+ // use constructors in your entities for required parameters
313
+ const author = new Author('Jon Snow', 'snow@wall.st');
314
+ author.born = new Date();
315
+
316
+ const publisher = new Publisher('7K publisher');
317
+
318
+ const book1 = new Book('My Life on The Wall, part 1', author);
319
+ book1.publisher = publisher;
320
+ const book2 = new Book('My Life on The Wall, part 2', author);
321
+ book2.publisher = publisher;
322
+ const book3 = new Book('My Life on The Wall, part 3', author);
323
+ book3.publisher = publisher;
324
+
325
+ // just persist books, author and publisher will be automatically cascade persisted
326
+ await em.persistAndFlush([book1, book2, book3]);
327
+ ```
328
+
329
+ To fetch entities from database you can use `find()` and `findOne()` of `EntityManager`:
330
+
331
+ ```typescript
332
+ const authors = em.find(Author, {}, { populate: ['books'] });
333
+
334
+ for (const author of authors) {
335
+ console.log(author); // instance of Author entity
336
+ console.log(author.name); // Jon Snow
337
+
338
+ for (const book of author.books) { // iterating books collection
339
+ console.log(book); // instance of Book entity
340
+ console.log(book.title); // My Life on The Wall, part 1/2/3
341
+ }
342
+ }
343
+ ```
344
+
345
+ More convenient way of fetching entities from database is by using `EntityRepository`, that carries the entity name, so you do not have to pass it to every `find` and `findOne` calls:
346
+
347
+ ```typescript
348
+ const booksRepository = em.getRepository(Book);
349
+
350
+ const books = await booksRepository.find({ author: '...' }, {
351
+ populate: ['author'],
352
+ limit: 1,
353
+ offset: 2,
354
+ orderBy: { title: QueryOrder.DESC },
355
+ });
356
+
357
+ console.log(books); // Loaded<Book, 'author'>[]
358
+ ```
359
+
360
+ Take a look at docs about [working with `EntityManager`](https://mikro-orm.io/docs/entity-manager/) or [using `EntityRepository` instead](https://mikro-orm.io/docs/repositories/).
361
+
362
+ ## 🤝 Contributing
363
+
364
+ Contributions, issues and feature requests are welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on the process for submitting pull requests to us.
365
+
366
+ ## Authors
367
+
368
+ 👤 **Martin Adámek**
369
+
370
+ - Twitter: [@B4nan](https://twitter.com/B4nan)
371
+ - Github: [@b4nan](https://github.com/b4nan)
372
+
373
+ See also the list of contributors who [participated](https://github.com/mikro-orm/mikro-orm/contributors) in this project.
374
+
375
+ ## Show Your Support
376
+
377
+ Please ⭐️ this repository if this project helped you!
378
+
379
+ ## 📝 License
380
+
381
+ Copyright © 2018 [Martin Adámek](https://github.com/b4nan).
382
+
383
+ This project is licensed under the MIT License - see the [LICENSE file](LICENSE) for details.
@@ -0,0 +1,10 @@
1
+ import { MigrationGenerator } from "./MigrationGenerator";
2
+ export declare class TSMigrationGenerator extends MigrationGenerator {
3
+ /**
4
+ * @inheritDoc
5
+ */
6
+ generateMigrationFile(className: string, diff: {
7
+ up: string[];
8
+ down: string[];
9
+ }): string;
10
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TSMigrationGenerator = void 0;
4
+ const MigrationGenerator_1 = require("./MigrationGenerator");
5
+ class TSMigrationGenerator extends MigrationGenerator_1.MigrationGenerator {
6
+ /**
7
+ * @inheritDoc
8
+ */
9
+ generateMigrationFile(className, diff) {
10
+ let ret = `import { Migration } from '@yandjin-mikro-orm/migrations-mongodb';\n\n`;
11
+ ret += `export class ${className} extends Migration {\n\n`;
12
+ ret += ` async up(): Promise<void> {\n`;
13
+ /* istanbul ignore next */
14
+ diff.up.forEach((sql) => (ret += this.createStatement(sql, 4)));
15
+ ret += ` }\n\n`;
16
+ /* istanbul ignore next */
17
+ if (diff.down.length > 0) {
18
+ ret += ` async down(): Promise<void> {\n`;
19
+ diff.down.forEach((sql) => (ret += this.createStatement(sql, 4)));
20
+ ret += ` }\n\n`;
21
+ }
22
+ ret += `}\n`;
23
+ return ret;
24
+ }
25
+ }
26
+ exports.TSMigrationGenerator = TSMigrationGenerator;
package/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * @module migrations-mongodb
4
+ */
5
+ export * from './Migrator';
6
+ export * from './Migration';
7
+ export * from './MigrationRunner';
8
+ export * from './MigrationGenerator';
9
+ export * from './JSMigrationGenerator';
10
+ export * from './TSMigrationGenerator';
11
+ export * from './MigrationStorage';
12
+ export * from './typings';
package/index.js ADDED
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /**
18
+ * @packageDocumentation
19
+ * @module migrations-mongodb
20
+ */
21
+ __exportStar(require("./Migrator"), exports);
22
+ __exportStar(require("./Migration"), exports);
23
+ __exportStar(require("./MigrationRunner"), exports);
24
+ __exportStar(require("./MigrationGenerator"), exports);
25
+ __exportStar(require("./JSMigrationGenerator"), exports);
26
+ __exportStar(require("./TSMigrationGenerator"), exports);
27
+ __exportStar(require("./MigrationStorage"), exports);
28
+ __exportStar(require("./typings"), exports);
package/index.mjs ADDED
@@ -0,0 +1,10 @@
1
+ import mod from "./index.js";
2
+
3
+ export default mod;
4
+ export const JSMigrationGenerator = mod.JSMigrationGenerator;
5
+ export const Migration = mod.Migration;
6
+ export const MigrationGenerator = mod.MigrationGenerator;
7
+ export const MigrationRunner = mod.MigrationRunner;
8
+ export const MigrationStorage = mod.MigrationStorage;
9
+ export const Migrator = mod.Migrator;
10
+ export const TSMigrationGenerator = mod.TSMigrationGenerator;
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@yandjin-mikro-orm/migrations-mongodb",
3
+ "version": "6.1.4-rc-sti-changes-1",
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
+ "main": "index.js",
6
+ "module": "index.mjs",
7
+ "typings": "index.d.ts",
8
+ "exports": {
9
+ "./package.json": "./package.json",
10
+ ".": {
11
+ "import": {
12
+ "types": "./index.d.ts",
13
+ "default": "./index.mjs"
14
+ },
15
+ "require": "./index.js"
16
+ }
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+ssh://git@github.com/mikro-orm/mikro-orm.git"
21
+ },
22
+ "keywords": [
23
+ "orm",
24
+ "mongo",
25
+ "mongodb",
26
+ "mysql",
27
+ "mariadb",
28
+ "postgresql",
29
+ "sqlite",
30
+ "sqlite3",
31
+ "ts",
32
+ "typescript",
33
+ "js",
34
+ "javascript",
35
+ "entity",
36
+ "ddd",
37
+ "mikro-orm",
38
+ "unit-of-work",
39
+ "data-mapper",
40
+ "identity-map"
41
+ ],
42
+ "author": "Martin Adámek",
43
+ "license": "MIT",
44
+ "bugs": {
45
+ "url": "https://github.com/mikro-orm/mikro-orm/issues"
46
+ },
47
+ "homepage": "https://mikro-orm.io",
48
+ "engines": {
49
+ "node": ">= 18.12.0"
50
+ },
51
+ "scripts": {
52
+ "build": "yarn clean && yarn compile && yarn copy && yarn run -T gen-esm-wrapper index.js index.mjs",
53
+ "clean": "yarn run -T rimraf ./dist",
54
+ "compile": "yarn run -T tsc -p tsconfig.build.json",
55
+ "copy": "node ../../scripts/copy.mjs"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public"
59
+ },
60
+ "dependencies": {
61
+ "@yandjin-mikro-orm/mongodb": "6.1.4-rc-sti-changes-1",
62
+ "fs-extra": "11.2.0",
63
+ "mongodb": "6.3.0",
64
+ "umzug": "3.7.0"
65
+ },
66
+ "devDependencies": {
67
+ "@yandjin-mikro-orm/core": "^6.1.4-rc-sti-changes-1"
68
+ },
69
+ "peerDependencies": {
70
+ "@yandjin-mikro-orm/core": "^6.0.0"
71
+ }
72
+ }
package/typings.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { UmzugMigration, MigrateOptions, MigrationResult, MigrationRow, } from "@yandjin-mikro-orm/core";
package/typings.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });