Skip to content
6 changes: 3 additions & 3 deletions src/implementation/Client/GRPCClient/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ export default class GRPCClientWorkflow implements IClientWorkflow {
this.client = client;
}

get(_instanceId: string): Promise<WorkflowGetResponseType> {
getWorkflowState(_instanceId: string, _workflowComponent?: string | undefined): Promise<WorkflowGetResponseType> {
throw new GRPCNotSupportedError();
}

start(
scheduleNewWorkflow(
_workflowName: string,
_input?: any,
_instanceId?: string | undefined
Expand All @@ -51,7 +51,7 @@ export default class GRPCClientWorkflow implements IClientWorkflow {
throw new GRPCNotSupportedError();
}

raise(_instanceId: string, _eventName: string, _input?: any): Promise<any> {
raiseEvent(_instanceId: string, _eventName: string, _input?: any): Promise<any> {
throw new GRPCNotSupportedError();
}
}
10 changes: 5 additions & 5 deletions src/implementation/Client/HTTPClient/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
this.logger = new Logger("HTTPClient", "Workflow", client.options.logger);
}

async get(instanceID: string): Promise<WorkflowGetResponseType> {
async getWorkflowState(instanceID: string): Promise<WorkflowGetResponseType> {
if (!instanceID) {
throw new PropertyRequiredError("instanceID");
}
Expand Down Expand Up @@ -65,7 +65,7 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
}
}

async start(
async scheduleNewWorkflow(
workflowName: string,
input?: any,
instanceId?: string | undefined,
Expand All @@ -81,7 +81,7 @@ export default class HTTPClientWorkflow implements IClientWorkflow {

const queryParams = createHTTPQueryParam({ data: { instanceID: instanceId } });

// Set content type if provided.
// Set content-type if provided.
// If not, HTTPClient will infer it from the data.
const headers: KeyValueType = {};
if (options.contentType) {
Expand All @@ -106,7 +106,7 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
}
}

async raise(
async raiseEvent(
instanceId: string,
eventName: string,
eventData?: any,
Expand All @@ -120,7 +120,7 @@ export default class HTTPClientWorkflow implements IClientWorkflow {
throw new PropertyRequiredError("eventName");
}

// Set content type if provided.
// Set content-type if provided.
// If not, HTTPClient will infer it from the data.
const headers: KeyValueType = {};
if (options.eventContentType) {
Expand Down
7 changes: 4 additions & 3 deletions src/interfaces/Client/IClientWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ export default interface IClientWorkflow {
* Get information about a workflow instance.
* @param instanceId The unique identifier for the workflow instance.
*/
get(instanceId: string): Promise<WorkflowGetResponseType>;

getWorkflowState(instanceId: string): Promise<WorkflowGetResponseType>;

/**
* Starts a new workflow instance.
* @param workflowName The name of the workflow to start.
* @param input The input to pass to the workflow, should be JSON serializable.
* @param instanceId The unique identifier for the workflow instance, if not provided one will be generated.
*/
start(workflowName: string, input?: any, instanceId?: string): Promise<string>;
scheduleNewWorkflow(workflowName: string, input?: any, instanceId?: string): Promise<string>;

/**
* Terminates a workflow instance.
Expand Down Expand Up @@ -58,5 +59,5 @@ export default interface IClientWorkflow {
* @param eventName The name of the event to raise.
* @param eventData The data associated with the event, should be JSON serializable.
*/
raise(instanceId: string, eventName: string, eventData?: any): Promise<void>;
raiseEvent(instanceId: string, eventName: string, eventData?: any): Promise<void>;
}
8 changes: 4 additions & 4 deletions test/unit/protocols/http/workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ describe("workflow", () => {
const workflow = new HTTPClientWorkflow(client);

it("should throw PropertyRequiredError when instanceID variable is not provided in get method", async () => {
await expect(workflow.get("")).rejects.toThrow(PropertyRequiredError);
await expect(workflow.getWorkflowState("")).rejects.toThrow(PropertyRequiredError);
});
it("should throw PropertyRequiredError when workflowName variable is not provided in start method", async () => {
await expect(workflow.start("")).rejects.toThrow(PropertyRequiredError);
await expect(workflow.scheduleNewWorkflow("")).rejects.toThrow(PropertyRequiredError);
});
it("should throw PropertyRequiredError when instanceID variable is not provided in _invokeMethod method", async () => {
await expect(workflow._invokeMethod("", "raise")).rejects.toThrow(PropertyRequiredError);
Expand All @@ -37,9 +37,9 @@ describe("workflow", () => {
await expect(workflow._invokeMethod(randomUUID(), "")).rejects.toThrow(PropertyRequiredError);
});
it("should throw PropertyRequiredError when instanceID variable is not provided in raise method", async () => {
await expect(workflow.raise("", "Event")).rejects.toThrow(PropertyRequiredError);
await expect(workflow.raiseEvent("", "Event")).rejects.toThrow(PropertyRequiredError);
});
it("should throw PropertyRequiredError when eventName variable is not provided in raise method", async () => {
await expect(workflow.raise(randomUUID(), "")).rejects.toThrow(PropertyRequiredError);
await expect(workflow.raiseEvent(randomUUID(), "")).rejects.toThrow(PropertyRequiredError);
});
});
Loading