Skip to content

Commit 536e6a1

Browse files
authored
chore(NODE-5247): update dependencies (#3657)
1 parent bf92d10 commit 536e6a1

29 files changed

+1742
-8305
lines changed

.evergreen/run-typescript.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ function get_ts_version() {
3131
export TSC="./node_modules/typescript/bin/tsc"
3232
export TS_VERSION=$(get_ts_version)
3333

34-
npm install --no-save --force typescript@"$TS_VERSION"
34+
# On old versions of TS we need to put the node types back to 18.11.19
35+
npm install --no-save --force typescript@"$TS_VERSION" "$(if [[ $TS_VERSION == '4.1.6' ]]; then echo "@types/[email protected]"; else echo ""; fi)"
3536

3637
echo "Typescript $($TSC -v)"
3738

etc/clean_definition_files.cjs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#! /usr/bin/env node
2+
/* eslint-disable @typescript-eslint/no-var-requires */
3+
const fs = require('fs');
4+
const path = require('path');
5+
6+
function* walk(root) {
7+
const directoryContents = fs.readdirSync(root);
8+
for (const filepath of directoryContents) {
9+
const fullPath = path.join(root, filepath);
10+
const stat = fs.statSync(fullPath);
11+
if (stat.isDirectory()) {
12+
yield* walk(fullPath);
13+
} else if (stat.isFile()) {
14+
yield fullPath;
15+
}
16+
}
17+
}
18+
19+
const libPath = path.resolve(__dirname, '..', 'lib');
20+
if (fs.existsSync(libPath)) {
21+
const definitionFiles = Array.from(walk(libPath)).filter(filePath => {
22+
return filePath.endsWith('.d.ts') || filePath.endsWith('.d.ts.map');
23+
});
24+
for (const definitionFile of definitionFiles) {
25+
fs.unlinkSync(definitionFile);
26+
}
27+
}

package-lock.json

Lines changed: 1658 additions & 8247 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,35 +26,35 @@
2626
},
2727
"dependencies": {
2828
"bson": "^4.7.2",
29-
"mongodb-connection-string-url": "^2.5.4",
29+
"mongodb-connection-string-url": "^2.6.0",
3030
"socks": "^2.7.1"
3131
},
3232
"devDependencies": {
3333
"@iarna/toml": "^2.2.5",
3434
"@istanbuljs/nyc-config-typescript": "^1.0.2",
35-
"@microsoft/api-extractor": "^7.33.3",
35+
"@microsoft/api-extractor": "^7.34.7",
3636
"@microsoft/tsdoc-config": "^0.16.2",
37-
"@mongodb-js/zstd": "^1.0.0",
38-
"@types/chai": "^4.3.3",
37+
"@mongodb-js/zstd": "^1.1.0",
38+
"@types/chai": "^4.3.5",
3939
"@types/chai-subset": "^1.3.3",
40-
"@types/express": "^4.17.14",
40+
"@types/express": "^4.17.17",
4141
"@types/kerberos": "^1.1.1",
42-
"@types/mocha": "^10.0.0",
43-
"@types/node": "^18.11.0",
42+
"@types/mocha": "^10.0.1",
43+
"@types/node": "^18.16.3",
4444
"@types/saslprep": "^1.0.1",
45-
"@types/semver": "^7.3.12",
46-
"@types/sinon": "^10.0.13",
47-
"@types/sinon-chai": "^3.2.8",
45+
"@types/semver": "^7.3.13",
46+
"@types/sinon": "^10.0.14",
47+
"@types/sinon-chai": "^3.2.9",
4848
"@types/whatwg-url": "^11.0.0",
49-
"@typescript-eslint/eslint-plugin": "^5.40.0",
50-
"@typescript-eslint/parser": "^5.40.0",
49+
"@typescript-eslint/eslint-plugin": "^5.59.2",
50+
"@typescript-eslint/parser": "^5.59.2",
5151
"bluebird": "^3.7.2",
52-
"chai": "^4.3.6",
52+
"chai": "^4.3.7",
5353
"chai-subset": "^1.6.0",
5454
"chalk": "^4.1.2",
55-
"eslint": "^8.25.0",
56-
"eslint-config-prettier": "^8.5.0",
57-
"eslint-plugin-import": "^2.26.0",
55+
"eslint": "^8.39.0",
56+
"eslint-config-prettier": "^8.8.0",
57+
"eslint-plugin-import": "^2.27.5",
5858
"eslint-plugin-prettier": "^4.2.1",
5959
"eslint-plugin-simple-import-sort": "^8.0.0",
6060
"eslint-plugin-tsdoc": "^0.2.17",
@@ -63,20 +63,18 @@
6363
"mocha": "^9.2.2",
6464
"mocha-sinon": "^2.1.2",
6565
"nyc": "^15.1.0",
66-
"prettier": "^2.7.1",
67-
"rimraf": "^3.0.2",
68-
"semver": "^7.3.8",
66+
"prettier": "^2.8.8",
67+
"semver": "^7.5.0",
6968
"sinon": "^13.0.1",
7069
"sinon-chai": "^3.7.0",
7170
"source-map-support": "^0.5.21",
7271
"standard-version": "^9.5.0",
7372
"ts-node": "^10.9.1",
74-
"tsd": "^0.24.1",
73+
"tsd": "^0.27.0",
7574
"typescript": "^4.8.4",
7675
"typescript-cached-transpile": "^0.0.6",
7776
"v8-heapsnapshot": "^1.2.0",
78-
"xml2js": "^0.4.23",
79-
"yargs": "^17.6.0"
77+
"yargs": "^17.7.2"
8078
},
8179
"license": "Apache-2.0",
8280
"engines": {
@@ -93,7 +91,7 @@
9391
"scripts": {
9492
"build:evergreen": "node .evergreen/generate_evergreen_tasks.js",
9593
"build:ts": "node ./node_modules/typescript/bin/tsc",
96-
"build:dts": "npm run build:ts && api-extractor run && rimraf 'lib/**/*.d.ts*'",
94+
"build:dts": "npm run build:ts && api-extractor run && node etc/clean_definition_files.cjs",
9795
"build:docs": "./etc/docs/build.ts",
9896
"build:typedoc": "typedoc",
9997
"check:bench": "node test/benchmarks/driverBench",

src/bulk/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const BatchType = Object.freeze({
4747
} as const);
4848

4949
/** @public */
50-
export type BatchType = typeof BatchType[keyof typeof BatchType];
50+
export type BatchType = (typeof BatchType)[keyof typeof BatchType];
5151

5252
/** @public */
5353
export interface InsertOneModel<TSchema extends Document = Document> {

src/cmap/auth/gssapi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const GSSAPICanonicalizationValue = Object.freeze({
2323

2424
/** @public */
2525
export type GSSAPICanonicalizationValue =
26-
typeof GSSAPICanonicalizationValue[keyof typeof GSSAPICanonicalizationValue];
26+
(typeof GSSAPICanonicalizationValue)[keyof typeof GSSAPICanonicalizationValue];
2727

2828
type MechanismProperties = {
2929
/** @deprecated use `CANONICALIZE_HOST_NAME` instead */

src/cmap/auth/providers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const AuthMechanism = Object.freeze({
1111
} as const);
1212

1313
/** @public */
14-
export type AuthMechanism = typeof AuthMechanism[keyof typeof AuthMechanism];
14+
export type AuthMechanism = (typeof AuthMechanism)[keyof typeof AuthMechanism];
1515

1616
/** @internal */
1717
export const AUTH_MECHS_AUTH_SRC_EXTERNAL = new Set<AuthMechanism>([

src/cmap/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ function parseSslOptions(options: MakeConnectionOptions): TLSConnectionOpts {
348348
}
349349

350350
const SOCKET_ERROR_EVENT_LIST = ['error', 'close', 'timeout', 'parseError'] as const;
351-
type ErrorHandlerEventName = typeof SOCKET_ERROR_EVENT_LIST[number] | 'cancel';
351+
type ErrorHandlerEventName = (typeof SOCKET_ERROR_EVENT_LIST)[number] | 'cancel';
352352
const SOCKET_ERROR_EVENTS = new Set(SOCKET_ERROR_EVENT_LIST);
353353

354354
function makeConnection(options: MakeConnectionOptions, _callback: Callback<Stream>) {

src/cmap/connection_pool.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export type ConnectionPoolEvents = {
138138
*/
139139
export class ConnectionPool extends TypedEventEmitter<ConnectionPoolEvents> {
140140
options: Readonly<ConnectionPoolOptions>;
141-
[kPoolState]: typeof PoolState[keyof typeof PoolState];
141+
[kPoolState]: (typeof PoolState)[keyof typeof PoolState];
142142
[kServer]: Server;
143143
[kLogger]: Logger;
144144
[kConnections]: List<Connection>;

src/cmap/wire_protocol/compression.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const Compressor = Object.freeze({
1515
} as const);
1616

1717
/** @public */
18-
export type Compressor = typeof Compressor[CompressorName];
18+
export type Compressor = (typeof Compressor)[CompressorName];
1919

2020
/** @public */
2121
export type CompressorName = keyof typeof Compressor;

src/cursor/abstract_cursor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export interface CursorStreamOptions {
7474
}
7575

7676
/** @public */
77-
export type CursorFlag = typeof CURSOR_FLAGS[number];
77+
export type CursorFlag = (typeof CURSOR_FLAGS)[number];
7878

7979
/** @public */
8080
export interface AbstractCursorOptions extends BSONSerializeOptions {

src/deps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export const AutoEncryptionLoggerLevel = Object.freeze({
209209

210210
/** @public */
211211
export type AutoEncryptionLoggerLevel =
212-
typeof AutoEncryptionLoggerLevel[keyof typeof AutoEncryptionLoggerLevel];
212+
(typeof AutoEncryptionLoggerLevel)[keyof typeof AutoEncryptionLoggerLevel];
213213

214214
/** @public */
215215
export interface AutoEncryptionTlsOptions {

src/error.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const MongoErrorLabel = Object.freeze({
9696
} as const);
9797

9898
/** @public */
99-
export type MongoErrorLabel = typeof MongoErrorLabel[keyof typeof MongoErrorLabel];
99+
export type MongoErrorLabel = (typeof MongoErrorLabel)[keyof typeof MongoErrorLabel];
100100

101101
/** @public */
102102
export interface ErrorDescription extends Document {

src/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const LoggerLevel = Object.freeze({
3434
* @public
3535
* @deprecated The Legacy Logger is deprecated and will be removed in the next major version.
3636
*/
37-
export type LoggerLevel = typeof LoggerLevel[keyof typeof LoggerLevel];
37+
export type LoggerLevel = (typeof LoggerLevel)[keyof typeof LoggerLevel];
3838

3939
/**
4040
* @public

src/mongo_client.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const ServerApiVersion = Object.freeze({
4242
} as const);
4343

4444
/** @public */
45-
export type ServerApiVersion = typeof ServerApiVersion[keyof typeof ServerApiVersion];
45+
export type ServerApiVersion = (typeof ServerApiVersion)[keyof typeof ServerApiVersion];
4646

4747
/** @public */
4848
export interface ServerApi {
@@ -74,19 +74,19 @@ export interface PkFactory {
7474
/** @public */
7575
export type SupportedTLSConnectionOptions = Pick<
7676
TLSConnectionOptions,
77-
Extract<keyof TLSConnectionOptions, typeof LEGAL_TLS_SOCKET_OPTIONS[number]>
77+
Extract<keyof TLSConnectionOptions, (typeof LEGAL_TLS_SOCKET_OPTIONS)[number]>
7878
>;
7979

8080
/** @public */
8181
export type SupportedTLSSocketOptions = Pick<
8282
TLSSocketOptions,
83-
Extract<keyof TLSSocketOptions, typeof LEGAL_TLS_SOCKET_OPTIONS[number]>
83+
Extract<keyof TLSSocketOptions, (typeof LEGAL_TLS_SOCKET_OPTIONS)[number]>
8484
>;
8585

8686
/** @public */
8787
export type SupportedSocketOptions = Pick<
8888
TcpNetConnectOpts,
89-
typeof LEGAL_TCP_SOCKET_OPTIONS[number]
89+
(typeof LEGAL_TCP_SOCKET_OPTIONS)[number]
9090
>;
9191

9292
/** @public */
@@ -308,7 +308,7 @@ export interface MongoClientPrivate {
308308
}
309309

310310
/** @public */
311-
export type MongoClientEvents = Pick<TopologyEvents, typeof MONGO_CLIENT_EVENTS[number]> & {
311+
export type MongoClientEvents = Pick<TopologyEvents, (typeof MONGO_CLIENT_EVENTS)[number]> & {
312312
// In previous versions the open event emitted a topology, in an effort to no longer
313313
// expose internals but continue to expose this useful event API, it now emits a mongoClient
314314
open(mongoClient: MongoClient): void;

src/mongo_logger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const SeverityLevel = Object.freeze({
1717
} as const);
1818

1919
/** @internal */
20-
export type SeverityLevel = typeof SeverityLevel[keyof typeof SeverityLevel];
20+
export type SeverityLevel = (typeof SeverityLevel)[keyof typeof SeverityLevel];
2121

2222
/** @internal */
2323
export const MongoLoggableComponent = Object.freeze({
@@ -29,7 +29,7 @@ export const MongoLoggableComponent = Object.freeze({
2929

3030
/** @internal */
3131
export type MongoLoggableComponent =
32-
typeof MongoLoggableComponent[keyof typeof MongoLoggableComponent];
32+
(typeof MongoLoggableComponent)[keyof typeof MongoLoggableComponent];
3333

3434
/** @internal */
3535
export interface MongoLoggerEnvOptions {

src/mongo_types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export const BSONType = Object.freeze({
188188
} as const);
189189

190190
/** @public */
191-
export type BSONType = typeof BSONType[keyof typeof BSONType];
191+
export type BSONType = (typeof BSONType)[keyof typeof BSONType];
192192
/** @public */
193193
export type BSONTypeAlias = keyof typeof BSONType;
194194

src/operations/find_and_modify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const ReturnDocument = Object.freeze({
1717
} as const);
1818

1919
/** @public */
20-
export type ReturnDocument = typeof ReturnDocument[keyof typeof ReturnDocument];
20+
export type ReturnDocument = (typeof ReturnDocument)[keyof typeof ReturnDocument];
2121

2222
/** @public */
2323
export interface FindOneAndDeleteOptions extends CommandOperationOptions {

src/operations/set_profiling_level.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const ProfilingLevel = Object.freeze({
1616
} as const);
1717

1818
/** @public */
19-
export type ProfilingLevel = typeof ProfilingLevel[keyof typeof ProfilingLevel];
19+
export type ProfilingLevel = (typeof ProfilingLevel)[keyof typeof ProfilingLevel];
2020

2121
/** @public */
2222
export type SetProfilingLevelOptions = CommandOperationOptions;

src/read_concern.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const ReadConcernLevel = Object.freeze({
1010
} as const);
1111

1212
/** @public */
13-
export type ReadConcernLevel = typeof ReadConcernLevel[keyof typeof ReadConcernLevel];
13+
export type ReadConcernLevel = (typeof ReadConcernLevel)[keyof typeof ReadConcernLevel];
1414

1515
/** @public */
1616
export type ReadConcernLike = ReadConcern | { level: ReadConcernLevel } | ReadConcernLevel;

src/read_preference.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const ReadPreferenceMode = Object.freeze({
1616
} as const);
1717

1818
/** @public */
19-
export type ReadPreferenceMode = typeof ReadPreferenceMode[keyof typeof ReadPreferenceMode];
19+
export type ReadPreferenceMode = (typeof ReadPreferenceMode)[keyof typeof ReadPreferenceMode];
2020

2121
/** @public */
2222
export interface HedgeOptions {

src/sdam/common.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const TopologyType = Object.freeze({
2424
} as const);
2525

2626
/** @public */
27-
export type TopologyType = typeof TopologyType[keyof typeof TopologyType];
27+
export type TopologyType = (typeof TopologyType)[keyof typeof TopologyType];
2828

2929
/**
3030
* An enumeration of server types we know about
@@ -44,7 +44,7 @@ export const ServerType = Object.freeze({
4444
} as const);
4545

4646
/** @public */
47-
export type ServerType = typeof ServerType[keyof typeof ServerType];
47+
export type ServerType = (typeof ServerType)[keyof typeof ServerType];
4848

4949
/** @internal */
5050
export type TimerQueue = Set<NodeJS.Timeout>;

src/transactions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const TxnState = Object.freeze({
1818
} as const);
1919

2020
/** @internal */
21-
export type TxnState = typeof TxnState[keyof typeof TxnState];
21+
export type TxnState = (typeof TxnState)[keyof typeof TxnState];
2222

2323
const stateMachine: { [state in TxnState]: TxnState[] } = {
2424
[TxnState.NO_TRANSACTION]: [TxnState.NO_TRANSACTION, TxnState.STARTING_TRANSACTION],

test/integration/crud/aggregation.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ describe('Aggregation', function () {
725725
// is executed
726726
const command = db.command.bind(db);
727727
// Validate the command
728-
db.command = function (...args: Parameters<typeof db['command']>) {
728+
db.command = function (...args: Parameters<(typeof db)['command']>) {
729729
const c = args[0];
730730
expect(err).to.not.exist;
731731
expect(c.maxTimeMS).to.equal(1000);
@@ -741,7 +741,7 @@ describe('Aggregation', function () {
741741
expect(result.authors).to.eql(['bob']);
742742

743743
// Validate the command
744-
db.command = function (...args: Parameters<typeof db['command']>) {
744+
db.command = function (...args: Parameters<(typeof db)['command']>) {
745745
const c = args[0];
746746
expect(err).to.not.exist;
747747
expect(c.maxTimeMS).to.equal(1000);
@@ -792,7 +792,7 @@ describe('Aggregation', function () {
792792

793793
const command = db.command.bind(db);
794794

795-
db.command = function (...args: Parameters<typeof db['command']>) {
795+
db.command = function (...args: Parameters<(typeof db)['command']>) {
796796
const c = args[0];
797797
expect(c).to.be.an('object');
798798
expect(c.comment).to.be.a('string').and.to.equal('comment');

test/integration/crud/misc_cursors.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3248,7 +3248,7 @@ describe('Cursor', function () {
32483248
it('should tail cursor using maxAwaitTimeMS for 3.2 or higher', {
32493249
// Add a tag that our runner can trigger on
32503250
// in this case we are setting that node needs to be higher than 0.10.X to run
3251-
metadata: { requires: { topology: ['single'], mongodb: '>3.1.9' } },
3251+
metadata: { requires: { topology: ['single'], mongodb: '<7.0.0' } },
32523252

32533253
test: function (done) {
32543254
const configuration = this.configuration;

test/integration/node-specific/comment_with_falsy_values.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Collection, CommandStartedEvent, Long, MongoClient } from '../../../src
44
import { TestBuilder, UnifiedTestSuiteBuilder } from '../../tools/utils';
55

66
const falsyValues = [0, false, '', Long.ZERO, null, NaN] as const;
7-
const falsyToString = (value: typeof falsyValues[number]) => {
7+
const falsyToString = (value: (typeof falsyValues)[number]) => {
88
if (Number.isNaN(value)) {
99
return 'NaN';
1010
}

0 commit comments

Comments
 (0)