@@ -6,14 +6,14 @@ import {isServerScope} from "./isServerScope";
66import { promisify } from "./promisify" ;
77
88export class Wrapper {
9- public wrapServerScope ( serverScope : Nano . ServerScope ) : ServerScopeAsync {
9+ public static wrapServerScope ( serverScope : Nano . ServerScope ) : ServerScopeAsync {
1010 const serverScopeAsync : ServerScopeAsync = serverScope as any ;
1111
1212 const { use, scope} = serverScope ;
1313
14- serverScopeAsync . db = this . wrapDatabaseScope ( serverScopeAsync . db ) ;
15- serverScopeAsync . use = ( db : string ) => this . wrapDocumentScope ( use ( db ) ) ;
16- serverScopeAsync . scope = ( db : string ) => this . wrapDocumentScope ( scope ( db ) ) ;
14+ serverScopeAsync . db = Wrapper . wrapDatabaseScope ( serverScopeAsync . db ) ;
15+ serverScopeAsync . use = ( db : string ) => Wrapper . wrapDocumentScope ( use ( db ) ) ;
16+ serverScopeAsync . scope = ( db : string ) => Wrapper . wrapDocumentScope ( scope ( db ) ) ;
1717
1818 serverScopeAsync . authAsync = promisify ( serverScopeAsync . auth ) ;
1919 serverScopeAsync . sessionAsync = promisify ( serverScopeAsync . session ) ;
@@ -23,12 +23,12 @@ export class Wrapper {
2323 return serverScopeAsync ;
2424 }
2525
26- public wrapDatabaseScope ( databaseScope : Nano . DatabaseScope ) : DatabaseScopeAsync {
26+ public static wrapDatabaseScope ( databaseScope : Nano . DatabaseScope ) : DatabaseScopeAsync {
2727 const databaseScopeAsync : DatabaseScopeAsync = databaseScope as any ;
2828
2929 const { use} = databaseScope ;
3030
31- databaseScopeAsync . use = ( db : string ) => this . wrapDocumentScope ( use ( db ) ) ;
31+ databaseScopeAsync . use = ( db : string ) => Wrapper . wrapDocumentScope ( use ( db ) ) ;
3232
3333 databaseScopeAsync . createAsync = promisify ( databaseScopeAsync . create ) ;
3434 databaseScopeAsync . getAsync = promisify ( databaseScopeAsync . getAsync ) ;
@@ -42,7 +42,7 @@ export class Wrapper {
4242 return databaseScopeAsync ;
4343 }
4444
45- public wrapDocumentScope < D > ( documentScope : Nano . DocumentScope < D > ) : DocumentScopeAsync < D > {
45+ public static wrapDocumentScope < D > ( documentScope : Nano . DocumentScope < D > ) : DocumentScopeAsync < D > {
4646 const documentScopeAsync : DocumentScopeAsync < D > = documentScope as any ;
4747
4848 documentScopeAsync . infoAsync = promisify ( documentScopeAsync . info ) ;
@@ -78,7 +78,7 @@ export class Wrapper {
7878 return documentScopeAsync ;
7979 }
8080
81- public wrap < D > ( nano : Nano . ServerScope | Nano . DocumentScope < D > ) : ServerScopeAsync | DocumentScopeAsync < D > {
82- return isServerScope ( nano ) ? this . wrapServerScope ( nano ) : this . wrapDocumentScope ( nano ) ;
81+ public static wrap < D > ( nano : Nano . ServerScope | Nano . DocumentScope < D > ) : ServerScopeAsync | DocumentScopeAsync < D > {
82+ return isServerScope ( nano ) ? Wrapper . wrapServerScope ( nano ) : Wrapper . wrapDocumentScope ( nano ) ;
8383 }
8484}
0 commit comments