@midwayjs/typegoose 3.0.0-beta.7 → 3.0.0-beta.8

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 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
+ # [3.0.0-beta.8](https://github.com/midwayjs/midway/compare/v3.0.0-beta.7...v3.0.0-beta.8) (2021-12-08)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * mongoose remote config bug ([#1399](https://github.com/midwayjs/midway/issues/1399)) ([e37602d](https://github.com/midwayjs/midway/commit/e37602d54ae503aeee48afa320709aae3d18b329))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.0.0-beta.7](https://github.com/midwayjs/midway/compare/v3.0.0-beta.6...v3.0.0-beta.7) (2021-12-03)
7
18
 
8
19
  **Note:** Version bump only for package @midwayjs/typegoose
@@ -1,14 +1,12 @@
1
- import * as mongoose from '@midwayjs/mongoose';
2
1
  import { IMidwayApplication, MidwayDecoratorService } 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
  decoratorService: MidwayDecoratorService;
9
7
  modelMap: WeakMap<object, any>;
10
8
  init(): Promise<void>;
11
- onReady(): Promise<void>;
9
+ onReady(container: any): Promise<void>;
12
10
  onStop(): Promise<void>;
13
11
  }
14
12
  //# sourceMappingURL=configuration.d.ts.map
@@ -26,13 +26,14 @@ let TypegooseConfiguration = class TypegooseConfiguration {
26
26
  return this.modelMap.get(meta.modelKey);
27
27
  });
28
28
  }
29
- async onReady() {
29
+ async onReady(container) {
30
30
  var _a, _b;
31
+ const connectionFactory = await container.getAsync(mongoose.MongooseConnectionServiceFactory);
31
32
  const Models = (0, decorator_1.listModule)(interface_1.ENTITY_MODEL_KEY);
32
33
  for (const Model of Models) {
33
34
  const metadata = (_a = (0, decorator_1.getClassMetadata)(interface_1.ENTITY_MODEL_KEY, Model)) !== null && _a !== void 0 ? _a : {};
34
35
  const connectionName = (_b = metadata.connectionName) !== null && _b !== void 0 ? _b : 'default';
35
- const conn = this.connectionFactory.get(connectionName);
36
+ const conn = connectionFactory.get(connectionName);
36
37
  if (conn) {
37
38
  const model = (0, typegoose_1.getModelForClass)(Model, { existingConnection: conn });
38
39
  this.modelMap.set(Model, model);
@@ -53,10 +54,6 @@ let TypegooseConfiguration = class TypegooseConfiguration {
53
54
  }
54
55
  }
55
56
  };
56
- __decorate([
57
- (0, decorator_1.Inject)(),
58
- __metadata("design:type", mongoose.MongooseConnectionServiceFactory)
59
- ], TypegooseConfiguration.prototype, "connectionFactory", void 0);
60
57
  __decorate([
61
58
  (0, decorator_1.Config)('mongoose'),
62
59
  __metadata("design:type", Object)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/typegoose",
3
- "version": "3.0.0-beta.7",
3
+ "version": "3.0.0-beta.8",
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": "^3.0.0-beta.7"
24
+ "@midwayjs/mongoose": "^3.0.0-beta.8"
25
25
  },
26
26
  "devDependencies": {
27
- "@midwayjs/core": "^3.0.0-beta.7",
28
- "@midwayjs/decorator": "^3.0.0-beta.7",
29
- "@midwayjs/mock": "^3.0.0-beta.7",
27
+ "@midwayjs/core": "^3.0.0-beta.8",
28
+ "@midwayjs/decorator": "^3.0.0-beta.8",
29
+ "@midwayjs/mock": "^3.0.0-beta.8",
30
30
  "@typegoose/typegoose": "^9.0.0",
31
31
  "mongoose": "~6.0.11"
32
32
  },
33
- "gitHead": "24590729121d9110e2d960db5b5e587cf55a1efc"
33
+ "gitHead": "bfafbdf8798f48d4daac5dd88ad53c6b2f33c110"
34
34
  }