Skip to content

Commit 46d4c51

Browse files
committed
chore(NODE-6939): update typescript to 5.8.3
1 parent fcbc6ed commit 46d4c51

File tree

19 files changed

+143
-92
lines changed

19 files changed

+143
-92
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"source-map-support": "^0.5.21",
109109
"ts-node": "^10.9.2",
110110
"tsd": "^0.31.2",
111-
"typescript": "5.5",
111+
"typescript": "5.8.3",
112112
"typescript-cached-transpile": "^0.0.6",
113113
"v8-heapsnapshot": "^1.3.1",
114114
"yargs": "^17.7.2"

src/bulk/common.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -894,16 +894,14 @@ export abstract class BulkOperationBase {
894894
/** @internal */
895895
s: BulkOperationPrivate;
896896
operationId?: number;
897+
private collection: Collection;
897898

898899
/**
899900
* Create a new OrderedBulkOperation or UnorderedBulkOperation instance
900901
* @internal
901902
*/
902-
constructor(
903-
private collection: Collection,
904-
options: BulkWriteOptions,
905-
isOrdered: boolean
906-
) {
903+
constructor(collection: Collection, options: BulkWriteOptions, isOrdered: boolean) {
904+
this.collection = collection;
907905
// determine whether bulkOperation is ordered or unordered
908906
this.isOrdered = isOrdered;
909907

src/client-side-encryption/state_machine.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,13 @@ export type StateMachineOptions = {
186186
*/
187187
// TODO(DRIVERS-2671): clarify CSOT behavior for FLE APIs
188188
export class StateMachine {
189-
constructor(
190-
private options: StateMachineOptions,
191-
private bsonOptions = pluckBSONSerializeOptions(options)
192-
) {}
189+
private options: StateMachineOptions;
190+
private bsonOptions: BSONSerializeOptions;
191+
192+
constructor(options: StateMachineOptions, bsonOptions = pluckBSONSerializeOptions(options)) {
193+
this.options = options;
194+
this.bsonOptions = bsonOptions;
195+
}
193196

194197
/**
195198
* Executes the state machine according to the specification

src/cmap/commands.ts

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,10 @@ export class OpQueryRequest {
7676
partial: boolean;
7777
/** moreToCome is an OP_MSG only concept */
7878
moreToCome = false;
79+
databaseName: string;
80+
query: Document;
7981

80-
constructor(
81-
public databaseName: string,
82-
public query: Document,
83-
options: OpQueryOptions
84-
) {
82+
constructor(databaseName: string, query: Document, options: OpQueryOptions) {
8583
// Basic options needed to be passed in
8684
// TODO(NODE-3483): Replace with MongoCommandError
8785
const ns = `${databaseName}.$cmd`;
@@ -97,7 +95,9 @@ export class OpQueryRequest {
9795
throw new MongoRuntimeError('Namespace cannot contain a null character');
9896
}
9997

100-
// Basic options
98+
// Basic optionsa
99+
this.databaseName = databaseName;
100+
this.query = query;
101101
this.ns = ns;
102102

103103
// Additional options
@@ -496,17 +496,18 @@ export class OpMsgRequest {
496496
checksumPresent: boolean;
497497
moreToCome: boolean;
498498
exhaustAllowed: boolean;
499+
databaseName: string;
500+
command: Document;
501+
options: OpQueryOptions;
499502

500-
constructor(
501-
public databaseName: string,
502-
public command: Document,
503-
public options: OpQueryOptions
504-
) {
503+
constructor(databaseName: string, command: Document, options: OpQueryOptions) {
505504
// Basic options needed to be passed in
506505
if (command == null)
507506
throw new MongoInvalidArgumentError('Query document must be specified for query');
508507

509-
// Basic options
508+
// Basic optionsa
509+
this.databaseName = databaseName;
510+
this.command = command;
510511
this.command.$db = databaseName;
511512

512513
// Ensure empty options
@@ -730,10 +731,19 @@ const COMPRESSION_DETAILS_SIZE = 9; // originalOpcode + uncompressedSize, compre
730731
* An OP_COMPRESSED request wraps either an OP_QUERY or OP_MSG message.
731732
*/
732733
export class OpCompressedRequest {
734+
private command: WriteProtocolMessageType;
735+
private options: { zLibCompressionLevel: number; agreedCompressor: CompressorName };
736+
733737
constructor(
734-
private command: WriteProtocolMessageType,
735-
private options: { zlibCompressionLevel: number; agreedCompressor: CompressorName }
736-
) {}
738+
command: WriteProtocolMessageType,
739+
options: { zlibCompressionLevel: number; agreedCompressor: CompressorName }
740+
) {
741+
this.command = command;
742+
this.options = {
743+
zLibCompressionLevel: options.zlibCompressionLevel,
744+
agreedCompressor: options.agreedCompressor
745+
};
746+
}
737747

738748
// Return whether a command contains an uncompressible command term
739749
// Will return true if command contains no uncompressible command terms
@@ -752,7 +762,13 @@ export class OpCompressedRequest {
752762
const originalCommandOpCode = concatenatedOriginalCommandBuffer.readInt32LE(12);
753763

754764
// Compress the message body
755-
const compressedMessage = await compress(this.options, messageToBeCompressed);
765+
const compressedMessage = await compress(
766+
{
767+
zlibCompressionLevel: this.options.zLibCompressionLevel,
768+
agreedCompressor: this.options.agreedCompressor
769+
},
770+
messageToBeCompressed
771+
);
756772
// Create the msgHeader of OP_COMPRESSED
757773
const msgHeader = Buffer.alloc(MESSAGE_HEADER_SIZE);
758774
msgHeader.writeInt32LE(

src/cmap/handshake/client_metadata.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ export class LimitedSizeDocument {
5353
private document = new Map();
5454
/** BSON overhead: Int32 + Null byte */
5555
private documentSize = 5;
56-
constructor(private maxSize: number) {}
56+
private maxSize: number;
57+
58+
constructor(maxSize: number) {
59+
this.maxSize = maxSize;
60+
}
5761

5862
/** Only adds key/value if the bsonByteLength is less than MAX_SIZE */
5963
public ifItFitsItSits(key: string, value: Record<string, any> | string): boolean {

src/cmap/wire_protocol/on_demand/document.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ import {
1414
toUTF8
1515
} from '../../../bson';
1616

17-
// eslint-disable-next-line no-restricted-syntax
18-
const enum BSONElementOffset {
19-
type = 0,
20-
nameOffset = 1,
21-
nameLength = 2,
22-
offset = 3,
23-
length = 4
24-
}
17+
const BSONElementOffset = {
18+
type: 0,
19+
nameOffset: 1,
20+
nameLength: 2,
21+
offset: 3,
22+
length: 4
23+
} as const;
2524

2625
/** @internal */
2726
export type JSTypeOf = {
@@ -67,17 +66,23 @@ export class OnDemandDocument {
6766

6867
/** All bson elements in this document */
6968
private readonly elements: ReadonlyArray<BSONElement>;
69+
/** BSON bytes, this document begins at offset */
70+
protected readonly bson: Uint8Array;
71+
/** The start of the document */
72+
private readonly offset: number;
73+
/** If this is an embedded document, indicates if this was a BSON array */
74+
public readonly isArray: boolean;
7075

7176
constructor(
72-
/** BSON bytes, this document begins at offset */
73-
protected readonly bson: Uint8Array,
74-
/** The start of the document */
75-
private readonly offset = 0,
76-
/** If this is an embedded document, indicates if this was a BSON array */
77-
public readonly isArray = false,
77+
bson: Uint8Array,
78+
offset = 0,
79+
isArray = false,
7880
/** If elements was already calculated */
7981
elements?: BSONElement[]
8082
) {
83+
this.bson = bson;
84+
this.offset = offset;
85+
this.isArray = isArray;
8186
this.elements = elements ?? parseToElementsToArray(this.bson, offset);
8287
}
8388

src/cmap/wire_protocol/responses.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ import {
2020
type OnDemandDocumentDeserializeOptions
2121
} from './on_demand/document';
2222

23-
// eslint-disable-next-line no-restricted-syntax
24-
const enum BSONElementOffset {
25-
type = 0,
26-
nameOffset = 1,
27-
nameLength = 2,
28-
offset = 3,
29-
length = 4
30-
}
23+
const BSONElementOffset = {
24+
type: 0,
25+
nameOffset: 1,
26+
nameLength: 2,
27+
offset: 3,
28+
length: 4
29+
} as const;
30+
3131
/**
3232
* Accepts a BSON payload and checks for na "ok: 0" element.
3333
* This utility is intended to prevent calling response class constructors

src/cursor/abstract_cursor.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,11 +1213,13 @@ configureResourceManagement(AbstractCursor.prototype);
12131213
* All timeout behavior is exactly the same as the wrapped timeout context's.
12141214
*/
12151215
export class CursorTimeoutContext extends TimeoutContext {
1216-
constructor(
1217-
public timeoutContext: TimeoutContext,
1218-
public owner: symbol | AbstractCursor
1219-
) {
1216+
timeoutContext: TimeoutContext;
1217+
owner: symbol | AbstractCursor;
1218+
1219+
constructor(timeoutContext: TimeoutContext, owner: symbol | AbstractCursor) {
12201220
super();
1221+
this.timeoutContext = timeoutContext;
1222+
this.owner = owner;
12211223
}
12221224
override get serverSelectionTimeout(): Timeout | null {
12231225
return this.timeoutContext.serverSelectionTimeout;

src/operations/distinct.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class DistinctOperation extends CommandOperation<any[]> {
9696

9797
const result = await super.executeCommand(server, session, cmd, timeoutContext);
9898

99-
return this.explain ? result : result.values;
99+
return this.explain ? (result as any[]) : result.values;
100100
}
101101
}
102102

src/operations/rename.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ export interface RenameOptions extends CommandOperationOptions {
1717

1818
/** @internal */
1919
export class RenameOperation extends CommandOperation<Document> {
20-
constructor(
21-
public collection: Collection,
22-
public newName: string,
23-
public override options: RenameOptions
24-
) {
20+
collection: Collection;
21+
newName: string;
22+
override options: RenameOptions;
23+
24+
constructor(collection: Collection, newName: string, options: RenameOptions) {
2525
super(collection, options);
26+
this.collection = collection;
27+
this.newName = newName;
28+
this.options = options;
2629
this.ns = new MongoDBNamespace('admin', '$cmd');
2730
}
2831

src/operations/run_command.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,17 @@ export type RunCommandOptions = {
2626

2727
/** @internal */
2828
export class RunCommandOperation<T = Document> extends AbstractOperation<T> {
29+
command: Document;
30+
override options: RunCommandOptions & { responseType?: MongoDBResponseConstructor };
31+
2932
constructor(
3033
parent: Db,
31-
public command: Document,
32-
public override options: RunCommandOptions & { responseType?: MongoDBResponseConstructor }
34+
command: Document,
35+
options: RunCommandOptions & { responseType?: MongoDBResponseConstructor }
3336
) {
3437
super(options);
38+
this.command = command;
39+
this.options = options;
3540
this.ns = parent.s.namespace.withCollection('$cmd');
3641
}
3742

@@ -62,14 +67,22 @@ export class RunCommandOperation<T = Document> extends AbstractOperation<T> {
6267
}
6368

6469
export class RunAdminCommandOperation<T = Document> extends AbstractOperation<T> {
70+
command: Document;
71+
override options: RunCommandOptions & {
72+
noResponse?: boolean;
73+
bypassPinningCheck?: boolean;
74+
};
75+
6576
constructor(
66-
public command: Document,
67-
public override options: RunCommandOptions & {
77+
command: Document,
78+
options: RunCommandOptions & {
6879
noResponse?: boolean;
6980
bypassPinningCheck?: boolean;
7081
}
7182
) {
7283
super(options);
84+
this.command = command;
85+
this.options = options;
7386
this.ns = new MongoDBNamespace('admin', '$cmd');
7487
}
7588

src/operations/search_indexes/create.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ export interface SearchIndexDescription extends Document {
2121

2222
/** @internal */
2323
export class CreateSearchIndexesOperation extends AbstractOperation<string[]> {
24-
constructor(
25-
private readonly collection: Collection,
26-
private readonly descriptions: ReadonlyArray<SearchIndexDescription>
27-
) {
24+
private readonly collection: Collection;
25+
private readonly descriptions: ReadonlyArray<SearchIndexDescription>;
26+
27+
constructor(collection: Collection, descriptions: ReadonlyArray<SearchIndexDescription>) {
2828
super();
29+
this.collection = collection;
30+
this.descriptions = descriptions;
2931
}
3032

3133
override get commandName() {

src/operations/search_indexes/drop.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ import { AbstractOperation } from '../operation';
88

99
/** @internal */
1010
export class DropSearchIndexOperation extends AbstractOperation<void> {
11-
constructor(
12-
private readonly collection: Collection,
13-
private readonly name: string
14-
) {
11+
private readonly collection: Collection;
12+
private readonly name: string;
13+
14+
constructor(collection: Collection, name: string) {
1515
super();
16+
this.collection = collection;
17+
this.name = name;
1618
}
1719

1820
override get commandName() {

src/operations/search_indexes/update.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ import { AbstractOperation } from '../operation';
77

88
/** @internal */
99
export class UpdateSearchIndexOperation extends AbstractOperation<void> {
10-
constructor(
11-
private readonly collection: Collection,
12-
private readonly name: string,
13-
private readonly definition: Document
14-
) {
10+
private readonly collection: Collection;
11+
private readonly name: string;
12+
private readonly definition: Document;
13+
14+
constructor(collection: Collection, name: string, definition: Document) {
1515
super();
16+
this.collection = collection;
17+
this.name = name;
18+
this.definition = definition;
1619
}
1720

1821
override get commandName() {

0 commit comments

Comments
 (0)