mongodb-memory-server-core
Advanced tools
Comparing version 6.6.1 to 6.6.2
@@ -6,2 +6,14 @@ # Change Log | ||
## [6.6.2](https://github.com/nodkz/mongodb-memory-server/compare/v6.6.1...v6.6.2) (2020-07-27) | ||
### Bug Fixes | ||
* lint ([218b057](https://github.com/nodkz/mongodb-memory-server/commit/218b057425eafa2463d8167fe1ba29a0a4590476)) | ||
* update Dependencies (audit problems) ([2782166](https://github.com/nodkz/mongodb-memory-server/commit/278216667929379c43c70314b437cc34db6f07fa)) | ||
## [6.6.1](https://github.com/nodkz/mongodb-memory-server/compare/v6.6.0...v6.6.1) (2020-05-20) | ||
@@ -8,0 +20,0 @@ |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -41,9 +60,2 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -50,0 +62,0 @@ var MongoMemoryReplSet_1 = __importDefault(require("../MongoMemoryReplSet")); |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MongoMemoryReplSet = exports.MongoMemoryServer = exports.MongoInstance = exports.MongoBinary = void 0; | ||
require("./util/resolve-config"); // import it for the side-effects (globals) | ||
@@ -8,0 +9,0 @@ var MongoBinary_1 = __importDefault(require("./util/MongoBinary")); |
@@ -26,2 +26,21 @@ "use strict"; | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -281,3 +300,3 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var uris, MongoClient, conn, db, admin, members, rsConfig, e_1, oldConfig; | ||
var uris, MongoClient, e_1, conn, db, admin, members, rsConfig, e_2, oldConfig; | ||
return __generator(this, function (_a) { | ||
@@ -296,19 +315,23 @@ switch (_a.label) { | ||
uris = _a.sent(); | ||
try { | ||
MongoClient = require('mongodb').MongoClient; | ||
} | ||
catch (e) { | ||
throw new Error("You need to install \"mongodb\" package. It's required for checking ReplicaSet state."); | ||
} | ||
return [4 /*yield*/, MongoClient.connect(uris[0], { | ||
useNewUrlParser: true, | ||
useUnifiedTopology: true, | ||
})]; | ||
_a.label = 2; | ||
case 2: | ||
_a.trys.push([2, 4, , 5]); | ||
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('mongodb')); })]; | ||
case 3: | ||
MongoClient = (_a.sent()).MongoClient; | ||
return [3 /*break*/, 5]; | ||
case 4: | ||
e_1 = _a.sent(); | ||
throw new Error("You need to install \"mongodb\" package. It's required for checking ReplicaSet state."); | ||
case 5: return [4 /*yield*/, MongoClient.connect(uris[0], { | ||
useNewUrlParser: true, | ||
useUnifiedTopology: true, | ||
})]; | ||
case 6: | ||
conn = _a.sent(); | ||
_a.label = 3; | ||
case 3: | ||
_a.trys.push([3, , 14, 16]); | ||
_a.label = 7; | ||
case 7: | ||
_a.trys.push([7, , 18, 20]); | ||
return [4 /*yield*/, conn.db(this.opts.replSet.dbName)]; | ||
case 4: | ||
case 8: | ||
db = _a.sent(); | ||
@@ -331,15 +354,15 @@ // MongoClient HACK which helps to avoid the following error: | ||
}; | ||
_a.label = 5; | ||
case 5: | ||
_a.trys.push([5, 7, , 12]); | ||
_a.label = 9; | ||
case 9: | ||
_a.trys.push([9, 11, , 16]); | ||
return [4 /*yield*/, admin.command({ replSetInitiate: rsConfig })]; | ||
case 6: | ||
case 10: | ||
_a.sent(); | ||
return [3 /*break*/, 12]; | ||
case 7: | ||
e_1 = _a.sent(); | ||
if (!(e_1 instanceof mongodb_1.MongoError && e_1.errmsg == 'already initialized')) return [3 /*break*/, 10]; | ||
log(e_1.errmsg + ": trying to set old config"); | ||
return [3 /*break*/, 16]; | ||
case 11: | ||
e_2 = _a.sent(); | ||
if (!(e_2 instanceof mongodb_1.MongoError && e_2.errmsg == 'already initialized')) return [3 /*break*/, 14]; | ||
log(e_2.errmsg + ": trying to set old config"); | ||
return [4 /*yield*/, admin.command({ replSetGetConfig: 1 })]; | ||
case 8: | ||
case 12: | ||
oldConfig = (_a.sent()).config; | ||
@@ -351,20 +374,20 @@ log('got old config:\n', oldConfig); | ||
})]; | ||
case 9: | ||
case 13: | ||
_a.sent(); | ||
return [3 /*break*/, 11]; | ||
case 10: throw e_1; | ||
case 11: return [3 /*break*/, 12]; | ||
case 12: | ||
return [3 /*break*/, 15]; | ||
case 14: throw e_2; | ||
case 15: return [3 /*break*/, 16]; | ||
case 16: | ||
log('Waiting for replica set to have a PRIMARY member.'); | ||
return [4 /*yield*/, this._waitForPrimary()]; | ||
case 13: | ||
case 17: | ||
_a.sent(); | ||
this.emit((this._state = 'running')); | ||
log('running'); | ||
return [3 /*break*/, 16]; | ||
case 14: return [4 /*yield*/, conn.close()]; | ||
case 15: | ||
return [3 /*break*/, 20]; | ||
case 18: return [4 /*yield*/, conn.close()]; | ||
case 19: | ||
_a.sent(); | ||
return [7 /*endfinally*/]; | ||
case 16: return [2 /*return*/]; | ||
case 20: return [2 /*return*/]; | ||
} | ||
@@ -371,0 +394,0 @@ }); |
@@ -13,2 +13,21 @@ "use strict"; | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -50,9 +69,2 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -78,7 +90,6 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
function MongoMemoryServer(opts) { | ||
var _a; | ||
this.runningInstance = null; | ||
this.instanceInfoSync = null; | ||
this.opts = __assign({}, opts); | ||
if (((_a = opts) === null || _a === void 0 ? void 0 : _a.autoStart) === true) { | ||
if ((opts === null || opts === void 0 ? void 0 : opts.autoStart) === true) { | ||
log('Autostarting MongoDB instance...'); | ||
@@ -93,14 +104,13 @@ this.start(); | ||
MongoMemoryServer.create = function (opts) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var instance; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
instance = new MongoMemoryServer(__assign(__assign({}, opts), { autoStart: false })); | ||
if (!((_a = opts) === null || _a === void 0 ? void 0 : _a.autoStart)) return [3 /*break*/, 2]; | ||
if (!(opts === null || opts === void 0 ? void 0 : opts.autoStart)) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, instance.start()]; | ||
case 1: | ||
_b.sent(); | ||
_b.label = 2; | ||
_a.sent(); | ||
_a.label = 2; | ||
case 2: return [2 /*return*/, instance]; | ||
@@ -158,10 +168,10 @@ } | ||
case 0: | ||
instOpts = (_a = this.opts.instance, (_a !== null && _a !== void 0 ? _a : {})); | ||
instOpts = (_a = this.opts.instance) !== null && _a !== void 0 ? _a : {}; | ||
_f = {}; | ||
return [4 /*yield*/, get_port_1.default({ port: (_b = instOpts.port, (_b !== null && _b !== void 0 ? _b : undefined)) })]; | ||
return [4 /*yield*/, get_port_1.default({ port: (_b = instOpts.port) !== null && _b !== void 0 ? _b : undefined })]; | ||
case 1: | ||
data = (_f.port = _h.sent(), | ||
_f.dbName = db_util_1.generateDbName(instOpts.dbName), | ||
_f.ip = (_c = instOpts.ip, (_c !== null && _c !== void 0 ? _c : '127.0.0.1')), | ||
_f.storageEngine = (_d = instOpts.storageEngine, (_d !== null && _d !== void 0 ? _d : 'ephemeralForTest')), | ||
_f.ip = (_c = instOpts.ip) !== null && _c !== void 0 ? _c : '127.0.0.1', | ||
_f.storageEngine = (_d = instOpts.storageEngine) !== null && _d !== void 0 ? _d : 'ephemeralForTest', | ||
_f.replSet = instOpts.replSet, | ||
@@ -202,3 +212,3 @@ _f.dbPath = instOpts.dbPath, | ||
instance = _h.sent(); | ||
return [2 /*return*/, __assign(__assign({}, data), { dbPath: data.dbPath, uri: data.uri, instance: instance, childProcess: (_e = instance.childProcess, (_e !== null && _e !== void 0 ? _e : undefined)) })]; | ||
return [2 /*return*/, __assign(__assign({}, data), { dbPath: data.dbPath, uri: data.uri, instance: instance, childProcess: (_e = instance.childProcess) !== null && _e !== void 0 ? _e : undefined })]; | ||
} | ||
@@ -246,3 +256,3 @@ }); | ||
var _a; | ||
return _a = this.instanceInfoSync, (_a !== null && _a !== void 0 ? _a : false); | ||
return (_a = this.instanceInfoSync) !== null && _a !== void 0 ? _a : false; | ||
}; | ||
@@ -249,0 +259,0 @@ /** |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -38,9 +57,2 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -47,0 +59,0 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -38,9 +57,2 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -47,0 +59,0 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -41,9 +60,2 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -50,0 +62,0 @@ var fs_1 = __importDefault(require("fs")); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getUriBase = exports.getHost = exports.generateDbName = void 0; | ||
var uuid_1 = require("uuid"); | ||
@@ -4,0 +5,0 @@ /** |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.deprecate = void 0; | ||
function deprecate(msg) { | ||
@@ -4,0 +5,0 @@ var stack; |
@@ -42,2 +42,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isLinuxOS = void 0; | ||
var fs_1 = require("fs"); | ||
@@ -176,19 +177,18 @@ var os_1 = require("os"); | ||
function tryOSRelease() { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var os, err_2; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_b.trys.push([0, 2, , 3]); | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, util_1.promisify(fs_1.readFile)('/etc/os-release')]; | ||
case 1: | ||
os = _b.sent(); | ||
os = _a.sent(); | ||
return [2 /*return*/, parseOS(os.toString())]; | ||
case 2: | ||
err_2 = _b.sent(); | ||
err_2 = _a.sent(); | ||
// check if the error is an "ENOENT" OR "SKIP_OS_RELEASE" is set | ||
// AND "USE_LINUX_OS_RELEASE" is unset | ||
// and just return | ||
if ((((_a = err_2) === null || _a === void 0 ? void 0 : _a.code) === 'ENOENT' || !util_1.isNullOrUndefined(resolve_config_1.default('SKIP_OS_RELEASE'))) && | ||
if (((err_2 === null || err_2 === void 0 ? void 0 : err_2.code) === 'ENOENT' || !util_1.isNullOrUndefined(resolve_config_1.default('SKIP_OS_RELEASE'))) && | ||
util_1.isNullOrUndefined(resolve_config_1.default('USE_LINUX_OS_RELEASE'))) { | ||
@@ -208,12 +208,11 @@ return [2 /*return*/]; | ||
function tryFirstReleaseFile() { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var file, os, err_3; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_b.trys.push([0, 3, , 4]); | ||
_a.trys.push([0, 3, , 4]); | ||
return [4 /*yield*/, util_1.promisify(fs_1.readdir)('/etc')]; | ||
case 1: | ||
file = (_b.sent()).filter(function (v) { | ||
file = (_a.sent()).filter(function (v) { | ||
// match if file ends with "-release" | ||
@@ -229,10 +228,10 @@ return v.match(/.*-release$/im) && | ||
case 2: | ||
os = _b.sent(); | ||
os = _a.sent(); | ||
return [2 /*return*/, parseOS(os.toString())]; | ||
case 3: | ||
err_3 = _b.sent(); | ||
err_3 = _a.sent(); | ||
// check if the error is an "ENOENT" OR "SKIP_RELEASE" is set | ||
// AND "USE_LINUX_RELEASE" is unset | ||
// and just return | ||
if (((_a = err_3) === null || _a === void 0 ? void 0 : _a.code) === 'ENOENT' && util_1.isNullOrUndefined(resolve_config_1.default('USE_LINUX_ANYFILE_RELEASE'))) { | ||
if ((err_3 === null || err_3 === void 0 ? void 0 : err_3.code) === 'ENOENT' && util_1.isNullOrUndefined(resolve_config_1.default('USE_LINUX_ANYFILE_RELEASE'))) { | ||
return [2 /*return*/]; | ||
@@ -252,5 +251,5 @@ } | ||
os: 'linux', | ||
dist: (_b = (_a = input.match(LSBRegex.name)) === null || _a === void 0 ? void 0 : _a[1], (_b !== null && _b !== void 0 ? _b : 'unkown')), | ||
dist: (_b = (_a = input.match(LSBRegex.name)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : 'unkown', | ||
codename: (_c = input.match(LSBRegex.codename)) === null || _c === void 0 ? void 0 : _c[1], | ||
release: (_e = (_d = input.match(LSBRegex.release)) === null || _d === void 0 ? void 0 : _d[1], (_e !== null && _e !== void 0 ? _e : '')), | ||
release: (_e = (_d = input.match(LSBRegex.release)) === null || _d === void 0 ? void 0 : _d[1]) !== null && _e !== void 0 ? _e : '', | ||
}; | ||
@@ -263,7 +262,7 @@ } | ||
os: 'linux', | ||
dist: (_b = (_a = input.match(OSRegex.name)) === null || _a === void 0 ? void 0 : _a[1], (_b !== null && _b !== void 0 ? _b : 'unkown')), | ||
dist: (_b = (_a = input.match(OSRegex.name)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : 'unkown', | ||
codename: (_c = input.match(OSRegex.codename)) === null || _c === void 0 ? void 0 : _c[1], | ||
release: (_e = (_d = input.match(OSRegex.release)) === null || _d === void 0 ? void 0 : _d[1], (_e !== null && _e !== void 0 ? _e : '')), | ||
release: (_e = (_d = input.match(OSRegex.release)) === null || _d === void 0 ? void 0 : _d[1]) !== null && _e !== void 0 ? _e : '', | ||
}; | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -15,3 +15,3 @@ export declare const LATEST_VERSION: string; | ||
static getCachePath(version: string): Promise<string>; | ||
static getDownloadPath(options: any): Promise<string>; | ||
static getDownloadPath(options: Required<MongoBinaryOpts>): Promise<string>; | ||
static getPath(opts?: MongoBinaryOpts): Promise<string>; | ||
@@ -18,0 +18,0 @@ static hasValidBinPath(files: string[]): boolean; |
@@ -57,2 +57,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LATEST_VERSION = void 0; | ||
var fs_1 = __importDefault(require("fs")); | ||
@@ -59,0 +60,0 @@ var os_1 = __importDefault(require("os")); |
@@ -82,3 +82,5 @@ import { DownloadProgressT } from '../types'; | ||
*/ | ||
printDownloadProgress(chunk: any): void; | ||
printDownloadProgress(chunk: { | ||
length: number; | ||
}): void; | ||
/** | ||
@@ -85,0 +87,0 @@ * Test if the location given is already used |
@@ -6,2 +6,21 @@ "use strict"; | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -46,9 +65,2 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -79,7 +91,7 @@ var os_1 = __importDefault(require("os")); | ||
var _b; | ||
this.platform = (platform !== null && platform !== void 0 ? platform : os_1.default.platform()); | ||
this.arch = (arch !== null && arch !== void 0 ? arch : os_1.default.arch()); | ||
this.version = (version !== null && version !== void 0 ? version : MongoBinary_1.LATEST_VERSION); | ||
this.platform = platform !== null && platform !== void 0 ? platform : os_1.default.platform(); | ||
this.arch = arch !== null && arch !== void 0 ? arch : os_1.default.arch(); | ||
this.version = version !== null && version !== void 0 ? version : MongoBinary_1.LATEST_VERSION; | ||
this.downloadDir = path_1.default.resolve(downloadDir || 'mongodb-download'); | ||
this.checkMD5 = (checkMD5 !== null && checkMD5 !== void 0 ? checkMD5 : resolve_config_1.envToBool((_b = resolve_config_1.default('MD5_CHECK'), (_b !== null && _b !== void 0 ? _b : '')))); | ||
this.checkMD5 = checkMD5 !== null && checkMD5 !== void 0 ? checkMD5 : resolve_config_1.envToBool((_b = resolve_config_1.default('MD5_CHECK')) !== null && _b !== void 0 ? _b : ''); | ||
this.dlProgress = { | ||
@@ -176,3 +188,3 @@ current: 0, | ||
mongoDBArchiveMd5 = _a.sent(); | ||
signatureContent = fs_1.default.readFileSync(mongoDBArchiveMd5).toString('UTF-8'); | ||
signatureContent = fs_1.default.readFileSync(mongoDBArchiveMd5).toString('utf-8'); | ||
m = signatureContent.match(/(.*?)\s/); | ||
@@ -272,9 +284,7 @@ md5Remote = m ? m[1] : null; | ||
return [3 /*break*/, 5]; | ||
case 4: throw new Error("MongoBinaryDownload: unsupported archive " + mongoDBArchive + " (downloaded from " + (_a = this | ||
._downloadingUrl, (_a !== null && _a !== void 0 ? _a : 'unkown')) + "). Broken archive from MongoDB Provider?"); | ||
case 4: throw new Error("MongoBinaryDownload: unsupported archive " + mongoDBArchive + " (downloaded from " + ((_a = this._downloadingUrl) !== null && _a !== void 0 ? _a : 'unkown') + "). Broken archive from MongoDB Provider?"); | ||
case 5: return [4 /*yield*/, this.locationExists(path_1.default.resolve(this.downloadDir, this.version, binaryName))]; | ||
case 6: | ||
if (!(_c.sent())) { | ||
throw new Error("MongoBinaryDownload: missing mongod binary in " + mongoDBArchive + " (downloaded from " + (_b = this | ||
._downloadingUrl, (_b !== null && _b !== void 0 ? _b : 'unkown')) + "). Broken archive from MongoDB Provider?"); | ||
throw new Error("MongoBinaryDownload: missing mongod binary in " + mongoDBArchive + " (downloaded from " + ((_b = this._downloadingUrl) !== null && _b !== void 0 ? _b : 'unkown') + "). Broken archive from MongoDB Provider?"); | ||
} | ||
@@ -372,2 +382,3 @@ return [2 /*return*/, extractDir]; | ||
.get(httpOptions, function (response) { | ||
// "as any" because otherwise the "agent" wouldnt match | ||
if (response.statusCode != 200) { | ||
@@ -374,0 +385,0 @@ if (response.statusCode === 403) { |
@@ -77,3 +77,3 @@ "use strict"; | ||
} | ||
mirror = (_a = resolve_config_1.default('DOWNLOAD_MIRROR'), (_a !== null && _a !== void 0 ? _a : 'https://fastdl.mongodb.org')); | ||
mirror = (_a = resolve_config_1.default('DOWNLOAD_MIRROR')) !== null && _a !== void 0 ? _a : 'https://fastdl.mongodb.org'; | ||
log("Using \"" + mirror + "\" as the mirror"); | ||
@@ -298,6 +298,3 @@ return [2 /*return*/, mirror + "/" + this.platform + "/" + archive]; | ||
parseFloat(ubuntuVersion.toString()); | ||
return "ubuntu" + ubuntuVersion | ||
.toString() | ||
.replace('.', '') | ||
.trim(); | ||
return "ubuntu" + ubuntuVersion.toString().replace('.', '').trim(); | ||
} | ||
@@ -304,0 +301,0 @@ catch (err) { |
@@ -27,3 +27,3 @@ /// <reference types="node" /> | ||
killerProcess: ChildProcess | null; | ||
waitForPrimaryResolveFns: Function[]; | ||
waitForPrimaryResolveFns: ((value: boolean) => void)[]; | ||
isInstancePrimary: boolean; | ||
@@ -30,0 +30,0 @@ isInstanceReady: boolean; |
@@ -119,3 +119,3 @@ "use strict"; | ||
result.push('--replSet', replSet); | ||
return result.concat((args !== null && args !== void 0 ? args : [])); | ||
return result.concat(args !== null && args !== void 0 ? args : []); | ||
}; | ||
@@ -234,3 +234,3 @@ /** | ||
var _a; | ||
var spawnOpts = (_a = this.opts.spawn, (_a !== null && _a !== void 0 ? _a : {})); | ||
var spawnOpts = (_a = this.opts.spawn) !== null && _a !== void 0 ? _a : {}; | ||
if (!spawnOpts.stdio) | ||
@@ -237,0 +237,0 @@ spawnOpts.stdio = 'pipe'; |
@@ -7,2 +7,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.envToBool = exports.reInitializePackageJson = exports.setDefaultValue = void 0; | ||
var camelcase_1 = __importDefault(require("camelcase")); | ||
@@ -32,4 +33,4 @@ var find_package_json_1 = __importDefault(require("find-package-json")); | ||
function resolveConfig(variableName) { | ||
var _a, _b, _c, _d, _e; | ||
return (_e = (_a = process.env["" + ENV_CONFIG_PREFIX + variableName], (_a !== null && _a !== void 0 ? _a : (_d = (_c = (_b = packageJson) === null || _b === void 0 ? void 0 : _b.config) === null || _c === void 0 ? void 0 : _c.mongodbMemoryServer) === null || _d === void 0 ? void 0 : _d[camelcase_1.default(variableName)])), (_e !== null && _e !== void 0 ? _e : defaultValues.get(variableName))); | ||
var _a, _b, _c, _d; | ||
return ((_d = (_a = process.env["" + ENV_CONFIG_PREFIX + variableName]) !== null && _a !== void 0 ? _a : (_c = (_b = packageJson === null || packageJson === void 0 ? void 0 : packageJson.config) === null || _b === void 0 ? void 0 : _b.mongodbMemoryServer) === null || _c === void 0 ? void 0 : _c[camelcase_1.default(variableName)]) !== null && _d !== void 0 ? _d : defaultValues.get(variableName)); | ||
} | ||
@@ -46,5 +47,5 @@ exports.default = resolveConfig; | ||
// enable debug "MONGOMS_DEBUG" is true | ||
if (envToBool((_a = resolveConfig('DEBUG'), (_a !== null && _a !== void 0 ? _a : '')))) { | ||
if (envToBool((_a = resolveConfig('DEBUG')) !== null && _a !== void 0 ? _a : '')) { | ||
debug_1.default.enable('MongoMS:*'); | ||
} | ||
//# sourceMappingURL=resolve-config.js.map |
{ | ||
"name": "mongodb-memory-server-core", | ||
"version": "6.6.1", | ||
"version": "6.6.2", | ||
"description": "MongoDB Server for testing (core package, without autodownload). The server will allow you to connect your favourite ODM or client library to the MongoDB Server and run parallel integration tests isolated from each other.", | ||
@@ -34,17 +34,18 @@ "main": "lib/index", | ||
"devDependencies": { | ||
"@types/jest": "25.1.4", | ||
"@types/jest": "26.0.7", | ||
"@types/mongodb": "3.5.2", | ||
"@types/tar-stream": "^2.1.0", | ||
"@types/yauzl": "^2.9.1", | ||
"@typescript-eslint/eslint-plugin": "2.23.0", | ||
"@typescript-eslint/parser": "2.23.0", | ||
"@typescript-eslint/eslint-plugin": "3.7.0", | ||
"@typescript-eslint/parser": "3.7.0", | ||
"cross-env": "^7.0.2", | ||
"eslint": "6.8.0", | ||
"eslint-config-prettier": "6.10.0", | ||
"jest": "^25.1.0", | ||
"lerna": "3.20.2", | ||
"eslint": "7.5.0", | ||
"eslint-config-prettier": "6.11.0", | ||
"flowgen": "^1.10.0", | ||
"jest": "^26.1.0", | ||
"lerna": "3.22.1", | ||
"mongodb": "3.5.4", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^25.2.1", | ||
"typescript": "^3.8.3" | ||
"ts-jest": "^26.1.3", | ||
"typescript": "^3.9.7" | ||
}, | ||
@@ -86,3 +87,2 @@ "dependencies": { | ||
"build:ts": "rimraf ./lib && tsc -p ./tsconfig.build.json", | ||
"disabled-build:flow": "find ./lib -name \"*.d.ts\" -exec bash -c './node_modules/.bin/flowgen --add-flow-header \"$1\" -o \"${1%.d.ts}\".js.flow' - '{}' \\;", | ||
"watch": "cross-env MONGOMS_DOWNLOAD_DIR=./tmp jest --watchAll", | ||
@@ -95,3 +95,3 @@ "coverage": "cross-env MONGOMS_DOWNLOAD_DIR=./tmp jest --coverage", | ||
}, | ||
"gitHead": "2974d49aebe35f176af2a20c5e28da563008b34d" | ||
"gitHead": "ac755ad985b8a9cd76fbf0d0d9c0835f97615924" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
363499
5222
3
16