@midwayjs/mikro 3.14.4 → 3.14.6
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/dist/configuration.js +0 -20
- package/package.json +6 -5
package/dist/configuration.js
CHANGED
|
@@ -44,26 +44,6 @@ let MikroConfiguration = class MikroConfiguration {
|
|
|
44
44
|
}
|
|
45
45
|
async onReady(container) {
|
|
46
46
|
this.dataSourceManager = await container.getAsync(dataSourceManager_1.MikroDataSourceManager);
|
|
47
|
-
const names = this.dataSourceManager.getDataSourceNames();
|
|
48
|
-
const entityManagers = names.map(name => {
|
|
49
|
-
return this.dataSourceManager.getDataSource(name).em;
|
|
50
|
-
});
|
|
51
|
-
if (names.length > 0) {
|
|
52
|
-
// create mikro request scope
|
|
53
|
-
// https://mikro-orm.io/docs/identity-map
|
|
54
|
-
this.applicationManager.getApplications().forEach(app => {
|
|
55
|
-
app.useMiddleware(async (ctx, next) => {
|
|
56
|
-
if (core_2.RequestContext['createAsync']) {
|
|
57
|
-
// mikro-orm 5.x
|
|
58
|
-
return await core_2.RequestContext['createAsync'](entityManagers, next);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
// mikro-orm 6.x
|
|
62
|
-
return await core_2.RequestContext.create(entityManagers, next);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
47
|
}
|
|
68
48
|
async onStop(container) {
|
|
69
49
|
if (this.dataSourceManager) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/mikro",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
],
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@midwayjs/core": "^3.14.4",
|
|
13
|
+
"@midwayjs/koa": "^3.14.4",
|
|
13
14
|
"@midwayjs/mock": "^3.14.4",
|
|
14
|
-
"@mikro-orm/core": "6.0.
|
|
15
|
-
"@mikro-orm/entity-generator": "6.0.
|
|
16
|
-
"@mikro-orm/sqlite": "6.0.
|
|
15
|
+
"@mikro-orm/core": "6.0.5",
|
|
16
|
+
"@mikro-orm/entity-generator": "6.0.5",
|
|
17
|
+
"@mikro-orm/sqlite": "6.0.5"
|
|
17
18
|
},
|
|
18
19
|
"author": {
|
|
19
20
|
"name": "czy88840616",
|
|
@@ -32,5 +33,5 @@
|
|
|
32
33
|
"type": "git",
|
|
33
34
|
"url": "https://github.com/midwayjs/midway.git"
|
|
34
35
|
},
|
|
35
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "c33891e8bf4439fcf00fb6a0ac353b9b445312ce"
|
|
36
37
|
}
|