Skip to content

Commit 6225009

Browse files
authored
Merge branch 'main' into disable-stale-bot
2 parents 708af96 + e4e2e96 commit 6225009

File tree

3 files changed

+28
-48
lines changed

3 files changed

+28
-48
lines changed

src/implementation/Client/GRPCClient/workflow.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,35 @@ export default class GRPCClientWorkflow implements IClientWorkflow {
2323
this.client = client;
2424
}
2525

26-
get(_instanceId: string, _workflowComponent?: string | undefined): Promise<WorkflowGetResponseType> {
26+
get(_instanceId: string): Promise<WorkflowGetResponseType> {
2727
throw new GRPCNotSupportedError();
2828
}
2929

3030
start(
3131
_workflowName: string,
3232
_input?: any,
33-
_instanceId?: string | undefined,
34-
_workflowComponent?: string | undefined,
33+
_instanceId?: string | undefined
3534
): Promise<string> {
3635
throw new GRPCNotSupportedError();
3736
}
3837

39-
terminate(_instanceId: string, _workflowComponent?: string | undefined): Promise<any> {
38+
terminate(_instanceId: string): Promise<any> {
4039
throw new GRPCNotSupportedError();
4140
}
4241

43-
pause(_instanceId: string, _workflowComponent?: string | undefined): Promise<any> {
42+
pause(_instanceId: string): Promise<any> {
4443
throw new GRPCNotSupportedError();
4544
}
4645

47-
resume(_instanceId: string, _workflowComponent?: string | undefined): Promise<any> {
46+
resume(_instanceId: string): Promise<any> {
4847
throw new GRPCNotSupportedError();
4948
}
5049

51-
purge(_instanceId: string, _workflowComponent?: string | undefined): Promise<any> {
50+
purge(_instanceId: string): Promise<any> {
5251
throw new GRPCNotSupportedError();
5352
}
5453

55-
raise(_instanceId: string, _eventName: string, _input?: any, _workflowComponent?: string | undefined): Promise<any> {
54+
raise(_instanceId: string, _eventName: string, _input?: any): Promise<any> {
5655
throw new GRPCNotSupportedError();
5756
}
5857
}

src/implementation/Client/HTTPClient/workflow.ts

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,20 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
2626
private readonly client: HTTPClient;
2727
private readonly logger: Logger;
2828

29-
private static readonly DEFAULT_WORKFLOW_COMPONENT = "dapr";
30-
3129
constructor(client: HTTPClient) {
3230
this.client = client;
3331
this.logger = new Logger("HTTPClient", "Workflow", client.options.logger);
3432
}
3533

36-
async get(instanceID: string, workflowComponent?: string): Promise<WorkflowGetResponseType> {
34+
async get(instanceID: string): Promise<WorkflowGetResponseType> {
3735
if (!instanceID) {
3836
throw new PropertyRequiredError("instanceID");
3937
}
4038

41-
workflowComponent = workflowComponent ?? HTTPClientWorkflow.DEFAULT_WORKFLOW_COMPONENT;
42-
4339
try {
4440
const result = await this.client.executeWithApiVersion(
4541
"v1.0-beta1",
46-
`/workflows/${workflowComponent}/${instanceID}`,
42+
`/workflows/dapr/${instanceID}`,
4743
{ method: "GET" },
4844
);
4945

@@ -73,7 +69,6 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
7369
workflowName: string,
7470
input?: any,
7571
instanceId?: string | undefined,
76-
workflowComponent?: string | undefined,
7772
options: WorkflowStartOptions = {},
7873
): Promise<string> {
7974
if (!workflowName) {
@@ -84,8 +79,6 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
8479
instanceId = randomUUID();
8580
}
8681

87-
workflowComponent = workflowComponent ?? HTTPClientWorkflow.DEFAULT_WORKFLOW_COMPONENT;
88-
8982
const queryParams = createHTTPQueryParam({ data: { instanceID: instanceId } });
9083

9184
// Set content type if provided.
@@ -98,7 +91,7 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
9891
try {
9992
await this.client.executeWithApiVersion(
10093
"v1.0-beta1",
101-
`/workflows/${workflowComponent}/${workflowName}/start?${queryParams}`,
94+
`/workflows/dapr/${workflowName}/start?${queryParams}`,
10295
{
10396
method: "POST",
10497
body: input,
@@ -117,7 +110,6 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
117110
instanceId: string,
118111
eventName: string,
119112
eventData?: any,
120-
workflowComponent?: string | undefined,
121113
options: WorkflowRaiseOptions = {},
122114
): Promise<void> {
123115
if (!instanceId) {
@@ -128,8 +120,6 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
128120
throw new PropertyRequiredError("eventName");
129121
}
130122

131-
workflowComponent = workflowComponent ?? HTTPClientWorkflow.DEFAULT_WORKFLOW_COMPONENT;
132-
133123
// Set content type if provided.
134124
// If not, HTTPClient will infer it from the data.
135125
const headers: KeyValueType = {};
@@ -140,7 +130,7 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
140130
try {
141131
await this.client.executeWithApiVersion(
142132
"v1.0-beta1",
143-
`/workflows/${workflowComponent}/${instanceId}/raiseEvent/${eventName}`,
133+
`/workflows/dapr/${instanceId}/raiseEvent/${eventName}`,
144134
{
145135
method: "POST",
146136
body: eventData,
@@ -153,23 +143,23 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
153143
}
154144
}
155145

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");
158148
}
159149

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");
162152
}
163153

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");
166156
}
167157

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");
170160
}
171161

172-
async _invokeMethod(instanceId: string, method: string, workflowComponent?: string | undefined): Promise<any> {
162+
async _invokeMethod(instanceId: string, method: string): Promise<any> {
173163
if (!instanceId) {
174164
throw new PropertyRequiredError("instanceID");
175165
}
@@ -178,10 +168,8 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
178168
throw new PropertyRequiredError("method");
179169
}
180170

181-
workflowComponent = workflowComponent ?? HTTPClientWorkflow.DEFAULT_WORKFLOW_COMPONENT;
182-
183171
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}`, {
185173
method: "POST",
186174
});
187175
} catch (e: any) {

src/interfaces/Client/IClientWorkflow.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,53 +17,46 @@ export default interface IClientWorkflow {
1717
/**
1818
* Get information about a workflow instance.
1919
* @param instanceId The unique identifier for the workflow instance.
20-
* @param workflowComponent The name of the workflow component to interface with, if not provided the default "dapr" will be used.
2120
*/
22-
get(instanceId: string, workflowComponent?: string): Promise<WorkflowGetResponseType>;
21+
get(instanceId: string): Promise<WorkflowGetResponseType>;
2322

2423
/**
2524
* Starts a new workflow instance.
2625
* @param workflowName The name of the workflow to start.
2726
* @param input The input to pass to the workflow, should be JSON serializable.
2827
* @param instanceId The unique identifier for the workflow instance, if not provided one will be generated.
29-
* @param workflowComponent The name of the workflow component to interface with, if not provided the default "dapr" will be used.
3028
*/
31-
start(workflowName: string, input?: any, instanceId?: string, workflowComponent?: string): Promise<string>;
29+
start(workflowName: string, input?: any, instanceId?: string): Promise<string>;
3230

3331
/**
3432
* Terminates a workflow instance.
3533
* @param instanceId The unique identifier for the workflow instance.
36-
* @param workflowComponent The name of the workflow component to interface with, if not provided the default "dapr" will be used.
3734
*/
38-
terminate(instanceId: string, workflowComponent?: string): Promise<void>;
35+
terminate(instanceId: string): Promise<void>;
3936

4037
/**
4138
* Pauses a workflow instance.
4239
* @param instanceId The unique identifier for the workflow instance.
43-
* @param workflowComponent The name of the workflow component to interface with, if not provided the default "dapr" will be used.
4440
*/
45-
pause(instanceId: string, workflowComponent?: string): Promise<void>;
41+
pause(instanceId: string): Promise<void>;
4642

4743
/**
4844
* Resumes a workflow instance.
4945
* @param instanceId The unique identifier for the workflow instance.
50-
* @param workflowComponent The name of the workflow component to interface with, if not provided the default "dapr" will be used.
5146
*/
52-
resume(instanceId: string, workflowComponent?: string): Promise<void>;
47+
resume(instanceId: string): Promise<void>;
5348

5449
/**
5550
* Purge a workflow instance.
5651
* @param instanceId The unique identifier for the workflow instance.
57-
* @param workflowComponent The name of the workflow component to interface with, if not provided the default "dapr" will be used.
5852
*/
59-
purge(instanceId: string, workflowComponent?: string): Promise<void>;
53+
purge(instanceId: string): Promise<void>;
6054

6155
/**
6256
* Raise an event to a workflow instance.
6357
* @param instanceId The unique identifier for the workflow instance.
6458
* @param eventName The name of the event to raise.
6559
* @param eventData The data associated with the event, should be JSON serializable.
66-
* @param workflowComponent The name of the workflow component to interface with, if not provided the default "dapr" will be used.
6760
*/
68-
raise(instanceId: string, eventName: string, eventData?: any, workflowComponent?: string): Promise<void>;
61+
raise(instanceId: string, eventName: string, eventData?: any): Promise<void>;
6962
}

0 commit comments

Comments
 (0)