Skip to content

@codesoul-co/hypha-core / contracts/runtime-replay

Using this module

Use the Runtime replay module for declaring and runtime-validating contracts. It exports 1 constant, 6 interfaces, 1 type.

Import from the package entrypoint

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

import type {
  RuntimeReplayDivergence,
  RuntimeReplayRequest,
  RuntimeReplayResult,
  RuntimeReplayServiceContract,
  RuntimeReplayVerificationRequest,
  RuntimeReplayVerificationResult,
  RuntimeReplayDivergenceKind,
} from '@codesoul-co/hypha-core';

Usage patterns

  • Use the 7 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The 1 constant/enum export provides stable values, schemas, definitions, or defaults. Reuse these exports instead of copying internal values into an application.

Public exports

SymbolKindSignatureDescription
RUNTIME_REPLAY_DIVERGENCE_KINDSconstantconst RUNTIME_REPLAY_DIVERGENCE_KINDS: readonly ["workflow_revision", "process_hash", "dependency_snapshot", "projection_version", "snapshot_checksum"]RUNTIME REPLAY DIVERGENCE KINDS constant exported by the contracts/runtime-replay module.
RuntimeReplayDivergenceinterfaceinterface RuntimeReplayDivergenceRuntime Replay Divergence interface with 4 public fields or methods.
RuntimeReplayRequestinterfaceinterface RuntimeReplayRequestRuntime Replay Request interface with 7 public fields or methods.
RuntimeReplayResultinterfaceinterface RuntimeReplayResultRuntime Replay Result interface with 16 public fields or methods.
RuntimeReplayServiceContractinterfaceinterface RuntimeReplayServiceContractRuntime Replay Service Contract interface with 2 public fields or methods.
RuntimeReplayVerificationRequestinterfaceinterface RuntimeReplayVerificationRequestRuntime Replay Verification Request interface with 2 public fields or methods.
RuntimeReplayVerificationResultinterfaceinterface RuntimeReplayVerificationResultRuntime Replay Verification Result interface with 3 public fields or methods.
RuntimeReplayDivergenceKindtypetype RuntimeReplayDivergenceKind = (typeof RUNTIME_REPLAY_DIVERGENCE_KINDS)[number]Public type alias for Runtime Replay Divergence Kind; the declaration contains its complete type expression.

RUNTIME_REPLAY_DIVERGENCE_KINDS

RUNTIME REPLAY DIVERGENCE KINDS constant exported by the contracts/runtime-replay module.

  • Kind: constant
  • Import: import { RUNTIME_REPLAY_DIVERGENCE_KINDS } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-replay

Declaration

text
export declare const RUNTIME_REPLAY_DIVERGENCE_KINDS: readonly ["workflow_revision", "process_hash", "dependency_snapshot", "projection_version", "snapshot_checksum"];

RuntimeReplayDivergence

Runtime Replay Divergence interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { RuntimeReplayDivergence } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-replay

Declaration

text
export interface RuntimeReplayDivergence {
    kind: RuntimeReplayDivergenceKind;
    expected: string;
    actual: string;
    message: string;
}

Contract members

MemberKindSignatureDescription
actualpropertyactual: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
expectedpropertyexpected: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
kindpropertykind: "workflow_revision" | "process_hash" | "dependency_snapshot" | "projection_version" | "snapshot_checksum"Public property; its type, readonly modifier and optionality are shown in the signature.
messagepropertymessage: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeReplayRequest

