@@ -14,23 +14,32 @@ declare abstract class Workflow {
14
14
* @param id Id for the instance of this Workflow
15
15
* @returns A promise that resolves with a handle for the Instance
16
16
*/
17
- public get ( id : string ) : Promise < Instance > ;
17
+ public getById ( id : string ) : Promise < WorkflowInstance > ;
18
+
19
+ /**
20
+ * Get a handle to an existing instance of the Workflow.
21
+ * @param name Name for the instance of this Workflow
22
+ * @returns A promise that resolves with a handle for the Instance
23
+ */
24
+ public getByName ( name : string ) : Promise < WorkflowInstance > ;
18
25
19
26
/**
20
27
* Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.
21
- * @param options optional fields to customize the instance creation
28
+ * @param options Options when creating an instance including name and params
22
29
* @returns A promise that resolves with a handle for the Instance
23
30
*/
24
- public create ( options ?: WorkflowInstanceCreateOptions ) : Promise < Instance > ;
31
+ public create (
32
+ options ?: WorkflowInstanceCreateOptions
33
+ ) : Promise < WorkflowInstance > ;
25
34
}
26
35
27
36
interface WorkflowInstanceCreateOptions {
28
37
/**
29
- * Name to create the instance of this Workflow with - it should always be unique
38
+ * A name for your Workflow instance. Must be unique within the Workflow.
30
39
*/
31
40
name ?: string ;
32
41
/**
33
- * The payload to send over to this instance, this is optional since you might need to pass params into the instance
42
+ * The event payload the Workflow instance is triggered with
34
43
*/
35
44
params ?: unknown ;
36
45
}
@@ -55,7 +64,7 @@ interface WorkflowError {
55
64
message : string ;
56
65
}
57
66
58
- declare abstract class Instance {
67
+ declare abstract class WorkflowInstance {
59
68
public id : string ;
60
69
61
70
/**
@@ -69,9 +78,9 @@ declare abstract class Instance {
69
78
public resume ( ) : Promise < void > ;
70
79
71
80
/**
72
- * Abort the instance. If it is errored, terminated or complete, an error will be thrown.
81
+ * Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
73
82
*/
74
- public abort ( ) : Promise < void > ;
83
+ public terminate ( ) : Promise < void > ;
75
84
76
85
/**
77
86
* Restart the instance.
0 commit comments