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

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,111 @@
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.13](https://github.com/midwayjs/midway/compare/v3.0.0-beta.12...v3.0.0-beta.13) (2021-12-30)
7
+
8
+ **Note:** Version bump only for package @midwayjs/typegoose
9
+
10
+
11
+
12
+
13
+
14
+ # [3.0.0-beta.12](https://github.com/midwayjs/midway/compare/v3.0.0-beta.11...v3.0.0-beta.12) (2021-12-28)
15
+
16
+
17
+ ### Features
18
+
19
+ * custom error code & add @Files/@Fields ([#1438](https://github.com/midwayjs/midway/issues/1438)) ([b0032af](https://github.com/midwayjs/midway/commit/b0032afd2fa9ea0416fe69f4bd0c1a58bea5314e))
20
+
21
+
22
+
23
+
24
+
25
+ # [3.0.0-beta.11](https://github.com/midwayjs/midway/compare/v3.0.0-beta.10...v3.0.0-beta.11) (2021-12-21)
26
+
27
+ **Note:** Version bump only for package @midwayjs/typegoose
28
+
29
+
30
+
31
+
32
+
33
+ # [3.0.0-beta.10](https://github.com/midwayjs/midway/compare/v3.0.0-beta.9...v3.0.0-beta.10) (2021-12-20)
34
+
35
+ **Note:** Version bump only for package @midwayjs/typegoose
36
+
37
+
38
+
39
+
40
+
41
+ # [3.0.0-beta.9](https://github.com/midwayjs/midway/compare/v3.0.0-beta.8...v3.0.0-beta.9) (2021-12-09)
42
+
43
+ **Note:** Version bump only for package @midwayjs/typegoose
44
+
45
+
46
+
47
+
48
+
49
+ # [3.0.0-beta.8](https://github.com/midwayjs/midway/compare/v3.0.0-beta.7...v3.0.0-beta.8) (2021-12-08)
50
+
51
+
52
+ ### Bug Fixes
53
+
54
+ * mongoose remote config bug ([#1399](https://github.com/midwayjs/midway/issues/1399)) ([e37602d](https://github.com/midwayjs/midway/commit/e37602d54ae503aeee48afa320709aae3d18b329))
55
+
56
+
57
+
58
+
59
+
60
+ # [3.0.0-beta.7](https://github.com/midwayjs/midway/compare/v3.0.0-beta.6...v3.0.0-beta.7) (2021-12-03)
61
+
62
+ **Note:** Version bump only for package @midwayjs/typegoose
63
+
64
+
65
+
66
+
67
+
68
+ # [3.0.0-beta.6](https://github.com/midwayjs/midway/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2021-11-26)
69
+
70
+ **Note:** Version bump only for package @midwayjs/typegoose
71
+
72
+
73
+
74
+
75
+
76
+ # [3.0.0-beta.5](https://github.com/midwayjs/midway/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2021-11-25)
77
+
78
+ **Note:** Version bump only for package @midwayjs/typegoose
79
+
80
+
81
+
82
+
83
+
84
+ # [3.0.0-beta.4](https://github.com/midwayjs/midway/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2021-11-24)
85
+
86
+ **Note:** Version bump only for package @midwayjs/typegoose
87
+
88
+
89
+
90
+
91
+
92
+ # [3.0.0-beta.3](https://github.com/midwayjs/midway/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2021-11-18)
93
+
94
+
95
+ ### Features
96
+
97
+ * add component and framework config definition ([#1367](https://github.com/midwayjs/midway/issues/1367)) ([b2fe615](https://github.com/midwayjs/midway/commit/b2fe6157f99659471ff1333eca0b86bb889f61a3))
98
+
99
+
100
+
101
+
102
+
103
+ # [3.0.0-beta.2](https://github.com/midwayjs/midway/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2021-11-16)
104
+
105
+ **Note:** Version bump only for package @midwayjs/typegoose
106
+
107
+
108
+
109
+
110
+
6
111
  # [3.0.0-beta.1](https://github.com/midwayjs/midway/compare/v2.12.4...v3.0.0-beta.1) (2021-11-14)
7
112
 
8
113
 
@@ -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.13",
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.13"
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.13",
28
+ "@midwayjs/decorator": "^3.0.0-beta.13",
29
+ "@midwayjs/mock": "^3.0.0-beta.13",
30
30
  "@typegoose/typegoose": "^9.0.0",
31
- "mongoose": "~6.0.11"
31
+ "mongoose": "^6.1.3"
32
32
  },
33
- "gitHead": "72e4d20c678e65a5440c4e9a6d3b70046daa497c"
33
+ "gitHead": "d3c47770fee9dce33a8d148882173fd7782864ad"
34
34
  }