Skip to content

chore(NODE-5247): update dependencies #3657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 9, 2023
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
3 changes: 2 additions & 1 deletion .evergreen/run-typescript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ function get_ts_version() {
export TSC="./node_modules/typescript/bin/tsc"
export TS_VERSION=$(get_ts_version)

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

echo "Typescript $($TSC -v)"

Expand Down
27 changes: 27 additions & 0 deletions etc/clean_definition_files.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#! /usr/bin/env node
/* eslint-disable @typescript-eslint/no-var-requires */
const fs = require('fs');
const path = require('path');

function* walk(root) {
const directoryContents = fs.readdirSync(root);
for (const filepath of directoryContents) {
const fullPath = path.join(root, filepath);
const stat = fs.statSync(fullPath);
if (stat.isDirectory()) {
yield* walk(fullPath);
} else if (stat.isFile()) {
yield fullPath;
}
}
}

const libPath = path.resolve(__dirname, '..', 'lib');
if (fs.existsSync(libPath)) {
const definitionFiles = Array.from(walk(libPath)).filter(filePath => {
return filePath.endsWith('.d.ts') || filePath.endsWith('.d.ts.map');
});
for (const definitionFile of definitionFiles) {
fs.unlinkSync(definitionFile);
}
}
9,905 changes: 1,658 additions & 8,247 deletions package-lock.json

Large diffs are not rendered by default.

44 changes: 21 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,35 @@
},
"dependencies": {
"bson": "^4.7.2",
"mongodb-connection-string-url": "^2.5.4",
"mongodb-connection-string-url": "^2.6.0",
"socks": "^2.7.1"
},
"devDependencies": {
"@iarna/toml": "^2.2.5",
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@microsoft/api-extractor": "^7.33.3",
"@microsoft/api-extractor": "^7.34.7",
"@microsoft/tsdoc-config": "^0.16.2",
"@mongodb-js/zstd": "^1.0.0",
"@types/chai": "^4.3.3",
"@mongodb-js/zstd": "^1.1.0",
"@types/chai": "^4.3.5",
"@types/chai-subset": "^1.3.3",
"@types/express": "^4.17.14",
"@types/express": "^4.17.17",
"@types/kerberos": "^1.1.1",
"@types/mocha": "^10.0.0",
"@types/node": "^18.11.0",
"@types/mocha": "^10.0.1",
"@types/node": "^18.16.3",
"@types/saslprep": "^1.0.1",
"@types/semver": "^7.3.12",
"@types/sinon": "^10.0.13",
"@types/sinon-chai": "^3.2.8",
"@types/semver": "^7.3.13",
"@types/sinon": "^10.0.14",
"@types/sinon-chai": "^3.2.9",
"@types/whatwg-url": "^11.0.0",
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.0",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"bluebird": "^3.7.2",
"chai": "^4.3.6",
"chai": "^4.3.7",
"chai-subset": "^1.6.0",
"chalk": "^4.1.2",
"eslint": "^8.25.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-simple-import-sort": "^8.0.0",
"eslint-plugin-tsdoc": "^0.2.17",
Expand All @@ -63,20 +63,18 @@
"mocha": "^9.2.2",
"mocha-sinon": "^2.1.2",
"nyc": "^15.1.0",
"prettier": "^2.7.1",
"rimraf": "^3.0.2",
"semver": "^7.3.8",
"prettier": "^2.8.8",
"semver": "^7.5.0",
"sinon": "^13.0.1",
"sinon-chai": "^3.7.0",
"source-map-support": "^0.5.21",
"standard-version": "^9.5.0",
"ts-node": "^10.9.1",
"tsd": "^0.24.1",
"tsd": "^0.27.0",
"typescript": "^4.8.4",
"typescript-cached-transpile": "^0.0.6",
"v8-heapsnapshot": "^1.2.0",
"xml2js": "^0.4.23",
"yargs": "^17.6.0"
"yargs": "^17.7.2"
},
"license": "Apache-2.0",
"engines": {
Expand All @@ -93,7 +91,7 @@
"scripts": {
"build:evergreen": "node .evergreen/generate_evergreen_tasks.js",
"build:ts": "node ./node_modules/typescript/bin/tsc",
"build:dts": "npm run build:ts && api-extractor run && rimraf 'lib/**/*.d.ts*'",
"build:dts": "npm run build:ts && api-extractor run && node etc/clean_definition_files.cjs",
"build:docs": "./etc/docs/build.ts",
"build:typedoc": "typedoc",
"check:bench": "node test/benchmarks/driverBench",
Expand Down
2 changes: 1 addition & 1 deletion src/bulk/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const BatchType = Object.freeze({
} as const);

/** @public */
export type BatchType = typeof BatchType[keyof typeof BatchType];
export type BatchType = (typeof BatchType)[keyof typeof BatchType];

/** @public */
export interface InsertOneModel<TSchema extends Document = Document> {
Expand Down
2 changes: 1 addition & 1 deletion src/cmap/auth/gssapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const GSSAPICanonicalizationValue = Object.freeze({

/** @public */
export type GSSAPICanonicalizationValue =
typeof GSSAPICanonicalizationValue[keyof typeof GSSAPICanonicalizationValue];
(typeof GSSAPICanonicalizationValue)[keyof typeof GSSAPICanonicalizationValue];

type MechanismProperties = {
/** @deprecated use `CANONICALIZE_HOST_NAME` instead */
Expand Down
2 changes: 1 addition & 1 deletion src/cmap/auth/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const AuthMechanism = Object.freeze({
} as const);

/** @public */
export type AuthMechanism = typeof AuthMechanism[keyof typeof AuthMechanism];
export type AuthMechanism = (typeof AuthMechanism)[keyof typeof AuthMechanism];

/** @internal */
export const AUTH_MECHS_AUTH_SRC_EXTERNAL = new Set<AuthMechanism>([
Expand Down
2 changes: 1 addition & 1 deletion src/cmap/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ function parseSslOptions(options: MakeConnectionOptions): TLSConnectionOpts {
}

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

function makeConnection(options: MakeConnectionOptions, _callback: Callback<Stream>) {
Expand Down
2 changes: 1 addition & 1 deletion src/cmap/connection_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export type ConnectionPoolEvents = {
*/
export class ConnectionPool extends TypedEventEmitter<ConnectionPoolEvents> {
options: Readonly<ConnectionPoolOptions>;
[kPoolState]: typeof PoolState[keyof typeof PoolState];
[kPoolState]: (typeof PoolState)[keyof typeof PoolState];
[kServer]: Server;
[kLogger]: Logger;
[kConnections]: List<Connection>;
Expand Down
2 changes: 1 addition & 1 deletion src/cmap/wire_protocol/compression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const Compressor = Object.freeze({
} as const);

/** @public */
export type Compressor = typeof Compressor[CompressorName];
export type Compressor = (typeof Compressor)[CompressorName];

/** @public */
export type CompressorName = keyof typeof Compressor;
Expand Down
2 changes: 1 addition & 1 deletion src/cursor/abstract_cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export interface CursorStreamOptions {
}

/** @public */
export type CursorFlag = typeof CURSOR_FLAGS[number];
export type CursorFlag = (typeof CURSOR_FLAGS)[number];

/** @public */
export interface AbstractCursorOptions extends BSONSerializeOptions {
Expand Down
2 changes: 1 addition & 1 deletion src/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export const AutoEncryptionLoggerLevel = Object.freeze({

/** @public */
export type AutoEncryptionLoggerLevel =
typeof AutoEncryptionLoggerLevel[keyof typeof AutoEncryptionLoggerLevel];
(typeof AutoEncryptionLoggerLevel)[keyof typeof AutoEncryptionLoggerLevel];

/** @public */
export interface AutoEncryptionTlsOptions {
Expand Down
2 changes: 1 addition & 1 deletion src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const MongoErrorLabel = Object.freeze({
} as const);

/** @public */
export type MongoErrorLabel = typeof MongoErrorLabel[keyof typeof MongoErrorLabel];
export type MongoErrorLabel = (typeof MongoErrorLabel)[keyof typeof MongoErrorLabel];

/** @public */
export interface ErrorDescription extends Document {
Expand Down
2 changes: 1 addition & 1 deletion src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const LoggerLevel = Object.freeze({
* @public
* @deprecated The Legacy Logger is deprecated and will be removed in the next major version.
*/
export type LoggerLevel = typeof LoggerLevel[keyof typeof LoggerLevel];
export type LoggerLevel = (typeof LoggerLevel)[keyof typeof LoggerLevel];

/**
* @public
Expand Down
10 changes: 5 additions & 5 deletions src/mongo_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const ServerApiVersion = Object.freeze({
} as const);

/** @public */
export type ServerApiVersion = typeof ServerApiVersion[keyof typeof ServerApiVersion];
export type ServerApiVersion = (typeof ServerApiVersion)[keyof typeof ServerApiVersion];

/** @public */
export interface ServerApi {
Expand Down Expand Up @@ -74,19 +74,19 @@ export interface PkFactory {
/** @public */
export type SupportedTLSConnectionOptions = Pick<
TLSConnectionOptions,
Extract<keyof TLSConnectionOptions, typeof LEGAL_TLS_SOCKET_OPTIONS[number]>
Extract<keyof TLSConnectionOptions, (typeof LEGAL_TLS_SOCKET_OPTIONS)[number]>
>;

/** @public */
export type SupportedTLSSocketOptions = Pick<
TLSSocketOptions,
Extract<keyof TLSSocketOptions, typeof LEGAL_TLS_SOCKET_OPTIONS[number]>
Extract<keyof TLSSocketOptions, (typeof LEGAL_TLS_SOCKET_OPTIONS)[number]>
>;

/** @public */
export type SupportedSocketOptions = Pick<
TcpNetConnectOpts,
typeof LEGAL_TCP_SOCKET_OPTIONS[number]
(typeof LEGAL_TCP_SOCKET_OPTIONS)[number]
>;

/** @public */
Expand Down Expand Up @@ -308,7 +308,7 @@ export interface MongoClientPrivate {
}

/** @public */
export type MongoClientEvents = Pick<TopologyEvents, typeof MONGO_CLIENT_EVENTS[number]> & {
export type MongoClientEvents = Pick<TopologyEvents, (typeof MONGO_CLIENT_EVENTS)[number]> & {
// In previous versions the open event emitted a topology, in an effort to no longer
// expose internals but continue to expose this useful event API, it now emits a mongoClient
open(mongoClient: MongoClient): void;
Expand Down
4 changes: 2 additions & 2 deletions src/mongo_logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const SeverityLevel = Object.freeze({
} as const);

/** @internal */
export type SeverityLevel = typeof SeverityLevel[keyof typeof SeverityLevel];
export type SeverityLevel = (typeof SeverityLevel)[keyof typeof SeverityLevel];

/** @internal */
export const MongoLoggableComponent = Object.freeze({
Expand All @@ -29,7 +29,7 @@ export const MongoLoggableComponent = Object.freeze({

/** @internal */
export type MongoLoggableComponent =
typeof MongoLoggableComponent[keyof typeof MongoLoggableComponent];
(typeof MongoLoggableComponent)[keyof typeof MongoLoggableComponent];

/** @internal */
export interface MongoLoggerEnvOptions {
Expand Down
2 changes: 1 addition & 1 deletion src/mongo_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export const BSONType = Object.freeze({
} as const);

/** @public */
export type BSONType = typeof BSONType[keyof typeof BSONType];
export type BSONType = (typeof BSONType)[keyof typeof BSONType];
/** @public */
export type BSONTypeAlias = keyof typeof BSONType;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/find_and_modify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const ReturnDocument = Object.freeze({
} as const);

/** @public */
export type ReturnDocument = typeof ReturnDocument[keyof typeof ReturnDocument];
export type ReturnDocument = (typeof ReturnDocument)[keyof typeof ReturnDocument];

/** @public */
export interface FindOneAndDeleteOptions extends CommandOperationOptions {
Expand Down
2 changes: 1 addition & 1 deletion src/operations/set_profiling_level.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const ProfilingLevel = Object.freeze({
} as const);

/** @public */
export type ProfilingLevel = typeof ProfilingLevel[keyof typeof ProfilingLevel];
export type ProfilingLevel = (typeof ProfilingLevel)[keyof typeof ProfilingLevel];

/** @public */
export type SetProfilingLevelOptions = CommandOperationOptions;
Expand Down
2 changes: 1 addition & 1 deletion src/read_concern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const ReadConcernLevel = Object.freeze({
} as const);

/** @public */
export type ReadConcernLevel = typeof ReadConcernLevel[keyof typeof ReadConcernLevel];
export type ReadConcernLevel = (typeof ReadConcernLevel)[keyof typeof ReadConcernLevel];

/** @public */
export type ReadConcernLike = ReadConcern | { level: ReadConcernLevel } | ReadConcernLevel;
Expand Down
2 changes: 1 addition & 1 deletion src/read_preference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const ReadPreferenceMode = Object.freeze({
} as const);

/** @public */
export type ReadPreferenceMode = typeof ReadPreferenceMode[keyof typeof ReadPreferenceMode];
export type ReadPreferenceMode = (typeof ReadPreferenceMode)[keyof typeof ReadPreferenceMode];

/** @public */
export interface HedgeOptions {
Expand Down
4 changes: 2 additions & 2 deletions src/sdam/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const TopologyType = Object.freeze({
} as const);

/** @public */
export type TopologyType = typeof TopologyType[keyof typeof TopologyType];
export type TopologyType = (typeof TopologyType)[keyof typeof TopologyType];

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

/** @public */
export type ServerType = typeof ServerType[keyof typeof ServerType];
export type ServerType = (typeof ServerType)[keyof typeof ServerType];

/** @internal */
export type TimerQueue = Set<NodeJS.Timeout>;
Expand Down
2 changes: 1 addition & 1 deletion src/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const TxnState = Object.freeze({
} as const);

/** @internal */
export type TxnState = typeof TxnState[keyof typeof TxnState];
export type TxnState = (typeof TxnState)[keyof typeof TxnState];

const stateMachine: { [state in TxnState]: TxnState[] } = {
[TxnState.NO_TRANSACTION]: [TxnState.NO_TRANSACTION, TxnState.STARTING_TRANSACTION],
Expand Down
6 changes: 3 additions & 3 deletions test/integration/crud/aggregation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ describe('Aggregation', function () {
// is executed
const command = db.command.bind(db);
// Validate the command
db.command = function (...args: Parameters<typeof db['command']>) {
db.command = function (...args: Parameters<(typeof db)['command']>) {
const c = args[0];
expect(err).to.not.exist;
expect(c.maxTimeMS).to.equal(1000);
Expand All @@ -741,7 +741,7 @@ describe('Aggregation', function () {
expect(result.authors).to.eql(['bob']);

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

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

db.command = function (...args: Parameters<typeof db['command']>) {
db.command = function (...args: Parameters<(typeof db)['command']>) {
const c = args[0];
expect(c).to.be.an('object');
expect(c.comment).to.be.a('string').and.to.equal('comment');
Expand Down
2 changes: 1 addition & 1 deletion test/integration/crud/misc_cursors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3248,7 +3248,7 @@ describe('Cursor', function () {
it('should tail cursor using maxAwaitTimeMS for 3.2 or higher', {
// Add a tag that our runner can trigger on
// in this case we are setting that node needs to be higher than 0.10.X to run
metadata: { requires: { topology: ['single'], mongodb: '>3.1.9' } },
metadata: { requires: { topology: ['single'], mongodb: '<7.0.0' } },

test: function (done) {
const configuration = this.configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Collection, CommandStartedEvent, Long, MongoClient } from '../../../src
import { TestBuilder, UnifiedTestSuiteBuilder } from '../../tools/utils';

const falsyValues = [0, false, '', Long.ZERO, null, NaN] as const;
const falsyToString = (value: typeof falsyValues[number]) => {
const falsyToString = (value: (typeof falsyValues)[number]) => {
if (Number.isNaN(value)) {
return 'NaN';
}
Expand Down
Loading