6
6
*/
7
7
8
8
import { FlagsConfig , flags , SfdxCommand } from '@salesforce/command' ;
9
+ import { Duration } from '@salesforce/kit' ;
9
10
import { SfdxProject , Org } from '@salesforce/core' ;
10
- import { FileResponse } from '@salesforce/source-deploy-retrieve ' ;
11
+ import { PushPullResponse } from '../../shared/types ' ;
11
12
import { SourceTracking } from '../../sourceTracking' ;
12
13
import { writeConflictTable } from '../../writeConflictTable' ;
13
14
export default class SourcePush extends SfdxCommand {
14
15
public static description = 'get local changes' ;
15
16
protected static readonly flagsConfig : FlagsConfig = {
16
17
forceoverwrite : flags . boolean ( { char : 'f' , description : 'overwrite files without prompting' } ) ,
18
+ // TODO: use shared flags from plugin-source
19
+ wait : flags . minutes ( {
20
+ char : 'w' ,
21
+ default : Duration . minutes ( 33 ) ,
22
+ min : Duration . minutes ( 0 ) , // wait=0 means deploy is asynchronous
23
+ description : 'tbd' ,
24
+ } ) ,
17
25
} ;
26
+
18
27
protected static requiresUsername = true ;
19
28
protected static requiresProject = true ;
29
+
20
30
protected project ! : SfdxProject ; // ok because requiresProject
21
31
protected org ! : Org ; // ok because requiresUsername
22
32
23
33
// eslint-disable-next-line @typescript-eslint/no-explicit-any
24
- public async run ( ) : Promise < FileResponse [ ] > {
34
+ public async run ( ) : Promise < PushPullResponse [ ] > {
25
35
const tracking = new SourceTracking ( {
26
36
org : this . org ,
27
37
project : this . project ,
@@ -35,7 +45,7 @@ export default class SourcePush extends SfdxCommand {
35
45
}
36
46
const deployResult = await tracking . deployLocalChanges ( {
37
47
ignoreWarnings : this . flags . ignorewarnings as boolean ,
38
- wait : this . flags . wait as number ,
48
+ wait : this . flags . wait as Duration ,
39
49
} ) ;
40
50
41
51
// TODO: convert deployResult to the proper type
@@ -44,6 +54,11 @@ export default class SourcePush extends SfdxCommand {
44
54
this . ux . logJson ( deployResult ) ;
45
55
}
46
56
47
- return deployResult ;
57
+ return deployResult . map ( ( fileResponse ) => ( {
58
+ state : fileResponse . state ,
59
+ fullName : fileResponse . fullName ,
60
+ type : fileResponse . type ,
61
+ filePath : fileResponse . filePath ,
62
+ } ) ) ;
48
63
}
49
64
}
0 commit comments