@mikro-orm/nestjs 6.1.1 → 6.1.2-dev.0
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/LICENSE +21 -0
- package/README.md +3 -3
- package/mikro-orm-core.module.js +2 -2
- package/mikro-orm.module.js +1 -2
- package/mikro-orm.providers.js +1 -1
- package/package.json +11 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Dario Mancuso, 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/README.md
CHANGED
|
@@ -132,7 +132,7 @@ Instead of relying on this discovery, you can provide the driver type explicitly
|
|
|
132
132
|
export class AppModule {}
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
##
|
|
135
|
+
## Load entities automatically
|
|
136
136
|
|
|
137
137
|
Manually adding entities to the entities array of the connection options can be
|
|
138
138
|
tedious. In addition, referencing entities from the root module breaks application
|
|
@@ -178,7 +178,7 @@ But middlewares are executed only for regular HTTP request handles, what if we n
|
|
|
178
178
|
a request scoped method outside of that? One example of that is queue handlers or
|
|
179
179
|
scheduled tasks.
|
|
180
180
|
|
|
181
|
-
We can use the `@
|
|
181
|
+
We can use the `@CreateRequestContext()` decorator. It requires you to first inject the
|
|
182
182
|
`MikroORM` instance to current context, it will be then used to create the context
|
|
183
183
|
for you. Under the hood, the decorator will register new request context for your
|
|
184
184
|
method and execute it inside the context.
|
|
@@ -189,7 +189,7 @@ export class MyService {
|
|
|
189
189
|
|
|
190
190
|
constructor(private readonly orm: MikroORM) { }
|
|
191
191
|
|
|
192
|
-
@
|
|
192
|
+
@CreateRequestContext()
|
|
193
193
|
async doSomething() {
|
|
194
194
|
// this will be executed in a separate context
|
|
195
195
|
}
|
package/mikro-orm-core.module.js
CHANGED
|
@@ -65,7 +65,7 @@ async function tryRequire(name) {
|
|
|
65
65
|
}
|
|
66
66
|
// TODO: provide the package name via some platform method, prefer that over the static map when available
|
|
67
67
|
const PACKAGES = {
|
|
68
|
-
MongoDriver: '@mikro-orm/
|
|
68
|
+
MongoDriver: '@mikro-orm/mongodb',
|
|
69
69
|
MySqlDriver: '@mikro-orm/mysql',
|
|
70
70
|
MsSqlDriver: '@mikro-orm/mssql',
|
|
71
71
|
MariaDbDriver: '@mikro-orm/mariadb',
|
|
@@ -248,7 +248,7 @@ let MikroOrmCoreModule = MikroOrmCoreModule_1 = class MikroOrmCoreModule {
|
|
|
248
248
|
return config?.getDriver().createEntityManager();
|
|
249
249
|
}
|
|
250
250
|
catch {
|
|
251
|
-
if (options && 'useFactory' in options && 'inject' in options && options.inject.length > 0) {
|
|
251
|
+
if (options && 'useFactory' in options && 'inject' in options && !options.driver && options.inject.length > 0) {
|
|
252
252
|
// eslint-disable-next-line no-console
|
|
253
253
|
console.warn('Support for driver specific imports in modules defined with `useFactory` and `inject` requires an explicit `driver` option. See https://github.com/mikro-orm/nestjs/pull/204');
|
|
254
254
|
}
|
package/mikro-orm.module.js
CHANGED
|
@@ -8,7 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var MikroOrmModule_1;
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.MikroOrmModule = void 0;
|
|
11
|
-
const core_1 = require("@mikro-orm/core");
|
|
12
11
|
const common_1 = require("@nestjs/common");
|
|
13
12
|
const mikro_orm_core_module_1 = require("./mikro-orm-core.module");
|
|
14
13
|
const mikro_orm_middleware_module_1 = require("./mikro-orm-middleware.module");
|
|
@@ -39,7 +38,7 @@ let MikroOrmModule = MikroOrmModule_1 = class MikroOrmModule {
|
|
|
39
38
|
const name = (Array.isArray(options) || contextName) ? contextName : options.contextName;
|
|
40
39
|
const providers = (0, mikro_orm_providers_1.createMikroOrmRepositoryProviders)(entities, name);
|
|
41
40
|
for (const e of entities) {
|
|
42
|
-
if (
|
|
41
|
+
if (typeof e !== 'string') {
|
|
43
42
|
mikro_orm_entities_storage_1.MikroOrmEntitiesStorage.addEntity(e, name);
|
|
44
43
|
}
|
|
45
44
|
}
|
package/mikro-orm.providers.js
CHANGED
|
@@ -48,7 +48,7 @@ function createEntityManagerProvider(scope = common_1.Scope.DEFAULT, entityManag
|
|
|
48
48
|
return {
|
|
49
49
|
provide: contextName ? (0, mikro_orm_common_1.getEntityManagerToken)(contextName) : entityManager,
|
|
50
50
|
scope,
|
|
51
|
-
useFactory: (orm) => scope === common_1.Scope.DEFAULT ? orm.em : orm.em.fork(forkOptions),
|
|
51
|
+
useFactory: (orm) => scope === common_1.Scope.DEFAULT ? orm.em : orm.em.fork({ useContext: true, ...forkOptions }),
|
|
52
52
|
inject: [contextName ? (0, mikro_orm_common_1.getMikroORMToken)(contextName) : core_1.MikroORM],
|
|
53
53
|
};
|
|
54
54
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/nestjs",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.2-dev.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Martin Adamek",
|
|
@@ -31,13 +31,14 @@
|
|
|
31
31
|
},
|
|
32
32
|
"readme": "./README.md",
|
|
33
33
|
"scripts": {
|
|
34
|
-
"build": "rm -rf dist && tsc -p tsconfig.build.json && cp package.json README.md
|
|
34
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json && cp package.json README.md ",
|
|
35
|
+
"copy": "node scripts/copy.mjs",
|
|
35
36
|
"test": "jest --runInBand",
|
|
36
37
|
"tsc-check-tests": "tsc --noEmit --project tests/tsconfig.json",
|
|
37
38
|
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
|
|
38
39
|
"release": "yarn build && cd dist && npm publish && cd ..",
|
|
39
40
|
"coverage": "yarn test --coverage",
|
|
40
|
-
"lint": "eslint
|
|
41
|
+
"lint": "eslint **/*.js"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
44
|
"@mikro-orm/core": "^6.0.0 || ^6.0.0-dev.0 || ^7.0.0-dev.0",
|
|
@@ -51,11 +52,11 @@
|
|
|
51
52
|
"@nestjs/core": "^11.0.5",
|
|
52
53
|
"@nestjs/platform-express": "^11.0.5",
|
|
53
54
|
"@nestjs/testing": "^11.0.5",
|
|
54
|
-
"@stylistic/eslint-plugin-ts": "^
|
|
55
|
+
"@stylistic/eslint-plugin-ts": "^4.0.0",
|
|
55
56
|
"@types/jest": "^29.5.12",
|
|
56
|
-
"@types/node": "^
|
|
57
|
-
"@types/supertest": "^
|
|
58
|
-
"conventional-changelog": "^
|
|
57
|
+
"@types/node": "^24.0.0",
|
|
58
|
+
"@types/supertest": "^7.0.0",
|
|
59
|
+
"conventional-changelog": "^7.0.0",
|
|
59
60
|
"conventional-changelog-cli": "^5.0.0",
|
|
60
61
|
"eslint": "^9.19.0",
|
|
61
62
|
"eslint-plugin-import": "^2.31.0",
|
|
@@ -64,7 +65,7 @@
|
|
|
64
65
|
"supertest": "^7.0.0",
|
|
65
66
|
"ts-jest": "^29.1.2",
|
|
66
67
|
"ts-node": "^10.9.2",
|
|
67
|
-
"typescript": "5.
|
|
68
|
+
"typescript": "5.9.3",
|
|
68
69
|
"typescript-eslint": "^8.22.0"
|
|
69
70
|
},
|
|
70
71
|
"commitlint": {
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
},
|
|
75
76
|
"lint-staged": {
|
|
76
77
|
"*.ts": [
|
|
77
|
-
"eslint
|
|
78
|
+
"eslint **/*.js --fix"
|
|
78
79
|
]
|
|
79
80
|
},
|
|
80
81
|
"renovate": {
|
|
@@ -105,5 +106,5 @@
|
|
|
105
106
|
"engines": {
|
|
106
107
|
"node": ">= 18.12.0"
|
|
107
108
|
},
|
|
108
|
-
"packageManager": "yarn@4.
|
|
109
|
+
"packageManager": "yarn@4.12.0"
|
|
109
110
|
}
|