Skip to content

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

Using this module

Use the Runtime projection module for declaring and runtime-validating contracts. It exports 5 interfaces, 1 type.

Import from the package entrypoint

ts
import type {
  RuntimeCancellationProjection,
  RuntimeOrchestrationProjection,
  RuntimePendingTransitionProjection,
  RuntimePendingWaitProjection,
  RuntimeResumeProjection,
  RuntimeOrchestrationRunStatus,
} 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
RuntimeCancellationProjectioninterfaceinterface RuntimeCancellationProjectionRuntime Cancellation Projection interface with 4 public fields or methods.
RuntimeOrchestrationProjectioninterfaceinterface RuntimeOrchestrationProjectionRuntime Orchestration Projection interface with 13 public fields or methods.
RuntimePendingTransitionProjectioninterfaceinterface RuntimePendingTransitionProjectionRuntime Pending Transition Projection interface with 3 public fields or methods.
RuntimePendingWaitProjectioninterfaceinterface RuntimePendingWaitProjectionRuntime Pending Wait Projection interface with 10 public fields or methods.
RuntimeResumeProjectioninterfaceinterface RuntimeResumeProjectionRuntime Resume Projection interface with 7 public fields or methods.
RuntimeOrchestrationRunStatustypetype RuntimeOrchestrationRunStatus = 'not_created' | RuntimeRunStatusPublic type alias for Runtime Orchestration Run Status; the declaration contains its complete type expression.

RuntimeCancellationProjection

Runtime Cancellation Projection interface with 4 public fields or methods.

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

Declaration

text
export interface RuntimeCancellationProjection {
    commandId: string;
    principalId: string;
    reason: string;
    requestedAt: string;
}

Contract members

MemberKindSignatureDescription
commandIdpropertycommandId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
principalIdpropertyprincipalId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason: 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.

RuntimeOrchestrationProjection

Runtime Orchestration Projection interface with 13 public fields or methods.

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

Declaration

text
export interface RuntimeOrchestrationProjection {
    runId: string;
    runStatus: RuntimeOrchestrationRunStatus;
    currentState?: string;
    terminalState?: string;
    statePath: string[];
    stateVisitCounts: Record<string, number>;
    stateAttempt: number;
    pendingTransition?: RuntimePendingTransitionProjection;
    pendingHumanActionRef?: string;
    pendingWait?: RuntimePendingWaitProjection;
    lastResume?: RuntimeResumeProjection;
    cancellation?: RuntimeCancellationProjection;
    pendingActivityIds: string[];
}

Contract members

MemberKindSignatureDescription
cancellationpropertycancellation?: RuntimeCancellationProjectionPublic property; its type, readonly modifier and optionality are shown in the signature.
currentStatepropertycurrentState?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
lastResumepropertylastResume?: RuntimeResumeProjectionPublic 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.
pendingHumanActionRefpropertypendingHumanActionRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
pendingTransitionpropertypendingTransition?: RuntimePendingTransitionProjectionPublic property; its type, readonly modifier and optionality are shown in the signature.
pendingWaitpropertypendingWait?: RuntimePendingWaitProjectionPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runStatuspropertyrunStatus: RuntimeOrchestrationRunStatusPublic 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.
stateVisitCountspropertystateVisitCounts: Record<string, number>Public property; its type, readonly modifier and optionality are shown in the signature.
terminalStatepropertyterminalState?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimePendingTransitionProjection

Runtime Pending Transition Projection interface with 3 public fields or methods.

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

Declaration

text
export interface RuntimePendingTransitionProjection {
    eventId: string;
    from: string;
    to: string;
}

Contract members

MemberKindSignatureDescription
eventIdpropertyeventId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
frompropertyfrom: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
topropertyto: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimePendingWaitProjection

Runtime Pending Wait Projection interface with 10 public fields or methods.

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

Declaration

text
export interface RuntimePendingWaitProjection {
    waitId: string;
    stateId: string;
    stateAttempt: number;
    type: RuntimeWaitIntentType;
    key?: string;
    pendingActionRef?: string;
    reason?: string;
    expectedSchema?: JsonSchema;
    expiresAt?: string;
    createdAt: string;
}

Contract members

MemberKindSignatureDescription
createdAtpropertycreatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
expectedSchemapropertyexpectedSchema?: JsonSchemaPublic property; its type, readonly modifier and optionality are shown in the signature.
expiresAtpropertyexpiresAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
keypropertykey?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
pendingActionRefpropertypendingActionRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason?: stringPublic 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.
stateIdpropertystateId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
typepropertytype: "human" | "signal" | "timer" | "pause"Public property; its type, readonly modifier and optionality are shown in the signature.
waitIdpropertywaitId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeResumeProjection

Runtime Resume Projection interface with 7 public fields or methods.

Declaration

text
export interface RuntimeResumeProjection {
    commandId: string;
    kind: 'manual' | 'signal' | 'timer';
    waitId: string;
    principalId: string;
    key?: string;
    payload?: RuntimeJsonValue;
    resumedAt: string;
}

Contract members

MemberKindSignatureDescription
commandIdpropertycommandId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
keypropertykey?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
kindpropertykind: "manual" | "signal" | "timer"Public property; its type, readonly modifier and optionality are shown in the signature.
payloadpropertypayload?: RuntimeJsonValuePublic property; its type, readonly modifier and optionality are shown in the signature.
principalIdpropertyprincipalId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
resumedAtpropertyresumedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
waitIdpropertywaitId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeOrchestrationRunStatus

Public type alias for Runtime Orchestration Run Status; the declaration contains its complete type expression.

Declaration

text
export type RuntimeOrchestrationRunStatus = 'not_created' | RuntimeRunStatus;