You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

mongodb-runner

Package Overview
Dependencies
Maintainers
43
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongodb-runner - npm Package Compare versions

Comparing version

to
5.4.2

5

dist/mongologreader.d.ts

@@ -18,2 +18,7 @@ /// <reference types="node" />

}>;
export type BuildInfo = {
version: string | null;
modules: string[] | null;
};
export declare function filterLogStreamForBuildInfo(input: Readable): Promise<BuildInfo>;
//# sourceMappingURL=mongologreader.d.ts.map

44

dist/mongologreader.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.filterLogStreamForPort = exports.isFailureToSetupListener = exports.parseAnyLogEntry = exports.createLogEntryIterator = void 0;
exports.filterLogStreamForBuildInfo = exports.filterLogStreamForPort = exports.isFailureToSetupListener = exports.parseAnyLogEntry = exports.createLogEntryIterator = void 0;
const stream_1 = require("stream");

@@ -58,3 +58,3 @@ const readline_1 = require("readline");

if (logEntry.id === undefined &&
(match = /^waiting for connections on port (?<port>\d+)$/i.exec(logEntry.message))) {
(match = /^waiting for connections on port (?<port>\d+)( ssl)?$/i.exec(logEntry.message))) {
return +(match.groups?.port ?? '0');

@@ -88,2 +88,42 @@ }

exports.filterLogStreamForPort = filterLogStreamForPort;
function getBuildInfoFromLogEntry(logEntry) {
let match;
if (logEntry.id === 23403) {
return logEntry.attr.buildInfo;
}
if (logEntry.id === undefined &&
(match = /^db version v(?<version>.+)$/i.exec(logEntry.message))) {
return { version: match.groups?.version };
}
if (logEntry.id === undefined &&
(match = /^modules: (?<moduleList>.+)$/i.exec(logEntry.message))) {
return {
modules: match.groups?.moduleList
?.split(' ')
?.filter((module) => module !== 'none'),
};
}
return {};
}
async function filterLogStreamForBuildInfo(input) {
let buildInfo = { version: null, modules: null };
const inputDuplicate = input.pipe(new stream_1.PassThrough({ objectMode: true }));
try {
for await (const logEntry of inputDuplicate) {
if (logEntry.component !== 'CONTROL' ||
!['initandlisten', 'listener'].includes(logEntry.context)) {
continue;
}
buildInfo = { ...buildInfo, ...getBuildInfoFromLogEntry(logEntry) };
if (buildInfo.version) {
break;
}
}
}
finally {
input.unpipe(inputDuplicate);
}
return buildInfo;
}
exports.filterLogStreamForBuildInfo = filterLogStreamForBuildInfo;
//# sourceMappingURL=mongologreader.js.map

2

dist/mongoserver.d.ts

@@ -8,3 +8,3 @@ import { MongoClient } from 'mongodb';

args?: string[];
docker?: string;
docker?: string | string[];
}

@@ -11,0 +11,0 @@ export declare class MongoServer {

@@ -94,3 +94,6 @@ "use strict";

}
commandline.push(options.docker);
if (Array.isArray(options.docker))
commandline.push(...options.docker);
else
commandline.push(options.docker);
if (options.binDir) {

@@ -156,2 +159,7 @@ commandline.push(`/runner-bin/${options.binary}`);

});
(0, mongologreader_1.filterLogStreamForBuildInfo)(logEntryStream).then((buildInfo) => {
(srv.buildInfo = buildInfo),
(0, util_1.debug)('got server build info from log', srv.serverVersion, srv.serverVariant);
}, () => {
});
const { port } = await (0, mongologreader_1.filterLogStreamForPort)(logEntryStream);

@@ -209,4 +217,6 @@ (0, util_1.debug)('server listening on port', port);

async _populateBuildInfo() {
if (this.buildInfo?.version)
return;
this.buildInfo = await this.withClient(async (client) => await client.db('admin').command({ buildInfo: 1 }));
(0, util_1.debug)('got server build info', this.serverVersion, this.serverVariant);
(0, util_1.debug)('got server build info through client', this.serverVersion, this.serverVariant);
}

@@ -213,0 +223,0 @@ async withClient(fn) {

@@ -16,3 +16,3 @@ {

"homepage": "https://github.com/mongodb-js/devtools-shared",
"version": "5.4.1",
"version": "5.4.2",
"repository": {

@@ -54,3 +54,3 @@ "type": "git",

"dependencies": {
"@mongodb-js/mongodb-downloader": "^0.2.6",
"@mongodb-js/mongodb-downloader": "^0.2.7",
"debug": "^4.3.4",

@@ -62,6 +62,6 @@ "mongodb": "^5.6.0",

"devDependencies": {
"@mongodb-js/eslint-config-devtools": "0.9.9",
"@mongodb-js/mocha-config-devtools": "^1.0.0",
"@mongodb-js/eslint-config-devtools": "0.9.10",
"@mongodb-js/mocha-config-devtools": "^1.0.1",
"@mongodb-js/prettier-config-devtools": "^1.0.1",
"@mongodb-js/tsconfig-devtools": "^1.0.0",
"@mongodb-js/tsconfig-devtools": "^1.0.1",
"@types/chai": "^4.2.21",

@@ -83,3 +83,3 @@ "@types/debug": "^4.1.8",

},
"gitHead": "01baaf9aa1855c547724cde08985cb75fdcf2b63"
"gitHead": "9c41f233d529e7b5cac1849a0a07ca2076fcdbb0"
}

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