Skip to content

Commit ef75502

Browse files
author
Thomas Reggi
authored
chore: fix symbols & public / internal one-liners (#2602)
Correct warnings and errors raised by api-extractor related to access modifiers which have been incorrectly specified on a single line. NODE-2783
1 parent 7d023a6 commit ef75502

File tree

14 files changed

+81
-21
lines changed

14 files changed

+81
-21
lines changed

src/admin.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ export class Admin {
5555
/** @internal */
5656
s: AdminPrivate;
5757

58-
/** @internal Create a new Admin instance (INTERNAL TYPE, do not instantiate directly) */
58+
/**
59+
* Create a new Admin instance
60+
* @internal
61+
*/
5962
constructor(db: Db) {
6063
this.s = { db };
6164
}

src/bson.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ export interface Document {
3232

3333
import type { SerializeOptions } from 'bson';
3434

35-
/** @public BSON Serialization options. TODO: Remove me when types from BSON are updated */
35+
// TODO: Remove me when types from BSON are updated
36+
/**
37+
* BSON Serialization options.
38+
* @public
39+
*/
3640
export interface BSONSerializeOptions extends SerializeOptions {
3741
/** Return document results as raw BSON buffers */
3842
fieldsAsRaw?: { [key: string]: boolean };

src/change_stream.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ interface UpdateDescription {
158158
removedFields: string[];
159159
}
160160

161+
/** @internal */
161162
export class ChangeStreamStream extends CursorStream {
162163
constructor(cursor: ChangeStreamCursor) {
163164
super(cursor);
@@ -465,7 +466,10 @@ export class ChangeStreamCursor extends Cursor<AggregateOperation, ChangeStreamC
465466
}
466467
}
467468

468-
/** @internal Create a new change stream cursor based on self's configuration */
469+
/**
470+
* Create a new change stream cursor based on self's configuration
471+
* @internal
472+
*/
469473
function createChangeStreamCursor(
470474
self: ChangeStream,
471475
options: ChangeStreamOptions

src/cmap/connection_pool.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ export interface CloseOptions {
127127
force?: boolean;
128128
}
129129

130-
/** @public NOTE: to be removed as part of NODE-2745 */
130+
// NOTE: to be removed as part of NODE-2745
131+
/** @public */
131132
export interface ConnectionPool {
132133
isConnected(): boolean;
133134
write(
@@ -137,7 +138,10 @@ export interface ConnectionPool {
137138
): void;
138139
}
139140

140-
/** @public A pool of connections which dynamically resizes, and emit events related to pool activity */
141+
/**
142+
* A pool of connections which dynamically resizes, and emit events related to pool activity
143+
* @public
144+
*/
141145
export class ConnectionPool extends EventEmitter {
142146
closed: boolean;
143147
options: Readonly<ConnectionPoolOptions>;

src/collection.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ export class Collection implements OperationParent {
166166
/** @internal */
167167
s: CollectionPrivate;
168168

169-
/** @internal Create a new Collection instance (INTERNAL TYPE, do not instantiate directly) */
169+
/**
170+
* Create a new Collection instance
171+
* @internal
172+
*/
170173
constructor(db: Db, name: string, options?: CollectionOptions) {
171174
checkCollectionName(name);
172175
emitDeprecatedOptionWarning(options, ['promiseLibrary']);

src/cursor/cursor.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ import type { ClientSession } from '../sessions';
2222

2323
const kCursor = Symbol('cursor');
2424

25-
/** @public Flags allowed for cursor */
25+
/**
26+
* Flags allowed for cursor
27+
* @public
28+
*/
2629
export const FLAGS = [
2730
'tailable',
2831
'oplogReplay',
@@ -47,7 +50,7 @@ export interface DocumentTransforms {
4750
}
4851

4952
/** @internal */
50-
interface CursorPrivate {
53+
export interface CursorPrivate {
5154
/** Transforms functions */
5255
transforms?: DocumentTransforms;
5356
numberOfRetries: number;
@@ -60,7 +63,10 @@ interface CursorPrivate {
6063
readConcern?: ReadConcern;
6164
}
6265

63-
/** @public Possible states for a cursor */
66+
/**
67+
* Possible states for a cursor
68+
* @public
69+
*/
6470
export enum CursorState {
6571
INIT = 0,
6672
OPEN = 1,
@@ -1647,7 +1653,10 @@ export function each(cursor: Cursor, callback: EachCallback): void {
16471653
}
16481654
}
16491655

1650-
/** @internal Trampoline emptying the number of retrieved items without incurring a nextTick operation */
1656+
/**
1657+
* Trampoline emptying the number of retrieved items without incurring a nextTick operation
1658+
* @internal
1659+
*/
16511660
function loop(cursor: Cursor, callback: Callback) {
16521661
// No more items we are done
16531662
if (cursor.bufferedCount() === 0) return;

src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export type {
9999
} from './bulk/common';
100100
export type {
101101
ChangeStream,
102+
ChangeStreamStream,
102103
ChangeStreamOptions,
103104
ChangeStreamCursor,
104105
ResumeToken,
@@ -150,12 +151,14 @@ export type {
150151
CursorCloseOptions,
151152
DocumentTransforms,
152153
CursorStreamOptions,
154+
CursorStream,
153155
CursorState,
154156
CursorOptions,
155157
FIELDS as CURSOR_FIELDS,
156158
FLAGS as CURSOR_FLAGS,
157159
CursorFlag,
158-
EachCallback
160+
EachCallback,
161+
CursorPrivate
159162
} from './cursor/cursor';
160163
export type { DbPrivate, DbOptions } from './db';
161164
export type { AutoEncryptionOptions, AutoEncryptionLoggerLevels, AutoEncrypter } from './deps';

src/operations/distinct.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import type { Collection } from '../collection';
88
/** @public */
99
export type DistinctOptions = CommandOperationOptions;
1010

11-
/** @internal Return a list of distinct values for the given key across a collection. */
11+
/**
12+
* Return a list of distinct values for the given key across a collection.
13+
* @internal
14+
*/
1215
export class DistinctOperation extends CommandOperation<DistinctOptions, Document[]> {
1316
collection: Collection;
1417
/** Field of the document to find distinct values for. */

src/operations/map_reduce.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ interface MapReduceStats {
6363
timing?: number;
6464
}
6565

66-
/** @internal Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection. */
66+
/**
67+
* Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection.
68+
* @internal
69+
*/
6770
export class MapReduceOperation extends CommandOperation<MapReduceOptions, Document | Document[]> {
6871
collection: Collection;
6972
/** The mapping function. */

src/operations/stats.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ export interface CollStatsOptions extends CommandOperationOptions {
1111
scale?: number;
1212
}
1313

14-
/** @internal Get all the collection statistics. */
14+
/**
15+
* Get all the collection statistics.
16+
* @internal
17+
*/
1518
export class CollStatsOperation extends CommandOperation<CollStatsOptions, Document> {
1619
collectionName: string;
1720

src/sdam/common.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export const STATE_CLOSED = 'closed';
88
export const STATE_CONNECTING = 'connecting';
99
export const STATE_CONNECTED = 'connected';
1010

11-
/** @public An enumeration of topology types we know about */
11+
/**
12+
* An enumeration of topology types we know about
13+
* @public
14+
*/
1215
export enum TopologyType {
1316
Single = 'Single',
1417
ReplicaSetNoPrimary = 'ReplicaSetNoPrimary',
@@ -17,7 +20,10 @@ export enum TopologyType {
1720
Unknown = 'Unknown'
1821
}
1922

20-
/** @public An enumeration of server types we know about */
23+
/**
24+
* An enumeration of server types we know about
25+
* @public
26+
*/
2127
export enum ServerType {
2228
Standalone = 'Standalone',
2329
Mongos = 'Mongos',

src/sdam/topology_description.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ export interface TopologyDescriptionOptions {
1616
localThresholdMS?: number;
1717
}
1818

19-
/** @public Representation of a deployment of servers */
19+
/**
20+
* Representation of a deployment of servers
21+
* @public
22+
*/
2023
export class TopologyDescription {
2124
type: TopologyType;
2225
setName?: string;

src/transactions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ const stateMachine = {
4242
]
4343
};
4444

45-
/** @public Configuration options for a transaction. */
45+
/**
46+
* Configuration options for a transaction.
47+
* @public
48+
*/
4649
export interface TransactionOptions extends CommandOperationOptions {
4750
/** A default read concern for commands in this transaction */
4851
readConcern?: ReadConcern;

src/utils.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ import { resolve } from 'path';
1717
import type { Document } from './bson';
1818
import type { IndexSpecification, IndexDirection } from './operations/indexes';
1919

20-
/** @public MongoDB Driver style callback */
20+
/**
21+
* MongoDB Driver style callback
22+
* @public
23+
*/
2124
export type Callback<T = any> = (error?: AnyError, result?: T) => void;
2225
/** @public */
2326
export type CallbackWithType<E = AnyError, T0 = any> = (error?: E, result?: T0) => void;
@@ -668,7 +671,10 @@ export function collectionNamespace(ns: string): string {
668671
return ns.split('.').slice(1).join('.');
669672
}
670673

671-
/** @internal Synchronously Generate a UUIDv4 */
674+
/**
675+
* Synchronously Generate a UUIDv4
676+
* @internal
677+
*/
672678
export function uuidV4(): Buffer {
673679
const result = crypto.randomBytes(16);
674680
result[6] = (result[6] & 0x0f) | 0x40;
@@ -978,7 +984,10 @@ export interface InterruptableAsyncIntervalOptions {
978984
/** Whether the method should be called immediately when the interval is started */
979985
immediate: boolean;
980986

981-
/* @internal only used for testing unreliable timer environments */
987+
/**
988+
* Only used for testing unreliable timer environments
989+
* @internal
990+
*/
982991
clock: () => number;
983992
}
984993

0 commit comments

Comments
 (0)