import * as Context from "effect/Context"; import * as Effect from "effect/Effect"; import * as FiberRef from "effect/FiberRef"; import type * as ParseResult from "effect/ParseResult"; import type { Pipeable } from "effect/Pipeable"; import type { Request } from "effect/Request"; import type * as Schedule from "effect/Schedule"; import * as Schema from "effect/Schema"; import type * as Scope from "effect/Scope"; import * as Subscribable from "effect/Subscribable"; import * as Procedure from "./Machine/Procedure.js"; import type { ProcedureList } from "./Machine/ProcedureList.js"; import type { SerializableProcedureList } from "./Machine/SerializableProcedureList.js"; /** * @since 1.0.0 * @category procedures */ export * as procedures from "./Machine/ProcedureList.js"; /** * @since 1.0.0 * @category procedures */ export * as serializable from "./Machine/SerializableProcedureList.js"; export { /** * @since 1.0.0 * @category symbols */ NoReply } from "./Machine/Procedure.js"; /** * @since 1.0.0 * @category type ids */ export declare const TypeId: unique symbol; /** * @since 1.0.0 * @category type ids */ export type TypeId = typeof TypeId; /** * @since 1.0.0 * @category models */ export interface Machine extends Pipeable { readonly [TypeId]: TypeId; readonly initialize: Machine.Initialize; readonly retryPolicy: Schedule.Schedule | undefined; } /** * @since 1.0.0 * @category type ids */ export declare const SerializableTypeId: unique symbol; /** * @since 1.0.0 * @category type ids */ export type SerializableTypeId = typeof SerializableTypeId; /** * @since 1.0.0 * @category models */ export interface SerializableMachine extends Machine { readonly [SerializableTypeId]: SerializableTypeId; readonly schemaInput: Schema.Schema; readonly schemaState: Schema.Schema; } /** * @since 1.0.0 * @category type ids */ export declare const ActorTypeId: unique symbol; /** * @since 1.0.0 * @category type ids */ export type ActorTypeId = typeof ActorTypeId; declare const MachineDefect_base: Schema.TaggedErrorClass; } & { cause: typeof Schema.Defect; }>; /** * @since 1.0.0 * @category errors */ export declare class MachineDefect extends MachineDefect_base { /** * @since 1.0.0 */ static wrap(effect: Effect.Effect): Effect.Effect; } declare const MachineContext_base: Context.TagClass; /** * @since 1.0.0 * @category tags */ export declare class MachineContext extends MachineContext_base { } /** * @since 1.0.0 * @category models */ export declare namespace Machine { /** * @since 1.0.0 * @category models */ type Any = Machine | Machine | Machine | Machine | Machine; /** * @since 1.0.0 * @category models */ type Initialize = (input: Input, previousState?: State | undefined) => Effect.Effect, E, InitR>; /** * @since 1.0.0 * @category models */ type InitializeSerializable = (input: Input, previousState?: State | undefined) => Effect.Effect, E, InitR>; /** * @since 1.0.0 */ type Public = M extends Machine ? Public : never; /** * @since 1.0.0 */ type Private = M extends Machine ? Private : never; /** * @since 1.0.0 */ type State = M extends Machine ? State : never; /** * @since 1.0.0 */ type InitError = M extends Machine ? InitErr : never; /** * @since 1.0.0 */ type Context = M extends Machine ? R : never; /** * @since 1.0.0 */ type Input = M extends Machine ? Input : never; /** * @since 1.0.0 */ type AddContext = M extends SerializableMachine ? SerializableMachine : M extends Machine ? Machine : never; } /** * @since 1.0.0 * @category models */ export interface Actor extends Subscribable.Subscribable> { readonly [ActorTypeId]: ActorTypeId; readonly machine: M; readonly input: Machine.Input; readonly send: >(request: Req) => Effect.Effect, Request.Error>; readonly join: Effect.Effect | MachineDefect>; } /** * @since 1.0.0 * @category models */ export interface SerializableActor extends Actor { readonly sendUnknown: (request: unknown) => Effect.Effect, ParseResult.ParseError>; } /** * @since 1.0.0 * @category constructors */ export declare const make: { /** * @since 1.0.0 * @category constructors */ (initialize: Effect.Effect, InitErr, R>): Machine>; /** * @since 1.0.0 * @category constructors */ (initialize: Machine.Initialize): Machine>; }; /** * @since 1.0.0 * @category constructors */ export declare const makeWith: () => { (initialize: Effect.Effect, InitErr, R>): Machine>; (initialize: Machine.Initialize): Machine>; }; /** * @since 1.0.0 * @category constructors */ export declare const makeSerializable: { /** * @since 1.0.0 * @category constructors */ (options: { readonly state: Schema.Schema; readonly input?: undefined; }, initialize: Effect.Effect, InitErr, R> | Machine.InitializeSerializable): SerializableMachine, RS>; /** * @since 1.0.0 * @category constructors */ (options: { readonly state: Schema.Schema; readonly input: Schema.Schema; }, initialize: Machine.InitializeSerializable): SerializableMachine, RS | RI>; }; /** * @since 1.0.0 * @category combinators */ export declare const retry: { /** * @since 1.0.0 * @category combinators */ | MachineDefect, R>(policy: Schedule.Schedule): (self: M) => Machine.AddContext; /** * @since 1.0.0 * @category combinators */ | MachineDefect, R>(self: M, policy: Schedule.Schedule): Machine.AddContext; }; /** * @since 1.0.0 * @category tracing */ export declare const currentTracingEnabled: FiberRef.FiberRef; /** * @since 1.0.0 * @category tracing */ export declare const withTracingEnabled: { /** * @since 1.0.0 * @category tracing */ (enabled: boolean): (effect: Effect.Effect) => Effect.Effect; /** * @since 1.0.0 * @category tracing */ (effect: Effect.Effect, enabled: boolean): Effect.Effect; }; /** * @since 1.0.0 * @category runtime */ export declare const boot: (self: M, ...[input, options]: [Machine.Input] extends [void] ? [input?: Machine.Input, options?: { readonly previousState?: Machine.State; }] : [input: Machine.Input, options?: { readonly previousState?: Machine.State; }]) => Effect.Effect : Actor, never, Machine.Context | Scope.Scope>; /** * @since 1.0.0 * @category runtime */ export declare const snapshot: (self: Actor>) => Effect.Effect<[input: unknown, state: unknown], ParseResult.ParseError, SR>; /** * @since 1.0.0 * @category runtime */ export declare const restore: (self: SerializableMachine, snapshot: readonly [input: unknown, state: unknown]) => Effect.Effect>, ParseResult.ParseError, R | SR>; //# sourceMappingURL=Machine.d.ts.map