Features
-
[
client] The experimentalWorkflowHandle.fetchHistoryfunction 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 bothconsoleandforwardloggers) 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
TelemetryOptionsinterface 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_receivedmetric (#439)
Bug Fixes
-
[
workflow] Don't fail workflow task if a query handler was not found (#932). -
[
worker] Wait for worker shutdown ifrunUntilpromise throws (#943).
Previously,Worker.runUntilwould not wait for worker to complete its shutdown if the innerfnOrPromisethrew an
error. Now, it will always wait for both worker shutdown AND the innerfnOrPromiseto resolve. If either one throw
an error, then that error is rethrown. If both throw an error, aCombinedWorkerRunErrorwill be thrown instead,
with acauseattribute containing both errors. -
The (experimental)
FailureConvertertype now receives itsPayloadConverterthrough 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.errorToFailurefunction's return type has been lossen, so that it supports greater customization on
user side (#927) -
[
client]ConnectionOptions.connectTimeoutis 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_latencynow 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 oncefnevaluated to true. It now behaves the same as
condition(fn, 1), ie. the function will sleep for a very short time, then return true iffnevaluates 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-bridgehas 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.writerather 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)