Releases: temporalio/sdk-typescript
1.5.0
Features
-
[
client
] The experimentalWorkflowHandle.fetchHistory
function can now be used to easily obtain a single
Workflow execution's history (#974). -
[
client
] Introduced (experimental) high level API to list workflows (#942,
#974):for await (const workflowInfo of client.workflow.list({ query: 'WorkflowType="MySuperCoolWorkflow"' })) { console.log(`${workflowInfo.workflowId} ${workflowInfo.runId}`); }
The same API can also be used to efficiently obtain a list of workflows histories. Multiple histories are fetched from
the server in parallel (up toconcurrency
, defaults to 5), which may improve performances.for await (const { workflowId, history } of client.workflow.list().intoHistories({ concurrency: 10 })) { // ... }
-
[
client
] Added (experimental) high level API to work with Schedules (#937,
#960):// Define a schedule that will start workflow 'RefreshClientTableWorkflow` every day at 5 AM and 1 PM await client.schedule.create({ scheduleId: `refresh-client-table-every-morning`, spec: { calendars: [{ hour: [5, 13] }], }, action: { type: 'startWorkflow', workflowType: 'RefreshClientTableWorkflow', taskQueue, }, });
Note that Schedules requires Temporal version 1.18 or later.
-
[
core
] Core's (experimental) telemetry options are now more configurable (#963,
#977). Notably, filters can now be specified independently
forlogging
(applicable to bothconsole
andforward
loggers) andtracing
. FunctionmakeTelemetryFilterString
can be used to easily build filter strings. Also, OTel metrics export interval can now be modified (defaults to 1
second).Note: the
TelemetryOptions
interface has changed quite a bit. Using appropriate new options is highly recommended.
Backward compatibility for legacy options is provided, to the extent possible, but these legacy options have been
deprecated. -
[
client
] WorkflowClient now supports a simpler way to define interceptors (#956).
Interceptors should now be provided as an array of interceptor object, rather than an array of factory to those
objects under a field namedcalls
. Former definition syntax is still supported, though deprecated.BEFORE
interceptors: { calls: [ (workflowId) => { create(...) => { ... } } ] }
AFTER
interceptors: [ { create(...) => { ... } } ]
-
[
worker
] Introduced an experimental API to efficiently replay a large number of workflow histories. Teams may
notably use this API to validate that changes to their workflow code will not cause non-determinism errors on existing
workflow instances, before rolling out these changes to production (#920,
#974).EXAMPLE USAGE
const histories = client.workflow.list({ query: 'WorkflowType="MyWorkflow"' }).intoHistories({ concurrency: 10 }); const replayResults = await Worker.runReplayHistories( { workflowsPath: require.resolve('./workflows'), // ... }, histories ); console.log(`Found ${replayResults.errors.length} replay errors`);
-
Added
activity_task_received
metric (#439)
Bug Fixes
-
[
workflow
] Don't fail workflow task if a query handler was not found (#932). -
[
worker
] Wait for worker shutdown ifrunUntil
promise throws (#943).
Previously,Worker.runUntil
would not wait for worker to complete its shutdown if the innerfnOrPromise
threw an
error. Now, it will always wait for both worker shutdown AND the innerfnOrPromise
to resolve. If either one throw
an error, then that error is rethrown. If both throw an error, aCombinedWorkerRunError
will be thrown instead,
with acause
attribute containing both errors. -
The (experimental)
FailureConverter
type now receives itsPayloadConverter
through an argument on convertion
methods, rather than through an option supplied at construction time (#936).
This provides a more predictable behaviour in the common case of using the default failure converter. More over,
FailureConverter.errorToFailure
function's return type has been lossen, so that it supports greater customization on
user side (#927) -
[
client
]ConnectionOptions.connectTimeout
is now being applied correctly (#954). -
[
workflow
] Properly encode memos inmakeContinueAsNewFunc
(#955).
They were previously not encoded at all, resulting in a failure due to invalid data. -
[
worker
] Activity metricscheduled_to_start_latency
now reports the time from the schedule time of the
current attempt to the start time of that same attempt, instead of the time elapsed since the initial schedule time
(#975). This new definition aligns with other SDKs and is
more useful from a monitoring perspective. -
[
workflow
] Previously,condition(fn, 0)
was incorrectly handled the same ascondition(fn)
, meaning that the
function would block indefinitely and would return nothing oncefn
evaluated to true. It now behaves the same as
condition(fn, 1)
, ie. the function will sleep for a very short time, then return true iffn
evaluates to true,
or false if timeout reaches its expiration (#985). -
[
core
] Fixed some non-deterministic behaviour in workflows containing local activities, due to heartbeats
being incorrectly counted as logical workflow tasks (#987). -
[
core
]core-bridge
has been refactored so that it does not retain static references to custom TypeScript error
constructors (#983). This change is part of an ongoing effort
to resolve multiple issues observed by some users in execution of their unit tests based on sdk-typescript, notably in
conjunction with Jest, Mocha and Vitest. -
[
worker
] The default log function now write errors usingprocess.stderr.write
rather thanconsole.error
(#940). This avoids complains by some test runners. -
[
debugger
] Log errors comming from VS Code debugger (#968) -
Bug Fixes in Core SDK:
- Fixed a situation causing Core to send activations containing both a legacy query and other jobs (#427)
- Don't use a process-wide unique id for sticky queues (#430)
- Added support for ignorable history events (#422)
- Avoid hang in duplicated run-ids during replay (#417)
- Backoff more if we receive ResourceExhausted error (#408)
Miscellaneous Tasks
1.4.4
Bug Fixes
-
Don't request eager activities when worker started with no remote activities
Actual fix made in this Core SDK PR: temporalio/sdk-core#429
1.4.3
Bug Fixes
- [
nyc-test-coverage
] Delay checking for coverage until helpers run because coverage is undefined when Jest
starts (#910) - [
worker
] Avoid a race in shutdown hooks (#918) - [
core
] Ignore cancels of StartFailed state in child workflows, see: temporalio/sdk-core#413
1.3.1
1.4.2
1.4.1
Bug Fixes
-
[
client
] Handle test server empty history when waiting for workflow result
(#902) -
[
common
] Export and deprecate error helpers (#901)Fixes a breaking change accidentally introduces in 1.4.0 where some rarely used utility functions were deleted.
Miscellaneous Tasks
-
Improve regex for extracting source map (#899)
Addresses reported issue by userr where regex caused
RangeError: Maximum call stack size exceeded
when parsing their
workflow bundle.
1.4.0
Features
-
💥 Make client gRPC retry more configurable (#879)
BREAKING CHANGE:
GrpcRetryOptions.retryableDecider
now gets theattempt
number as the first argument. This is an advanced/rare option, and the change should be caught at compile time.Also adds
BackoffOptions
anddefaultGrpcRetryOptions
.NOTE: This feature is experimental and its API may change.
-
[
client
] Delete search attributes with empty array values in describe() response (#878)⚠️ This fixes a bug where empty/deleted Custom Search Attributes were returned as[]
fromworkflowHandle.describe()
. Such attribute properties will no longer be present in theWorkflowExecutionDescription.searchAttributes
object. Note that this behavior is consistent with what you'll see if using a pre-1.4 version of the SDK with Server version 1.18. -
Add support for custom failure converters (#887)
Adds
DataConverter.failureConverterPath
andFailureConverter
, which converts from proto Failure instances to JS Errors and back.We recommended going with the default (i.e. not using the
failureConverterPath
option) in order to maintain cross-language Failure serialization compatibility.NOTE: This feature is experimental and its API may change.
-
[
workflow
] AddworkflowInfo().unsafe.now()
(#882)It returns the current system time in milliseconds. The safe version of time is
new Date()
andDate.now()
, which are set on the first invocation of a Workflow Task and stay constant for the duration of the Task and during replay. -
Upgrade core, add support for OTEL metric temporality (#891)
- Upgraded otel and other deps (temporalio/sdk-core#402)
- Fix incorrect string names for polling methods (temporalio/sdk-core#401)
Miscellaneous Tasks
-
Remove
internal-*
packages (#881)⚠️ Any imports from@temporalio/internal-*
need to be updated. As noted in their named and READMEs, they're not meant to be used to directly, so we don't imagine this is a common case. However, if you do find instances, they should be changed to importing from:@temporalio/internal-non-workflow-common ➡️ @temporalio/common/lib/internal-non-workflow @temporalio/internal-workflow-common ➡️ @temporalio/common
-
[
common
] Deprecate internal functions that should have never been exported (#893)Some time-related and binary conversion internal helper functions were exported from
@temporalio/common
. They are now deprecated and hidden from the API reference, as they're meant for internal use only. -
[
workflow
] ExportLoggerSinks
from@temporalio/workflow
(#889) -
[
client
] Add max retry interval for client (#883) -
Label grpc-retry API as experimental (#891)
-
Make the failure-converter code symmetric (#891)
Bug Fixes
1.3.0
Bug Fixes
-
💥 Various bug fixes (#873)
BREAKING CHANGE: Makes
WorkflowExecutionDescription.historyLength
a number. This was aLong
before, but shouldn't
have been. If you're currently calling:(await workflowHandle.describe()).historyLength.toNumber();
then remove the
.toNumber()
call.This PR also included:
- Make
protobufjs
a dev dependency of@temporalio/client
- Use simple version of Core's
cancelChildWorkflowExecution
command
- Make
-
💥 Update Core from
e261
tob437
(#865 and #873)BREAKING CHANGE: This fixes a bug where values (memo, search attributes, and retry policy) were not being passed on to
the next Run during Continue-As-New. Now they are, unless you specify different values when calling
continueAsNew
(temporalio/sdk-core#376). [We believe this is unlikely to break
users code—the code would have to be depending on the absence of these values in Continued-As-New Runs.]This update also have various fixes and features:
- Don't dispatch eager activity if task queue is not the "current" (temporalio/sdk-core#397)
- Fix cancelling of started-but-lang-doesn't-know workflows (temporalio/sdk-core#379)
- Protect worker from more network errors (temporalio/sdk-core#396)
- Use tokio-rustls for request (temporalio/sdk-core#395)
- Fix for ephemeral test server zombie (temporalio/sdk-core#392)
- Ephemeral server lazy-downloader and runner (temporalio/sdk-core#389)
- Fix health service getter (temporalio/sdk-core#387)
- Expose HealthService (temporalio/sdk-core#386)
- Add more missing workflow options and add request_id as parameter for some calls (temporalio/sdk-core#365)
- Correct API definition link (temporalio/sdk-core#381)
- Add grpc health checking service/fns to client (temporalio/sdk-core#377)
- Respect per-call gRPC headers (temporalio/sdk-core#375)
- More client refactoring & add versioning-opt-in config flag (temporalio/sdk-core#374)
- Publicly expose the new client traits (temporalio/sdk-core#371)
- Add Test Server client & update deps (temporalio/sdk-core#370)
- Added test confirming act. w/o heartbeats times out (temporalio/sdk-core#369)
- Add Operator API machinery to client (temporalio/sdk-core#366)
-
[
client
] Only requiresignalArgs
insignalWithStart
when needed (#847)
Features
-
💥 Improvements to
@temporalio/testing
(#865 and #873)BREAKING CHANGE: Breaking for the testing package in some of the more advanced and rarely used options:
- No longer accepting
runInNormalTime
when waiting for workflow result TestWorkflowEnvironmentOptions
is completely redone
[Given that these were rarely used and the testing package isn't meant for production use, we don't think this change warrants a major version bump.]
TestWorkflowEnvironment.create
is deprecated in favor of: - No longer accepting
-
Various minor features (#865)
- Add
Connection.healthService
and generate testservice and health in proto package - Updated ci to use sdk-ci namespace for testing with cloud.
- Use ephemeral server from Core (supports both time skipping and temporalite)
- Test server is now only downloaded on first use
- Removed some unused dependencies
- Refactored core bridge into multiple files
- Closes #834
- Closes #844
- Add
-
[
client
] Add a high-level metaClient
class (#870)We now recommend using this instead of our other clients:
import { Client } from '@temporalio/client'; const client = new Client(options); await client.workflow.start(); await client.activity.heartbeat(); await client.activity.complete();
client.workflow
is aWorkflowClient
.client.activity
is anAsyncCompletionClient
.- We will be adding
client.schedule.*
(see theScheduleClient
proposal).
-
Add
ActivityOptions.allowEagerDispatch
(default true) (#873) -
[
testing
] Usetemporal.download
for downloading test server (#864) -
Add Webpack rule to auto instrument Workflows for code coverage, add
augmentWorkerOptions()
(#858, thanks to@vkarpov15
🙏)
Documentation
- Improve API reference (#871)
- Publish unchanged packages (#862)
- Update
nyc-test-coverage
README (#866)
Miscellaneous Tasks
1.2.0
1.1.0
Bug Fixes
-
💥 [
worker
] Remove unnecessaryReplayWorkerOptions
(#816)BREAKING CHANGE: While this is technically breaking (if you pass options that are irrelevant to replay like
maxActivitiesPerSecond
, you'll get a compilation error), we decided it did not warrant a major version bump, as it doesn't affect production code (replay is a testing feature) and is only a type change (is caught at compile type by TS users and doesn't affect JS users). -
Warn instead of throwing when getting
workflowBundle
withworkflowsPath
andbundlerOptions
(#833)⚠️ NOTE: We now prefer takingworkflowBundle
overworkflowsPath
when both are provided, which is the correct behavior and what users should expect.We also now warn that workflow interceptors are ignored when using
workflowBundle
. -
[
workflow
] Make breakpoints work inside workflow isolate context (#819)⚠️ NOTE: Bundles created withbundleWorkflowCode
should only be used for callingWorker.create
when the exact same version of@temporalio/worker
is used. (If you don't pin to exact versions in yourpackage.json
, then you should use a lockfile, and both the machine that runsbundleWorkflowCode
andWorker.create
should runnpm ci
, notnpm install
.)⚠️ DEPRECATION:sourceMap
andsourceMapPath
are now deprecated. We've inlined source maps, so now this works:const { code } = await bundleWorkflowCode({ workflowsPath }); const worker = await Worker.create({ workflowBundle: { code }, ...otherOptions });
-
Avoid using dynamic import in
@temporalio/testing
(#805) -
[
worker
] Don't start activity poller if no activities registered (#808) -
Update
proto3-json-serializer
to^1.0.3
(#809) -
Add
@types/long
to client (#735) -
[
worker
] Improve worker default options heuristics (#802) -
Use
GITHUB_TOKEN
increate-project
for CI (#721)
Features
-
💥 [
worker
] Add webpack configuration, closes #537 (#815)This was our most-upvoted feature request! (9 👍's.) See
WorkerOptions.bundlerOptions.webpackConfigHook
for usage.BREAKING CHANGE: If you provide both
workflowBundle
&workflowsPath
or bothworkflowBundle
&bundlerOptions
toWorker.create
, aValueError
will now be thrown. While this is technically breaking, TODO -
Add
@temporalio/nyc-test-coverage
package (#798, thanks to@vkarpov15
🙏)This package adds code coverage for Istanbul. It's currently in beta: the API may be unstable as we gather feedback on it from users. To try it out, see this code snippet for current usage.
-
[
common
] ImproveApplicationFailure
arguments; add.create
and.fromError
(#767)See
ApplicationFailure.create
andApplicationFailure.fromError
-
Expose additional console methods to workflow context (#831)
console.[error|warn|info|debug]
can now be called from Workflow code, in addition toconsole.log