ProcessServiceDefinition<Self, Id, E, R>Canonical process service declaration.
export interface interface ProcessServiceDefinition<Self, Id extends string, E, R>Canonical process service declaration.
ProcessServiceDefinition<function (type parameter) Self in ProcessServiceDefinition<Self, Id extends string, E, R>Self, function (type parameter) Id in ProcessServiceDefinition<Self, Id extends string, E, R>Id extends string, function (type parameter) E in ProcessServiceDefinition<Self, Id extends string, E, R>E, function (type parameter) R in ProcessServiceDefinition<Self, Id extends string, E, R>R>
extends import ContextContext.interface ServiceClass<in out Self, in out Identifier extends string, in out Shape>Class-style service key produced by Context.Service<Self, Shape>()("Id").
When to use
Use when declaring a service as a class so the class value can serve as the
Context key.
Details
The class itself is the Context key, and its string key identifies the
service at runtime.
Namespace containing helper types for class-style Context.Service
declarations.
ServiceClass<function (type parameter) Self in ProcessServiceDefinition<Self, Id extends string, E, R>Self, function (type parameter) Id in ProcessServiceDefinition<Self, Id extends string, E, R>Id, interface Process<out R>Managed process handle for the process manager.
Process<function (type parameter) R in ProcessServiceDefinition<Self, Id extends string, E, R>R>>,
interface ProcessDefinition<out Id extends string, out R>Canonical process declaration that can be registered with a typed
the process manager.
ProcessDefinition<function (type parameter) Id in ProcessServiceDefinition<Self, Id extends string, E, R>Id, function (type parameter) R in ProcessServiceDefinition<Self, Id extends string, E, R>R> {
readonly ProcessServiceDefinition<Self, Id extends string, E, R>.tag: Context.Key<Self, Process<R>>(property) ProcessServiceDefinition<Self, Id extends string, E, R>.tag: {
key: string;
Service: {
name: string;
type: "managed";
effect: Effect.Effect<void, never, R>;
run: () => Effect.Effect<unknown, never, R>;
snapshot: Effect.Effect<ProcessSnapshot>;
events: Stream.Stream<ProcessLiveEvent>;
polling: { readonly wake: Effect.Effect<void>; readonly resetCadence: Effect.Effect<void> };
};
Identifier: Identifier;
stack: string | undefined;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
tag: import ContextContext.interface Key<out Identifier, out Shape>Typed identifier for a service stored in a Context.
When to use
Use as the typed handle for storing, retrieving, and requiring a specific
service in a Context.
Details
Identifier tracks the requirement in Effect types, while Shape is the
service implementation retrieved by the key. A key is also an Effect value,
so yielding it inside Effect.gen retrieves the service from the current
fiber context.
Key<function (type parameter) Self in ProcessServiceDefinition<Self, Id extends string, E, R>Self, interface Process<out R>Managed process handle for the process manager.
Process<function (type parameter) R in ProcessServiceDefinition<Self, Id extends string, E, R>R>>;
readonly ProcessServiceDefinition<Self, Id extends string, E, R>.layer: Layer.Layer<Self, never, never>(property) ProcessServiceDefinition<Self, Id extends string, E, R>.layer: {
build: (memoMap: Layer.MemoMap, scope: Scope.Scope) => Effect.Effect<Context.Context<Self>, never, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
layer: import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<function (type parameter) Self in ProcessServiceDefinition<Self, Id extends string, E, R>Self>;
/**
* Factory defaults before {@link configure} layers (see `HyperlinkConfigure` module).
*/
readonly ProcessServiceDefinition<Self, Id extends string, E, R>.defaultSpec: ProcessMakeOptions<E, R>(property) ProcessServiceDefinition<Self, Id extends string, E, R>.defaultSpec: {
effect: Effect.Effect<void, E, RUser>;
_store: ProcessStoreWriter;
_storeScopeTag: StoreScopeTag;
_resultRef: SubscriptionRef.SubscriptionRef<Option.Option<unknown>>;
polling: AnyPollingLayer;
schedule: ProcessScheduleInitializer<RUser> | AnyScheduleLayer;
scheduleLayer: AnyScheduleLayer;
}
Factory defaults before
configure
layers (see HyperlinkConfigure module).
defaultSpec: interface ProcessMakeOptions<E, RUser>Configuration for
Process.make
when using the config-object form (id is separate).
ProcessMakeOptions<function (type parameter) E in ProcessServiceDefinition<Self, Id extends string, E, R>E, function (type parameter) R in ProcessServiceDefinition<Self, Id extends string, E, R>R>;
/**
* Append a configure patch; merge with {@link layer} via `Layer.provideMerge`.
*/
readonly ProcessServiceDefinition<Self, Id extends string, E, R>.configure: (patch: ConfigPatch<ProcessMakeOptions<E, R>>) => Layer.Layer<never>Append a configure patch; merge with
layer
via Layer.provideMerge.
configure: (
patch: ConfigPatch<ProcessMakeOptions<E, R>>patch: import ConfigPatchConfigPatch<interface ProcessMakeOptions<E, RUser>Configuration for
Process.make
when using the config-object form (id is separate).
ProcessMakeOptions<function (type parameter) E in ProcessServiceDefinition<Self, Id extends string, E, R>E, function (type parameter) R in ProcessServiceDefinition<Self, Id extends string, E, R>R>>,
) => import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<never>;
/**
* Patch only the supervised repeat `effect`: `fn(previous) => next`.
*/
readonly ProcessServiceDefinition<Self, Id extends string, E, R>.wrapEffect: (fn: (previous: ProcessMakeOptions<E, R>["effect"]) => ProcessMakeOptions<E, R>["effect"]) => Layer.Layer<never>Patch only the supervised repeat effect: fn(previous) => next.
wrapEffect: (
fn: (
previous: ProcessMakeOptions<E, R>["effect"]
) => ProcessMakeOptions<E, R>["effect"]
fn: (
previous: ProcessMakeOptions<E, R>["effect"](parameter) previous: {
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
previous: interface ProcessMakeOptions<E, RUser>Configuration for
Process.make
when using the config-object form (id is separate).
ProcessMakeOptions<function (type parameter) E in ProcessServiceDefinition<Self, Id extends string, E, R>E, function (type parameter) R in ProcessServiceDefinition<Self, Id extends string, E, R>R>["effect"],
) => interface ProcessMakeOptions<E, RUser>Configuration for
Process.make
when using the config-object form (id is separate).
ProcessMakeOptions<function (type parameter) E in ProcessServiceDefinition<Self, Id extends string, E, R>E, function (type parameter) R in ProcessServiceDefinition<Self, Id extends string, E, R>R>["effect"],
) => import LayerLayer.interface Layer<in ROut, out E = never, out RIn = never>A Layer describes how to build one or more services for dependency injection.
When to use
Use to model construction of application services for dependency injection,
especially when services have dependencies, can fail during construction, or
need scoped setup and release.
Details
A Layer<ROut, E, RIn> represents ROut as the services this layer
provides, E as the possible errors during layer construction, and RIn as
the services this layer requires as dependencies.
Layer<never>;
/**
* {@link Process} built from {@link defaultSpec} after folding configure patches.
* the process manager uses this when assembling the group runtime.
*/
readonly ProcessServiceDefinition<Self, Id extends string, E, R>.buildConfiguredProcess: Effect.Effect<Process<R>>(property) ProcessServiceDefinition<Self, Id extends string, E, R>.buildConfiguredProcess: {
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
Process
built from
defaultSpec
after folding configure patches.
the process manager uses this when assembling the group runtime.
buildConfiguredProcess: import EffectEffect.interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<interface Process<out R>Managed process handle for the process manager.
Process<function (type parameter) R in ProcessServiceDefinition<Self, Id extends string, E, R>R>>;
}