Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,154 changes: 277 additions & 877 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/compass-aggregations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"lodash.debounce": "^4.0.8",
"lodash.isempty": "^4.4.0",
"lodash.isstring": "^4.0.1",
"mongodb": "^4.4.1",
"mongodb": "^4.6.0",
"mongodb-ns": "^2.4.0",
"re-resizable": "^6.9.0",
"react-bootstrap": "^0.32.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,16 @@ describe('aggregation module', function () {
stub(aggregateMock, 'toArray').callsFake(async () => new Promise(() => { }));
const cursorCloseSpy = spy(aggregateMock, 'close');

const killSessionsCatchSpy = spy();
const killSessionsSpy = spy();
store.dispatch({
type: DATA_SERVICE_CONNECTED,
dataService: new class {
startSession() {
return {};
}
killSessions() {
return {
catch: () => killSessionsCatchSpy(),
}
killSessionsSpy();
return Promise.resolve();
}
aggregate() {
return aggregateMock;
Expand All @@ -140,7 +139,7 @@ describe('aggregation module', function () {

await wait();

expect(killSessionsCatchSpy.getCalls().map(x => x.args), 'calls killSessions with correct args').to.deep.equal([[]]);
expect(killSessionsSpy.getCalls().map(x => x.args), 'calls killSessions with correct args').to.deep.equal([[]]);
expect(cursorCloseSpy.getCalls().map(x => x.args), 'calls cursorClose with correct args').to.deep.equal([[]]);
expect(store.getState().aggregation).to.deep.equal({
documents,
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-aggregations/src/modules/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ const aggregate = (
dispatch(
stagePreviewUpdated(docs || [], index, e as Error, true, getState().env)
);
cursor.close();
void cursor.close();
dispatch(
globalAppRegistryEmit('agg-pipeline-executed', {
id: getState().id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ export async function aggregatePipeline({
{ ...defaultOptions, ...options }
);
const abort = () => {
cursor.close();
dataService.killSessions(session).catch(() => {
Promise.all([
cursor.close(),
dataService.killSessions(session)
]).catch((err) => {
log.warn(
mongoLogId(1001000105),
'Aggregations',
'Attempting to kill the session failed'
'Attempting to kill the session failed',
{ error: err.message }
);
});
};
Expand Down
4 changes: 2 additions & 2 deletions packages/compass-collection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@mongodb-js/compass-components": "^0.15.0",
"bson": "*",
"hadron-ipc": "^2.10.0",
"mongodb": "^4.4.1",
"mongodb": "^4.6.0",
"mongodb-collection-model": "^4.23.0",
"mongodb-data-service": "^21.21.0",
"numeral": "*",
Expand Down Expand Up @@ -99,7 +99,7 @@
"hadron-app-registry": "^8.12.0",
"hadron-ipc": "^2.10.0",
"mocha": "^8.4.0",
"mongodb": "^4.4.1",
"mongodb": "^4.6.0",
"mongodb-collection-model": "^4.23.0",
"mongodb-connection-string-url": "^2.5.2",
"mongodb-data-service": "^21.21.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-connections/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@mongodb-js/connection-form": "^0.6.0",
"debug": "^4.2.0",
"lodash": "^4.17.21",
"mongodb": "^4.4.0",
"mongodb": "^4.6.0",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"uuid": "^8.2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ describe('connection tracking', function () {
local: { key: 'asdf' },
aws: { accessKeyId: 'asdf', secretAccessKey: 'asdf' },
},
// @ts-expect-error next driver release will have types
encryptedFieldsMap: {
['foo.bar']: {},
},
Expand Down
3 changes: 1 addition & 2 deletions packages/compass-connections/src/modules/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ function getCsfleInformation(
const kmsProviders = configuredKMSProviders(fleOptions?.autoEncryption ?? {});
const csfleInfo: Record<string, unknown> = {
is_csfle: kmsProviders.length > 0,
// @ts-expect-error next driver release has types
has_csfle_schema: !!fleOptions?.autoEncryption.encryptedFieldsMap,
has_csfle_schema: !!fleOptions?.autoEncryption?.encryptedFieldsMap,
};

for (const kmsProvider of ['aws', 'gcp', 'kmip', 'local', 'azure'] as const) {
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"hadron-build": "^24.17.0",
"lodash": "^4.17.21",
"mocha": "*",
"mongodb": "^4.4.0",
"mongodb": "^4.6.0",
"mongodb-connection-string-url": "^2.5.2",
"mongodb-log-writer": "^1.1.4",
"mongodb-runner": "^4.9.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-import-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"lodash.throttle": "^4.1.1",
"marky": "^1.2.1",
"mime-types": "^2.1.24",
"mongodb": "^4.4.1",
"mongodb": "^4.6.0",
"mongodb-ns": "^2.4.0",
"mongodb-query-parser": "^2.4.6",
"object-sizeof": "^1.5.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/compass-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"leaflet-defaulticon-compatibility": "^0.1.1",
"lodash": "^4.17.21",
"mocha": "^8.4.0",
"mongodb": "^4.4.0",
"mongodb": "^4.6.0",
"mongodb-ns": "^2.4.0",
"node-fetch": "^2.6.1",
"nyc": "^15.1.0",
Expand Down
10 changes: 5 additions & 5 deletions packages/compass-shell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
"@leafygreen-ui/code": "^9.4.0",
"@mongodb-js/compass-logging": "^0.12.0",
"@mongodb-js/mongodb-redux-common": "^1.12.0",
"@mongosh/browser-repl": "^1.2.3",
"@mongosh/logging": "^1.2.3",
"@mongosh/node-runtime-worker-thread": "^1.2.3",
"@mongosh/service-provider-core": "^1.2.3"
"@mongosh/browser-repl": "^1.4.1",
"@mongosh/logging": "^1.4.1",
"@mongosh/node-runtime-worker-thread": "^1.4.1",
"@mongosh/service-provider-core": "^1.4.1"
},
"peerDependencies": {
"@mongodb-js/compass-components": "^0.15.0",
Expand Down Expand Up @@ -106,7 +106,7 @@
"karma-webpack": "^4.0.2",
"mocha": "^5.2.0",
"mocha-webpack": "^2.0.0-beta.0",
"mongodb": "^4.4.0",
"mongodb": "^4.6.0",
"mongodb-reflux-store": "^0.0.1",
"node-loader": "^0.6.0",
"nyc": "^13.1.0",
Expand Down
7 changes: 5 additions & 2 deletions packages/compass/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
"**/mongodb-client-encryption/package.json",
"**/mongodb-client-encryption/lib/**",
"**/mongodb-client-encryption/build/**",
"**/socks/**",
"**/smart-buffer/**",
"**/ip/**",
"**/bl/**",
"**/nan/**",
"**/node_modules/bindings/**",
Expand Down Expand Up @@ -157,7 +160,7 @@
"email": "compass@mongodb.com"
},
"dependencies": {
"@mongosh/node-runtime-worker-thread": "^1.2.3",
"@mongosh/node-runtime-worker-thread": "^1.4.1",
"clipboard": "^2.0.6",
"kerberos": "^2.0.0",
"keytar": "^7.7.0",
Expand Down Expand Up @@ -245,7 +248,7 @@
"make-fetch-happen": "^8.0.14",
"marky": "^1.2.1",
"mocha": "^8.4.0",
"mongodb": "^4.4.0",
"mongodb": "^4.6.0",
"mongodb-connection-model": "^21.17.0",
"mongodb-data-service": "^21.21.0",
"mongodb-download-url": "^1.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/connection-form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"depcheck": "^1.4.1",
"eslint": "^7.25.0",
"mocha": "^8.4.0",
"mongodb": "^4.4.0",
"mongodb": "^4.6.0",
"mongodb-data-service": "^21.21.0",
"nyc": "^15.1.0",
"prettier": "2.3.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,9 @@ function CSFLETab({
<EncryptedFieldConfigInput
label="EncryptedFieldsMap"
description="Add an optional client-side EncryptedFieldsMap for enhanced security."
// @ts-expect-error next driver release will have types
encryptedFieldsMap={autoEncryptionOptions?.encryptedFieldsMap}
errorMessage={errorMessageByFieldName(errors, 'encryptedFieldsMap')}
onChange={(value: Document | undefined) => {
// @ts-expect-error next driver release will have types
handleFieldChanged('encryptedFieldsMap', value);
}}
/>
Expand Down
1 change: 0 additions & 1 deletion packages/connection-form/src/utils/csfle-handler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ describe('csfle-handler', function () {
'$compass.rawText': exampleString,
'$compass.error': null,
},
// @ts-expect-error next driver release will have types
encryptedFieldsMap: {
'$compass.rawText': exampleString,
'$compass.error': null,
Expand Down
4 changes: 0 additions & 4 deletions packages/connection-form/src/utils/csfle-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ export function hasAnyCsfleOption(o: Readonly<AutoEncryptionOptions>): boolean {
o.bypassAutoEncryption ||
o.keyVaultNamespace ||
o.schemaMap ||
// @ts-expect-error next driver release will have types
o.encryptedFieldsMap ||
[
...Object.values(o.tlsOptions ?? {}),
Expand Down Expand Up @@ -264,11 +263,8 @@ export function adjustCSFLEParams(
autoEncryptionOptions.schemaMap['$compass.rawText']
);
}
// @ts-expect-error next driver release will have types
if (autoEncryptionOptions?.encryptedFieldsMap?.['$compass.error'] === null) {
// @ts-expect-error next driver release will have types
autoEncryptionOptions.encryptedFieldsMap = textToEncryptedFieldConfig(
// @ts-expect-error next driver release will have types
autoEncryptionOptions.encryptedFieldsMap['$compass.rawText']
);
}
Expand Down
1 change: 0 additions & 1 deletion packages/connection-form/src/utils/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ function validateCSFLEErrors(
const errors: ConnectionFormError[] = [];
for (const fieldName of ['schemaMap', 'encryptedFieldsMap'] as const) {
const encryptedFieldConfigError =
// @ts-expect-error next driver release will have types
autoEncryptionOptions[fieldName]?.['$compass.error'];
if (encryptedFieldConfigError) {
errors.push({
Expand Down
4 changes: 2 additions & 2 deletions packages/connection-model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"posttest-ci": "node ../../scripts/killall-mongo.js"
},
"peerDependencies": {
"mongodb": "^4.4.0"
"mongodb": "^4.6.0"
},
"dependencies": {
"@mongodb-js/ssh-tunnel": "^1.7.0",
Expand All @@ -55,7 +55,7 @@
"eslint-config-mongodb-js": "^5.0.3",
"mocha": "^8.0.1",
"mock-require": "^3.0.3",
"mongodb": "^4.4.0",
"mongodb": "^4.6.0",
"mongodb-runner": "^4.9.0",
"proxyquire": "^2.1.0",
"sinon": "^9.0.2",
Expand Down
5 changes: 2 additions & 3 deletions packages/data-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"reformat": "npm run prettier -- --write ."
},
"peerDependencies": {
"mongodb": "^4.4.0"
"mongodb": "^4.6.0"
},
"dependencies": {
"@mongodb-js/compass-logging": "^0.12.0",
Expand Down Expand Up @@ -90,8 +90,7 @@
"eslint": "^7.25.0",
"kerberos": "^2.0.0",
"mocha": "^8.4.0",
"mongodb": "^4.4.0",
"mongodb-fle": "npm:mongodb@^4.6.0-alpha.0",
"mongodb": "^4.6.0",
"mongodb-runner": "^4.9.0",
"nyc": "^15.0.0",
"prettier": "2.3.2",
Expand Down
9 changes: 1 addition & 8 deletions packages/data-service/src/connect-mongo-client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { MongoClientOptions } from 'mongodb';
import { MongoClient } from 'mongodb';
import { MongoClient as FLEMongoClient } from 'mongodb-fle';
import { connectMongoClient, hookLogger } from '@mongodb-js/devtools-connect';
import type { DevtoolsConnectOptions } from '@mongodb-js/devtools-connect';
import type SSHTunnel from '@mongodb-js/ssh-tunnel';
Expand Down Expand Up @@ -46,7 +45,6 @@ export default async function connectMongoClientCompass(
...options.autoEncryption,
extraOptions: {
...options.autoEncryption?.extraOptions,
// @ts-expect-error next driver release has types
csflePath: process.env.COMPASS_CSFLE_LIBRARY_PATH,
},
};
Expand All @@ -63,12 +61,7 @@ export default async function connectMongoClientCompass(
if (socks5Options) {
Object.assign(options, socks5Options);
}

const BaseMongoClient =
process.env.COMPASS_CSFLE_SUPPORT === 'true'
? (FLEMongoClient as unknown as typeof MongoClient)
: MongoClient;
class CompassMongoClient extends BaseMongoClient {
class CompassMongoClient extends MongoClient {
constructor(url: string, options?: MongoClientOptions) {
super(url, options);
if (setupListeners) {
Expand Down
17 changes: 12 additions & 5 deletions packages/data-service/src/csfle-collection-tracker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ describe('CSFLECollectionTracker', function () {
kmsProviders: { local: { key: 'A'.repeat(128) } },
keyVaultNamespace: `${dbName}.kv`,
extraOptions: {
// @ts-expect-error until next driver bump
csflePath: process.env.COMPASS_CSFLE_LIBRARY_PATH,
},
...autoEncryption,
Expand Down Expand Up @@ -192,7 +191,6 @@ describe('CSFLECollectionTracker', function () {
context('with client-side FLE2 schema info', function () {
beforeEach(async function () {
[tracker, dataService] = await createTracker({
// @ts-expect-error next driver release updates types
encryptedFieldsMap: {
[`${dbName}.test2`]: {
fields: [{ path: 'a', keyId: SOME_UUID1, bsonType: 'string' }],
Expand Down Expand Up @@ -298,14 +296,12 @@ describe('CSFLECollectionTracker', function () {
'CRUD'
);
await crudClient.db(dbName).createCollection('test2', {
// @ts-expect-error next driver release updates types
encryptedFields: {
fields: [{ path: 'a', keyId: SOME_UUID1, bsonType: 'string' }],
},
});

await crudClient.db(dbName).createCollection('test3', {
// @ts-expect-error next driver release updates types
encryptedFields: {
fields: [{ path: 'n.a', keyId: SOME_UUID2, bsonType: 'string' }],
},
Expand Down Expand Up @@ -344,6 +340,18 @@ describe('CSFLECollectionTracker', function () {
dataService as any
)._initializedClient('META');
await metadataClient.db(dbName).dropCollection('test2');
await metadataClient
.db(dbName)
.dropCollection('enxcol_.test2.esc')
.catch(() => {});
await metadataClient
.db(dbName)
.dropCollection('enxcol_.test2.ecc')
.catch(() => {});
await metadataClient
.db(dbName)
.dropCollection('enxcol_.test2.ecoc')
.catch(() => {});
});

it('ensures that writes fail when server validation has been removed in the background', async function () {
Expand All @@ -368,7 +376,6 @@ describe('CSFLECollectionTracker', function () {
dataService as any
)._initializedClient('META');
await metadataClient.db(dbName).createCollection('test2', {
// @ts-expect-error next driver release updates types
encryptedFields: {
fields: [{ path: 'b', keyId: SOME_UUID1, bsonType: 'string' }],
},
Expand Down
2 changes: 0 additions & 2 deletions packages/data-service/src/csfle-collection-tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ function extractEncrytedFieldFromAutoEncryptionOptions(
return [
...extractEncryptedFieldsFromSchema(autoEncryption.schemaMap?.[ns]),
...extractEncryptedFieldsFromEncryptedFieldsConfig(
// @ts-expect-error next driver release updates types
autoEncryption?.encryptedFieldsMap?.[ns]
),
];
Expand Down Expand Up @@ -227,7 +226,6 @@ export class CSFLECollectionTrackerImpl implements CSFLECollectionTracker {
const { autoEncryption } = this._crudClient.options;
for (const ns of [
...Object.keys(autoEncryption?.schemaMap ?? {}),
// @ts-expect-error next driver release updates types
...Object.keys(autoEncryption?.encryptedFieldsMap ?? {}),
]) {
log.info(
Expand Down
Loading