Skip to content

Commit 3b45cef

Browse files
committed
refactor!: remove deprecated items
Removals are noted in JIRA ticket. NODE-2317
1 parent 1615be0 commit 3b45cef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+975
-1843
lines changed

.eslintrc.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"plugins": [
88
"@typescript-eslint",
99
"prettier",
10-
"promise",
1110
"eslint-plugin-tsdoc"
1211
],
1312
"extends": [
@@ -27,10 +26,9 @@
2726

2827
"tsdoc/syntax": "warn",
2928

30-
"no-console": "off",
29+
"no-console": "error",
3130
"eqeqeq": ["error", "always", { "null": "ignore" }],
3231
"strict": ["error", "global"],
33-
"promise/no-native": "error",
3432

3533
"@typescript-eslint/no-explicit-any": "off"
3634
},

package-lock.json

+538-453
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+9-10
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
},
3232
"devDependencies": {
3333
"@istanbuljs/nyc-config-typescript": "^1.0.1",
34-
"@microsoft/api-extractor": "^7.12.1",
35-
"@microsoft/tsdoc-config": "^0.13.9",
34+
"@microsoft/api-extractor": "^7.13.1",
35+
"@microsoft/tsdoc-config": "^0.14.0",
3636
"@types/aws4": "^1.5.1",
3737
"@types/bl": "^2.1.0",
3838
"@types/chai": "^4.2.14",
@@ -42,19 +42,18 @@
4242
"@types/node": "^14.6.4",
4343
"@types/saslprep": "^1.0.0",
4444
"@types/semver": "^7.3.4",
45-
"@typescript-eslint/eslint-plugin": "^3.10.0",
46-
"@typescript-eslint/parser": "^3.10.0",
45+
"@typescript-eslint/eslint-plugin": "^4.15.1",
46+
"@typescript-eslint/parser": "^4.15.1",
4747
"chai": "^4.2.0",
4848
"chai-subset": "^1.6.0",
4949
"chalk": "^4.1.0",
5050
"co": "4.6.0",
5151
"coveralls": "^3.0.11",
52-
"eslint": "^6.8.0",
52+
"eslint": "^7.20.0",
5353
"eslint-config-prettier": "^6.11.0",
5454
"eslint-plugin-jsdoc": "^30.7.8",
5555
"eslint-plugin-prettier": "^3.1.3",
56-
"eslint-plugin-promise": "^4.2.1",
57-
"eslint-plugin-tsdoc": "^0.2.10",
56+
"eslint-plugin-tsdoc": "^0.2.11",
5857
"js-yaml": "^3.14.0",
5958
"jsdoc": "^3.6.4",
6059
"lodash.camelcase": "^4.3.0",
@@ -72,9 +71,9 @@
7271
"source-map-support": "^0.5.19",
7372
"standard-version": "^8.0.2",
7473
"through2": "^3.0.1",
75-
"ts-node": "^9.0.0",
76-
"typedoc": "^0.20.14",
77-
"typescript": "^4.0.5",
74+
"ts-node": "^9.1.1",
75+
"typedoc": "^0.20.25",
76+
"typescript": "^4.1.5",
7877
"typescript-cached-transpile": "^0.0.6",
7978
"worker-farm": "^1.5.0",
8079
"wtfnode": "^0.8.2",

src/cmap/auth/scram.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as crypto from 'crypto';
22
import { Binary, Document } from '../../bson';
33
import { MongoError, AnyError } from '../../error';
44
import { AuthProvider, AuthContext } from './auth_provider';
5-
import { Callback, ns } from '../../utils';
5+
import { Callback, emitWarning, ns } from '../../utils';
66
import type { MongoCredentials } from './mongo_credentials';
77
import type { HandshakeDocument } from '../connect';
88

@@ -25,7 +25,7 @@ class ScramSHA extends AuthProvider {
2525
return callback(new MongoError('AuthContext must provide credentials.'));
2626
}
2727
if (cryptoMethod === 'sha256' && saslprep == null) {
28-
console.warn('Warning: no saslprep library specified. Passwords will not be sanitized');
28+
emitWarning('Warning: no saslprep library specified. Passwords will not be sanitized');
2929
}
3030

3131
crypto.randomBytes(24, (err, nonce) => {

src/cmap/commands.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { OP_QUERY, OP_GETMORE, OP_KILL_CURSORS, OP_MSG } from './wire_protocol/c
55
import type { Long, Document, BSONSerializeOptions } from '../bson';
66
import type { ClientSession } from '../sessions';
77
import type { CommandOptions } from './connection';
8+
import { MongoError } from '../error';
89

910
// Incrementing request id
1011
let _requestId = 0;
@@ -826,7 +827,7 @@ export class BinMsg {
826827
while (this.index < this.data.length) {
827828
const payloadType = this.data.readUInt8(this.index++);
828829
if (payloadType === 1) {
829-
console.error('TYPE 1');
830+
throw new MongoError('Type 1 payload'); // ???
830831
} else if (payloadType === 0) {
831832
const bsonSize = this.data.readUInt32LE(this.index);
832833
const bin = this.data.slice(this.index, this.index + bsonSize);

src/cmap/connection_pool.ts

+1-29
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Denque = require('denque');
22
import { EventEmitter } from 'events';
33
import { Logger } from '../logger';
4-
import { Connection, ConnectionOptions, CommandOptions } from './connection';
4+
import { Connection, ConnectionOptions } from './connection';
55
import { connect } from './connect';
66
import { eachAsync, relayEvents, makeCounter, Callback } from '../utils';
77
import { MongoError } from '../error';
@@ -18,7 +18,6 @@ import {
1818
ConnectionCheckedInEvent,
1919
ConnectionPoolClearedEvent
2020
} from './events';
21-
import type { Document } from '../bson';
2221

2322
const kLogger = Symbol('logger');
2423
const kConnections = Symbol('connections');
@@ -360,33 +359,6 @@ export class ConnectionPool extends EventEmitter {
360359
});
361360
});
362361
}
363-
364-
// NOTE: remove `isConnected` and `write` as part of NODE-2745
365-
// These functions only exist if makeServerTrampoline is
366-
// called when using the wire protocol methods
367-
368-
/**
369-
* @internal
370-
* @deprecated Remove sever trampoline code. (NODE-2745)
371-
*/
372-
isConnected(): boolean {
373-
throw new TypeError('This is not a server trampoline instance');
374-
}
375-
376-
/**
377-
* @internal
378-
* @deprecated Remove sever trampoline code. (NODE-2745)
379-
*/
380-
write(
381-
message: Document,
382-
commandOptions: CommandOptions,
383-
callback: (err: MongoError, ...args: Document[]) => void
384-
): void {
385-
message;
386-
commandOptions;
387-
callback;
388-
throw new TypeError('This is not a server trampoline instance');
389-
}
390362
}
391363

392364
function ensureMinPoolSize(pool: ConnectionPool) {

src/cmap/events.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { GetMore, KillCursor, Msg, WriteProtocolMessageType } from './commands';
22
import { calculateDurationInMs, deepCopy } from '../utils';
3-
import type { ConnectionPool, ConnectionPoolOptions } from './connection_pool';
3+
import { ConnectionPool, ConnectionPoolOptions } from './connection_pool';
44
import type { Connection } from './connection';
55
import type { Document } from '../bson';
66
import type { AnyError } from '../error';
@@ -150,17 +150,17 @@ export class ConnectionPoolClearedEvent extends ConnectionPoolMonitoringEvent {
150150
}
151151

152152
export const CMAP_EVENT_NAMES = [
153-
'connectionPoolCreated',
154-
'connectionPoolClosed',
155-
'connectionCreated',
156-
'connectionReady',
157-
'connectionClosed',
158-
'connectionCheckOutStarted',
159-
'connectionCheckOutFailed',
160-
'connectionCheckedOut',
161-
'connectionCheckedIn',
162-
'connectionPoolCleared'
163-
];
153+
ConnectionPool.CONNECTION_POOL_CREATED,
154+
ConnectionPool.CONNECTION_POOL_CLOSED,
155+
ConnectionPool.CONNECTION_CREATED,
156+
ConnectionPool.CONNECTION_READY,
157+
ConnectionPool.CONNECTION_CLOSED,
158+
ConnectionPool.CONNECTION_CHECK_OUT_STARTED,
159+
ConnectionPool.CONNECTION_CHECK_OUT_FAILED,
160+
ConnectionPool.CONNECTION_CHECKED_OUT,
161+
ConnectionPool.CONNECTION_CHECKED_IN,
162+
ConnectionPool.CONNECTION_POOL_CLEARED
163+
] as const;
164164

165165
/**
166166
* An event indicating the start of a given

0 commit comments

Comments
 (0)