@mongosh/node-runtime-worker-thread 5.0.2 → 5.0.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/dist/index.js +1 -1
- package/dist/report.html +2 -2
- package/dist/serializer.d.ts +2 -2
- package/dist/serializer.js +13 -5
- package/dist/serializer.js.map +1 -1
- package/dist/worker-runtime.js +2 -2
- package/package.json +4 -4
- package/src/serializer.ts +13 -3
- package/src/worker-runtime.spec.ts +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongosh/node-runtime-worker-thread",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.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",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"@mongodb-js/prettier-config-devtools": "^1.0.1",
|
|
40
40
|
"@mongodb-js/sbom-tools": "^0.10.4",
|
|
41
41
|
"@mongodb-js/tsconfig-mongosh": "^1.0.0",
|
|
42
|
-
"@mongosh/browser-runtime-core": "^5.1.
|
|
43
|
-
"@mongosh/browser-runtime-electron": "^5.1.
|
|
42
|
+
"@mongosh/browser-runtime-core": "^5.1.1",
|
|
43
|
+
"@mongosh/browser-runtime-electron": "^5.1.1",
|
|
44
44
|
"@mongosh/service-provider-core": "5.0.1",
|
|
45
45
|
"@mongosh/service-provider-node-driver": "^5.0.2",
|
|
46
46
|
"@mongosh/testing": "2.0.1",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"interruptor": "^1.0.2",
|
|
58
58
|
"system-ca": "^3.0.0"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "358be80f16d6556d17ef5b47326818c6711420bb"
|
|
61
61
|
}
|
package/src/serializer.ts
CHANGED
|
@@ -53,10 +53,11 @@ export function serializeEvaluationResult({
|
|
|
53
53
|
type,
|
|
54
54
|
printable,
|
|
55
55
|
source,
|
|
56
|
+
constructionOptions,
|
|
56
57
|
}: RuntimeEvaluationResult): RuntimeEvaluationResult {
|
|
57
58
|
// Primitive values don't require any special treatment for serialization
|
|
58
59
|
if (isPrimitive(printable)) {
|
|
59
|
-
return { type, printable, source };
|
|
60
|
+
return { type, printable, source, constructionOptions };
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
// Errors are serialized as some error metadata can be lost without this
|
|
@@ -65,6 +66,7 @@ export function serializeEvaluationResult({
|
|
|
65
66
|
type: 'SerializedErrorResult',
|
|
66
67
|
printable: serializeError(printable),
|
|
67
68
|
source,
|
|
69
|
+
constructionOptions,
|
|
68
70
|
};
|
|
69
71
|
}
|
|
70
72
|
|
|
@@ -90,6 +92,7 @@ export function serializeEvaluationResult({
|
|
|
90
92
|
printable: {
|
|
91
93
|
origType: type,
|
|
92
94
|
serializedValue: EJSON.serialize(printable),
|
|
95
|
+
constructionOptions,
|
|
93
96
|
},
|
|
94
97
|
};
|
|
95
98
|
}
|
|
@@ -98,9 +101,15 @@ export function deserializeEvaluationResult({
|
|
|
98
101
|
type,
|
|
99
102
|
printable,
|
|
100
103
|
source,
|
|
104
|
+
constructionOptions,
|
|
101
105
|
}: RuntimeEvaluationResult): RuntimeEvaluationResult {
|
|
102
106
|
if (type === 'SerializedErrorResult') {
|
|
103
|
-
return {
|
|
107
|
+
return {
|
|
108
|
+
type,
|
|
109
|
+
printable: deserializeError(printable),
|
|
110
|
+
source,
|
|
111
|
+
constructionOptions,
|
|
112
|
+
};
|
|
104
113
|
}
|
|
105
114
|
|
|
106
115
|
if (type === 'SerializedShellApiResult') {
|
|
@@ -108,10 +117,11 @@ export function deserializeEvaluationResult({
|
|
|
108
117
|
type: printable.origType,
|
|
109
118
|
printable: EJSON.deserialize(printable.serializedValue),
|
|
110
119
|
source,
|
|
120
|
+
constructionOptions,
|
|
111
121
|
};
|
|
112
122
|
}
|
|
113
123
|
|
|
114
|
-
return { type, printable, source };
|
|
124
|
+
return { type, printable, source, constructionOptions };
|
|
115
125
|
}
|
|
116
126
|
|
|
117
127
|
const autoEncryptionBSONOptions = ['schemaMap', 'encryptedFieldsMap'] as const;
|
|
@@ -537,7 +537,12 @@ describe('worker-runtime', function () {
|
|
|
537
537
|
await evaluate('print("Hi!")');
|
|
538
538
|
|
|
539
539
|
expect(evalListener.onPrint).to.have.been.calledWith([
|
|
540
|
-
{
|
|
540
|
+
{
|
|
541
|
+
printable: 'Hi!',
|
|
542
|
+
source: undefined,
|
|
543
|
+
type: null,
|
|
544
|
+
constructionOptions: undefined,
|
|
545
|
+
},
|
|
541
546
|
]);
|
|
542
547
|
});
|
|
543
548
|
|