-
Notifications
You must be signed in to change notification settings - Fork 1.8k
chore(NODE-6939): update typescript to 5.8.3 #4526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -76,12 +76,10 @@ export class OpQueryRequest { | |||||
partial: boolean; | ||||||
/** moreToCome is an OP_MSG only concept */ | ||||||
moreToCome = false; | ||||||
databaseName: string; | ||||||
query: Document; | ||||||
|
||||||
constructor( | ||||||
public databaseName: string, | ||||||
public query: Document, | ||||||
options: OpQueryOptions | ||||||
) { | ||||||
constructor(databaseName: string, query: Document, options: OpQueryOptions) { | ||||||
// Basic options needed to be passed in | ||||||
// TODO(NODE-3483): Replace with MongoCommandError | ||||||
const ns = `${databaseName}.$cmd`; | ||||||
|
@@ -97,7 +95,9 @@ export class OpQueryRequest { | |||||
throw new MongoRuntimeError('Namespace cannot contain a null character'); | ||||||
} | ||||||
|
||||||
// Basic options | ||||||
// Basic optionsa | ||||||
this.databaseName = databaseName; | ||||||
this.query = query; | ||||||
this.ns = ns; | ||||||
|
||||||
// Additional options | ||||||
|
@@ -496,17 +496,18 @@ export class OpMsgRequest { | |||||
checksumPresent: boolean; | ||||||
moreToCome: boolean; | ||||||
exhaustAllowed: boolean; | ||||||
databaseName: string; | ||||||
command: Document; | ||||||
options: OpQueryOptions; | ||||||
|
||||||
constructor( | ||||||
public databaseName: string, | ||||||
public command: Document, | ||||||
public options: OpQueryOptions | ||||||
) { | ||||||
constructor(databaseName: string, command: Document, options: OpQueryOptions) { | ||||||
// Basic options needed to be passed in | ||||||
if (command == null) | ||||||
throw new MongoInvalidArgumentError('Query document must be specified for query'); | ||||||
|
||||||
// Basic options | ||||||
// Basic optionsa | ||||||
this.databaseName = databaseName; | ||||||
this.command = command; | ||||||
this.command.$db = databaseName; | ||||||
|
||||||
// Ensure empty options | ||||||
|
@@ -730,10 +731,19 @@ const COMPRESSION_DETAILS_SIZE = 9; // originalOpcode + uncompressedSize, compre | |||||
* An OP_COMPRESSED request wraps either an OP_QUERY or OP_MSG message. | ||||||
*/ | ||||||
export class OpCompressedRequest { | ||||||
private command: WriteProtocolMessageType; | ||||||
private options: { zLibCompressionLevel: number; agreedCompressor: CompressorName }; | ||||||
|
||||||
constructor( | ||||||
private command: WriteProtocolMessageType, | ||||||
private options: { zlibCompressionLevel: number; agreedCompressor: CompressorName } | ||||||
) {} | ||||||
command: WriteProtocolMessageType, | ||||||
options: { zlibCompressionLevel: number; agreedCompressor: CompressorName } | ||||||
) { | ||||||
this.command = command; | ||||||
this.options = { | ||||||
zLibCompressionLevel: options.zlibCompressionLevel, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should there be some sort of test that catches this? |
||||||
agreedCompressor: options.agreedCompressor | ||||||
}; | ||||||
} | ||||||
|
||||||
// Return whether a command contains an uncompressible command term | ||||||
// Will return true if command contains no uncompressible command terms | ||||||
|
@@ -752,7 +762,13 @@ export class OpCompressedRequest { | |||||
const originalCommandOpCode = concatenatedOriginalCommandBuffer.readInt32LE(12); | ||||||
|
||||||
// Compress the message body | ||||||
const compressedMessage = await compress(this.options, messageToBeCompressed); | ||||||
const compressedMessage = await compress( | ||||||
{ | ||||||
zlibCompressionLevel: this.options.zLibCompressionLevel, | ||||||
agreedCompressor: this.options.agreedCompressor | ||||||
}, | ||||||
messageToBeCompressed | ||||||
); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
// Create the msgHeader of OP_COMPRESSED | ||||||
const msgHeader = Buffer.alloc(MESSAGE_HEADER_SIZE); | ||||||
msgHeader.writeInt32LE( | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -87,6 +87,10 @@ export function onData( | |||||||
|
||||||||
[Symbol.asyncIterator]() { | ||||||||
return this; | ||||||||
}, | ||||||||
|
||||||||
[Symbol.asyncDispose]: function (): PromiseLike<void> { | ||||||||
return closeHandler().then(() => undefined); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
a suggestion: nothing wrong with async syntax here I think, just a bit simpler to drop the return value. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also probably worth leaving a comment about how this shouldn't be used (I don't think it will but in case). On older Node versions this is going to be: {
throw() {/*...*/} // ...
async undefined() {
}
} But typescript isn't going to let you know, ideally a test would fail on node 16 but might as well leave a paper trail. |
||||||||
} | ||||||||
}; | ||||||||
|
||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.