Runtime Replay Request interface with 7 public fields or methods.

  • Kind: interface
  • Import: import type { RuntimeReplayRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-replay

Declaration

text
export interface RuntimeReplayRequest {
    scope: RuntimeScope;
    checkpointId?: string;
    expectedWorkflowRevision: string;
    expectedProcessHash: string;
    expectedDependencySnapshotRef: string;
    toSequence?: number;
    requestedAt: string;
}

Contract members

MemberKindSignatureDescription
checkpointIdpropertycheckpointId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
expectedDependencySnapshotRefpropertyexpectedDependencySnapshotRef: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
expectedProcessHashpropertyexpectedProcessHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
expectedWorkflowRevisionpropertyexpectedWorkflowRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
requestedAtpropertyrequestedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: RuntimeScopePublic property; its type, readonly modifier and optionality are shown in the signature.
toSequencepropertytoSequence?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeReplayResult

Runtime Replay Result interface with 16 public fields or methods.

  • Kind: interface
  • Import: import type { RuntimeReplayResult } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-replay

Declaration

text
export interface RuntimeReplayResult {
    sourceRunId: string;
    mode: 'deterministic';
    checkpointId: string;
    baseEventSequence: number;
    targetEventSequence: number;
    replayedEventCount: number;
    appliedEventCount: number;
    eventIds: string[];
    workflowRevision: string;
    processHash: string;
    dependencySnapshotRef: string;
    projectionVersion: string;
    finalSnapshot: RuntimeOrchestrationProjection;
    finalSnapshotChecksum: string;
    divergences: RuntimeReplayDivergence[];
    completedAt: string;
}

Contract members

MemberKindSignatureDescription
appliedEventCountpropertyappliedEventCount: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
baseEventSequencepropertybaseEventSequence: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
checkpointIdpropertycheckpointId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
completedAtpropertycompletedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
dependencySnapshotRefpropertydependencySnapshotRef: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
divergencespropertydivergences: RuntimeReplayDivergence[]Public property; its type, readonly modifier and optionality are shown in the signature.
eventIdspropertyeventIds: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
finalSnapshotpropertyfinalSnapshot: RuntimeOrchestrationProjectionPublic property; its type, readonly modifier and optionality are shown in the signature.
finalSnapshotChecksumpropertyfinalSnapshotChecksum: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
modepropertymode: "deterministic"Public property; its type, readonly modifier and optionality are shown in the signature.
processHashpropertyprocessHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
projectionVersionpropertyprojectionVersion: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
replayedEventCountpropertyreplayedEventCount: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceRunIdpropertysourceRunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
targetEventSequencepropertytargetEventSequence: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
workflowRevisionpropertyworkflowRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeReplayServiceContract

Runtime Replay Service Contract interface with 2 public fields or methods.

  • Kind: interface
  • Import: import type { RuntimeReplayServiceContract } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-replay

Declaration

text
export interface RuntimeReplayServiceContract {
    replay(request: RuntimeReplayRequest): Promise<RuntimeReplayResult>;
    verify(request: RuntimeReplayVerificationRequest): Promise<RuntimeReplayVerificationResult>;
}

Contract members

MemberKindSignatureDescription
replaymethodreplay(request: RuntimeReplayRequest): Promise<RuntimeReplayResult>Public method; parameters and return type are shown in the signature.
verifymethodverify(request: RuntimeReplayVerificationRequest): Promise<RuntimeReplayVerificationResult>Public method; parameters and return type are shown in the signature.

RuntimeReplayVerificationRequest

Runtime Replay Verification Request interface with 2 public fields or methods.

  • Kind: interface
  • Import: import type { RuntimeReplayVerificationRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-replay

Declaration

text
export interface RuntimeReplayVerificationRequest {
    replay: RuntimeReplayRequest;
    expectedSnapshotChecksum: string;
}

Contract members

MemberKindSignatureDescription
expectedSnapshotChecksumpropertyexpectedSnapshotChecksum: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
replaypropertyreplay: RuntimeReplayRequestPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeReplayVerificationResult

Runtime Replay Verification Result interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { RuntimeReplayVerificationResult } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-replay

Declaration

text
export interface RuntimeReplayVerificationResult {
    replay: RuntimeReplayResult;
    matches: boolean;
    divergences: RuntimeReplayDivergence[];
}

Contract members

MemberKindSignatureDescription
divergencespropertydivergences: RuntimeReplayDivergence[]Public property; its type, readonly modifier and optionality are shown in the signature.
matchespropertymatches: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
replaypropertyreplay: RuntimeReplayResultPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeReplayDivergenceKind

Public type alias for Runtime Replay Divergence Kind; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { RuntimeReplayDivergenceKind } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-replay

Declaration

text
export type RuntimeReplayDivergenceKind = (typeof RUNTIME_REPLAY_DIVERGENCE_KINDS)[number];