@midwayjs/mikro 3.7.3 → 3.8.3
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 +6 -2
- package/dist/decorator.d.ts +2 -0
- package/dist/decorator.js +8 -1
- package/package.json +5 -5
package/dist/configuration.js
CHANGED
|
@@ -23,11 +23,15 @@ let MikroConfiguration = class MikroConfiguration {
|
|
|
23
23
|
else {
|
|
24
24
|
return this.dataSourceManager
|
|
25
25
|
.getDataSource(meta.connectionName ||
|
|
26
|
-
this.dataSourceManager.
|
|
27
|
-
this.dataSourceManager.
|
|
26
|
+
this.dataSourceManager.getDataSourceNameByModel(meta.modelKey) ||
|
|
27
|
+
this.dataSourceManager.getDefaultDataSourceName())
|
|
28
28
|
.em.getRepository(meta.modelKey);
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
+
this.decoratorService.registerPropertyHandler(decorator_1.DATA_SOURCE_KEY, (propertyName, meta) => {
|
|
32
|
+
return this.dataSourceManager.getDataSource(meta.dataSourceName ||
|
|
33
|
+
this.dataSourceManager.getDefaultDataSourceName());
|
|
34
|
+
});
|
|
31
35
|
}
|
|
32
36
|
async onReady(container) {
|
|
33
37
|
this.dataSourceManager = await container.getAsync(dataSourceManager_1.MikroDataSourceManager);
|
package/dist/decorator.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { EntityName } from '@mikro-orm/core';
|
|
2
2
|
export declare const ENTITY_MODEL_KEY = "mikro:entity_model_key";
|
|
3
|
+
export declare const DATA_SOURCE_KEY = "mikro:data_source_key";
|
|
3
4
|
export declare function InjectRepository(modelKey: EntityName<any>, connectionName?: string): PropertyDecorator;
|
|
5
|
+
export declare function InjectDataSource(dataSourceName?: string): PropertyDecorator;
|
|
4
6
|
//# sourceMappingURL=decorator.d.ts.map
|
package/dist/decorator.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InjectRepository = exports.ENTITY_MODEL_KEY = void 0;
|
|
3
|
+
exports.InjectDataSource = exports.InjectRepository = exports.DATA_SOURCE_KEY = exports.ENTITY_MODEL_KEY = void 0;
|
|
4
4
|
const core_1 = require("@midwayjs/core");
|
|
5
5
|
exports.ENTITY_MODEL_KEY = 'mikro:entity_model_key';
|
|
6
|
+
exports.DATA_SOURCE_KEY = 'mikro:data_source_key';
|
|
6
7
|
function InjectRepository(modelKey, connectionName) {
|
|
7
8
|
return (0, core_1.createCustomPropertyDecorator)(exports.ENTITY_MODEL_KEY, {
|
|
8
9
|
modelKey,
|
|
@@ -10,4 +11,10 @@ function InjectRepository(modelKey, connectionName) {
|
|
|
10
11
|
});
|
|
11
12
|
}
|
|
12
13
|
exports.InjectRepository = InjectRepository;
|
|
14
|
+
function InjectDataSource(dataSourceName) {
|
|
15
|
+
return (0, core_1.createCustomPropertyDecorator)(exports.DATA_SOURCE_KEY, {
|
|
16
|
+
dataSourceName,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
exports.InjectDataSource = InjectDataSource;
|
|
13
20
|
//# sourceMappingURL=decorator.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/mikro",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.3",
|
|
4
4
|
"main": "dist/index",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"index.d.ts"
|
|
10
10
|
],
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@midwayjs/core": "^3.
|
|
13
|
-
"@midwayjs/mock": "^3.
|
|
12
|
+
"@midwayjs/core": "^3.8.0",
|
|
13
|
+
"@midwayjs/mock": "^3.8.0",
|
|
14
14
|
"@mikro-orm/core": "5.5.0",
|
|
15
15
|
"@mikro-orm/entity-generator": "5.5.0",
|
|
16
16
|
"@mikro-orm/sql-highlighter": "1.0.1",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|
|
35
|
-
"url": "
|
|
35
|
+
"url": "https://github.com/midwayjs/midway.git"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "ea7288f98f0db5a868c7b72b15ec051819aef598"
|
|
38
38
|
}
|