File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
src/client-side-encryption Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -153,13 +153,29 @@ export class StateMachine {
153
153
) { }
154
154
155
155
/**
156
- * Executes the state machine according to the specification
156
+ * Executes the state machine according to the specification.
157
+ * Will construct the result using `responseType`.
158
+ */
159
+ async execute < R extends MongoDBResponseConstructor > (
160
+ executor : StateMachineExecutable ,
161
+ context : MongoCryptContext ,
162
+ responseType ?: R
163
+ ) : Promise < InstanceType < R > > ;
164
+
165
+ /**
166
+ * Executes the state machine according to the specification.
167
+ * Will return a document from the default BSON deserializer.
157
168
*/
158
169
async execute < T extends Document > (
170
+ executor : StateMachineExecutable ,
171
+ context : MongoCryptContext
172
+ ) : Promise < T > ;
173
+
174
+ async execute < T extends Document , R extends MongoDBResponseConstructor > (
159
175
executor : StateMachineExecutable ,
160
176
context : MongoCryptContext ,
161
- responseType ?: MongoDBResponseConstructor
162
- ) : Promise < T > {
177
+ responseType ?: R
178
+ ) : Promise < T | InstanceType < R > > {
163
179
const keyVaultNamespace = executor . _keyVaultNamespace ;
164
180
const keyVaultClient = executor . _keyVaultClient ;
165
181
const metaDataClient = executor . _metaDataClient ;
You can’t perform that action at this time.
0 commit comments