<
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>,
config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>
): anyServe this queue remotely (served-only) — run the worker / refill / persist
engine behind the tag, mount its RPC handlers, and register into Hyperlink.servedHyperlinksLayer,
without granting the local instance (no yield* Tag in the serving process). The engine's worker
requirement R is preserved, so a per-resource Layer.provide discharges it in isolation — the
queue's counterpart to Hyperlink.serveRemote.
Reach for this (with Node.httpServer) for a pure gateway/edge that exposes the queue for remote clients but never consumes it locally; use serve when the serving node also drives it.
Node.httpServer([
QueueHyperlink.serveRemote(RosterImportQueue, rosterCfg).pipe(Layer.provide(emptyHookSource)),
QueueHyperlink.serveRemote(MediaImportQueue, mediaCfg).pipe(Layer.provide(emptyHookSource)),
]).pipe(Layer.provide(NodeHttpServer.layer(() => createServer(), { port })));export const const serveRemote: <
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>,
config: QueueVerbConfig<
F,
QueueErrorValueOf<Error>,
R,
RR,
Success
>
) => any
Serve this queue remotely (served-only) — run the worker / refill / persist
engine behind the tag, mount its RPC handlers, and register into
Hyperlink.servedHyperlinksLayer
,
without granting the local instance (no yield* Tag in the serving process). The engine's worker
requirement R is preserved, so a per-resource Layer.provide discharges it in isolation — the
queue's counterpart to
Hyperlink.serveRemote
.
Reach for this (with
Node.httpServer
) for a pure gateway/edge that exposes the queue for
remote clients but never consumes it locally; use
serve
when the serving node also drives it.
Node.httpServer([
QueueHyperlink.serveRemote(RosterImportQueue, rosterCfg).pipe(Layer.provide(emptyHookSource)),
QueueHyperlink.serveRemote(MediaImportQueue, mediaCfg).pipe(Layer.provide(emptyHookSource)),
]).pipe(Layer.provide(NodeHttpServer.layer(() => createServer(), { port })));
serveRemote = <
function (type parameter) Self in <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>, config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>): anySelf,
function (type parameter) F in <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>, config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>): anyF 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 <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>, config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>): anyR = never,
function (type parameter) RR in <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>, config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>): anyRR = never,
function (type parameter) Success in <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>, config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>): anySuccess extends import SchemaSchema.Top = typeof import SchemaSchema.const Void: Schema.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?: Schema.MakeOptions) => void;
makeOption: (input: void, options?: Schema.MakeOptions) => Option.Option<void>;
makeEffect: (input: void, options?: Schema.MakeOptions) => Effect.Effect<void, Schema.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 <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>, config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>): anyError extends import SchemaSchema.Top = typeof import SchemaSchema.const Never: Schema.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?: Schema.MakeOptions) => never;
makeOption: (input: never, options?: Schema.MakeOptions) => Option.Option<never>;
makeEffect: (input: never, options?: Schema.MakeOptions) => Effect.Effect<never, Schema.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: anytag: type QueueTagFor<
Self,
F extends QueueItemFields,
Success extends Schema.Top,
Error extends Schema.Top
> = any
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 <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>, config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>): anySelf, function (type parameter) F in <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>, config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>): anyF, function (type parameter) Success in <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>, config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>): anySuccess, function (type parameter) Error in <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>, config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>): anyError>,
config: QueueVerbConfig<
F,
QueueErrorValueOf<Error>,
R,
RR,
Success
>
config: type QueueVerbConfig<
F extends QueueItemFields,
E,
R,
RR,
Success extends Schema.Top
> = Omit<
QueueHyperlinkConfigWithItemSchema<
Item,
E,
R,
A
>,
"itemSchema" | "refill"
> & {
readonly refill?:
| {
readonly onStart?: boolean
readonly onDrained?: boolean
readonly load: (
queue: QueueHandle<
Schema.Struct.View<
F,
"Type",
Schema.Struct.TypeOptionalKeys<F>,
Schema.Struct.TypeMutableKeys<F>
>,
E,
QueueEnqueueErrors,
never,
QueueSuccessValueOf<Success>
>
) => Effect.Effect<void, never, RR>
}
| 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 <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>, config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>): anyF, 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 <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>, config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>): anyError>, function (type parameter) R in <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>, config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>): anyR, function (type parameter) RR in <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>, config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>): anyRR, function (type parameter) Success in <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>, config: QueueVerbConfig<F, QueueErrorValueOf<Error>, R, RR, Success>): anySuccess>,
) =>
const withDefaultMemory: <
unknown,
unknown,
unknown
>(
layer: Layer.Layer<unknown, unknown, any>
) => Layer.Layer<any, unknown, unknown>
Satisfy
Store.Storage
with the ephemeral default and export it for readback.
Prefer
layer
Layer.provide(AppStore.layer…).
withDefaultMemory(
import LayerLayer.const unwrap: <
unknown,
unknown,
unknown,
unknown,
unknown
>(
self: Effect.Effect<
Layer.Layer<unknown, unknown, unknown>,
unknown,
unknown
>
) => Layer.Layer<unknown, unknown, unknown>
Unwraps a Layer from an Effect, flattening the nested structure.
When to use
Use when you have an Effect that produces a Layer and you want to
use that layer directly.
Details
The resulting Layer will have the combined error and dependency types from
both the outer Effect and the inner Layer.
Example (Unwrapping an effectful layer)
import { Context, Effect, Layer } from "effect"
class Database extends Context.Service<Database, {
readonly query: (sql: string) => Effect.Effect<string>
}>()("Database") {}
const layerEffect = Effect.succeed(
Layer.succeed(Database, { query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result")) })
)
const unwrappedLayer = Layer.unwrap(layerEffect)
unwrap(
import EffectEffect.const map: <any, unknown, unknown, any>(self: Effect.Effect<any, unknown, unknown>, f: (a: any) => any) => Effect.Effect<any, unknown, unknown> (+1 overload)Transforms the value inside an effect by applying a function to it.
When to use
Use to transform an effect's success value with a function that returns a
plain value, producing a new effect without changing the original effect's
typed error or context requirements.
Details
map takes a function and applies it to the value contained within an
effect, creating a new effect with the transformed value.
It's important to note that effects are immutable, meaning that the original
effect is not modified. Instead, a new effect is returned with the updated
value.
Example (Choosing map syntax variants)
import { Effect, pipe } from "effect"
const myEffect = Effect.succeed(1)
const transformation = (n: number) => n + 1
const mappedWithPipe = pipe(myEffect, Effect.map(transformation))
const mappedWithDataFirst = Effect.map(myEffect, transformation)
const mappedWithMethod = myEffect.pipe(Effect.map(transformation))
Example (Adding a service charge)
import { Effect, pipe } from "effect"
const addServiceCharge = (amount: number) => amount + 1
const fetchTransactionAmount = Effect.promise(() => Promise.resolve(100))
const finalAmount = pipe(
fetchTransactionAmount,
Effect.map(addServiceCharge)
)
Effect.runPromise(finalAmount).then(console.log)
// Output: 101
map(const buildQueueImpl: <
unknown,
F,
R,
RR,
Success,
Error
>(
tag: QueueTagFor<unknown, F, Success, Error>,
config: QueueVerbConfig<
F,
QueueErrorValueOf<Error>,
R,
RR,
Success
>
) => Effect.Effect<any, unknown, unknown>
Build the live
QueueEngine
handle behind tag and map it onto the toolkit service
impl — the single adapter shared by the local layer (
layer
) and the served
forms (
serve
/
serveRemote
). The worker R is captured at build time and
provided to each method, so the impl requires nothing beyond the scope; the engine queue
name defaults to the tag id (telemetry attribution) unless config.name overrides.
The queue spec has no
Hyperlink.local
members, so the resulting impl satisfies both
ImplOf (for Hyperlink.layer / Hyperlink.serve) and ServeImplOf (for Hyperlink.serveRemote).
buildQueueImpl(tag: anytag, config: QueueVerbConfig<
F,
QueueErrorValueOf<Error>,
R,
RR,
Success
>
config), (built: anybuilt) =>
import HyperlinkHyperlink.serveRemote(tag: anytag, built: anybuilt) as any,
),
) as any,
) as any;