Skip to content

@codesoul-co/hypha-core / modules/runtime/orchestration-projection

模块用法

用于执行该边界的运行时行为。Orchestration projection 模块公开 2 常量、2 函数。

从包入口导入

ts
import {
  RUNTIME_ORCHESTRATION_PROJECTION_ID,
  RUNTIME_ORCHESTRATION_PROJECTION_VERSION,
  createRuntimeOrchestrationProjectionDefinition,
  reduceRuntimeOrchestrationProjection,
} from '@codesoul-co/hypha-core';

使用要点

  • 2 个函数是该模块的直接操作入口;每个 overload 的必需/可选参数与返回类型均在下方列出。
  • 2 个常量/枚举提供稳定值、Schema、Definition 或默认配置;应复用这些导出,避免在应用中复制内部值。

公共导出

Symbol种类签名说明
RUNTIME_ORCHESTRATION_PROJECTION_ID常量const RUNTIME_ORCHESTRATION_PROJECTION_ID: "runtime.orchestration"modules/runtime/orchestration-projection 模块导出的 RUNTIME ORCHESTRATION PROJECTION ID 常量。
RUNTIME_ORCHESTRATION_PROJECTION_VERSION常量const RUNTIME_ORCHESTRATION_PROJECTION_VERSION: "1.5.0"modules/runtime/orchestration-projection 模块导出的 RUNTIME ORCHESTRATION PROJECTION VERSION 常量。
createRuntimeOrchestrationProjectionDefinition函数createRuntimeOrchestrationProjectionDefinition(runId: string): ProjectionDefinition<RuntimeOrchestrationProjection>Create Runtime Orchestration Projection Definition 函数,提供 1 个公开调用签名;参数与返回类型见下表。
reduceRuntimeOrchestrationProjection函数reduceRuntimeOrchestrationProjection(state: RuntimeOrchestrationProjection, event: PersistedFrameworkEvent): RuntimeOrchestrationProjectionReduce Runtime Orchestration Projection 函数,提供 1 个公开调用签名;参数与返回类型见下表。

RUNTIME_ORCHESTRATION_PROJECTION_ID

modules/runtime/orchestration-projection 模块导出的 RUNTIME ORCHESTRATION PROJECTION ID 常量。

声明

text
export declare const RUNTIME_ORCHESTRATION_PROJECTION_ID: "runtime.orchestration";

RUNTIME_ORCHESTRATION_PROJECTION_VERSION

modules/runtime/orchestration-projection 模块导出的 RUNTIME ORCHESTRATION PROJECTION VERSION 常量。

声明

text
export declare const RUNTIME_ORCHESTRATION_PROJECTION_VERSION: "1.5.0";

createRuntimeOrchestrationProjectionDefinition

Create Runtime Orchestration Projection Definition 函数,提供 1 个公开调用签名;参数与返回类型见下表。

声明

text
export declare function createRuntimeOrchestrationProjectionDefinition(runId: string): ProjectionDefinition<RuntimeOrchestrationProjection>;

调用签名

text
createRuntimeOrchestrationProjectionDefinition(runId: string): ProjectionDefinition<RuntimeOrchestrationProjection>

参数

参数类型必需说明
runIdstring必需参数;接受的值由类型列定义。

返回值

  • 类型: ProjectionDefinition<RuntimeOrchestrationProjection>
  • 说明: 返回值契约由上述类型定义。

reduceRuntimeOrchestrationProjection

Reduce Runtime Orchestration Projection 函数,提供 1 个公开调用签名;参数与返回类型见下表。

声明

text
export declare function reduceRuntimeOrchestrationProjection(state: RuntimeOrchestrationProjection, event: PersistedFrameworkEvent): RuntimeOrchestrationProjection;

调用签名

text
reduceRuntimeOrchestrationProjection(state: RuntimeOrchestrationProjection, event: PersistedFrameworkEvent): RuntimeOrchestrationProjection

参数

参数类型必需说明
stateRuntimeOrchestrationProjection必需参数;接受的值由类型列定义。
eventPersistedFrameworkEvent<unknown>必需参数;接受的值由类型列定义。

返回值

  • 类型: RuntimeOrchestrationProjection
  • 说明: 返回值契约由上述类型定义。