@@ -26,24 +26,20 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
26
26
private readonly client : HTTPClient ;
27
27
private readonly logger : Logger ;
28
28
29
- private static readonly DEFAULT_WORKFLOW_COMPONENT = "dapr" ;
30
-
31
29
constructor ( client : HTTPClient ) {
32
30
this . client = client ;
33
31
this . logger = new Logger ( "HTTPClient" , "Workflow" , client . options . logger ) ;
34
32
}
35
33
36
- async get ( instanceID : string , workflowComponent ?: string ) : Promise < WorkflowGetResponseType > {
34
+ async get ( instanceID : string ) : Promise < WorkflowGetResponseType > {
37
35
if ( ! instanceID ) {
38
36
throw new PropertyRequiredError ( "instanceID" ) ;
39
37
}
40
38
41
- workflowComponent = workflowComponent ?? HTTPClientWorkflow . DEFAULT_WORKFLOW_COMPONENT ;
42
-
43
39
try {
44
40
const result = await this . client . executeWithApiVersion (
45
41
"v1.0-beta1" ,
46
- `/workflows/${ workflowComponent } /${ instanceID } ` ,
42
+ `/workflows/dapr /${ instanceID } ` ,
47
43
{ method : "GET" } ,
48
44
) ;
49
45
@@ -73,7 +69,6 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
73
69
workflowName : string ,
74
70
input ?: any ,
75
71
instanceId ?: string | undefined ,
76
- workflowComponent ?: string | undefined ,
77
72
options : WorkflowStartOptions = { } ,
78
73
) : Promise < string > {
79
74
if ( ! workflowName ) {
@@ -84,8 +79,6 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
84
79
instanceId = randomUUID ( ) ;
85
80
}
86
81
87
- workflowComponent = workflowComponent ?? HTTPClientWorkflow . DEFAULT_WORKFLOW_COMPONENT ;
88
-
89
82
const queryParams = createHTTPQueryParam ( { data : { instanceID : instanceId } } ) ;
90
83
91
84
// Set content type if provided.
@@ -98,7 +91,7 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
98
91
try {
99
92
await this . client . executeWithApiVersion (
100
93
"v1.0-beta1" ,
101
- `/workflows/${ workflowComponent } /${ workflowName } /start?${ queryParams } ` ,
94
+ `/workflows/dapr /${ workflowName } /start?${ queryParams } ` ,
102
95
{
103
96
method : "POST" ,
104
97
body : input ,
@@ -117,7 +110,6 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
117
110
instanceId : string ,
118
111
eventName : string ,
119
112
eventData ?: any ,
120
- workflowComponent ?: string | undefined ,
121
113
options : WorkflowRaiseOptions = { } ,
122
114
) : Promise < void > {
123
115
if ( ! instanceId ) {
@@ -128,8 +120,6 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
128
120
throw new PropertyRequiredError ( "eventName" ) ;
129
121
}
130
122
131
- workflowComponent = workflowComponent ?? HTTPClientWorkflow . DEFAULT_WORKFLOW_COMPONENT ;
132
-
133
123
// Set content type if provided.
134
124
// If not, HTTPClient will infer it from the data.
135
125
const headers : KeyValueType = { } ;
@@ -140,7 +130,7 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
140
130
try {
141
131
await this . client . executeWithApiVersion (
142
132
"v1.0-beta1" ,
143
- `/workflows/${ workflowComponent } /${ instanceId } /raiseEvent/${ eventName } ` ,
133
+ `/workflows/dapr /${ instanceId } /raiseEvent/${ eventName } ` ,
144
134
{
145
135
method : "POST" ,
146
136
body : eventData ,
@@ -153,23 +143,23 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
153
143
}
154
144
}
155
145
156
- async terminate ( instanceId : string , workflowComponent ?: string | undefined ) : Promise < void > {
157
- await this . _invokeMethod ( instanceId , "terminate" , workflowComponent ) ;
146
+ async terminate ( instanceId : string ) : Promise < void > {
147
+ await this . _invokeMethod ( instanceId , "terminate" ) ;
158
148
}
159
149
160
- async pause ( instanceId : string , workflowComponent ?: string | undefined ) : Promise < void > {
161
- await this . _invokeMethod ( instanceId , "pause" , workflowComponent ) ;
150
+ async pause ( instanceId : string ) : Promise < void > {
151
+ await this . _invokeMethod ( instanceId , "pause" ) ;
162
152
}
163
153
164
- async resume ( instanceId : string , workflowComponent ?: string | undefined ) : Promise < void > {
165
- await this . _invokeMethod ( instanceId , "resume" , workflowComponent ) ;
154
+ async resume ( instanceId : string ) : Promise < void > {
155
+ await this . _invokeMethod ( instanceId , "resume" ) ;
166
156
}
167
157
168
- async purge ( instanceId : string , workflowComponent ?: string | undefined ) : Promise < void > {
169
- await this . _invokeMethod ( instanceId , "purge" , workflowComponent ) ;
158
+ async purge ( instanceId : string ) : Promise < void > {
159
+ await this . _invokeMethod ( instanceId , "purge" ) ;
170
160
}
171
161
172
- async _invokeMethod ( instanceId : string , method : string , workflowComponent ?: string | undefined ) : Promise < any > {
162
+ async _invokeMethod ( instanceId : string , method : string ) : Promise < any > {
173
163
if ( ! instanceId ) {
174
164
throw new PropertyRequiredError ( "instanceID" ) ;
175
165
}
@@ -178,10 +168,8 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
178
168
throw new PropertyRequiredError ( "method" ) ;
179
169
}
180
170
181
- workflowComponent = workflowComponent ?? HTTPClientWorkflow . DEFAULT_WORKFLOW_COMPONENT ;
182
-
183
171
try {
184
- await this . client . executeWithApiVersion ( "v1.0-beta1" , `/workflows/${ workflowComponent } /${ instanceId } /${ method } ` , {
172
+ await this . client . executeWithApiVersion ( "v1.0-beta1" , `/workflows/dapr /${ instanceId } /${ method } ` , {
185
173
method : "POST" ,
186
174
} ) ;
187
175
} catch ( e : any ) {
0 commit comments