@midwayjs/mongoose 3.4.0-beta.2 → 3.4.0-beta.5

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/manager.d.ts CHANGED
@@ -3,8 +3,9 @@ import * as mongoose from 'mongoose';
3
3
  export declare class MongooseDataSourceManager extends DataSourceManager<mongoose.Connection> {
4
4
  config: any;
5
5
  logger: any;
6
+ baseDir: string;
6
7
  init(): Promise<void>;
7
- protected createDataSource(config: any, name: string): Promise<mongoose.Connection>;
8
+ protected createDataSource(config: any, name: string): Promise<any>;
8
9
  getName(): string;
9
10
  destroyDataSource(dataSource: mongoose.Connection): Promise<void>;
10
11
  protected checkConnected(dataSource: mongoose.Connection): Promise<boolean>;
package/dist/manager.js CHANGED
@@ -25,10 +25,10 @@ let MongooseDataSourceManager = class MongooseDataSourceManager extends core_1.D
25
25
  this.logger.warn('[midway:mongoose] mongoose.clients is deprecated, please use new config format.');
26
26
  this.config.dataSource = this.config.clients;
27
27
  }
28
- await this.initDataSource(this.config);
28
+ await this.initDataSource(this.config, this.baseDir);
29
29
  }
30
30
  async createDataSource(config, name) {
31
- const connection = await mongoose.createConnection(config.uri, config.options);
31
+ const connection = (await mongoose.createConnection(config.uri, config.options));
32
32
  connection.on('error', err => {
33
33
  err.message = `[midway:mongoose] ${err.message}`;
34
34
  this.logger.error(err);
@@ -67,6 +67,10 @@ __decorate([
67
67
  (0, decorator_1.Logger)('coreLogger'),
68
68
  __metadata("design:type", Object)
69
69
  ], MongooseDataSourceManager.prototype, "logger", void 0);
70
+ __decorate([
71
+ (0, decorator_1.Inject)(),
72
+ __metadata("design:type", String)
73
+ ], MongooseDataSourceManager.prototype, "baseDir", void 0);
70
74
  __decorate([
71
75
  (0, decorator_1.Init)(),
72
76
  __metadata("design:type", Function),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/mongoose",
3
- "version": "3.4.0-beta.2",
3
+ "version": "3.4.0-beta.5",
4
4
  "description": "Midway Component for mongoose",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
@@ -22,13 +22,13 @@
22
22
  },
23
23
  "license": "MIT",
24
24
  "devDependencies": {
25
- "@midwayjs/core": "^3.4.0-beta.2",
26
- "@midwayjs/decorator": "^3.4.0-beta.2",
27
- "@midwayjs/mock": "^3.4.0-beta.2",
28
- "mongoose": "6.2.10"
25
+ "@midwayjs/core": "^3.4.0-beta.5",
26
+ "@midwayjs/decorator": "^3.4.0-beta.5",
27
+ "@midwayjs/mock": "^3.4.0-beta.5",
28
+ "mongoose": "6.4.2"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "mongoose": "*"
32
32
  },
33
- "gitHead": "a61721d3946b30fd4cac183265edcd99b31ac72b"
33
+ "gitHead": "d84d1c77aed1fd973d002ab65cd0adeadb7924a6"
34
34
  }