@mongosh/node-runtime-worker-thread 1.2.2 → 1.3.1
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 +2 -2
- package/dist/child-process-proxy.js +1 -1
- package/dist/index.js +1 -1
- package/dist/worker-runtime.js +7 -7
- package/package.json +9 -8
- package/src/index.spec.ts +8 -8
- package/src/lock.spec.ts +1 -1
- package/src/rpc.spec.ts +4 -4
- package/src/rpc.ts +2 -2
- package/src/spawn-child-from-source.spec.ts +3 -3
- package/src/worker-runtime.spec.ts +6 -6
- package/webpack.config.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongosh/node-runtime-worker-thread",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
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,11 +28,11 @@
|
|
|
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.
|
|
31
|
+
"@mongosh/browser-runtime-core": "1.3.1",
|
|
32
|
+
"@mongosh/browser-runtime-electron": "1.3.1",
|
|
33
|
+
"@mongosh/service-provider-core": "1.3.1",
|
|
34
|
+
"@mongosh/service-provider-server": "1.3.1",
|
|
35
|
+
"@mongosh/types": "1.3.1",
|
|
36
36
|
"bson": "^4.6.1",
|
|
37
37
|
"mocha": "^7.1.2",
|
|
38
38
|
"postmsg-rpc": "^2.4.0",
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
"webpack-cli": "^4.3.1"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"interruptor": "^1.0.1"
|
|
45
|
+
"interruptor": "^1.0.1",
|
|
46
|
+
"system-ca": "^1.0.2"
|
|
46
47
|
},
|
|
47
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "29a1453899120580f7ee669ec5952810b86d11b7"
|
|
48
49
|
}
|
package/src/index.spec.ts
CHANGED
|
@@ -47,7 +47,7 @@ describe('WorkerRuntime', () => {
|
|
|
47
47
|
|
|
48
48
|
try {
|
|
49
49
|
await runtime.evaluate('1+1');
|
|
50
|
-
} catch (e) {
|
|
50
|
+
} catch (e: any) {
|
|
51
51
|
err = e;
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -66,7 +66,7 @@ describe('WorkerRuntime', () => {
|
|
|
66
66
|
|
|
67
67
|
try {
|
|
68
68
|
await runtime.evaluate('1+1');
|
|
69
|
-
} catch (e) {
|
|
69
|
+
} catch (e: any) {
|
|
70
70
|
err = e;
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -91,7 +91,7 @@ describe('WorkerRuntime', () => {
|
|
|
91
91
|
|
|
92
92
|
try {
|
|
93
93
|
await runtime.evaluate('throw new TypeError("Oh no, types!")');
|
|
94
|
-
} catch (e) {
|
|
94
|
+
} catch (e: any) {
|
|
95
95
|
err = e;
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -189,7 +189,7 @@ describe('WorkerRuntime', () => {
|
|
|
189
189
|
try {
|
|
190
190
|
process.kill(pid, 0);
|
|
191
191
|
return true;
|
|
192
|
-
} catch (e) {
|
|
192
|
+
} catch (e: any) {
|
|
193
193
|
return false;
|
|
194
194
|
}
|
|
195
195
|
}
|
|
@@ -223,7 +223,7 @@ describe('WorkerRuntime', () => {
|
|
|
223
223
|
await runtime.terminate();
|
|
224
224
|
})()
|
|
225
225
|
]);
|
|
226
|
-
} catch (e) {
|
|
226
|
+
} catch (e: any) {
|
|
227
227
|
err = e;
|
|
228
228
|
}
|
|
229
229
|
expect(err).to.be.instanceof(Error);
|
|
@@ -250,7 +250,7 @@ describe('WorkerRuntime', () => {
|
|
|
250
250
|
await runtime.interrupt();
|
|
251
251
|
})()
|
|
252
252
|
]);
|
|
253
|
-
} catch (e) {
|
|
253
|
+
} catch (e: any) {
|
|
254
254
|
err = e;
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -275,7 +275,7 @@ describe('WorkerRuntime', () => {
|
|
|
275
275
|
await runtime.interrupt();
|
|
276
276
|
})()
|
|
277
277
|
]);
|
|
278
|
-
} catch (e) {
|
|
278
|
+
} catch (e: any) {
|
|
279
279
|
err = e;
|
|
280
280
|
}
|
|
281
281
|
|
|
@@ -298,7 +298,7 @@ describe('WorkerRuntime', () => {
|
|
|
298
298
|
await runtime.interrupt();
|
|
299
299
|
})()
|
|
300
300
|
]);
|
|
301
|
-
} catch (e) {
|
|
301
|
+
} catch (e: any) {
|
|
302
302
|
// ignore
|
|
303
303
|
}
|
|
304
304
|
|
package/src/lock.spec.ts
CHANGED
package/src/rpc.spec.ts
CHANGED
|
@@ -115,7 +115,7 @@ describe('rpc', () => {
|
|
|
115
115
|
try {
|
|
116
116
|
// eslint-disable-next-line @typescript-eslint/await-thenable
|
|
117
117
|
await caller.throws();
|
|
118
|
-
} catch (e) {
|
|
118
|
+
} catch (e: any) {
|
|
119
119
|
err = e;
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -144,7 +144,7 @@ describe('rpc', () => {
|
|
|
144
144
|
|
|
145
145
|
try {
|
|
146
146
|
await caller.callMe((a: number, b: number) => a + b);
|
|
147
|
-
} catch (e) {
|
|
147
|
+
} catch (e: any) {
|
|
148
148
|
err = e;
|
|
149
149
|
}
|
|
150
150
|
|
|
@@ -171,7 +171,7 @@ describe('rpc', () => {
|
|
|
171
171
|
|
|
172
172
|
try {
|
|
173
173
|
await caller.returnsFunction();
|
|
174
|
-
} catch (e) {
|
|
174
|
+
} catch (e: any) {
|
|
175
175
|
err = e;
|
|
176
176
|
}
|
|
177
177
|
|
|
@@ -217,7 +217,7 @@ describe('rpc', () => {
|
|
|
217
217
|
caller[cancel]();
|
|
218
218
|
})()
|
|
219
219
|
]);
|
|
220
|
-
} catch (e) {
|
|
220
|
+
} catch (e: any) {
|
|
221
221
|
err = e;
|
|
222
222
|
}
|
|
223
223
|
expect(err).to.be.instanceof(Error);
|
package/src/rpc.ts
CHANGED
|
@@ -98,7 +98,7 @@ function getRPCOptions(messageBus: RPCMessageBus): PostmsgRpcOptions {
|
|
|
98
98
|
// that was executing the method.
|
|
99
99
|
try {
|
|
100
100
|
data.res = serialize(data.res);
|
|
101
|
-
} catch (e) {
|
|
101
|
+
} catch (e: any) {
|
|
102
102
|
data.res = serialize({
|
|
103
103
|
type: RPCMessageTypes.Error,
|
|
104
104
|
payload: serializeError(e)
|
|
@@ -141,7 +141,7 @@ export function exposeAll<O>(obj: O, messageBus: RPCMessageBus): Exposed<O> {
|
|
|
141
141
|
async(...args: unknown[]) => {
|
|
142
142
|
try {
|
|
143
143
|
return { type: RPCMessageTypes.Message, payload: await val(...args) };
|
|
144
|
-
} catch (e) {
|
|
144
|
+
} catch (e: any) {
|
|
145
145
|
// If server (whatever is executing the exposed method) throws during
|
|
146
146
|
// the execution, we want to propagate error to the client (whatever
|
|
147
147
|
// issued the call) and re-throw there. We will do this with a special
|
|
@@ -23,7 +23,7 @@ describe('spawnChildFromSource', () => {
|
|
|
23
23
|
// @ts-expect-error
|
|
24
24
|
stdio: 'ignore'
|
|
25
25
|
});
|
|
26
|
-
} catch (e) {
|
|
26
|
+
} catch (e: any) {
|
|
27
27
|
err = e;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -58,7 +58,7 @@ describe('spawnChildFromSource', () => {
|
|
|
58
58
|
'ignore',
|
|
59
59
|
'ignore'
|
|
60
60
|
);
|
|
61
|
-
} catch (e) {
|
|
61
|
+
} catch (e: any) {
|
|
62
62
|
err = e;
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -77,7 +77,7 @@ describe('spawnChildFromSource', () => {
|
|
|
77
77
|
{},
|
|
78
78
|
10
|
|
79
79
|
);
|
|
80
|
-
} catch (e) {
|
|
80
|
+
} catch (e: any) {
|
|
81
81
|
err = e;
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -82,7 +82,7 @@ describe('worker', () => {
|
|
|
82
82
|
|
|
83
83
|
try {
|
|
84
84
|
await evaluate('1 + 1');
|
|
85
|
-
} catch (e) {
|
|
85
|
+
} catch (e: any) {
|
|
86
86
|
err = e;
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -384,7 +384,7 @@ describe('worker', () => {
|
|
|
384
384
|
let err: Error;
|
|
385
385
|
try {
|
|
386
386
|
await evaluate('throw new TypeError("Oh no, types!")');
|
|
387
|
-
} catch (e) {
|
|
387
|
+
} catch (e: any) {
|
|
388
388
|
err = e;
|
|
389
389
|
}
|
|
390
390
|
|
|
@@ -404,7 +404,7 @@ describe('worker', () => {
|
|
|
404
404
|
let err: Error;
|
|
405
405
|
try {
|
|
406
406
|
await evaluate('throw Object.assign(new TypeError("Oh no, types!"), { errInfo: { message: "wrong type :S" } })');
|
|
407
|
-
} catch (e) {
|
|
407
|
+
} catch (e: any) {
|
|
408
408
|
err = e;
|
|
409
409
|
}
|
|
410
410
|
|
|
@@ -440,7 +440,7 @@ describe('worker', () => {
|
|
|
440
440
|
evaluate('sleep(50); 1+1'),
|
|
441
441
|
evaluate('sleep(50); 1+1')
|
|
442
442
|
]);
|
|
443
|
-
} catch (e) {
|
|
443
|
+
} catch (e: any) {
|
|
444
444
|
err = e;
|
|
445
445
|
}
|
|
446
446
|
|
|
@@ -653,7 +653,7 @@ describe('worker', () => {
|
|
|
653
653
|
interrupt(handle);
|
|
654
654
|
})()
|
|
655
655
|
]);
|
|
656
|
-
} catch (e) {
|
|
656
|
+
} catch (e: any) {
|
|
657
657
|
err = e;
|
|
658
658
|
}
|
|
659
659
|
|
|
@@ -681,7 +681,7 @@ describe('worker', () => {
|
|
|
681
681
|
await interrupt();
|
|
682
682
|
})()
|
|
683
683
|
]);
|
|
684
|
-
} catch (e) {
|
|
684
|
+
} catch (e: any) {
|
|
685
685
|
err = e;
|
|
686
686
|
}
|
|
687
687
|
|