@apipass/mongo-memory-server 0.0.34 → 0.0.35

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.
@@ -1,7 +1,7 @@
1
1
  export declare abstract class MongodbMemoryServerSetup {
2
+ private static mongoDb;
3
+ private static client;
2
4
  abstract databaseName: string;
3
- private mongoDB;
4
- private client;
5
5
  initialize(): Promise<void>;
6
6
  connectDatabase(): Promise<void>;
7
7
  abstract loadInitialData(): Promise<void>;
@@ -13,10 +13,6 @@ exports.MongodbMemoryServerSetup = void 0;
13
13
  const mongodb_memory_server_1 = require("mongodb-memory-server");
14
14
  const mongoose = require("mongoose");
15
15
  class MongodbMemoryServerSetup {
16
- constructor() {
17
- this.mongoDB = null;
18
- this.client = null;
19
- }
20
16
  initialize() {
21
17
  return __awaiter(this, void 0, void 0, function* () {
22
18
  yield this.connectDatabase();
@@ -25,10 +21,10 @@ class MongodbMemoryServerSetup {
25
21
  }
26
22
  connectDatabase() {
27
23
  return __awaiter(this, void 0, void 0, function* () {
28
- if (!this.mongoDB) {
29
- this.mongoDB = yield mongodb_memory_server_1.MongoMemoryServer.create();
24
+ if (!MongodbMemoryServerSetup.mongoDb) {
25
+ MongodbMemoryServerSetup.mongoDb = yield mongodb_memory_server_1.MongoMemoryServer.create();
30
26
  }
31
- this.client = yield mongoose.connect(this.mongoDB.getUri(), {
27
+ MongodbMemoryServerSetup.client = yield mongoose.connect(MongodbMemoryServerSetup.mongoDb.getUri(), {
32
28
  dbName: this.databaseName,
33
29
  autoCreate: true
34
30
  });
@@ -36,17 +32,19 @@ class MongodbMemoryServerSetup {
36
32
  }
37
33
  disconnectDatabase() {
38
34
  return __awaiter(this, void 0, void 0, function* () {
39
- if (this.client) {
35
+ if (MongodbMemoryServerSetup.client) {
40
36
  yield mongoose.connection.dropDatabase();
41
37
  yield mongoose.disconnect();
42
38
  }
43
- if (this.mongoDB) {
44
- yield this.mongoDB.stop();
39
+ if (MongodbMemoryServerSetup.mongoDb) {
40
+ yield MongodbMemoryServerSetup.mongoDb.stop();
45
41
  }
46
- this.client = null;
47
- this.mongoDB = null;
42
+ MongodbMemoryServerSetup.client = null;
43
+ MongodbMemoryServerSetup.mongoDb = null;
48
44
  });
49
45
  }
50
46
  }
51
47
  exports.MongodbMemoryServerSetup = MongodbMemoryServerSetup;
48
+ MongodbMemoryServerSetup.mongoDb = null;
49
+ MongodbMemoryServerSetup.client = null;
52
50
  //# sourceMappingURL=mongodb-memory-server.setup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mongodb-memory-server.setup.js","sourceRoot":"","sources":["../src/mongodb-memory-server.setup.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iEAAyD;AACzD,qCAAoC;AAEpC,MAAsB,wBAAwB;IAA9C;QAEU,YAAO,GAA6B,IAAI,CAAA;QACxC,WAAM,GAA2B,IAAI,CAAA;IA8B/C,CAAC;IA5Bc,UAAU;;YACrB,MAAM,IAAI,CAAC,eAAe,EAAE,CAAA;YAC5B,MAAM,IAAI,CAAC,eAAe,EAAE,CAAA;QAC9B,CAAC;KAAA;IAEY,eAAe;;YAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClB,IAAI,CAAC,OAAO,GAAG,MAAM,yCAAiB,CAAC,MAAM,EAAE,CAAA;YACjD,CAAC;YACD,IAAI,CAAC,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE;gBAC1D,MAAM,EAAE,IAAI,CAAC,YAAY;gBACzB,UAAU,EAAE,IAAI;aACjB,CAAC,CAAA;QACJ,CAAC;KAAA;IAIY,kBAAkB;;YAC7B,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,MAAM,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,CAAA;gBACxC,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAA;YAC7B,CAAC;YACD,IAAI,IAAI,CAAC,OAA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AhCH,4DAiCC;AAhCgB,gCAAO,GAA6B,IAAI,CAAA;AACxC,+BAAM,GAA2B,IAAI,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apipass/mongo-memory-server",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "license": "ISC",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -22,5 +22,5 @@
22
22
  "scripts": {
23
23
  "tsc": "tsc"
24
24
  },
25
- "gitHead": "49a7fe3715a10216c18dfcadcc81b0e4d14fe67c"
25
+ "gitHead": "2600683b4721773803ec57a08b7a00e92ffcc5a9"
26
26
  }