@mongosh/node-runtime-worker-thread 1.4.1 → 1.4.2
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/serializer.js +3 -3
- package/dist/serializer.js.map +1 -1
- package/dist/worker-runtime.js +2 -2
- package/package.json +7 -7
- package/src/serializer.spec.ts +38 -2
- package/src/serializer.ts +3 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongosh/node-runtime-worker-thread",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
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.4.
|
|
32
|
-
"@mongosh/browser-runtime-electron": "1.4.
|
|
33
|
-
"@mongosh/service-provider-core": "1.4.
|
|
34
|
-
"@mongosh/service-provider-server": "1.4.
|
|
35
|
-
"@mongosh/types": "1.4.
|
|
31
|
+
"@mongosh/browser-runtime-core": "1.4.2",
|
|
32
|
+
"@mongosh/browser-runtime-electron": "1.4.2",
|
|
33
|
+
"@mongosh/service-provider-core": "1.4.2",
|
|
34
|
+
"@mongosh/service-provider-server": "1.4.2",
|
|
35
|
+
"@mongosh/types": "1.4.2",
|
|
36
36
|
"bson": "^4.6.2",
|
|
37
37
|
"mocha": "^7.1.2",
|
|
38
38
|
"postmsg-rpc": "^2.4.0",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"interruptor": "^1.0.1",
|
|
46
46
|
"system-ca": "^1.0.2"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "7daf54d237b923567f44725816de7f62f471df11"
|
|
49
49
|
}
|
package/src/serializer.spec.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DevtoolsConnectOptions } from '@mongosh/service-provider-server/lib/cli-service-provider';
|
|
2
2
|
import { expect } from 'chai';
|
|
3
|
-
import { UUID } from 'bson';
|
|
3
|
+
import { UUID, Long } from 'bson';
|
|
4
4
|
import {
|
|
5
5
|
serializeError,
|
|
6
6
|
deserializeError,
|
|
@@ -141,7 +141,7 @@ describe('serializer', () => {
|
|
|
141
141
|
});
|
|
142
142
|
|
|
143
143
|
describe('connection options', () => {
|
|
144
|
-
it('should serialize and deserialize connection options', () => {
|
|
144
|
+
it('should serialize and deserialize FLE1 connection options', () => {
|
|
145
145
|
const options: DevtoolsConnectOptions = {
|
|
146
146
|
autoEncryption: {
|
|
147
147
|
schemaMap: {
|
|
@@ -184,5 +184,41 @@ describe('serializer', () => {
|
|
|
184
184
|
|
|
185
185
|
expect(deserializeConnectOptions(serialized)).to.deep.equal(options);
|
|
186
186
|
});
|
|
187
|
+
|
|
188
|
+
it('should serialize and deserialize FLE2 connection options', () => {
|
|
189
|
+
const options: DevtoolsConnectOptions = {
|
|
190
|
+
autoEncryption: {
|
|
191
|
+
encryptedFieldsMap: {
|
|
192
|
+
'hr.employees': {
|
|
193
|
+
fields: [{
|
|
194
|
+
path: 'phoneNumber',
|
|
195
|
+
keyId: new UUID('fd6275d7-9260-4e6c-a86b-68ec5240814a').toBinary(),
|
|
196
|
+
bsonType: 'string',
|
|
197
|
+
queries: { queryType: 'equality', contention: new Long(0) }
|
|
198
|
+
}]
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
const serialized = serializeConnectOptions(options);
|
|
205
|
+
|
|
206
|
+
expect(serialized).to.deep.equal({
|
|
207
|
+
autoEncryption: {
|
|
208
|
+
encryptedFieldsMap: {
|
|
209
|
+
'hr.employees': {
|
|
210
|
+
fields: [{
|
|
211
|
+
path: 'phoneNumber',
|
|
212
|
+
keyId: { $binary: { base64: '/WJ115JgTmyoa2jsUkCBSg==', subType: '04' } },
|
|
213
|
+
bsonType: 'string',
|
|
214
|
+
queries: { queryType: 'equality', contention: { $numberLong: '0' } }
|
|
215
|
+
}]
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
expect(deserializeConnectOptions(serialized)).to.deep.equal(options);
|
|
222
|
+
});
|
|
187
223
|
});
|
|
188
224
|
});
|
package/src/serializer.ts
CHANGED
|
@@ -114,9 +114,7 @@ export function deserializeEvaluationResult({
|
|
|
114
114
|
|
|
115
115
|
const autoEncryptionBSONOptions = [
|
|
116
116
|
'schemaMap',
|
|
117
|
-
|
|
118
|
-
// This may need to be adjusted later.
|
|
119
|
-
'encryptedFieldConfigMap'
|
|
117
|
+
'encryptedFieldsMap'
|
|
120
118
|
] as const;
|
|
121
119
|
|
|
122
120
|
export function serializeConnectOptions(options: Readonly<DevtoolsConnectOptions> = {}): DevtoolsConnectOptions {
|
|
@@ -125,7 +123,7 @@ export function serializeConnectOptions(options: Readonly<DevtoolsConnectOptions
|
|
|
125
123
|
if (serializedOptions.autoEncryption?.[autoEncryptionOption]) {
|
|
126
124
|
serializedOptions.autoEncryption = {
|
|
127
125
|
...serializedOptions.autoEncryption,
|
|
128
|
-
[autoEncryptionOption]: EJSON.serialize(serializedOptions.autoEncryption[autoEncryptionOption])
|
|
126
|
+
[autoEncryptionOption]: EJSON.serialize(serializedOptions.autoEncryption[autoEncryptionOption], { relaxed: false })
|
|
129
127
|
};
|
|
130
128
|
}
|
|
131
129
|
}
|
|
@@ -138,7 +136,7 @@ export function deserializeConnectOptions(options: Readonly<DevtoolsConnectOptio
|
|
|
138
136
|
if (deserializedOptions.autoEncryption?.[autoEncryptionOption]) {
|
|
139
137
|
deserializedOptions.autoEncryption = {
|
|
140
138
|
...deserializedOptions.autoEncryption,
|
|
141
|
-
[autoEncryptionOption]: EJSON.deserialize(deserializedOptions.autoEncryption[autoEncryptionOption])
|
|
139
|
+
[autoEncryptionOption]: EJSON.deserialize(deserializedOptions.autoEncryption[autoEncryptionOption], { relaxed: false })
|
|
142
140
|
};
|
|
143
141
|
}
|
|
144
142
|
}
|