@midwayjs/leoric 3.20.5 → 4.0.0-beta.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/dist/configuration.js
CHANGED
|
@@ -57,6 +57,7 @@ let LeoricConfiguration = class LeoricConfiguration {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
+
exports.LeoricConfiguration = LeoricConfiguration;
|
|
60
61
|
__decorate([
|
|
61
62
|
(0, core_1.Inject)(),
|
|
62
63
|
__metadata("design:type", core_1.MidwayDecoratorService)
|
|
@@ -67,7 +68,7 @@ __decorate([
|
|
|
67
68
|
__metadata("design:paramtypes", []),
|
|
68
69
|
__metadata("design:returntype", Promise)
|
|
69
70
|
], LeoricConfiguration.prototype, "init", null);
|
|
70
|
-
LeoricConfiguration = __decorate([
|
|
71
|
+
exports.LeoricConfiguration = LeoricConfiguration = __decorate([
|
|
71
72
|
(0, core_1.Configuration)({
|
|
72
73
|
namespace: 'leoric',
|
|
73
74
|
importConfigs: [
|
|
@@ -79,5 +80,4 @@ LeoricConfiguration = __decorate([
|
|
|
79
80
|
],
|
|
80
81
|
})
|
|
81
82
|
], LeoricConfiguration);
|
|
82
|
-
exports.LeoricConfiguration = LeoricConfiguration;
|
|
83
83
|
//# sourceMappingURL=configuration.js.map
|
|
@@ -4,7 +4,6 @@ import { LeoricConfigOption } from './interface';
|
|
|
4
4
|
export declare class LeoricDataSourceManager extends DataSourceManager<Realm, ConnectOptions> {
|
|
5
5
|
leoricConfig: LeoricConfigOption;
|
|
6
6
|
coreLogger: ILogger;
|
|
7
|
-
baseDir: string;
|
|
8
7
|
init(): Promise<void>;
|
|
9
8
|
getName(): string;
|
|
10
9
|
protected createDataSource(config: any, dataSourceName: string): Promise<Realm>;
|
|
@@ -43,8 +43,8 @@ let LeoricDataSourceManager = class LeoricDataSourceManager extends core_1.DataS
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
await this.initDataSource(this.leoricConfig, {
|
|
46
|
-
baseDir: this.baseDir,
|
|
47
46
|
entitiesConfigKey: 'models',
|
|
47
|
+
concurrent: true,
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
getName() {
|
|
@@ -78,6 +78,7 @@ let LeoricDataSourceManager = class LeoricDataSourceManager extends core_1.DataS
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
+
exports.LeoricDataSourceManager = LeoricDataSourceManager;
|
|
81
82
|
__decorate([
|
|
82
83
|
(0, core_1.Config)('leoric'),
|
|
83
84
|
__metadata("design:type", Object)
|
|
@@ -86,19 +87,14 @@ __decorate([
|
|
|
86
87
|
(0, core_1.Logger)('coreLogger'),
|
|
87
88
|
__metadata("design:type", Object)
|
|
88
89
|
], LeoricDataSourceManager.prototype, "coreLogger", void 0);
|
|
89
|
-
__decorate([
|
|
90
|
-
(0, core_1.Inject)(),
|
|
91
|
-
__metadata("design:type", String)
|
|
92
|
-
], LeoricDataSourceManager.prototype, "baseDir", void 0);
|
|
93
90
|
__decorate([
|
|
94
91
|
(0, core_1.Init)(),
|
|
95
92
|
__metadata("design:type", Function),
|
|
96
93
|
__metadata("design:paramtypes", []),
|
|
97
94
|
__metadata("design:returntype", Promise)
|
|
98
95
|
], LeoricDataSourceManager.prototype, "init", null);
|
|
99
|
-
LeoricDataSourceManager = __decorate([
|
|
96
|
+
exports.LeoricDataSourceManager = LeoricDataSourceManager = __decorate([
|
|
100
97
|
(0, core_1.Provide)(),
|
|
101
98
|
(0, core_1.Scope)(core_1.ScopeEnum.Singleton)
|
|
102
99
|
], LeoricDataSourceManager);
|
|
103
|
-
exports.LeoricDataSourceManager = LeoricDataSourceManager;
|
|
104
100
|
//# sourceMappingURL=dataSourceManager.js.map
|
package/dist/decorator.js
CHANGED
|
@@ -5,14 +5,16 @@ const core_1 = require("@midwayjs/core");
|
|
|
5
5
|
exports.MODEL_KEY = 'leoric:model_key';
|
|
6
6
|
exports.DATA_SOURCE_KEY = 'leoric:data_source_key';
|
|
7
7
|
function InjectDataSource(dataSourceName) {
|
|
8
|
-
return
|
|
8
|
+
return core_1.DecoratorManager.createCustomPropertyDecorator(exports.DATA_SOURCE_KEY, {
|
|
9
|
+
dataSourceName,
|
|
10
|
+
});
|
|
9
11
|
}
|
|
10
12
|
exports.InjectDataSource = InjectDataSource;
|
|
11
13
|
function InjectModel(modelName, dataSourceName) {
|
|
12
14
|
return (target, propertyKey) => {
|
|
13
15
|
if (!modelName)
|
|
14
16
|
modelName = propertyKey.toString();
|
|
15
|
-
return
|
|
17
|
+
return core_1.DecoratorManager.createCustomPropertyDecorator(exports.MODEL_KEY, {
|
|
16
18
|
modelName,
|
|
17
19
|
dataSourceName,
|
|
18
20
|
})(target, propertyKey);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/leoric",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.1",
|
|
4
4
|
"description": "Leoric as a Midway model component",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -21,20 +21,20 @@
|
|
|
21
21
|
"leoric": "2.13.5"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@midwayjs/core": "^
|
|
25
|
-
"@midwayjs/koa": "^
|
|
26
|
-
"@midwayjs/mock": "^
|
|
24
|
+
"@midwayjs/core": "^4.0.0-beta.1",
|
|
25
|
+
"@midwayjs/koa": "^4.0.0-beta.1",
|
|
26
|
+
"@midwayjs/mock": "^4.0.0-beta.1",
|
|
27
27
|
"sqlite3": "5.1.7"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "tsc",
|
|
31
|
-
"test": "node
|
|
32
|
-
"cov": "node
|
|
31
|
+
"test": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand",
|
|
32
|
+
"cov": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand --coverage --forceExit",
|
|
33
33
|
"lint:fix": "../../node_modules/.bin/mwts fix"
|
|
34
34
|
},
|
|
35
35
|
"repository": {
|
|
36
36
|
"type": "git",
|
|
37
37
|
"url": "https://github.com/midwayjs/midway.git"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "832961ec3aff123c033197d8c00cb2bc9bad7ff8"
|
|
40
40
|
}
|