@apipass/mongo-memory-server 0.0.35 → 0.0.37

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/lib/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './mongodb-memory-server.setup';
1
+ export * from './mongoose-config-service.mock';
package/lib/index.js CHANGED
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./mongodb-memory-server.setup"), exports);
17
+ __exportStar(require("./mongoose-config-service.mock"), exports);
18
18
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C"}
@@ -0,0 +1,5 @@
1
+ import type { MongooseModuleOptions, MongooseOptionsFactory } from '@nestjs/mongoose';
2
+ export declare class MongooseConfigServiceMock implements MongooseOptionsFactory {
3
+ private static mongoDb;
4
+ createMongooseOptions(options?: MongooseModuleOptions): Promise<MongooseModuleOptions>;
5
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MongooseConfigServiceMock = void 0;
13
+ const mongodb_memory_server_1 = require("mongodb-memory-server");
14
+ class MongooseConfigServiceMock {
15
+ createMongooseOptions() {
16
+ return __awaiter(this, arguments, void 0, function* (options = {}) {
17
+ if (!MongooseConfigServiceMock.mongoDb) {
18
+ MongooseConfigServiceMock.mongoDb = yield mongodb_memory_server_1.MongoMemoryServer.create();
19
+ }
20
+ return Object.assign({ uri: MongooseConfigServiceMock.mongoDb.getUri(), autoCreate: true }, options);
21
+ });
22
+ }
23
+ }
24
+ exports.MongooseConfigServiceMock = MongooseConfigServiceMock;
25
+ MongooseConfigServiceMock.mongoDb = null;
26
+ //# sourceMappingURL=mongoose-config-service.mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mongoose-config-service.mock.js","sourceRoot":"","sources":["../src/mongoose-config-service.mock.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iEAAyD;AAGzD,MAAa,yBAAyB;IAG9B,qBAAqB;6DAAE,UAAiC,EAAE;YAC9D,IAAI,CAAC,yBAAyB,CAAC,OAAO,EAAE,CAAC;gBACvC,yBAAyB,CAAC,OAAO,GAAG,MAAM,yCAAiB,CAAC,MAAM,EAAE,CAAA;YACtE,CAAC;YACD,uBACE,GAAG,EAAE,yBAAyB,CAAC,OAAO,CAAC,MAAM,EAAE,EAC/C,UAAU,EAAE,IAAI,IACb,OAAO,EACX;QACH,CAAC;KAAA;;AAZH,8DAaC;AAZgB,iCAAO,GAA6B,IAAI,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apipass/mongo-memory-server",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "license": "ISC",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "lib": "lib"
9
9
  },
10
10
  "dependencies": {
11
- "mongoose": "8.6.3"
11
+ "@nestjs/mongoose": "10.0.10"
12
12
  },
13
13
  "devDependencies": {
14
14
  "mongodb-memory-server": "10.0.0"
@@ -22,5 +22,5 @@
22
22
  "scripts": {
23
23
  "tsc": "tsc"
24
24
  },
25
- "gitHead": "2600683b4721773803ec57a08b7a00e92ffcc5a9"
25
+ "gitHead": "a97365e39f1fd0956ba05c4c3f1c8a0d9dea9c02"
26
26
  }
@@ -1,9 +0,0 @@
1
- export declare abstract class MongodbMemoryServerSetup {
2
- private static mongoDb;
3
- private static client;
4
- abstract databaseName: string;
5
- initialize(): Promise<void>;
6
- connectDatabase(): Promise<void>;
7
- abstract loadInitialData(): Promise<void>;
8
- disconnectDatabase(): Promise<void>;
9
- }
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.MongodbMemoryServerSetup = void 0;
13
- const mongodb_memory_server_1 = require("mongodb-memory-server");
14
- const mongoose = require("mongoose");
15
- class MongodbMemoryServerSetup {
16
- initialize() {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- yield this.connectDatabase();
19
- yield this.loadInitialData();
20
- });
21
- }
22
- connectDatabase() {
23
- return __awaiter(this, void 0, void 0, function* () {
24
- if (!MongodbMemoryServerSetup.mongoDb) {
25
- MongodbMemoryServerSetup.mongoDb = yield mongodb_memory_server_1.MongoMemoryServer.create();
26
- }
27
- MongodbMemoryServerSetup.client = yield mongoose.connect(MongodbMemoryServerSetup.mongoDb.getUri(), {
28
- dbName: this.databaseName,
29
- autoCreate: true
30
- });
31
- });
32
- }
33
- disconnectDatabase() {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- if (MongodbMemoryServerSetup.client) {
36
- yield mongoose.connection.dropDatabase();
37
- yield mongoose.disconnect();
38
- }
39
- if (MongodbMemoryServerSetup.mongoDb) {
40
- yield MongodbMemoryServerSetup.mongoDb.stop();
41
- }
42
- MongodbMemoryServerSetup.client = null;
43
- MongodbMemoryServerSetup.mongoDb = null;
44
- });
45
- }
46
- }
47
- exports.MongodbMemoryServerSetup = MongodbMemoryServerSetup;
48
- MongodbMemoryServerSetup.mongoDb = null;
49
- MongodbMemoryServerSetup.client = null;
50
- //# sourceMappingURL=mongodb-memory-server.setup.js.map
@@ -1 +0,0 @@
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;IAK/B,UAAU;;YACrB,MAAM,IAAI,CAAC,eAAe,EAAE,CAAA;YAC5B,MAAM,IAAI,CAAC,eAAe,EAAE,CAAA;QAC9B,CAAC;KAAA;IAEY,eAAe;;YAC1B,IAAI,CAAC,wBAAwB,CAAC,OAAO,EAAE,CAAC;gBACtC,wBAAwB,CAAC,OAAO,GAAG,MAAM,yCAAiB,CAAC,MAAM,EAAE,CAAA;YACrE,CAAC;YACD,wBAAwB,CAAC,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,wBAAwB,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE;gBAClG,MAAM,EAAE,IAAI,CAAC,YAAY;gBACzB,UAAU,EAAE,IAAI;aACjB,CAAC,CAAA;QACJ,CAAC;KAAA;IAIY,kBAAkB;;YAC7B,IAAI,wBAAwB,CAAC,MAAM,EAAE,CAAC;gBACpC,MAAM,QAAQ,CAAC,UAAU,CAAC,YAAY,EAAE,CAAA;gBACxC,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAA;YAC7B,CAAC;YACD,IAAI,wBAAwB,CAAC,OAAO,EAAE,CAAC;gBACrC,MAAM,wBAAwB,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;YAC/C,CAAC;YACD,wBAAwB,CAAC,MAAM,GAAG,IAAI,CAAA;YACtC,wBAAwB,CAAC,OAAO,GAAG,IAAI,CAAA;QACzC,CAAC;KAAA;;AAhCH,4DAiCC;AAhCgB,gCAAO,GAA6B,IAAI,CAAA;AACxC,+BAAM,GAA2B,IAAI,CAAA"}