Skip to content

Releases: temporalio/sdk-typescript

1.5.0

04 Aug 21:22
Compare
Choose a tag to compare

Features

  • [client] The experimental WorkflowHandle.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 to concurrency, 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
    for logging (applicable to both console and forward loggers) and tracing. Function makeTelemetryFilterString
    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 named calls. 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 if runUntil promise throws (#943).
    Previously, Worker.runUntil would not wait for worker to complete its shutdown if the inner fnOrPromise threw an
    error. Now, it will always wait for both worker shutdown AND the inner fnOrPromise to resolve. If either one throw
    an error, then that error is rethrown. If both throw an error, a CombinedWorkerRunError will be thrown instead,
    with a cause attribute containing both errors.

  • The (experimental) FailureConverter type now receives its PayloadConverter 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 in makeContinueAsNewFunc (#955).
    They were previously not encoded at all, resulting in a failure due to invalid data.

  • [worker] Activity metric scheduled_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 as condition(fn), meaning that the
    function would block indefinitely and would return nothing once fn 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 if fn 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 using process.stderr.write rather than console.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

  • Improved code linting (#771, thanks to @JounQin 🙏)
  • [client] Extract a BaseClient super class (#957)

1.4.4

04 Aug 21:22
Compare
Choose a tag to compare

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

04 Aug 21:23
Compare
Choose a tag to compare

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

04 Aug 21:26
Compare
Choose a tag to compare

Bug Fixes

  • Depend on ~1.3.1 of @temporalio/* packages to prevent >= 1.4.0 versions from being installed.

1.4.2

04 Aug 21:24
Compare
Choose a tag to compare

Bug Fixes

  • [client] Fix default gRPC keepalive settings not applied
    (#906)

1.4.1

04 Aug 21:24
Compare
Choose a tag to compare

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

04 Aug 21:25
Compare
Choose a tag to compare

Features

  • 💥 Make client gRPC retry more configurable (#879)

    BREAKING CHANGE: GrpcRetryOptions.retryableDecider now gets the attempt number as the first argument. This is an advanced/rare option, and the change should be caught at compile time.

    Also adds BackoffOptions and defaultGrpcRetryOptions.

    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 [] from workflowHandle.describe(). Such attribute properties will no longer be present in the WorkflowExecutionDescription.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 and FailureConverter, 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] Add workflowInfo().unsafe.now() (#882)

    It returns the current system time in milliseconds. The safe version of time is new Date() and Date.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)

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] Export LoggerSinks 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

  • Fix double import of long in generated proto TS files (#891)
  • Fix bundler with default workflow interceptors (#891)
  • Limit eager activity requests to 3 (#891)

1.3.0

04 Aug 21:27
Compare
Choose a tag to compare

Bug Fixes

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:

    Added TestWorkflowEnvironment.currentTimeMs.

  • 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
  • [client] Add a high-level meta Client 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();
  • Add ActivityOptions.allowEagerDispatch (default true) (#873)

  • [testing] Use temporal.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

04 Aug 21:27
Compare
Choose a tag to compare

Features

  • [client] Enable gRPC keep-alive by default (#855)
  • Implement entrypoint for debug replayer (#848)

Bug Fixes

  • Build nyc-test-coverage package, fixes #839 (#843)
  • [workflow] Fix non-determinism on replay when using a patched statement in a condition (#859)
  • isCancellation no longer scans chain recursively (#837)
  • Don't trigger conditions for query jobs (#854)

Documentation

  • Add title and link to other docs (#842)
  • Update release instructions (#835)
  • Update README badge links (#856)

1.1.0

04 Aug 21:29
Compare
Choose a tag to compare

Bug Fixes

  • 💥 [worker] Remove unnecessary ReplayWorkerOptions (#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 with workflowsPath and bundlerOptions (#833)

    ⚠️ NOTE: We now prefer taking workflowBundle over workflowsPath 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 with bundleWorkflowCode should only be used for calling Worker.create when the exact same version of @temporalio/worker is used. (If you don't pin to exact versions in your package.json, then you should use a lockfile, and both the machine that runs bundleWorkflowCode and Worker.create should run npm ci, not npm install.)

    ⚠️ DEPRECATION: sourceMap and sourceMapPath 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)

  • Help protobufjs find long in Yarn3 (#810) (#814)

  • Add @types/long to client (#735)

  • [worker] Improve worker default options heuristics (#802)

  • Use GITHUB_TOKEN in create-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 both workflowBundle & bundlerOptions to Worker.create, a ValueError 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] Improve ApplicationFailure arguments; add .create and .fromError (#767)

    See ApplicationFailure.create and ApplicationFailure.fromError

  • Expose additional console methods to workflow context (#831)

    console.[error|warn|info|debug] can now be called from Workflow code, in addition to console.log

Documentation

  • Add package list to README (#803)
  • Add API doc for bundleWorkflowCode, fixes #792 (#793)
  • Surface missing core-bridge exports (#812)
  • Export missing ApplicationFailureOptions (#823)
  • Improve API reference (#826)