Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@mongosh/node-runtime-worker-thread

Package Overview
Dependencies
8
Maintainers
13
Versions
81
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.10.1 to 1.10.2

.prettierignore

11

.eslintrc.js

@@ -1,1 +0,10 @@

module.exports = require('../../config/eslintrc.base');
const { fixCygwinPath } = require('@mongodb-js/eslint-config-mongosh/utils');
module.exports = {
root: true,
extends: ['@mongodb-js/eslint-config-mongosh'],
parserOptions: {
tsconfigRootDir: fixCygwinPath(__dirname),
project: ['./tsconfig-lint.json'],
},
};

6

dist/child-process-evaluation-listener.d.ts
/// <reference types="node" />
import { ChildProcess } from 'child_process';
import { Exposed } from './rpc';
import type { ChildProcess } from 'child_process';
import type { Exposed } from './rpc';
import type { WorkerRuntime } from './index';
import { RuntimeEvaluationListener } from '@mongosh/browser-runtime-core';
import type { RuntimeEvaluationListener } from '@mongosh/browser-runtime-core';
export declare class ChildProcessEvaluationListener {

@@ -7,0 +7,0 @@ exposedListener: Exposed<Required<Omit<RuntimeEvaluationListener, 'onLoad' | 'getCryptLibraryOptions'>>>;

@@ -20,11 +20,11 @@ "use strict";

var _a, _b, _c;
return (_c = (_b = (_a = workerRuntime.evaluationListener) === null || _a === void 0 ? void 0 : _a.setConfig) === null || _b === void 0 ? void 0 : _b.call(_a, key, value)) !== null && _c !== void 0 ? _c : Promise.resolve('ignored');
return ((_c = (_b = (_a = workerRuntime.evaluationListener) === null || _a === void 0 ? void 0 : _a.setConfig) === null || _b === void 0 ? void 0 : _b.call(_a, key, value)) !== null && _c !== void 0 ? _c : Promise.resolve('ignored'));
},
resetConfig(key) {
var _a, _b, _c;
return (_c = (_b = (_a = workerRuntime.evaluationListener) === null || _a === void 0 ? void 0 : _a.resetConfig) === null || _b === void 0 ? void 0 : _b.call(_a, key)) !== null && _c !== void 0 ? _c : Promise.resolve('ignored');
return ((_c = (_b = (_a = workerRuntime.evaluationListener) === null || _a === void 0 ? void 0 : _a.resetConfig) === null || _b === void 0 ? void 0 : _b.call(_a, key)) !== null && _c !== void 0 ? _c : Promise.resolve('ignored'));
},
validateConfig(key, value) {
var _a, _b, _c;
return (_c = (_b = (_a = workerRuntime.evaluationListener) === null || _a === void 0 ? void 0 : _a.validateConfig) === null || _b === void 0 ? void 0 : _b.call(_a, key, value)) !== null && _c !== void 0 ? _c : Promise.resolve(null);
return ((_c = (_b = (_a = workerRuntime.evaluationListener) === null || _a === void 0 ? void 0 : _a.validateConfig) === null || _b === void 0 ? void 0 : _b.call(_a, key, value)) !== null && _c !== void 0 ? _c : Promise.resolve(null));
},

@@ -46,3 +46,3 @@ getConfig(key) {

return ((_c = (_b = (_a = workerRuntime.evaluationListener) === null || _a === void 0 ? void 0 : _a.onExit) === null || _b === void 0 ? void 0 : _b.call(_a, exitCode)) !== null && _c !== void 0 ? _c : Promise.resolve());
}
},
}, childProcess);

@@ -49,0 +49,0 @@ }

/// <reference types="node" />
import { ChildProcess } from 'child_process';
import { MongoshBus } from '@mongosh/types';
import { Exposed } from './rpc';
import type { ChildProcess } from 'child_process';
import type { MongoshBus } from '@mongosh/types';
import type { Exposed } from './rpc';
export declare class ChildProcessMongoshBus {

@@ -6,0 +6,0 @@ exposedEmitter: Exposed<MongoshBus>;

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

throw new Error("Can't use `once` method on ChildProcessMongoshBus");
}
},
}, childProcess);

@@ -19,0 +19,0 @@ this.exposedEmitter = exposedEmitter;

/// <reference types="node" />
import { SpawnOptionsWithoutStdio } from 'child_process';
import { Runtime, RuntimeEvaluationListener, RuntimeEvaluationResult } from '@mongosh/browser-runtime-core';
import type { SpawnOptionsWithoutStdio } from 'child_process';
import type { Runtime, RuntimeEvaluationListener, RuntimeEvaluationResult } from '@mongosh/browser-runtime-core';
import type { MongoshBus } from '@mongosh/types';
import type { CompassServiceProvider } from '@mongosh/service-provider-server';
declare type DevtoolsConnectOptions = Parameters<(typeof CompassServiceProvider)['connect']>[1];
type DevtoolsConnectOptions = Parameters<(typeof CompassServiceProvider)['connect']>[1];
declare class WorkerRuntime implements Runtime {

@@ -8,0 +8,0 @@ private initOptions;

@@ -1,2 +0,2 @@

export declare type UNLOCKED = 'UNLOCKED';
export type UNLOCKED = 'UNLOCKED';
export declare class Lock {

@@ -3,0 +3,0 @@ private static UNLOCK_TOKEN;

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

if (this.isLocked()) {
throw new Error('Can\'t create another lock while locked');
throw new Error("Can't create another lock while locked");
}

@@ -14,0 +14,0 @@ this.promise = new Promise((resolve) => {

export declare function serialize(data: unknown): string;
export declare function deserialize<T = unknown>(str: string): T | string;
declare type RPCMessageBus = {
type RPCMessageBus = {
on: Function;

@@ -16,3 +16,3 @@ off: Function;

export declare const cancel: unique symbol;
export declare type Exposed<T> = {
export type Exposed<T> = {
[k in keyof T]: T[k] & {

@@ -25,6 +25,6 @@ close(): void;

export declare function exposeAll<O>(obj: O, messageBus: RPCMessageBus): Exposed<O>;
export declare type Caller<Impl, Keys extends keyof Impl = keyof Impl> = CancelableMethods<Pick<Impl, Keys>> & {
export type Caller<Impl, Keys extends keyof Impl = keyof Impl> = CancelableMethods<Pick<Impl, Keys>> & {
[cancel]: () => void;
};
export declare function createCaller<Impl extends {}>(methodNames: Extract<keyof Impl, string>[], messageBus: RPCMessageBus, processors?: Partial<Record<typeof methodNames[number], (...input: any[]) => any[]>>): Caller<Impl, typeof methodNames[number]>;
export declare function createCaller<Impl extends {}>(methodNames: Extract<keyof Impl, string>[], messageBus: RPCMessageBus, processors?: Partial<Record<(typeof methodNames)[number], (...input: any[]) => any[]>>): Caller<Impl, (typeof methodNames)[number]>;
export {};

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

type: RPCMessageTypes.Error,
payload: (0, serializer_1.serializeError)(e)
payload: (0, serializer_1.serializeError)(e),
});

@@ -89,3 +89,3 @@ }

return data;
}
},
};

@@ -113,3 +113,3 @@ }

});
}
},
});

@@ -145,3 +145,3 @@ return obj;

}
}
},
});

@@ -148,0 +148,0 @@ return obj;

@@ -1,2 +0,2 @@

import { RuntimeEvaluationResult } from '@mongosh/browser-runtime-core';
import type { RuntimeEvaluationResult } from '@mongosh/browser-runtime-core';
import type { DevtoolsConnectOptions } from '@mongosh/service-provider-server';

@@ -10,5 +10,5 @@ export declare function serializeError(err: Error): Error;

}
export declare function serializeEvaluationResult({ type, printable, source }: RuntimeEvaluationResult): RuntimeEvaluationResult;
export declare function deserializeEvaluationResult({ type, printable, source }: RuntimeEvaluationResult): RuntimeEvaluationResult;
export declare function serializeEvaluationResult({ type, printable, source, }: RuntimeEvaluationResult): RuntimeEvaluationResult;
export declare function deserializeEvaluationResult({ type, printable, source, }: RuntimeEvaluationResult): RuntimeEvaluationResult;
export declare function serializeConnectOptions(options: Readonly<DevtoolsConnectOptions>): DevtoolsConnectOptions;
export declare function deserializeConnectOptions(options: Readonly<DevtoolsConnectOptions>): DevtoolsConnectOptions;

@@ -32,4 +32,4 @@ "use strict";

SerializedResultTypes["SerializedShellApiResult"] = "SerializedShellApiResult";
})(SerializedResultTypes = exports.SerializedResultTypes || (exports.SerializedResultTypes = {}));
function serializeEvaluationResult({ type, printable, source }) {
})(SerializedResultTypes || (exports.SerializedResultTypes = SerializedResultTypes = {}));
function serializeEvaluationResult({ type, printable, source, }) {
if (isPrimitive(printable)) {

@@ -42,3 +42,3 @@ return { type, printable, source };

printable: serializeError(printable),
source
source,
};

@@ -50,3 +50,3 @@ }

printable: (0, util_1.inspect)(printable),
source
source,
};

@@ -58,8 +58,8 @@ }

