@midwayjs/typegoose 3.0.0-beta.1 → 3.0.0-beta.10

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,84 @@
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.10](https://github.com/midwayjs/midway/compare/v3.0.0-beta.9...v3.0.0-beta.10) (2021-12-20)
7
+
8
+ **Note:** Version bump only for package @midwayjs/typegoose
9
+
10
+
11
+
12
+
13
+
14
+ # [3.0.0-beta.9](https://github.com/midwayjs/midway/compare/v3.0.0-beta.8...v3.0.0-beta.9) (2021-12-09)
15
+
16
+ **Note:** Version bump only for package @midwayjs/typegoose
17
+
18
+
19
+
20
+
21
+
22
+ # [3.0.0-beta.8](https://github.com/midwayjs/midway/compare/v3.0.0-beta.7...v3.0.0-beta.8) (2021-12-08)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * mongoose remote config bug ([#1399](https://github.com/midwayjs/midway/issues/1399)) ([e37602d](https://github.com/midwayjs/midway/commit/e37602d54ae503aeee48afa320709aae3d18b329))
28
+
29
+
30
+
31
+
32
+
33
+ # [3.0.0-beta.7](https://github.com/midwayjs/midway/compare/v3.0.0-beta.6...v3.0.0-beta.7) (2021-12-03)
34
+
35
+ **Note:** Version bump only for package @midwayjs/typegoose
36
+
37
+
38
+
39
+
40
+
41
+ # [3.0.0-beta.6](https://github.com/midwayjs/midway/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2021-11-26)
42
+
43
+ **Note:** Version bump only for package @midwayjs/typegoose
44
+
45
+
46
+
47
+
48
+
49
+ # [3.0.0-beta.5](https://github.com/midwayjs/midway/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2021-11-25)
50
+
51
+ **Note:** Version bump only for package @midwayjs/typegoose
52
+
53
+
54
+
55
+
56
+
57
+ # [3.0.0-beta.4](https://github.com/midwayjs/midway/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2021-11-24)
58
+
59
+ **Note:** Version bump only for package @midwayjs/typegoose
60
+
61
+
62
+
63
+
64
+
65
+ # [3.0.0-beta.3](https://github.com/midwayjs/midway/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2021-11-18)
66
+
67
+
68
+ ### Features
69
+
70
+ * add component and framework config definition ([#1367](https://github.com/midwayjs/midway/issues/1367)) ([b2fe615](https://github.com/midwayjs/midway/commit/b2fe6157f99659471ff1333eca0b86bb889f61a3))
71
+
72
+
73
+
74
+
75
+
76
+ # [3.0.0-beta.2](https://github.com/midwayjs/midway/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2021-11-16)
77
+
78
+ **Note:** Version bump only for package @midwayjs/typegoose
79
+
80
+
81
+
82
+
83
+
6
84
  # [3.0.0-beta.1](https://github.com/midwayjs/midway/compare/v2.12.4...v3.0.0-beta.1) (2021-11-14)
7
85
 
8
86
 
@@ -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)
@@ -1,19 +1,5 @@
1
- import * as mongoose from 'mongoose';
2
1
  export interface EntityOptions {
3
2
  connectionName: string;
4
3
  }
5
4
  export declare const ENTITY_MODEL_KEY = "TYPEGOOSE:MODEL";
6
- interface M5 {
7
- ConnectionOptions: unknown;
8
- }
9
- interface M6 {
10
- ConnectOptions: unknown;
11
- }
12
- declare type ExtractConnectionOptions<T> = T extends M5 ? T['ConnectionOptions'] : T extends M6 ? T['ConnectOptions'] : never;
13
- declare type ConnectionOptions = ExtractConnectionOptions<typeof mongoose>;
14
- export declare type DefaultConfig = {
15
- uri: string;
16
- options: ConnectionOptions;
17
- };
18
- export {};
19
5
  //# sourceMappingURL=interface.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/typegoose",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-beta.10",
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.1"
24
+ "@midwayjs/mongoose": "^3.0.0-beta.10"
25
25
  },
26
26
  "devDependencies": {
27
- "@midwayjs/core": "^3.0.0-beta.1",
28
- "@midwayjs/decorator": "^3.0.0-beta.1",
29
- "@midwayjs/mock": "^3.0.0-beta.1",
27
+ "@midwayjs/core": "^3.0.0-beta.10",
28
+ "@midwayjs/decorator": "^3.0.0-beta.10",
29
+ "@midwayjs/mock": "^3.0.0-beta.10",
30
30
  "@typegoose/typegoose": "^9.0.0",
31
31
  "mongoose": "~6.0.11"
32
32
  },
33
- "gitHead": "72e4d20c678e65a5440c4e9a6d3b70046daa497c"
33
+ "gitHead": "153870f2e2dd6b17673ec7591e49224a6bd51b36"
34
34
  }