Socket
Socket
Sign inDemoInstall

mongodb-memory-server-core

Package Overview
Dependencies
Maintainers
1
Versions
270
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongodb-memory-server-core - npm Package Compare versions

Comparing version 6.2.0 to 6.2.1

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [6.2.1](https://github.com/nodkz/mongodb-memory-server/compare/v6.2.0...v6.2.1) (2019-12-30)
### Bug Fixes
* **ArchLinux:** binary not downloaded when no release file is found. Plus other code fixes and cleanups (tnx [@hasezoey](https://github.com/hasezoey)) ([8723187](https://github.com/nodkz/mongodb-memory-server/commit/8723187)), closes [#248](https://github.com/nodkz/mongodb-memory-server/issues/248) [#255](https://github.com/nodkz/mongodb-memory-server/issues/255)
# [6.2.0](https://github.com/nodkz/mongodb-memory-server/compare/v6.1.1...v6.2.0) (2019-12-26)

@@ -8,0 +19,0 @@

4

lib/util/__tests__/MongoBinaryDownload-test.js

@@ -55,3 +55,3 @@ "use strict";

});
it("if checkMD5 input parameter is missing, then it checks \nMONGOMS_MD5_CHECK environment variable", function () {
it("if checkMD5 input parameter is missing, then it checks\nMONGOMS_MD5_CHECK environment variable", function () {
expect(new MongoBinaryDownload_1.default({}).checkMD5).toBe(false);

@@ -128,3 +128,3 @@ process.env.MONGOMS_MD5_CHECK = '1';

du.download = jest.fn(function () { return Promise.resolve(''); });
expect(du.makeMD5check('', '')).rejects.toMatchInlineSnapshot("[Error: MongoBinaryDownload: md5 check is failed]");
expect(du.makeMD5check('', '')).rejects.toMatchInlineSnapshot("[Error: MongoBinaryDownload: md5 check failed]");
});

@@ -131,0 +131,0 @@ it('false value of checkMD5 attribute disables makeMD5check validation', function () { return __awaiter(void 0, void 0, void 0, function () {

@@ -56,2 +56,9 @@ "use strict";

};
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 });

@@ -68,3 +75,3 @@ var fs_1 = __importDefault(require("fs"));

var MongoBinaryDownload_1 = __importDefault(require("./MongoBinaryDownload"));
var resolve_config_1 = __importDefault(require("./resolve-config"));
var resolve_config_1 = __importStar(require("./resolve-config"));
// TODO: return back `latest` version when it will be fixed in MongoDB distro (for now use 4.0.3 😂)

@@ -176,9 +183,9 @@ // More details in https://github.com/nodkz/mongodb-memory-server/issues/131

if (opts === void 0) { opts = {}; }
var _a;
return __awaiter(this, void 0, void 0, function () {
var legacyDLDir, envDebug, nodeModulesDLDir, defaultOptions, options, version, systemBinary, binaryPath, binaryVersion;
return __generator(this, function (_a) {
switch (_a.label) {
var legacyDLDir, nodeModulesDLDir, defaultOptions, options, version, systemBinary, binaryPath, binaryVersion;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
legacyDLDir = path_1.default.resolve(os_1.default.homedir(), '.cache/mongodb-binaries');
envDebug = resolve_config_1.default('DEBUG');
nodeModulesDLDir = process.cwd();

@@ -200,3 +207,3 @@ while (nodeModulesDLDir.endsWith("node_modules" + path_1.default.sep + "mongodb-memory-server")) {

systemBinary: resolve_config_1.default('SYSTEM_BINARY'),
debug: typeof envDebug === 'string' ? ['1', 'on', 'yes', 'true'].indexOf(envDebug) !== -1 : false,
debug: resolve_config_1.envToBool((_a = resolve_config_1.default('DEBUG'), (_a !== null && _a !== void 0 ? _a : ''))),
};

@@ -221,3 +228,3 @@ if (opts.debug) {

case 1:
binaryPath = _a.sent();
binaryPath = _b.sent();
if (binaryPath) {

@@ -236,3 +243,3 @@ if (~binaryPath.indexOf(' ')) {

}
_a.label = 2;
_b.label = 2;
case 2:

@@ -242,4 +249,4 @@ if (!!binaryPath) return [3 /*break*/, 4];

case 3:
binaryPath = _a.sent();
_a.label = 4;
binaryPath = _b.sent();
_b.label = 4;
case 4:

@@ -249,4 +256,4 @@ if (!!binaryPath) return [3 /*break*/, 6];

case 5:
binaryPath = _a.sent();
_a.label = 6;
binaryPath = _b.sent();
_b.label = 6;
case 6:

@@ -253,0 +260,0 @@ this.debug("MongoBinary: Mongod binary path: " + binaryPath);

@@ -28,12 +28,49 @@ import { DebugFn, DebugPropT, DownloadProgressT } from '../types';

constructor({ platform, arch, downloadDir, version, checkMD5, debug }: MongoBinaryDownloadOpts);
/**
* Get the path of the already downloaded "mongod" file
* otherwise download it and then return the path
*/
getMongodPath(): Promise<string>;
/**
* Download the MongoDB Archive and check it against an MD5
* @returns The MongoDB Archive location
*/
startDownload(): Promise<string>;
/**
* Download MD5 file and check it against the MongoDB Archive
* @param urlForReferenceMD5 URL to download the MD5
* @param mongoDBArchive The MongoDB Archive file location
*/
makeMD5check(urlForReferenceMD5: string, mongoDBArchive: string): Promise<boolean | undefined>;
/**
* Download file from downloadUrl
* @param downloadUrl URL to download a File
*/
download(downloadUrl: string): Promise<string>;
/**
* Extract given Archive
* @param mongoDBArchive Archive location
* @returns extracted directory location
*/
extract(mongoDBArchive: string): Promise<string>;
/**
* Downlaod given httpOptions to tempDownloadLocation, then move it to downloadLocation
* @param httpOptions The httpOptions directly passed to https.get
* @param downloadLocation The location the File should be after the download
* @param tempDownloadLocation The location the File should be while downloading
*/
httpDownload(httpOptions: HttpDownloadOptions, downloadLocation: string, tempDownloadLocation: string): Promise<string>;
/**
* Print the Download Progress to STDOUT
* @param chunk A chunk to get the length
*/
printDownloadProgress(chunk: any): void;
locationExists(location: string): boolean;
/**
* Test if the location given is already used
* Does *not* dereference links
* @param location The Path to test
*/
locationExists(location: string): Promise<boolean>;
}
export {};
//# sourceMappingURL=MongoBinaryDownload.d.ts.map

@@ -41,2 +41,9 @@ "use strict";

};
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 });

@@ -53,17 +60,13 @@ var os_1 = __importDefault(require("os"));

var https_proxy_agent_1 = __importDefault(require("https-proxy-agent"));
var util_1 = require("util");
var resolve_config_1 = __importStar(require("./resolve-config"));
var MongoBinaryDownload = /** @class */ (function () {
function MongoBinaryDownload(_a) {
var platform = _a.platform, arch = _a.arch, downloadDir = _a.downloadDir, version = _a.version, checkMD5 = _a.checkMD5, debug = _a.debug;
this.platform = platform || os_1.default.platform();
this.arch = arch || os_1.default.arch();
this.version = version || MongoBinary_1.LATEST_VERSION;
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.downloadDir = path_1.default.resolve(downloadDir || 'mongodb-download');
if (checkMD5 === undefined) {
this.checkMD5 =
typeof process.env.MONGOMS_MD5_CHECK === 'string' &&
['1', 'on', 'yes', 'true'].indexOf(process.env.MONGOMS_MD5_CHECK.toLowerCase()) !== -1;
}
else {
this.checkMD5 = checkMD5;
}
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.dlProgress = {

@@ -87,2 +90,6 @@ current: 0,

}
/**
* Get the path of the already downloaded "mongod" file
* otherwise download it and then return the path
*/
MongoBinaryDownload.prototype.getMongodPath = function () {

@@ -96,13 +103,17 @@ return __awaiter(this, void 0, void 0, function () {

mongodPath = path_1.default.resolve(this.downloadDir, this.version, binaryName);
if (this.locationExists(mongodPath)) {
return [4 /*yield*/, this.locationExists(mongodPath)];
case 1:
if (_a.sent()) {
return [2 /*return*/, mongodPath];
}
return [4 /*yield*/, this.startDownload()];
case 1:
case 2:
mongoDBArchive = _a.sent();
return [4 /*yield*/, this.extract(mongoDBArchive)];
case 2:
case 3:
_a.sent();
fs_1.default.unlinkSync(mongoDBArchive);
if (this.locationExists(mongodPath)) {
return [4 /*yield*/, this.locationExists(mongodPath)];
case 4:
if (_a.sent()) {
return [2 /*return*/, mongodPath];

@@ -115,2 +126,6 @@ }

};
/**
* Download the MongoDB Archive and check it against an MD5
* @returns The MongoDB Archive location
*/
MongoBinaryDownload.prototype.startDownload = function () {

@@ -145,2 +160,7 @@ return __awaiter(this, void 0, void 0, function () {

};
/**
* Download MD5 file and check it against the MongoDB Archive
* @param urlForReferenceMD5 URL to download the MD5
* @param mongoDBArchive The MongoDB Archive file location
*/
MongoBinaryDownload.prototype.makeMD5check = function (urlForReferenceMD5, mongoDBArchive) {

@@ -163,3 +183,3 @@ return __awaiter(this, void 0, void 0, function () {

if (md5Remote !== md5Local) {
throw new Error('MongoBinaryDownload: md5 check is failed');
throw new Error('MongoBinaryDownload: md5 check failed');
}

@@ -171,2 +191,6 @@ return [2 /*return*/, true];

};
/**
* Download file from downloadUrl
* @param downloadUrl URL to download a File
*/
MongoBinaryDownload.prototype.download = function (downloadUrl) {

@@ -212,7 +236,13 @@ return __awaiter(this, void 0, void 0, function () {

};
/**
* Extract given Archive
* @param mongoDBArchive Archive location
* @returns extracted directory location
*/
MongoBinaryDownload.prototype.extract = function (mongoDBArchive) {
var _a;
return __awaiter(this, void 0, void 0, function () {
var binaryName, extractDir, filter;
return __generator(this, function (_a) {
switch (_a.label) {
return __generator(this, function (_b) {
switch (_b.label) {
case 0:

@@ -238,3 +268,3 @@ binaryName = this.platform === 'win32' ? 'mongod.exe' : 'mongod';

map: function (file) {
file.path = path_1.default.basename(file.path); // eslint-disable-line
file.path = path_1.default.basename(file.path);
return file;

@@ -244,6 +274,8 @@ },

case 1:
_a.sent();
if (!this.locationExists(path_1.default.resolve(this.downloadDir, this.version, binaryName))) {
throw new Error("MongoBinaryDownload: missing mongod binary in " + mongoDBArchive + " (downloaded from " + (this
._downloadingUrl || '') + "). Broken package in MongoDB distro?");
_b.sent();
return [4 /*yield*/, this.locationExists(path_1.default.resolve(this.downloadDir, this.version, binaryName))];
case 2:
if (!(_b.sent())) {
throw new Error("MongoBinaryDownload: missing mongod binary in " + mongoDBArchive + " (downloaded from " + (_a = this
._downloadingUrl, (_a !== null && _a !== void 0 ? _a : 'unkown')) + "). Broken archive from MongoDB Provider?");
}

@@ -255,2 +287,8 @@ return [2 /*return*/, extractDir];

};
/**
* Downlaod given httpOptions to tempDownloadLocation, then move it to downloadLocation
* @param httpOptions The httpOptions directly passed to https.get
* @param downloadLocation The location the File should be after the download
* @param tempDownloadLocation The location the File should be while downloading
*/
MongoBinaryDownload.prototype.httpDownload = function (httpOptions, downloadLocation, tempDownloadLocation) {

@@ -267,13 +305,23 @@ return __awaiter(this, void 0, void 0, function () {

response.pipe(fileStream);
fileStream.on('finish', function () {
if (_this.dlProgress.current < 1000000 && !httpOptions.path.endsWith('.md5')) {
var downloadUrl = _this._downloadingUrl || "https://" + httpOptions.hostname + "/" + httpOptions.path;
reject(new Error("Too small (" + _this.dlProgress.current + " bytes) mongod binary downloaded from " + downloadUrl));
return;
}
fileStream.close();
fs_1.default.renameSync(tempDownloadLocation, downloadLocation);
_this.debug("renamed " + tempDownloadLocation + " to " + downloadLocation);
resolve(downloadLocation);
});
fileStream.on('finish', function () { return __awaiter(_this, void 0, void 0, function () {
var downloadUrl;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (this.dlProgress.current < this.dlProgress.length &&
!httpOptions.path.endsWith('.md5')) {
downloadUrl = this._downloadingUrl || "https://" + httpOptions.hostname + "/" + httpOptions.path;
reject(new Error("Too small (" + this.dlProgress.current + " bytes) mongod binary downloaded from " + downloadUrl));
return [2 /*return*/];
}
fileStream.close();
return [4 /*yield*/, util_1.promisify(fs_1.default.rename)(tempDownloadLocation, downloadLocation)];
case 1:
_a.sent();
this.debug("renamed " + tempDownloadLocation + " to " + downloadLocation);
resolve(downloadLocation);
return [2 /*return*/];
}
});
}); });
response.on('data', function (chunk) {

@@ -283,3 +331,4 @@ _this.printDownloadProgress(chunk);

req.on('error', function (e) {
_this.debug('request error:', e);
// log it without having debug enabled
console.error("Couldnt download " + httpOptions.path + "!", e.message);
reject(e);

@@ -292,2 +341,6 @@ });

};
/**
* Print the Download Progress to STDOUT
* @param chunk A chunk to get the length
*/
MongoBinaryDownload.prototype.printDownloadProgress = function (chunk) {

@@ -305,12 +358,27 @@ this.dlProgress.current += chunk.length;

};
/**
* Test if the location given is already used
* Does *not* dereference links
* @param location The Path to test
*/
MongoBinaryDownload.prototype.locationExists = function (location) {
try {
fs_1.default.lstatSync(location);
return true;
}
catch (e) {
if (e.code !== 'ENOENT')
throw e;
return false;
}
return __awaiter(this, void 0, void 0, function () {
var e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, util_1.promisify(fs_1.default.lstat)(location)];
case 1:
_a.sent();
return [2 /*return*/, true];
case 2:
e_1 = _a.sent();
if (e_1.code !== 'ENOENT')
throw e_1;
return [2 /*return*/, false];
case 3: return [2 /*return*/];
}
});
});
};

@@ -317,0 +385,0 @@ return MongoBinaryDownload;

@@ -14,19 +14,87 @@ import { AnyOS, LinuxOS } from './getos';

constructor({ platform, arch, version, os }: MongoBinaryDownloadUrlOpts);
/**
* Assemble the URL to download
* Calls all the necessary functions to determine the URL
*/
getDownloadUrl(): Promise<string>;
/**
* Get the archive
* Version independent
*/
getArchiveName(): Promise<string>;
/**
* Get the archive for Windows
* (from: https://www.mongodb.org/dl/win32)
*/
getArchiveNameWin(): Promise<string>;
/**
* Get the archive for OSX (Mac)
* (from: https://www.mongodb.org/dl/osx)
*/
getArchiveNameOsx(): Promise<string>;
/**
* Get the archive for Linux
* (from: https://www.mongodb.org/dl/linux)
*/
getArchiveNameLinux(): Promise<string>;
/**
* Get the version string (with distro)
* @param os LinuxOS Object
*/
getLinuxOSVersionString(os: LinuxOS): string;
/**
* Get the version string for Debain
* @param os LinuxOS Object
*/
getDebianVersionString(os: LinuxOS): string;
/**
* Get the version string for Fedora
* @param os LinuxOS Object
*/
getFedoraVersionString(os: LinuxOS): string;
/**
* Get the version string for Red Hat Enterprise Linux
* @param os LinuxOS Object
*/
getRhelVersionString(os: LinuxOS): string;
/**
* Get the version string for ElementaryOS
* @param os LinuxOS Object
*/
getElementaryOSVersionString(os: LinuxOS): string;
/**
* Get the version string for Linux Mint
* @param os LinuxOS Object
*/
getMintVersionString(os: LinuxOS): string;
/**
* Linux Fallback
* @param os LinuxOS Object
*/
getLegacyVersionString(os: AnyOS): string;
/**
* Get the version string for Suse / OpenSuse
* @param os LinuxOS Object
*/
getSuseVersionString(os: LinuxOS): string;
/**
* Get the version string for Ubuntu
* @param os LinuxOS Object
*/
getUbuntuVersionString(os: LinuxOS): string;
/**
* Translate input platform to mongodb useable platfrom
* @example
* darwin -> osx
* @param platform The Platform to translate
*/
translatePlatform(platform: string): string;
/**
* Translate input arch to mongodb useable arch
* @example
* x64 -> x86_64
* @param platform The Platform to translate
*/
translateArch(arch: string, mongoPlatform: string): string;
}
//# sourceMappingURL=MongoBinaryDownloadUrl.d.ts.map

@@ -53,14 +53,20 @@ "use strict";

}
/**
* Assemble the URL to download
* Calls all the necessary functions to determine the URL
*/
MongoBinaryDownloadUrl.prototype.getDownloadUrl = function () {
var _a;
return __awaiter(this, void 0, void 0, function () {
var archive, downloadUrl;
return __generator(this, function (_a) {
switch (_a.label) {
var archive, downloadUrl, mirror;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.getArchiveName()];
case 1:
archive = _a.sent();
archive = _b.sent();
downloadUrl = resolve_config_1.default('DOWNLOAD_URL');
if (downloadUrl)
return [2 /*return*/, downloadUrl];
return [2 /*return*/, (resolve_config_1.default('DOWNLOAD_MIRROR') || 'https://fastdl.mongodb.org') + "/" + this.platform + "/" + archive];
mirror = (_a = resolve_config_1.default('DOWNLOAD_MIRROR'), (_a !== null && _a !== void 0 ? _a : 'https://fastdl.mongodb.org'));
return [2 /*return*/, mirror + "/" + this.platform + "/" + archive];
}

@@ -70,2 +76,6 @@ });

};
/**
* Get the archive
* Version independent
*/
MongoBinaryDownloadUrl.prototype.getArchiveName = function () {

@@ -87,3 +97,6 @@ return __awaiter(this, void 0, void 0, function () {

};
// https://www.mongodb.org/dl/win32
/**
* Get the archive for Windows
* (from: https://www.mongodb.org/dl/win32)
*/
MongoBinaryDownloadUrl.prototype.getArchiveNameWin = function () {

@@ -106,3 +119,6 @@ return __awaiter(this, void 0, void 0, function () {

};
// https://www.mongodb.org/dl/osx
/**
* Get the archive for OSX (Mac)
* (from: https://www.mongodb.org/dl/osx)
*/
MongoBinaryDownloadUrl.prototype.getArchiveNameOsx = function () {

@@ -127,3 +143,6 @@ return __awaiter(this, void 0, void 0, function () {

};
// https://www.mongodb.org/dl/linux
/**
* Get the archive for Linux
* (from: https://www.mongodb.org/dl/linux)
*/
MongoBinaryDownloadUrl.prototype.getArchiveNameLinux = function () {

@@ -157,2 +176,6 @@ return __awaiter(this, void 0, void 0, function () {

};
/**
* Get the version string (with distro)
* @param os LinuxOS Object
*/
MongoBinaryDownloadUrl.prototype.getLinuxOSVersionString = function (os) {

@@ -180,10 +203,24 @@ if (/ubuntu/i.test(os.dist)) {

}
else if (/arch/i.test(os.dist)) {
console.warn('There is no offical build of MongoDB for ArchLinux!');
}
else if (/alpine/i.test(os.dist)) {
console.warn('There is no offical build of MongoDB for Alpine!');
}
else if (/unkown/i.test(os.dist)) {
// in some cases this is redundant, but this is here to notify users to report if their Distro couldnt be parsed
// "unkown" is likely to happen if no release file / command could be found
console.warn('Couldnt parse dist infomation, please report this to https://github.com/nodkz/mongodb-memory-server/issues');
}
// this is when the os.dist couldnt be handled by MongoBinaryDownloadUrl
console.warn("Unknown linux distro " + os.dist + ", falling back to legacy MongoDB build");
else {
// warn if no case for the *parsed* distro is found
console.warn("Unknown linux distro " + os.dist);
}
// warn for the fallback
console.warn("Falling back to legacy MongoDB build!");
return this.getLegacyVersionString(os);
};
/**
* Get the version string for Debain
* @param os LinuxOS Object
*/
MongoBinaryDownloadUrl.prototype.getDebianVersionString = function (os) {

@@ -206,2 +243,6 @@ var name = 'debian';

};
/**
* Get the version string for Fedora
* @param os LinuxOS Object
*/
MongoBinaryDownloadUrl.prototype.getFedoraVersionString = function (os) {

@@ -221,2 +262,6 @@ var name = 'rhel';

};
/**
* Get the version string for Red Hat Enterprise Linux
* @param os LinuxOS Object
*/
MongoBinaryDownloadUrl.prototype.getRhelVersionString = function (os) {

@@ -238,10 +283,27 @@ var name = 'rhel';

};
/**
* Get the version string for ElementaryOS
* @param os LinuxOS Object
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
MongoBinaryDownloadUrl.prototype.getElementaryOSVersionString = function (os) {
// Elementary specific - get used ubuntu version
var ubuntuVersion = child_process_1.execSync('/usr/bin/lsb_release -u -rs');
return "ubuntu" + ubuntuVersion
.toString()
.replace('.', '')
.trim();
try {
// confirm it is actually a version, otherwise throw an error
parseFloat(ubuntuVersion.toString());
return "ubuntu" + ubuntuVersion
.toString()
.replace('.', '')
.trim();
}
catch (err) {
console.error('ElementaryOS "lsb_relese -u -rs" couldnt be executed!');
throw err;
}
};
/**
* Get the version string for Linux Mint
* @param os LinuxOS Object
*/
MongoBinaryDownloadUrl.prototype.getMintVersionString = function (os) {

@@ -268,2 +330,6 @@ var name = 'ubuntu';

};
/**
* Linux Fallback
* @param os LinuxOS Object
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars

@@ -273,9 +339,14 @@ MongoBinaryDownloadUrl.prototype.getLegacyVersionString = function (os) {

};
/**
* Get the version string for Suse / OpenSuse
* @param os LinuxOS Object
*/
MongoBinaryDownloadUrl.prototype.getSuseVersionString = function (os) {
var releaseMatch = os.release.match(/(^11|^12)/);
if (releaseMatch) {
return "suse" + releaseMatch[0];
}
return '';
return releaseMatch ? "suse" + releaseMatch[0] : '';
};
/**
* Get the version string for Ubuntu
* @param os LinuxOS Object
*/
MongoBinaryDownloadUrl.prototype.getUbuntuVersionString = function (os) {

@@ -320,2 +391,8 @@ var name = 'ubuntu';

};
/**
* Translate input platform to mongodb useable platfrom
* @example
* darwin -> osx
* @param platform The Platform to translate
*/
MongoBinaryDownloadUrl.prototype.translatePlatform = function (platform) {

@@ -328,3 +405,2 @@ switch (platform) {

case 'linux':
return 'linux';
case 'elementary OS':

@@ -338,2 +414,8 @@ return 'linux';

};
/**
* Translate input arch to mongodb useable arch
* @example
* x64 -> x86_64
* @param platform The Platform to translate
*/
MongoBinaryDownloadUrl.prototype.translateArch = function (arch, mongoPlatform) {

@@ -340,0 +422,0 @@ if (arch === 'ia32') {

export declare function setDefaultValue(key: string, value: string): void;
export declare function reInitializePackageJson(directory?: string): void;
/**
* Resolve "variableName" with a prefix of "ENV_CONFIG_PREFIX"
* @param variableName The variable to use
*/
export default function resolveConfig(variableName: string): string | undefined;
/**
* Convert "1, on, yes, true" to true (otherwise false)
* @param env The String / Environment Variable to check
*/
export declare function envToBool(env: string): boolean;
//# sourceMappingURL=resolve-config.d.ts.map

@@ -24,11 +24,19 @@ "use strict";

reInitializePackageJson();
/**
* Resolve "variableName" with a prefix of "ENV_CONFIG_PREFIX"
* @param variableName The variable to use
*/
function resolveConfig(variableName) {
return (process.env["" + ENV_CONFIG_PREFIX + variableName] ||
(packageJson &&
packageJson.config &&
packageJson.config.mongodbMemoryServer &&
packageJson.config.mongodbMemoryServer[camelcase_1.default(variableName)]) ||
defaultValues.get(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)));
}
exports.default = resolveConfig;
/**
* Convert "1, on, yes, true" to true (otherwise false)
* @param env The String / Environment Variable to check
*/
function envToBool(env) {
return ['1', 'on', 'yes', 'true'].indexOf(env.toLowerCase()) !== -1;
}
exports.envToBool = envToBool;
//# sourceMappingURL=resolve-config.js.map
{
"name": "mongodb-memory-server-core",
"version": "6.2.0",
"version": "6.2.1",
"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.",

@@ -78,3 +78,3 @@ "main": "lib/index",

},
"gitHead": "38124fea1cb263f3ab94e75a5f14e51e524c5a1c"
"gitHead": "bfc38a9f8a87a2fdd720beed3ae5ebca238db9a4"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc