@flowrensic/node

中文文档
0.6.61发布于 2026/11/11Apache-2.0TypeScriptESM + CJS近 30 天下载 1.3万

Replay history fetch and activity interceptor for Temporal workers, for use with Flowrensic.

此软件包已被标记为弃用

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

原始使用文档
文档目录5 节
  1. Who the caller is
  2. Replay
  3. Activity telemetry
  4. Query and signal counts
  5. Peers

@flowrensic/node

Pre-release. This package is an early preview and not ready for production. Its API can change in any version.

Replay the histories your workflows already produced, against the code you are about to ship.

Flowrensic keeps what a Temporal Engine recorded. This package fetches a set to disk and reports back what your replay found. The replay itself stays yours: call Temporal's replayer directly, in your suite, with your own bundler options. Histories in a repo go stale on the next deploy and nobody can say which are still safe to delete.

Server: flowrensic/flowrensic on Docker Hub. Temporal is the supported engine.

Who the caller is

Every call to Flowrensic says who sends it, in three headers: Flowrensic-Current-Env, Flowrensic-Env-Access-Key and Flowrensic-Current-Ephemeral-Run. Each helper here takes them as the options currentEnv, envAccessKey and currentEphemeralRun, beside serverBaseUrl. The package reads no environment variable: pass the values from your own config. An env of kind ephemeral takes currentEphemeralRun, such as the CI build number, and without one the run is default.

Replay

import { fetchReplaySet, publishVerdicts, readReplaySet } from '@flowrensic/node';
import { historyFromJSON } from '@temporalio/common/lib/proto-utils.js';
import { Worker } from '@temporalio/worker';

await fetchReplaySet({
  serverBaseUrl: 'http://flowrensic:8080',
  replayHistoryWorkflow: 'OrderWorkflow',
  replayHistoryOutDir: 'replay-set',
  replayHistoryFromEnvs: ['prod', 'staging'],
  currentEnv: 'ci',
  envAccessKey: config.envAccessKey,
  currentEphemeralRun: config.buildNumber,
});

const set = await readReplaySet('replay-set');
const histories = await Promise.all(
  set.histories.map(async (entry) => ({
    workflowId: entry.run_id,
    history: historyFromJSON(JSON.parse(await readFile(join('replay-set', entry.file), 'utf8'))),
  })),
);

const verdicts = [];
for await (const result of Worker.runReplayHistories({ workflowsPath }, histories)) {
  verdicts.push({
    runId: result.workflowId,
    workflowType: set.workflow_type,
    passed: result.error === undefined,
    error: result.error?.message,
  });
}

await publishVerdicts({
  serverBaseUrl: 'http://flowrensic:8080',
  codeVersion: config.gitSha,
  verdicts,
  currentEnv: 'ci',
  envAccessKey: config.envAccessKey,
  currentEphemeralRun: config.buildNumber,
});

The set holds the histories of each env named, one env after the other, and replay-set.json lists the envs and gives each history its env. Each env named must be the current env or one its entry in FLOWRENSIC_KNOWN_ENVS may read. The current env must be of kind ephemeral: every fetch belongs to an ephemeral run, and a persistent env is refused.

Verdicts go back against the run and the version, so a break points at the change that caused it.

flowrensic replay fetch in the CLI writes the same directory and the same manifest, for a pipeline that would rather fetch in a step than in a test.

The server picks the set: recent histories, versions still running somewhere, outcomes that differ. Newest-ten on a healthy workflow type is ten completions and not one failure.

Activity telemetry

import { createAttemptSink, flowrensicInterceptor } from '@flowrensic/node';

const sink = createAttemptSink({ serverBaseUrl: 'http://flowrensic:8080', currentEnv: 'prod', envAccessKey, workerName: 'orders-worker' });

const worker = await Worker.create({
  // ...
  interceptors: { activity: [flowrensicInterceptor(sink)] },
});

workerName names the worker, the same name for every copy of it. The Workflow types page shows it beside each type the worker runs, with the task queue, and can filter by it. Left out, the worker has no name.

One event per attempt, not per activity: the gap between the two is the retry count. Each attempt carries the namespace Temporal gives the activity, and the server keeps the namespaces of each environment apart. There is no namespace setting.

Activity inbound only, and publishing failures are swallowed. Telemetry must never fail the activity it measures.

Query and signal counts

The Workflow types page counts the queries each workflow type answers. The worker needs the workflow module and the sinks:

import { createRequire } from 'node:module';
import { flowrensicQuerySinks } from '@flowrensic/node';

const queries = flowrensicQuerySinks({ serverBaseUrl: 'http://flowrensic:8080', currentEnv: 'prod', envAccessKey });

const worker = await Worker.create({
  // ...
  interceptors: {
    activity: [flowrensicInterceptor(sink)],
    workflowModules: [createRequire(import.meta.url).resolve('@flowrensic/node/workflow')],
  },
  sinks: queries.sinks,
});
// Before the process ends:
await queries.buffer.close();

The client interceptor sends the queries and signals that fail or get no answer. Put it in the plugins of the client, so it reads the namespace of the client:

const interceptor = flowrensicClientInterceptor({ serverBaseUrl: 'http://flowrensic:8080', currentEnv: 'prod', envAccessKey });
const client = new Client({ connection, namespace: 'orders', plugins: [interceptor] });
// Before the process ends:
await interceptor.close();

Peers

@temporalio/worker, @temporalio/common, @temporalio/activity, @temporalio/workflow, 1.24 or newer, for the interceptors. The replay runs on your SDK, not on one this package pins.

版本与发布记录

@flowrensic/node 共发布 76 个版本,首次发布于 2026/10/08;过去 12 个月发布了 76 个版本。

版本发布日期距今
0.6.61latest2026/11/115 天前
0.6.602026/11/106 天前
0.6.582026/11/096 天前
0.6.552026/11/078 天前
0.6.522026/11/079 天前
0.6.512026/11/069 天前

关于 @flowrensic/node 的常见问题

@flowrensic/node 是什么?

Replay history fetch and activity interceptor for Temporal workers, for use with Flowrensic.注意:该包已被作者标记为弃用——Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

如何安装 @flowrensic/node?

在项目目录运行 npm install @flowrensic/node,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@temporalio/proto(>=1.24)、@temporalio/client(>=1.24)、@temporalio/common(>=1.24)、@temporalio/worker(>=1.24)、@temporalio/activity(>=1.24)、@temporalio/workflow(>=1.24)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@flowrensic/node 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@flowrensic/node 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@flowrensic/node 可以商用吗?

@flowrensic/node 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@flowrensic/node 的下载量有多少?

根据 npm 官方下载统计,@flowrensic/node 在 2026/10/15 – 2026/11/13 这 30 天内被下载 12,984 次,日均约 433 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@flowrensic/node 还在维护吗?

最新版本 0.6.61 发布于 2026/11/11(5 天前);至今共发布 76 个版本,其中过去 12 个月发布了 76 个;首次发布于 2026/10/08。作者已将其标记为弃用,新项目建议寻找替代方案。