origType: type,
serializedValue: bson_1.EJSON.serialize(printable)
}
serializedValue: bson_1.EJSON.serialize(printable),
},
};
}
exports.serializeEvaluationResult = serializeEvaluationResult;
function deserializeEvaluationResult({ type, printable, source }) {
function deserializeEvaluationResult({ type, printable, source, }) {
if (type === SerializedResultTypes.SerializedErrorResult) {

@@ -72,3 +72,3 @@ return { type, printable: deserializeError(printable), source };

printable: bson_1.EJSON.deserialize(printable.serializedValue),
source
source,
};

@@ -79,6 +79,3 @@ }

exports.deserializeEvaluationResult = deserializeEvaluationResult;
const autoEncryptionBSONOptions = [
'schemaMap',
'encryptedFieldsMap'
];
const autoEncryptionBSONOptions = ['schemaMap', 'encryptedFieldsMap'];
function serializeConnectOptions(options) {

@@ -91,3 +88,3 @@ var _a;

...serializedOptions.autoEncryption,
[autoEncryptionOption]: bson_1.EJSON.serialize(serializedOptions.autoEncryption[autoEncryptionOption], { relaxed: false })
[autoEncryptionOption]: bson_1.EJSON.serialize(serializedOptions.autoEncryption[autoEncryptionOption], { relaxed: false }),
};

@@ -106,3 +103,3 @@ }

...deserializedOptions.autoEncryption,
[autoEncryptionOption]: bson_1.EJSON.deserialize(deserializedOptions.autoEncryption[autoEncryptionOption], { relaxed: false })
[autoEncryptionOption]: bson_1.EJSON.deserialize(deserializedOptions.autoEncryption[autoEncryptionOption], { relaxed: false }),
};

@@ -109,0 +106,0 @@ }

/// <reference types="node" />
import { ChildProcess, SpawnOptions, StdioNull, StdioPipe } from 'child_process';
/// <reference types="node" />
import type { ChildProcess, SpawnOptions, StdioNull, StdioPipe } from 'child_process';
export declare function kill(childProcess: ChildProcess, code?: NodeJS.Signals | number): Promise<void>;
export default function spawnChildFromSource(src: string, spawnOptions?: Omit<SpawnOptions, 'stdio'>, timeoutMs?: number, _stdout?: StdioNull | StdioPipe, _stderr?: StdioNull | StdioPipe): Promise<ChildProcess>;

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

stdio: ['pipe', _stdout, _stderr, 'ipc'],
...spawnOptions
...spawnOptions,
});

