@codesoul-co/hypha-core / contracts/runtime-cancellation
- Package index:
@codesoul-co/hypha-core - Source:
packages/core/src/contracts/runtime-cancellation.ts - Exports: 18
Using this module
Use the Runtime cancellation module for declaring and runtime-validating contracts. It exports 4 constants, 10 interfaces, 4 types.
Import from the package entrypoint
import {
RUNTIME_CANCELLATION_DISPOSITIONS,
RUNTIME_CANCELLATION_PROPAGATIONS,
RUNTIME_CANCELLATION_TARGET_STATUSES,
RUNTIME_CANCELLATION_TARGET_TYPES,
} from '@codesoul-co/hypha-core';
import type {
RuntimeActivityCancellationPort,
RuntimeActivityCancellationRequest,
RuntimeCancelCommand,
RuntimeCancellationPolicy,
RuntimeCancellationTargetResult,
RuntimeCancelResult,
RuntimeChildRunCancellationPort,
RuntimeChildRunCancellationRequest,
} from '@codesoul-co/hypha-core';
// The complete export list is documented below.Usage patterns
- Use the 14 type/interface exports as static contracts in application code, adapters, or tests. Import them with
import type; they do not exist at runtime. - The 4 constant/enum exports provide stable values, schemas, definitions, or defaults. Reuse these exports instead of copying internal values into an application.
Public exports
| Symbol | Kind | Signature | Description |
|---|---|---|---|
RUNTIME_CANCELLATION_DISPOSITIONS | constant | const RUNTIME_CANCELLATION_DISPOSITIONS: readonly ["applied", "reused"] | RUNTIME CANCELLATION DISPOSITIONS constant exported by the contracts/runtime-cancellation module. |
RUNTIME_CANCELLATION_PROPAGATIONS | constant | const RUNTIME_CANCELLATION_PROPAGATIONS: readonly ["none", "children", "all_descendants"] | RUNTIME CANCELLATION PROPAGATIONS constant exported by the contracts/runtime-cancellation module. |
RUNTIME_CANCELLATION_TARGET_STATUSES | constant | const RUNTIME_CANCELLATION_TARGET_STATUSES: readonly ["cancelled", "already_terminal", "not_found", "failed"] | RUNTIME CANCELLATION TARGET STATUSES constant exported by the contracts/runtime-cancellation module. |
RUNTIME_CANCELLATION_TARGET_TYPES | constant | const RUNTIME_CANCELLATION_TARGET_TYPES: readonly ["activity", "child_run", "session_command"] | RUNTIME CANCELLATION TARGET TYPES constant exported by the contracts/runtime-cancellation module. |
RuntimeActivityCancellationPort | interface | interface RuntimeActivityCancellationPort | Runtime Activity Cancellation Port interface with 1 public fields or methods. |
RuntimeActivityCancellationRequest | interface | interface RuntimeActivityCancellationRequest | Runtime Activity Cancellation Request interface with 7 public fields or methods. |
RuntimeCancelCommand | interface | interface RuntimeCancelCommand | Runtime Cancel Command interface with 9 public fields or methods. |
RuntimeCancellationPolicy | interface | interface RuntimeCancellationPolicy | Runtime Cancellation Policy interface with 3 public fields or methods. |
RuntimeCancellationTargetResult | interface | interface RuntimeCancellationTargetResult | Runtime Cancellation Target Result interface with 4 public fields or methods. |
RuntimeCancelResult | interface | interface RuntimeCancelResult | Runtime Cancel Result interface with 6 public fields or methods. |
RuntimeChildRunCancellationPort | interface | interface RuntimeChildRunCancellationPort | Runtime Child Run Cancellation Port interface with 2 public fields or methods. |
RuntimeChildRunCancellationRequest | interface | interface RuntimeChildRunCancellationRequest | Runtime Child Run Cancellation Request interface with 8 public fields or methods. |
RuntimeChildRunListRequest | interface | interface RuntimeChildRunListRequest | Runtime Child Run List Request interface with 2 public fields or methods. |
RuntimeChildRunReference | interface | interface RuntimeChildRunReference | Runtime Child Run Reference interface with 1 public fields or methods. |
RuntimeCancellationDisposition | type | type RuntimeCancellationDisposition = (typeof RUNTIME_CANCELLATION_DISPOSITIONS)[number] | Public type alias for Runtime Cancellation Disposition; the declaration contains its complete type expression. |
RuntimeCancellationPropagation | type | type RuntimeCancellationPropagation = (typeof RUNTIME_CANCELLATION_PROPAGATIONS)[number] | Public type alias for Runtime Cancellation Propagation; the declaration contains its complete type expression. |
RuntimeCancellationTargetStatus | type | type RuntimeCancellationTargetStatus = (typeof RUNTIME_CANCELLATION_TARGET_STATUSES)[number] | Public type alias for Runtime Cancellation Target Status; the declaration contains its complete type expression. |
RuntimeCancellationTargetType | type | type RuntimeCancellationTargetType = (typeof RUNTIME_CANCELLATION_TARGET_TYPES)[number] | Public type alias for Runtime Cancellation Target Type; the declaration contains its complete type expression. |
RUNTIME_CANCELLATION_DISPOSITIONS
RUNTIME CANCELLATION DISPOSITIONS constant exported by the contracts/runtime-cancellation module.
- Kind: constant
- Import:
import { RUNTIME_CANCELLATION_DISPOSITIONS } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export declare const RUNTIME_CANCELLATION_DISPOSITIONS: readonly ["applied", "reused"];RUNTIME_CANCELLATION_PROPAGATIONS
RUNTIME CANCELLATION PROPAGATIONS constant exported by the contracts/runtime-cancellation module.
- Kind: constant
- Import:
import { RUNTIME_CANCELLATION_PROPAGATIONS } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export declare const RUNTIME_CANCELLATION_PROPAGATIONS: readonly ["none", "children", "all_descendants"];RUNTIME_CANCELLATION_TARGET_STATUSES
RUNTIME CANCELLATION TARGET STATUSES constant exported by the contracts/runtime-cancellation module.
- Kind: constant
- Import:
import { RUNTIME_CANCELLATION_TARGET_STATUSES } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export declare const RUNTIME_CANCELLATION_TARGET_STATUSES: readonly ["cancelled", "already_terminal", "not_found", "failed"];RUNTIME_CANCELLATION_TARGET_TYPES
RUNTIME CANCELLATION TARGET TYPES constant exported by the contracts/runtime-cancellation module.
- Kind: constant
- Import:
import { RUNTIME_CANCELLATION_TARGET_TYPES } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export declare const RUNTIME_CANCELLATION_TARGET_TYPES: readonly ["activity", "child_run", "session_command"];RuntimeActivityCancellationPort
Runtime Activity Cancellation Port interface with 1 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeActivityCancellationPort } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export interface RuntimeActivityCancellationPort {
cancel(request: RuntimeActivityCancellationRequest): Promise<RuntimeCancellationTargetResult>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
cancel | method | cancel(request: RuntimeActivityCancellationRequest): Promise<RuntimeCancellationTargetResult> | Public method; parameters and return type are shown in the signature. |
RuntimeActivityCancellationRequest
Runtime Activity Cancellation Request interface with 7 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeActivityCancellationRequest } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export interface RuntimeActivityCancellationRequest {
scope: RuntimeScope;
activityId: string;
reason: string;
requestedAt: string;
deadlineAt?: string;
fencingToken: number;
idempotencyKey: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
activityId | property | activityId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
deadlineAt | property | deadlineAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
fencingToken | property | fencingToken: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
idempotencyKey | property | idempotencyKey: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
reason | property | reason: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
requestedAt | property | requestedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: RuntimeScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeCancelCommand
Runtime Cancel Command interface with 9 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCancelCommand } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export interface RuntimeCancelCommand {
commandId: string;
scope: RuntimeScope;
principal: RuntimePrincipal;
ownerId: string;
leaseTtlMs: number;
reason: string;
policy: RuntimeCancellationPolicy;
requestedAt: string;
idempotencyKey?: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
commandId | property | commandId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
idempotencyKey | property | idempotencyKey?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
leaseTtlMs | property | leaseTtlMs: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
ownerId | property | ownerId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
policy | property | policy: RuntimeCancellationPolicy | Public property; its type, readonly modifier and optionality are shown in the signature. |
principal | property | principal: RuntimePrincipal | Public property; its type, readonly modifier and optionality are shown in the signature. |
reason | property | reason: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
requestedAt | property | requestedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: RuntimeScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeCancellationPolicy
Runtime Cancellation Policy interface with 3 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCancellationPolicy } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export interface RuntimeCancellationPolicy {
propagation: RuntimeCancellationPropagation;
cancelRunningActivities: boolean;
waitGraceMs?: number;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
cancelRunningActivities | property | cancelRunningActivities: boolean | Public property; its type, readonly modifier and optionality are shown in the signature. |
propagation | property | propagation: "none" | "children" | "all_descendants" | Public property; its type, readonly modifier and optionality are shown in the signature. |
waitGraceMs | property | waitGraceMs?: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeCancellationTargetResult
Runtime Cancellation Target Result interface with 4 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCancellationTargetResult } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export interface RuntimeCancellationTargetResult {
targetType: RuntimeCancellationTargetType;
targetId: string;
status: RuntimeCancellationTargetStatus;
error?: NormalizedRuntimeError;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
error | property | error?: NormalizedRuntimeError | Public property; its type, readonly modifier and optionality are shown in the signature. |
status | property | status: "cancelled" | "failed" | "not_found" | "already_terminal" | Public property; its type, readonly modifier and optionality are shown in the signature. |
targetId | property | targetId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
targetType | property | targetType: "activity" | "child_run" | "session_command" | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeCancelResult
Runtime Cancel Result interface with 6 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeCancelResult } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export interface RuntimeCancelResult {
commandId: string;
disposition: RuntimeCancellationDisposition;
eventIds: string[];
targetResults: RuntimeCancellationTargetResult[];
unresolvedActivityIds: string[];
projection: RuntimeOrchestrationProjection;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
commandId | property | commandId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
disposition | property | disposition: "applied" | "reused" | Public property; its type, readonly modifier and optionality are shown in the signature. |
eventIds | property | eventIds: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
projection | property | projection: RuntimeOrchestrationProjection | Public property; its type, readonly modifier and optionality are shown in the signature. |
targetResults | property | targetResults: RuntimeCancellationTargetResult[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
unresolvedActivityIds | property | unresolvedActivityIds: string[] | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeChildRunCancellationPort
Runtime Child Run Cancellation Port interface with 2 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeChildRunCancellationPort } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export interface RuntimeChildRunCancellationPort {
listChildren(request: RuntimeChildRunListRequest): Promise<RuntimeChildRunReference[]>;
cancel(request: RuntimeChildRunCancellationRequest): Promise<RuntimeCancellationTargetResult>;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
cancel | method | cancel(request: RuntimeChildRunCancellationRequest): Promise<RuntimeCancellationTargetResult> | Public method; parameters and return type are shown in the signature. |
listChildren | method | listChildren(request: RuntimeChildRunListRequest): Promise<RuntimeChildRunReference[]> | Public method; parameters and return type are shown in the signature. |
RuntimeChildRunCancellationRequest
Runtime Child Run Cancellation Request interface with 8 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeChildRunCancellationRequest } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export interface RuntimeChildRunCancellationRequest {
parentScope: RuntimeScope;
childRunId: string;
reason: string;
propagation: Exclude<RuntimeCancellationPropagation, 'none'>;
requestedAt: string;
deadlineAt?: string;
fencingToken: number;
idempotencyKey: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
childRunId | property | childRunId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
deadlineAt | property | deadlineAt?: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
fencingToken | property | fencingToken: number | Public property; its type, readonly modifier and optionality are shown in the signature. |
idempotencyKey | property | idempotencyKey: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
parentScope | property | parentScope: RuntimeScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
propagation | property | propagation: "children" | "all_descendants" | Public property; its type, readonly modifier and optionality are shown in the signature. |
reason | property | reason: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
requestedAt | property | requestedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeChildRunListRequest
Runtime Child Run List Request interface with 2 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeChildRunListRequest } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export interface RuntimeChildRunListRequest {
scope: RuntimeScope;
requestedAt: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
requestedAt | property | requestedAt: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
scope | property | scope: RuntimeScope | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeChildRunReference
Runtime Child Run Reference interface with 1 public fields or methods.
- Kind: interface
- Import:
import type { RuntimeChildRunReference } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export interface RuntimeChildRunReference {
runId: string;
}Contract members
| Member | Kind | Signature | Description |
|---|---|---|---|
runId | property | runId: string | Public property; its type, readonly modifier and optionality are shown in the signature. |
RuntimeCancellationDisposition
Public type alias for Runtime Cancellation Disposition; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { RuntimeCancellationDisposition } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export type RuntimeCancellationDisposition = (typeof RUNTIME_CANCELLATION_DISPOSITIONS)[number];RuntimeCancellationPropagation
Public type alias for Runtime Cancellation Propagation; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { RuntimeCancellationPropagation } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export type RuntimeCancellationPropagation = (typeof RUNTIME_CANCELLATION_PROPAGATIONS)[number];RuntimeCancellationTargetStatus
Public type alias for Runtime Cancellation Target Status; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { RuntimeCancellationTargetStatus } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export type RuntimeCancellationTargetStatus = (typeof RUNTIME_CANCELLATION_TARGET_STATUSES)[number];RuntimeCancellationTargetType
Public type alias for Runtime Cancellation Target Type; the declaration contains its complete type expression.
- Kind: type
- Import:
import type { RuntimeCancellationTargetType } from '@codesoul-co/hypha-core'; - Source module:
contracts/runtime-cancellation
Declaration
export type RuntimeCancellationTargetType = (typeof RUNTIME_CANCELLATION_TARGET_TYPES)[number];