mongodb-memory-server-core
Advanced tools
Comparing version 8.14.0-beta.1 to 8.14.0
/// <reference types="node" /> | ||
import { URL } from 'url'; | ||
import https from 'https'; | ||
import { MongoBinaryOpts } from './MongoBinary'; | ||
import { RequestOptions } from 'https'; | ||
export interface MongoBinaryDownloadProgress { | ||
@@ -17,3 +17,3 @@ current: number; | ||
_downloadingUrl?: string; | ||
/** These options are kind of raw, they are not run through DryMongoBinary.generateOptions */ | ||
/**These options are kind of raw, they are not run through DryMongoBinary.generateOptions */ | ||
binaryOpts: Required<MongoBinaryOpts>; | ||
@@ -88,3 +88,3 @@ get checkMD5(): boolean; | ||
*/ | ||
httpDownload(url: URL, httpOptions: https.RequestOptions, downloadLocation: string, tempDownloadLocation: string): Promise<string>; | ||
httpDownload(url: URL, httpOptions: RequestOptions, downloadLocation: string, tempDownloadLocation: string): Promise<string>; | ||
/** | ||
@@ -91,0 +91,0 @@ * Print the Download Progress to STDOUT |
@@ -10,3 +10,3 @@ "use strict"; | ||
const md5_file_1 = (0, tslib_1.__importDefault)(require("md5-file")); | ||
const https_1 = (0, tslib_1.__importDefault)(require("https")); | ||
const follow_redirects_1 = require("follow-redirects"); | ||
const zlib_1 = require("zlib"); | ||
@@ -315,6 +315,8 @@ const tar_stream_1 = (0, tslib_1.__importDefault)(require("tar-stream")); | ||
const downloadUrl = this.assignDownloadingURL(url); | ||
const maxRedirects = parseInt((0, resolveConfig_1.default)(resolveConfig_1.ResolveConfigVariables.MAX_REDIRECTS) || ''); | ||
const useHttpsOptions = Object.assign({ maxRedirects: Number.isNaN(maxRedirects) ? 2 : maxRedirects }, httpOptions); | ||
return new Promise((resolve, reject) => { | ||
log(`httpDownload: trying to download "${downloadUrl}"`); | ||
https_1.default | ||
.get(url, httpOptions, (response) => { | ||
follow_redirects_1.https | ||
.get(url, useHttpsOptions, (response) => { | ||
if (response.statusCode != 200) { | ||
@@ -321,0 +323,0 @@ if (response.statusCode === 403) { |
@@ -42,6 +42,2 @@ import { AnyOS, LinuxOS } from './getos'; | ||
/** | ||
* Parse and apply config option DISTRO | ||
*/ | ||
protected overwriteDistro(): void; | ||
/** | ||
* Get the version string (with distro) | ||
@@ -48,0 +44,0 @@ * @param os LinuxOS Object |
@@ -130,8 +130,5 @@ "use strict"; | ||
if (this.arch !== 'i686') { | ||
if (!this.os && (0, resolveConfig_1.resolveConfig)(resolveConfig_1.ResolveConfigVariables.DISTRO)) { | ||
if (!this.os) { | ||
this.os = yield (0, getos_1.getOS)(); | ||
} | ||
if ((0, resolveConfig_1.resolveConfig)(resolveConfig_1.ResolveConfigVariables.DISTRO)) { | ||
this.overwriteDistro(); | ||
} | ||
osString = this.getLinuxOSVersionString(this.os); | ||
@@ -149,25 +146,2 @@ } | ||
/** | ||
* Parse and apply config option DISTRO | ||
*/ | ||
overwriteDistro() { | ||
const env = (0, resolveConfig_1.resolveConfig)(resolveConfig_1.ResolveConfigVariables.DISTRO); | ||
if ((0, utils_1.isNullOrUndefined)(env)) { | ||
return; | ||
} | ||
const split = env.split('-'); | ||
const distro = split[0]; | ||
const release = split[1]; | ||
if ((0, utils_1.isNullOrUndefined)(distro)) { | ||
throw new errors_1.GenericMMSError('Expected DISTRO option to have a distro like "ubuntu-18.04"'); | ||
} | ||
if ((0, utils_1.isNullOrUndefined)(release)) { | ||
throw new errors_1.GenericMMSError('Expected DISTRO option to have a release like "ubuntu-18.04" (delimited by "-")'); | ||
} | ||
this.os = { | ||
os: 'linux', | ||
dist: distro, | ||
release: release, | ||
}; | ||
} | ||
/** | ||
* Get the version string (with distro) | ||
@@ -174,0 +148,0 @@ * @param os LinuxOS Object |
@@ -19,3 +19,3 @@ /** Enum of all possible config options */ | ||
USE_ARCHIVE_NAME_FOR_BINARY_NAME = "USE_ARCHIVE_NAME_FOR_BINARY_NAME", | ||
DISTRO = "DISTRO" | ||
MAX_REDIRECTS = "MAX_REDIRECTS" | ||
} | ||
@@ -25,3 +25,3 @@ /** The Prefix for Environmental values */ | ||
/** This Value exists here, because "defaultValues" can be changed with "setDefaultValue", but this property is constant */ | ||
export declare const DEFAULT_VERSION = "5.0.18"; | ||
export declare const DEFAULT_VERSION = "5.0.19"; | ||
/** Default values for some config options that require explicit setting, it is constant so that the default values cannot be interfered with */ | ||
@@ -28,0 +28,0 @@ export declare const defaultValues: Map<ResolveConfigVariables, string>; |
@@ -31,3 +31,3 @@ "use strict"; | ||
ResolveConfigVariables["USE_ARCHIVE_NAME_FOR_BINARY_NAME"] = "USE_ARCHIVE_NAME_FOR_BINARY_NAME"; | ||
ResolveConfigVariables["DISTRO"] = "DISTRO"; | ||
ResolveConfigVariables["MAX_REDIRECTS"] = "MAX_REDIRECTS"; | ||
})(ResolveConfigVariables = exports.ResolveConfigVariables || (exports.ResolveConfigVariables = {})); | ||
@@ -37,3 +37,3 @@ /** The Prefix for Environmental values */ | ||
/** This Value exists here, because "defaultValues" can be changed with "setDefaultValue", but this property is constant */ | ||
exports.DEFAULT_VERSION = '5.0.18'; | ||
exports.DEFAULT_VERSION = '5.0.19'; | ||
/** Default values for some config options that require explicit setting, it is constant so that the default values cannot be interfered with */ | ||
@@ -48,2 +48,3 @@ exports.defaultValues = new Map([ | ||
[ResolveConfigVariables.USE_ARCHIVE_NAME_FOR_BINARY_NAME, 'false'], | ||
[ResolveConfigVariables.MAX_REDIRECTS, '2'], | ||
]); | ||
@@ -50,0 +51,0 @@ /** |
{ | ||
"name": "mongodb-memory-server-core", | ||
"version": "8.14.0-beta.1", | ||
"version": "8.14.0", | ||
"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.", | ||
@@ -36,2 +36,3 @@ "main": "lib/index", | ||
"@types/find-cache-dir": "^3.2.1", | ||
"@types/follow-redirects": "^1.14.1", | ||
"@types/semver": "^7.5.0", | ||
@@ -50,2 +51,3 @@ "@types/tar-stream": "^2.2.2", | ||
"find-cache-dir": "^3.3.2", | ||
"follow-redirects": "^1.15.2", | ||
"get-port": "^5.1.1", | ||
@@ -56,5 +58,5 @@ "https-proxy-agent": "^5.0.1", | ||
"new-find-package-json": "^2.0.0", | ||
"semver": "^7.5.3", | ||
"semver": "^7.5.4", | ||
"tar-stream": "^2.1.4", | ||
"tslib": "^2.6.0", | ||
"tslib": "^2.6.1", | ||
"uuid": "^9.0.0", | ||
@@ -74,4 +76,3 @@ "yauzl": "^2.10.0" | ||
"tscheck": "tsc --noEmit" | ||
}, | ||
"optionalDependencies": {} | ||
} | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
3
382074
15
10
5513
+ Addedfollow-redirects@^1.15.2
+ Addedfollow-redirects@1.15.9(transitive)
Updatedsemver@^7.5.4
Updatedtslib@^2.6.1