Skip to content

Commit 755fd5d

Browse files
committed
wip
1 parent cb908ce commit 755fd5d

File tree

122 files changed

+8802
-3836
lines changed

Some content is hidden

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

122 files changed

+8802
-3836
lines changed

.eslintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"@typescript-eslint",
99
"prettier",
1010
"promise",
11-
"eslint-plugin-tsdoc"
11+
"eslint-plugin-tsdoc",
12+
"sort-imports-es6-autofix"
1213
],
1314
"extends": [
1415
"eslint:recommended",
@@ -26,6 +27,8 @@
2627
"prettier/prettier": "error",
2728

2829
"tsdoc/syntax": "warn",
30+
"sort-imports": "off",
31+
"sort-imports-es6-autofix/sort-imports-es6": "error",
2932

3033
"no-console": "off",
3134
"eqeqeq": ["error", "always", { "null": "ignore" }],

graph.svg

Lines changed: 4717 additions & 0 deletions
Loading

package-lock.json

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

package.json

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@
1919
"official"
2020
],
2121
"peerOptionalDependencies": {
22-
"kerberos": "^1.1.0",
23-
"mongodb-client-encryption": "^1.0.0",
24-
"mongodb-extjson": "^2.1.2",
25-
"snappy": "^6.1.1",
26-
"bson-ext": "^2.0.0"
22+
"kerberos": "^1.1.4",
23+
"mongodb-client-encryption": "^1.1.0",
24+
"snappy": "^6.3.5",
25+
"bson-ext": "^2.0.5"
2726
},
2827
"dependencies": {
29-
"bl": "^2.2.1",
30-
"bson": "^4.0.4",
28+
"bl": "^4.0.3",
29+
"bson": "^4.2.0",
3130
"denque": "^1.4.1"
3231
},
3332
"devDependencies": {
@@ -36,50 +35,51 @@
3635
"@microsoft/tsdoc-config": "^0.13.6",
3736
"@types/aws4": "^1.5.1",
3837
"@types/bl": "^2.1.0",
39-
"@types/bson": "^4.0.2",
38+
"@types/bson": "^4.0.3",
4039
"@types/kerberos": "^1.1.0",
41-
"@types/node": "^14.6.4",
40+
"@types/node": "^14.14.9",
4241
"@types/saslprep": "^1.0.0",
43-
"@typescript-eslint/eslint-plugin": "^3.10.0",
44-
"@typescript-eslint/parser": "^3.10.0",
42+
"@typescript-eslint/eslint-plugin": "^4.8.1",
43+
"@typescript-eslint/parser": "^4.8.1",
4544
"chai": "^4.2.0",
4645
"chai-subset": "^1.6.0",
47-
"chalk": "^2.4.2",
46+
"chalk": "^4.1.0",
4847
"co": "4.6.0",
49-
"coveralls": "^3.0.11",
50-
"eslint": "^6.8.0",
51-
"eslint-config-prettier": "^6.11.0",
52-
"eslint-plugin-jsdoc": "^30.3.1",
53-
"eslint-plugin-prettier": "^3.1.3",
48+
"coveralls": "^3.1.0",
49+
"eslint": "^7.13.0",
50+
"eslint-config-prettier": "^6.15.0",
51+
"eslint-plugin-jsdoc": "^30.7.8",
52+
"eslint-plugin-prettier": "^3.1.4",
5453
"eslint-plugin-promise": "^4.2.1",
55-
"eslint-plugin-tsdoc": "^0.2.6",
54+
"eslint-plugin-sort-imports-es6-autofix": "^0.5.0",
55+
"eslint-plugin-tsdoc": "^0.2.7",
5656
"js-yaml": "^3.14.0",
57-
"jsdoc": "^3.6.4",
57+
"jsdoc": "^3.6.6",
5858
"lodash.camelcase": "^4.3.0",
59-
"madge": "^3.9.0",
60-
"mocha": "^8.1.3",
61-
"mocha-sinon": "^2.1.0",
59+
"madge": "^3.12.0",
60+
"mocha": "^8.2.1",
61+
"mocha-sinon": "^2.1.2",
6262
"mongodb-mock-server": "^2.0.1",
6363
"nyc": "^15.1.0",
64-
"prettier": "^2.0.5",
64+
"prettier": "^2.2.0",
6565
"rimraf": "^3.0.2",
66-
"semver": "^5.5.0",
67-
"sinon": "^4.3.0",
68-
"sinon-chai": "^3.2.0",
69-
"snappy": "^6.3.0",
66+
"semver": "^7.3.2",
67+
"sinon": "^9.2.1",
68+
"sinon-chai": "^3.5.0",
69+
"snappy": "^6.3.5",
7070
"source-map-support": "^0.5.19",
7171
"spec-xunit-file": "0.0.1-3",
72-
"standard-version": "^7.1.0",
73-
"through2": "^3.0.1",
72+
"standard-version": "^9.0.0",
73+
"through2": "^4.0.2",
7474
"ts-node": "^9.0.0",
7575
"typedoc": "^0.19.2",
7676
"typedoc-plugin-pages": "^1.0.1",
7777
"typescript": "^4.0.5",
7878
"typescript-cached-transpile": "^0.0.6",
79-
"worker-farm": "^1.5.0",
80-
"wtfnode": "^0.8.2",
79+
"worker-farm": "^1.7.0",
80+
"wtfnode": "^0.8.3",
8181
"xml2js": "^0.4.23",
82-
"yargs": "^14.2.0"
82+
"yargs": "^16.1.1"
8383
},
8484
"license": "Apache-2.0",
8585
"engines": {
@@ -95,7 +95,7 @@
9595
"build:docs": "npm run build:dts && typedoc",
9696
"check:bench": "node test/benchmarks/driverBench",
9797
"check:coverage": "nyc npm run check:test",
98-
"check:lint": "npm run check:ts && eslint -v && eslint --max-warnings=0 --ext '.js,.ts' src test",
98+
"check:lint": "npm run check:ts && eslint -v && eslint -f visualstudio --max-warnings=0 --ext '.js,.ts' src test",
9999
"check:test": "mocha --recursive test/functional test/unit",
100100
"check:ts": "tsc -v && tsc --noEmit",
101101
"check:atlas": "mocha --config \"test/manual/mocharc.json\" test/manual/atlas_connectivity.test.js",
@@ -110,6 +110,6 @@
110110
},
111111
"homepage": "https://github.com/mongodb/node-mongodb-native",
112112
"optionalDependencies": {
113-
"saslprep": "^1.0.0"
113+
"saslprep": "^1.0.3"
114114
}
115115
}

src/admin.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import { AddUserOperation, AddUserOptions } from './operations/add_user';
2-
import { RemoveUserOperation, RemoveUserOptions } from './operations/remove_user';
3-
import {
4-
ValidateCollectionOperation,
5-
ValidateCollectionOptions
6-
} from './operations/validate_collection';
2+
import { Callback, getTopology } from './utils';
73
import {
84
ListDatabasesOperation,
95
ListDatabasesOptions,
106
ListDatabasesResult
117
} from './operations/list_databases';
12-
import { executeOperation } from './operations/execute_operation';
8+
import { RemoveUserOperation, RemoveUserOptions } from './operations/remove_user';
139
import { RunCommandOperation, RunCommandOptions } from './operations/run_command';
14-
import { Callback, getTopology } from './utils';
15-
import type { Document } from './bson';
10+
import {
11+
ValidateCollectionOperation,
12+
ValidateCollectionOptions
13+
} from './operations/validate_collection';
14+
import { executeOperation } from './operations/execute_operation';
1615
import type { CommandOperationOptions } from './operations/command';
1716
import type { Db } from './db';
17+
import type { Document } from './bson';
1818

1919
/** @internal */
2020
export interface AdminPrivate {

src/apm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { Connection } from './cmap/connection';
12
import { EventEmitter } from 'events';
23
import type { Callback } from './utils';
3-
import { Connection } from './cmap/connection';
44

55
// eslint-disable-next-line @typescript-eslint/no-unused-vars
66
import type { MongoClient } from './mongo_client';

src/bson.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { OperationParent } from './operations/command';
21
// import type * as _BSON from 'bson';
32
// let BSON: typeof _BSON = require('bson');
43
// try {
@@ -83,7 +82,7 @@ export function pluckBSONSerializeOptions(options: BSONSerializeOptions): BSONSe
8382
*/
8483
export function resolveBSONOptions(
8584
options?: BSONSerializeOptions,
86-
parent?: OperationParent
85+
parent?: { bsonOptions?: BSONSerializeOptions }
8786
): BSONSerializeOptions {
8887
const parentOptions = parent?.bsonOptions;
8988
return {

src/bulk/common.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
import { PromiseProvider } from '../promise_provider';
2-
import { Long, ObjectId, Document, BSONSerializeOptions, resolveBSONOptions } from '../bson';
3-
import { MongoError, MongoWriteConcernError, AnyError } from '../error';
1+
import { AnyError, MongoError, MongoWriteConcernError } from '../error';
2+
import { BSONSerializeOptions, Document, Long, ObjectId, resolveBSONOptions } from '../bson';
43
import {
4+
Callback,
5+
MongoDBNamespace,
56
applyRetryableWrites,
67
executeLegacyOperation,
8+
getTopology,
79
hasAtomicOperators,
8-
Callback,
9-
MongoDBNamespace,
1010
maxWireVersion,
11-
getTopology,
1211
resolveOptions
1312
} from '../utils';
14-
import { executeOperation } from '../operations/execute_operation';
13+
import { DeleteOperation } from '../operations/delete';
1514
import { InsertOperation } from '../operations/insert';
15+
import { PromiseProvider } from '../promise_provider';
1616
import { UpdateOperation } from '../operations/update';
17-
import { DeleteOperation } from '../operations/delete';
1817
import { WriteConcern } from '../write_concern';
18+
import { executeOperation } from '../operations/execute_operation';
19+
import type { CollationOptions } from '../cmap/wire_protocol/write_command';
1920
import type { Collection } from '../collection';
20-
import type { Topology } from '../sdam/topology';
2121
import type { CommandOperationOptions } from '../operations/command';
22-
import type { CollationOptions } from '../cmap/wire_protocol/write_command';
2322
import type { Hint } from '../operations/operation';
23+
import type { Topology } from '../sdam/topology';
2424

2525
// Error codes
2626
const WRITE_CONCERN_ERROR = 64;

src/bulk/ordered.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import * as BSON from '../bson';
22
import {
3-
BulkOperationBase,
43
Batch,
54
BatchType,
5+
BulkOperationBase,
66
BulkWriteOptions,
7-
UpdateStatement,
8-
DeleteStatement
7+
DeleteStatement,
8+
UpdateStatement
99
} from './common';
10-
import type { Document } from '../bson';
1110
import type { Collection } from '../collection';
11+
import type { Document } from '../bson';
1212

1313
export class OrderedBulkOperation extends BulkOperationBase {
1414
constructor(collection: Collection, options: BulkWriteOptions) {

src/bulk/unordered.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import * as BSON from '../bson';
22
import {
3-
BulkOperationBase,
43
Batch,
54
BatchType,
5+
BulkOperationBase,
66
BulkWriteOptions,
7-
UpdateStatement,
7+
BulkWriteResult,
88
DeleteStatement,
9-
BulkWriteResult
9+
UpdateStatement
1010
} from './common';
1111
import type { Callback } from '../utils';
12-
import type { Document } from '../bson';
1312
import type { Collection } from '../collection';
13+
import type { Document } from '../bson';
1414

1515
export class UnorderedBulkOperation extends BulkOperationBase {
1616
constructor(collection: Collection, options: BulkWriteOptions) {

src/change_stream.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
import Denque = require('denque');
2-
import { EventEmitter } from 'events';
3-
import { MongoError, AnyError, isResumableError } from './error';
4-
import { Cursor, CursorOptions, CursorStream, CursorStreamOptions } from './cursor/cursor';
52
import { AggregateOperation, AggregateOptions } from './operations/aggregate';
3+
import { AnyError, MongoError, isResumableError } from './error';
64
import {
7-
relayEvents,
8-
maxWireVersion,
5+
Callback,
6+
MongoDBNamespace,
97
calculateDurationInMs,
10-
now,
8+
getTopology,
9+
maxWireVersion,
1110
maybePromise,
12-
MongoDBNamespace,
13-
Callback,
14-
getTopology
11+
now,
12+
relayEvents
1513
} from './utils';
14+
import { Collection } from './collection';
15+
import { Cursor, CursorOptions, CursorStream, CursorStreamOptions } from './cursor/cursor';
16+
import { Db } from './db';
17+
import { EventEmitter } from 'events';
18+
import { MongoClient } from './mongo_client';
19+
import type { CollationOptions } from './cmap/wire_protocol/write_command';
20+
import type { Document, Timestamp } from './bson';
21+
import type { OperationParent } from './operations/command';
1622
import type { ReadPreference } from './read_preference';
17-
import type { Timestamp, Document } from './bson';
1823
import type { Topology } from './sdam/topology';
19-
import type { OperationParent } from './operations/command';
20-
import type { CollationOptions } from './cmap/wire_protocol/write_command';
21-
import { MongoClient } from './mongo_client';
22-
import { Db } from './db';
23-
import { Collection } from './collection';
2424

2525
const kResumeQueue = Symbol('resumeQueue');
2626
const kCursorStream = Symbol('cursorStream');

src/cmap/auth/auth_provider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import type { Document } from '../../bson';
1+
import type { Callback, ClientMetadataOptions } from '../../utils';
22
import type { Connection, ConnectionOptions } from '../connection';
3-
import type { MongoCredentials } from './mongo_credentials';
3+
import type { Document } from '../../bson';
44
import type { HandshakeDocument } from '../connect';
5-
import type { ClientMetadataOptions, Callback } from '../../utils';
5+
import type { MongoCredentials } from './mongo_credentials';
66

77
export type AuthContextOptions = ConnectionOptions & ClientMetadataOptions;
88

src/cmap/auth/defaultAuthProviders.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { GSSAPI } from './gssapi';
12
import { MongoCR } from './mongocr';
2-
import { X509 } from './x509';
3+
import { MongoDBAWS } from './mongodb_aws';
34
import { Plain } from './plain';
4-
import { GSSAPI } from './gssapi';
55
import { ScramSHA1, ScramSHA256 } from './scram';
6-
import { MongoDBAWS } from './mongodb_aws';
6+
import { X509 } from './x509';
77
import type { AuthProvider } from './auth_provider';
88

99
/** @public */

src/cmap/auth/gssapi.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { AuthProvider, AuthContext } from './auth_provider';
2-
import { MongoError } from '../../error';
1+
import { AuthContext, AuthProvider } from './auth_provider';
32
import { Kerberos, KerberosClient } from '../../deps';
3+
import { MongoError } from '../../error';
44
import type { Callback } from '../../utils';
5-
import type { HandshakeDocument } from '../connect';
65
import type { Document } from '../../bson';
6+
import type { HandshakeDocument } from '../connect';
77

88
const kGssapiClient = Symbol('GSSAPI_CLIENT');
99

src/cmap/auth/mongo_credentials.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Resolves the default auth mechanism according to
22

3-
import type { Document } from '../../bson';
43
import { AuthMechanism } from './defaultAuthProviders';
4+
import type { Document } from '../../bson';
55

66
// https://github.com/mongodb/specifications/blob/master/source/auth/auth.rst
77
function getDefaultAuthMechanism(ismaster?: Document): AuthMechanism {

src/cmap/auth/mongocr.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as crypto from 'crypto';
2-
import { AuthProvider, AuthContext } from './auth_provider';
3-
import type { Callback } from '../../utils';
2+
import { AuthContext, AuthProvider } from './auth_provider';
43
import { MongoError } from '../../error';
4+
import type { Callback } from '../../utils';
55

66
export class MongoCR extends AuthProvider {
77
auth(authContext: AuthContext, callback: Callback): void {

src/cmap/auth/mongodb_aws.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import * as http from 'http';
1+
import * as BSON from '../../bson';
22
import * as crypto from 'crypto';
3+
import * as http from 'http';
34
import * as url from 'url';
4-
import * as BSON from '../../bson';
5-
import { AuthProvider, AuthContext } from './auth_provider';
5+
import { AuthContext, AuthProvider } from './auth_provider';
6+
import { Callback, maxWireVersion } from '../../utils';
67
import { MongoCredentials } from './mongo_credentials';
78
import { MongoError } from '../../error';
8-
import { maxWireVersion, Callback } from '../../utils';
99
import type { BSONSerializeOptions } from '../../bson';
1010

11-
import { aws4 } from '../../deps';
1211
import { AuthMechanism } from './defaultAuthProviders';
12+
import { aws4 } from '../../deps';
1313

1414
const ASCII_N = 110;
1515
const AWS_RELATIVE_URI = 'http://169.254.170.2';

src/cmap/auth/plain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { AuthContext, AuthProvider } from './auth_provider';
12
import { Binary } from '../../bson';
2-
import { AuthProvider, AuthContext } from './auth_provider';
33
import { MongoError } from '../../error';
44
import type { Callback } from '../../utils';
55

0 commit comments

Comments
 (0)