diff --git a/src/implementation/Client/GRPCClient/workflow.ts b/src/implementation/Client/GRPCClient/workflow.ts index 9a760918..43d24324 100644 --- a/src/implementation/Client/GRPCClient/workflow.ts +++ b/src/implementation/Client/GRPCClient/workflow.ts @@ -23,11 +23,11 @@ export default class GRPCClientWorkflow implements IClientWorkflow { this.client = client; } - get(_instanceId: string): Promise { + getWorkflowState(_instanceId: string, _workflowComponent?: string | undefined): Promise { throw new GRPCNotSupportedError(); } - start( + scheduleNewWorkflow( _workflowName: string, _input?: any, _instanceId?: string | undefined @@ -51,7 +51,7 @@ export default class GRPCClientWorkflow implements IClientWorkflow { throw new GRPCNotSupportedError(); } - raise(_instanceId: string, _eventName: string, _input?: any): Promise { + raiseEvent(_instanceId: string, _eventName: string, _input?: any): Promise { throw new GRPCNotSupportedError(); } } diff --git a/src/implementation/Client/HTTPClient/workflow.ts b/src/implementation/Client/HTTPClient/workflow.ts index 935a7f41..428f976e 100644 --- a/src/implementation/Client/HTTPClient/workflow.ts +++ b/src/implementation/Client/HTTPClient/workflow.ts @@ -31,7 +31,7 @@ export default class HTTPClientWorkflow implements IClientWorkflow { this.logger = new Logger("HTTPClient", "Workflow", client.options.logger); } - async get(instanceID: string): Promise { + async getWorkflowState(instanceID: string): Promise { if (!instanceID) { throw new PropertyRequiredError("instanceID"); } @@ -65,7 +65,7 @@ export default class HTTPClientWorkflow implements IClientWorkflow { } } - async start( + async scheduleNewWorkflow( workflowName: string, input?: any, instanceId?: string | undefined, @@ -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) { @@ -106,7 +106,7 @@ export default class HTTPClientWorkflow implements IClientWorkflow { } } - async raise( + async raiseEvent( instanceId: string, eventName: string, eventData?: any, @@ -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) { diff --git a/src/interfaces/Client/IClientWorkflow.ts b/src/interfaces/Client/IClientWorkflow.ts index ccc0e7f6..5027e7cb 100644 --- a/src/interfaces/Client/IClientWorkflow.ts +++ b/src/interfaces/Client/IClientWorkflow.ts @@ -18,7 +18,8 @@ export default interface IClientWorkflow { * Get information about a workflow instance. * @param instanceId The unique identifier for the workflow instance. */ - get(instanceId: string): Promise; + + getWorkflowState(instanceId: string): Promise; /** * Starts a new workflow instance. @@ -26,7 +27,7 @@ export default interface IClientWorkflow { * @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; + scheduleNewWorkflow(workflowName: string, input?: any, instanceId?: string): Promise; /** * Terminates a workflow instance. @@ -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; + raiseEvent(instanceId: string, eventName: string, eventData?: any): Promise; } diff --git a/test/unit/protocols/http/workflow.test.ts b/test/unit/protocols/http/workflow.test.ts index 8d26c6d7..c9dd573b 100644 --- a/test/unit/protocols/http/workflow.test.ts +++ b/test/unit/protocols/http/workflow.test.ts @@ -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); @@ -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); }); });