Skip to content

Commit

Permalink
fix: add all accessor tags to exported symbols (#2649)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nbbeeken authored Dec 3, 2020
1 parent 93ef9e8 commit 55534c9
Show file tree
Hide file tree
Showing 25 changed files with 255 additions and 134 deletions.
15 changes: 4 additions & 11 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": "",
"publicTrimmedFilePath": "<projectFolder>/<unscopedPackageName>.d.ts"
},
"tsdocMetadata": {
"enabled": false
Expand All @@ -23,23 +24,15 @@
},
"extractorMessageReporting": {
"default": {
"logLevel": "warning"
"logLevel": "error"
},
"ae-internal-missing-underscore": {
"logLevel": "none",
"addToApiReportFile": false
},
"ae-missing-release-tag": {
"ae-forgotten-export": {
"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.

13 changes: 7 additions & 6 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 All @@ -91,11 +91,12 @@
"scripts": {
"build:evergreen": "node .evergreen/generate_evergreen_tasks.js",
"build:ts": "rimraf lib && tsc",
"build:dts": "npm run build:ts && api-extractor run --typescript-compiler-folder node_modules/typescript --local && rimraf 'lib/**/*.d.ts*'",
"build:dts": "npm run build:ts && api-extractor run && rimraf 'lib/**/*.d.ts*'",
"build:docs": "npm run build:dts && typedoc",
"check:bench": "node test/benchmarks/driverBench",
"check:coverage": "nyc npm run check:test",
"check:lint": "npm run check:ts && eslint -v && eslint --max-warnings=0 --ext '.js,.ts' src test",
"check:lint": "npm run build:dts && npm run check:eslint",
"check:eslint": "eslint -v && eslint --max-warnings=0 --ext '.js,.ts' src test",
"check:test": "mocha --recursive test/functional test/unit",
"check:ts": "tsc -v && tsc --noEmit",
"check:atlas": "mocha --config \"test/manual/mocharc.json\" test/manual/atlas_connectivity.test.js",
Expand Down
43 changes: 27 additions & 16 deletions src/bulk/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@ import type { Hint } from '../operations/operation';
// Error codes
const WRITE_CONCERN_ERROR = 64;

export enum BatchType {
INSERT = 1,
UPDATE = 2,
REMOVE = 3
}
/** @public */
export const BatchType = {
INSERT: 1,
UPDATE: 2,
REMOVE: 3
} as const;

/** @public */
export type BatchTypeId = typeof BatchType[keyof typeof BatchType];

/** @public */
export interface InsertOneModel {
Expand Down Expand Up @@ -115,7 +119,7 @@ export type AnyBulkWriteOperation =
| { deleteOne: DeleteOneModel }
| { deleteMany: DeleteManyModel };

/** @internal */
/** @public */
export interface BulkResult {
ok: number;
writeErrors: WriteError[];
Expand All @@ -133,17 +137,19 @@ export interface BulkResult {
/**
* Keeps the state of a unordered batch so we can rewrite the results
* correctly after command execution
*
* @internal
*/
export class Batch {
originalZeroIndex: number;
currentIndex: number;
originalIndexes: number[];
batchType: BatchType;
batchType: BatchTypeId;
operations: Document[];
size: number;
sizeBytes: number;

constructor(batchType: BatchType, originalZeroIndex: number) {
constructor(batchType: BatchTypeId, originalZeroIndex: number) {
this.originalZeroIndex = originalZeroIndex;
this.currentIndex = 0;
this.originalIndexes = [];
Expand Down Expand Up @@ -348,7 +354,7 @@ export class WriteConcernError {
}
}

/** @internal */
/** @public */
export interface BulkWriteOperationError {
index: number;
code: number;
Expand Down Expand Up @@ -704,8 +710,10 @@ export class MongoBulkWriteError extends MongoError {
/**
* A builder object that is returned from {@link BulkOperationBase#find}.
* Is used to build a write operation that involves a query filter.
*
* @public
*/
class FindOperators {
export class FindOperators {
bulkOperation: BulkOperationBase;

/**
Expand Down Expand Up @@ -855,16 +863,17 @@ class FindOperators {
return this.bulkOperation.addToOperationsList(BatchType.REMOVE, document);
}

removeOne() {
removeOne(): BulkOperationBase {
return this.deleteOne();
}

remove() {
remove(): BulkOperationBase {
return this.delete();
}
}

interface BulkOperationPrivate {
/** @internal */
export interface BulkOperationPrivate {
bulkResult: BulkResult;
currentBatch?: Batch;
currentIndex: number;
Expand Down Expand Up @@ -916,8 +925,10 @@ export interface BulkWriteOptions extends CommandOperationOptions {
forceServerObjectId?: boolean;
}

/** @public */
export abstract class BulkOperationBase {
isOrdered: boolean;
/** @internal */
s: BulkOperationPrivate;
operationId?: number;

Expand Down Expand Up @@ -1263,7 +1274,7 @@ export abstract class BulkOperationBase {
}

abstract addToOperationsList(
batchType: BatchType,
batchType: BatchTypeId,
document: Document | UpdateStatement | DeleteStatement
): this;
}
Expand Down Expand Up @@ -1301,7 +1312,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 +1379,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
Loading

0 comments on commit 55534c9

Please sign in to comment.