Skip to content

Conversation

@singhk97
Copy link
Contributor

Ensure that HTTP responses are returned directly from handlers, rather than through event-based callbacks.

Activity processing and response flow:

  • The onActivity handler in app.events.ts now returns a Promise<InvokeResponse> and directly returns the result of processing the activity, rather than just awaiting it.
  • The $process function in app.process.ts is refactored to always return an InvokeResponse, handling both normal and error cases, and ensuring response construction is consistent.

HttpPlugin interface and implementation updates:

  • The $onActivity event handler in HttpPlugin is now asynchronous and returns a Promise<InvokeResponse>, aligning with the new app contract.
  • The HTTP request handler in HttpPlugin now awaits the activity response and sends it directly to the client, removing the previous pattern of storing pending responses and using callback events.
  • Old error and activity response event handlers (onError, onActivityResponse) and related state management are removed from HttpPlugin, as response handling is now synchronous with the HTTP request.

Type and import consistency:

  • The InvokeResponse type is imported and used consistently across files to improve type safety and clarity.

Copy link
Collaborator

@heyitsaamir heyitsaamir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Add tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants