Skip to content

@codesoul-co/hypha-harness / execution-context

Using this module

Use the Execution context module for executing runtime behavior at this boundary. It exports 1 function, 2 interfaces.

Import from the package entrypoint

ts
import {
  createRuntimeExecutionContext,
} from '@codesoul-co/hypha-harness';

import type {
  CreateRuntimeExecutionContextOptions,
  RuntimeExecutionContext,
} from '@codesoul-co/hypha-harness';

Usage patterns

  • Use the 2 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The module exposes 1 function as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.

Public exports

SymbolKindSignatureDescription
createRuntimeExecutionContextfunctioncreateRuntimeExecutionContext(options: CreateRuntimeExecutionContextOptions): RuntimeExecutionContextCreate Runtime Execution Context function with 1 public call signature; parameters and return types are listed below.
CreateRuntimeExecutionContextOptionsinterfaceinterface CreateRuntimeExecutionContextOptionsCreate Runtime Execution Context Options interface with 15 public fields or methods.
RuntimeExecutionContextinterfaceinterface RuntimeExecutionContextRuntime Execution Context interface with 16 public fields or methods.

createRuntimeExecutionContext

Create Runtime Execution Context function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { createRuntimeExecutionContext } from '@codesoul-co/hypha-harness';
  • Source module: execution-context

Declaration

text
export declare function createRuntimeExecutionContext(options: CreateRuntimeExecutionContextOptions): RuntimeExecutionContext;

Call signature

text
createRuntimeExecutionContext(options: CreateRuntimeExecutionContextOptions): RuntimeExecutionContext

Parameters

ParameterTypeRequiredDescription
optionsCreateRuntimeExecutionContextOptionsYesRequired parameter; accepted values are defined by the type column.

Returns

  • Type: RuntimeExecutionContext
  • Description: The return contract is defined by the type shown above.

CreateRuntimeExecutionContextOptions

Create Runtime Execution Context Options interface with 15 public fields or methods.

  • Kind: interface
  • Import: import type { CreateRuntimeExecutionContextOptions } from '@codesoul-co/hypha-harness';
  • Source module: execution-context

Declaration

text
export interface CreateRuntimeExecutionContextOptions {
    scope: RuntimeScope;
    principal: RuntimePrincipal;
    run: RuntimeRun;
    snapshot: FSMSnapshot;
    process: FSMProcessSpec;
    attempt: number;
    runLease: RunLeaseAuthorization;
    abortSignal: AbortSignal;
    determinismStore: RuntimeDeterminismStore;
    eventCommitPort: RuntimeEventCommitPort;
    activityDispatchPort: RuntimeActivityDispatchPort;
    resourceCoordinator: RuntimeResourceCoordinator;
    causationId?: string;
    now?: () => string;
    nextId?: (namespace: string) => string;
}

Contract members

MemberKindSignatureDescription
abortSignalpropertyabortSignal: AbortSignalPublic property; its type, readonly modifier and optionality are shown in the signature.
activityDispatchPortpropertyactivityDispatchPort: RuntimeActivityDispatchPortPublic property; its type, readonly modifier and optionality are shown in the signature.
attemptpropertyattempt: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
causationIdpropertycausationId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
determinismStorepropertydeterminismStore: RuntimeDeterminismStorePublic property; its type, readonly modifier and optionality are shown in the signature.
eventCommitPortpropertyeventCommitPort: RuntimeEventCommitPortPublic property; its type, readonly modifier and optionality are shown in the signature.
nextIdmethodnextId?(namespace: string): stringPublic method; parameters and return type are shown in the signature.
nowmethodnow?(): stringPublic method; parameters and return type are shown in the signature.
principalpropertyprincipal: RuntimePrincipalPublic property; its type, readonly modifier and optionality are shown in the signature.
processpropertyprocess: FSMProcessSpecPublic property; its type, readonly modifier and optionality are shown in the signature.
resourceCoordinatorpropertyresourceCoordinator: RuntimeResourceCoordinatorPublic property; its type, readonly modifier and optionality are shown in the signature.
runpropertyrun: RuntimeRunPublic property; its type, readonly modifier and optionality are shown in the signature.
runLeasepropertyrunLease: RunLeaseAuthorizationPublic 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.
snapshotpropertysnapshot: FSMSnapshotPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeExecutionContext

Runtime Execution Context interface with 16 public fields or methods.

  • Kind: interface
  • Import: import type { RuntimeExecutionContext } from '@codesoul-co/hypha-harness';
  • Source module: execution-context

Declaration

text
export interface RuntimeExecutionContext {
    readonly scope: Readonly<RuntimeScope>;
    readonly principal: Readonly<RuntimePrincipal>;
    readonly run: Readonly<RuntimeRun>;
    readonly snapshot: Readonly<FSMSnapshot>;
    readonly process: Readonly<FSMProcessSpec>;
    readonly state: Readonly<FSMStateSpec>;
    readonly attempt: number;
    readonly fencingToken: number;
    readonly abortSignal: AbortSignal;
    readonly events: RuntimeEventHelper;
    readonly activities: RuntimeActivityHelper;
    readonly transitions: RuntimeTransitionHelper;
    readonly waits: RuntimeWaitHelper;
    readonly resources: RuntimeResourceHelper;
    readonly clock: RuntimeClockHelper;
    readonly ids: RuntimeIdHelper;
}

Contract members

MemberKindSignatureDescription
abortSignalpropertyreadonly abortSignal: AbortSignalPublic property; its type, readonly modifier and optionality are shown in the signature.
activitiespropertyreadonly activities: RuntimeActivityHelperPublic property; its type, readonly modifier and optionality are shown in the signature.
attemptpropertyreadonly attempt: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
clockpropertyreadonly clock: RuntimeClockHelperPublic property; its type, readonly modifier and optionality are shown in the signature.
eventspropertyreadonly events: RuntimeEventHelperPublic property; its type, readonly modifier and optionality are shown in the signature.
fencingTokenpropertyreadonly fencingToken: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
idspropertyreadonly ids: RuntimeIdHelperPublic property; its type, readonly modifier and optionality are shown in the signature.
principalpropertyreadonly principal: Readonly<RuntimePrincipal>Public property; its type, readonly modifier and optionality are shown in the signature.
processpropertyreadonly process: Readonly<FSMProcessSpec>Public property; its type, readonly modifier and optionality are shown in the signature.
resourcespropertyreadonly resources: RuntimeResourceHelperPublic property; its type, readonly modifier and optionality are shown in the signature.
runpropertyreadonly run: Readonly<RuntimeRun>Public property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyreadonly scope: Readonly<RuntimeScope>Public property; its type, readonly modifier and optionality are shown in the signature.
snapshotpropertyreadonly snapshot: Readonly<FSMSnapshot>Public property; its type, readonly modifier and optionality are shown in the signature.
statepropertyreadonly state: Readonly<FSMStateSpec>Public property; its type, readonly modifier and optionality are shown in the signature.
transitionspropertyreadonly transitions: RuntimeTransitionHelperPublic property; its type, readonly modifier and optionality are shown in the signature.
waitspropertyreadonly waits: RuntimeWaitHelperPublic property; its type, readonly modifier and optionality are shown in the signature.