@mongosh/node-runtime-worker-thread 1.6.1 → 1.7.0
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/dist/child-process-proxy.js +1 -1
- package/dist/index.js +1 -1
- package/dist/report.html +39 -0
- package/dist/worker-runtime.js +98 -98
- package/package.json +9 -13
- package/src/index.d.ts +0 -6
- package/webpack.config.js +5 -31
- package/dist/src/child-process-evaluation-listener.d.ts +0 -10
- package/dist/src/child-process-mongosh-bus.d.ts +0 -9
- package/dist/src/child-process-proxy.d.ts +0 -1
- package/dist/src/index.d.ts +0 -29
- package/dist/src/lock.d.ts +0 -10
- package/dist/src/rpc.d.ts +0 -28
- package/dist/src/serializer.d.ts +0 -13
- package/dist/src/spawn-child-from-source.d.ts +0 -4
- package/dist/src/worker-runtime.d.ts +0 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongosh/node-runtime-worker-thread",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
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",
|
|
@@ -28,22 +28,18 @@
|
|
|
28
28
|
"prepublish": "npm run webpack-build"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@mongosh/browser-runtime-core": "1.
|
|
32
|
-
"@mongosh/browser-runtime-electron": "1.
|
|
33
|
-
"@mongosh/service-provider-core": "1.
|
|
34
|
-
"@mongosh/service-provider-server": "1.
|
|
35
|
-
"@mongosh/types": "1.
|
|
36
|
-
"bson": "^4.7.
|
|
31
|
+
"@mongosh/browser-runtime-core": "1.7.0",
|
|
32
|
+
"@mongosh/browser-runtime-electron": "1.7.0",
|
|
33
|
+
"@mongosh/service-provider-core": "1.7.0",
|
|
34
|
+
"@mongosh/service-provider-server": "1.7.0",
|
|
35
|
+
"@mongosh/types": "1.7.0",
|
|
36
|
+
"bson": "^4.7.2",
|
|
37
37
|
"mocha": "^7.1.2",
|
|
38
|
-
"postmsg-rpc": "^2.4.0"
|
|
39
|
-
"terser-webpack-plugin": "^4.2.3",
|
|
40
|
-
"ts-loader": "^8.0.14",
|
|
41
|
-
"webpack": "^5.75.0",
|
|
42
|
-
"webpack-cli": "^4.3.1"
|
|
38
|
+
"postmsg-rpc": "^2.4.0"
|
|
43
39
|
},
|
|
44
40
|
"dependencies": {
|
|
45
41
|
"interruptor": "^1.0.1",
|
|
46
42
|
"system-ca": "^1.0.2"
|
|
47
43
|
},
|
|
48
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "a2605fcf349a050c7a9081016a431b036b4c5ec3"
|
|
49
45
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -42,12 +42,6 @@ declare module 'inline-entry-loader!*' {
|
|
|
42
42
|
export default entry;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
declare type Params<T extends (...args: any) => any> = T extends (
|
|
46
|
-
...args: infer P
|
|
47
|
-
) => any
|
|
48
|
-
? P
|
|
49
|
-
: never;
|
|
50
|
-
|
|
51
45
|
declare type CancelablePromise<T> = Promise<T> & { cancel(): void };
|
|
52
46
|
|
|
53
47
|
declare type CancelableMethods<T> = {
|
package/webpack.config.js
CHANGED
|
@@ -1,43 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const { merge } = require('webpack-merge');
|
|
1
3
|
const path = require('path');
|
|
2
|
-
|
|
4
|
+
|
|
5
|
+
const baseWebpackConfig = require('../../config/webpack.base.config');
|
|
3
6
|
|
|
4
7
|
/** @type import('webpack').Configuration */
|
|
5
8
|
const config = {
|
|
6
|
-
target: 'node',
|
|
7
|
-
|
|
8
9
|
output: {
|
|
9
10
|
path: path.resolve(__dirname, 'dist'),
|
|
10
11
|
filename: '[name].js',
|
|
11
12
|
libraryTarget: 'umd'
|
|
12
13
|
},
|
|
13
14
|
|
|
14
|
-
module: {
|
|
15
|
-
rules: [
|
|
16
|
-
{
|
|
17
|
-
test: /\.ts$/,
|
|
18
|
-
use: [{ loader: 'ts-loader' }],
|
|
19
|
-
exclude: [/node_modules/]
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
resolve: {
|
|
25
|
-
extensions: ['.ts', '.js']
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
optimization: {
|
|
29
|
-
minimizer: [
|
|
30
|
-
new TerserPlugin({
|
|
31
|
-
terserOptions: {
|
|
32
|
-
// Not keeping classnames breaks shell-api during minification
|
|
33
|
-
keep_classnames: true
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
node: false,
|
|
40
|
-
|
|
41
15
|
externals: {
|
|
42
16
|
'mongodb-client-encryption': 'commonjs2 mongodb-client-encryption',
|
|
43
17
|
kerberos: 'commonjs2 kerberos',
|
|
@@ -51,6 +25,6 @@ const config = {
|
|
|
51
25
|
module.exports = ['index', 'child-process-proxy', 'worker-runtime'].map(
|
|
52
26
|
(entry) => ({
|
|
53
27
|
entry: { [entry]: path.resolve(__dirname, 'src', `${entry}.ts`) },
|
|
54
|
-
...config
|
|
28
|
+
...merge(baseWebpackConfig, config)
|
|
55
29
|
})
|
|
56
30
|
);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { ChildProcess } from 'child_process';
|
|
3
|
-
import { Exposed } from './rpc';
|
|
4
|
-
import type { WorkerRuntime } from './index';
|
|
5
|
-
import { RuntimeEvaluationListener } from '@mongosh/browser-runtime-core';
|
|
6
|
-
export declare class ChildProcessEvaluationListener {
|
|
7
|
-
exposedListener: Exposed<Required<Omit<RuntimeEvaluationListener, 'onLoad' | 'getCryptLibraryOptions'>>>;
|
|
8
|
-
constructor(workerRuntime: WorkerRuntime, childProcess: ChildProcess);
|
|
9
|
-
terminate(): void;
|
|
10
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { ChildProcess } from 'child_process';
|
|
3
|
-
import { MongoshBus } from '@mongosh/types';
|
|
4
|
-
import { Exposed } from './rpc';
|
|
5
|
-
export declare class ChildProcessMongoshBus {
|
|
6
|
-
exposedEmitter: Exposed<MongoshBus>;
|
|
7
|
-
constructor(eventEmitter: MongoshBus, childProcess: ChildProcess);
|
|
8
|
-
terminate(): void;
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { SpawnOptionsWithoutStdio } from 'child_process';
|
|
3
|
-
import { Runtime, RuntimeEvaluationListener, RuntimeEvaluationResult } from '@mongosh/browser-runtime-core';
|
|
4
|
-
import type { MongoshBus } from '@mongosh/types';
|
|
5
|
-
import type { CompassServiceProvider } from '@mongosh/service-provider-server';
|
|
6
|
-
declare type DevtoolsConnectOptions = Parameters<(typeof CompassServiceProvider)['connect']>[1];
|
|
7
|
-
declare class WorkerRuntime implements Runtime {
|
|
8
|
-
private initOptions;
|
|
9
|
-
evaluationListener: RuntimeEvaluationListener | null;
|
|
10
|
-
private eventEmitter;
|
|
11
|
-
private childProcessMongoshBus;
|
|
12
|
-
private childProcessEvaluationListener;
|
|
13
|
-
private childProcess;
|
|
14
|
-
private childProcessRuntime;
|
|
15
|
-
private initWorkerPromise;
|
|
16
|
-
private childProcessProxySrcPath;
|
|
17
|
-
constructor(uri: string, driverOptions?: DevtoolsConnectOptions, cliOptions?: {
|
|
18
|
-
nodb?: boolean;
|
|
19
|
-
}, spawnOptions?: SpawnOptionsWithoutStdio, eventEmitter?: MongoshBus);
|
|
20
|
-
private initWorker;
|
|
21
|
-
evaluate(code: string): Promise<RuntimeEvaluationResult>;
|
|
22
|
-
getCompletions(code: string): Promise<import("@mongosh/browser-runtime-core").Completion[]>;
|
|
23
|
-
getShellPrompt(): Promise<string>;
|
|
24
|
-
setEvaluationListener(listener: RuntimeEvaluationListener | null): RuntimeEvaluationListener | null;
|
|
25
|
-
terminate(): Promise<void>;
|
|
26
|
-
interrupt(): Promise<boolean>;
|
|
27
|
-
waitForRuntimeToBeReady(): Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
export { WorkerRuntime };
|
package/dist/src/lock.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare type UNLOCKED = 'UNLOCKED';
|
|
2
|
-
export declare class Lock {
|
|
3
|
-
private static UNLOCK_TOKEN;
|
|
4
|
-
private promise;
|
|
5
|
-
private resolve;
|
|
6
|
-
lock(): Promise<UNLOCKED>;
|
|
7
|
-
unlock(): boolean;
|
|
8
|
-
isLocked(): boolean;
|
|
9
|
-
isUnlockToken(resolvedValue: any): resolvedValue is UNLOCKED;
|
|
10
|
-
}
|
package/dist/src/rpc.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export declare function serialize(data: unknown): string;
|
|
2
|
-
export declare function deserialize<T = unknown>(str: string): T | string;
|
|
3
|
-
declare type RPCMessageBus = {
|
|
4
|
-
on: Function;
|
|
5
|
-
off: Function;
|
|
6
|
-
} & ({
|
|
7
|
-
postMessage: Function;
|
|
8
|
-
send?: never;
|
|
9
|
-
} | {
|
|
10
|
-
postMessage?: never;
|
|
11
|
-
send?: Function;
|
|
12
|
-
});
|
|
13
|
-
export declare function removeTrailingUndefined(arr: unknown[]): unknown[];
|
|
14
|
-
export declare const close: unique symbol;
|
|
15
|
-
export declare const cancel: unique symbol;
|
|
16
|
-
export declare type Exposed<T> = {
|
|
17
|
-
[k in keyof T]: T[k] & {
|
|
18
|
-
close(): void;
|
|
19
|
-
};
|
|
20
|
-
} & {
|
|
21
|
-
[close]: () => void;
|
|
22
|
-
};
|
|
23
|
-
export declare function exposeAll<O>(obj: O, messageBus: RPCMessageBus): Exposed<O>;
|
|
24
|
-
export declare type Caller<Impl, Keys extends keyof Impl = keyof Impl> = CancelableMethods<Pick<Impl, Keys>> & {
|
|
25
|
-
[cancel]: () => void;
|
|
26
|
-
};
|
|
27
|
-
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]>;
|
|
28
|
-
export {};
|
package/dist/src/serializer.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { RuntimeEvaluationResult } from '@mongosh/browser-runtime-core';
|
|
2
|
-
import type { DevtoolsConnectOptions } from '@mongosh/service-provider-server/lib/cli-service-provider';
|
|
3
|
-
export declare function serializeError(err: Error): Error;
|
|
4
|
-
export declare function deserializeError(err: any): Error;
|
|
5
|
-
export declare enum SerializedResultTypes {
|
|
6
|
-
SerializedErrorResult = "SerializedErrorResult",
|
|
7
|
-
InspectResult = "InspectResult",
|
|
8
|
-
SerializedShellApiResult = "SerializedShellApiResult"
|
|
9
|
-
}
|
|
10
|
-
export declare function serializeEvaluationResult({ type, printable, source }: RuntimeEvaluationResult): RuntimeEvaluationResult;
|
|
11
|
-
export declare function deserializeEvaluationResult({ type, printable, source }: RuntimeEvaluationResult): RuntimeEvaluationResult;
|
|
12
|
-
export declare function serializeConnectOptions(options?: Readonly<DevtoolsConnectOptions>): DevtoolsConnectOptions;
|
|
13
|
-
export declare function deserializeConnectOptions(options: Readonly<DevtoolsConnectOptions>): DevtoolsConnectOptions;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { ChildProcess, SpawnOptions, StdioNull, StdioPipe } from 'child_process';
|
|
3
|
-
export declare function kill(childProcess: ChildProcess, code?: NodeJS.Signals | number): Promise<void>;
|
|
4
|
-
export default function spawnChildFromSource(src: string, spawnOptions?: Omit<SpawnOptions, 'stdio'>, timeoutMs?: number, _stdout?: StdioNull | StdioPipe, _stderr?: StdioNull | StdioPipe): Promise<ChildProcess>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Runtime, RuntimeEvaluationListener } from '@mongosh/browser-runtime-core';
|
|
2
|
-
import { CompassServiceProvider } from '@mongosh/service-provider-server';
|
|
3
|
-
import { InterruptHandle } from 'interruptor';
|
|
4
|
-
declare type DevtoolsConnectOptions = Parameters<(typeof CompassServiceProvider)['connect']>[1];
|
|
5
|
-
export declare type WorkerRuntimeEvaluationListener = RuntimeEvaluationListener & {
|
|
6
|
-
onRunInterruptible(handle: InterruptHandle | null): void;
|
|
7
|
-
};
|
|
8
|
-
export declare type WorkerRuntime = Runtime & {
|
|
9
|
-
init(uri: string, driverOptions?: DevtoolsConnectOptions, cliOptions?: {
|
|
10
|
-
nodb?: boolean;
|
|
11
|
-
}): Promise<void>;
|
|
12
|
-
interrupt(): boolean;
|
|
13
|
-
};
|
|
14
|
-
export {};
|