@@ -4,6 +4,15 @@ export interface ActivityCancellationDetailsHolder {
44 details ?: ActivityCancellationDetails ;
55}
66
7+ export interface ActivityCancellationDetailsOptions {
8+ notFound ?: boolean ;
9+ cancelRequested ?: boolean ;
10+ paused ?: boolean ;
11+ timedOut ?: boolean ;
12+ workerShutdown ?: boolean ;
13+ reset ?: boolean ;
14+ }
15+
716/**
817 * Provides the reasons for the activity's cancellation. Cancellation details are set once and do not change once set.
918 */
@@ -15,20 +24,13 @@ export class ActivityCancellationDetails {
1524 readonly workerShutdown : boolean ;
1625 readonly reset : boolean ;
1726
18- private constructor (
19- notFound : boolean = false ,
20- cancelRequested : boolean = false ,
21- paused : boolean = false ,
22- timedOut : boolean = false ,
23- workerShutdown : boolean = false ,
24- reset : boolean = false
25- ) {
26- this . notFound = notFound ;
27- this . cancelRequested = cancelRequested ;
28- this . paused = paused ;
29- this . timedOut = timedOut ;
30- this . workerShutdown = workerShutdown ;
31- this . reset = reset ;
27+ public constructor ( options : ActivityCancellationDetailsOptions = { } ) {
28+ this . notFound = options . notFound ?? false ;
29+ this . cancelRequested = options . cancelRequested ?? false ;
30+ this . paused = options . paused ?? false ;
31+ this . timedOut = options . timedOut ?? false ;
32+ this . workerShutdown = options . workerShutdown ?? false ;
33+ this . reset = options . reset ?? false ;
3234 }
3335
3436 static fromProto (
@@ -37,13 +39,13 @@ export class ActivityCancellationDetails {
3739 if ( proto == null ) {
3840 return new ActivityCancellationDetails ( ) ;
3941 }
40- return new ActivityCancellationDetails (
41- proto . isNotFound ?? false ,
42- proto . isCancelled ?? false ,
43- proto . isPaused ?? false ,
44- proto . isTimedOut ?? false ,
45- proto . isWorkerShutdown ?? false ,
46- proto . isReset ?? false
47- ) ;
42+ return new ActivityCancellationDetails ( {
43+ notFound : proto . isNotFound ?? false ,
44+ cancelRequested : proto . isCancelled ?? false ,
45+ paused : proto . isPaused ?? false ,
46+ timedOut : proto . isTimedOut ?? false ,
47+ workerShutdown : proto . isWorkerShutdown ?? false ,
48+ reset : proto . isReset ?? false
49+ } ) ;
4850 }
4951}
0 commit comments