Creates a new RestatePromise that maps the result of this promise with
the provided mapper
, once this promise is fulfilled.
NOTE: You MUST use this API when you need to map the result of a
RestatePromise without await
ing it, rather than using Promise.then.
Promise.then is used by Restate to distinguish when awaiting an asynchronous operation,
thus calling .then
on several Restate promises can lead to concurrency issues.
the function to execute when this promise is fulfilled.
If the promise completed successfully, value
is provided as input, otherwise failure
is provided as input.
If this mapper returns a value, this value will be used to resolve the returned RestatePromise.
If the mapper throws a TerminalError, this error will be used to reject the returned RestatePromise.
Creates a promise that awaits for the current promise up to the specified timeout duration. If the timeout is fired, this Promise will be rejected with a TimeoutError.
duration of the sleep in millis. This is a lower-bound.
A promise that can be combined using Promise combinators in RestateContext.