@mongosh/node-runtime-worker-thread 1.10.1 → 1.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.depcheckrc +14 -2
- package/.eslintignore +2 -1
- package/.eslintrc.js +10 -1
- package/.prettierignore +6 -0
- package/.prettierrc.json +1 -0
- package/dist/child-process-evaluation-listener.d.ts +3 -3
- package/dist/child-process-evaluation-listener.js +4 -4
- package/dist/child-process-evaluation-listener.js.map +1 -1
- package/dist/child-process-mongosh-bus.d.ts +3 -3
- package/dist/child-process-mongosh-bus.js +1 -1
- package/dist/child-process-mongosh-bus.js.map +1 -1
- package/dist/child-process-proxy.js +1 -1
- package/dist/child-process-proxy.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lock.d.ts +1 -1
- package/dist/lock.js +1 -1
- package/dist/lock.js.map +1 -1
- package/dist/report.html +2 -2
- package/dist/rpc.d.ts +4 -4
- package/dist/rpc.js +4 -4
- package/dist/rpc.js.map +1 -1
- package/dist/serializer.d.ts +3 -3
- package/dist/serializer.js +11 -14
- package/dist/serializer.js.map +1 -1
- package/dist/spawn-child-from-source.d.ts +2 -1
- package/dist/spawn-child-from-source.js +1 -1
- package/dist/spawn-child-from-source.js.map +1 -1
- package/dist/worker-runtime.d.ts +5 -5
- package/dist/worker-runtime.js +34 -46
- package/dist/worker-runtime.js.map +1 -1
- package/package.json +26 -15
- package/src/child-process-evaluation-listener.ts +25 -10
- package/src/child-process-mongosh-bus.ts +5 -4
- package/src/child-process-proxy.spec.ts +22 -12
- package/src/child-process-proxy.ts +18 -15
- package/src/index.spec.ts +109 -68
- package/src/index.ts +25 -13
- package/src/lock.spec.ts +9 -9
- package/src/lock.ts +1 -1
- package/src/rpc.spec.ts +33 -34
- package/src/rpc.ts +17 -16
- package/src/serializer.spec.ts +85 -63
- package/src/serializer.ts +24 -17
- package/src/spawn-child-from-source.spec.ts +10 -9
- package/src/spawn-child-from-source.ts +5 -5
- package/src/worker-runtime.spec.ts +117 -98
- package/src/worker-runtime.ts +26 -21
- package/tsconfig-lint.json +5 -0
- package/tsconfig.json +5 -11
- package/tsconfig.test.json +3 -5
- package/webpack.config.js +4 -4
- package/tsconfig.lint.json +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-runtime.js","sourceRoot":"","sources":["../src/worker-runtime.ts"],"names":[],"mappings":";;AAGA,mDAA0D;
|
|
1
|
+
{"version":3,"file":"worker-runtime.js","sourceRoot":"","sources":["../src/worker-runtime.ts"],"names":[],"mappings":";;AAGA,mDAA0D;AAO1D,gFAAoE;AAEpE,8EAA0E;AAC1E,+BAAgD;AAChD,6CAGsB;AAGtB,iCAA8B;AAE9B,6CAA+C;AAM/C,IAAI,CAAC,2BAAU,IAAI,6BAAY,EAAE;IAC/B,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;CACvE;AAED,IAAI,OAAO,GAAmB,IAAI,CAAC;AACnC,IAAI,QAAQ,GAA2B,IAAI,CAAC;AAE5C,MAAM,cAAc,GAAG,IAAI,WAAI,EAAE,CAAC;AAElC,SAAS,aAAa,CAAC,UAAkB;IACvC,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,eAAe,UAAU,oCAAoC,CAC9D,CAAC;KACH;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAMD,MAAM,kBAAkB,GAAG,IAAA,kBAAY,EACrC;IACE,SAAS;IACT,UAAU;IACV,WAAW;IACX,WAAW;IACX,aAAa;IACb,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,QAAQ;IACR,oBAAoB;CACrB,EACD,2BAAU,EACV;IACE,OAAO,EAAE,UACP,OAAkC;QAMlC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,sCAAyB,CAAC,CAAC,CAAC;IAClD,CAAC;CACF,CACF,CAAC;AAEF,MAAM,UAAU,GAAe,MA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Q,CAAC,GAAG,EAAE;IACpB,IAAI,2BAAU,EAAE;QACd,2BAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;KACjC;AACH,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongosh/node-runtime-worker-thread",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.3",
|
|
4
4
|
"description": "MongoDB shell runtime that lives in a worker thread",
|
|
5
5
|
"homepage": "https://github.com/mongodb-js/mongosh",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -20,26 +20,37 @@
|
|
|
20
20
|
"test": "cross-env TS_NODE_PROJECT=./tsconfig.test.json mocha -r \"../../scripts/import-expansions.js\" --timeout 15000 -r ts-node/register \"./src/**/*.spec.ts\"",
|
|
21
21
|
"pretest-ci": "node ../../scripts/run-if-package-requested.js npm run webpack-build -- --no-stats --no-devtool",
|
|
22
22
|
"test-ci": "node ../../scripts/run-if-package-requested.js npm test",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
23
|
+
"eslint": "eslint",
|
|
24
|
+
"lint": "npm run eslint . && npm run prettier -- --check .",
|
|
25
|
+
"check": "npm run lint && npm run depcheck",
|
|
26
|
+
"depcheck": "depcheck",
|
|
27
|
+
"webpack-build": "npm run compile && webpack --mode production",
|
|
28
|
+
"webpack-build-dev": "npm run compile && webpack --mode development",
|
|
29
|
+
"compile": "tsc -p tsconfig.json",
|
|
30
|
+
"prepublish": "npm run webpack-build",
|
|
31
|
+
"prettier": "prettier",
|
|
32
|
+
"reformat": "npm run prettier -- --write . && npm run eslint --fix"
|
|
29
33
|
},
|
|
30
34
|
"devDependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@mongosh/
|
|
35
|
-
"@mongosh/
|
|
36
|
-
"
|
|
35
|
+
"@mongodb-js/eslint-config-mongosh": "1.10.3",
|
|
36
|
+
"@mongodb-js/prettier-config-devtools": "^1.0.1",
|
|
37
|
+
"@mongodb-js/tsconfig-mongosh": "1.10.3",
|
|
38
|
+
"@mongosh/browser-runtime-core": "1.10.3",
|
|
39
|
+
"@mongosh/browser-runtime-electron": "1.10.3",
|
|
40
|
+
"@mongosh/service-provider-core": "1.10.3",
|
|
41
|
+
"@mongosh/service-provider-server": "1.10.3",
|
|
42
|
+
"@mongosh/types": "1.10.3",
|
|
43
|
+
"bson": "^5.3.0",
|
|
44
|
+
"depcheck": "^1.4.3",
|
|
45
|
+
"eslint": "^7.25.0",
|
|
37
46
|
"mocha": "^10.2.0",
|
|
38
|
-
"postmsg-rpc": "^2.4.0"
|
|
47
|
+
"postmsg-rpc": "^2.4.0",
|
|
48
|
+
"prettier": "^2.8.8",
|
|
49
|
+
"webpack-merge": "^5.8.0"
|
|
39
50
|
},
|
|
40
51
|
"dependencies": {
|
|
41
52
|
"interruptor": "^1.0.1",
|
|
42
53
|
"system-ca": "^1.0.2"
|
|
43
54
|
},
|
|
44
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "5df718faed3916fc5ce637f953eef2f913b14303"
|
|
45
56
|
}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { ChildProcess } from 'child_process';
|
|
2
|
-
import {
|
|
1
|
+
import type { ChildProcess } from 'child_process';
|
|
2
|
+
import type { Exposed } from './rpc';
|
|
3
|
+
import { exposeAll, close } from './rpc';
|
|
3
4
|
import type { WorkerRuntime } from './index';
|
|
4
5
|
import { deserializeEvaluationResult } from './serializer';
|
|
5
|
-
import { RuntimeEvaluationListener } from '@mongosh/browser-runtime-core';
|
|
6
|
+
import type { RuntimeEvaluationListener } from '@mongosh/browser-runtime-core';
|
|
6
7
|
|
|
7
8
|
export class ChildProcessEvaluationListener {
|
|
8
|
-
exposedListener: Exposed<
|
|
9
|
+
exposedListener: Exposed<
|
|
10
|
+
Required<
|
|
11
|
+
Omit<RuntimeEvaluationListener, 'onLoad' | 'getCryptLibraryOptions'>
|
|
12
|
+
>
|
|
13
|
+
>;
|
|
9
14
|
|
|
10
15
|
constructor(workerRuntime: WorkerRuntime, childProcess: ChildProcess) {
|
|
16
|
+
// @ts-expect-error TODO(MONGOSH-1506) fix the typing
|
|
11
17
|
this.exposedListener = exposeAll(
|
|
12
18
|
{
|
|
13
19
|
onPrompt(question, type) {
|
|
@@ -20,19 +26,28 @@ export class ChildProcessEvaluationListener {
|
|
|
20
26
|
return workerRuntime.evaluationListener?.onPrint?.(values);
|
|
21
27
|
},
|
|
22
28
|
setConfig(key, value) {
|
|
23
|
-
return
|
|
29
|
+
return (
|
|
30
|
+
workerRuntime.evaluationListener?.setConfig?.(key, value) ??
|
|
31
|
+
Promise.resolve('ignored')
|
|
32
|
+
);
|
|
24
33
|
},
|
|
25
34
|
resetConfig(key) {
|
|
26
|
-
return
|
|
35
|
+
return (
|
|
36
|
+
workerRuntime.evaluationListener?.resetConfig?.(key) ??
|
|
37
|
+
Promise.resolve('ignored')
|
|
38
|
+
);
|
|
27
39
|
},
|
|
28
40
|
validateConfig(key, value) {
|
|
29
|
-
return
|
|
41
|
+
return (
|
|
42
|
+
workerRuntime.evaluationListener?.validateConfig?.(key, value) ??
|
|
43
|
+
Promise.resolve(null)
|
|
44
|
+
);
|
|
30
45
|
},
|
|
31
46
|
getConfig(key) {
|
|
32
|
-
return workerRuntime.evaluationListener?.getConfig?.(key)
|
|
47
|
+
return workerRuntime.evaluationListener?.getConfig?.(key);
|
|
33
48
|
},
|
|
34
49
|
listConfigOptions() {
|
|
35
|
-
return workerRuntime.evaluationListener?.listConfigOptions?.()
|
|
50
|
+
return workerRuntime.evaluationListener?.listConfigOptions?.();
|
|
36
51
|
},
|
|
37
52
|
onClearCommand() {
|
|
38
53
|
return workerRuntime.evaluationListener?.onClearCommand?.();
|
|
@@ -42,7 +57,7 @@ export class ChildProcessEvaluationListener {
|
|
|
42
57
|
workerRuntime.evaluationListener?.onExit?.(exitCode) ??
|
|
43
58
|
(Promise.resolve() as Promise<never>)
|
|
44
59
|
);
|
|
45
|
-
}
|
|
60
|
+
},
|
|
46
61
|
},
|
|
47
62
|
childProcess
|
|
48
63
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ChildProcess } from 'child_process';
|
|
2
|
-
import { MongoshBus } from '@mongosh/types';
|
|
3
|
-
import {
|
|
1
|
+
import type { ChildProcess } from 'child_process';
|
|
2
|
+
import type { MongoshBus } from '@mongosh/types';
|
|
3
|
+
import type { Exposed } from './rpc';
|
|
4
|
+
import { exposeAll, close } from './rpc';
|
|
4
5
|
|
|
5
6
|
export class ChildProcessMongoshBus {
|
|
6
7
|
exposedEmitter: Exposed<MongoshBus>;
|
|
@@ -16,7 +17,7 @@ export class ChildProcessMongoshBus {
|
|
|
16
17
|
},
|
|
17
18
|
once() {
|
|
18
19
|
throw new Error("Can't use `once` method on ChildProcessMongoshBus");
|
|
19
|
-
}
|
|
20
|
+
},
|
|
20
21
|
},
|
|
21
22
|
childProcess
|
|
22
23
|
);
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import { ChildProcess
|
|
3
|
-
import {
|
|
2
|
+
import type { ChildProcess } from 'child_process';
|
|
3
|
+
import { fork, spawn } from 'child_process';
|
|
4
|
+
import type { Caller } from './rpc';
|
|
5
|
+
import { cancel, createCaller } from './rpc';
|
|
4
6
|
import { expect } from 'chai';
|
|
5
|
-
import { WorkerRuntime } from './worker-runtime';
|
|
7
|
+
import type { WorkerRuntime } from './worker-runtime';
|
|
6
8
|
import { once } from 'events';
|
|
7
9
|
import { promisify } from 'util';
|
|
8
10
|
import { dummyOptions } from './index.spec';
|
|
@@ -14,11 +16,11 @@ const childProcessModulePath = path.resolve(
|
|
|
14
16
|
'child-process-proxy.js'
|
|
15
17
|
);
|
|
16
18
|
|
|
17
|
-
describe('child process worker proxy', ()
|
|
19
|
+
describe('child process worker proxy', function () {
|
|
18
20
|
let caller: Caller<WorkerRuntime>;
|
|
19
21
|
let childProcess: ChildProcess;
|
|
20
22
|
|
|
21
|
-
afterEach(()
|
|
23
|
+
afterEach(function () {
|
|
22
24
|
if (caller) {
|
|
23
25
|
caller[cancel]();
|
|
24
26
|
caller = null;
|
|
@@ -30,7 +32,7 @@ describe('child process worker proxy', () => {
|
|
|
30
32
|
}
|
|
31
33
|
});
|
|
32
34
|
|
|
33
|
-
it('should start worker runtime and proxy calls', async()
|
|
35
|
+
it('should start worker runtime and proxy calls', async function () {
|
|
34
36
|
childProcess = fork(childProcessModulePath);
|
|
35
37
|
caller = createCaller(['init', 'evaluate'], childProcess);
|
|
36
38
|
await caller.init('mongodb://nodb/', dummyOptions, { nodb: true });
|
|
@@ -38,15 +40,23 @@ describe('child process worker proxy', () => {
|
|
|
38
40
|
expect(result.printable).to.equal(2);
|
|
39
41
|
});
|
|
40
42
|
|
|
41
|
-
it('should exit on its own when the parent process disconnects', async()
|
|
42
|
-
const intermediateProcess = spawn(
|
|
43
|
-
|
|
43
|
+
it('should exit on its own when the parent process disconnects', async function () {
|
|
44
|
+
const intermediateProcess = spawn(
|
|
45
|
+
process.execPath,
|
|
46
|
+
[
|
|
47
|
+
'-e',
|
|
48
|
+
`require("child_process")
|
|
44
49
|
.fork(${JSON.stringify(childProcessModulePath)})
|
|
45
|
-
.on("message", function(m) { console.log("message " + m + " from " + this.pid) })
|
|
46
|
-
|
|
50
|
+
.on("message", function(m) { console.log("message " + m + " from " + this.pid) })`,
|
|
51
|
+
],
|
|
52
|
+
{ stdio: ['pipe', 'pipe', 'inherit'] }
|
|
53
|
+
);
|
|
47
54
|
|
|
48
55
|
// Make sure the outer child process runs and has created the inner child process
|
|
49
|
-
const [message] = await once(
|
|
56
|
+
const [message] = await once(
|
|
57
|
+
intermediateProcess.stdout.setEncoding('utf8'),
|
|
58
|
+
'data'
|
|
59
|
+
);
|
|
50
60
|
const match = message.trim().match(/^message ready from (?<pid>\d+)$/);
|
|
51
61
|
expect(match).to.not.equal(null);
|
|
52
62
|
|
|
@@ -17,7 +17,8 @@ import { once } from 'events';
|
|
|
17
17
|
import { SHARE_ENV, Worker } from 'worker_threads';
|
|
18
18
|
import path from 'path';
|
|
19
19
|
import { exposeAll, createCaller } from './rpc';
|
|
20
|
-
import { InterruptHandle
|
|
20
|
+
import type { InterruptHandle } from 'interruptor';
|
|
21
|
+
import { interrupt as nativeInterrupt } from 'interruptor';
|
|
21
22
|
|
|
22
23
|
const workerRuntimeSrcPath =
|
|
23
24
|
process.env.WORKER_RUNTIME_SRC_PATH_DO_NOT_USE_THIS_EXCEPT_FOR_TESTING ||
|
|
@@ -25,15 +26,15 @@ const workerRuntimeSrcPath =
|
|
|
25
26
|
|
|
26
27
|
const workerProcess = new Worker(workerRuntimeSrcPath, { env: SHARE_ENV });
|
|
27
28
|
|
|
28
|
-
const workerReadyPromise: Promise<void> = (async() => {
|
|
29
|
-
const waitForReadyMessage = async() => {
|
|
29
|
+
const workerReadyPromise: Promise<void> = (async () => {
|
|
30
|
+
const waitForReadyMessage = async () => {
|
|
30
31
|
let msg: string;
|
|
31
32
|
while (([msg] = await once(workerProcess, 'message'))) {
|
|
32
33
|
if (msg === 'ready') return;
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
|
|
36
|
-
const waitForError = async() => {
|
|
37
|
+
const waitForError = async () => {
|
|
37
38
|
const [err] = await once(workerProcess, 'error');
|
|
38
39
|
if (err) {
|
|
39
40
|
err.message = `Worker thread failed to start with the following error: ${err.message}`;
|
|
@@ -41,10 +42,7 @@ const workerReadyPromise: Promise<void> = (async() => {
|
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
44
|
|
|
44
|
-
await Promise.race([
|
|
45
|
-
waitForReadyMessage(),
|
|
46
|
-
waitForError()
|
|
47
|
-
]);
|
|
45
|
+
await Promise.race([waitForReadyMessage(), waitForError()]);
|
|
48
46
|
})();
|
|
49
47
|
|
|
50
48
|
// We expect the amount of listeners to be more than the default value of 10 but
|
|
@@ -54,7 +52,6 @@ const workerReadyPromise: Promise<void> = (async() => {
|
|
|
54
52
|
process.setMaxListeners(25);
|
|
55
53
|
workerProcess.setMaxListeners(25);
|
|
56
54
|
|
|
57
|
-
|
|
58
55
|
let interruptHandle: InterruptHandle | null = null;
|
|
59
56
|
|
|
60
57
|
const { interrupt } = createCaller(['interrupt'], workerProcess);
|
|
@@ -72,7 +69,7 @@ const worker = Object.assign(
|
|
|
72
69
|
}
|
|
73
70
|
|
|
74
71
|
return interrupt();
|
|
75
|
-
}
|
|
72
|
+
},
|
|
76
73
|
}
|
|
77
74
|
);
|
|
78
75
|
|
|
@@ -81,7 +78,7 @@ function waitForWorkerReadyProxy<T extends Function>(fn: T): T {
|
|
|
81
78
|
async apply(target, thisArg, argumentsList) {
|
|
82
79
|
await workerReadyPromise;
|
|
83
80
|
return target.call(thisArg, ...Array.from(argumentsList));
|
|
84
|
-
}
|
|
81
|
+
},
|
|
85
82
|
});
|
|
86
83
|
}
|
|
87
84
|
|
|
@@ -96,15 +93,22 @@ exposeAll(worker, process);
|
|
|
96
93
|
const evaluationListener = Object.assign(
|
|
97
94
|
createCaller(
|
|
98
95
|
[
|
|
99
|
-
'onPrint',
|
|
100
|
-
'
|
|
96
|
+
'onPrint',
|
|
97
|
+
'onPrompt',
|
|
98
|
+
'getConfig',
|
|
99
|
+
'setConfig',
|
|
100
|
+
'resetConfig',
|
|
101
|
+
'validateConfig',
|
|
102
|
+
'listConfigOptions',
|
|
103
|
+
'onClearCommand',
|
|
104
|
+
'onExit',
|
|
101
105
|
],
|
|
102
106
|
process
|
|
103
107
|
),
|
|
104
108
|
{
|
|
105
109
|
onRunInterruptible(handle: InterruptHandle | null) {
|
|
106
110
|
interruptHandle = handle;
|
|
107
|
-
}
|
|
111
|
+
},
|
|
108
112
|
}
|
|
109
113
|
);
|
|
110
114
|
|
|
@@ -116,6 +120,5 @@ exposeAll(messageBus, workerProcess);
|
|
|
116
120
|
|
|
117
121
|
process.once('disconnect', () => process.exit());
|
|
118
122
|
process.nextTick(() => {
|
|
119
|
-
// eslint-disable-next-line chai-friendly/no-unused-expressions
|
|
120
123
|
process.send?.('ready');
|
|
121
124
|
});
|