@@ -3,12 +3,13 @@ import { COMMANDS } from "../../app.injection";
3
3
import { TransactionService } from "../transaction/transaction.service" ;
4
4
import { ITransactionType , IStatusQueryType } from "../api-introspection" ;
5
5
import { StatusService } from "../status/status.service" ;
6
+ import { InstallService } from "../tasks/install/install.service" ;
6
7
7
8
@Injectable ( )
8
9
export class ExecutorService {
9
- taskMap = new Map <
10
+ taskMapServer = new Map <
10
11
COMMANDS ,
11
- ( ) => Promise < ITransactionType | ITransactionType [ ] >
12
+ ( ) => Promise < ITransactionType | ITransactionType [ ] | { } >
12
13
> ( [
13
14
[ COMMANDS . add , this . transactionService . addTransaction ] ,
14
15
[ COMMANDS . checkout , this . transactionService . checkoutTransaction ] ,
@@ -17,14 +18,26 @@ export class ExecutorService {
17
18
[ COMMANDS . push , this . transactionService . pushTransactions ]
18
19
] ) ;
19
20
21
+ taskMapClient = new Map <
22
+ COMMANDS ,
23
+ ( ) => Promise < ITransactionType | ITransactionType [ ] | { } >
24
+ > ( [
25
+ [ COMMANDS . install , this . installService . install ] ,
26
+ [ COMMANDS . i , this . installService . install ]
27
+ ] ) ;
28
+
20
29
constructor (
21
30
private transactionService : TransactionService ,
22
- private statusService : StatusService
31
+ private statusService : StatusService ,
32
+ private installService : InstallService
23
33
) { }
24
34
25
35
async execute ( command : COMMANDS ) {
26
- if ( this . taskMap . has ( command ) && await this . isServerStarted ( ) ) {
27
- return await this . taskMap . get ( command ) ( ) ;
36
+ if ( this . taskMapClient . has ( command ) ) {
37
+ return await this . taskMapClient . get ( command ) ( ) ;
38
+ }
39
+ if ( this . taskMapServer . has ( command ) && ( await this . isServerStarted ( ) ) ) {
40
+ return await this . taskMapServer . get ( command ) ( ) ;
28
41
}
29
42
return null ;
30
43
}
0 commit comments