<
Sch extends Schema.Top,
Success extends Schema.Top = Schema.Void,
Error extends Schema.Top = Schema.Never
>(
itemSchema: Sch,
wire?: { readonly success?: Success; readonly error?: Error }
): Schema.Union<
readonly [
Schema.TaggedStruct<"Start", { readonly key: Schema.String }>,
Schema.TaggedStruct<
"Enqueued",
{
readonly entries: Schema.$Array<
Schema.Struct<{
readonly item: Sch
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly attempts: Schema.Number
readonly timestamps: Schema.Struct<{
readonly enqueuedAt: Schema.DateTimeUtc
readonly startedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly completedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly interruptedAt: Schema.optionalKey<Schema.DateTimeUtc>
}>
readonly batchId: Schema.optional<Schema.String>
readonly releaseId: Schema.optional<Schema.String>
readonly sourceHyperlinkId: Schema.optional<Schema.String>
readonly attributes: Schema.optional<
Schema.$Record<Schema.String, Schema.Unknown>
>
}>
>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly batchId: Schema.optionalKey<Schema.String>
}
>,
Schema.TaggedStruct<
"Started",
{
readonly entry: Schema.Struct<{
readonly item: Sch
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly attempts: Schema.Number
readonly timestamps: Schema.Struct<{
readonly enqueuedAt: Schema.DateTimeUtc
readonly startedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly completedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly interruptedAt: Schema.optionalKey<Schema.DateTimeUtc>
}>
readonly batchId: Schema.optional<Schema.String>
readonly releaseId: Schema.optional<Schema.String>
readonly sourceHyperlinkId: Schema.optional<Schema.String>
readonly attributes: Schema.optional<
Schema.$Record<Schema.String, Schema.Unknown>
>
}>
}
>,
Schema.TaggedStruct<
"Completed",
{
readonly entry: Schema.Struct<{
readonly item: Sch
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly attempts: Schema.Number
readonly timestamps: Schema.Struct<{
readonly enqueuedAt: Schema.DateTimeUtc
readonly startedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly completedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly interruptedAt: Schema.optionalKey<Schema.DateTimeUtc>
}>
readonly batchId: Schema.optional<Schema.String>
readonly releaseId: Schema.optional<Schema.String>
readonly sourceHyperlinkId: Schema.optional<Schema.String>
readonly attributes: Schema.optional<
Schema.$Record<Schema.String, Schema.Unknown>
>
}>
readonly success: Schema.Union<readonly [Success]>
readonly elapsed: Schema.Duration
}
>,
Schema.TaggedStruct<
"Failed",
{
readonly entry: Schema.Struct<{
readonly item: Sch
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly attempts: Schema.Number
readonly timestamps: Schema.Struct<{
readonly enqueuedAt: Schema.DateTimeUtc
readonly startedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly completedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly interruptedAt: Schema.optionalKey<Schema.DateTimeUtc>
}>
readonly batchId: Schema.optional<Schema.String>
readonly releaseId: Schema.optional<Schema.String>
readonly sourceHyperlinkId: Schema.optional<Schema.String>
readonly attributes: Schema.optional<
Schema.$Record<Schema.String, Schema.Unknown>
>
}>
readonly cause: Schema.Cause<Error, Schema.Unknown>
readonly elapsed: Schema.Duration
}
>,
Schema.TaggedStruct<
"RetryScheduled",
{
readonly entry: Schema.Struct<{
readonly item: Sch
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly attempts: Schema.Number
readonly timestamps: Schema.Struct<{
readonly enqueuedAt: Schema.DateTimeUtc
readonly startedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly completedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly interruptedAt: Schema.optionalKey<Schema.DateTimeUtc>
}>
readonly batchId: Schema.optional<Schema.String>
readonly releaseId: Schema.optional<Schema.String>
readonly sourceHyperlinkId: Schema.optional<Schema.String>
readonly attributes: Schema.optional<
Schema.$Record<Schema.String, Schema.Unknown>
>
}>
readonly cause: Schema.Cause<Error, Schema.Unknown>
readonly nextAttempt: Schema.Number
}
>,
Schema.TaggedStruct<
"RetryExhausted",
{
readonly entry: Schema.Struct<{
readonly item: Sch
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly attempts: Schema.Number
readonly timestamps: Schema.Struct<{
readonly enqueuedAt: Schema.DateTimeUtc
readonly startedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly completedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly interruptedAt: Schema.optionalKey<Schema.DateTimeUtc>
}>
readonly batchId: Schema.optional<Schema.String>
readonly releaseId: Schema.optional<Schema.String>
readonly sourceHyperlinkId: Schema.optional<Schema.String>
readonly attributes: Schema.optional<
Schema.$Record<Schema.String, Schema.Unknown>
>
}>
readonly cause: Schema.Cause<Error, Schema.Unknown>
}
>,
Schema.TaggedStruct<
"Drained",
{ readonly key: Schema.String; readonly completed: Schema.Number }
>,
Schema.TaggedStruct<
"Cleared",
{ readonly key: Schema.String; readonly count: Schema.Number }
>,
Schema.TaggedStruct<
"ShutdownRequested",
{
readonly key: Schema.String
readonly mode: Schema.Literals<readonly ["drain", "finishActive"]>
readonly pending: Schema.Number
}
>,
Schema.TaggedStruct<
"ShutdownComplete",
{ readonly key: Schema.String; readonly completed: Schema.Number }
>,
Schema.TaggedStruct<
"Released",
{
readonly key: Schema.String
readonly releaseId: Schema.String
readonly entries: Schema.$Array<
Schema.Struct<{
readonly item: Sch
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly attempts: Schema.Number
readonly timestamps: Schema.Struct<{
readonly enqueuedAt: Schema.DateTimeUtc
readonly startedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly completedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly interruptedAt: Schema.optionalKey<Schema.DateTimeUtc>
}>
readonly batchId: Schema.optional<Schema.String>
readonly releaseId: Schema.optional<Schema.String>
readonly sourceHyperlinkId: Schema.optional<Schema.String>
readonly attributes: Schema.optional<
Schema.$Record<Schema.String, Schema.Unknown>
>
}>
>
}
>,
Schema.TaggedStruct<
"DeadLettered",
{
readonly key: Schema.String
readonly entries: Schema.$Array<
Schema.Struct<{
readonly item: Sch
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly attempts: Schema.Number
readonly timestamps: Schema.Struct<{
readonly enqueuedAt: Schema.DateTimeUtc
readonly startedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly completedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly interruptedAt: Schema.optionalKey<Schema.DateTimeUtc>
}>
readonly batchId: Schema.optional<Schema.String>
readonly releaseId: Schema.optional<Schema.String>
readonly sourceHyperlinkId: Schema.optional<Schema.String>
readonly attributes: Schema.optional<
Schema.$Record<Schema.String, Schema.Unknown>
>
}>
>
readonly reason: Schema.String
}
>,
Schema.TaggedStruct<
"Dropped",
{
readonly key: Schema.String
readonly entries: Schema.$Array<
Schema.Struct<{
readonly item: Sch
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly attempts: Schema.Number
readonly timestamps: Schema.Struct<{
readonly enqueuedAt: Schema.DateTimeUtc
readonly startedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly completedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly interruptedAt: Schema.optionalKey<Schema.DateTimeUtc>
}>
readonly batchId: Schema.optional<Schema.String>
readonly releaseId: Schema.optional<Schema.String>
readonly sourceHyperlinkId: Schema.optional<Schema.String>
readonly attributes: Schema.optional<
Schema.$Record<Schema.String, Schema.Unknown>
>
}>
>
readonly reason: Schema.String
}
>,
Schema.TaggedStruct<
"RateLimitExceeded",
{
readonly key: Schema.String
readonly entry: Schema.Struct<{
readonly item: Sch
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly attempts: Schema.Number
readonly timestamps: Schema.Struct<{
readonly enqueuedAt: Schema.DateTimeUtc
readonly startedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly completedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly interruptedAt: Schema.optionalKey<Schema.DateTimeUtc>
}>
readonly batchId: Schema.optional<Schema.String>
readonly releaseId: Schema.optional<Schema.String>
readonly sourceHyperlinkId: Schema.optional<Schema.String>
readonly attributes: Schema.optional<
Schema.$Record<Schema.String, Schema.Unknown>
>
}>
readonly limitKey: Schema.String
readonly algorithm: Schema.Literals<
readonly ["fixed-window", "token-bucket"]
>
readonly outcome: Schema.Literals<
readonly ["delayed", "rejected"]
>
}
>
]
>Build the events union schema for a queue item schema Sch with optional success/error
wire slots (default Schema.Void / Schema.Never) — the runtime schema behind
QueueHyperlink.events, whose decoded type is QueueEventSchema.
export const const queueEvent: <Sch extends Schema.Top, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(itemSchema: Sch, wire?: {
readonly success?: Success;
readonly error?: Error;
}) => Schema.Union<readonly [Schema.TaggedStruct<"Start", {
readonly key: Schema.String;
}>, Schema.TaggedStruct<"Enqueued", {
readonly entries: Schema.$Array<Schema.Struct<{
readonly item: Sch;
readonly entryId: Schema.String;
readonly key: Schema.optional<Schema.String>;
readonly priority: Schema.Literals<readonly ["high", "normal", "low"]>;
readonly attempts: Schema.Number;
readonly timestamps: Schema.Struct<...>;
readonly batchId: Schema.optional<...>;
readonly releaseId: Schema.optional<...>;
readonly sourceHyperlinkId: Schema.optional<...>;
readonly attributes: Schema.optional<...>;
}>>;
readonly priority: Schema.Literals<...>;
readonly batchId: Schema.optionalKey<...>;
}>, ... 12 more ..., Schema.TaggedStruct<...>]>
Build the events union schema for a queue item schema Sch with optional success/error
wire slots (default
Schema.Void
/
Schema.Never
) — the runtime schema behind
QueueHyperlink.events
, whose decoded type is
QueueEventSchema
.
queueEvent = <
function (type parameter) Sch in <Sch extends Schema.Top, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(itemSchema: Sch, wire?: {
readonly success?: Success;
readonly error?: Error;
}): Schema.Union<...>
Sch extends import SchemaSchema.Top,
function (type parameter) Success in <Sch extends Schema.Top, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(itemSchema: Sch, wire?: {
readonly success?: Success;
readonly error?: Error;
}): Schema.Union<...>
Success 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 <Sch extends Schema.Top, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(itemSchema: Sch, wire?: {
readonly success?: Success;
readonly error?: Error;
}): Schema.Union<...>
Error 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,
>(
itemSchema: Sch extends Schema.TopitemSchema: function (type parameter) Sch in <Sch extends Schema.Top, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(itemSchema: Sch, wire?: {
readonly success?: Success;
readonly error?: Error;
}): Schema.Union<...>
Sch,
wire: | {
readonly success?: Success
readonly error?: Error
}
| undefined
wire?: {
readonly success?: Success | undefinedsuccess?: function (type parameter) Success in <Sch extends Schema.Top, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(itemSchema: Sch, wire?: {
readonly success?: Success;
readonly error?: Error;
}): Schema.Union<...>
Success;
readonly error?: Error | undefinederror?: function (type parameter) Error in <Sch extends Schema.Top, Success extends Schema.Top = Schema.Void, Error extends Schema.Top = Schema.Never>(itemSchema: Sch, wire?: {
readonly success?: Success;
readonly error?: Error;
}): Schema.Union<...>
Error;
},
) =>
const buildQueueEvent: <Sch, Success, Error>(itemSchema: Sch, successSchema: Success, errorSchema: Error) => Schema.Union<readonly [Schema.TaggedStruct<"Start", {
readonly key: Schema.String;
}>, Schema.TaggedStruct<"Enqueued", {
readonly entries: Schema.$Array<Schema.Struct<{
readonly item: Sch;
readonly entryId: Schema.String;
readonly key: Schema.optional<Schema.String>;
readonly priority: Schema.Literals<readonly ["high", "normal", "low"]>;
readonly attempts: Schema.Number;
readonly timestamps: Schema.Struct<{
readonly enqueuedAt: Schema.DateTimeUtc;
readonly startedAt: Schema.optionalKey<...>;
readonly completedAt: Schema.optionalKey<...>;
readonly interruptedAt: Schema.optionalKey<...>;
}>;
readonly batchId: Schema.optional<...>;
readonly releaseId: Schema.optional<...>;
readonly sourceHyperlinkId: Schema.optional<...>;
readonly attributes: Schema.optional<...>;
}>>;
readonly priority: Schema.Literals<...>;
readonly batchId: Schema.optionalKey<...>;
}>, ... 12 more ..., Schema.TaggedStruct<...>]>
Build the events union schema with concrete success / error wire schemas (no defaulting
??, so Completed.success is exactly Success, no | void widening). This is the concrete
builder the spec / store / engine consume so their decoded .Type reduces; the defaulting
queueEvent
overloads wrap it.
buildQueueEvent(
itemSchema: Sch extends Schema.TopitemSchema,
function withVoidDefault<Success>(
schema: Success | undefined
): Success
Resolve an optional wire success schema to its
Schema.Void
default while keeping the
decoded type clean: the public overload returns the caller's Success (not the
Success | typeof Schema.Void union a bare ?? Schema.Void yields, whose ["Type"] is a deferred
indexed access that stops buildQueueEvent's Completed.success from reducing under a generic
Success). Sound: a caller whose Success is not typeof Schema.Void always supplies the schema
(the type param is inferred from it), so the ?? Schema.Void branch only runs when Success really
is typeof Schema.Void. A function-overload narrowing — no cast.
withVoidDefault(wire: | {
readonly success?: Success
readonly error?: Error
}
| undefined
wire?.success?: Success | undefinedsuccess),
function withNeverDefault<Error>(
schema: Error | undefined
): Error
Mirror of
withVoidDefault
for the wire error schema (default
Schema.Never
). The
Error | typeof Schema.Never union's ["Type"] would fold never away, but the schema-value
union still defers, so the same clean-narrowing keeps Failed.cause a concrete Cause<Error>.
withNeverDefault(wire: | {
readonly success?: Success
readonly error?: Error
}
| undefined
wire?.error?: Error | undefinederror),
);