diff --git a/package-lock.json b/package-lock.json index 2b7ce6b1..6883e83f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8066,6 +8066,52 @@ "mongodb-client-encryption": "^6.3.0" } }, + "node_modules/@mongosh/service-provider-core/node_modules/mongodb": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.21.0.tgz", + "integrity": "sha512-URyb/VXMjJ4da46OeSXg+puO39XH9DeQpWCslifrRn9JWugy0D+DvvBvkm2WxmHe61O/H19JM66p1z7RHVkZ6A==", + "license": "Apache-2.0", + "dependencies": { + "@mongodb-js/saslprep": "^1.3.0", + "bson": "^6.10.4", + "mongodb-connection-string-url": "^3.0.2" + }, + "engines": { + "node": ">=16.20.1" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.188.0", + "@mongodb-js/zstd": "^1.1.0 || ^2.0.0", + "gcp-metadata": "^5.2.0", + "kerberos": "^2.0.1", + "mongodb-client-encryption": ">=6.0.0 <7", + "snappy": "^7.3.2", + "socks": "^2.7.1" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "@mongodb-js/zstd": { + "optional": true + }, + "gcp-metadata": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + }, + "socks": { + "optional": true + } + } + }, "node_modules/@mongosh/shell-api": { "version": "3.16.2", "resolved": "https://registry.npmjs.org/@mongosh/shell-api/-/shell-api-3.16.2.tgz", @@ -12665,9 +12711,9 @@ } }, "node_modules/bson": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/bson/-/bson-6.10.3.tgz", - "integrity": "sha512-MTxGsqgYTwfshYWTRdmZRC+M7FnG1b4y7RO7p2k3X24Wq0yv1m77Wsj0BzlPzd/IowgESfsruQCUToa7vbOpPQ==", + "version": "6.10.4", + "resolved": "https://registry.npmjs.org/bson/-/bson-6.10.4.tgz", + "integrity": "sha512-WIsKqkSC0ABoBJuT1LEX+2HEvNmNKKgnTAyd0fL8qzK4SH2i9NXg+t08YtdZp/V9IZ33cxe3iV4yM0qg8lMQng==", "license": "Apache-2.0", "engines": { "node": ">=16.20.1" @@ -22915,26 +22961,26 @@ } }, "node_modules/mongodb": { - "version": "6.16.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.16.0.tgz", - "integrity": "sha512-D1PNcdT0y4Grhou5Zi/qgipZOYeWrhLEpk33n3nm6LGtz61jvO88WlrWCK/bigMjpnOdAUKKQwsGIl0NtWMyYw==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "integrity": "sha512-vG/A5cQrvGGvZm2mTnCSz1LUcbOPl83hfB6bxULKQ8oFZauyox/2xbZOoGNl+64m8VBrETkdGCDBdOsCr3F3jg==", "license": "Apache-2.0", "dependencies": { - "@mongodb-js/saslprep": "^1.1.9", - "bson": "^6.10.3", - "mongodb-connection-string-url": "^3.0.0" + "@mongodb-js/saslprep": "^1.3.0", + "bson": "^7.0.0", + "mongodb-connection-string-url": "^7.0.0" }, "engines": { - "node": ">=16.20.1" + "node": ">=20.19.0" }, "peerDependencies": { - "@aws-sdk/credential-providers": "^3.188.0", - "@mongodb-js/zstd": "^1.1.0 || ^2.0.0", - "gcp-metadata": "^5.2.0", - "kerberos": "^2.0.1", - "mongodb-client-encryption": ">=6.0.0 <7", - "snappy": "^7.2.2", - "socks": "^2.7.1" + "@aws-sdk/credential-providers": "^3.806.0", + "@mongodb-js/zstd": "^7.0.0", + "gcp-metadata": "^7.0.1", + "kerberos": "^7.0.0", + "mongodb-client-encryption": ">=7.0.0 <7.1.0", + "snappy": "^7.3.2", + "socks": "^2.8.6" }, "peerDependenciesMeta": { "@aws-sdk/credential-providers": { @@ -23115,6 +23161,60 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/mongodb-schema/node_modules/mongodb": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.21.0.tgz", + "integrity": "sha512-URyb/VXMjJ4da46OeSXg+puO39XH9DeQpWCslifrRn9JWugy0D+DvvBvkm2WxmHe61O/H19JM66p1z7RHVkZ6A==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@mongodb-js/saslprep": "^1.3.0", + "bson": "^6.10.4", + "mongodb-connection-string-url": "^3.0.2" + }, + "engines": { + "node": ">=16.20.1" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.188.0", + "@mongodb-js/zstd": "^1.1.0 || ^2.0.0", + "gcp-metadata": "^5.2.0", + "kerberos": "^2.0.1", + "mongodb-client-encryption": ">=6.0.0 <7", + "snappy": "^7.3.2", + "socks": "^2.7.1" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "@mongodb-js/zstd": { + "optional": true + }, + "gcp-metadata": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + }, + "socks": { + "optional": true + } + } + }, + "node_modules/mongodb-schema/node_modules/mongodb-ns": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/mongodb-ns/-/mongodb-ns-2.4.3.tgz", + "integrity": "sha512-M0/PfP5i0z0p53lW2CDTTCkzwgRvDcs0MojTLkzxSeAbDic8eqOki+leT8HQoEEQmGcQOJPMcSGwbh/bYUR1HA==", + "license": "MIT", + "optional": true + }, "node_modules/mongodb-schema/node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", @@ -23144,6 +23244,85 @@ "node": ">=12" } }, + "node_modules/mongodb/node_modules/@types/whatwg-url": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-13.0.0.tgz", + "integrity": "sha512-N8WXpbE6Wgri7KUSvrmQcqrMllKZ9uxkYWMt+mCSGwNc0Hsw9VQTW7ApqI4XNrx6/SaM2QQJCzMPDEXE058s+Q==", + "license": "MIT", + "dependencies": { + "@types/webidl-conversions": "*" + } + }, + "node_modules/mongodb/node_modules/bson": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/bson/-/bson-7.1.1.tgz", + "integrity": "sha512-TtJgBB+QyOlWjrbM+8bRgH84VM/xrDjyBFgSgGrfZF4xvt6gbEDtcswm27Tn9F9TWsjQybxT8b8VpCP/oJK4Dw==", + "license": "Apache-2.0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/mongodb/node_modules/mongodb-connection-string-url": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-7.0.0.tgz", + "integrity": "sha512-irhhjRVLE20hbkRl4zpAYLnDMM+zIZnp0IDB9akAFFUZp/3XdOfwwddc7y6cNvF2WCEtfTYRwYbIfYa2kVY0og==", + "license": "Apache-2.0", + "dependencies": { + "@types/whatwg-url": "^13.0.0", + "whatwg-url": "^14.1.0" + }, + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/mongodb6": { + "name": "mongodb", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.21.0.tgz", + "integrity": "sha512-URyb/VXMjJ4da46OeSXg+puO39XH9DeQpWCslifrRn9JWugy0D+DvvBvkm2WxmHe61O/H19JM66p1z7RHVkZ6A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@mongodb-js/saslprep": "^1.3.0", + "bson": "^6.10.4", + "mongodb-connection-string-url": "^3.0.2" + }, + "engines": { + "node": ">=16.20.1" + }, + "peerDependencies": { + "@aws-sdk/credential-providers": "^3.188.0", + "@mongodb-js/zstd": "^1.1.0 || ^2.0.0", + "gcp-metadata": "^5.2.0", + "kerberos": "^2.0.1", + "mongodb-client-encryption": ">=6.0.0 <7", + "snappy": "^7.3.2", + "socks": "^2.7.1" + }, + "peerDependenciesMeta": { + "@aws-sdk/credential-providers": { + "optional": true + }, + "@mongodb-js/zstd": { + "optional": true + }, + "gcp-metadata": { + "optional": true + }, + "kerberos": { + "optional": true + }, + "mongodb-client-encryption": { + "optional": true + }, + "snappy": { + "optional": true + }, + "socks": { + "optional": true + } + } + }, "node_modules/moo": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz", @@ -30603,8 +30782,10 @@ "eslint-plugin-promise": "^6.1.1", "gen-esm-wrapper": "^1.1.3", "mocha": "^8.4.0", - "mongodb": "^6.9.0 || ^7.0.0", + "mongodb": "^7.0.0", "mongodb-log-writer": "^2.5.5", + "mongodb-runner": "^6.5.4", + "mongodb6": "npm:mongodb@^6.9.0", "nyc": "^15.1.0", "os-dns-native": "^2.0.1", "prettier": "^3.5.3", @@ -30626,6 +30807,15 @@ "mongodb-log-writer": "^2.5.5" } }, + "packages/devtools-connect/node_modules/@types/whatwg-url": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-13.0.0.tgz", + "integrity": "sha512-N8WXpbE6Wgri7KUSvrmQcqrMllKZ9uxkYWMt+mCSGwNc0Hsw9VQTW7ApqI4XNrx6/SaM2QQJCzMPDEXE058s+Q==", + "license": "MIT", + "dependencies": { + "@types/webidl-conversions": "*" + } + }, "packages/devtools-connect/node_modules/mongodb-client-encryption": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/mongodb-client-encryption/-/mongodb-client-encryption-7.0.0.tgz", @@ -30641,6 +30831,19 @@ "node": ">=20.19.0" } }, + "packages/devtools-connect/node_modules/mongodb-connection-string-url": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-7.0.0.tgz", + "integrity": "sha512-irhhjRVLE20hbkRl4zpAYLnDMM+zIZnp0IDB9akAFFUZp/3XdOfwwddc7y6cNvF2WCEtfTYRwYbIfYa2kVY0og==", + "license": "Apache-2.0", + "dependencies": { + "@types/whatwg-url": "^13.0.0", + "whatwg-url": "^14.1.0" + }, + "engines": { + "node": ">=20.19.0" + } + }, "packages/devtools-connect/node_modules/napi-build-utils": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", @@ -31527,15 +31730,6 @@ "@types/webidl-conversions": "*" } }, - "packages/mongodb-runner/node_modules/bson": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-7.0.0.tgz", - "integrity": "sha512-Kwc6Wh4lQ5OmkqqKhYGKIuELXl+EPYSCObVE6bWsp1T/cGkOCBN0I8wF/T44BiuhHyNi1mmKVPXk60d41xZ7kw==", - "license": "Apache-2.0", - "engines": { - "node": ">=20.19.0" - } - }, "packages/mongodb-runner/node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -31549,52 +31743,6 @@ "node": ">=12" } }, - "packages/mongodb-runner/node_modules/mongodb": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", - "integrity": "sha512-vG/A5cQrvGGvZm2mTnCSz1LUcbOPl83hfB6bxULKQ8oFZauyox/2xbZOoGNl+64m8VBrETkdGCDBdOsCr3F3jg==", - "license": "Apache-2.0", - "dependencies": { - "@mongodb-js/saslprep": "^1.3.0", - "bson": "^7.0.0", - "mongodb-connection-string-url": "^7.0.0" - }, - "engines": { - "node": ">=20.19.0" - }, - "peerDependencies": { - "@aws-sdk/credential-providers": "^3.806.0", - "@mongodb-js/zstd": "^7.0.0", - "gcp-metadata": "^7.0.1", - "kerberos": "^7.0.0", - "mongodb-client-encryption": ">=7.0.0 <7.1.0", - "snappy": "^7.3.2", - "socks": "^2.8.6" - }, - "peerDependenciesMeta": { - "@aws-sdk/credential-providers": { - "optional": true - }, - "@mongodb-js/zstd": { - "optional": true - }, - "gcp-metadata": { - "optional": true - }, - "kerberos": { - "optional": true - }, - "mongodb-client-encryption": { - "optional": true - }, - "snappy": { - "optional": true - }, - "socks": { - "optional": true - } - } - }, "packages/mongodb-runner/node_modules/mongodb-connection-string-url": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-7.0.0.tgz", @@ -39196,10 +39344,12 @@ "kerberos": "^2.1.0 || ^7.0.0", "lodash.merge": "^4.6.2", "mocha": "^8.4.0", - "mongodb": "^6.9.0 || ^7.0.0", + "mongodb": "^7.0.0", "mongodb-client-encryption": "^6.5.0 || ^7.0.0", "mongodb-connection-string-url": "^3.0.1 || ^7.0.0", "mongodb-log-writer": "^2.5.5", + "mongodb-runner": "^6.5.4", + "mongodb6": "npm:mongodb@^6.9.0", "nyc": "^15.1.0", "os-dns-native": "^2.0.1", "prettier": "^3.5.3", @@ -39211,6 +39361,14 @@ "typescript": "^5.8.2" }, "dependencies": { + "@types/whatwg-url": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-13.0.0.tgz", + "integrity": "sha512-N8WXpbE6Wgri7KUSvrmQcqrMllKZ9uxkYWMt+mCSGwNc0Hsw9VQTW7ApqI4XNrx6/SaM2QQJCzMPDEXE058s+Q==", + "requires": { + "@types/webidl-conversions": "*" + } + }, "mongodb-client-encryption": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/mongodb-client-encryption/-/mongodb-client-encryption-7.0.0.tgz", @@ -39221,6 +39379,15 @@ "prebuild-install": "^7.1.3" } }, + "mongodb-connection-string-url": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-7.0.0.tgz", + "integrity": "sha512-irhhjRVLE20hbkRl4zpAYLnDMM+zIZnp0IDB9akAFFUZp/3XdOfwwddc7y6cNvF2WCEtfTYRwYbIfYa2kVY0og==", + "requires": { + "@types/whatwg-url": "^13.0.0", + "whatwg-url": "^14.1.0" + } + }, "napi-build-utils": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", @@ -40497,6 +40664,18 @@ "mongodb-build-info": "^1.7.2", "mongodb-client-encryption": "^6.3.0", "mongodb-connection-string-url": "^3.0.1" + }, + "dependencies": { + "mongodb": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.21.0.tgz", + "integrity": "sha512-URyb/VXMjJ4da46OeSXg+puO39XH9DeQpWCslifrRn9JWugy0D+DvvBvkm2WxmHe61O/H19JM66p1z7RHVkZ6A==", + "requires": { + "@mongodb-js/saslprep": "^1.3.0", + "bson": "^6.10.4", + "mongodb-connection-string-url": "^3.0.2" + } + } } }, "@mongosh/shell-api": { @@ -44105,9 +44284,9 @@ } }, "bson": { - "version": "6.10.3", - "resolved": "https://registry.npmjs.org/bson/-/bson-6.10.3.tgz", - "integrity": "sha512-MTxGsqgYTwfshYWTRdmZRC+M7FnG1b4y7RO7p2k3X24Wq0yv1m77Wsj0BzlPzd/IowgESfsruQCUToa7vbOpPQ==" + "version": "6.10.4", + "resolved": "https://registry.npmjs.org/bson/-/bson-6.10.4.tgz", + "integrity": "sha512-WIsKqkSC0ABoBJuT1LEX+2HEvNmNKKgnTAyd0fL8qzK4SH2i9NXg+t08YtdZp/V9IZ33cxe3iV4yM0qg8lMQng==" }, "buffer": { "version": "5.7.1", @@ -51630,13 +51809,37 @@ "dev": true }, "mongodb": { - "version": "6.16.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.16.0.tgz", - "integrity": "sha512-D1PNcdT0y4Grhou5Zi/qgipZOYeWrhLEpk33n3nm6LGtz61jvO88WlrWCK/bigMjpnOdAUKKQwsGIl0NtWMyYw==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "integrity": "sha512-vG/A5cQrvGGvZm2mTnCSz1LUcbOPl83hfB6bxULKQ8oFZauyox/2xbZOoGNl+64m8VBrETkdGCDBdOsCr3F3jg==", "requires": { - "@mongodb-js/saslprep": "^1.1.9", - "bson": "^6.10.3", - "mongodb-connection-string-url": "^3.0.0" + "@mongodb-js/saslprep": "^1.3.0", + "bson": "^7.0.0", + "mongodb-connection-string-url": "^7.0.0" + }, + "dependencies": { + "@types/whatwg-url": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-13.0.0.tgz", + "integrity": "sha512-N8WXpbE6Wgri7KUSvrmQcqrMllKZ9uxkYWMt+mCSGwNc0Hsw9VQTW7ApqI4XNrx6/SaM2QQJCzMPDEXE058s+Q==", + "requires": { + "@types/webidl-conversions": "*" + } + }, + "bson": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/bson/-/bson-7.1.1.tgz", + "integrity": "sha512-TtJgBB+QyOlWjrbM+8bRgH84VM/xrDjyBFgSgGrfZF4xvt6gbEDtcswm27Tn9F9TWsjQybxT8b8VpCP/oJK4Dw==" + }, + "mongodb-connection-string-url": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-7.0.0.tgz", + "integrity": "sha512-irhhjRVLE20hbkRl4zpAYLnDMM+zIZnp0IDB9akAFFUZp/3XdOfwwddc7y6cNvF2WCEtfTYRwYbIfYa2kVY0og==", + "requires": { + "@types/whatwg-url": "^13.0.0", + "whatwg-url": "^14.1.0" + } + } } }, "mongodb-build-info": { @@ -51985,11 +52188,6 @@ "@types/webidl-conversions": "*" } }, - "bson": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-7.0.0.tgz", - "integrity": "sha512-Kwc6Wh4lQ5OmkqqKhYGKIuELXl+EPYSCObVE6bWsp1T/cGkOCBN0I8wF/T44BiuhHyNi1mmKVPXk60d41xZ7kw==" - }, "cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -52000,16 +52198,6 @@ "wrap-ansi": "^7.0.0" } }, - "mongodb": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", - "integrity": "sha512-vG/A5cQrvGGvZm2mTnCSz1LUcbOPl83hfB6bxULKQ8oFZauyox/2xbZOoGNl+64m8VBrETkdGCDBdOsCr3F3jg==", - "requires": { - "@mongodb-js/saslprep": "^1.3.0", - "bson": "^7.0.0", - "mongodb-connection-string-url": "^7.0.0" - } - }, "mongodb-connection-string-url": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-7.0.0.tgz", @@ -52089,6 +52277,23 @@ "argparse": "^2.0.1" } }, + "mongodb": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.21.0.tgz", + "integrity": "sha512-URyb/VXMjJ4da46OeSXg+puO39XH9DeQpWCslifrRn9JWugy0D+DvvBvkm2WxmHe61O/H19JM66p1z7RHVkZ6A==", + "optional": true, + "requires": { + "@mongodb-js/saslprep": "^1.3.0", + "bson": "^6.10.4", + "mongodb-connection-string-url": "^3.0.2" + } + }, + "mongodb-ns": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/mongodb-ns/-/mongodb-ns-2.4.3.tgz", + "integrity": "sha512-M0/PfP5i0z0p53lW2CDTTCkzwgRvDcs0MojTLkzxSeAbDic8eqOki+leT8HQoEEQmGcQOJPMcSGwbh/bYUR1HA==", + "optional": true + }, "yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", @@ -52112,6 +52317,17 @@ } } }, + "mongodb6": { + "version": "npm:mongodb@6.21.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.21.0.tgz", + "integrity": "sha512-URyb/VXMjJ4da46OeSXg+puO39XH9DeQpWCslifrRn9JWugy0D+DvvBvkm2WxmHe61O/H19JM66p1z7RHVkZ6A==", + "dev": true, + "requires": { + "@mongodb-js/saslprep": "^1.3.0", + "bson": "^6.10.4", + "mongodb-connection-string-url": "^3.0.2" + } + }, "moo": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.1.tgz", diff --git a/packages/devtools-connect/package.json b/packages/devtools-connect/package.json index 32c22669..268561ea 100644 --- a/packages/devtools-connect/package.json +++ b/packages/devtools-connect/package.json @@ -75,8 +75,10 @@ "eslint-plugin-promise": "^6.1.1", "gen-esm-wrapper": "^1.1.3", "mocha": "^8.4.0", - "mongodb": "^6.9.0 || ^7.0.0", + "mongodb": "^7.0.0", + "mongodb6": "npm:mongodb@^6.9.0", "mongodb-log-writer": "^2.5.5", + "mongodb-runner": "^6.5.4", "nyc": "^15.1.0", "os-dns-native": "^2.0.1", "resolve-mongodb-srv": "^1.1.1", diff --git a/packages/devtools-connect/src/connect.spec.ts b/packages/devtools-connect/src/connect.spec.ts index d4e47aab..c3019906 100644 --- a/packages/devtools-connect/src/connect.spec.ts +++ b/packages/devtools-connect/src/connect.spec.ts @@ -1,12 +1,15 @@ import { connectMongoClient } from './'; import type { DevtoolsConnectOptions } from './'; import { isHumanOidcFlow } from './connect'; -import { EventEmitter } from 'events'; +import { EventEmitter, once } from 'events'; import { MongoClient } from 'mongodb'; +import { MongoClient as MongoClient6 } from 'mongodb6'; import sinon, { stubConstructor } from 'ts-sinon'; import chai, { expect } from 'chai'; import sinonChai from 'sinon-chai'; import { Agent as HTTPSAgent } from 'https'; +import { MongoCluster } from 'mongodb-runner'; +import { tmpdir } from 'os'; chai.use(sinonChai); @@ -556,27 +559,48 @@ describe('devtools connect', function () { }); describe('integration', function () { - before(function () { - if (!process.env.MONGODB_URI) { - this.skip(); - } - }); + let cluster: MongoCluster; - it('successfully connects to mongod service', async function () { - const bus = new EventEmitter(); - const { client } = await connectMongoClient( - process.env.MONGODB_URI ?? '', - defaultOpts, - bus, - MongoClient, - ); - expect((await client.db('admin').command({ ping: 1 })).ok).to.equal(1); + before(async function () { + this.timeout(180_000); + + cluster = await MongoCluster.start({ + tmpDir: tmpdir(), + topology: 'standalone', + }); + }); - const onCloseStub = sinon.stub(); - client.on('close', onCloseStub); - await client.close(); - expect(onCloseStub.getCalls()).to.have.lengthOf(1); + after(async function () { + await cluster?.close(); }); + + for (const [name, versionRe, Client] of [ + ['6.x driver', /^6\.\d+\.\d+$/, MongoClient6], + ['7.x driver', /^7\.\d+\.\d+$/, MongoClient], + ] as const) { + it(`successfully connects to mongod service (${name})`, async function () { + const bus = new EventEmitter(); + const initEvent = once( + bus, + 'devtools-connect:connect-attempt-initialized', + ); + const { client } = await connectMongoClient( + cluster.connectionString, + defaultOpts, + bus, + Client as typeof MongoClient, + ); + expect((await client.db('admin').command({ ping: 1 })).ok).to.equal(1); + const [connectionAttemptMetadata] = await initEvent; + expect(connectionAttemptMetadata.driver.name).to.equal('nodejs'); + expect(connectionAttemptMetadata.driver.version).to.match(versionRe); + + const onCloseStub = sinon.stub(); + client.on('close', onCloseStub); + await client.close(); + expect(onCloseStub.getCalls()).to.have.lengthOf(1); + }); + } }); describe('atlas', function () { diff --git a/packages/devtools-connect/src/connect.ts b/packages/devtools-connect/src/connect.ts index 22260a4f..ee174384 100644 --- a/packages/devtools-connect/src/connect.ts +++ b/packages/devtools-connect/src/connect.ts @@ -67,13 +67,10 @@ async function connectWithFailFast( let failEarlyClosePromise: Promise | null = null; logger.emit('devtools-connect:connect-attempt-initialized', { uri, - driver: { - // metadata is hidden and driverInfo is deprecated and nullable - // because this is just informational, do our best effort to get that info - name: client.options.driverInfo?.name ?? 'mongodb-js', - version: client.options.driverInfo?.version ?? '', - }, - + // TODO: Use a public API once NODE-7406 is done. + // `metadata` became internal + async in v7.x, previously it + // was synchronously available. + driver: (await (client.options as any).metadata).driver, // eslint-disable-next-line @typescript-eslint/no-var-requires devtoolsConnectVersion: require('../package.json').version, host: client.options.srvHost ?? client.options.hosts.join(','),