@midwayjs/sequelize 3.5.1 → 3.6.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/dist/configuration.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SequelizeDataSourceManager } from './dataSourceManager';
|
|
2
1
|
import { IMidwayContainer, MidwayDecoratorService } from '@midwayjs/core';
|
|
2
|
+
import { SequelizeDataSourceManager } from './dataSourceManager';
|
|
3
3
|
export declare class SequelizeConfiguration {
|
|
4
4
|
sequelizeConfig: any;
|
|
5
5
|
decoratorService: MidwayDecoratorService;
|
package/dist/configuration.js
CHANGED
|
@@ -10,13 +10,12 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SequelizeConfiguration = void 0;
|
|
13
|
-
const decorator_1 = require("@midwayjs/decorator");
|
|
14
|
-
const dataSourceManager_1 = require("./dataSourceManager");
|
|
15
13
|
const core_1 = require("@midwayjs/core");
|
|
16
|
-
const
|
|
14
|
+
const dataSourceManager_1 = require("./dataSourceManager");
|
|
15
|
+
const decorator_1 = require("./decorator");
|
|
17
16
|
let SequelizeConfiguration = class SequelizeConfiguration {
|
|
18
17
|
async init() {
|
|
19
|
-
this.decoratorService.registerPropertyHandler(
|
|
18
|
+
this.decoratorService.registerPropertyHandler(decorator_1.ENTITY_MODEL_KEY, (propertyName, meta) => {
|
|
20
19
|
return this.dataSourceManager
|
|
21
20
|
.getDataSource(meta.connectionName ||
|
|
22
21
|
this.dataSourceManager.getDataSourceNameByModel(meta.modelKey))
|
|
@@ -33,21 +32,21 @@ let SequelizeConfiguration = class SequelizeConfiguration {
|
|
|
33
32
|
}
|
|
34
33
|
};
|
|
35
34
|
__decorate([
|
|
36
|
-
(0,
|
|
35
|
+
(0, core_1.Config)('sequelize'),
|
|
37
36
|
__metadata("design:type", Object)
|
|
38
37
|
], SequelizeConfiguration.prototype, "sequelizeConfig", void 0);
|
|
39
38
|
__decorate([
|
|
40
|
-
(0,
|
|
39
|
+
(0, core_1.Inject)(),
|
|
41
40
|
__metadata("design:type", core_1.MidwayDecoratorService)
|
|
42
41
|
], SequelizeConfiguration.prototype, "decoratorService", void 0);
|
|
43
42
|
__decorate([
|
|
44
|
-
(0,
|
|
43
|
+
(0, core_1.Init)(),
|
|
45
44
|
__metadata("design:type", Function),
|
|
46
45
|
__metadata("design:paramtypes", []),
|
|
47
46
|
__metadata("design:returntype", Promise)
|
|
48
47
|
], SequelizeConfiguration.prototype, "init", null);
|
|
49
48
|
SequelizeConfiguration = __decorate([
|
|
50
|
-
(0,
|
|
49
|
+
(0, core_1.Configuration)({
|
|
51
50
|
namespace: 'sequelize',
|
|
52
51
|
importConfigs: [
|
|
53
52
|
{
|
|
@@ -10,7 +10,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SequelizeDataSourceManager = void 0;
|
|
13
|
-
const decorator_1 = require("@midwayjs/decorator");
|
|
14
13
|
const core_1 = require("@midwayjs/core");
|
|
15
14
|
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
16
15
|
let SequelizeDataSourceManager = class SequelizeDataSourceManager extends core_1.DataSourceManager {
|
|
@@ -27,7 +26,7 @@ let SequelizeDataSourceManager = class SequelizeDataSourceManager extends core_1
|
|
|
27
26
|
client.addModels(entities);
|
|
28
27
|
}
|
|
29
28
|
// 兼容老写法,但是这里可能有问题,会添加到所有的数据源之中
|
|
30
|
-
const listEntities = (0,
|
|
29
|
+
const listEntities = (0, core_1.listModule)('sequelize:core');
|
|
31
30
|
client.addModels(listEntities);
|
|
32
31
|
await client.authenticate();
|
|
33
32
|
if (config.sync) {
|
|
@@ -53,26 +52,26 @@ let SequelizeDataSourceManager = class SequelizeDataSourceManager extends core_1
|
|
|
53
52
|
}
|
|
54
53
|
};
|
|
55
54
|
__decorate([
|
|
56
|
-
(0,
|
|
55
|
+
(0, core_1.Config)('sequelize'),
|
|
57
56
|
__metadata("design:type", Object)
|
|
58
57
|
], SequelizeDataSourceManager.prototype, "sequelizeConfig", void 0);
|
|
59
58
|
__decorate([
|
|
60
|
-
(0,
|
|
59
|
+
(0, core_1.Logger)('coreLogger'),
|
|
61
60
|
__metadata("design:type", Object)
|
|
62
61
|
], SequelizeDataSourceManager.prototype, "coreLogger", void 0);
|
|
63
62
|
__decorate([
|
|
64
|
-
(0,
|
|
63
|
+
(0, core_1.Inject)(),
|
|
65
64
|
__metadata("design:type", String)
|
|
66
65
|
], SequelizeDataSourceManager.prototype, "baseDir", void 0);
|
|
67
66
|
__decorate([
|
|
68
|
-
(0,
|
|
67
|
+
(0, core_1.Init)(),
|
|
69
68
|
__metadata("design:type", Function),
|
|
70
69
|
__metadata("design:paramtypes", []),
|
|
71
70
|
__metadata("design:returntype", Promise)
|
|
72
71
|
], SequelizeDataSourceManager.prototype, "init", null);
|
|
73
72
|
SequelizeDataSourceManager = __decorate([
|
|
74
|
-
(0,
|
|
75
|
-
(0,
|
|
73
|
+
(0, core_1.Provide)(),
|
|
74
|
+
(0, core_1.Scope)(core_1.ScopeEnum.Singleton)
|
|
76
75
|
], SequelizeDataSourceManager);
|
|
77
76
|
exports.SequelizeDataSourceManager = SequelizeDataSourceManager;
|
|
78
77
|
//# sourceMappingURL=dataSourceManager.js.map
|
package/dist/decorator.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InjectRepository = exports.ENTITY_MODEL_KEY = exports.BaseTable = void 0;
|
|
4
|
-
const
|
|
4
|
+
const core_1 = require("@midwayjs/core");
|
|
5
5
|
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
6
|
-
const decorator_2 = require("@midwayjs/decorator");
|
|
7
6
|
function BaseTable(arg) {
|
|
8
7
|
if (typeof arg === 'function') {
|
|
9
|
-
(0,
|
|
8
|
+
(0, core_1.saveModule)('sequelize:core', arg);
|
|
10
9
|
annotate(arg);
|
|
11
10
|
}
|
|
12
11
|
else {
|
|
13
12
|
const options = Object.assign({}, arg);
|
|
14
13
|
return target => {
|
|
15
|
-
(0,
|
|
14
|
+
(0, core_1.saveModule)('sequelize:core', target);
|
|
16
15
|
annotate(target, options);
|
|
17
16
|
};
|
|
18
17
|
}
|
|
@@ -24,7 +23,7 @@ function annotate(target, options = {}) {
|
|
|
24
23
|
}
|
|
25
24
|
exports.ENTITY_MODEL_KEY = 'sequelize:entity_model_key';
|
|
26
25
|
function InjectRepository(modelKey, connectionName) {
|
|
27
|
-
return (0,
|
|
26
|
+
return (0, core_1.createCustomPropertyDecorator)(exports.ENTITY_MODEL_KEY, {
|
|
28
27
|
modelKey,
|
|
29
28
|
connectionName,
|
|
30
29
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/sequelize",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"main": "dist/index",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -9,14 +9,13 @@
|
|
|
9
9
|
"index.d.ts"
|
|
10
10
|
],
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@midwayjs/core": "^3.
|
|
13
|
-
"@midwayjs/
|
|
14
|
-
"@midwayjs/
|
|
15
|
-
"
|
|
16
|
-
"sqlite3": "5.0.11"
|
|
12
|
+
"@midwayjs/core": "^3.6.0",
|
|
13
|
+
"@midwayjs/koa": "^3.6.0",
|
|
14
|
+
"@midwayjs/mock": "^3.6.0",
|
|
15
|
+
"sqlite3": "5.1.2"
|
|
17
16
|
},
|
|
18
17
|
"dependencies": {
|
|
19
|
-
"sequelize": "6.
|
|
18
|
+
"sequelize": "6.24.0",
|
|
20
19
|
"sequelize-typescript": "^2.1.0"
|
|
21
20
|
},
|
|
22
21
|
"keywords": [
|
|
@@ -41,5 +40,5 @@
|
|
|
41
40
|
"type": "git",
|
|
42
41
|
"url": "http://github.com/midwayjs/midway.git"
|
|
43
42
|
},
|
|
44
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "22643b0e8519766bb7c68b975930199fc136336e"
|
|
45
44
|
}
|