Machine overview
Added in v1.0.0
Table of contents
- combinators
- constructors
- errors
- models
- procedures
- runtime
- symbols
- tags
- tracing
- type ids
combinators
retry
Signature
export declare const retry: {
<M extends Machine.Any, Out, In extends Machine.InitError<M> | MachineDefect, R>(
policy: Schedule.Schedule<Out, In, R>
): (self: M) => Machine.AddContext<M, R>
<M extends Machine.Any, Out, In extends Machine.InitError<M> | MachineDefect, R>(
self: M,
policy: Schedule.Schedule<Out, In, R>
): Machine.AddContext<M, R>
}
Added in v1.0.0
constructors
make
Signature
export declare const make: {
<State, Public extends Procedure.TaggedRequest.Any, Private extends Procedure.TaggedRequest.Any, InitErr, R>(
initialize: Effect.Effect<ProcedureList<State, Public, Private, R>, InitErr, R>
): Machine<State, Public, Private, void, InitErr, Exclude<R, Scope.Scope | MachineContext>>
<State, Public extends Procedure.TaggedRequest.Any, Private extends Procedure.TaggedRequest.Any, Input, InitErr, R>(
initialize: Machine.Initialize<Input, State, Public, Private, R, InitErr, R>
): Machine<State, Public, Private, Input, InitErr, Exclude<R, Scope.Scope | MachineContext>>
}
Added in v1.0.0
makeSerializable
Signature
export declare const makeSerializable: {
<State, IS, RS, Public extends Schema.TaggedRequest.All, Private extends Schema.TaggedRequest.All, InitErr, R>(
options: { readonly state: Schema.Schema<State, IS, RS>; readonly input?: undefined },
initialize:
| Effect.Effect<SerializableProcedureList<State, Public, Private, R>, InitErr, R>
| Machine.InitializeSerializable<void, State, Public, Private, R, InitErr, R>
): SerializableMachine<State, Public, Private, void, InitErr, Exclude<R, Scope.Scope | MachineContext>, RS>
<
State,
IS,
RS,
Input,
II,
RI,
Public extends Schema.TaggedRequest.All,
Private extends Schema.TaggedRequest.All,
InitErr,
R
>(
options: { readonly state: Schema.Schema<State, IS, RS>; readonly input: Schema.Schema<Input, II, RI> },
initialize: Machine.InitializeSerializable<Input, State, Public, Private, R, InitErr, R>
): SerializableMachine<State, Public, Private, Input, InitErr, Exclude<R, Scope.Scope | MachineContext>, RS | RI>
}
Added in v1.0.0
makeWith
Signature
export declare const makeWith: <State, Input = void>() => {
<Public extends Procedure.TaggedRequest.Any, Private extends Procedure.TaggedRequest.Any, InitErr, R>(
initialize: Effect.Effect<ProcedureList<State, Public, Private, R>, InitErr, R>
): Machine<State, Public, Private, void, InitErr, Exclude<R, Scope.Scope | MachineContext>>
<Public extends Procedure.TaggedRequest.Any, Private extends Procedure.TaggedRequest.Any, InitErr, R>(
initialize: Machine.Initialize<Input, State, Public, Private, R, InitErr, R>
): Machine<State, Public, Private, Input, InitErr, Exclude<R, Scope.Scope | MachineContext>>
}
Added in v1.0.0
errors
MachineDefect (class)
Signature
export declare class MachineDefect
Added in v1.0.0
wrap (static method)
Signature
static wrap<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, MachineDefect, R>
Added in v1.0.0
models
Actor (interface)
Signature
export interface Actor<M extends Machine.Any> extends Subscribable.Subscribable<Machine.State<M>> {
readonly [ActorTypeId]: ActorTypeId
readonly machine: M
readonly input: Machine.Input<M>
readonly send: <Req extends Machine.Public<M>>(
request: Req
) => Effect.Effect<Request.Success<Req>, Request.Error<Req>>
readonly join: Effect.Effect<never, Machine.InitError<M> | MachineDefect>
}
Added in v1.0.0
Machine (interface)
Signature
export interface Machine<
State,
Public extends Procedure.TaggedRequest.Any,
Private extends Procedure.TaggedRequest.Any,
Input,
InitErr,
R
> extends Pipeable {
readonly [TypeId]: TypeId
readonly initialize: Machine.Initialize<Input, State, Public, Private, InitErr, R, R>
readonly retryPolicy: Schedule.Schedule<unknown, InitErr | MachineDefect, R> | undefined
}
Added in v1.0.0
Machine (namespace)
Added in v1.0.0
AddContext (type alias)
Signature
export type AddContext<M, R, E = never> =
M extends SerializableMachine<
infer State,
infer Public,
infer Private,
infer Input,
infer InitErr,
infer R2,
infer SR
>
? SerializableMachine<State, Public, Private, Input, InitErr | E, R | R2, SR>
: M extends Machine<infer State, infer Public, infer Private, infer Input, infer InitErr, infer R2>
? Machine<State, Public, Private, Input, InitErr | E, R | R2>
: never
Added in v1.0.0
Any (type alias)
Signature
export type Any =
| Machine<any, any, any, any, any, any>
| Machine<any, any, any, any, never, any>
| Machine<any, never, any, any, never, any>
| Machine<any, any, never, any, never, any>
| Machine<any, never, never, any, never, any>
Added in v1.0.0
Context (type alias)
Signature
export type Context<M> = M extends Machine<infer _S, infer _Pu, infer _Pr, infer _I, infer _IE, infer R> ? R : never
Added in v1.0.0
InitError (type alias)
Signature
export type InitError<M> =
M extends Machine<infer _S, infer _Pu, infer _Pr, infer _I, infer InitErr, infer _R> ? InitErr : never
Added in v1.0.0
Initialize (type alias)
Signature
export type Initialize<
Input,
State,
Public extends Procedure.TaggedRequest.Any,
Private extends Procedure.TaggedRequest.Any,
R,
E,
InitR
> = (
input: Input,
previousState?: State | undefined
) => Effect.Effect<ProcedureList<State, Public, Private, R>, E, InitR>
Added in v1.0.0
InitializeSerializable (type alias)
Signature
export type InitializeSerializable<
Input,
State,
Public extends Schema.TaggedRequest.All,
Private extends Schema.TaggedRequest.All,
R,
E,
InitR
> = (
input: Input,
previousState?: State | undefined
) => Effect.Effect<SerializableProcedureList<State, Public, Private, R>, E, InitR>
Added in v1.0.0
Input (type alias)
Signature
export type Input<M> =
M extends Machine<infer _S, infer _Pu, infer _Pr, infer Input, infer _IE, infer _R> ? Input : never
Added in v1.0.0
Private (type alias)
Signature
export type Private<M> =
M extends Machine<infer _S, infer _Pu, infer Private, infer _I, infer _IE, infer _R> ? Private : never
Added in v1.0.0
Public (type alias)
Signature
export type Public<M> =
M extends Machine<infer _S, infer Public, infer _Pr, infer _I, infer _IE, infer _R> ? Public : never
Added in v1.0.0
State (type alias)
Signature
export type State<M> =
M extends Machine<infer State, infer _Pu, infer _Pr, infer _I, infer _IE, infer _R> ? State : never
Added in v1.0.0
SerializableActor (interface)
Signature
export interface SerializableActor<M extends Machine.Any> extends Actor<M> {
readonly sendUnknown: (
request: unknown
) => Effect.Effect<Schema.ExitEncoded<unknown, unknown, unknown>, ParseResult.ParseError>
}
Added in v1.0.0
SerializableMachine (interface)
Signature
export interface SerializableMachine<
State,
Public extends Schema.TaggedRequest.All,
Private extends Schema.TaggedRequest.All,
Input,
InitErr,
R,
SR
> extends Machine<State, Public, Private, Input, InitErr, R> {
readonly [SerializableTypeId]: SerializableTypeId
readonly schemaInput: Schema.Schema<Input, unknown, SR>
readonly schemaState: Schema.Schema<State, unknown, SR>
}
Added in v1.0.0
procedures
From “./Machine/ProcedureList.js”
Re-exports all named exports from the “./Machine/ProcedureList.js” module as procedures
.
Signature
export * as procedures from "./Machine/ProcedureList.js"
Added in v1.0.0
From “./Machine/SerializableProcedureList.js”
Re-exports all named exports from the “./Machine/SerializableProcedureList.js” module as serializable
.
Signature
export * as serializable from "./Machine/SerializableProcedureList.js"
Added in v1.0.0
runtime
boot
Signature
export declare const boot: <M extends Machine.Any>(
self: M,
...[input, options]: [Machine.Input<M>] extends [void]
? [input?: Machine.Input<M>, options?: { readonly previousState?: Machine.State<M> }]
: [input: Machine.Input<M>, options?: { readonly previousState?: Machine.State<M> }]
) => Effect.Effect<
M extends { readonly [SerializableTypeId]: SerializableTypeId } ? SerializableActor<M> : Actor<M>,
never,
Machine.Context<M> | Scope.Scope
>
Added in v1.0.0
restore
Signature
export declare const restore: <
State,
Public extends Schema.TaggedRequest.All,
Private extends Schema.TaggedRequest.All,
Input,
InitErr,
R,
SR
>(
self: SerializableMachine<State, Public, Private, Input, InitErr, R, SR>,
snapshot: readonly [input: unknown, state: unknown]
) => Effect.Effect<
Actor<SerializableMachine<State, Public, Private, Input, InitErr, R, SR>>,
ParseResult.ParseError,
R | SR
>
Added in v1.0.0
snapshot
Signature
export declare const snapshot: <
State,
Public extends Schema.TaggedRequest.All,
Private extends Schema.TaggedRequest.All,
Input,
InitErr,
R,
SR
>(
self: Actor<SerializableMachine<State, Public, Private, Input, InitErr, R, SR>>
) => Effect.Effect<[input: unknown, state: unknown], ParseResult.ParseError, SR>
Added in v1.0.0
symbols
NoReply
Signature
export declare const NoReply: typeof Procedure.NoReply
Added in v1.0.0
tags
MachineContext (class)
Signature
export declare class MachineContext
Added in v1.0.0
tracing
currentTracingEnabled
Signature
export declare const currentTracingEnabled: FiberRef.FiberRef<boolean>
Added in v1.0.0
withTracingEnabled
Signature
export declare const withTracingEnabled: {
(enabled: boolean): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
<A, E, R>(effect: Effect.Effect<A, E, R>, enabled: boolean): Effect.Effect<A, E, R>
}
Added in v1.0.0
type ids
ActorTypeId
Signature
export declare const ActorTypeId: typeof ActorTypeId
Added in v1.0.0
ActorTypeId (type alias)
Signature
export type ActorTypeId = typeof ActorTypeId
Added in v1.0.0
SerializableTypeId
Signature
export declare const SerializableTypeId: typeof SerializableTypeId
Added in v1.0.0
SerializableTypeId (type alias)
Signature
export type SerializableTypeId = typeof SerializableTypeId
Added in v1.0.0
TypeId
Signature
export declare const TypeId: typeof TypeId
Added in v1.0.0
TypeId (type alias)
Signature
export type TypeId = typeof TypeId
Added in v1.0.0