@mikro-orm/nestjs 5.1.8 → 5.2.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/mikro-orm-core.module.js +2 -3
- package/mikro-orm-middleware.module.js +2 -3
- package/mikro-orm.entities.storage.js +1 -1
- package/mikro-orm.middleware.js +2 -3
- package/mikro-orm.module.d.ts +5 -0
- package/mikro-orm.module.js +9 -3
- package/mikro-orm.providers.js +1 -0
- package/multiple-mikro-orm.middleware.js +2 -3
- package/package.json +21 -21
package/mikro-orm-core.module.js
CHANGED
|
@@ -52,7 +52,7 @@ async function tryRequire(name) {
|
|
|
52
52
|
return undefined; // ignore, optional dependency
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
let MikroOrmCoreModule = MikroOrmCoreModule_1 = class MikroOrmCoreModule {
|
|
55
|
+
let MikroOrmCoreModule = exports.MikroOrmCoreModule = MikroOrmCoreModule_1 = class MikroOrmCoreModule {
|
|
56
56
|
constructor(options, moduleRef) {
|
|
57
57
|
this.options = options;
|
|
58
58
|
this.moduleRef = moduleRef;
|
|
@@ -156,10 +156,9 @@ let MikroOrmCoreModule = MikroOrmCoreModule_1 = class MikroOrmCoreModule {
|
|
|
156
156
|
return contextName;
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
|
-
MikroOrmCoreModule = MikroOrmCoreModule_1 = __decorate([
|
|
159
|
+
exports.MikroOrmCoreModule = MikroOrmCoreModule = MikroOrmCoreModule_1 = __decorate([
|
|
160
160
|
(0, common_1.Global)(),
|
|
161
161
|
(0, common_1.Module)({}),
|
|
162
162
|
__param(0, (0, common_1.Inject)(mikro_orm_common_1.MIKRO_ORM_MODULE_OPTIONS)),
|
|
163
163
|
__metadata("design:paramtypes", [Object, core_2.ModuleRef])
|
|
164
164
|
], MikroOrmCoreModule);
|
|
165
|
-
exports.MikroOrmCoreModule = MikroOrmCoreModule;
|
|
@@ -18,7 +18,7 @@ const common_1 = require("@nestjs/common");
|
|
|
18
18
|
const mikro_orm_common_1 = require("./mikro-orm.common");
|
|
19
19
|
const multiple_mikro_orm_middleware_1 = require("./multiple-mikro-orm.middleware");
|
|
20
20
|
const middleware_helper_1 = require("./middleware.helper");
|
|
21
|
-
let MikroOrmMiddlewareModule = MikroOrmMiddlewareModule_1 = class MikroOrmMiddlewareModule {
|
|
21
|
+
let MikroOrmMiddlewareModule = exports.MikroOrmMiddlewareModule = MikroOrmMiddlewareModule_1 = class MikroOrmMiddlewareModule {
|
|
22
22
|
constructor(options) {
|
|
23
23
|
this.options = options;
|
|
24
24
|
}
|
|
@@ -46,10 +46,9 @@ let MikroOrmMiddlewareModule = MikroOrmMiddlewareModule_1 = class MikroOrmMiddle
|
|
|
46
46
|
.forRoutes({ path: (0, middleware_helper_1.forRoutesPath)(this.options, consumer), method: common_1.RequestMethod.ALL });
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
MikroOrmMiddlewareModule = MikroOrmMiddlewareModule_1 = __decorate([
|
|
49
|
+
exports.MikroOrmMiddlewareModule = MikroOrmMiddlewareModule = MikroOrmMiddlewareModule_1 = __decorate([
|
|
50
50
|
(0, common_1.Global)(),
|
|
51
51
|
(0, common_1.Module)({}),
|
|
52
52
|
__param(0, (0, common_1.Inject)(mikro_orm_common_1.MIKRO_ORM_MODULE_OPTIONS)),
|
|
53
53
|
__metadata("design:paramtypes", [Object])
|
|
54
54
|
], MikroOrmMiddlewareModule);
|
|
55
|
-
exports.MikroOrmMiddlewareModule = MikroOrmMiddlewareModule;
|
package/mikro-orm.middleware.js
CHANGED
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.MikroOrmMiddleware = void 0;
|
|
13
13
|
const core_1 = require("@mikro-orm/core");
|
|
14
14
|
const common_1 = require("@nestjs/common");
|
|
15
|
-
let MikroOrmMiddleware = class MikroOrmMiddleware {
|
|
15
|
+
let MikroOrmMiddleware = exports.MikroOrmMiddleware = class MikroOrmMiddleware {
|
|
16
16
|
constructor(orm) {
|
|
17
17
|
this.orm = orm;
|
|
18
18
|
}
|
|
@@ -20,8 +20,7 @@ let MikroOrmMiddleware = class MikroOrmMiddleware {
|
|
|
20
20
|
core_1.RequestContext.create(this.orm.em, next);
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
MikroOrmMiddleware = __decorate([
|
|
23
|
+
exports.MikroOrmMiddleware = MikroOrmMiddleware = __decorate([
|
|
24
24
|
(0, common_1.Injectable)(),
|
|
25
25
|
__metadata("design:paramtypes", [core_1.MikroORM])
|
|
26
26
|
], MikroOrmMiddleware);
|
|
27
|
-
exports.MikroOrmMiddleware = MikroOrmMiddleware;
|
package/mikro-orm.module.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import type { AnyEntity } from '@mikro-orm/core';
|
|
|
2
2
|
import type { DynamicModule } from '@nestjs/common';
|
|
3
3
|
import type { MikroOrmModuleAsyncOptions, MikroOrmModuleSyncOptions, MikroOrmMiddlewareModuleOptions, MikroOrmModuleFeatureOptions, EntityName } from './typings';
|
|
4
4
|
export declare class MikroOrmModule {
|
|
5
|
+
/**
|
|
6
|
+
* Clears the entity storage. This is useful for testing purposes, when you want to isolate the tests.
|
|
7
|
+
* Keep in mind that this should be called when using a test runner that keeps the context alive between tests (like Vitest with threads disabled).
|
|
8
|
+
*/
|
|
9
|
+
static clearStorage(contextName?: string): void;
|
|
5
10
|
static forRoot(options?: MikroOrmModuleSyncOptions): DynamicModule;
|
|
6
11
|
static forRootAsync(options: MikroOrmModuleAsyncOptions): DynamicModule;
|
|
7
12
|
static forFeature(options: EntityName<AnyEntity>[] | MikroOrmModuleFeatureOptions, contextName?: string): DynamicModule;
|
package/mikro-orm.module.js
CHANGED
|
@@ -14,7 +14,14 @@ const mikro_orm_providers_1 = require("./mikro-orm.providers");
|
|
|
14
14
|
const mikro_orm_core_module_1 = require("./mikro-orm-core.module");
|
|
15
15
|
const mikro_orm_middleware_module_1 = require("./mikro-orm-middleware.module");
|
|
16
16
|
const mikro_orm_entities_storage_1 = require("./mikro-orm.entities.storage");
|
|
17
|
-
let MikroOrmModule = MikroOrmModule_1 = class MikroOrmModule {
|
|
17
|
+
let MikroOrmModule = exports.MikroOrmModule = MikroOrmModule_1 = class MikroOrmModule {
|
|
18
|
+
/**
|
|
19
|
+
* Clears the entity storage. This is useful for testing purposes, when you want to isolate the tests.
|
|
20
|
+
* Keep in mind that this should be called when using a test runner that keeps the context alive between tests (like Vitest with threads disabled).
|
|
21
|
+
*/
|
|
22
|
+
static clearStorage(contextName) {
|
|
23
|
+
mikro_orm_entities_storage_1.MikroOrmEntitiesStorage.clear(contextName);
|
|
24
|
+
}
|
|
18
25
|
static forRoot(options) {
|
|
19
26
|
return {
|
|
20
27
|
module: MikroOrmModule_1,
|
|
@@ -49,7 +56,6 @@ let MikroOrmModule = MikroOrmModule_1 = class MikroOrmModule {
|
|
|
49
56
|
};
|
|
50
57
|
}
|
|
51
58
|
};
|
|
52
|
-
MikroOrmModule = MikroOrmModule_1 = __decorate([
|
|
59
|
+
exports.MikroOrmModule = MikroOrmModule = MikroOrmModule_1 = __decorate([
|
|
53
60
|
(0, common_1.Module)({})
|
|
54
61
|
], MikroOrmModule);
|
|
55
|
-
exports.MikroOrmModule = MikroOrmModule;
|
package/mikro-orm.providers.js
CHANGED
|
@@ -9,6 +9,7 @@ function createMikroOrmProvider(contextName) {
|
|
|
9
9
|
return {
|
|
10
10
|
provide: contextName ? (0, mikro_orm_common_1.getMikroORMToken)(contextName) : core_1.MikroORM,
|
|
11
11
|
useFactory: async (options) => {
|
|
12
|
+
options = { ...options };
|
|
12
13
|
if (options?.autoLoadEntities) {
|
|
13
14
|
options.entities = [...(options.entities || []), ...mikro_orm_entities_storage_1.MikroOrmEntitiesStorage.getEntities(contextName)];
|
|
14
15
|
options.entitiesTs = [...(options.entitiesTs || []), ...mikro_orm_entities_storage_1.MikroOrmEntitiesStorage.getEntities(contextName)];
|
|
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.MultipleMikroOrmMiddleware = void 0;
|
|
16
16
|
const core_1 = require("@mikro-orm/core");
|
|
17
17
|
const common_1 = require("@nestjs/common");
|
|
18
|
-
let MultipleMikroOrmMiddleware = class MultipleMikroOrmMiddleware {
|
|
18
|
+
let MultipleMikroOrmMiddleware = exports.MultipleMikroOrmMiddleware = class MultipleMikroOrmMiddleware {
|
|
19
19
|
constructor(orm) {
|
|
20
20
|
this.orm = orm;
|
|
21
21
|
}
|
|
@@ -23,9 +23,8 @@ let MultipleMikroOrmMiddleware = class MultipleMikroOrmMiddleware {
|
|
|
23
23
|
core_1.RequestContext.create(this.orm.map(orm => orm.em), next);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
MultipleMikroOrmMiddleware = __decorate([
|
|
26
|
+
exports.MultipleMikroOrmMiddleware = MultipleMikroOrmMiddleware = __decorate([
|
|
27
27
|
(0, common_1.Injectable)(),
|
|
28
28
|
__param(0, (0, common_1.Inject)('MikroORMs')),
|
|
29
29
|
__metadata("design:paramtypes", [Array])
|
|
30
30
|
], MultipleMikroOrmMiddleware);
|
|
31
|
-
exports.MultipleMikroOrmMiddleware = MultipleMikroOrmMiddleware;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/nestjs",
|
|
3
|
-
"version": "5.1
|
|
3
|
+
"version": "5.2.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Martin Adamek",
|
|
@@ -41,30 +41,30 @@
|
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@mikro-orm/core": "^5.0.0 || ^6.0.0-dev.0",
|
|
44
|
-
"@nestjs/common": "^8.0.0 || ^9.0.0",
|
|
45
|
-
"@nestjs/core": "^8.0.0 || ^9.0.0"
|
|
44
|
+
"@nestjs/common": "^8.0.0 || ^9.0.0 || ^10.0.0",
|
|
45
|
+
"@nestjs/core": "^8.0.0 || ^9.0.0 || ^10.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@mikro-orm/core": "^5.
|
|
49
|
-
"@mikro-orm/sqlite": "^5.
|
|
50
|
-
"@nestjs/common": "^9.3
|
|
51
|
-
"@nestjs/core": "^9.3
|
|
52
|
-
"@nestjs/platform-express": "^9.3
|
|
53
|
-
"@nestjs/testing": "^9.3
|
|
54
|
-
"@types/jest": "^29.2
|
|
55
|
-
"@types/node": "^
|
|
48
|
+
"@mikro-orm/core": "^5.7.12",
|
|
49
|
+
"@mikro-orm/sqlite": "^5.7.12",
|
|
50
|
+
"@nestjs/common": "^9.4.3",
|
|
51
|
+
"@nestjs/core": "^9.4.3",
|
|
52
|
+
"@nestjs/platform-express": "^9.4.3",
|
|
53
|
+
"@nestjs/testing": "^9.4.3",
|
|
54
|
+
"@types/jest": "^29.5.2",
|
|
55
|
+
"@types/node": "^20.3.1",
|
|
56
56
|
"@types/supertest": "^2.0.12",
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "~5.
|
|
58
|
-
"@typescript-eslint/parser": "~5.
|
|
59
|
-
"conventional-changelog": "^
|
|
60
|
-
"conventional-changelog-cli": "^
|
|
61
|
-
"eslint": "^8.
|
|
62
|
-
"jest": "^29.
|
|
63
|
-
"rxjs": "^7.8.
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "~5.61.0",
|
|
58
|
+
"@typescript-eslint/parser": "~5.61.0",
|
|
59
|
+
"conventional-changelog": "^4.0.0",
|
|
60
|
+
"conventional-changelog-cli": "^3.0.0",
|
|
61
|
+
"eslint": "^8.43.0",
|
|
62
|
+
"jest": "^29.5.0",
|
|
63
|
+
"rxjs": "^7.8.1",
|
|
64
64
|
"supertest": "^6.3.3",
|
|
65
|
-
"ts-jest": "^29.0
|
|
65
|
+
"ts-jest": "^29.1.0",
|
|
66
66
|
"ts-node": "^10.9.1",
|
|
67
|
-
"typescript": "5.
|
|
67
|
+
"typescript": "5.1.6"
|
|
68
68
|
},
|
|
69
69
|
"commitlint": {
|
|
70
70
|
"extends": [
|
|
@@ -104,5 +104,5 @@
|
|
|
104
104
|
"engines": {
|
|
105
105
|
"node": ">= 14.0.0"
|
|
106
106
|
},
|
|
107
|
-
"packageManager": "yarn@3.
|
|
107
|
+
"packageManager": "yarn@3.6.1"
|
|
108
108
|
}
|