Skip to content

@codesoul-co/hypha-core / contracts/runtime-projection-schemas

模块用法

用于声明并运行时校验契约。Runtime projection schemas 模块公开 7 常量、1 函数。

从包入口导入

ts
import {
  runtimeOrchestrationProjectionDefinition,
  runtimeOrchestrationProjectionExample,
  runtimeOrchestrationProjectionJsonSchema,
  runtimeOrchestrationProjectionSchema,
  runtimeOrchestrationRunStatusSchema,
  runtimeProjectionContractDefinitions,
  runtimeProjectionContractJsonSchemas,
  validateRuntimeOrchestrationProjection,
} from '@codesoul-co/hypha-core';

使用要点

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

运行时校验示例

ts
import { runtimeOrchestrationProjectionSchema } from '@codesoul-co/hypha-core';

declare function loadExternalInput(): unknown;
const input: unknown = loadExternalInput();
const parsed = runtimeOrchestrationProjectionSchema.parse(input);

配置、网络请求或持久化数据等不可信输入应先通过 Runtime Schema,再传给只接受已校验契约的函数或类。

公共导出

Symbol种类签名说明
runtimeOrchestrationProjectionDefinition常量const runtimeOrchestrationProjectionDefinition: SpecSchemaDefinition<RuntimeOrchestrationProjection>contracts/runtime-projection-schemas 模块导出的 Runtime Orchestration Projection Definition 常量。
runtimeOrchestrationProjectionExample常量const runtimeOrchestrationProjectionExample: RuntimeOrchestrationProjectionRuntime Orchestration Projection 的有效示例值。
runtimeOrchestrationProjectionJsonSchema常量const runtimeOrchestrationProjectionJsonSchema: JsonSchemaRuntime Orchestration Projection 的 JSON Schema。
runtimeOrchestrationProjectionSchema常量const runtimeOrchestrationProjectionSchema: z.ZodEffects<z.ZodObject<{ runId: z.ZodString; runStatus: z.ZodEnum<[RuntimeOrchestrationRunStatus, ...RuntimeOrchestrationRunStatus[]]>; currentState: z.ZodOptional<z.ZodString>; terminalState: z.ZodOptional<z.ZodString>; statePath: z.ZodArray<z.ZodString, "many">; stateVisitCounts: z.ZodRecord<z.ZodString, z.ZodNumber>; stateAttempt: z.ZodNumber; pendingTransition: z.Z...Runtime Orchestration Projection 的运行时 Schema。
runtimeOrchestrationRunStatusSchema常量const runtimeOrchestrationRunStatusSchema: z.ZodEnum<[RuntimeOrchestrationRunStatus, ...RuntimeOrchestrationRunStatus[]]>Runtime Orchestration Run Status 的运行时 Schema。
runtimeProjectionContractDefinitions常量const runtimeProjectionContractDefinitions: readonly [SpecSchemaDefinition<RuntimeOrchestrationProjection>]contracts/runtime-projection-schemas 模块导出的 Runtime Projection Contract Definitions 常量。
runtimeProjectionContractJsonSchemas常量const runtimeProjectionContractJsonSchemas: Record<string, JsonSchema>contracts/runtime-projection-schemas 模块导出的 Runtime Projection Contract JSON Schemas 常量。
validateRuntimeOrchestrationProjection函数validateRuntimeOrchestrationProjection(input: unknown): RuntimeOrchestrationProjectionValidate Runtime Orchestration Projection 函数,提供 1 个公开调用签名;参数与返回类型见下表。

runtimeOrchestrationProjectionDefinition

contracts/runtime-projection-schemas 模块导出的 Runtime Orchestration Projection Definition 常量。

声明

text
export declare const runtimeOrchestrationProjectionDefinition: SpecSchemaDefinition<RuntimeOrchestrationProjection>;

runtimeOrchestrationProjectionExample

Runtime Orchestration Projection 的有效示例值。

声明

text
export declare const runtimeOrchestrationProjectionExample: RuntimeOrchestrationProjection;

runtimeOrchestrationProjectionJsonSchema

Runtime Orchestration Projection 的 JSON Schema。

声明

text
export declare const runtimeOrchestrationProjectionJsonSchema: JsonSchema;

runtimeOrchestrationProjectionSchema

Runtime Orchestration Projection 的运行时 Schema。

声明

text
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const runtimeOrchestrationProjectionSchema: (typeof import('@codesoul-co/hypha-core'))['runtimeOrchestrationProjectionSchema'];

该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。

runtimeOrchestrationRunStatusSchema

Runtime Orchestration Run Status 的运行时 Schema。

声明

text
export declare const runtimeOrchestrationRunStatusSchema: z.ZodEnum<[RuntimeOrchestrationRunStatus, ...RuntimeOrchestrationRunStatus[]]>;

runtimeProjectionContractDefinitions

contracts/runtime-projection-schemas 模块导出的 Runtime Projection Contract Definitions 常量。

声明

text
export declare const runtimeProjectionContractDefinitions: readonly [SpecSchemaDefinition<RuntimeOrchestrationProjection>];

runtimeProjectionContractJsonSchemas

contracts/runtime-projection-schemas 模块导出的 Runtime Projection Contract JSON Schemas 常量。

声明

text
export declare const runtimeProjectionContractJsonSchemas: Record<string, JsonSchema>;

validateRuntimeOrchestrationProjection

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

声明

text
export declare function validateRuntimeOrchestrationProjection(input: unknown): RuntimeOrchestrationProjection;

调用签名

text
validateRuntimeOrchestrationProjection(input: unknown): RuntimeOrchestrationProjection

参数

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

返回值

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