Warn on unfinished handlers and provide `workflow.allHandlersFinished()` API
Fixes #1434.
- new workflow API to wait for all signal and update handlers to be finished:
await workflow.condition(() => workflow.allHandlersFinished()) - By default, warn when workflow exits with unfinished handlers, but not when a handler finishes due to workflow cancellation or workflow failure.
- Warnings controlled by
HandlerUnfinishedPolicy
I'm concerned with allHandlersFinished returning true between handling of a signal and an update.
@bergundy and I discussed this. There is indeed a bug, though not introduced in this PR and therefore not blocking this PR. We've opened https://github.com/temporalio/sdk-typescript/issues/1474
Should also close https://github.com/temporalio/sdk-typescript/issues/1435
Thanks very much for reviewing @mjameswh!
Still a few nits, but I'm ok to fix those in a follow-up PR.
The only thing I've pushed to a follow-up is the task of generating example stack traces to review our use of untrackPromise: https://github.com/temporalio/sdk-typescript/issues/1486, which was needed even before this PR.