Skip to content

Commit 0b636ba

Browse files
authored
fix(NODE-3245): mark symbols as internal remove from type definitions (#2810)
1 parent 661511d commit 0b636ba

27 files changed

+12011
-642
lines changed

package-lock.json

+11,839-566
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+8-9
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,19 @@
2626
"bson-ext": "^2.0.0"
2727
},
2828
"dependencies": {
29-
"bson": "^4.2.3",
30-
"denque": "^1.4.1"
29+
"bson": "^4.4.0",
30+
"denque": "^1.5.0"
3131
},
3232
"devDependencies": {
3333
"@istanbuljs/nyc-config-typescript": "^1.0.1",
34-
"@microsoft/api-extractor": "^7.14.0",
34+
"@microsoft/api-extractor": "^7.15.2",
3535
"@microsoft/tsdoc-config": "^0.15.2",
3636
"@types/aws4": "^1.5.1",
37-
"@types/bl": "^2.1.0",
3837
"@types/chai": "^4.2.14",
3938
"@types/chai-subset": "^1.3.3",
4039
"@types/kerberos": "^1.1.0",
4140
"@types/mocha": "^8.2.0",
42-
"@types/node": "^14.14.41",
41+
"@types/node": "^15.3.1",
4342
"@types/saslprep": "^1.0.0",
4443
"@types/semver": "^7.3.4",
4544
"@typescript-eslint/eslint-plugin": "^4.19.0",
@@ -49,11 +48,11 @@
4948
"chalk": "^4.1.0",
5049
"co": "4.6.0",
5150
"coveralls": "^3.0.11",
52-
"eslint": "^7.20.0",
51+
"eslint": "^7.26.0",
5352
"eslint-config-prettier": "^6.11.0",
5453
"eslint-plugin-jsdoc": "^30.7.8",
5554
"eslint-plugin-prettier": "^3.1.3",
56-
"eslint-plugin-tsdoc": "^0.2.11",
55+
"eslint-plugin-tsdoc": "^0.2.14",
5756
"js-yaml": "^3.14.0",
5857
"jsdoc": "^3.6.4",
5958
"lodash.camelcase": "^4.3.0",
@@ -72,8 +71,8 @@
7271
"standard-version": "^9.1.1",
7372
"through2": "^3.0.1",
7473
"ts-node": "^9.1.1",
75-
"tsd": "^0.14.0",
76-
"typedoc": "^0.20.35",
74+
"tsd": "^0.15.1",
75+
"typedoc": "^0.20.36",
7776
"typescript": "^4.2.4",
7877
"typescript-cached-transpile": "^0.0.6",
7978
"worker-farm": "^1.5.0",

src/change_stream.ts

+3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ import type { ClientSession } from './sessions';
2828
import { executeOperation, ExecutionResult } from './operations/execute_operation';
2929
import { InferIdType, Nullable, TypedEventEmitter } from './mongo_types';
3030

31+
/** @internal */
3132
const kResumeQueue = Symbol('resumeQueue');
33+
/** @internal */
3234
const kCursorStream = Symbol('cursorStream');
35+
/** @internal */
3336
const kClosed = Symbol('closed');
3437

3538
const CHANGE_STREAM_OPTIONS = ['resumeAfter', 'startAfter', 'startAtOperationTime', 'fullDocument'];

src/cmap/connection.ts

+18-8
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,23 @@ import type { W, WriteConcern, WriteConcernOptions } from '../write_concern';
4444
import type { ServerApi, SupportedNodeConnectionOptions } from '../mongo_client';
4545
import { CancellationToken, TypedEventEmitter } from '../mongo_types';
4646

47+
/** @internal */
4748
const kStream = Symbol('stream');
49+
/** @internal */
4850
const kQueue = Symbol('queue');
51+
/** @internal */
4952
const kMessageStream = Symbol('messageStream');
53+
/** @internal */
5054
const kGeneration = Symbol('generation');
55+
/** @internal */
5156
const kLastUseTime = Symbol('lastUseTime');
57+
/** @internal */
5258
const kClusterTime = Symbol('clusterTime');
59+
/** @internal */
5360
const kDescription = Symbol('description');
61+
/** @internal */
5462
const kIsMaster = Symbol('ismaster');
63+
/** @internal */
5564
const kAutoEncrypter = Symbol('autoEncrypter');
5665

5766
/** @internal */
@@ -113,7 +122,8 @@ export interface ConnectionOptions
113122
autoEncrypter?: AutoEncrypter;
114123
serverApi?: ServerApi;
115124
monitorCommands: boolean;
116-
connectionType: typeof Connection;
125+
/** @internal */
126+
connectionType?: typeof Connection;
117127
credentials?: MongoCredentials;
118128
connectTimeoutMS?: number;
119129
tls: boolean;
@@ -134,15 +144,15 @@ export interface DestroyOptions {
134144

135145
/** @public */
136146
export type ConnectionEvents = {
137-
[Connection.COMMAND_STARTED](event: CommandStartedEvent): void;
138-
[Connection.COMMAND_SUCCEEDED](event: CommandSucceededEvent): void;
139-
[Connection.COMMAND_FAILED](event: CommandFailedEvent): void;
140-
[Connection.CLUSTER_TIME_RECEIVED](clusterTime: Document): void;
141-
[Connection.CLOSE](): void;
142-
[Connection.MESSAGE](message: any): void;
147+
commandStarted(event: CommandStartedEvent): void;
148+
commandSucceeded(event: CommandSucceededEvent): void;
149+
commandFailed(event: CommandFailedEvent): void;
150+
clusterTimeReceived(clusterTime: Document): void;
151+
close(): void;
152+
message(message: any): void;
143153
};
144154

145-
/** @public */
155+
/** @internal */
146156
export class Connection extends TypedEventEmitter<ConnectionEvents> {
147157
id: number | '<monitor>';
148158
address: string;

src/cmap/connection_pool.ts

+22-12
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,23 @@ import {
1919
} from './connection_pool_events';
2020
import { CancellationToken, TypedEventEmitter } from '../mongo_types';
2121

22+
/** @internal */
2223
const kLogger = Symbol('logger');
24+
/** @internal */
2325
const kConnections = Symbol('connections');
26+
/** @internal */
2427
const kPermits = Symbol('permits');
28+
/** @internal */
2529
const kMinPoolSizeTimer = Symbol('minPoolSizeTimer');
30+
/** @internal */
2631
const kGeneration = Symbol('generation');
32+
/** @internal */
2733
const kConnectionCounter = Symbol('connectionCounter');
34+
/** @internal */
2835
const kCancellationToken = Symbol('cancellationToken');
36+
/** @internal */
2937
const kWaitQueue = Symbol('waitQueue');
38+
/** @internal */
3039
const kCancelled = Symbol('cancelled');
3140

3241
/** @public */
@@ -55,21 +64,21 @@ export interface CloseOptions {
5564

5665
/** @public */
5766
export type ConnectionPoolEvents = {
58-
[ConnectionPool.CONNECTION_POOL_CREATED](event: ConnectionPoolCreatedEvent): void;
59-
[ConnectionPool.CONNECTION_POOL_CLOSED](event: ConnectionPoolClosedEvent): void;
60-
[ConnectionPool.CONNECTION_POOL_CLEARED](event: ConnectionPoolClearedEvent): void;
61-
[ConnectionPool.CONNECTION_CREATED](event: ConnectionCreatedEvent): void;
62-
[ConnectionPool.CONNECTION_READY](event: ConnectionReadyEvent): void;
63-
[ConnectionPool.CONNECTION_CLOSED](event: ConnectionClosedEvent): void;
64-
[ConnectionPool.CONNECTION_CHECK_OUT_STARTED](event: ConnectionCheckOutStartedEvent): void;
65-
[ConnectionPool.CONNECTION_CHECK_OUT_FAILED](event: ConnectionCheckOutFailedEvent): void;
66-
[ConnectionPool.CONNECTION_CHECKED_OUT](event: ConnectionCheckedOutEvent): void;
67-
[ConnectionPool.CONNECTION_CHECKED_IN](event: ConnectionCheckedInEvent): void;
67+
connectionPoolCreated(event: ConnectionPoolCreatedEvent): void;
68+
connectionPoolClosed(event: ConnectionPoolClosedEvent): void;
69+
connectionPoolCleared(event: ConnectionPoolClearedEvent): void;
70+
connectionCreated(event: ConnectionCreatedEvent): void;
71+
connectionReady(event: ConnectionReadyEvent): void;
72+
connectionClosed(event: ConnectionClosedEvent): void;
73+
connectionCheckOutStarted(event: ConnectionCheckOutStartedEvent): void;
74+
connectionCheckOutFailed(event: ConnectionCheckOutFailedEvent): void;
75+
connectionCheckedOut(event: ConnectionCheckedOutEvent): void;
76+
connectionCheckedIn(event: ConnectionCheckedInEvent): void;
6877
} & Omit<ConnectionEvents, 'close' | 'message'>;
6978

7079
/**
7180
* A pool of connections which dynamically resizes, and emit events related to pool activity
72-
* @public
81+
* @internal
7382
*/
7483
export class ConnectionPool extends TypedEventEmitter<ConnectionPoolEvents> {
7584
closed: boolean;
@@ -148,6 +157,7 @@ export class ConnectionPool extends TypedEventEmitter<ConnectionPoolEvents> {
148157
*/
149158
static readonly CONNECTION_CHECKED_IN = 'connectionCheckedIn' as const;
150159

160+
/** @internal */
151161
constructor(options: ConnectionPoolOptions) {
152162
super();
153163

@@ -548,7 +558,7 @@ export const CMAP_EVENTS = [
548558

549559
/**
550560
* A callback provided to `withConnection`
551-
* @public
561+
* @internal
552562
*
553563
* @param error - An error instance representing the error during the execution.
554564
* @param connection - The managed connection which was checked out of the pool.

src/cmap/connection_pool_events.ts

+11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export class ConnectionPoolMonitoringEvent {
1313
/** The address (host/port pair) of the pool */
1414
address: string;
1515

16+
/** @internal */
1617
constructor(pool: ConnectionPool) {
1718
this.time = new Date();
1819
this.address = pool.address;
@@ -28,6 +29,7 @@ export class ConnectionPoolCreatedEvent extends ConnectionPoolMonitoringEvent {
2829
/** The options used to create this connection pool */
2930
options?: ConnectionPoolOptions;
3031

32+
/** @internal */
3133
constructor(pool: ConnectionPool) {
3234
super(pool);
3335
this.options = pool.options;
@@ -40,6 +42,7 @@ export class ConnectionPoolCreatedEvent extends ConnectionPoolMonitoringEvent {
4042
* @category Event
4143
*/
4244
export class ConnectionPoolClosedEvent extends ConnectionPoolMonitoringEvent {
45+
/** @internal */
4346
constructor(pool: ConnectionPool) {
4447
super(pool);
4548
}
@@ -54,6 +57,7 @@ export class ConnectionCreatedEvent extends ConnectionPoolMonitoringEvent {
5457
/** A monotonically increasing, per-pool id for the newly created connection */
5558
connectionId: number | '<monitor>';
5659

60+
/** @internal */
5761
constructor(pool: ConnectionPool, connection: Connection) {
5862
super(pool);
5963
this.connectionId = connection.id;
@@ -69,6 +73,7 @@ export class ConnectionReadyEvent extends ConnectionPoolMonitoringEvent {
6973
/** The id of the connection */
7074
connectionId: number | '<monitor>';
7175

76+
/** @internal */
7277
constructor(pool: ConnectionPool, connection: Connection) {
7378
super(pool);
7479
this.connectionId = connection.id;
@@ -86,6 +91,7 @@ export class ConnectionClosedEvent extends ConnectionPoolMonitoringEvent {
8691
/** The reason the connection was closed */
8792
reason: string;
8893

94+
/** @internal */
8995
constructor(pool: ConnectionPool, connection: Connection, reason: string) {
9096
super(pool);
9197
this.connectionId = connection.id;
@@ -99,6 +105,7 @@ export class ConnectionClosedEvent extends ConnectionPoolMonitoringEvent {
99105
* @category Event
100106
*/
101107
export class ConnectionCheckOutStartedEvent extends ConnectionPoolMonitoringEvent {
108+
/** @internal */
102109
constructor(pool: ConnectionPool) {
103110
super(pool);
104111
}
@@ -113,6 +120,7 @@ export class ConnectionCheckOutFailedEvent extends ConnectionPoolMonitoringEvent
113120
/** The reason the attempt to check out failed */
114121
reason: AnyError | string;
115122

123+
/** @internal */
116124
constructor(pool: ConnectionPool, reason: AnyError | string) {
117125
super(pool);
118126
this.reason = reason;
@@ -128,6 +136,7 @@ export class ConnectionCheckedOutEvent extends ConnectionPoolMonitoringEvent {
128136
/** The id of the connection */
129137
connectionId: number | '<monitor>';
130138

139+
/** @internal */
131140
constructor(pool: ConnectionPool, connection: Connection) {
132141
super(pool);
133142
this.connectionId = connection.id;
@@ -143,6 +152,7 @@ export class ConnectionCheckedInEvent extends ConnectionPoolMonitoringEvent {
143152
/** The id of the connection */
144153
connectionId: number | '<monitor>';
145154

155+
/** @internal */
146156
constructor(pool: ConnectionPool, connection: Connection) {
147157
super(pool);
148158
this.connectionId = connection.id;
@@ -155,6 +165,7 @@ export class ConnectionCheckedInEvent extends ConnectionPoolMonitoringEvent {
155165
* @category Event
156166
*/
157167
export class ConnectionPoolClearedEvent extends ConnectionPoolMonitoringEvent {
168+
/** @internal */
158169
constructor(pool: ConnectionPool) {
159170
super(pool);
160171
}

src/cmap/message_stream.ts

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const MESSAGE_HEADER_SIZE = 16;
1717
const COMPRESSION_DETAILS_SIZE = 9; // originalOpcode + uncompressedSize, compressorID
1818

1919
const kDefaultMaxBsonMessageSize = 1024 * 1024 * 16 * 4;
20+
/** @internal */
2021
const kBuffer = Symbol('buffer');
2122

2223
/** @internal */

src/cursor/abstract_cursor.ts

+14
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,27 @@ import type { ExecutionResult } from '../operations/execute_operation';
1010
import { ReadConcern, ReadConcernLike } from '../read_concern';
1111
import { TODO_NODE_3286, TypedEventEmitter } from '../mongo_types';
1212

13+
/** @internal */
1314
const kId = Symbol('id');
15+
/** @internal */
1416
const kDocuments = Symbol('documents');
17+
/** @internal */
1518
const kServer = Symbol('server');
19+
/** @internal */
1620
const kNamespace = Symbol('namespace');
21+
/** @internal */
1722
const kTopology = Symbol('topology');
23+
/** @internal */
1824
const kSession = Symbol('session');
25+
/** @internal */
1926
const kOptions = Symbol('options');
27+
/** @internal */
2028
const kTransform = Symbol('transform');
29+
/** @internal */
2130
const kInitialized = Symbol('initialized');
31+
/** @internal */
2232
const kClosed = Symbol('closed');
33+
/** @internal */
2334
const kKilled = Symbol('killed');
2435

2536
/** @public */
@@ -108,6 +119,7 @@ export abstract class AbstractCursor<
108119
/** @event */
109120
static readonly CLOSE = 'close' as const;
110121

122+
/** @internal */
111123
constructor(
112124
topology: Topology,
113125
namespace: MongoDBNamespace,
@@ -155,10 +167,12 @@ export abstract class AbstractCursor<
155167
return this[kId];
156168
}
157169

170+
/** @internal */
158171
get topology(): Topology {
159172
return this[kTopology];
160173
}
161174

175+
/** @internal */
162176
get server(): Server | undefined {
163177
return this[kServer];
164178
}

src/cursor/aggregation_cursor.ts

+3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ import type { ExplainVerbosityLike } from '../explain';
1414
/** @public */
1515
export interface AggregationCursorOptions extends AbstractCursorOptions, AggregateOptions {}
1616

17+
/** @internal */
1718
const kParent = Symbol('parent');
19+
/** @internal */
1820
const kPipeline = Symbol('pipeline');
21+
/** @internal */
1922
const kOptions = Symbol('options');
2023

2124
/**

src/cursor/find_cursor.ts

+4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ import { formatSort, Sort, SortDirection } from '../sort';
1313
import type { Callback, MongoDBNamespace } from '../utils';
1414
import { AbstractCursor, assertUninitialized } from './abstract_cursor';
1515

16+
/** @internal */
1617
const kFilter = Symbol('filter');
18+
/** @internal */
1719
const kNumReturned = Symbol('numReturned');
20+
/** @internal */
1821
const kBuiltOptions = Symbol('builtOptions');
1922

2023
/** @public Flags allowed for cursor */
@@ -36,6 +39,7 @@ export class FindCursor<TSchema = Document> extends AbstractCursor<TSchema> {
3639
/** @internal */
3740
[kBuiltOptions]: FindOptions;
3841

42+
/** @internal */
3943
constructor(
4044
topology: Topology,
4145
namespace: MongoDBNamespace,

src/encrypter.ts

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { MONGO_CLIENT_EVENTS } from './operations/connect';
88

99
let AutoEncrypterClass: AutoEncrypter;
1010

11+
/** @internal */
1112
const kInternalClient = Symbol('internalClient');
1213

1314
/** @internal */

0 commit comments

Comments
 (0)