Company
Date Published
Author
Valeri Karpov
Word count
1143
Language
English
Hacker News points
None

Summary

The Temporal's TypeScript SDK ensures workflow determinism by using V8 isolates via the isolated-vm npm package. Each workflow runs in an isolate that prevents direct access to non-deterministic logic like reading from the file system or generating a random number. This is crucial as Temporal stores each workflow's event history, including its initial state and all received signals and activity results. The SDK replaces commonly used non-deterministic built-ins with deterministic alternatives. It also prevents access to several Node.js APIs that could lead to non-determinism. If a workflow needs to use an npm module that interacts with the outside world, it should be placed in an activity which runs in the normal Node.js environment.