Skip to content

Commit

Permalink
fix: add all accessor tags to exported symbols
Browse files Browse the repository at this point in the history
The mongodb.d.ts now only includes the public API.

NODE-2783
  • Loading branch information
nbbeeken committed Dec 1, 2020
1 parent 98ae02c commit ffe74e7
Show file tree
Hide file tree
Showing 25 changed files with 211 additions and 121 deletions.
17 changes: 3 additions & 14 deletions api-extractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
},
"dtsRollup": {
"enabled": true,
"untrimmedFilePath": "<projectFolder>/<unscopedPackageName>.d.ts"
"untrimmedFilePath": "<projectFolder>/<unscopedPackageName>-internal.d.ts",
"publicTrimmedFilePath": "<projectFolder>/<unscopedPackageName>.d.ts"
},
"tsdocMetadata": {
"enabled": false
Expand All @@ -23,23 +24,11 @@
},
"extractorMessageReporting": {
"default": {
"logLevel": "warning"
"logLevel": "error"
},
"ae-internal-missing-underscore": {
"logLevel": "none",
"addToApiReportFile": false
},
"ae-missing-release-tag": {
"logLevel": "error",
"addToApiReportFile": false
},
"ae-incompatible-release-tags": {
"logLevel": "none",
"addToApiReportFile": false
},
"ae-unresolved-link": {
"addToApiReportFile": false,
"logLevel": "none"
}
},
"tsdocMessageReporting": {
Expand Down
106 changes: 58 additions & 48 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.1",
"@microsoft/api-extractor": "^7.12.0",
"@microsoft/tsdoc-config": "^0.13.6",
"@microsoft/tsdoc-config": "^0.13.7",
"@types/aws4": "^1.5.1",
"@types/bl": "^2.1.0",
"@types/bson": "^4.0.2",
Expand All @@ -51,10 +51,10 @@
"coveralls": "^3.0.11",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jsdoc": "^30.3.1",
"eslint-plugin-jsdoc": "^30.7.8",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-tsdoc": "^0.2.6",
"eslint-plugin-tsdoc": "^0.2.8",
"jsdoc": "^3.6.4",
"lodash.camelcase": "^4.3.0",
"madge": "^3.9.0",
Expand All @@ -74,7 +74,7 @@
"through2": "^3.0.1",
"ts-node": "^9.0.0",
"typedoc": "^0.19.2",
"typedoc-plugin-pages": "^1.0.1",
"typedoc-plugin-pages": "^1.1.0",
"typescript": "^4.0.5",
"typescript-cached-transpile": "^0.0.6",
"worker-farm": "^1.5.0",
Expand Down
8 changes: 4 additions & 4 deletions src/bulk/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export type AnyBulkWriteOperation =
| { deleteOne: DeleteOneModel }
| { deleteMany: DeleteManyModel };

/** @internal */
/** @public */
export interface BulkResult {
ok: number;
writeErrors: WriteError[];
Expand Down Expand Up @@ -348,7 +348,7 @@ export class WriteConcernError {
}
}

/** @internal */
/** @public */
export interface BulkWriteOperationError {
index: number;
code: number;
Expand Down Expand Up @@ -1301,7 +1301,7 @@ function shouldForceServerObjectId(bulkOperation: BulkOperationBase): boolean {
return false;
}

/** @internal */
/** @public */
export interface UpdateStatement {
/** The query that matches documents to update. */
q: Document;
Expand Down Expand Up @@ -1368,7 +1368,7 @@ function isUpdateStatement(model: Document): model is UpdateStatement {
return 'q' in model;
}

/** @internal */
/** @public */
export interface DeleteStatement {
/** The query that matches documents to delete. */
q: Document;
Expand Down
7 changes: 5 additions & 2 deletions src/change_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export interface ResumeOptions {
export type ResumeToken = unknown;

/**
* Represents a specific point in time on a server. Can be retrieved by using {@link Db.command}
* Represents a specific point in time on a server. Can be retrieved by using {@link Db#command}
* @public
* @remarks
* See {@link https://docs.mongodb.com/manual/reference/method/db.runCommand/#response| Run Command Response}
Expand Down Expand Up @@ -180,6 +180,7 @@ export class ChangeStream extends EventEmitter {
parent: MongoClient | Db | Collection;
namespace: MongoDBNamespace;
type: symbol;
/** @internal */
cursor?: ChangeStreamCursor;
streamOptions?: CursorStreamOptions;
[kResumeQueue]: Denque;
Expand All @@ -206,6 +207,8 @@ export class ChangeStream extends EventEmitter {
static readonly RESUME_TOKEN_CHANGED = 'resumeTokenChanged' as const;

/**
* @internal
*
* @param parent - The parent object that created this change stream
* @param pipeline - An array of {@link https://docs.mongodb.com/manual/reference/operator/aggregation-pipeline/|aggregation pipeline stages} through which to pass change stream documents
*/
Expand Down Expand Up @@ -332,7 +335,7 @@ export class ChangeStream extends EventEmitter {
}
}

/** @public */
/** @internal */
export interface ChangeStreamCursorOptions extends AbstractCursorOptions {
startAtOperationTime?: OperationTime;
resumeAfter?: ResumeToken;
Expand Down
27 changes: 24 additions & 3 deletions src/cmap/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,23 @@ export class Connection extends EventEmitter {
closed: boolean;
destroyed: boolean;
lastIsMasterMS?: number;
/** @internal */
[kDescription]: StreamDescription;
/** @internal */
[kGeneration]: number;
/** @internal */
[kLastUseTime]: number;
/** @internal */
[kAutoEncrypter]?: unknown;
/** @internal */
[kQueue]: Map<number, OperationDescription>;
/** @internal */
[kMessageStream]: MessageStream;
/** @internal */
[kStream]: Stream;
/** @internal */
[kIsMaster]: Document;
/** @internal */
[kClusterTime]: Document;

/** @event */
Expand Down Expand Up @@ -235,7 +244,9 @@ export class Connection extends EventEmitter {
}

// Wire protocol methods
/** @internal */
command(ns: string, cmd: Document, callback: Callback): void;
/** @internal */
command(ns: string, cmd: Document, options: CommandOptions, callback: Callback): void;
command(
ns: string,
Expand All @@ -246,34 +257,44 @@ export class Connection extends EventEmitter {
wp.command(makeServerTrampoline(this), ns, cmd, options as CommandOptions, callback);
}

/** @internal */
query(ns: string, cmd: Document, options: FindOptions, callback: Callback): void {
wp.query(makeServerTrampoline(this), ns, cmd, options, callback);
}

/** @internal */
getMore(ns: string, cursorId: Long, options: GetMoreOptions, callback: Callback<Document>): void {
wp.getMore(makeServerTrampoline(this), ns, cursorId, options, callback);
}

/** @internal */
killCursors(ns: string, cursorIds: Long[], options: CommandOptions, callback: Callback): void {
wp.killCursors(makeServerTrampoline(this), ns, cursorIds, options, callback);
}

/** @internal */
insert(ns: string, ops: Document[], options: InsertOptions, callback: Callback): void {
wp.insert(makeServerTrampoline(this), ns, ops, options, callback);
}

/** @internal */
update(ns: string, ops: Document[], options: UpdateOptions, callback: Callback): void {
wp.update(makeServerTrampoline(this), ns, ops, options, callback);
}

/** @internal */
remove(ns: string, ops: Document[], options: RemoveOptions, callback: Callback): void {
wp.remove(makeServerTrampoline(this), ns, ops, options, callback);
}
}

/// This lets us emulate a legacy `Server` instance so we can work with the existing wire
/// protocol methods. Eventually, the operation executor will return a `Connection` to execute
/// against.
/**
* This lets us emulate a legacy `Server` instance so we can work with the existing wire
* protocol methods. Eventually, the operation executor will return a `Connection` to execute
* against.
* @internal
* @deprecated Remove (NODE-2745)
*/
function makeServerTrampoline(connection: Connection): Server {
return ({
description: connection.description,
Expand Down
Loading

0 comments on commit ffe74e7

Please sign in to comment.