UNPKG

arvo-event-handler

Version:

A complete set of orthogonal event handler and orchestration primitives for Arvo based applications, featuring declarative state machines (XState), imperative resumables for agentic workflows, contract-based routing, OpenTelemetry observability, and in-me

39 lines (38 loc) 1.81 kB
import type { ArvoOrchestratorContract, VersionedArvoContract } from 'arvo-core'; import { ArvoResumable } from '.'; import type { CreateArvoResumableParam } from './types'; /** * Creates a new {@link ArvoResumable} orchestrator instance. * * Factory function that constructs a resumable workflow handler with automatic * resource locking determination and contract validation. Validates that service * contracts have unique URIs and no circular dependencies exist. * * @param param - Configuration parameters for the resumable * @returns Configured ArvoResumable instance ready for event handling * * @throws {ConfigViolation} When service contracts have duplicate URIs * @throws {ConfigViolation} When circular dependency detected (self contract registered as service) * * @example * ```typescript * const resumable = createArvoResumable({ * contracts: { * self: myOrchestratorContract, * services: { * userService: userContract.version('1.0.0'), * paymentService: paymentContract.version('1.0.0') } * }, * memory: new SimpleMachineMemory(), * handler: { * '1.0.0': async ({ input, service, context }) => { * // Handler implementation * } * }, * }); * ``` * * @see {@link ArvoResumable} For the orchestrator class documentation * @see {@link ArvoResumableHandler} For handler interface details */ export declare const createArvoResumable: <TMemory extends Record<string, any> = Record<string, any>, TSelfContract extends ArvoOrchestratorContract = ArvoOrchestratorContract, TServiceContract extends Record<string, VersionedArvoContract<any, any>> = Record<string, VersionedArvoContract<any, any>>>(param: CreateArvoResumableParam<TMemory, TSelfContract, TServiceContract>) => ArvoResumable<TMemory, TSelfContract, TServiceContract>;