@midwayjs/typegoose 2.13.5 → 2.14.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/CHANGELOG.md +11 -0
- package/dist/configuration.d.ts +2 -4
- package/dist/configuration.js +3 -6
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.14.0](https://github.com/midwayjs/midway/compare/v2.13.5...v2.14.0) (2021-12-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* mongoose init before config load ([#1401](https://github.com/midwayjs/midway/issues/1401)) ([34d2ab8](https://github.com/midwayjs/midway/commit/34d2ab8b5bcfc9bddf52b9a93d6f3b44960ef537))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.13.5](https://github.com/midwayjs/midway/compare/v2.13.4...v2.13.5) (2021-10-21)
|
|
7
18
|
|
|
8
19
|
|
package/dist/configuration.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IMidwayApplication } from '@midwayjs/core';
|
|
1
|
+
import { IMidwayApplication, IMidwayContainer } from '@midwayjs/core';
|
|
3
2
|
export declare class TypegooseConfiguration {
|
|
4
|
-
connectionFactory: mongoose.MongooseConnectionServiceFactory;
|
|
5
3
|
oldMongooseConfig: any;
|
|
6
4
|
legacyMode: boolean;
|
|
7
5
|
app: IMidwayApplication;
|
|
8
6
|
modelMap: WeakMap<object, any>;
|
|
9
7
|
init(): Promise<void>;
|
|
10
|
-
onReady(): Promise<void>;
|
|
8
|
+
onReady(container: IMidwayContainer): Promise<void>;
|
|
11
9
|
onStop(): Promise<void>;
|
|
12
10
|
}
|
|
13
11
|
//# sourceMappingURL=configuration.d.ts.map
|
package/dist/configuration.js
CHANGED
|
@@ -28,13 +28,14 @@ let TypegooseConfiguration = class TypegooseConfiguration {
|
|
|
28
28
|
return this.modelMap.get(key.modelKey);
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
async onReady() {
|
|
31
|
+
async onReady(container) {
|
|
32
32
|
var _a, _b;
|
|
33
|
+
const connectionFactory = await container.getAsync(mongoose.MongooseConnectionServiceFactory);
|
|
33
34
|
const Models = (0, decorator_1.listModule)(interface_1.ENTITY_MODEL_KEY);
|
|
34
35
|
for (const Model of Models) {
|
|
35
36
|
const metadata = (_a = (0, decorator_1.getClassMetadata)(interface_1.ENTITY_MODEL_KEY, Model)) !== null && _a !== void 0 ? _a : {};
|
|
36
37
|
const connectionName = (_b = metadata.connectionName) !== null && _b !== void 0 ? _b : 'default';
|
|
37
|
-
const conn =
|
|
38
|
+
const conn = connectionFactory.get(connectionName);
|
|
38
39
|
if (conn) {
|
|
39
40
|
const model = (0, typegoose_1.getModelForClass)(Model, { existingConnection: conn });
|
|
40
41
|
this.modelMap.set(Model, model);
|
|
@@ -55,10 +56,6 @@ let TypegooseConfiguration = class TypegooseConfiguration {
|
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
};
|
|
58
|
-
__decorate([
|
|
59
|
-
(0, decorator_1.Inject)(),
|
|
60
|
-
__metadata("design:type", mongoose.MongooseConnectionServiceFactory)
|
|
61
|
-
], TypegooseConfiguration.prototype, "connectionFactory", void 0);
|
|
62
59
|
__decorate([
|
|
63
60
|
(0, decorator_1.Config)('mongoose'),
|
|
64
61
|
__metadata("design:type", Object)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/typegoose",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"description": "Midway Component for typegoose",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@midwayjs/mongoose": "^2.
|
|
24
|
+
"@midwayjs/mongoose": "^2.14.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@midwayjs/core": "^2.
|
|
28
|
-
"@midwayjs/decorator": "^2.
|
|
29
|
-
"@midwayjs/mock": "^2.
|
|
27
|
+
"@midwayjs/core": "^2.14.0",
|
|
28
|
+
"@midwayjs/decorator": "^2.14.0",
|
|
29
|
+
"@midwayjs/mock": "^2.14.0",
|
|
30
30
|
"@typegoose/typegoose": "^9.0.0",
|
|
31
31
|
"mongoose": "~6.0.11"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "5fd716b0e731162d8e9f0931790fde7402fb83de"
|
|
34
34
|
}
|