//#region src/channels/channels.d.ts /** * Workflow channel kinds. Every state field declared on a workflow's * `stateSchema` is bound to a channel that decides the merge strategy * applied when multiple writers update the same field within a single * execution step. * * The names are **Graphorin's own design** and must not be aliased to * terms from other workflow libraries. A dedicated lint rule lands later * in the release line to enforce this. * * @stable */ type ChannelKind = 'latest-value' | 'any-value' | 'reducer' | 'list-aggregate' | 'stream' | 'barrier' | 'ephemeral'; /** * Discriminated union of every channel descriptor. * * Channels are a *description* of the merge strategy, not a runtime * value: the engine reads the `kind` field plus optional auxiliary * fields (`reduce`, `from`, `unique`) to decide how to combine writes. * * @stable */ type Channel = LatestValue | AnyValue | Reducer | ListAggregate | Stream | Barrier | Ephemeral; /** * Overwrite-on-write. Multiple writes within the same execution step * raise `MultiWriteError` (use `AnyValue` if collisions are acceptable). * * @stable */ interface LatestValue { readonly kind: 'latest-value'; readonly default?: T; } /** * Overwrite-on-write - collisions are silently allowed (last-write-wins * semantics within a step). * * @stable */ interface AnyValue { readonly kind: 'any-value'; readonly default?: T; } /** * Fold writes via a user-provided `reduce` function. The reducer is * invoked left-to-right over the writes collected within an execution * step. * * @stable */ interface Reducer { readonly kind: 'reducer'; readonly default?: T; readonly reduce: (prev: T, next: T) => T; } /** * Specialization of `Reducer` that appends each write to a list. * * @stable */ interface ListAggregate { readonly kind: 'list-aggregate'; readonly default?: ReadonlyArray; } /** * Append-only queue. Used for dynamic task creation via `Dispatch(...)` * and for application-defined event streams. * * @stable */ interface Stream { readonly kind: 'stream'; readonly unique?: boolean; readonly default?: ReadonlyArray; } /** * Barrier - completes when every writer in `from` has produced a value. * * @stable */ interface Barrier { readonly kind: 'barrier'; readonly from: ReadonlyArray; readonly default?: T; } /** * Value scoped to a single execution step - discarded when the step * ends. * * @stable */ interface Ephemeral { readonly kind: 'ephemeral'; readonly default?: T; } /** * Construct a `LatestValue` channel. * * @stable */ declare function latestValue(opts?: { readonly default?: T; }): LatestValue; /** * Construct an `AnyValue` channel. * * @stable */ declare function anyValue(opts?: { readonly default?: T; }): AnyValue; /** * Construct a `Reducer` channel. * * @stable */ declare function reducer(reduce: (prev: T, next: T) => T, opts?: { readonly default?: T; }): Reducer; /** * Construct a `ListAggregate` channel. * * @stable */ declare function listAggregate(opts?: { readonly default?: ReadonlyArray; }): ListAggregate; /** * Construct a `Stream` channel. * * @stable */ declare function stream(opts?: { readonly unique?: boolean; readonly default?: ReadonlyArray; }): Stream; /** * Construct a `Barrier` channel. * * @stable */ declare function barrier(from: ReadonlyArray, opts?: { readonly default?: T; }): Barrier; /** * Construct an `Ephemeral` channel. * * @stable */ declare function ephemeral(opts?: { readonly default?: T; }): Ephemeral; //#endregion export { AnyValue, Barrier, Channel, ChannelKind, Ephemeral, LatestValue, ListAggregate, Reducer, Stream, anyValue, barrier, ephemeral, latestValue, listAggregate, reducer, stream }; //# sourceMappingURL=channels.d.ts.map