Skip to content

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

Using this module

Use the Runtime query module for declaring and runtime-validating contracts. It exports 6 interfaces.

Import from the package entrypoint

ts
import type {
  RuntimeQueryRequest,
  RuntimeQueryServiceContract,
  RuntimeRunView,
  RuntimeStateExplanation,
  RuntimeTimelineRequest,
  RuntimeTimelineResult,
} from '@codesoul-co/hypha-core';

Usage patterns

  • Use the 6 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.

Public exports

SymbolKindSignatureDescription
RuntimeQueryRequestinterfaceinterface RuntimeQueryRequestRuntime Query Request interface with 1 public fields or methods.
RuntimeQueryServiceContractinterfaceinterface RuntimeQueryServiceContractRuntime Query Service Contract interface with 5 public fields or methods.
RuntimeRunViewinterfaceinterface RuntimeRunViewRuntime Run View interface with 7 public fields or methods.
RuntimeStateExplanationinterfaceinterface RuntimeStateExplanationRuntime State Explanation interface with 10 public fields or methods.
RuntimeTimelineRequestinterfaceinterface RuntimeTimelineRequest extends RuntimeQueryRequestRuntime Timeline Request interface with 5 public fields or methods.
RuntimeTimelineResultinterfaceinterface RuntimeTimelineResultRuntime Timeline Result interface with 5 public fields or methods.

RuntimeQueryRequest

Runtime Query Request interface with 1 public fields or methods.

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

Declaration

text
export interface RuntimeQueryRequest {
    scope: RuntimeScope;
}

Contract members

MemberKindSignatureDescription
scopepropertyscope: RuntimeScopePublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeQueryServiceContract

Runtime Query Service Contract interface with 5 public fields or methods.

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

Declaration

text
export interface RuntimeQueryServiceContract {
    getRun(request: RuntimeQueryRequest): Promise<RuntimeRunView | null>;
    getFSM(request: RuntimeQueryRequest): Promise<RuntimeOrchestrationProjection | null>;
    getTimeline(request: RuntimeTimelineRequest): Promise<RuntimeTimelineResult>;
    getPendingWaits(request: RuntimeQueryRequest): Promise<RuntimePendingWaitProjection[]>;
    explainState(request: RuntimeQueryRequest): Promise<RuntimeStateExplanation | null>;
}

Contract members

MemberKindSignatureDescription
explainStatemethodexplainState(request: RuntimeQueryRequest): Promise<RuntimeStateExplanation | null>Public method; parameters and return type are shown in the signature.
getFSMmethodgetFSM(request: RuntimeQueryRequest): Promise<RuntimeOrchestrationProjection | null>Public method; parameters and return type are shown in the signature.
getPendingWaitsmethodgetPendingWaits(request: RuntimeQueryRequest): Promise<RuntimePendingWaitProjection[]>Public method; parameters and return type are shown in the signature.
getRunmethodgetRun(request: RuntimeQueryRequest): Promise<RuntimeRunView | null>Public method; parameters and return type are shown in the signature.
getTimelinemethodgetTimeline(request: RuntimeTimelineRequest): Promise<RuntimeTimelineResult>Public method; parameters and return type are shown in the signature.

RuntimeRunView

Runtime Run View interface with 7 public fields or methods.

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

Declaration

text
export interface RuntimeRunView {
    scope: RuntimeScope;
    projectionVersion: string;
    projection: RuntimeOrchestrationProjection;
    projectionLastSequence: number;
    eventHeadSequence: number;
    projectionLag: number;
    refreshedAt: string;
}

Contract members

MemberKindSignatureDescription
eventHeadSequencepropertyeventHeadSequence: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
projectionpropertyprojection: RuntimeOrchestrationProjectionPublic property; its type, readonly modifier and optionality are shown in the signature.
projectionLagpropertyprojectionLag: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
projectionLastSequencepropertyprojectionLastSequence: numberPublic 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.
refreshedAtpropertyrefreshedAt: 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.

RuntimeStateExplanation

Runtime State Explanation interface with 10 public fields or methods.

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

Declaration

text
export interface RuntimeStateExplanation {
    scope: RuntimeScope;
    runStatus: RuntimeOrchestrationProjection['runStatus'];
    currentState?: string;
    stateAttempt: number;
    statePath: string[];
    pendingWaitId?: string;
    pendingTransitionEventId?: string;
    pendingActivityIds: string[];
    lastEventSequence: number;
    source: 'runtime.orchestration.projection';
}

Contract members

MemberKindSignatureDescription
currentStatepropertycurrentState?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
lastEventSequencepropertylastEventSequence: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
pendingActivityIdspropertypendingActivityIds: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
pendingTransitionEventIdpropertypendingTransitionEventId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
pendingWaitIdpropertypendingWaitId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runStatuspropertyrunStatus: import("/Users/erwin/Downloads/codespace/Hypha/packages/core/dist/contracts/runtime-projection").RuntimeOrchestrationRunStatusPublic 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.
sourcepropertysource: "runtime.orchestration.projection"Public property; its type, readonly modifier and optionality are shown in the signature.
stateAttemptpropertystateAttempt: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
statePathpropertystatePath: string[]Public property; its type, readonly modifier and optionality are shown in the signature.

RuntimeTimelineRequest

Runtime Timeline Request interface with 5 public fields or methods.

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

Declaration

text
export interface RuntimeTimelineRequest extends RuntimeQueryRequest {
    fromSequence?: number;
    toSequence?: number;
    types?: FrameworkEventType[];
    limit?: number;
}

Contract members

MemberKindSignatureDescription
fromSequencepropertyfromSequence?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
limitpropertylimit?: numberPublic 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.
typespropertytypes?: FrameworkEventType[]Public property; its type, readonly modifier and optionality are shown in the signature.

RuntimeTimelineResult

Runtime Timeline Result interface with 5 public fields or methods.

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

Declaration

text
export interface RuntimeTimelineResult {
    scope: RuntimeScope;
    events: PersistedFrameworkEvent[];
    eventCount: number;
    eventHeadSequence: number;
    refreshedAt: string;
}

Contract members

MemberKindSignatureDescription
eventCountpropertyeventCount: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
eventHeadSequencepropertyeventHeadSequence: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
eventspropertyevents: PersistedFrameworkEvent<unknown>[]Public property; its type, readonly modifier and optionality are shown in the signature.
refreshedAtpropertyrefreshedAt: 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.