@@ -25,13 +25,13 @@ import {
25
25
import type { Topology } from '../sdam/topology' ;
26
26
import type { ClientSession } from '../sessions' ;
27
27
import { type Callback , maybeCallback , supportsRetryableWrites } from '../utils' ;
28
- import { AbstractCallbackOperation , Aspect } from './operation' ;
28
+ import { AbstractOperation , Aspect } from './operation' ;
29
29
30
30
const MMAPv1_RETRY_WRITES_ERROR_CODE = MONGODB_ERROR_CODES . IllegalOperation ;
31
31
const MMAPv1_RETRY_WRITES_ERROR_MESSAGE =
32
32
'This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.' ;
33
33
34
- type ResultTypeFromOperation < TOperation > = TOperation extends AbstractCallbackOperation < infer K >
34
+ type ResultTypeFromOperation < TOperation > = TOperation extends AbstractOperation < infer K >
35
35
? K
36
36
: never ;
37
37
@@ -61,29 +61,29 @@ export interface ExecutionResult {
61
61
* @param callback - The command result callback
62
62
*/
63
63
export function executeOperation <
64
- T extends AbstractCallbackOperation < TResult > ,
64
+ T extends AbstractOperation < TResult > ,
65
65
TResult = ResultTypeFromOperation < T >
66
66
> ( client : MongoClient , operation : T ) : Promise < TResult > ;
67
67
export function executeOperation <
68
- T extends AbstractCallbackOperation < TResult > ,
68
+ T extends AbstractOperation < TResult > ,
69
69
TResult = ResultTypeFromOperation < T >
70
70
> ( client : MongoClient , operation : T , callback : Callback < TResult > ) : void ;
71
71
export function executeOperation <
72
- T extends AbstractCallbackOperation < TResult > ,
72
+ T extends AbstractOperation < TResult > ,
73
73
TResult = ResultTypeFromOperation < T >
74
74
> ( client : MongoClient , operation : T , callback ?: Callback < TResult > ) : Promise < TResult > | void ;
75
75
export function executeOperation <
76
- T extends AbstractCallbackOperation < TResult > ,
76
+ T extends AbstractOperation < TResult > ,
77
77
TResult = ResultTypeFromOperation < T >
78
78
> ( client : MongoClient , operation : T , callback ?: Callback < TResult > ) : Promise < TResult > | void {
79
79
return maybeCallback ( ( ) => executeOperationAsync ( client , operation ) , callback ) ;
80
80
}
81
81
82
82
async function executeOperationAsync <
83
- T extends AbstractCallbackOperation < TResult > ,
83
+ T extends AbstractOperation < TResult > ,
84
84
TResult = ResultTypeFromOperation < T >
85
85
> ( client : MongoClient , operation : T ) : Promise < TResult > {
86
- if ( ! ( operation instanceof AbstractCallbackOperation ) ) {
86
+ if ( ! ( operation instanceof AbstractOperation ) ) {
87
87
// TODO(NODE-3483): Extend MongoRuntimeError
88
88
throw new MongoRuntimeError ( 'This method requires a valid operation instance' ) ;
89
89
}
@@ -209,7 +209,7 @@ type RetryOptions = {
209
209
} ;
210
210
211
211
async function retryOperation <
212
- T extends AbstractCallbackOperation < TResult > ,
212
+ T extends AbstractOperation < TResult > ,
213
213
TResult = ResultTypeFromOperation < T >
214
214
> (
215
215
operation : T ,
0 commit comments