Skip to content

Commit 7ec39bc

Browse files
committed
chore: fix ts
1 parent 7ee8a74 commit 7ec39bc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/client-side-encryption/auto_encrypter.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66

77
import { deserialize, type Document, serialize } from '../bson';
88
import { type CommandOptions, type ProxyOptions } from '../cmap/connection';
9-
import { MongoDBResponse } from '../cmap/wire_protocol/responses';
9+
import { MongoDBResponse, type MongoDBResponseConstructor } from '../cmap/wire_protocol/responses';
1010
import { getMongoDBClientEncryption } from '../deps';
1111
import { MongoRuntimeError } from '../error';
1212
import { MongoClient, type MongoClientOptions } from '../mongo_client';
@@ -484,6 +484,10 @@ export class AutoEncrypter {
484484
? response
485485
: serialize(response, options);
486486

487+
const responseType = MongoDBResponse.is(response)
488+
? (response.constructor as MongoDBResponseConstructor)
489+
: undefined;
490+
487491
const context = this._mongocrypt.makeDecryptionContext(buffer);
488492

489493
context.id = this._contextCounter++;
@@ -495,7 +499,7 @@ export class AutoEncrypter {
495499
});
496500

497501
const decorateResult = this[kDecorateResult];
498-
const result = await stateMachine.execute(this, context, response.constructor);
502+
const result = await stateMachine.execute(this, context, responseType);
499503
if (decorateResult) {
500504
decorateDecryptionResult(result, response);
501505
}

0 commit comments

Comments
 (0)