<
Self,
F extends QueueItemFields = QueueItemFields,
R = never,
RR = never,
Success extends Schema.Top = Schema.Void,
Error extends Schema.Top = Schema.Never
>(
tag: QueueTagFor<Self, F, Success, Error>,
patch: ConfigPatch<
QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>
>
): Layer.Layer<never>
<
Self,
F extends PriorityItemFields = PriorityItemFields,
E = never,
R = never,
RR = never
>(
tag: HyperlinkTag<Self, PriorityInstanceSpec<F>>,
patch: ConfigPatch<
PriorityLayerConfig<Schema.Struct<F>["Type"], E, R, RR>
>
): Layer.Layer<never>A config-patch layer for the WorkPool tag — the toolkit successor to the old
WorkPool.Service(...).configure(...). Merge it with the queue's layer (e.g. per
environment) and its patch (concurrency / rateLimit / attempts / …) folds onto the layer's base
config at build. Keyed by tag.key; later patches win. Config lives in the layer, not the tag,
so configure takes the tag and returns a layer rather than being a tag method.
const Prod = Layer.mergeAll(
WorkPool.layer(MyQueue, { effect }),
WorkPool.configure(MyQueue, { concurrency: 3, rateLimit: { window: "1 second", limit: 5 } }),
);export function function configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never> (+1 overload)A config-patch layer for the WorkPool tag — the toolkit successor to the old
WorkPool.Service(...).configure(...). Merge it with the queue's
layer
(e.g. per
environment) and its patch (concurrency / rateLimit / attempts / …) folds onto the layer's base
config at build. Keyed by tag.key; later patches win. Config lives in the layer, not the tag,
so configure takes the tag and returns a layer rather than being a tag method.
const Prod = Layer.mergeAll(
WorkPool.layer(MyQueue, { effect }),
WorkPool.configure(MyQueue, { concurrency: 3, rateLimit: { window: "1 second", limit: 5 } }),
);
configure<
function (type parameter) Self in configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never>Self,
function (type parameter) F in configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never>F extends type QueueItemFields = {
[x: string]: Schema.Codec<
unknown,
unknown,
never,
never
>
}
The item-schema constraint shared by
layer
/
serve
/
serveRemote
.
QueueItemFields = type QueueItemFields = {
[x: string]: Schema.Codec<
unknown,
unknown,
never,
never
>
}
The item-schema constraint shared by
layer
/
serve
/
serveRemote
.
QueueItemFields,
function (type parameter) R in configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never>R = never,
function (type parameter) RR in configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never>RR = never,
function (type parameter) Success in configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never>Success extends import SchemaSchema.Top = typeof import SchemaSchema.const Void: Voidconst Void: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<void, readonly []>) => Schema.Void;
annotateKey: (annotations: Schema.Annotations.Key<void>) => Schema.Void;
check: (checks_0: Check<void>, ...checks: Array<Check<void>>) => Schema.Void;
rebuild: (ast: Void) => Schema.Void;
make: (input: void, options?: MakeOptions) => void;
makeOption: (input: void, options?: MakeOptions) => Option_.Option<void>;
makeEffect: (input: void, options?: MakeOptions) => Effect.Effect<void, SchemaError, 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; <…;
}
Type-level representation of
Void
.
Schema for a TypeScript void return value.
When to use
Use when you need to model the return value of a function, RPC, or endpoint
whose result is intentionally ignored.
Details
Runtime parsing accepts any present value and discards it, producing
undefined. The public decoded and encoded TypeScript representation remains
void, so typed construction, decoding, and encoding APIs are still modeled
as void.
Void,
function (type parameter) Error in configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never>Error extends import SchemaSchema.Top = typeof import SchemaSchema.const Never: Neverconst Never: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<never, readonly []>) => Schema.Never;
annotateKey: (annotations: Schema.Annotations.Key<never>) => Schema.Never;
check: (checks_0: Check<never>, ...checks: Array<Check<never>>) => Schema.Never;
rebuild: (ast: Never) => Schema.Never;
make: (input: never, options?: MakeOptions) => never;
makeOption: (input: never, options?: MakeOptions) => Option_.Option<never>;
makeEffect: (input: never, options?: MakeOptions) => Effect.Effect<never, SchemaError, 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; <…;
}
Type-level representation of
Never
.
Schema for the never type. Always fails validation — no value satisfies it.
Never,
>(
tag: QueueTagFor<Self, F, Success, Error>tag: type QueueTagFor<Self, F extends QueueItemFields, Success extends Schema.Top, Error extends Schema.Top> = Hyperlink.HyperlinkTag<Self, {
add: Hyperlink.Method<Schema.Union<readonly [Schema.Struct<F>, Schema.$Array<Schema.Struct<F>>]>, Schema.Void, Schema.Never, false, Hyperlink.MethodAnnotations & {
description: string;
}, {
(item: PrettifyPayload<Schema.Struct.View<F, "Type", Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>): Effect.Effect<void>;
(items: readonly PrettifyPayload<Schema.Struct.View<F, "Type", Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<...>>>[]): Effect.Effect<void>;
(itemOrItems: PrettifyPayload<...> | readonly PrettifyPayload<...>[]): Effect.Effect<void>;
}>;
... 16 more ...;
metrics: {
...;
};
}, {
...;
}> & QueueSuccessCarrier<...> & QueueErrorCarrier<...> & QueueItemSchemaCarrier<...>
The tag: param shape shared by every queue verb (
buildQueueImpl
/
layer
/
serve
/
serveRemote
/
configure
): the instance's
HyperlinkTag
over
the threaded
QueueInstanceSpec
<F, Success, Error> (so events carries the real
Cause<Error> / Completed.success, matching
materializeQueueTag
), plus the
worker-success/error carriers. Both are needed: the spec sits at HyperlinkTag's invariant
Shape position (unreliable for inference), so the covariant carriers give the verbs a stable
surface to infer Success/Error from the passed tag.
QueueTagFor<function (type parameter) Self in configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never>Self, function (type parameter) F in configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never>F, function (type parameter) Success in configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never>Success, function (type parameter) Error in configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never>Error>,
patch: ConfigPatch<
QueueVerbConfig<
F,
QueueErrorValueOf<Error>,
R,
RR,
Success
>
>
patch: type ConfigPatch<T> = PartialConfigPatch<T> | ((previous: T) => T)Patch for a hyperlink or daemon spec.
- Partial object — shallow-merge fields; use a function value to replace a field.
effect field — a unary function (previous) => next updates the prior worker /
supervised body; a multi-argument function value replaces effect outright (queue workers
stay two-argument).
- Full reducer —
(previous) => next over the whole spec (see
configureLayer
).
ConfigPatch<type QueueVerbConfig<F extends QueueItemFields, E, R, RR, Success extends Schema.Top> = Omit<WorkPoolConfigWithItemSchema<Schema.Struct.View<F, "Type", Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>, E, R, QueueSuccessValueOf<Success>>, "itemSchema" | "refill"> & {
readonly refill?: {
readonly onStart?: boolean;
readonly onDrained?: boolean;
readonly load: (queue: EngineQueueHandle<Schema.Struct.View<F, "Type", Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>, E, QueueEnqueueErrors, never, QueueSuccessValueOf<...>>) => Effect.Effect<...>;
} | undefined;
}
The worker-config: param shape shared by every queue verb —
QueueLayerConfig
with the
instance item type + worker-success value recovered from F / Success.
QueueVerbConfig<function (type parameter) F in configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never>F, type QueueErrorValueOf<
Error extends Schema.Top
> = Error["Type"]
The worker error value type (E) carried on a queue instance spec's Error wire schema — the
decoded type of the tag's error slot (default never). The layer/serve config's worker failure
channel is constrained to this.
QueueErrorValueOf<function (type parameter) Error in configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never>Error>, function (type parameter) R in configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never>R, function (type parameter) RR in configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never>RR, function (type parameter) Success in configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never>Success>>,
): 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>;
export function function configure<Self, F extends PriorityItemFields = PriorityItemFields, E = never, R = never, RR = never>(tag: HyperlinkTag<Self, PriorityInstanceSpec<F>>, patch: ConfigPatch<PriorityLayerConfig<Schema.Struct<F>["Type"], E, R, RR>>): Layer.Layer<never> (+1 overload)A config-patch layer for the WorkPool tag — the toolkit successor to the old
WorkPool.Service(...).configure(...). Merge it with the queue's
layer
(e.g. per
environment) and its patch (concurrency / rateLimit / attempts / …) folds onto the layer's base
config at build. Keyed by tag.key; later patches win. Config lives in the layer, not the tag,
so configure takes the tag and returns a layer rather than being a tag method.
const Prod = Layer.mergeAll(
WorkPool.layer(MyQueue, { effect }),
WorkPool.configure(MyQueue, { concurrency: 3, rateLimit: { window: "1 second", limit: 5 } }),
);
configure<
function (type parameter) Self in configure<Self, F extends PriorityItemFields = PriorityItemFields, E = never, R = never, RR = never>(tag: HyperlinkTag<Self, PriorityInstanceSpec<F>>, patch: ConfigPatch<PriorityLayerConfig<Schema.Struct<F>["Type"], E, R, RR>>): Layer.Layer<never>Self,
function (type parameter) F in configure<Self, F extends PriorityItemFields = PriorityItemFields, E = never, R = never, RR = never>(tag: HyperlinkTag<Self, PriorityInstanceSpec<F>>, patch: ConfigPatch<PriorityLayerConfig<Schema.Struct<F>["Type"], E, R, RR>>): Layer.Layer<never>F extends type PriorityItemFields = {
[x: string]: Schema.Codec<
unknown,
unknown,
never,
never
>
}
PriorityItemFields = type PriorityItemFields = {
[x: string]: Schema.Codec<
unknown,
unknown,
never,
never
>
}
PriorityItemFields,
function (type parameter) E in configure<Self, F extends PriorityItemFields = PriorityItemFields, E = never, R = never, RR = never>(tag: HyperlinkTag<Self, PriorityInstanceSpec<F>>, patch: ConfigPatch<PriorityLayerConfig<Schema.Struct<F>["Type"], E, R, RR>>): Layer.Layer<never>E = never,
function (type parameter) R in configure<Self, F extends PriorityItemFields = PriorityItemFields, E = never, R = never, RR = never>(tag: HyperlinkTag<Self, PriorityInstanceSpec<F>>, patch: ConfigPatch<PriorityLayerConfig<Schema.Struct<F>["Type"], E, R, RR>>): Layer.Layer<never>R = never,
function (type parameter) RR in configure<Self, F extends PriorityItemFields = PriorityItemFields, E = never, R = never, RR = never>(tag: HyperlinkTag<Self, PriorityInstanceSpec<F>>, patch: ConfigPatch<PriorityLayerConfig<Schema.Struct<F>["Type"], E, R, RR>>): Layer.Layer<never>RR = never,
>(
tag: HyperlinkTag<
Self,
PriorityInstanceSpec<F>
>
(parameter) tag: {
key: Identifier;
Service: {
enqueue: (payload: ReadonlyArray<{ attempts: number; item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; entryId: string; priority: 'high' | 'normal' | 'low'; timestamps: { readonly enqueuedAt: …;
release: (payload: { options?: { readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: JsonValue } | undefined; readonly scope?: 'pendingOnly' | undefined } | undefined }) => Effect.Effect<ReadonlyArray<{ readonly a…;
releaseEncoded: (payload: { options?: { readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: JsonValue } | undefined; readonly scope?: 'pendingOnly' | undefined } | undefined }) => Effect.Effect<ReadonlyArray<{ readonly a…;
deadLetter: (payload: { selector: { readonly key?: string | undefined; readonly item?: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>> | undefined; readonly entryId?: string | undefined }; options: { …;
drop: (payload: { selector: { readonly key?: string | undefined; readonly item?: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>> | undefined; readonly entryId?: string | undefined }; options: { …;
events: Stream.Stream<Schema.Struct.ReadonlySide<{ readonly _tag: Schema.tag<'Start'>; readonly key: Schema.String }, 'Type'> | { readonly entries: ReadonlyArray<{ readonly attempts: number; readonly item: Schema.Struct.View<F, 'Type', Schema.Stru…;
status: Hyperlink.Subscribable<Schema.Struct.ReadonlySide<{ readonly sizes: Schema.$Record<Schema.String, Schema.Number>; readonly paused: Schema.Boolean; readonly inFlight: Schema.Number; readonly completed: Schema.Number; readonly phase: Schema.…;
size: Hyperlink.Subscribable<number>;
isEmpty: Hyperlink.Subscribable<boolean>;
levelSizes: Effect.Effect<ReadonlyArray<number>, never, never>;
start: Effect.Effect<void, never, never>;
pause: Effect.Effect<void, never, never>;
resume: Effect.Effect<void, never, never>;
shutdown: Effect.Effect<void, never, never>;
clear: Effect.Effect<number, never, never>;
metrics: { readonly stream: Stream.Stream<{ readonly inFlight: number; readonly completed: number; readonly avgWaitMillis: { readonly high?: number | undefined; readonly normal?: number | undefined; readonly low?: number | undefined }; readonly win…;
add: (arg0: unknown, arg1?: unknown) => Effect.Effect<void, never, never>;
};
description: string | undefined;
of: (this: void, self: { readonly enqueue: (payload: ReadonlyArray<{ attempts: number; item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; entryId: string; priority: 'high' | 'normal' | 'lo…;
context: (self: { readonly enqueue: (payload: ReadonlyArray<{ attempts: number; item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; entryId: string; priority: 'high' | 'normal' | 'low'; timestam…;
use: (f: (service: { readonly enqueue: (payload: ReadonlyArray<{ attempts: number; item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; entryId: string; priority: 'high' | 'normal' | 'low'; t…;
useSync: (f: (service: { readonly enqueue: (payload: ReadonlyArray<{ attempts: number; item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; entryId: string; priority: 'high' | 'normal' | 'low'; t…;
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: interface HyperlinkTag<Self, S extends Spec, Svc = Simplify<{ readonly [K in keyof S]: S[K] extends FromLocalMethod<infer M> ? InjectLocal<M, Self> : S[K] extends LocalMethod<infer T> ? LocalEffect<...> : S[K] extends DefaultMethod<...> ? F : S[K] extends { ...; } ? SuccessOf<...> : S[K] extends { ...; } ? Subscribable<...> : S[K] extends { ...; } ? ClientMethod<...> : S[K] extends Spec ? Simplify<...> : never; }>>The type of a HyperService tag carrying spec S — what
Hyperlink.Tag
produces
(and what you extend). Lets a consumer write
<S extends Spec>(tag: HyperlinkTag<Self, S>) and read the spec through named types
(
specOf
/
groupOf
) instead of a Parameters<typeof specOf> workaround.
HyperlinkTag<function (type parameter) Self in configure<Self, F extends PriorityItemFields = PriorityItemFields, E = never, R = never, RR = never>(tag: HyperlinkTag<Self, PriorityInstanceSpec<F>>, patch: ConfigPatch<PriorityLayerConfig<Schema.Struct<F>["Type"], E, R, RR>>): Layer.Layer<never>Self, type PriorityInstanceSpec<F extends Schema.Struct.Fields> = Omit<{
add: Hyperlink.Method<Schema.Tuple<readonly [Schema.Union<readonly [Schema.Struct<F>, Schema.$Array<Schema.Struct<F>>]>, Schema.optional<Schema.Schema<string | number>>]>, Schema.Void, Schema.Never, false, Hyperlink.MethodAnnotations & {
readonly callStyle: "pair";
} & {
description: string;
}, Hyperlink.Derive>;
enqueue: Hyperlink.Method<Schema.$Array<Schema.Struct<{
readonly item: Schema.Struct<F>;
readonly entryId: Schema.String;
readonly key: Schema.optional<Schema.String>;
... 7 more ...;
readonly attributes: Schema.optional<...>;
}>>, ... 4 more ..., Hyperlink.Derive>;
... 14 more ...;
metrics: {
...;
};
}, "add"> & {
...;
}
Full priority-queue instance contract for itemSchema F.
PriorityInstanceSpec<function (type parameter) F in configure<Self, F extends PriorityItemFields = PriorityItemFields, E = never, R = never, RR = never>(tag: HyperlinkTag<Self, PriorityInstanceSpec<F>>, patch: ConfigPatch<PriorityLayerConfig<Schema.Struct<F>["Type"], E, R, RR>>): Layer.Layer<never>F>>,
patch: ConfigPatch<
PriorityLayerConfig<
Schema.Struct<F>["Type"],
E,
R,
RR
>
>
patch: type ConfigPatch<T> = PartialConfigPatch<T> | ((previous: T) => T)Patch for a hyperlink or daemon spec.
- Partial object — shallow-merge fields; use a function value to replace a field.
effect field — a unary function (previous) => next updates the prior worker /
supervised body; a multi-argument function value replaces effect outright (queue workers
stay two-argument).
- Full reducer —
(previous) => next over the whole spec (see
configureLayer
).
ConfigPatch<type PriorityLayerConfig<
A,
E,
R,
RR = never
> = Omit<
WorkPoolPriorityConfigWithItemSchema<A, E, R>,
"itemSchema" | "refill" | "name"
> & {
readonly refill?: {
readonly onStart?: boolean
readonly onDrained?: boolean
readonly load: (
queue: WorkPoolPriorityHandle<
A,
E,
QueueEnqueueErrors,
never
>
) => Effect.Effect<void, never, RR>
}
}
Worker/layer config for a toolkit priority queue (tag carries itemSchema).
PriorityLayerConfig<import SchemaSchema.interface Struct<Fields extends Schema.Struct.Fields>Defines a struct schema from a map of field schemas.
Details
Each field value is a schema. Use
optionalKey
or
optional
to
mark fields as optional, and
mutableKey
to mark them as mutable.
The resulting schema's Type is a readonly object type with the fields'
decoded types. The Encoded form mirrors the field schemas' encoded types.
Example (Defining a basic struct)
import { Schema } from "effect"
const Person = Schema.Struct({
name: Schema.String,
age: Schema.Number,
email: Schema.optionalKey(Schema.String)
})
// { readonly name: string; readonly age: number; readonly email?: string }
type Person = typeof Person.Type
const alice = Schema.decodeUnknownSync(Person)({ name: "Alice", age: 30 })
console.log(alice)
// { name: 'Alice', age: 30 }
Namespace for struct field type utilities.
Details
These types compute the decoded Type, encoded Encoded, and constructor
input MakeIn of a
Struct
from its field map, handling optional,
mutable, and other field modifiers automatically.
Struct.Fields — constraint for the field map object
Struct.Type<F> — decoded type of the struct
Struct.Encoded<F> — encoded type of the struct
Struct.MakeIn<F> — constructor input (optional/defaulted fields may be omitted)
Struct.DecodingServices<F> / Struct.EncodingServices<F> — required services
Type-level representation returned by
Struct
.
Struct<function (type parameter) F in configure<Self, F extends PriorityItemFields = PriorityItemFields, E = never, R = never, RR = never>(tag: HyperlinkTag<Self, PriorityInstanceSpec<F>>, patch: ConfigPatch<PriorityLayerConfig<Schema.Struct<F>["Type"], E, R, RR>>): Layer.Layer<never>F>["Type"], function (type parameter) E in configure<Self, F extends PriorityItemFields = PriorityItemFields, E = never, R = never, RR = never>(tag: HyperlinkTag<Self, PriorityInstanceSpec<F>>, patch: ConfigPatch<PriorityLayerConfig<Schema.Struct<F>["Type"], E, R, RR>>): Layer.Layer<never>E, function (type parameter) R in configure<Self, F extends PriorityItemFields = PriorityItemFields, E = never, R = never, RR = never>(tag: HyperlinkTag<Self, PriorityInstanceSpec<F>>, patch: ConfigPatch<PriorityLayerConfig<Schema.Struct<F>["Type"], E, R, RR>>): Layer.Layer<never>R, function (type parameter) RR in configure<Self, F extends PriorityItemFields = PriorityItemFields, E = never, R = never, RR = never>(tag: HyperlinkTag<Self, PriorityInstanceSpec<F>>, patch: ConfigPatch<PriorityLayerConfig<Schema.Struct<F>["Type"], E, R, RR>>): Layer.Layer<never>RR>>,
): 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>;
export function function configure<Self, F extends QueueItemFields = QueueItemFields, R = never, RR = never, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(tag: QueueTagFor<Self, F, Success, Error>, patch: ConfigPatch<QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>>): Layer.Layer<never> (+1 overload)A config-patch layer for the WorkPool tag — the toolkit successor to the old
WorkPool.Service(...).configure(...). Merge it with the queue's
layer
(e.g. per
environment) and its patch (concurrency / rateLimit / attempts / …) folds onto the layer's base
config at build. Keyed by tag.key; later patches win. Config lives in the layer, not the tag,
so configure takes the tag and returns a layer rather than being a tag method.
const Prod = Layer.mergeAll(
WorkPool.layer(MyQueue, { effect }),
WorkPool.configure(MyQueue, { concurrency: 3, rateLimit: { window: "1 second", limit: 5 } }),
);
configure(
tag: AnyPoolTagtag: type AnyPoolTag = QueueTagFor<unknown, QueueItemFields, Schema.Top, Schema.Top> | Hyperlink.HyperlinkTag<unknown, PriorityInstanceSpec<PriorityItemFields>, {
readonly enqueue: (payload: readonly {
attempts: number;
item: Schema.Struct.ReadonlySide<PriorityItemFields, "Type">;
entryId: string;
priority: "high" | "normal" | "low";
timestamps: {
readonly enqueuedAt: DateTime.Utc;
readonly startedAt?: DateTime.Utc | undefined;
readonly completedAt?: DateTime.Utc | undefined;
readonly interruptedAt?: DateTime.Utc | undefined;
};
... 5 more ...;
lane?: number | undefined;
}[]) => Effect.Effect<...>;
... 15 more ...;
readonly add: (arg0: unknown, arg1?: unknown) => Effect.Effect<...>;
}>
A WorkPool tag — plain or
priority
— the runtime verbs dispatch over by kind.
AnyPoolTag,
patch: ConfigPatch<unknown>patch: type ConfigPatch<T> = PartialConfigPatch<T> | ((previous: T) => T)Patch for a hyperlink or daemon spec.
- Partial object — shallow-merge fields; use a function value to replace a field.
effect field — a unary function (previous) => next updates the prior worker /
supervised body; a multi-argument function value replaces effect outright (queue workers
stay two-argument).
- Full reducer —
(previous) => next over the whole spec (see
configureLayer
).
ConfigPatch<unknown>,
): 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> {
return configureLayer<T extends object>(resourceId: string, patch: ConfigPatch<T>): Layer.Layer<never>Layer that appends one configure patch for resourceId.
Provide or merge with the HyperService .layer so patches are visible when that layer builds.
configureLayer(tag: AnyPoolTagtag.ServiceClass<in out Self, in out Identifier extends string, in out Shape>.key: stringkey, patch: ConfigPatch<unknown>patch);
}