@@ -21,0 +21,0 @@ if (!childProcess.stdin) {

@@ -1,9 +0,9 @@

import { Runtime, RuntimeEvaluationListener } from '@mongosh/browser-runtime-core';
import type { Runtime, RuntimeEvaluationListener } from '@mongosh/browser-runtime-core';
import { CompassServiceProvider } from '@mongosh/service-provider-server';
import { InterruptHandle } from 'interruptor';
declare type DevtoolsConnectOptions = Parameters<(typeof CompassServiceProvider)['connect']>[1];
export declare type WorkerRuntimeEvaluationListener = RuntimeEvaluationListener & {
import type { InterruptHandle } from 'interruptor';
type DevtoolsConnectOptions = Parameters<(typeof CompassServiceProvider)['connect']>[1];
export type WorkerRuntimeEvaluationListener = RuntimeEvaluationListener & {
onRunInterruptible(handle: InterruptHandle | null): void;
};
export declare type WorkerRuntime = Runtime & {
export type WorkerRuntime = Runtime & {
init(uri: string, driverOptions?: DevtoolsConnectOptions, cliOptions?: {

@@ -10,0 +10,0 @@ nodb?: boolean;

{
"name": "@mongosh/node-runtime-worker-thread",
"version": "1.10.1",
"version": "1.10.2",
"description": "MongoDB shell runtime that lives in a worker thread",

@@ -23,18 +23,29 @@ "homepage": "https://github.com/mongodb-js/mongosh",

"test-ci": "node ../../scripts/run-if-package-requested.js npm test",
"lint": "eslint --report-unused-disable-directives \"./{src,test}/**/*.{js,ts,tsx}\"",
"check": "npm run lint && depcheck",
"webpack-build": "npm run compile-ts && webpack --mode production",
"webpack-build-dev": "npm run compile-ts && webpack --mode development",
"compile-ts": "tsc -p tsconfig.json",
"prepublish": "npm run webpack-build"
"eslint": "eslint",
"lint": "npm run eslint . && npm run prettier -- --check .",
"check": "npm run lint && npm run depcheck",
"depcheck": "depcheck",
"webpack-build": "npm run compile && webpack --mode production",
"webpack-build-dev": "npm run compile && webpack --mode development",
"compile": "tsc -p tsconfig.json",
"prepublish": "npm run webpack-build",
"prettier": "prettier",
"reformat": "npm run prettier -- --write . && npm run eslint --fix"
},
"devDependencies": {
"@mongosh/browser-runtime-core": "1.10.1",
"@mongosh/browser-runtime-electron": "1.10.1",
"@mongosh/service-provider-core": "1.10.1",
"@mongosh/service-provider-server": "1.10.1",
"@mongosh/types": "1.10.1",
"bson": "^5.2.0",
"@mongodb-js/eslint-config-mongosh": "1.10.2",
"@mongodb-js/prettier-config-devtools": "^1.0.1",
"@mongodb-js/tsconfig-mongosh": "1.10.2",
"@mongosh/browser-runtime-core": "1.10.2",
"@mongosh/browser-runtime-electron": "1.10.2",
"@mongosh/service-provider-core": "1.10.2",
"@mongosh/service-provider-server": "1.10.2",
"@mongosh/types": "1.10.2",
"bson": "^5.3.0",
"depcheck": "^1.4.3",
"eslint": "^7.25.0",
"mocha": "^10.2.0",
"postmsg-rpc": "^2.4.0"
"postmsg-rpc": "^2.4.0",
"prettier": "^2.8.8",
"webpack-merge": "^5.8.0"
},

@@ -45,3 +56,3 @@ "dependencies": {

},
"gitHead": "05ad91b4dd40382a13f27abe1ae8c3f9f52a38f7"
"gitHead": "9351a54cc24def10a97fe7f8c7b455c02fdce62e"
}

@@ -1,11 +0,17 @@

import { ChildProcess } from 'child_process';
import { exposeAll, Exposed, close } from './rpc';
import type { ChildProcess } from 'child_process';
import type { Exposed } from './rpc';
import { exposeAll, close } from './rpc';
import type { WorkerRuntime } from './index';
import { deserializeEvaluationResult } from './serializer';
import { RuntimeEvaluationListener } from '@mongosh/browser-runtime-core';
import type { RuntimeEvaluationListener } from '@mongosh/browser-runtime-core';
export class ChildProcessEvaluationListener {
exposedListener: Exposed<Required<Omit<RuntimeEvaluationListener, 'onLoad' | 'getCryptLibraryOptions'>>>;
exposedListener: Exposed<
Required<
Omit<RuntimeEvaluationListener, 'onLoad' | 'getCryptLibraryOptions'>
>
>;
constructor(workerRuntime: WorkerRuntime, childProcess: ChildProcess) {
// @ts-expect-error TODO(MONGOSH-1506) fix the typing
this.exposedListener = exposeAll(

@@ -23,15 +29,24 @@ {

setConfig(key, value) {
return workerRuntime.evaluationListener?.setConfig?.(key, value) ?? Promise.resolve('ignored');
return (
workerRuntime.evaluationListener?.setConfig?.(key, value) ??
Promise.resolve('ignored')
);
},
resetConfig(key) {
return workerRuntime.evaluationListener?.resetConfig?.(key) ?? Promise.resolve('ignored');
return (
workerRuntime.evaluationListener?.resetConfig?.(key) ??
Promise.resolve('ignored')
);
},
validateConfig(key, value) {
return workerRuntime.evaluationListener?.validateConfig?.(key, value) ?? Promise.resolve(null);
return (
workerRuntime.evaluationListener?.validateConfig?.(key, value) ??
Promise.resolve(null)
);
},
getConfig(key) {
return workerRuntime.evaluationListener?.getConfig?.(key) as any;
return workerRuntime.evaluationListener?.getConfig?.(key);
},
listConfigOptions() {
return workerRuntime.evaluationListener?.listConfigOptions?.() as any;
return workerRuntime.evaluationListener?.listConfigOptions?.();
},

@@ -46,3 +61,3 @@ onClearCommand() {

);
}
},
},

@@ -49,0 +64,0 @@ childProcess

@@ -1,4 +0,5 @@

import { ChildProcess } from 'child_process';
import { MongoshBus } from '@mongosh/types';
import { exposeAll, Exposed, close } from './rpc';
import type { ChildProcess } from 'child_process';
import type { MongoshBus } from '@mongosh/types';
import type { Exposed } from './rpc';
import { exposeAll, close } from './rpc';

@@ -19,3 +20,3 @@ export class ChildProcessMongoshBus {

throw new Error("Can't use `once` method on ChildProcessMongoshBus");
}
},
},

@@ -22,0 +23,0 @@ childProcess

import path from 'path';
import { ChildProcess, fork, spawn } from 'child_process';
import { Caller, cancel, createCaller } from './rpc';
import type { ChildProcess } from 'child_process';
import { fork, spawn } from 'child_process';
import type { Caller } from './rpc';
import { cancel, createCaller } from './rpc';
import { expect } from 'chai';
import { WorkerRuntime } from './worker-runtime';
import type { WorkerRuntime } from './worker-runtime';
import { once } from 'events';

@@ -17,7 +19,7 @@ import { promisify } from 'util';

describe('child process worker proxy', () => {
describe('child process worker proxy', function () {
let caller: Caller<WorkerRuntime>;
let childProcess: ChildProcess;
afterEach(() => {
afterEach(function () {
if (caller) {

@@ -34,3 +36,3 @@ caller[cancel]();

it('should start worker runtime and proxy calls', async() => {
it('should start worker runtime and proxy calls', async function () {
childProcess = fork(childProcessModulePath);

@@ -43,11 +45,19 @@ caller = createCaller(['init', 'evaluate'], childProcess);

it('should exit on its own when the parent process disconnects', async() => {
const intermediateProcess = spawn(process.execPath,
['-e', `require("child_process")
it('should exit on its own when the parent process disconnects', async function () {
const intermediateProcess = spawn(
process.execPath,
[
'-e',
`require("child_process")
.fork(${JSON.stringify(childProcessModulePath)})
.on("message", function(m) { console.log("message " + m + " from " + this.pid) })`],
{ stdio: ['pipe', 'pipe', 'inherit'] });
.on("message", function(m) { console.log("message " + m + " from " + this.pid) })`,
],
{ stdio: ['pipe', 'pipe', 'inherit'] }
);
// Make sure the outer child process runs and has created the inner child process
const [message] = await once(intermediateProcess.stdout.setEncoding('utf8'), 'data');
const [message] = await once(
intermediateProcess.stdout.setEncoding('utf8'),
'data'
);
const match = message.trim().match(/^message ready from (?<pid>\d+)$/);

@@ -54,0 +64,0 @@ expect(match).to.not.equal(null);

@@ -20,3 +20,4 @@ /* istanbul ignore file */

import { exposeAll, createCaller } from './rpc';
import { InterruptHandle, interrupt as nativeInterrupt } from 'interruptor';
import type { InterruptHandle } from 'interruptor';
import { interrupt as nativeInterrupt } from 'interruptor';

@@ -29,4 +30,4 @@ const workerRuntimeSrcPath =

const workerReadyPromise: Promise<void> = (async() => {
const waitForReadyMessage = async() => {
const workerReadyPromise: Promise<void> = (async () => {
const waitForReadyMessage = async () => {
let msg: string;

@@ -38,3 +39,3 @@ while (([msg] = await once(workerProcess, 'message'))) {

const waitForError = async() => {
const waitForError = async () => {
const [err] = await once(workerProcess, 'error');

@@ -47,6 +48,3 @@ if (err) {

await Promise.race([
waitForReadyMessage(),
waitForError()
]);
await Promise.race([waitForReadyMessage(), waitForError()]);
})();

@@ -61,3 +59,2 @@

let interruptHandle: InterruptHandle | null = null;

@@ -80,3 +77,3 @@

return interrupt();
}
},
}

@@ -90,3 +87,3 @@ );

return target.call(thisArg, ...Array.from(argumentsList));
}
},
});

@@ -106,4 +103,11 @@ }

[
'onPrint', 'onPrompt', 'getConfig', 'setConfig', 'resetConfig',
'validateConfig', 'listConfigOptions', 'onClearCommand', 'onExit'
'onPrint',
'onPrompt',
'getConfig',
'setConfig',
'resetConfig',
'validateConfig',
'listConfigOptions',
'onClearCommand',
'onExit',
],

@@ -115,3 +119,3 @@ process

interruptHandle = handle;
}
},
}

@@ -128,4 +132,3 @@ );

process.nextTick(() => {
// eslint-disable-next-line chai-friendly/no-unused-expressions
process.send?.('ready');
});

@@ -5,3 +5,3 @@ import path from 'path';

import sinonChai from 'sinon-chai';
import { MongoshBus } from '@mongosh/types';
import type { MongoshBus } from '@mongosh/types';
import { startTestServer } from '../../../testing/integration-testing-hooks';

@@ -14,3 +14,3 @@ import { WorkerRuntime } from '../dist/index';

productName: 'Test Product',
productDocsLink: 'https://example.com/'
productDocsLink: 'https://example.com/',
});

@@ -21,3 +21,3 @@

function createMockEventEmitter() {
return (sinon.stub({ on() {}, emit() {} }) as unknown) as MongoshBus;
return sinon.stub({ on() {}, emit() {} }) as unknown as MongoshBus;
}

@@ -29,6 +29,6 @@

describe('WorkerRuntime', () => {
describe('WorkerRuntime', function () {
let runtime: WorkerRuntime;
afterEach(async() => {
afterEach(async function () {
if (runtime) {

@@ -40,3 +40,3 @@ await runtime.terminate();

describe('spawn errors', () => {
describe('spawn errors', function () {
const brokenScript = path.resolve(

@@ -49,10 +49,14 @@ __dirname,

afterEach(() => {
delete process.env.CHILD_PROCESS_PROXY_SRC_PATH_DO_NOT_USE_THIS_EXCEPT_FOR_TESTING;
afterEach(function () {
delete process
.env.CHILD_PROCESS_PROXY_SRC_PATH_DO_NOT_USE_THIS_EXCEPT_FOR_TESTING;
});
it('should return init error if child process failed to spawn', async() => {
process.env.CHILD_PROCESS_PROXY_SRC_PATH_DO_NOT_USE_THIS_EXCEPT_FOR_TESTING = brokenScript;
it('should return init error if child process failed to spawn', async function () {
process.env.CHILD_PROCESS_PROXY_SRC_PATH_DO_NOT_USE_THIS_EXCEPT_FOR_TESTING =
brokenScript;
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, { nodb: true });
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, {
nodb: true,
});

@@ -68,11 +72,19 @@ let err;

expect(err).to.be.instanceof(Error);
expect(err).to.have.property('message').match(/Child process failed to start/);
expect(err)
.to.have.property('message')
.match(/Child process failed to start/);
});
it('should return init error if worker in child process failed to spawn', async() => {
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, { nodb: true }, {
env: {
WORKER_RUNTIME_SRC_PATH_DO_NOT_USE_THIS_EXCEPT_FOR_TESTING: brokenScript
it('should return init error if worker in child process failed to spawn', async function () {
runtime = new WorkerRuntime(
'mongodb://nodb/',
dummyOptions,
{ nodb: true },
{
env: {
WORKER_RUNTIME_SRC_PATH_DO_NOT_USE_THIS_EXCEPT_FOR_TESTING:
brokenScript,
},
}
});
);

@@ -88,9 +100,13 @@ let err;

expect(err).to.be.instanceof(Error);
expect(err).to.have.property('message').match(/Worker thread failed to start/);
expect(err)
.to.have.property('message')
.match(/Worker thread failed to start/);
});
});
describe('evaluate', () => {
it('should evaluate and return basic values', async() => {
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, { nodb: true });
describe('evaluate', function () {
it('should evaluate and return basic values', async function () {
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, {
nodb: true,
});
const result = await runtime.evaluate('1+1');

@@ -101,5 +117,7 @@

describe('errors', () => {
it("should throw an error if it's thrown during evaluation", async() => {
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, { nodb: true });
describe('errors', function () {
it("should throw an error if it's thrown during evaluation", async function () {
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, {
nodb: true,
});

@@ -122,4 +140,6 @@ let err: Error;

it("should return an error if it's returned from evaluation", async() => {
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, { nodb: true });
it("should return an error if it's returned from evaluation", async function () {
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, {
nodb: true,
});

@@ -140,7 +160,10 @@ const { printable } = await runtime.evaluate(

describe('getCompletions', () => {
describe('getCompletions', function () {
const testServer = startTestServer('shared');
it('should return completions', async() => {
runtime = new WorkerRuntime(await testServer.connectionString(), dummyOptions);
it('should return completions', async function () {
runtime = new WorkerRuntime(
await testServer.connectionString(),
dummyOptions
);
const completions = await runtime.getCompletions('db.coll1.f');

@@ -152,7 +175,10 @@

describe('getShellPrompt', () => {
describe('getShellPrompt', function () {
const testServer = startTestServer('shared');
it('should return prompt when connected to the server', async() => {
runtime = new WorkerRuntime(await testServer.connectionString(), dummyOptions);
it('should return prompt when connected to the server', async function () {
runtime = new WorkerRuntime(
await testServer.connectionString(),
dummyOptions
);
const result = await runtime.getShellPrompt();

@@ -164,9 +190,11 @@

describe('setEvaluationListener', () => {
it('allows to set evaluation listener for runtime', async() => {
describe('setEvaluationListener', function () {
it('allows to set evaluation listener for runtime', async function () {
const evalListener = {
onPrompt: sinon.spy(() => 'password123')
onPrompt: sinon.spy(() => 'password123'),
};
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, { nodb: true });
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, {
nodb: true,
});

@@ -182,6 +210,6 @@ runtime.setEvaluationListener(evalListener);

describe('eventEmitter', () => {
describe('eventEmitter', function () {
const testServer = startTestServer('shared');
it('should propagate emitted events from worker', async() => {
it('should propagate emitted events from worker', async function () {
const eventEmitter = createMockEventEmitter();

@@ -199,12 +227,15 @@

expect(eventEmitter.emit).to.have.been.calledWith('mongosh:api-call-with-arguments', {
arguments: {},
class: 'Database',
db: 'test',
method: 'getCollectionNames'
});
expect(eventEmitter.emit).to.have.been.calledWith(
'mongosh:api-call-with-arguments',
{
arguments: {},
class: 'Database',
db: 'test',
method: 'getCollectionNames',
}
);
});
});
describe('terminate', () => {
describe('terminate', function () {
function isRunning(pid: number): boolean {

@@ -221,5 +252,6 @@ try {

// strings to make TS happy
/* eslint-disable dot-notation */
it('should terminate child process', async() => {
const runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, { nodb: true });
it('should terminate child process', async function () {
const runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, {
nodb: true,
});
await runtime.terminate();

@@ -230,11 +262,14 @@ expect(runtime['childProcess']).to.have.property('killed', true);

it('should remove all listeners from childProcess', async() => {
const runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, { nodb: true });
it('should remove all listeners from childProcess', async function () {
const runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, {
nodb: true,
});
await runtime.terminate();
expect(runtime['childProcess'].listenerCount('message')).to.equal(0);
});
/* eslint-enable dot-notation */
it('should cancel any in-flight runtime calls', async() => {
const runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, { nodb: true });
it('should cancel any in-flight runtime calls', async function () {
const runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, {
nodb: true,
});
let err: Error;

@@ -244,7 +279,7 @@ try {

runtime.evaluate('while(true){}'),
(async() => {
(async () => {
// smol sleep to make sure we actually issued a call
await sleep(100);
await runtime.terminate();
})()
})(),
]);

@@ -259,5 +294,7 @@ } catch (e: any) {

describe('interrupt', () => {
it('should interrupt in-flight async tasks', async() => {
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, { nodb: true });
describe('interrupt', function () {
it('should interrupt in-flight async tasks', async function () {
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, {
nodb: true,
});

@@ -271,3 +308,3 @@ await runtime.waitForRuntimeToBeReady();

runtime.evaluate('sleep(1000000)'),
(async() => {
(async () => {
// This is flaky when not enought time given to the worker to

@@ -278,3 +315,3 @@ // finish the sync part of the work. If it causes too much issues

await runtime.interrupt();
})()
})(),
]);

@@ -291,4 +328,6 @@ } catch (e: any) {

it('should interrupt in-flight synchronous tasks', async() => {
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, { nodb: true });
it('should interrupt in-flight synchronous tasks', async function () {
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, {
nodb: true,
});

@@ -302,6 +341,6 @@ await runtime.waitForRuntimeToBeReady();

runtime.evaluate('while(true){}'),
(async() => {
(async () => {
await sleep(200);
await runtime.interrupt();
})()
})(),
]);

@@ -318,4 +357,6 @@ } catch (e: any) {

it('should allow to evaluate again after interruption', async() => {
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, { nodb: true });
it('should allow to evaluate again after interruption', async function () {
runtime = new WorkerRuntime('mongodb://nodb/', dummyOptions, {
nodb: true,
});

@@ -327,6 +368,6 @@ await runtime.waitForRuntimeToBeReady();

runtime.evaluate('while(true){}'),
(async() => {
(async () => {
await sleep(200);
await runtime.interrupt();
})()
})(),
]);

@@ -333,0 +374,0 @@ } catch (e: any) {

/* istanbul ignore file */
/* ^^^ we test the dist directly, so isntanbul can't calculate the coverage correctly */
import { ChildProcess, spawn, SpawnOptionsWithoutStdio } from 'child_process';
import {
import type { ChildProcess, SpawnOptionsWithoutStdio } from 'child_process';
import { spawn } from 'child_process';
import type {
Runtime,
RuntimeEvaluationListener,
RuntimeEvaluationResult
RuntimeEvaluationResult,
} from '@mongosh/browser-runtime-core';

@@ -14,10 +15,16 @@ import type { MongoshBus } from '@mongosh/types';

import { kill } from './spawn-child-from-source';
import { Caller, createCaller, cancel } from './rpc';
import type { Caller } from './rpc';
import { createCaller, cancel } from './rpc';
import { ChildProcessEvaluationListener } from './child-process-evaluation-listener';
import type { WorkerRuntime as WorkerThreadWorkerRuntime } from './worker-runtime';
import { deserializeEvaluationResult, serializeConnectOptions } from './serializer';
import {
deserializeEvaluationResult,
serializeConnectOptions,
} from './serializer';
import { ChildProcessMongoshBus } from './child-process-mongosh-bus';
import type { CompassServiceProvider } from '@mongosh/service-provider-server';
type DevtoolsConnectOptions = Parameters<(typeof CompassServiceProvider)['connect']>[1];
type DevtoolsConnectOptions = Parameters<
(typeof CompassServiceProvider)['connect']
>[1];
type ChildProcessRuntime = Caller<WorkerThreadWorkerRuntime>;

@@ -97,7 +104,7 @@

stdio: ['inherit', 'inherit', 'pipe', 'ipc'],
...spawnOptions
...spawnOptions,
}
);
const waitForReadyMessage = async() => {
const waitForReadyMessage = async () => {
let msg: string;

@@ -111,3 +118,2 @@ while (([msg] = await once(this.childProcess, 'message'))) {

// eslint-disable-next-line chai-friendly/no-unused-expressions
this.childProcess?.stderr?.setEncoding('utf8')?.on('data', (chunk) => {

@@ -117,3 +123,3 @@ spawnError += chunk;

const waitForError = async() => {
const waitForError = async () => {
const [exitCode] = await once(this.childProcess, 'exit');

@@ -128,3 +134,5 @@

error = new Error(
`Worker runtime failed to start: child process exited with code ${exitCode}`
`Worker runtime failed to start: child process exited with code ${
exitCode as number | string
}`
);

@@ -152,3 +160,3 @@ }

'getShellPrompt',
'interrupt'
'interrupt',
],

@@ -168,3 +176,7 @@ this.childProcess

await this.childProcessRuntime.init(uri, serializeConnectOptions(driverOptions), cliOptions);
await this.childProcessRuntime.init(
uri,
serializeConnectOptions(driverOptions),
cliOptions
);
}

@@ -171,0 +183,0 @@

@@ -8,11 +8,11 @@ import { expect } from 'chai';

describe('Lock', () => {
it('should allow to create a lock promise that can be resolved programmatically', async() => {
describe('Lock', function () {
it('should allow to create a lock promise that can be resolved programmatically', async function () {
const lock = new Lock();
const [token, wasUnlocked] = await Promise.all([
lock.lock(),
(async() => {
(async () => {
await sleep(50);
return lock.unlock();
})()
})(),
]);

@@ -23,3 +23,3 @@ expect(lock.isUnlockToken(token)).to.equal(true);

it('throws when trying to create locks when locked', () => {
it('throws when trying to create locks when locked', function () {
const lock = new Lock();

@@ -47,4 +47,4 @@

describe('unlock', () => {
it('should return false if lock is not locked', () => {
describe('unlock', function () {
it('should return false if lock is not locked', function () {
const lock = new Lock();

@@ -55,4 +55,4 @@ expect(lock.unlock()).to.equal(false);

describe('isLocked', () => {
it('shoult return current lock status', () => {
describe('isLocked', function () {
it('shoult return current lock status', function () {
const lock = new Lock();

@@ -59,0 +59,0 @@ expect(lock.isLocked()).to.equal(false);

@@ -12,3 +12,3 @@ export type UNLOCKED = 'UNLOCKED';

if (this.isLocked()) {
throw new Error('Can\'t create another lock while locked');
throw new Error("Can't create another lock while locked");
}

@@ -15,0 +15,0 @@

import { expect } from 'chai';
import { EventEmitter } from 'events';
import type { Caller, Exposed } from './rpc';
import {

@@ -9,7 +10,5 @@ createCaller,

cancel,
Caller,
Exposed,
serialize,
deserialize,
removeTrailingUndefined
removeTrailingUndefined,
} from './rpc';

@@ -30,5 +29,5 @@

describe('rpc helpers', () => {
describe('serialize', () => {
it('returns base64 representation of an input', () => {
describe('rpc helpers', function () {
describe('serialize', function () {
it('returns base64 representation of an input', function () {
expect(serialize('Hello')).to.equal('data:;base64,/w0iBUhlbGxv');

@@ -38,8 +37,8 @@ });

describe('deserialize', () => {
it("converts base64 representation of input back to it's original form", () => {
describe('deserialize', function () {
it("converts base64 representation of input back to it's original form", function () {
expect(deserialize(serialize('Hello'))).to.equal('Hello');
});
it("returns original string if it's not a base64 data uri", () => {
it("returns original string if it's not a base64 data uri", function () {
expect(deserialize('Hi')).to.equal('Hi');

@@ -49,4 +48,4 @@ });

describe('removeTrailingUndefined', () => {
it('removes trailing undefineds from an array', () => {
describe('removeTrailingUndefined', function () {
it('removes trailing undefineds from an array', function () {
expect(

@@ -59,3 +58,3 @@ removeTrailingUndefined([1, 2, 3, undefined, undefined, undefined])

describe('rpc', () => {
describe('rpc', function () {
let messageBus: EventEmitter;

@@ -72,3 +71,3 @@ let caller: Caller<{

afterEach(() => {
afterEach(function () {
if (messageBus) {

@@ -90,3 +89,3 @@ messageBus.removeAllListeners();

it('exposes functions and allows to call them', async() => {
it('exposes functions and allows to call them', async function () {
messageBus = createMockRpcMesageBus();

@@ -99,3 +98,3 @@ caller = createCaller(['meow'], messageBus);

return 'Meow meow meow!';
}
},
},

@@ -108,3 +107,3 @@ messageBus

it('serializes and de-serializes errors when thrown', async() => {
it('serializes and de-serializes errors when thrown', async function () {
messageBus = createMockRpcMesageBus();

@@ -117,3 +116,3 @@ caller = createCaller(['throws'], messageBus);

throw new TypeError('Uh-oh, error!');
}
},
},

@@ -140,3 +139,3 @@ messageBus

it('throws on client if arguments are not serializable', async() => {
it('throws on client if arguments are not serializable', async function () {
messageBus = createMockRpcMesageBus();

@@ -149,3 +148,3 @@ caller = createCaller(['callMe'], messageBus);

fn(1, 2);
}
},
},

@@ -169,3 +168,3 @@ messageBus

it('throws on client if retured value from the server is not serializable', async() => {
it('throws on client if retured value from the server is not serializable', async function () {
messageBus = createMockRpcMesageBus();

@@ -178,3 +177,3 @@ caller = createCaller(['returnsFunction'], messageBus);

return () => {};
}
},
},

@@ -198,4 +197,4 @@ messageBus

describe('createCaller', () => {
it('creates a caller with provided method names', () => {
describe('createCaller', function () {
it('creates a caller with provided method names', function () {
messageBus = createMockRpcMesageBus();

@@ -207,3 +206,3 @@ caller = createCaller(['meow', 'woof'], messageBus);

it('attaches caller listener to provided process', (done) => {
it('attaches caller listener to provided process', function (done) {
messageBus = createMockRpcMesageBus();

@@ -222,4 +221,4 @@ caller = createCaller(['meow'], messageBus);

describe('cancel', () => {
it('stops all in-flight evaluations', async() => {
describe('cancel', function () {
it('stops all in-flight evaluations', async function () {
messageBus = createMockRpcMesageBus();

@@ -231,7 +230,7 @@ caller = createCaller(['neverResolves'], messageBus);

caller.neverResolves(),
(async() => {
(async () => {
// smol sleep to make sure we actually issued a call
await sleep(100);
caller[cancel]();
})()
})(),
]);

@@ -247,4 +246,4 @@ } catch (e: any) {

describe('exposeAll', () => {
it('exposes passed methods on provided process', (done) => {
describe('exposeAll', function () {
it('exposes passed methods on provided process', function (done) {
messageBus = createMockRpcMesageBus();

@@ -256,3 +255,3 @@

return 'Meow meow meow meow!';
}
},
},

@@ -278,8 +277,8 @@ messageBus

func: 'meow',
id: '123abc'
id: '123abc',
});
});
describe('close', () => {
it('disables all exposed listeners', () => {
describe('close', function () {
it('disables all exposed listeners', function () {
messageBus = createMockRpcMesageBus();

@@ -286,0 +285,0 @@ exposed = exposeAll({ doSomething() {} }, messageBus);

@@ -8,3 +8,3 @@ import v8 from 'v8';

ServerMessageData,
ClientMessageData
ClientMessageData,
} from 'postmsg-rpc';

@@ -32,3 +32,3 @@

Message,
Error
Error,
}

@@ -106,3 +106,3 @@

type: RPCMessageTypes.Error,
payload: serializeError(e)
payload: serializeError(e),
});

@@ -128,3 +128,3 @@ }

return data;
}
},
};

@@ -142,6 +142,6 @@ }

export function exposeAll<O>(obj: O, messageBus: RPCMessageBus): Exposed<O> {
Object.entries(obj).forEach(([key, val]) => {
Object.entries(obj as Record<string, any>).forEach(([key, val]) => {
const { close } = expose(
key,
async(...args: unknown[]) => {
async (...args: unknown[]) => {
try {

@@ -164,6 +164,8 @@ return { type: RPCMessageTypes.Message, payload: await val(...args) };

value() {
Object.values(obj).forEach((fn) => {
fn.close();
});
}
Object.values(obj as Record<string, { close: () => void }>).forEach(
(fn) => {
fn.close();
}
);
},
});

@@ -182,5 +184,5 @@ return obj as Exposed<O>;

processors: Partial<
Record<typeof methodNames[number], (...input: any[]) => any[]>
Record<(typeof methodNames)[number], (...input: any[]) => any[]>
> = {}
): Caller<Impl, typeof methodNames[number]> {
): Caller<Impl, (typeof methodNames)[number]> {
const obj = {};

@@ -190,3 +192,3 @@ const inflight = new Set<CancelablePromise<unknown>>();

const c = caller(name as string, getRPCOptions(messageBus));
(obj as any)[name] = async(...args: unknown[]) => {
(obj as any)[name] = async (...args: unknown[]) => {
const processed =

@@ -211,6 +213,5 @@ typeof processors[name] === 'function'

}
}
},
});
return obj as Caller<Impl, typeof methodNames[number]>;
return obj as Caller<Impl, (typeof methodNames)[number]>;
}

@@ -1,2 +0,2 @@

import { DevtoolsConnectOptions } from '@mongosh/service-provider-server/lib/cli-service-provider';
import type { DevtoolsConnectOptions } from '@mongosh/service-provider-server/lib/cli-service-provider';
import { expect } from 'chai';

@@ -11,9 +11,9 @@ import { UUID, Long } from 'bson';

serializeConnectOptions,
deserializeConnectOptions
deserializeConnectOptions,
} from './serializer';
import { dummyOptions } from './index.spec';
describe('serializer', () => {
describe('serializeError', () => {
it('serializer Error to plain object', () => {
describe('serializer', function () {
describe('serializeError', function () {
it('serializer Error to plain object', function () {
const serialized = serializeError(new TypeError('Uh-oh'));

@@ -27,4 +27,4 @@

describe('deserializeError', () => {
it('creates an instance of an error from plain object', () => {
describe('deserializeError', function () {
it('creates an instance of an error from plain object', function () {
const err = deserializeError({ name: 'CustomError', message: 'Error!' });

@@ -38,7 +38,7 @@

describe('serializeEvaluationResult', () => {
it('should return primitive values as-is', () => {
describe('serializeEvaluationResult', function () {
it('should return primitive values as-is', function () {
const serialized = serializeEvaluationResult({
type: 'primitive',
printable: 123
printable: 123,
});

@@ -50,6 +50,6 @@

it('should serialize error values', () => {
it('should serialize error values', function () {
const serialized = serializeEvaluationResult({
type: 'error',
printable: new SyntaxError('Ooops!')
printable: new SyntaxError('Ooops!'),
});

@@ -69,6 +69,6 @@

it('should return inspect result for non shell-api result types (type === null)', () => {
it('should return inspect result for non shell-api result types (type === null)', function () {
const serialized = serializeEvaluationResult({
type: null,
printable: function abc() {}
printable: function abc() {},
});

@@ -83,6 +83,6 @@

it('should serialize shell-api result type', () => {
it('should serialize shell-api result type', function () {
const serialized = serializeEvaluationResult({
type: 'TotallyRealShellApiType',
printable: { foo: 'bar' }
printable: { foo: 'bar' },
});

@@ -101,3 +101,3 @@

.deep.equal({
foo: 'bar'
foo: 'bar',
});

@@ -107,7 +107,7 @@ });

describe('deserializeEvaluationResult', () => {
it('should deserialize SerializedErrorResult', () => {
describe('deserializeEvaluationResult', function () {
it('should deserialize SerializedErrorResult', function () {
const deserialized = deserializeEvaluationResult({
type: SerializedResultTypes.SerializedErrorResult,
printable: { name: 'TypeError', message: 'Uh-oh' }
printable: { name: 'TypeError', message: 'Uh-oh' },
});

@@ -126,3 +126,3 @@

it('should deserialize SerializedShellApiResult', () => {
it('should deserialize SerializedShellApiResult', function () {
const deserialized = deserializeEvaluationResult({

@@ -132,4 +132,4 @@ type: SerializedResultTypes.SerializedShellApiResult,

origType: 'ShellApiResult',
serializedValue: { foo: 'bar' }
}
serializedValue: { foo: 'bar' },
},
});

@@ -143,9 +143,12 @@

it('should return unknown types as-is', () => {
it('should return unknown types as-is', function () {
const deserialized = deserializeEvaluationResult({
type: 'SomethingSomethingResultType',
printable: 'Hello'
printable: 'Hello',
});
expect(deserialized).to.have.property('type', 'SomethingSomethingResultType');
expect(deserialized).to.have.property(
'type',
'SomethingSomethingResultType'
);
expect(deserialized).to.have.property('printable', 'Hello');

@@ -155,4 +158,4 @@ });

describe('connection options', () => {
it('should serialize and deserialize FLE1 connection options', () => {
describe('connection options', function () {
it('should serialize and deserialize FLE1 connection options', function () {
const options: DevtoolsConnectOptions = {

@@ -167,11 +170,11 @@ ...dummyOptions,

encrypt: {
keyId: [ new UUID('a21ddc6a-8806-4384-9fdf-8ba02a767b5f') ],
keyId: [new UUID('a21ddc6a-8806-4384-9fdf-8ba02a767b5f')],
bsonType: 'string',
algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Random'
}
}
}
}
}
}
algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Random',
},
},
},
},
},
},
};

@@ -190,11 +193,18 @@

encrypt: {
keyId: [ { $binary: { base64: 'oh3caogGQ4Sf34ugKnZ7Xw==', subType: '04' } } ],
keyId: [
{
$binary: {
base64: 'oh3caogGQ4Sf34ugKnZ7Xw==',
subType: '04',
},
},
],
bsonType: 'string',
algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Random'
}
}
}
}
}
}
algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Random',
},
},
},
},
},
},
});

@@ -205,3 +215,3 @@

it('should serialize and deserialize FLE2 connection options', () => {
it('should serialize and deserialize FLE2 connection options', function () {
const options: DevtoolsConnectOptions = {

@@ -212,11 +222,13 @@ ...dummyOptions,

'hr.employees': {
fields: [{
path: 'phoneNumber',
keyId: new UUID('fd6275d7-9260-4e6c-a86b-68ec5240814a'),
bsonType: 'string',
queries: { queryType: 'equality', contention: new Long(0) }
}]
}
}
}
fields: [
{
path: 'phoneNumber',
keyId: new UUID('fd6275d7-9260-4e6c-a86b-68ec5240814a'),
bsonType: 'string',
queries: { queryType: 'equality', contention: new Long(0) },
},
],
},
},
},
};

@@ -231,11 +243,21 @@

'hr.employees': {
fields: [{
path: 'phoneNumber',
keyId: { $binary: { base64: '/WJ115JgTmyoa2jsUkCBSg==', subType: '04' } },
bsonType: 'string',
queries: { queryType: 'equality', contention: { $numberLong: '0' } }
}]
}
}
}
fields: [
{
path: 'phoneNumber',
keyId: {
$binary: {
base64: '/WJ115JgTmyoa2jsUkCBSg==',
subType: '04',
},
},
bsonType: 'string',
queries: {
queryType: 'equality',
contention: { $numberLong: '0' },
},
},
],
},
},
},
});

@@ -242,0 +264,0 @@

import { inspect } from 'util';
import { EJSON } from 'bson';
import { RuntimeEvaluationResult } from '@mongosh/browser-runtime-core';
import type { RuntimeEvaluationResult } from '@mongosh/browser-runtime-core';
import type { DevtoolsConnectOptions } from '@mongosh/service-provider-server';

@@ -47,3 +47,3 @@

InspectResult = 'InspectResult',
SerializedShellApiResult = 'SerializedShellApiResult'
SerializedShellApiResult = 'SerializedShellApiResult',
}

@@ -54,3 +54,3 @@

printable,
source
source,
}: RuntimeEvaluationResult): RuntimeEvaluationResult {

@@ -67,3 +67,3 @@ // Primitive values don't require any special treatment for serialization

printable: serializeError(printable),
source
source,
};

@@ -82,3 +82,3 @@ }

printable: inspect(printable),
source
source,
};

@@ -94,4 +94,4 @@ }

origType: type,
serializedValue: EJSON.serialize(printable)
}
serializedValue: EJSON.serialize(printable),
},
};

@@ -103,3 +103,3 @@ }

printable,
source
source,
}: RuntimeEvaluationResult): RuntimeEvaluationResult {

@@ -114,3 +114,3 @@ if (type === SerializedResultTypes.SerializedErrorResult) {

printable: EJSON.deserialize(printable.serializedValue),
source
source,
};

@@ -122,8 +122,7 @@ }

const autoEncryptionBSONOptions = [
'schemaMap',
'encryptedFieldsMap'
] as const;
const autoEncryptionBSONOptions = ['schemaMap', 'encryptedFieldsMap'] as const;
export function serializeConnectOptions(options: Readonly<DevtoolsConnectOptions>): DevtoolsConnectOptions {
export function serializeConnectOptions(
options: Readonly<DevtoolsConnectOptions>
): DevtoolsConnectOptions {
const serializedOptions = { ...options };

@@ -134,3 +133,6 @@ for (const autoEncryptionOption of autoEncryptionBSONOptions) {

...serializedOptions.autoEncryption,
[autoEncryptionOption]: EJSON.serialize(serializedOptions.autoEncryption[autoEncryptionOption], { relaxed: false })
[autoEncryptionOption]: EJSON.serialize(
serializedOptions.autoEncryption[autoEncryptionOption],
{ relaxed: false }
),
};

@@ -142,3 +144,5 @@ }

export function deserializeConnectOptions(options: Readonly<DevtoolsConnectOptions>): DevtoolsConnectOptions {
export function deserializeConnectOptions(
options: Readonly<DevtoolsConnectOptions>
): DevtoolsConnectOptions {
const deserializedOptions: any = { ...options };

@@ -149,3 +153,6 @@ for (const autoEncryptionOption of autoEncryptionBSONOptions) {

...deserializedOptions.autoEncryption,
[autoEncryptionOption]: EJSON.deserialize(deserializedOptions.autoEncryption[autoEncryptionOption], { relaxed: false })
[autoEncryptionOption]: EJSON.deserialize(
deserializedOptions.autoEncryption[autoEncryptionOption],
{ relaxed: false }
),
};

@@ -152,0 +159,0 @@ }

import { expect } from 'chai';
import childProcess, { ChildProcess } from 'child_process';
import type { ChildProcess } from 'child_process';
import childProcess from 'child_process';
import { once } from 'events';
import spawnChildFromSource, { kill } from './spawn-child-from-source';
describe('spawnChildFromSource', () => {
describe('spawnChildFromSource', function () {
let spawned: ChildProcess;
afterEach(async() => {
afterEach(async function () {
if (spawned) {

@@ -16,3 +17,3 @@ await kill(spawned, 'SIGKILL');

it('should throw if stdin is missing', async() => {
it('should throw if stdin is missing', async function () {
let err: Error;

@@ -25,3 +26,3 @@

// @ts-expect-error
stdio: 'ignore'
stdio: 'ignore',
});

@@ -38,3 +39,3 @@ } catch (e: any) {

it('should resolve with a child process', async() => {
it('should resolve with a child process', async function () {
spawned = await spawnChildFromSource('');

@@ -44,3 +45,3 @@ expect(spawned).to.be.instanceof((childProcess as any).ChildProcess);

it('should spawn a process with an ipc channel open', async() => {
it('should spawn a process with an ipc channel open', async function () {
spawned = await spawnChildFromSource(

@@ -54,3 +55,3 @@ 'process.on("message", (data) => process.send(data))'

it('should fail if process exited before successfully starting', async() => {
it('should fail if process exited before successfully starting', async function () {
let err: Error;

@@ -76,3 +77,3 @@

it('should fail if a timeout exceeded before the process is "ready"', async() => {
it('should fail if a timeout exceeded before the process is "ready"', async function () {
let err: Error;

@@ -79,0 +80,0 @@

@@ -1,9 +0,9 @@

import {
import type {
ChildProcess,
Serializable,
spawn,
SpawnOptions,
StdioNull,
StdioPipe
StdioPipe,
} from 'child_process';
import { spawn } from 'child_process';
import { once } from 'events';

@@ -28,3 +28,3 @@

): Promise<ChildProcess> {
return new Promise(async(resolve, reject) => {
return new Promise(async (resolve, reject) => {
const readyToken = Date.now().toString(32);

@@ -34,3 +34,3 @@

stdio: ['pipe', _stdout, _stderr, 'ipc'],
...spawnOptions
...spawnOptions,
});

@@ -37,0 +37,0 @@

@@ -9,6 +9,7 @@ import path from 'path';

import { startTestServer } from '../../../testing/integration-testing-hooks';
import { Caller, cancel, close, createCaller, exposeAll, Exposed } from './rpc';
import type { Caller, Exposed } from './rpc';
import { cancel, close, createCaller, exposeAll } from './rpc';
import { deserializeEvaluationResult } from './serializer';
import type { WorkerRuntime } from './worker-runtime';
import { RuntimeEvaluationResult } from '@mongosh/browser-runtime-core';
import type { RuntimeEvaluationResult } from '@mongosh/browser-runtime-core';
import { interrupt } from 'interruptor';

@@ -31,7 +32,7 @@ import { dummyOptions } from './index.spec';

describe('worker', () => {
describe('worker', function () {
let worker: Worker;
let caller: Caller<WorkerRuntime>;
beforeEach(async() => {
beforeEach(async function () {
worker = new Worker(workerThreadModule);

@@ -47,3 +48,3 @@ await once(worker, 'message');

'setEvaluationListener',
'interrupt'
'interrupt',
],

@@ -60,3 +61,3 @@ worker

afterEach(async() => {
afterEach(async function () {
if (worker) {

@@ -83,3 +84,3 @@ // There is a Node.js bug that causes worker process to still be ref-ed

it('should throw if worker is not initialized yet', async() => {
it('should throw if worker is not initialized yet', async function () {
const { evaluate } = caller;

@@ -101,4 +102,4 @@

describe('evaluate', () => {
describe('basic shell result values', () => {
describe('evaluate', function () {
describe('basic shell result values', function () {
const primitiveValues: [string, string, unknown][] = [

@@ -109,3 +110,3 @@ ['null', 'null', null],

['number', '1+1', 2],
['string', '"hello"', 'hello']
['string', '"hello"', 'hello'],
];

@@ -118,3 +119,3 @@

'function def() {}; def.def = 1; def',
'[Function: def] { def: 1 }'
'[Function: def] { def: 1 }',
],

@@ -126,3 +127,3 @@ ['anonymous function', '(() => {})', /\[Function.+\]/],

'class ABC { constructor() { this.abc = 1; } }; var abc = new ABC(); abc',
'ABC { abc: 1 }'
'ABC { abc: 1 }',
],

@@ -133,3 +134,3 @@ ['simple array', '[1, 2, 3]', '[ 1, 2, 3 ]'],

'[1, 2,, 4]',
'[ 1, 2, <1 empty item>, 4 ]'
'[ 1, 2, <1 empty item>, 4 ]',
],

@@ -139,3 +140,3 @@ [

'[1, 2, 3, () => {}]',
/\[ 1, 2, 3, \[Function( \(anonymous\))?\] \]/
/\[ 1, 2, 3, \[Function( \(anonymous\))?\] \]/,
],

@@ -145,3 +146,3 @@ [

'({str: "foo", num: 123})',
"{ str: 'foo', num: 123 }"
"{ str: 'foo', num: 123 }",
],

@@ -151,3 +152,3 @@ [

'({str: "foo", num: 123, bool: false, fn() {}})',
"{ str: 'foo', num: 123, bool: false, fn: [Function: fn] }"
"{ str: 'foo', num: 123, bool: false, fn: [Function: fn] }",
],

@@ -157,3 +158,3 @@ [

'({min: MinKey(), max: MaxKey(), int: NumberInt("1")})',
'{ min: MinKey(), max: MaxKey(), int: Int32(1) }'
'{ min: MinKey(), max: MaxKey(), int: Int32(1) }',
],

@@ -163,4 +164,4 @@ [

'({ cls: class A{}, fn() {}, bsonType: NumberInt("1"), str: "123"})',
"{ cls: [class A], fn: [Function: fn], bsonType: Int32(1), str: '123' }"
]
"{ cls: [class A], fn: [Function: fn], bsonType: Int32(1), str: '123' }",
],
];

@@ -171,3 +172,3 @@

it(testName, async() => {
it(testName, async function () {
const { init, evaluate } = caller;

@@ -186,3 +187,3 @@ await init('mongodb://nodb/', dummyOptions, { nodb: true });

describe('shell-api results', () => {
describe('shell-api results', function () {
const testServer = startTestServer('shared');

@@ -192,3 +193,3 @@ const db = `test-db-${Date.now().toString(16)}`;

afterEach(() => {
afterEach(function () {
if (exposed) {

@@ -211,3 +212,3 @@ exposed[close]();

.be.undefined;
}
},
],

@@ -222,8 +223,8 @@ ['show collections', 'ShowCollectionsResult', []],

.be.undefined;
}
]
},
],
];
const useCommand: CommandTestRecord[] = [
[`use ${db}`, null, `switched to db ${db}`]
[`use ${db}`, null, `switched to db ${db}`],
];

@@ -240,4 +241,4 @@

.match(/https:\/\/docs.mongodb.com/);
}
]
},
],
];

@@ -250,3 +251,3 @@

'db.coll.insertOne({ _id: ObjectId("000000000000000000000000"), foo: 321 });',
'db.coll.aggregate({ $match: { foo: 321 } })'
'db.coll.aggregate({ $match: { foo: 321 } })',
],

@@ -260,6 +261,6 @@ 'AggregationCursor',

_id: new ObjectId('000000000000000000000000'),
foo: 321
foo: 321,
})
);
}
},
],

@@ -270,3 +271,3 @@ [

'db.coll.insertMany([1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(i => ({ i })))',
'db.coll.find({ i: { $mod: [2, 0] } }, { _id: 0 })'
'db.coll.find({ i: { $mod: [2, 0] } }, { _id: 0 })',
],

@@ -276,4 +277,4 @@ 'Cursor',

documents: [{ i: 2 }, { i: 4 }, { i: 6 }, { i: 8 }, { i: 10 }],
cursorHasMore: false
}
cursorHasMore: false,
},
],

@@ -285,3 +286,3 @@ [

'db.coll.find({}, { _id: 0 })',
'it'
'it',
],

@@ -291,4 +292,4 @@ 'CursorIterationResult',

expect(printable.documents).to.include.deep.members([{ a: 'a' }]);
}
]
},
],
];

@@ -305,3 +306,3 @@

.instanceof(ObjectId);
}
},
],

@@ -316,3 +317,3 @@ [

.instanceof(ObjectId);
}
},
],

@@ -323,3 +324,3 @@ [

'db.coll.insertOne({ a: "a" })',
'db.coll.updateOne({ a: "a" }, { $set: { a: "b" } })'
'db.coll.updateOne({ a: "a" }, { $set: { a: "b" } })',
],

@@ -332,4 +333,4 @@ 'UpdateResult',

modifiedCount: 1,
upsertedCount: 0
}
upsertedCount: 0,
},
],

@@ -340,6 +341,6 @@ [

'db.coll.insertOne({ a: "a" })',
'db.coll.deleteOne({ a: "a" })'
'db.coll.deleteOne({ a: "a" })',
],
'DeleteResult',
{ acknowledged: true, deletedCount: 1 }
{ acknowledged: true, deletedCount: 1 },
],

@@ -355,4 +356,4 @@ [

.instanceof(ObjectId);
}
]
},
],
];

@@ -378,9 +379,12 @@

it(`"${command}" should return ${resultType} result`, async() => {
it(`"${command}" should return ${resultType} result`, async function () {
// Without this dummy evaluation listener, a request to getConfig()
// from the shell leads to a never-resolved Promise.
exposed = exposeAll({
getConfig() {},
validateConfig() {}
}, worker);
exposed = exposeAll(
{
getConfig() {},
validateConfig() {},
},
worker
);

@@ -413,4 +417,4 @@ const { init, evaluate } = caller;

describe('errors', () => {
it("should throw an error if it's thrown during evaluation", async() => {
describe('errors', function () {
it("should throw an error if it's thrown during evaluation", async function () {
const { init, evaluate } = caller;

@@ -435,3 +439,3 @@

it('should preserve extra error properties', async() => {
it('should preserve extra error properties', async function () {
const { init, evaluate } = caller;

@@ -443,3 +447,5 @@

try {
await evaluate('throw Object.assign(new TypeError("Oh no, types!"), { errInfo: { message: "wrong type :S" } })');
await evaluate(
'throw Object.assign(new TypeError("Oh no, types!"), { errInfo: { message: "wrong type :S" } })'
);
} catch (e: any) {

@@ -455,3 +461,3 @@ err = e;

it("should return an error if it's returned from evaluation", async() => {
it("should return an error if it's returned from evaluation", async function () {
const { init, evaluate } = caller;

@@ -471,3 +477,3 @@

it('should throw when trying to run two evaluations concurrently', async() => {
it('should throw when trying to run two evaluations concurrently', async function () {
const { init, evaluate } = caller;

@@ -481,3 +487,3 @@ await init('mongodb://nodb/', dummyOptions, { nodb: true });

evaluate('sleep(50); 1+1'),
evaluate('sleep(50); 1+1')
evaluate('sleep(50); 1+1'),
]);

@@ -498,6 +504,6 @@ } catch (e: any) {

describe('getShellPrompt', () => {
describe('getShellPrompt', function () {
const testServer = startTestServer('shared');
it('should return prompt when connected to the server', async() => {
it('should return prompt when connected to the server', async function () {
const { init, getShellPrompt } = caller;

@@ -513,6 +519,6 @@

describe('getCompletions', () => {
describe('getCompletions', function () {
const testServer = startTestServer('shared');
it('should return completions', async() => {
it('should return completions', async function () {
const { init, getCompletions } = caller;

@@ -525,3 +531,3 @@

expect(completions).to.deep.contain({
completion: 'db.coll1.find'
completion: 'db.coll1.find',
});

@@ -531,3 +537,3 @@ });

describe('evaluationListener', () => {
describe('evaluationListener', function () {
const spySandbox = sinon.createSandbox();

@@ -545,4 +551,6 @@

validateConfig() {},
listConfigOptions() { return ['displayBatchSize']; },
onRunInterruptible() {}
listConfigOptions() {
return ['displayBatchSize'];
},
onRunInterruptible() {},
};

@@ -564,3 +572,3 @@

afterEach(() => {
afterEach(function () {
if (exposed) {

@@ -574,4 +582,4 @@ exposed[close]();

describe('onPrint', () => {
it('should be called when shell evaluates `print`', async() => {
describe('onPrint', function () {
it('should be called when shell evaluates `print`', async function () {
const { init, evaluate } = caller;

@@ -586,7 +594,7 @@ const evalListener = createSpiedEvaluationListener();

expect(evalListener.onPrint).to.have.been.calledWith([
{ printable: 'Hi!', source: undefined, type: null }
{ printable: 'Hi!', source: undefined, type: null },
]);
});
it('should correctly serialize bson objects', async() => {
it('should correctly serialize bson objects', async function () {
const { init, evaluate } = caller;

@@ -601,3 +609,7 @@ const evalListener = createSpiedEvaluationListener();

expect(evalListener.onPrint).to.have.been.calledWith([
{ printable: 'ObjectId("62a209b0c7dc31e23ab9da45")', source: undefined, type: 'InspectResult' }
{
printable: 'ObjectId("62a209b0c7dc31e23ab9da45")',
source: undefined,
type: 'InspectResult',
},
]);

@@ -607,4 +619,4 @@ });

describe('onPrompt', () => {
it('should be called when shell evaluates `passwordPrompt`', async() => {
describe('onPrompt', function () {
it('should be called when shell evaluates `passwordPrompt`', async function () {
const { init, evaluate } = caller;

@@ -623,4 +635,4 @@ const evalListener = createSpiedEvaluationListener();

describe('getConfig', () => {
it('should be called when shell evaluates `config.get()`', async() => {
describe('getConfig', function () {
it('should be called when shell evaluates `config.get()`', async function () {
const { init, evaluate } = caller;

@@ -638,4 +650,4 @@ const evalListener = createSpiedEvaluationListener();

describe('setConfig', () => {
it('should be called when shell evaluates `config.set()`', async() => {
describe('setConfig', function () {
it('should be called when shell evaluates `config.set()`', async function () {
const { init, evaluate } = caller;

@@ -649,9 +661,15 @@ const evalListener = createSpiedEvaluationListener();

await evaluate('config.set("displayBatchSize", 200)');
expect(evalListener.validateConfig).to.have.been.calledWith('displayBatchSize', 200);
expect(evalListener.setConfig).to.have.been.calledWith('displayBatchSize', 200);
expect(evalListener.validateConfig).to.have.been.calledWith(
'displayBatchSize',
200
);
expect(evalListener.setConfig).to.have.been.calledWith(
'displayBatchSize',
200
);
});
});
describe('resetConfig', () => {
it('should be called when shell evaluates `config.reset()`', async() => {
describe('resetConfig', function () {
it('should be called when shell evaluates `config.reset()`', async function () {
const { init, evaluate } = caller;

@@ -665,8 +683,10 @@ const evalListener = createSpiedEvaluationListener();

await evaluate('config.reset("displayBatchSize")');
expect(evalListener.resetConfig).to.have.been.calledWith('displayBatchSize');
expect(evalListener.resetConfig).to.have.been.calledWith(
'displayBatchSize'
);
});
});
describe('listConfigOptions', () => {
it('should be called when shell evaluates `config[asPrintable]`', async() => {
describe('listConfigOptions', function () {
it('should be called when shell evaluates `config[asPrintable]`', async function () {
const { init, evaluate } = caller;

@@ -686,4 +706,4 @@ const evalListener = createSpiedEvaluationListener();

describe('onRunInterruptible', () => {
it('should call callback when interruptible evaluation starts and ends', async() => {
describe('onRunInterruptible', function () {
it('should call callback when interruptible evaluation starts and ends', async function () {
const { init, evaluate } = caller;

@@ -697,6 +717,5 @@ const evalListener = createSpiedEvaluationListener();

const [
firstCall,
secondCall
] = (evalListener.onRunInterruptible as sinon.SinonSpy).args;
const [firstCall, secondCall] = (
evalListener.onRunInterruptible as sinon.SinonSpy
).args;

@@ -707,3 +726,3 @@ expect(firstCall[0]).to.have.property('__id');

it('should return a handle that allows to interrupt the evaluation', async() => {
it('should return a handle that allows to interrupt the evaluation', async function () {
const { init, evaluate } = caller;

@@ -721,3 +740,3 @@ const evalListener = createSpiedEvaluationListener();

evaluate('while(true){}'),
(async() => {
(async () => {
await sleep(50);

@@ -727,3 +746,3 @@ const handle = (evalListener.onRunInterruptible as sinon.SinonSpy)

interrupt(handle);
})()
})(),
]);

@@ -742,4 +761,4 @@ } catch (e: any) {

describe('interrupt', () => {
it('should interrupt in-flight async tasks', async() => {
describe('interrupt', function () {
it('should interrupt in-flight async tasks', async function () {
const { init, evaluate, interrupt } = caller;

@@ -754,6 +773,6 @@

evaluate('sleep(100000)'),
(async() => {
(async () => {
await sleep(10);
await interrupt();
})()
})(),
]);

@@ -760,0 +779,0 @@ } catch (e: any) {

@@ -5,19 +5,25 @@ /* istanbul ignore file */

import { parentPort, isMainThread } from 'worker_threads';
import {
import type {
Completion,
Runtime,
RuntimeEvaluationListener,
RuntimeEvaluationResult
RuntimeEvaluationResult,
} from '@mongosh/browser-runtime-core';
import { ElectronRuntime } from '@mongosh/browser-runtime-electron';
import type { ServiceProvider } from '@mongosh/service-provider-core';
import { CompassServiceProvider } from '@mongosh/service-provider-server';
import { exposeAll, createCaller } from './rpc';
import {
CompassServiceProvider
} from '@mongosh/service-provider-server';
import { exposeAll, createCaller } from './rpc';
import { serializeEvaluationResult, deserializeConnectOptions } from './serializer';
serializeEvaluationResult,
deserializeConnectOptions,
} from './serializer';
import type { MongoshBus } from '@mongosh/types';
import { Lock, UNLOCKED } from './lock';
import { runInterruptible, InterruptHandle } from 'interruptor';
import type { UNLOCKED } from './lock';
import { Lock } from './lock';
import type { InterruptHandle } from 'interruptor';
import { runInterruptible } from 'interruptor';
type DevtoolsConnectOptions = Parameters<(typeof CompassServiceProvider)['connect']>[1];
type DevtoolsConnectOptions = Parameters<
(typeof CompassServiceProvider)['connect']
>[1];

@@ -58,7 +64,9 @@ if (!parentPort || isMainThread) {

'onExit',
'onRunInterruptible'
'onRunInterruptible',
],
parentPort,
{
onPrint: function(results: RuntimeEvaluationResult[]): RuntimeEvaluationResult[][] {
onPrint: function (
results: RuntimeEvaluationResult[]
): RuntimeEvaluationResult[][] {
// We're transforming an args array, so we have to return an array of

@@ -69,3 +77,3 @@ // args. onPrint only takes one arg which is an array of

return [results.map(serializeEvaluationResult)];
}
},
}

@@ -82,3 +90,3 @@ );

throw new Error("Can't call `once` method on worker runtime MongoshBus");
}
},
}

@@ -121,3 +129,3 @@ );

async evaluate(code) {
async evaluate(code: string) {
if (evaluationLock.isLocked()) {

@@ -162,6 +170,3 @@ throw new Error(

try {
result = await Promise.race([
evaluationPromise,
evaluationLock.lock()
]);
result = await Promise.race([evaluationPromise, evaluationLock.lock()]);
} finally {

@@ -182,7 +187,7 @@ evaluationLock.unlock();

async getCompletions(code) {
getCompletions(code: string): Promise<Completion[]> {
return ensureRuntime('getCompletions').getCompletions(code);
},
async getShellPrompt() {
getShellPrompt(): Promise<string> {
return ensureRuntime('getShellPrompt').getShellPrompt();

@@ -199,3 +204,3 @@ },

return evaluationLock.unlock();
}
},
};

@@ -202,0 +207,0 @@

{
"extends": "../../config/tsconfig.base.json",
"extends": "@mongodb-js/tsconfig-mongosh/tsconfig.common.json",
"compilerOptions": {

@@ -7,11 +7,5 @@ "outDir": "./dist",

},
"files": [
"./src/index.d.ts"
],
"include": [
"./src/**/*"
],
"exclude": [
"./src/**/*.spec.*"
]
}
"files": ["./src/index.d.ts"],
"include": ["src/**/*"],
"exclude": ["./src/**/*.spec.*"]
}
{
"extends": "../../config/tsconfig.test.json",
"extends": "@mongodb-js/tsconfig-mongosh/tsconfig.test.json",
"ts-node": {

@@ -10,5 +10,3 @@ "files": true

},
"files": [
"./src/index.d.ts"
]
}
"files": ["./src/index.d.ts"]
}

@@ -12,3 +12,3 @@ 'use strict';

filename: '[name].js',
libraryTarget: 'umd'
libraryTarget: 'umd',
},

@@ -22,4 +22,4 @@

'os-dns-native': 'commonjs2 os-dns-native',
'system-ca': 'commonjs2 system-ca'
}
'system-ca': 'commonjs2 system-ca',
},
};

@@ -30,4 +30,4 @@

entry: { [entry]: path.resolve(__dirname, 'src', `${entry}.ts`) },
...merge(baseWebpackConfig, config)
...merge(baseWebpackConfig, config),
})
);

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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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 too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc