Skip to content

Commit 55534c9

Browse files
authored
fix: add all accessor tags to exported symbols (#2649)
Correct all access modifiers to correctly inherit internal or public specifiers. Update types rollup config for mongodb.d.ts to only include the public API. NODE-2783
1 parent 93ef9e8 commit 55534c9

25 files changed

+255
-134
lines changed

api-extractor.json

+4-11
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
},
1010
"dtsRollup": {
1111
"enabled": true,
12-
"untrimmedFilePath": "<projectFolder>/<unscopedPackageName>.d.ts"
12+
"untrimmedFilePath": "",
13+
"publicTrimmedFilePath": "<projectFolder>/<unscopedPackageName>.d.ts"
1314
},
1415
"tsdocMetadata": {
1516
"enabled": false
@@ -23,23 +24,15 @@
2324
},
2425
"extractorMessageReporting": {
2526
"default": {
26-
"logLevel": "warning"
27+
"logLevel": "error"
2728
},
2829
"ae-internal-missing-underscore": {
2930
"logLevel": "none",
3031
"addToApiReportFile": false
3132
},
32-
"ae-missing-release-tag": {
33+
"ae-forgotten-export": {
3334
"logLevel": "error",
3435
"addToApiReportFile": false
35-
},
36-
"ae-incompatible-release-tags": {
37-
"logLevel": "none",
38-
"addToApiReportFile": false
39-
},
40-
"ae-unresolved-link": {
41-
"addToApiReportFile": false,
42-
"logLevel": "none"
4336
}
4437
},
4538
"tsdocMessageReporting": {

package-lock.json

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

package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"devDependencies": {
3535
"@istanbuljs/nyc-config-typescript": "^1.0.1",
3636
"@microsoft/api-extractor": "^7.12.0",
37-
"@microsoft/tsdoc-config": "^0.13.6",
37+
"@microsoft/tsdoc-config": "^0.13.7",
3838
"@types/aws4": "^1.5.1",
3939
"@types/bl": "^2.1.0",
4040
"@types/bson": "^4.0.2",
@@ -51,10 +51,10 @@
5151
"coveralls": "^3.0.11",
5252
"eslint": "^6.8.0",
5353
"eslint-config-prettier": "^6.11.0",
54-
"eslint-plugin-jsdoc": "^30.3.1",
54+
"eslint-plugin-jsdoc": "^30.7.8",
5555
"eslint-plugin-prettier": "^3.1.3",
5656
"eslint-plugin-promise": "^4.2.1",
57-
"eslint-plugin-tsdoc": "^0.2.6",
57+
"eslint-plugin-tsdoc": "^0.2.8",
5858
"jsdoc": "^3.6.4",
5959
"lodash.camelcase": "^4.3.0",
6060
"madge": "^3.9.0",
@@ -74,7 +74,7 @@
7474
"through2": "^3.0.1",
7575
"ts-node": "^9.0.0",
7676
"typedoc": "^0.19.2",
77-
"typedoc-plugin-pages": "^1.0.1",
77+
"typedoc-plugin-pages": "^1.1.0",
7878
"typescript": "^4.0.5",
7979
"typescript-cached-transpile": "^0.0.6",
8080
"worker-farm": "^1.5.0",
@@ -91,11 +91,12 @@
9191
"scripts": {
9292
"build:evergreen": "node .evergreen/generate_evergreen_tasks.js",
9393
"build:ts": "rimraf lib && tsc",
94-
"build:dts": "npm run build:ts && api-extractor run --typescript-compiler-folder node_modules/typescript --local && rimraf 'lib/**/*.d.ts*'",
94+
"build:dts": "npm run build:ts && api-extractor run && rimraf 'lib/**/*.d.ts*'",
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 build:dts && npm run check:eslint",
99+
"check:eslint": "eslint -v && eslint --max-warnings=0 --ext '.js,.ts' src test",
99100
"check:test": "mocha --recursive test/functional test/unit",
100101
"check:ts": "tsc -v && tsc --noEmit",
101102
"check:atlas": "mocha --config \"test/manual/mocharc.json\" test/manual/atlas_connectivity.test.js",

src/bulk/common.ts

+27-16
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ import type { Hint } from '../operations/operation';
2525
// Error codes
2626
const WRITE_CONCERN_ERROR = 64;
2727

28-
export enum BatchType {
29-
INSERT = 1,
30-
UPDATE = 2,
31-
REMOVE = 3
32-
}
28+
/** @public */
29+
export const BatchType = {
30+
INSERT: 1,
31+
UPDATE: 2,
32+
REMOVE: 3
33+
} as const;
34+
35+
/** @public */
36+
export type BatchTypeId = typeof BatchType[keyof typeof BatchType];
3337

3438
/** @public */
3539
export interface InsertOneModel {
@@ -115,7 +119,7 @@ export type AnyBulkWriteOperation =
115119
| { deleteOne: DeleteOneModel }
116120
| { deleteMany: DeleteManyModel };
117121

118-
/** @internal */
122+
/** @public */
119123
export interface BulkResult {
120124
ok: number;
121125
writeErrors: WriteError[];
@@ -133,17 +137,19 @@ export interface BulkResult {
133137
/**
134138
* Keeps the state of a unordered batch so we can rewrite the results
135139
* correctly after command execution
140+
*
141+
* @internal
136142
*/
137143
export class Batch {
138144
originalZeroIndex: number;
139145
currentIndex: number;
140146
originalIndexes: number[];
141-
batchType: BatchType;
147+
batchType: BatchTypeId;
142148
operations: Document[];
143149
size: number;
144150
sizeBytes: number;
145151

146-
constructor(batchType: BatchType, originalZeroIndex: number) {
152+
constructor(batchType: BatchTypeId, originalZeroIndex: number) {
147153
this.originalZeroIndex = originalZeroIndex;
148154
this.currentIndex = 0;
149155
this.originalIndexes = [];
@@ -348,7 +354,7 @@ export class WriteConcernError {
348354
}
349355
}
350356

351-
/** @internal */
357+
/** @public */
352358
export interface BulkWriteOperationError {
353359
index: number;
354360
code: number;
@@ -704,8 +710,10 @@ export class MongoBulkWriteError extends MongoError {
704710
/**
705711
* A builder object that is returned from {@link BulkOperationBase#find}.
706712
* Is used to build a write operation that involves a query filter.
713+
*
714+
* @public
707715
*/
708-
class FindOperators {
716+
export class FindOperators {
709717
bulkOperation: BulkOperationBase;
710718

711719
/**
@@ -855,16 +863,17 @@ class FindOperators {
855863
return this.bulkOperation.addToOperationsList(BatchType.REMOVE, document);
856864
}
857865

858-
removeOne() {
866+
removeOne(): BulkOperationBase {
859867
return this.deleteOne();
860868
}
861869

862-
remove() {
870+
remove(): BulkOperationBase {
863871
return this.delete();
864872
}
865873
}
866874

867-
interface BulkOperationPrivate {
875+
/** @internal */
876+
export interface BulkOperationPrivate {
868877
bulkResult: BulkResult;
869878
currentBatch?: Batch;
870879
currentIndex: number;
@@ -916,8 +925,10 @@ export interface BulkWriteOptions extends CommandOperationOptions {
916925
forceServerObjectId?: boolean;
917926
}
918927

928+
/** @public */
919929
export abstract class BulkOperationBase {
920930
isOrdered: boolean;
931+
/** @internal */
921932
s: BulkOperationPrivate;
922933
operationId?: number;
923934

@@ -1263,7 +1274,7 @@ export abstract class BulkOperationBase {
12631274
}
12641275

12651276
abstract addToOperationsList(
1266-
batchType: BatchType,
1277+
batchType: BatchTypeId,
12671278
document: Document | UpdateStatement | DeleteStatement
12681279
): this;
12691280
}
@@ -1301,7 +1312,7 @@ function shouldForceServerObjectId(bulkOperation: BulkOperationBase): boolean {
13011312
return false;
13021313
}
13031314

1304-
/** @internal */
1315+
/** @public */
13051316
export interface UpdateStatement {
13061317
/** The query that matches documents to update. */
13071318
q: Document;
@@ -1368,7 +1379,7 @@ function isUpdateStatement(model: Document): model is UpdateStatement {
13681379
return 'q' in model;
13691380
}
13701381

1371-
/** @internal */
1382+
/** @public */
13721383
export interface DeleteStatement {
13731384
/** The query that matches documents to delete. */
13741385
q: Document;

0 commit comments

Comments
 (0)