<F extends Schema.Struct.Fields>(
itemSchema: Schema.Struct<F>,
laneConfig: WorkPoolPriorityLaneConfig,
wire?: { readonly success?: Schema.Top; readonly error?: Schema.Top }
): {
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>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly lane: Schema.optional<Schema.Number>
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.Void,
Schema.Never,
false,
Hyperlink.MethodAnnotations & { description: string },
Hyperlink.Derive
>
release: Hyperlink.Method<
{
readonly options: Schema.optionalKey<
Schema.Struct<{
readonly scope: Schema.optionalKey<
Schema.Literal<"pendingOnly">
>
readonly releaseId: Schema.optionalKey<Schema.String>
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<JsonValue, JsonValue, never, never>
>
>
}>
>
},
Schema.$Array<
Schema.Struct<{
readonly item: Schema.Struct<F>
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly lane: Schema.optional<Schema.Number>
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.Never,
false,
Hyperlink.MethodAnnotations & {
description: string
destructive: true
},
Hyperlink.Derive
>
releaseEncoded: Hyperlink.Method<
{
readonly options: Schema.optionalKey<
Schema.Struct<{
readonly scope: Schema.optionalKey<
Schema.Literal<"pendingOnly">
>
readonly releaseId: Schema.optionalKey<Schema.String>
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<JsonValue, JsonValue, never, never>
>
>
}>
>
},
Schema.$Array<
Schema.Struct<{
readonly payload: Schema.Codec<JsonValue, JsonValue, never, never>
readonly item: Schema.Struct<{
readonly id: Schema.String
readonly version: Schema.String
readonly encoding: Schema.Literal<"json">
readonly jsonSchema: Schema.Unknown
}>
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.Union<
readonly [
typeof QueueMissingItemSchemaError,
typeof QueueItemEncodingError
]
>,
false,
Hyperlink.MethodAnnotations & {
description: string
destructive: true
},
Hyperlink.Derive
>
deadLetter: Hyperlink.Method<
{
readonly selector: Schema.Struct<{
readonly entryId: Schema.optionalKey<Schema.String>
readonly key: Schema.optional<Schema.String>
readonly item: Schema.optionalKey<Schema.Struct<F>>
}>
readonly options: Schema.Struct<{
readonly reason: Schema.String
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<JsonValue, JsonValue, never, never>
>
>
}>
},
Schema.$Array<
Schema.Struct<{
readonly item: Schema.Struct<F>
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly lane: Schema.optional<Schema.Number>
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.Never,
false,
Hyperlink.MethodAnnotations & {
description: string
destructive: true
},
Hyperlink.Derive
>
drop: Hyperlink.Method<
{
readonly selector: Schema.Struct<{
readonly entryId: Schema.optionalKey<Schema.String>
readonly key: Schema.optional<Schema.String>
readonly item: Schema.optionalKey<Schema.Struct<F>>
}>
readonly options: Schema.Struct<{
readonly reason: Schema.String
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<JsonValue, JsonValue, never, never>
>
>
}>
},
Schema.$Array<
Schema.Struct<{
readonly item: Schema.Struct<F>
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly lane: Schema.optional<Schema.Number>
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.Never,
false,
Hyperlink.MethodAnnotations & {
description: string
destructive: true
},
Hyperlink.Derive
>
events: Hyperlink.Method<
undefined,
Schema.Union<
readonly [
Schema.TaggedStruct<"Start", { readonly key: Schema.String }>,
Schema.TaggedStruct<
"Enqueued",
{
readonly entries: Schema.$Array<
Schema.Struct<{
readonly item: Schema.Struct<F>
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: Schema.Struct<F>
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: Schema.Struct<F>
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 [Schema.Top | Schema.Void]
>
readonly elapsed: Schema.Duration
}
>,
Schema.TaggedStruct<
"Failed",
{
readonly entry: Schema.Struct<{
readonly item: Schema.Struct<F>
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<
Schema.Top | Schema.Unknown,
Schema.Unknown
>
readonly elapsed: Schema.Duration
}
>,
Schema.TaggedStruct<
"RetryScheduled",
{
readonly entry: Schema.Struct<{
readonly item: Schema.Struct<F>
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<
Schema.Top | Schema.Unknown,
Schema.Unknown
>
readonly nextAttempt: Schema.Number
}
>,
Schema.TaggedStruct<
"RetryExhausted",
{
readonly entry: Schema.Struct<{
readonly item: Schema.Struct<F>
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<
Schema.Top | Schema.Unknown,
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: Schema.Struct<F>
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: Schema.Struct<F>
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: Schema.Struct<F>
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: Schema.Struct<F>
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"]
>
}
>
]
>,
Schema.Never,
true,
Hyperlink.MethodAnnotations & { description: string },
Hyperlink.Derive
>
status: Hyperlink.Marked<
Hyperlink.Method<
undefined,
Schema.Struct<{
readonly sizes: Schema.$Record<Schema.String, Schema.Number>
readonly paused: Schema.Boolean
readonly inFlight: Schema.Number
readonly completed: Schema.Number
readonly phase: Schema.Literals<
readonly ["running", "draining", "off"]
>
}>,
Schema.Never,
true,
Hyperlink.MethodAnnotations & { description: string },
Hyperlink.Derive
>,
{ readonly _tag: "ref" }
>
size: Hyperlink.Marked<
Hyperlink.Method<
undefined,
Schema.Number,
Schema.Never,
true,
Hyperlink.MethodAnnotations & { description: string },
Hyperlink.Derive
>,
{ readonly _tag: "ref" }
>
isEmpty: Hyperlink.Marked<
Hyperlink.Method<
undefined,
Schema.Boolean,
Schema.Never,
true,
Hyperlink.MethodAnnotations & { description: string },
Hyperlink.Derive
>,
{ readonly _tag: "ref" }
>
levelSizes: Hyperlink.Method<
undefined,
Schema.$Array<Schema.Number>,
Schema.Never,
false,
Hyperlink.MethodAnnotations & { description: string },
Hyperlink.Derive
>
start: Hyperlink.Method<
undefined,
Schema.Void,
Schema.Never,
false,
Hyperlink.MethodAnnotations & { description: string },
Hyperlink.Derive
>
pause: Hyperlink.Method<
undefined,
Schema.Void,
Schema.Never,
false,
Hyperlink.MethodAnnotations & { description: string },
Hyperlink.Derive
>
resume: Hyperlink.Method<
undefined,
Schema.Void,
Schema.Never,
false,
Hyperlink.MethodAnnotations & { description: string },
Hyperlink.Derive
>
shutdown: Hyperlink.Method<
undefined,
Schema.Void,
Schema.Never,
false,
Hyperlink.MethodAnnotations & {
description: string
destructive: true
},
Hyperlink.Derive
>
clear: Hyperlink.Method<
undefined,
Schema.Number,
Schema.Never,
false,
Hyperlink.MethodAnnotations & {
description: string
destructive: true
},
Hyperlink.Derive
>
metrics: {
stream: Hyperlink.Method<
undefined,
Schema.Struct<{
readonly windowStart: Schema.DateTimeUtc
readonly windowEnd: Schema.DateTimeUtc
readonly windowMillis: Schema.Number
readonly enqueued: Schema.Number
readonly started: Schema.Number
readonly completed: Schema.Number
readonly failed: Schema.Number
readonly retried: Schema.Number
readonly deadLettered: Schema.Number
readonly dropped: Schema.Number
readonly rateLimitExceeded: Schema.Number
readonly inFlight: Schema.Number
readonly throughputPerSec: Schema.Number
readonly avgWaitMillis: Schema.Struct<{
readonly high: Schema.optionalKey<Schema.Number>
readonly normal: Schema.optionalKey<Schema.Number>
readonly low: Schema.optionalKey<Schema.Number>
}>
readonly avgExecutionMillis: Schema.optionalKey<Schema.Number>
readonly avgTotalMillis: Schema.optionalKey<Schema.Number>
}>,
Schema.Never,
true,
Hyperlink.MethodAnnotations & { description: string },
Hyperlink.Derive
>
query: Hyperlink.Method<
{
limit: Schema.optionalKey<Schema.Number>
since: Schema.optionalKey<Schema.DateTimeUtc>
until: Schema.optionalKey<Schema.DateTimeUtc>
},
Schema.$Array<
Schema.Struct<{
readonly windowStart: Schema.DateTimeUtc
readonly windowEnd: Schema.DateTimeUtc
readonly windowMillis: Schema.Number
readonly enqueued: Schema.Number
readonly started: Schema.Number
readonly completed: Schema.Number
readonly failed: Schema.Number
readonly retried: Schema.Number
readonly deadLettered: Schema.Number
readonly dropped: Schema.Number
readonly rateLimitExceeded: Schema.Number
readonly inFlight: Schema.Number
readonly throughputPerSec: Schema.Number
readonly avgWaitMillis: Schema.Struct<{
readonly high: Schema.optionalKey<Schema.Number>
readonly normal: Schema.optionalKey<Schema.Number>
readonly low: Schema.optionalKey<Schema.Number>
}>
readonly avgExecutionMillis: Schema.optionalKey<Schema.Number>
readonly avgTotalMillis: Schema.optionalKey<Schema.Number>
}>
>,
Schema.Never,
false,
Hyperlink.MethodAnnotations & { description: string },
Hyperlink.Derive
>
}
}Build a priority-queue instance spec: shared priorityControlSpec plus
per-instance data-plane procedures typed by itemSchema.
export const const prioritySpec: <F extends Schema.Struct.Fields>(itemSchema: Schema.Struct<F>, laneConfig: WorkPoolPriorityLaneConfig, wire?: {
readonly success?: Schema.Top;
readonly error?: Schema.Top;
}) => {
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>;
... 15 more ...;
metrics: {
...;
};
}
Build a priority-queue instance spec: shared
priorityControlSpec
plus
per-instance data-plane procedures typed by itemSchema.
prioritySpec = <function (type parameter) F in <F extends Schema.Struct.Fields>(itemSchema: Schema.Struct<F>, laneConfig: WorkPoolPriorityLaneConfig, wire?: {
readonly success?: Schema.Top;
readonly error?: Schema.Top;
}): {
...;
}
F extends import SchemaSchema.Struct.type Struct<Fields extends Struct.Fields>.Fields = {
readonly [x: string]: Schema.Constraint;
readonly [x: number]: Schema.Constraint;
readonly [x: symbol]: Schema.Constraint;
}
Constraint for a struct field map: an object whose values are schemas.
Fields>(
itemSchema: Schema.Struct<F>(parameter) itemSchema: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: F) => To, options?: { readonly unsafePreserveChecks?: boolean | undefined } | undefined) => Schema.Struct<{ [K in keyof Readonly<To>]: Readonly<To>[K]; }>;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>, readonly []>) => Schema.Struct<F>;
annotateKey: (annotations: Schema.Annotations.Key<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>) => Schema.Struct<F>;
check: (checks_0: Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>, ...checks: Array<Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>…;
rebuild: (ast: Objects) => Schema.Struct<F>;
make: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>;
makeOption: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Option_.Option<Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>>;
makeEffect: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Effect.Effect<Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>, 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; <…;
}
itemSchema: 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 <F extends Schema.Struct.Fields>(itemSchema: Schema.Struct<F>, laneConfig: WorkPoolPriorityLaneConfig, wire?: {
readonly success?: Schema.Top;
readonly error?: Schema.Top;
}): {
...;
}
F>,
laneConfig: WorkPoolPriorityLaneConfig(parameter) laneConfig: {
laneCount: number;
namedLanes: Record<string, number>;
defaultLevel: number;
}
laneConfig: WorkPoolPriorityLaneConfig,
wire: {
readonly success?: Schema.Top
readonly error?: Schema.Top
}
wire?: { readonly success?: Schema.Topsuccess?: import SchemaSchema.Top; readonly error?: Schema.Toperror?: import SchemaSchema.Top },
) => {
const const itemOrItems: Schema.Union<
readonly [
Schema.Struct<F>,
Schema.$Array<Schema.Struct<F>>
]
>
const itemOrItems: {
Type: { [K in keyof Members]: Members[K]["Type"]; }[number];
Encoded: { [K in keyof Members]: Members[K]["Encoded"]; }[number];
DecodingServices: { [K in keyof Members]: Members[K]["DecodingServices"]; }[number];
EncodingServices: { [K in keyof Members]: Members[K]["EncodingServices"]; }[number];
Iso: { [K in keyof Members]: Members[K]["Iso"]; }[number];
members: Members;
mapMembers: (f: (members: readonly [Schema.Struct<F>, Schema.$Array<Schema.Struct<F>>]) => To, options?: { readonly unsafePreserveChecks?: boolean | undefined } | undefined) => Schema.Union<{ [K in keyof Readonly<To>]: Readonly<To>[K]; }>;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>> | ReadonlyArray<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeM…;
annotateKey: (annotations: Schema.Annotations.Key<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>> | ReadonlyArray<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMuta…;
check: (checks_0: Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>> | ReadonlyArray<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>>, ...ch…;
rebuild: (ast: Union<Arrays | Objects>) => Schema.Union<readonly [Schema.Struct<F>, Schema.$Array<Schema.Struct<F>>]>;
make: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>> | ReadonlyArray<Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>>, options?: MakeOptions) => Struct.…;
makeOption: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>> | ReadonlyArray<Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>>, options?: MakeOptions) => Option_…;
makeEffect: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>> | ReadonlyArray<Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>>, options?: MakeOptions) => Effect.…;
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; <…;
}
itemOrItems = import SchemaSchema.function Union<
Members extends ReadonlyArray<Constraint>
>(
members: Members,
options?: { mode?: "anyOf" | "oneOf" }
): Union<Members>
Creates a union schema from an array of member schemas. Members are tested in
order; the first match is returned.
Details
Optionally, specify mode:
"anyOf" (default) — matches if any member matches.
"oneOf" — matches if exactly one member matches.
Example (Defining a string or number union)
import { Schema } from "effect"
const schema = Schema.Union([Schema.String, Schema.Number])
Schema.decodeUnknownSync(schema)("hello") // "hello"
Schema.decodeUnknownSync(schema)(42) // 42
Union([itemSchema: Schema.Struct<F>(parameter) itemSchema: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: F) => To, options?: { readonly unsafePreserveChecks?: boolean | undefined } | undefined) => Schema.Struct<{ [K in keyof Readonly<To>]: Readonly<To>[K]; }>;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>, readonly []>) => Schema.Struct<F>;
annotateKey: (annotations: Schema.Annotations.Key<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>) => Schema.Struct<F>;
check: (checks_0: Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>, ...checks: Array<Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>…;
rebuild: (ast: Objects) => Schema.Struct<F>;
make: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>;
makeOption: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Option_.Option<Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>>;
makeEffect: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Effect.Effect<Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>, 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; <…;
}
itemSchema, import SchemaSchema.Array<Schema.Struct<F>>(self: Schema.Struct<F>): Schema.$Array<Schema.Struct<F>>
export Array
Defines a ReadonlyArray schema for a given element schema.
Example (Defining an array of strings)
import { Schema } from "effect"
const schema = Schema.Array(Schema.String)
const result = Schema.decodeUnknownSync(schema)(["a", "b", "c"])
console.log(result)
// [ 'a', 'b', 'c' ]
Array(itemSchema: Schema.Struct<F>(parameter) itemSchema: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: F) => To, options?: { readonly unsafePreserveChecks?: boolean | undefined } | undefined) => Schema.Struct<{ [K in keyof Readonly<To>]: Readonly<To>[K]; }>;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>, readonly []>) => Schema.Struct<F>;
annotateKey: (annotations: Schema.Annotations.Key<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>) => Schema.Struct<F>;
check: (checks_0: Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>, ...checks: Array<Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>…;
rebuild: (ast: Objects) => Schema.Struct<F>;
make: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>;
makeOption: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Option_.Option<Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>>;
makeEffect: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Effect.Effect<Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>, 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; <…;
}
itemSchema)]);
const const level: Schema.Schema<
string | number
>
const level: {
Type: T;
Rebuild: Schema<T>;
Iso: Iso;
ast: Ast;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<string | number, any>) => Schema.Schema<string | number>;
annotateKey: (annotations: Schema.Annotations.Key<string | number>) => Schema.Schema<string | number>;
check: (checks_0: Check<string | number>, ...checks: Array<Check<string | number>>) => Schema.Schema<string | number>;
rebuild: (ast: AST) => Schema.Schema<string | number>;
make: (input: unknown, options?: MakeOptions) => string | number;
makeOption: (input: unknown, options?: MakeOptions) => Option_.Option<string | number>;
makeEffect: (input: unknown, options?: MakeOptions) => Effect.Effect<string | number, 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; <…;
}
level = const priorityLane: (
namedLanes?: Readonly<Record<string, number>>
) => Schema.Schema<number | string>
Level argument on the wire — numeric lane index or a name from the tag's
namedLanes registry (when declared at tag construction).
priorityLane(laneConfig: WorkPoolPriorityLaneConfig(parameter) laneConfig: {
laneCount: number;
namedLanes: Record<string, number>;
defaultLevel: number;
}
laneConfig.WorkPoolPriorityLaneConfig.namedLanes?: Record<string, number> | undefinedMap configured names to lane indices (e.g. { interactive: 2, batch: 5 }).
namedLanes);
const const entry: Schema.Struct<{
readonly item: Schema.Struct<F>
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly lane: Schema.optional<Schema.Number>
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>
>
}>
const entry: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly item: Schema.Struct<F>; readonly entryId: Schema.String; readonly key: Schema.optional<Schema.String>; readonly priority: Schema.Literals<readonly ['high', 'normal', 'low']>; readonly lane: Schema.optional<Schema.Nu…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly a…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly atte…;
check: (checks_0: Check<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readon…;
rebuild: (ast: Objects) => Schema.Struct<{ readonly item: Schema.Struct<F>; readonly entryId: Schema.String; readonly key: Schema.optional<Schema.String>; readonly priority: Schema.Literals<readonly ['high', 'normal', 'low']>; readonly lane: Schema…;
make: (input: { readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readonly timestamps: { r…;
makeOption: (input: { readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readonly timestamps: { r…;
makeEffect: (input: { readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readonly timestamps: { r…;
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; <…;
}
entry = const priorityEntry: <
Sch extends Schema.Top
>(
itemSchema: Sch
) => Schema.Struct<{
readonly item: Sch
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly lane: Schema.optional<Schema.Number>
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>
>
}>
Priority queue entry on the wire — like
queueEntry
plus optional numeric level.
priorityEntry(itemSchema: Schema.Struct<F>(parameter) itemSchema: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: F) => To, options?: { readonly unsafePreserveChecks?: boolean | undefined } | undefined) => Schema.Struct<{ [K in keyof Readonly<To>]: Readonly<To>[K]; }>;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>, readonly []>) => Schema.Struct<F>;
annotateKey: (annotations: Schema.Annotations.Key<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>) => Schema.Struct<F>;
check: (checks_0: Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>, ...checks: Array<Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>…;
rebuild: (ast: Objects) => Schema.Struct<F>;
make: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>;
makeOption: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Option_.Option<Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>>;
makeEffect: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Effect.Effect<Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>, 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; <…;
}
itemSchema);
const const eventSchema: Schema.Union<readonly [Schema.TaggedStruct<"Start", {
readonly key: Schema.String;
}>, Schema.TaggedStruct<"Enqueued", {
readonly entries: Schema.$Array<Schema.Struct<{
readonly item: Schema.Struct<F>;
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<...>;
}>;
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<...>]>
const eventSchema: {
Type: { [K in keyof Members]: Members[K]["Type"]; }[number];
Encoded: { [K in keyof Members]: Members[K]["Encoded"]; }[number];
DecodingServices: { [K in keyof Members]: Members[K]["DecodingServices"]; }[number];
EncodingServices: { [K in keyof Members]: Members[K]["EncodingServices"]; }[number];
Iso: { [K in keyof Members]: Members[K]["Iso"]; }[number];
members: Members;
mapMembers: (f: (members: readonly [Schema.TaggedStruct<'Start', { readonly key: Schema.String }>, Schema.TaggedStruct<'Enqueued', { readonly entries: Schema.$Array<Schema.Struct<{ readonly item: Schema.Struct<F>; readonly entryId: Schema.String; read…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<Schema.Struct.ReadonlySide<{ readonly _tag: Schema.tag<'Start'>; readonly key: Schema.String; }, 'Type'> | { readonly entries: ReadonlyArray<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Stru…;
annotateKey: (annotations: Schema.Annotations.Key<Schema.Struct.ReadonlySide<{ readonly _tag: Schema.tag<'Start'>; readonly key: Schema.String }, 'Type'> | { readonly entries: ReadonlyArray<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.T…;
check: (checks_0: Check<Schema.Struct.ReadonlySide<{ readonly _tag: Schema.tag<'Start'>; readonly key: Schema.String }, 'Type'> | { readonly entries: ReadonlyArray<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, …;
rebuild: (ast: Union<Objects>) => Schema.Union<readonly [Schema.TaggedStruct<'Start', { readonly key: Schema.String }>, Schema.TaggedStruct<'Enqueued', { readonly entries: Schema.$Array<Schema.Struct<{ readonly item: Schema.Struct<F>; readonly entr…;
make: (input: { readonly key: string; readonly _tag?: 'Start' | undefined } | { readonly entries: ReadonlyArray<{ readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string;…;
makeOption: (input: { readonly key: string; readonly _tag?: 'Start' | undefined } | { readonly entries: ReadonlyArray<{ readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string;…;
makeEffect: (input: { readonly key: string; readonly _tag?: 'Start' | undefined } | { readonly entries: ReadonlyArray<{ readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string;…;
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; <…;
}
eventSchema = const buildQueueEvent: <Schema.Struct<F>, Schema.Top | Schema.Void, Schema.Top | Schema.Unknown>(itemSchema: Schema.Struct<F>, successSchema: Schema.Top | Schema.Void, errorSchema: Schema.Top | Schema.Unknown) => Schema.Union<readonly [Schema.TaggedStruct<"Start", {
readonly key: Schema.String;
}>, Schema.TaggedStruct<"Enqueued", {
readonly entries: Schema.$Array<Schema.Struct<{
readonly item: Schema.Struct<F>;
readonly entryId: Schema.String;
readonly key: Schema.optional<Schema.String>;
... 6 more ...;
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: Schema.Struct<F>(parameter) itemSchema: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: F) => To, options?: { readonly unsafePreserveChecks?: boolean | undefined } | undefined) => Schema.Struct<{ [K in keyof Readonly<To>]: Readonly<To>[K]; }>;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>, readonly []>) => Schema.Struct<F>;
annotateKey: (annotations: Schema.Annotations.Key<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>) => Schema.Struct<F>;
check: (checks_0: Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>, ...checks: Array<Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>…;
rebuild: (ast: Objects) => Schema.Struct<F>;
make: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>;
makeOption: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Option_.Option<Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>>;
makeEffect: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Effect.Effect<Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>, 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; <…;
}
itemSchema,
wire: {
readonly success?: Schema.Top
readonly error?: Schema.Top
}
wire?.success?: Schema.Topsuccess ?? 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,
wire: {
readonly success?: Schema.Top
readonly error?: Schema.Top
}
wire?.error?: Schema.Toperror ?? import SchemaSchema.const Unknown: Unknownconst Unknown: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<unknown, readonly []>) => Schema.Unknown;
annotateKey: (annotations: Schema.Annotations.Key<unknown>) => Schema.Unknown;
check: (checks_0: Check<unknown>, ...checks: Array<Check<unknown>>) => Schema.Unknown;
rebuild: (ast: Unknown) => Schema.Unknown;
make: (input: unknown, options?: MakeOptions) => unknown;
makeOption: (input: unknown, options?: MakeOptions) => Option_.Option<unknown>;
makeEffect: (input: unknown, options?: MakeOptions) => Effect.Effect<unknown, 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
Unknown
.
Schema for the unknown type. Accepts any value without validation.
When to use
Use as a top schema when you need to accept any input while preserving
TypeScript's unknown safety at use sites.
Unknown,
);
return {
...const priorityControlSpec: {
status: Hyperlink.Marked<Hyperlink.Method<undefined, Schema.Struct<{
readonly sizes: Schema.$Record<Schema.String, Schema.Number>;
readonly paused: Schema.Boolean;
readonly inFlight: Schema.Number;
readonly completed: Schema.Number;
readonly phase: Schema.Literals<readonly ["running", "draining", "off"]>;
}>, Schema.Never, true, Hyperlink.MethodAnnotations & {
description: string;
}, Hyperlink.Derive>, {
readonly _tag: "ref";
}>;
... 8 more ...;
metrics: {
...;
};
}
Shared control + observation contract for every priority-queue instance.
priorityControlSpec,
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
>
(property) add: {
kind: MethodKind;
payload: P;
success: Su;
error: E;
stream: Str;
annotations: Ann;
annotate: <A extends MethodAnnotations>(annotations: A) => Method<P, Su, E, Str, Ann & A, Client>;
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; <…;
}
add: import HyperlinkHyperlink.function mutatePair<Schema.Void, Schema.Union<readonly [Schema.Struct<F>, Schema.$Array<Schema.Struct<F>>]>, Schema.optional<Schema.Schema<string | number>>>(success: Schema.Void, head: Schema.Union<readonly [Schema.Struct<F>, Schema.$Array<Schema.Struct<F>>]>, tail: Schema.optional<Schema.Schema<string | number>>): Hyperlink.Method<Schema.Tuple<readonly [Schema.Union<readonly [Schema.Struct<F>, Schema.$Array<Schema.Struct<F>>]>, Schema.optional<...>]>, ... 4 more ..., Hyperlink.Derive> (+1 overload)Like
effectFn
, but the payload must be a 2-tuple schema surfaced as two call
arguments (first, second?) — used by priority-queue add(item, lane?).
mutatePair(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, const itemOrItems: Schema.Union<
readonly [
Schema.Struct<F>,
Schema.$Array<Schema.Struct<F>>
]
>
const itemOrItems: {
Type: { [K in keyof Members]: Members[K]["Type"]; }[number];
Encoded: { [K in keyof Members]: Members[K]["Encoded"]; }[number];
DecodingServices: { [K in keyof Members]: Members[K]["DecodingServices"]; }[number];
EncodingServices: { [K in keyof Members]: Members[K]["EncodingServices"]; }[number];
Iso: { [K in keyof Members]: Members[K]["Iso"]; }[number];
members: Members;
mapMembers: (f: (members: readonly [Schema.Struct<F>, Schema.$Array<Schema.Struct<F>>]) => To, options?: { readonly unsafePreserveChecks?: boolean | undefined } | undefined) => Schema.Union<{ [K in keyof Readonly<To>]: Readonly<To>[K]; }>;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>> | ReadonlyArray<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeM…;
annotateKey: (annotations: Schema.Annotations.Key<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>> | ReadonlyArray<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMuta…;
check: (checks_0: Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>> | ReadonlyArray<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>>, ...ch…;
rebuild: (ast: Union<Arrays | Objects>) => Schema.Union<readonly [Schema.Struct<F>, Schema.$Array<Schema.Struct<F>>]>;
make: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>> | ReadonlyArray<Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>>, options?: MakeOptions) => Struct.…;
makeOption: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>> | ReadonlyArray<Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>>, options?: MakeOptions) => Option_…;
makeEffect: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>> | ReadonlyArray<Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>>, options?: MakeOptions) => Effect.…;
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; <…;
}
itemOrItems, import SchemaSchema.const optional: optionalLambda
<Schema.Schema<string | number>>(self: Schema.Schema<string | number>) => Schema.optional<Schema.Schema<string | number>>
Type-level representation returned by
optional
.
Marks a struct field as optional, allowing the key to be absent or
undefined.
Details
The resulting property may be absent or explicitly set to undefined.
Equivalent to optionalKey(UndefinedOr(S)).
Use
optionalKey
instead if you want exact optional semantics (absent
only, not undefined).
Example (Defining an optional field accepting undefined)
import { Schema } from "effect"
const schema = Schema.Struct({
name: Schema.String,
age: Schema.optional(Schema.Number)
})
// { readonly name: string; readonly age?: number | undefined }
type Person = typeof schema.Type
optional(const level: Schema.Schema<
string | number
>
const level: {
Type: T;
Rebuild: Schema<T>;
Iso: Iso;
ast: Ast;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<string | number, any>) => Schema.Schema<string | number>;
annotateKey: (annotations: Schema.Annotations.Key<string | number>) => Schema.Schema<string | number>;
check: (checks_0: Check<string | number>, ...checks: Array<Check<string | number>>) => Schema.Schema<string | number>;
rebuild: (ast: AST) => Schema.Schema<string | number>;
make: (input: unknown, options?: MakeOptions) => string | number;
makeOption: (input: unknown, options?: MakeOptions) => Option_.Option<string | number>;
makeEffect: (input: unknown, options?: MakeOptions) => Effect.Effect<string | number, 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; <…;
}
level)).Method<Tuple<readonly [Union<readonly [Struct<F>, $Array<Struct<F>>]>, optional<Schema<string | number>>]>, Void, Never, false, PairMethodAnnotations, Derive>.annotate: <A extends MethodAnnotations>(annotations: A) => Method<P, Su, E, Str, Ann & A, Client>annotate({
description: stringdescription:
"Enqueue an item (or batch) at an optional lane — numeric index or configured name.",
}),
enqueue: Hyperlink.Method<
Schema.$Array<
Schema.Struct<{
readonly item: Schema.Struct<F>
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly lane: Schema.optional<Schema.Number>
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.Void,
Schema.Never,
false,
Hyperlink.MethodAnnotations & {
description: string
},
Hyperlink.Derive
>
(property) enqueue: {
kind: MethodKind;
payload: P;
success: Su;
error: E;
stream: Str;
annotations: Ann;
annotate: <A extends MethodAnnotations>(annotations: A) => Method<P, Su, E, Str, Ann & A, Client>;
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; <…;
}
enqueue: import HyperlinkHyperlink.function effectFn<Schema.$Array<Schema.Struct<{
readonly item: Schema.Struct<F>;
readonly entryId: Schema.String;
readonly key: Schema.optional<Schema.String>;
readonly priority: Schema.Literals<readonly ["high", "normal", "low"]>;
readonly lane: Schema.optional<Schema.Number>;
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<...>;
}>;
readonly batchId: Schema.optional<...>;
readonly releaseId: Schema.optional<...>;
readonly sourceHyperlinkId: Schema.optional<...>;
readonly attributes: Schema.optional<...>;
}>>>(payload: Schema.$Array<...>): Hyperlink.Method<...> (+7 overloads)
Two-stage
effectFn
— override the client-facing type with a Client that must narrow
the schema-derived shape: effectFn<Client>()(payload). Reshape freely (e.g. add overloads), but a
Client that would accept payloads the wire rejects fails to compile (payload resolves to never).
For an override that can't be a narrowing (a generic library), use
unsafeEffectFn
.
effectFn(import SchemaSchema.Array<Schema.Struct<{
readonly item: Schema.Struct<F>;
readonly entryId: Schema.String;
readonly key: Schema.optional<Schema.String>;
readonly priority: Schema.Literals<readonly ["high", "normal", "low"]>;
readonly lane: Schema.optional<Schema.Number>;
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<...>;
}>;
readonly batchId: Schema.optional<...>;
readonly releaseId: Schema.optional<...>;
readonly sourceHyperlinkId: Schema.optional<...>;
readonly attributes: Schema.optional<...>;
}>>(self: Schema.Struct<...>): Schema.$Array<...>
export Array
Defines a ReadonlyArray schema for a given element schema.
Example (Defining an array of strings)
import { Schema } from "effect"
const schema = Schema.Array(Schema.String)
const result = Schema.decodeUnknownSync(schema)(["a", "b", "c"])
console.log(result)
// [ 'a', 'b', 'c' ]
Array(const entry: Schema.Struct<{
readonly item: Schema.Struct<F>
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly lane: Schema.optional<Schema.Number>
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>
>
}>
const entry: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly item: Schema.Struct<F>; readonly entryId: Schema.String; readonly key: Schema.optional<Schema.String>; readonly priority: Schema.Literals<readonly ['high', 'normal', 'low']>; readonly lane: Schema.optional<Schema.Nu…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly a…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly atte…;
check: (checks_0: Check<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readon…;
rebuild: (ast: Objects) => Schema.Struct<{ readonly item: Schema.Struct<F>; readonly entryId: Schema.String; readonly key: Schema.optional<Schema.String>; readonly priority: Schema.Literals<readonly ['high', 'normal', 'low']>; readonly lane: Schema…;
make: (input: { readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readonly timestamps: { r…;
makeOption: (input: { readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readonly timestamps: { r…;
makeEffect: (input: { readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readonly timestamps: { r…;
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; <…;
}
entry)).Method<$Array<Struct<{ readonly item: Struct<F>; readonly entryId: String; readonly key: optional<String>; readonly priority: Literals<readonly ["high", "normal", "low"]>; ... 6 more ...; readonly attributes: optional<...>; }>>, ... 4 more ..., Derive>.annotate: <A extends MethodAnnotations>(annotations: A) => Method<P, Su, E, Str, Ann & A, Client>annotate({
description: stringdescription:
"Re-inject existing entries — each re-enters at its own level with attempts preserved.",
}),
release: Hyperlink.Method<
{
readonly options: Schema.optionalKey<
Schema.Struct<{
readonly scope: Schema.optionalKey<
Schema.Literal<"pendingOnly">
>
readonly releaseId: Schema.optionalKey<Schema.String>
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<
JsonValue,
JsonValue,
never,
never
>
>
>
}>
>
},
Schema.$Array<
Schema.Struct<{
readonly item: Schema.Struct<F>
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly lane: Schema.optional<Schema.Number>
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.Never,
false,
Hyperlink.MethodAnnotations & {
description: string
destructive: true
},
Hyperlink.Derive
>
(property) release: {
kind: MethodKind;
payload: P;
success: Su;
error: E;
stream: Str;
annotations: Ann;
annotate: <A extends MethodAnnotations>(annotations: A) => Method<P, Su, E, Str, Ann & A, Client>;
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; <…;
}
release: import HyperlinkHyperlink.function effectFn<{
readonly options: Schema.optionalKey<Schema.Struct<{
readonly scope: Schema.optionalKey<Schema.Literal<"pendingOnly">>;
readonly releaseId: Schema.optionalKey<Schema.String>;
readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>>;
}>>;
}, 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<...>;
}>>>(payload: {
readonly options: Schema.optionalKey<Schema.Struct<{
readonly scope: Schema.optionalKey<Schema.Literal<"pendingOnly">>;
readonly releaseId: Schema.optionalKey<Schema.String>;
readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>>;
}>>;
}, success: Schema.$Array<...>): Hyperlink.Method<...> (+7 overloads)
Two-stage
effectFn
— override the client-facing type with a Client that must narrow
the schema-derived shape: effectFn<Client>()(payload). Reshape freely (e.g. add overloads), but a
Client that would accept payloads the wire rejects fails to compile (payload resolves to never).
For an override that can't be a narrowing (a generic library), use
unsafeEffectFn
.
effectFn(
{ options: Schema.optionalKey<
Schema.Struct<{
readonly scope: Schema.optionalKey<
Schema.Literal<"pendingOnly">
>
readonly releaseId: Schema.optionalKey<Schema.String>
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<
JsonValue,
JsonValue,
never,
never
>
>
>
}>
>
(property) options: {
Type: S["Type"];
Encoded: S["Encoded"];
DecodingServices: S["DecodingServices"];
EncodingServices: S["EncodingServices"];
Iso: S["Iso"];
schema: S;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: JsonValue; } | undefined; readonly scope?: 'pendingOnly' | undefined; }, readonly []>) => Schema.optionalKey<S…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: JsonValue } | undefined; readonly scope?: 'pendingOnly' | undefined }>) => Schema.optionalKey<Schema.Struct<{ rea…;
check: (checks_0: Check<{ readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: JsonValue } | undefined; readonly scope?: 'pendingOnly' | undefined }>, ...checks: Array<Check<{ readonly releaseId?: string | undefi…;
rebuild: (ast: Objects) => Schema.optionalKey<Schema.Struct<{ readonly scope: Schema.optionalKey<Schema.Literal<'pendingOnly'>>; readonly releaseId: Schema.optionalKey<Schema.String>; readonly attributes: Schema.optionalKey<Schema.$Record<Schema.St…;
make: (input: { readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: unknown } | undefined; readonly scope?: 'pendingOnly' | undefined }, options?: MakeOptions) => { readonly releaseId?: string | undefined; read…;
makeOption: (input: { readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: unknown } | undefined; readonly scope?: 'pendingOnly' | undefined }, options?: MakeOptions) => Option_.Option<{ readonly releaseId?: string | …;
makeEffect: (input: { readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: unknown } | undefined; readonly scope?: 'pendingOnly' | undefined }, options?: MakeOptions) => Effect.Effect<{ readonly releaseId?: string | u…;
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; <…;
}
options: import SchemaSchema.const optionalKey: optionalKeyLambda
<Schema.Struct<{
readonly scope: Schema.optionalKey<Schema.Literal<"pendingOnly">>;
readonly releaseId: Schema.optionalKey<Schema.String>;
readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>>;
}>>(self: Schema.Struct<{
readonly scope: Schema.optionalKey<Schema.Literal<"pendingOnly">>;
readonly releaseId: Schema.optionalKey<Schema.String>;
readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>>;
}>) => Schema.optionalKey<...>
Type-level representation returned by
optionalKey
.
Creates an exact optional key schema for struct fields. Unlike optional,
this creates exact optional properties (not | undefined) that can be
completely omitted from the object.
Example (Creating a struct with optional key)
import { Schema } from "effect"
const schema = Schema.Struct({
name: Schema.String,
age: Schema.optionalKey(Schema.Number)
})
// Type: { readonly name: string; readonly age?: number }
type Person = typeof schema["Type"]
optionalKey(const queueReleaseOptions: Schema.Struct<{
readonly scope: Schema.optionalKey<
Schema.Literal<"pendingOnly">
>
readonly releaseId: Schema.optionalKey<Schema.String>
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<
JsonValue,
JsonValue,
never,
never
>
>
>
}>
const queueReleaseOptions: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly scope: Schema.optionalKey<Schema.Literal<'pendingOnly'>>; readonly releaseId: Schema.optionalKey<Schema.String>; readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValu…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: JsonValue; } | undefined; readonly scope?: 'pendingOnly' | undefined; }, readonly []>) => Schema.Struct<{ read…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: JsonValue } | undefined; readonly scope?: 'pendingOnly' | undefined }>) => Schema.Struct<{ readonly scope: Schema…;
check: (checks_0: Check<{ readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: JsonValue } | undefined; readonly scope?: 'pendingOnly' | undefined }>, ...checks: Array<Check<{ readonly releaseId?: string | undefi…;
rebuild: (ast: Objects) => Schema.Struct<{ readonly scope: Schema.optionalKey<Schema.Literal<'pendingOnly'>>; readonly releaseId: Schema.optionalKey<Schema.String>; readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<…;
make: (input: { readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: unknown } | undefined; readonly scope?: 'pendingOnly' | undefined }, options?: MakeOptions) => { readonly releaseId?: string | undefined; read…;
makeOption: (input: { readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: unknown } | undefined; readonly scope?: 'pendingOnly' | undefined }, options?: MakeOptions) => Option_.Option<{ readonly releaseId?: string | …;
makeEffect: (input: { readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: unknown } | undefined; readonly scope?: 'pendingOnly' | undefined }, options?: MakeOptions) => Effect.Effect<{ readonly releaseId?: string | u…;
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; <…;
}
Options for release / releaseEncoded (wire form of QueueReleaseOptions).
queueReleaseOptions) },
import SchemaSchema.Array<Schema.Struct<{
readonly item: Schema.Struct<F>;
readonly entryId: Schema.String;
readonly key: Schema.optional<Schema.String>;
readonly priority: Schema.Literals<readonly ["high", "normal", "low"]>;
readonly lane: Schema.optional<Schema.Number>;
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<...>;
}>;
readonly batchId: Schema.optional<...>;
readonly releaseId: Schema.optional<...>;
readonly sourceHyperlinkId: Schema.optional<...>;
readonly attributes: Schema.optional<...>;
}>>(self: Schema.Struct<...>): Schema.$Array<...>
export Array
Defines a ReadonlyArray schema for a given element schema.
Example (Defining an array of strings)
import { Schema } from "effect"
const schema = Schema.Array(Schema.String)
const result = Schema.decodeUnknownSync(schema)(["a", "b", "c"])
console.log(result)
// [ 'a', 'b', 'c' ]
Array(const entry: Schema.Struct<{
readonly item: Schema.Struct<F>
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly lane: Schema.optional<Schema.Number>
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>
>
}>
const entry: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly item: Schema.Struct<F>; readonly entryId: Schema.String; readonly key: Schema.optional<Schema.String>; readonly priority: Schema.Literals<readonly ['high', 'normal', 'low']>; readonly lane: Schema.optional<Schema.Nu…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly a…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly atte…;
check: (checks_0: Check<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readon…;
rebuild: (ast: Objects) => Schema.Struct<{ readonly item: Schema.Struct<F>; readonly entryId: Schema.String; readonly key: Schema.optional<Schema.String>; readonly priority: Schema.Literals<readonly ['high', 'normal', 'low']>; readonly lane: Schema…;
make: (input: { readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readonly timestamps: { r…;
makeOption: (input: { readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readonly timestamps: { r…;
makeEffect: (input: { readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readonly timestamps: { r…;
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; <…;
}
entry),
).Method<{ readonly options: optionalKey<Struct<{ readonly scope: optionalKey<Literal<"pendingOnly">>; readonly releaseId: optionalKey<String>; readonly attributes: optionalKey<...>; }>>; }, ... 4 more ..., Derive>.annotate: <A extends MethodAnnotations>(annotations: A) => Method<P, Su, E, Str, Ann & A, Client>annotate({
description: stringdescription:
"Export pending entries for handoff and remove them from this queue.",
destructive: truedestructive: true,
}),
releaseEncoded: Hyperlink.Method<
{
readonly options: Schema.optionalKey<
Schema.Struct<{
readonly scope: Schema.optionalKey<
Schema.Literal<"pendingOnly">
>
readonly releaseId: Schema.optionalKey<Schema.String>
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<
JsonValue,
JsonValue,
never,
never
>
>
>
}>
>
},
Schema.$Array<
Schema.Struct<{
readonly payload: Schema.Codec<
JsonValue,
JsonValue,
never,
never
>
readonly item: Schema.Struct<{
readonly id: Schema.String
readonly version: Schema.String
readonly encoding: Schema.Literal<"json">
readonly jsonSchema: Schema.Unknown
}>
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.Union<
readonly [
typeof QueueMissingItemSchemaError,
typeof QueueItemEncodingError
]
>,
false,
Hyperlink.MethodAnnotations & {
description: string
destructive: true
},
Hyperlink.Derive
>
(property) releaseEncoded: {
kind: MethodKind;
payload: P;
success: Su;
error: E;
stream: Str;
annotations: Ann;
annotate: <A extends MethodAnnotations>(annotations: A) => Method<P, Su, E, Str, Ann & A, Client>;
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; <…;
}
releaseEncoded: import HyperlinkHyperlink.function effectFn<{
readonly options: Schema.optionalKey<Schema.Struct<{
readonly scope: Schema.optionalKey<Schema.Literal<"pendingOnly">>;
readonly releaseId: Schema.optionalKey<Schema.String>;
readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>>;
}>>;
}, Schema.$Array<Schema.Struct<{
readonly payload: Schema.Codec<JsonValue, JsonValue, never, never>;
readonly item: Schema.Struct<{
...;
}>;
... 8 more ...;
readonly attributes: Schema.optional<...>;
}>>, Schema.Union<...>>(payload: {
readonly options: Schema.optionalKey<Schema.Struct<{
readonly scope: Schema.optionalKey<Schema.Literal<"pendingOnly">>;
readonly releaseId: Schema.optionalKey<Schema.String>;
readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>>;
}>>;
}, success: Schema.$Array<...>, error: Schema.Union<...>): Hyperlink.Method<...> (+7 overloads)
Two-stage
effectFn
— override the client-facing type with a Client that must narrow
the schema-derived shape: effectFn<Client>()(payload). Reshape freely (e.g. add overloads), but a
Client that would accept payloads the wire rejects fails to compile (payload resolves to never).
For an override that can't be a narrowing (a generic library), use
unsafeEffectFn
.
effectFn(
{ options: Schema.optionalKey<
Schema.Struct<{
readonly scope: Schema.optionalKey<
Schema.Literal<"pendingOnly">
>
readonly releaseId: Schema.optionalKey<Schema.String>
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<
JsonValue,
JsonValue,
never,
never
>
>
>
}>
>
(property) options: {
Type: S["Type"];
Encoded: S["Encoded"];
DecodingServices: S["DecodingServices"];
EncodingServices: S["EncodingServices"];
Iso: S["Iso"];
schema: S;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: JsonValue; } | undefined; readonly scope?: 'pendingOnly' | undefined; }, readonly []>) => Schema.optionalKey<S…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: JsonValue } | undefined; readonly scope?: 'pendingOnly' | undefined }>) => Schema.optionalKey<Schema.Struct<{ rea…;
check: (checks_0: Check<{ readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: JsonValue } | undefined; readonly scope?: 'pendingOnly' | undefined }>, ...checks: Array<Check<{ readonly releaseId?: string | undefi…;
rebuild: (ast: Objects) => Schema.optionalKey<Schema.Struct<{ readonly scope: Schema.optionalKey<Schema.Literal<'pendingOnly'>>; readonly releaseId: Schema.optionalKey<Schema.String>; readonly attributes: Schema.optionalKey<Schema.$Record<Schema.St…;
make: (input: { readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: unknown } | undefined; readonly scope?: 'pendingOnly' | undefined }, options?: MakeOptions) => { readonly releaseId?: string | undefined; read…;
makeOption: (input: { readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: unknown } | undefined; readonly scope?: 'pendingOnly' | undefined }, options?: MakeOptions) => Option_.Option<{ readonly releaseId?: string | …;
makeEffect: (input: { readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: unknown } | undefined; readonly scope?: 'pendingOnly' | undefined }, options?: MakeOptions) => Effect.Effect<{ readonly releaseId?: string | u…;
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; <…;
}
options: import SchemaSchema.const optionalKey: optionalKeyLambda
<Schema.Struct<{
readonly scope: Schema.optionalKey<Schema.Literal<"pendingOnly">>;
readonly releaseId: Schema.optionalKey<Schema.String>;
readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>>;
}>>(self: Schema.Struct<{
readonly scope: Schema.optionalKey<Schema.Literal<"pendingOnly">>;
readonly releaseId: Schema.optionalKey<Schema.String>;
readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>>;
}>) => Schema.optionalKey<...>
Type-level representation returned by
optionalKey
.
Creates an exact optional key schema for struct fields. Unlike optional,
this creates exact optional properties (not | undefined) that can be
completely omitted from the object.
Example (Creating a struct with optional key)
import { Schema } from "effect"
const schema = Schema.Struct({
name: Schema.String,
age: Schema.optionalKey(Schema.Number)
})
// Type: { readonly name: string; readonly age?: number }
type Person = typeof schema["Type"]
optionalKey(const queueReleaseOptions: Schema.Struct<{
readonly scope: Schema.optionalKey<
Schema.Literal<"pendingOnly">
>
readonly releaseId: Schema.optionalKey<Schema.String>
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<
JsonValue,
JsonValue,
never,
never
>
>
>
}>
const queueReleaseOptions: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly scope: Schema.optionalKey<Schema.Literal<'pendingOnly'>>; readonly releaseId: Schema.optionalKey<Schema.String>; readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValu…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: JsonValue; } | undefined; readonly scope?: 'pendingOnly' | undefined; }, readonly []>) => Schema.Struct<{ read…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: JsonValue } | undefined; readonly scope?: 'pendingOnly' | undefined }>) => Schema.Struct<{ readonly scope: Schema…;
check: (checks_0: Check<{ readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: JsonValue } | undefined; readonly scope?: 'pendingOnly' | undefined }>, ...checks: Array<Check<{ readonly releaseId?: string | undefi…;
rebuild: (ast: Objects) => Schema.Struct<{ readonly scope: Schema.optionalKey<Schema.Literal<'pendingOnly'>>; readonly releaseId: Schema.optionalKey<Schema.String>; readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<…;
make: (input: { readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: unknown } | undefined; readonly scope?: 'pendingOnly' | undefined }, options?: MakeOptions) => { readonly releaseId?: string | undefined; read…;
makeOption: (input: { readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: unknown } | undefined; readonly scope?: 'pendingOnly' | undefined }, options?: MakeOptions) => Option_.Option<{ readonly releaseId?: string | …;
makeEffect: (input: { readonly releaseId?: string | undefined; readonly attributes?: { readonly [x: string]: unknown } | undefined; readonly scope?: 'pendingOnly' | undefined }, options?: MakeOptions) => Effect.Effect<{ readonly releaseId?: string | u…;
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; <…;
}
Options for release / releaseEncoded (wire form of QueueReleaseOptions).
queueReleaseOptions) },
import SchemaSchema.Array<Schema.Struct<{
readonly payload: Schema.Codec<JsonValue, JsonValue, never, never>;
readonly item: Schema.Struct<{
readonly id: Schema.String;
readonly version: Schema.String;
readonly encoding: Schema.Literal<"json">;
readonly jsonSchema: Schema.Unknown;
}>;
readonly entryId: Schema.String;
readonly key: Schema.optional<Schema.String>;
readonly priority: Schema.Literals<readonly ["high", "normal", "low"]>;
readonly attempts: Schema.Number;
... 4 more ...;
readonly attributes: Schema.optional<...>;
}>>(self: Schema.Struct<...>): Schema.$Array<...>
export Array
Defines a ReadonlyArray schema for a given element schema.
Example (Defining an array of strings)
import { Schema } from "effect"
const schema = Schema.Array(Schema.String)
const result = Schema.decodeUnknownSync(schema)(["a", "b", "c"])
console.log(result)
// [ 'a', 'b', 'c' ]
Array(const queueEncodedEntry: Schema.Struct<{
readonly payload: Schema.Codec<
JsonValue,
JsonValue,
never,
never
>
readonly item: Schema.Struct<{
readonly id: Schema.String
readonly version: Schema.String
readonly encoding: Schema.Literal<"json">
readonly jsonSchema: Schema.Unknown
}>
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>
>
}>
const queueEncodedEntry: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly payload: Schema.Codec<JsonValue, JsonValue, never, never>; readonly item: Schema.Struct<{ readonly id: Schema.String; readonly version: Schema.String; readonly encoding: Schema.Literal<'json'>; readonly jsonSchema: …;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly payload: JsonValue; readonly item: Schema.Struct.ReadonlySide<{ readonly id: Schema.String; readonly version: Schema.String; readonly encoding: Schema.Literal<'json'>; readonly jsonSchema:…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly payload: JsonValue; readonly item: Schema.Struct.ReadonlySide<{ readonly id: Schema.String; readonly version: Schema.String; readonly encoding: Schema.Literal<'json'>; readonly jsonSchema: Sc…;
check: (checks_0: Check<{ readonly payload: JsonValue; readonly item: Schema.Struct.ReadonlySide<{ readonly id: Schema.String; readonly version: Schema.String; readonly encoding: Schema.Literal<'json'>; readonly jsonSchema: Schema.Unknown }, 'Typ…;
rebuild: (ast: Objects) => Schema.Struct<{ readonly payload: Schema.Codec<JsonValue, JsonValue, never, never>; readonly item: Schema.Struct<{ readonly id: Schema.String; readonly version: Schema.String; readonly encoding: Schema.Literal<'json'>; re…;
make: (input: { readonly payload: unknown; readonly item: Struct.ReadonlyMakeIn<{ readonly id: String; readonly version: String; readonly encoding: Literal<'json'>; readonly jsonSchema: Unknown }>; readonly entryId: string; readonly priority: 'h…;
makeOption: (input: { readonly payload: unknown; readonly item: Struct.ReadonlyMakeIn<{ readonly id: String; readonly version: String; readonly encoding: Literal<'json'>; readonly jsonSchema: Unknown }>; readonly entryId: string; readonly priority: 'h…;
makeEffect: (input: { readonly payload: unknown; readonly item: Struct.ReadonlyMakeIn<{ readonly id: String; readonly version: String; readonly encoding: Literal<'json'>; readonly jsonSchema: Unknown }>; readonly entryId: string; readonly priority: 'h…;
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; <…;
}
A queue entry in encoded / wire form — the element returned by releaseEncoded. The
item is replaced by its codec descriptor and the value lives in payload (already
JSON-encoded), so an encoded entry crosses RPC without the receiver knowing the item schema.
Mirrors the engine's QueueEncodedEntry.
queueEncodedEntry),
const queueReleaseEncodingError: Schema.Union<
readonly [
typeof QueueMissingItemSchemaError,
typeof QueueItemEncodingError
]
>
const queueReleaseEncodingError: {
Type: { [K in keyof Members]: Members[K]["Type"]; }[number];
Encoded: { [K in keyof Members]: Members[K]["Encoded"]; }[number];
DecodingServices: { [K in keyof Members]: Members[K]["DecodingServices"]; }[number];
EncodingServices: { [K in keyof Members]: Members[K]["EncodingServices"]; }[number];
Iso: { [K in keyof Members]: Members[K]["Iso"]; }[number];
members: Members;
mapMembers: (f: (members: readonly [typeof QueueMissingItemSchemaError, typeof QueueItemEncodingError]) => To, options?: { readonly unsafePreserveChecks?: boolean | undefined } | undefined) => Schema.Union<{ [K in keyof Readonly<To>]: Readonly<To>[K];…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<QueueMissingItemSchemaError | QueueItemEncodingError, readonly []>) => Schema.Union<readonly [typeof QueueMissingItemSchemaError, typeof QueueItemEncodingError]>;
annotateKey: (annotations: Schema.Annotations.Key<QueueMissingItemSchemaError | QueueItemEncodingError>) => Schema.Union<readonly [typeof QueueMissingItemSchemaError, typeof QueueItemEncodingError]>;
check: (checks_0: Check<QueueMissingItemSchemaError | QueueItemEncodingError>, ...checks: Array<Check<QueueMissingItemSchemaError | QueueItemEncodingError>>) => Schema.Union<readonly [typeof QueueMissingItemSchemaError, typeof QueueItemEncodingEr…;
rebuild: (ast: Union<Declaration>) => Schema.Union<readonly [typeof QueueMissingItemSchemaError, typeof QueueItemEncodingError]>;
make: (input: QueueMissingItemSchemaError | QueueItemEncodingError, options?: MakeOptions) => QueueMissingItemSchemaError | QueueItemEncodingError;
makeOption: (input: QueueMissingItemSchemaError | QueueItemEncodingError, options?: MakeOptions) => Option_.Option<QueueMissingItemSchemaError | QueueItemEncodingError>;
makeEffect: (input: QueueMissingItemSchemaError | QueueItemEncodingError, options?: MakeOptions) => Effect.Effect<QueueMissingItemSchemaError | QueueItemEncodingError, 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; <…;
}
The releaseEncoded failure channel — the wire-encodable union of the engine's encode
errors (now Schema.TaggedErrorClass, so they are both yieldable and RPC-encodable).
queueReleaseEncodingError,
).Method<{ readonly options: optionalKey<Struct<{ readonly scope: optionalKey<Literal<"pendingOnly">>; readonly releaseId: optionalKey<String>; readonly attributes: optionalKey<...>; }>>; }, ... 4 more ..., Derive>.annotate: <A extends MethodAnnotations>(annotations: A) => Method<P, Su, E, Str, Ann & A, Client>annotate({
description: stringdescription: "Export pending entries in encoded/wire form for remote handoff.",
destructive: truedestructive: true,
}),
deadLetter: Hyperlink.Method<
{
readonly selector: Schema.Struct<{
readonly entryId: Schema.optionalKey<Schema.String>
readonly key: Schema.optional<Schema.String>
readonly item: Schema.optionalKey<
Schema.Struct<F>
>
}>
readonly options: Schema.Struct<{
readonly reason: Schema.String
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<
JsonValue,
JsonValue,
never,
never
>
>
>
}>
},
Schema.$Array<
Schema.Struct<{
readonly item: Schema.Struct<F>
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly lane: Schema.optional<Schema.Number>
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.Never,
false,
Hyperlink.MethodAnnotations & {
description: string
destructive: true
},
Hyperlink.Derive
>
(property) deadLetter: {
kind: MethodKind;
payload: P;
success: Su;
error: E;
stream: Str;
annotations: Ann;
annotate: <A extends MethodAnnotations>(annotations: A) => Method<P, Su, E, Str, Ann & A, Client>;
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; <…;
}
deadLetter: import HyperlinkHyperlink.function effectFn<{
readonly selector: Schema.Struct<{
readonly entryId: Schema.optionalKey<Schema.String>;
readonly key: Schema.optional<Schema.String>;
readonly item: Schema.optionalKey<Schema.Struct<F>>;
}>;
readonly options: Schema.Struct<{
readonly reason: Schema.String;
readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>>;
}>;
}, Schema.$Array<Schema.Struct<{
readonly item: Schema.Struct<...>;
... 9 more ...;
readonly attributes: Schema.optional<...>;
}>>>(payload: {
readonly selector: Schema.Struct<{
readonly entryId: Schema.optionalKey<Schema.String>;
readonly key: Schema.optional<Schema.String>;
readonly item: Schema.optionalKey<Schema.Struct<F>>;
}>;
readonly options: Schema.Struct<{
readonly reason: Schema.String;
readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>>;
}>;
}, success: Schema.$Array<...>): Hyperlink.Method<...> (+7 overloads)
Two-stage
effectFn
— override the client-facing type with a Client that must narrow
the schema-derived shape: effectFn<Client>()(payload). Reshape freely (e.g. add overloads), but a
Client that would accept payloads the wire rejects fails to compile (payload resolves to never).
For an override that can't be a narrowing (a generic library), use
unsafeEffectFn
.
effectFn(
{
selector: Schema.Struct<{
readonly entryId: Schema.optionalKey<Schema.String>
readonly key: Schema.optional<Schema.String>
readonly item: Schema.optionalKey<
Schema.Struct<F>
>
}>
(property) selector: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly entryId: Schema.optionalKey<Schema.String>; readonly key: Schema.optional<Schema.String>; readonly item: Schema.optionalKey<Schema.Struct<F>> }) => To, options?: { readonly unsafePreserveChecks?: boolean | undefined…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly key?: string | undefined; readonly item?: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>> | undefined; readonly entryId?: string | undefi…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly key?: string | undefined; readonly item?: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>> | undefined; readonly entryId?: string | undefined…;
check: (checks_0: Check<{ readonly key?: string | undefined; readonly item?: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>> | undefined; readonly entryId?: string | undefined }>, ...checks: Arra…;
rebuild: (ast: Objects) => Schema.Struct<{ readonly entryId: Schema.optionalKey<Schema.String>; readonly key: Schema.optional<Schema.String>; readonly item: Schema.optionalKey<Schema.Struct<F>> }>;
make: (input: { readonly key?: string | undefined; readonly item?: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>> | undefined; readonly entryId?: string | undefined }, options?: MakeOptions) => { readon…;
makeOption: (input: { readonly key?: string | undefined; readonly item?: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>> | undefined; readonly entryId?: string | undefined }, options?: MakeOptions) => Option_.…;
makeEffect: (input: { readonly key?: string | undefined; readonly item?: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>> | undefined; readonly entryId?: string | undefined }, options?: MakeOptions) => Effect.E…;
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; <…;
}
selector: const priorityEntrySelector: <
Sch extends Schema.Top
>(
itemSchema: Sch
) => Schema.Struct<{
readonly entryId: Schema.optionalKey<Schema.String>
readonly key: Schema.optional<Schema.String>
readonly item: Schema.optionalKey<Sch>
}>
Selector for priority-queue routing verbs.
priorityEntrySelector(itemSchema: Schema.Struct<F>(parameter) itemSchema: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: F) => To, options?: { readonly unsafePreserveChecks?: boolean | undefined } | undefined) => Schema.Struct<{ [K in keyof Readonly<To>]: Readonly<To>[K]; }>;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>, readonly []>) => Schema.Struct<F>;
annotateKey: (annotations: Schema.Annotations.Key<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>) => Schema.Struct<F>;
check: (checks_0: Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>, ...checks: Array<Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>…;
rebuild: (ast: Objects) => Schema.Struct<F>;
make: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>;
makeOption: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Option_.Option<Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>>;
makeEffect: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Effect.Effect<Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>, 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; <…;
}
itemSchema),
options: Schema.Struct<{
readonly reason: Schema.String
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<
JsonValue,
JsonValue,
never,
never
>
>
>
}>
(property) options: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly reason: Schema.String; readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>> }) => To, options?: { readonly unsafePreserveChecks?: boolean | undefin…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue; } | undefined; }, readonly []>) => Schema.Struct<{ readonly reason: Schema.String; readonly attributes: Schema.opti…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined }>) => Schema.Struct<{ readonly reason: Schema.String; readonly attributes: Schema.optionalKey<Schema.$Re…;
check: (checks_0: Check<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined }>, ...checks: Array<Check<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined }…;
rebuild: (ast: Objects) => Schema.Struct<{ readonly reason: Schema.String; readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>> }>;
make: (input: { readonly reason: string; readonly attributes?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => { readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined };
makeOption: (input: { readonly reason: string; readonly attributes?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => Option_.Option<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undef…;
makeEffect: (input: { readonly reason: string; readonly attributes?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => Effect.Effect<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefi…;
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; <…;
}
options: const queueRouteOptions: Schema.Struct<{
readonly reason: Schema.String
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<
JsonValue,
JsonValue,
never,
never
>
>
>
}>
const queueRouteOptions: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly reason: Schema.String; readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>> }) => To, options?: { readonly unsafePreserveChecks?: boolean | undefin…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue; } | undefined; }, readonly []>) => Schema.Struct<{ readonly reason: Schema.String; readonly attributes: Schema.opti…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined }>) => Schema.Struct<{ readonly reason: Schema.String; readonly attributes: Schema.optionalKey<Schema.$Re…;
check: (checks_0: Check<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined }>, ...checks: Array<Check<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined }…;
rebuild: (ast: Objects) => Schema.Struct<{ readonly reason: Schema.String; readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>> }>;
make: (input: { readonly reason: string; readonly attributes?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => { readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined };
makeOption: (input: { readonly reason: string; readonly attributes?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => Option_.Option<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undef…;
makeEffect: (input: { readonly reason: string; readonly attributes?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => Effect.Effect<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefi…;
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; <…;
}
Options for deadLetter / drop (wire form of QueueRouteOptions).
queueRouteOptions,
},
import SchemaSchema.Array<Schema.Struct<{
readonly item: Schema.Struct<F>;
readonly entryId: Schema.String;
readonly key: Schema.optional<Schema.String>;
readonly priority: Schema.Literals<readonly ["high", "normal", "low"]>;
readonly lane: Schema.optional<Schema.Number>;
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<...>;
}>;
readonly batchId: Schema.optional<...>;
readonly releaseId: Schema.optional<...>;
readonly sourceHyperlinkId: Schema.optional<...>;
readonly attributes: Schema.optional<...>;
}>>(self: Schema.Struct<...>): Schema.$Array<...>
export Array
Defines a ReadonlyArray schema for a given element schema.
Example (Defining an array of strings)
import { Schema } from "effect"
const schema = Schema.Array(Schema.String)
const result = Schema.decodeUnknownSync(schema)(["a", "b", "c"])
console.log(result)
// [ 'a', 'b', 'c' ]
Array(const entry: Schema.Struct<{
readonly item: Schema.Struct<F>
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly lane: Schema.optional<Schema.Number>
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>
>
}>
const entry: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly item: Schema.Struct<F>; readonly entryId: Schema.String; readonly key: Schema.optional<Schema.String>; readonly priority: Schema.Literals<readonly ['high', 'normal', 'low']>; readonly lane: Schema.optional<Schema.Nu…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly a…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly atte…;
check: (checks_0: Check<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readon…;
rebuild: (ast: Objects) => Schema.Struct<{ readonly item: Schema.Struct<F>; readonly entryId: Schema.String; readonly key: Schema.optional<Schema.String>; readonly priority: Schema.Literals<readonly ['high', 'normal', 'low']>; readonly lane: Schema…;
make: (input: { readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readonly timestamps: { r…;
makeOption: (input: { readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readonly timestamps: { r…;
makeEffect: (input: { readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readonly timestamps: { r…;
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; <…;
}
entry),
).Method<{ readonly selector: Struct<{ readonly entryId: optionalKey<String>; readonly key: optional<String>; readonly item: optionalKey<Struct<F>>; }>; readonly options: Struct<...>; }, ... 4 more ..., Derive>.annotate: <A extends MethodAnnotations>(annotations: A) => Method<P, Su, E, Str, Ann & A, Client>annotate({
description: stringdescription: "Remove pending entries matching the selector and route to dead letter.",
destructive: truedestructive: true,
}),
drop: Hyperlink.Method<
{
readonly selector: Schema.Struct<{
readonly entryId: Schema.optionalKey<Schema.String>
readonly key: Schema.optional<Schema.String>
readonly item: Schema.optionalKey<
Schema.Struct<F>
>
}>
readonly options: Schema.Struct<{
readonly reason: Schema.String
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<
JsonValue,
JsonValue,
never,
never
>
>
>
}>
},
Schema.$Array<
Schema.Struct<{
readonly item: Schema.Struct<F>
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly lane: Schema.optional<Schema.Number>
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.Never,
false,
Hyperlink.MethodAnnotations & {
description: string
destructive: true
},
Hyperlink.Derive
>
(property) drop: {
kind: MethodKind;
payload: P;
success: Su;
error: E;
stream: Str;
annotations: Ann;
annotate: <A extends MethodAnnotations>(annotations: A) => Method<P, Su, E, Str, Ann & A, Client>;
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; <…;
}
drop: import HyperlinkHyperlink.function effectFn<{
readonly selector: Schema.Struct<{
readonly entryId: Schema.optionalKey<Schema.String>;
readonly key: Schema.optional<Schema.String>;
readonly item: Schema.optionalKey<Schema.Struct<F>>;
}>;
readonly options: Schema.Struct<{
readonly reason: Schema.String;
readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>>;
}>;
}, Schema.$Array<Schema.Struct<{
readonly item: Schema.Struct<...>;
... 9 more ...;
readonly attributes: Schema.optional<...>;
}>>>(payload: {
readonly selector: Schema.Struct<{
readonly entryId: Schema.optionalKey<Schema.String>;
readonly key: Schema.optional<Schema.String>;
readonly item: Schema.optionalKey<Schema.Struct<F>>;
}>;
readonly options: Schema.Struct<{
readonly reason: Schema.String;
readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>>;
}>;
}, success: Schema.$Array<...>): Hyperlink.Method<...> (+7 overloads)
Two-stage
effectFn
— override the client-facing type with a Client that must narrow
the schema-derived shape: effectFn<Client>()(payload). Reshape freely (e.g. add overloads), but a
Client that would accept payloads the wire rejects fails to compile (payload resolves to never).
For an override that can't be a narrowing (a generic library), use
unsafeEffectFn
.
effectFn(
{
selector: Schema.Struct<{
readonly entryId: Schema.optionalKey<Schema.String>
readonly key: Schema.optional<Schema.String>
readonly item: Schema.optionalKey<
Schema.Struct<F>
>
}>
(property) selector: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly entryId: Schema.optionalKey<Schema.String>; readonly key: Schema.optional<Schema.String>; readonly item: Schema.optionalKey<Schema.Struct<F>> }) => To, options?: { readonly unsafePreserveChecks?: boolean | undefined…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly key?: string | undefined; readonly item?: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>> | undefined; readonly entryId?: string | undefi…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly key?: string | undefined; readonly item?: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>> | undefined; readonly entryId?: string | undefined…;
check: (checks_0: Check<{ readonly key?: string | undefined; readonly item?: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>> | undefined; readonly entryId?: string | undefined }>, ...checks: Arra…;
rebuild: (ast: Objects) => Schema.Struct<{ readonly entryId: Schema.optionalKey<Schema.String>; readonly key: Schema.optional<Schema.String>; readonly item: Schema.optionalKey<Schema.Struct<F>> }>;
make: (input: { readonly key?: string | undefined; readonly item?: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>> | undefined; readonly entryId?: string | undefined }, options?: MakeOptions) => { readon…;
makeOption: (input: { readonly key?: string | undefined; readonly item?: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>> | undefined; readonly entryId?: string | undefined }, options?: MakeOptions) => Option_.…;
makeEffect: (input: { readonly key?: string | undefined; readonly item?: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>> | undefined; readonly entryId?: string | undefined }, options?: MakeOptions) => Effect.E…;
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; <…;
}
selector: const priorityEntrySelector: <
Sch extends Schema.Top
>(
itemSchema: Sch
) => Schema.Struct<{
readonly entryId: Schema.optionalKey<Schema.String>
readonly key: Schema.optional<Schema.String>
readonly item: Schema.optionalKey<Sch>
}>
Selector for priority-queue routing verbs.
priorityEntrySelector(itemSchema: Schema.Struct<F>(parameter) itemSchema: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: F) => To, options?: { readonly unsafePreserveChecks?: boolean | undefined } | undefined) => Schema.Struct<{ [K in keyof Readonly<To>]: Readonly<To>[K]; }>;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>, readonly []>) => Schema.Struct<F>;
annotateKey: (annotations: Schema.Annotations.Key<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>) => Schema.Struct<F>;
check: (checks_0: Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>>, ...checks: Array<Check<Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>…;
rebuild: (ast: Objects) => Schema.Struct<F>;
make: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>;
makeOption: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Option_.Option<Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>>;
makeEffect: (input: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>, options?: MakeOptions) => Effect.Effect<Struct.View<F, 'Type', Struct.TypeOptionalKeys<F>, Struct.TypeMutableKeys<F>>, 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; <…;
}
itemSchema),
options: Schema.Struct<{
readonly reason: Schema.String
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<
JsonValue,
JsonValue,
never,
never
>
>
>
}>
(property) options: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly reason: Schema.String; readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>> }) => To, options?: { readonly unsafePreserveChecks?: boolean | undefin…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue; } | undefined; }, readonly []>) => Schema.Struct<{ readonly reason: Schema.String; readonly attributes: Schema.opti…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined }>) => Schema.Struct<{ readonly reason: Schema.String; readonly attributes: Schema.optionalKey<Schema.$Re…;
check: (checks_0: Check<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined }>, ...checks: Array<Check<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined }…;
rebuild: (ast: Objects) => Schema.Struct<{ readonly reason: Schema.String; readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>> }>;
make: (input: { readonly reason: string; readonly attributes?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => { readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined };
makeOption: (input: { readonly reason: string; readonly attributes?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => Option_.Option<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undef…;
makeEffect: (input: { readonly reason: string; readonly attributes?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => Effect.Effect<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefi…;
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; <…;
}
options: const queueRouteOptions: Schema.Struct<{
readonly reason: Schema.String
readonly attributes: Schema.optionalKey<
Schema.$Record<
Schema.String,
Schema.Codec<
JsonValue,
JsonValue,
never,
never
>
>
>
}>
const queueRouteOptions: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly reason: Schema.String; readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>> }) => To, options?: { readonly unsafePreserveChecks?: boolean | undefin…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue; } | undefined; }, readonly []>) => Schema.Struct<{ readonly reason: Schema.String; readonly attributes: Schema.opti…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined }>) => Schema.Struct<{ readonly reason: Schema.String; readonly attributes: Schema.optionalKey<Schema.$Re…;
check: (checks_0: Check<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined }>, ...checks: Array<Check<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined }…;
rebuild: (ast: Objects) => Schema.Struct<{ readonly reason: Schema.String; readonly attributes: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<JsonValue, JsonValue, never, never>>> }>;
make: (input: { readonly reason: string; readonly attributes?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => { readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefined };
makeOption: (input: { readonly reason: string; readonly attributes?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => Option_.Option<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undef…;
makeEffect: (input: { readonly reason: string; readonly attributes?: { readonly [x: string]: unknown } | undefined }, options?: MakeOptions) => Effect.Effect<{ readonly reason: string; readonly attributes?: { readonly [x: string]: JsonValue } | undefi…;
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; <…;
}
Options for deadLetter / drop (wire form of QueueRouteOptions).
queueRouteOptions,
},
import SchemaSchema.Array<Schema.Struct<{
readonly item: Schema.Struct<F>;
readonly entryId: Schema.String;
readonly key: Schema.optional<Schema.String>;
readonly priority: Schema.Literals<readonly ["high", "normal", "low"]>;
readonly lane: Schema.optional<Schema.Number>;
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<...>;
}>;
readonly batchId: Schema.optional<...>;
readonly releaseId: Schema.optional<...>;
readonly sourceHyperlinkId: Schema.optional<...>;
readonly attributes: Schema.optional<...>;
}>>(self: Schema.Struct<...>): Schema.$Array<...>
export Array
Defines a ReadonlyArray schema for a given element schema.
Example (Defining an array of strings)
import { Schema } from "effect"
const schema = Schema.Array(Schema.String)
const result = Schema.decodeUnknownSync(schema)(["a", "b", "c"])
console.log(result)
// [ 'a', 'b', 'c' ]
Array(const entry: Schema.Struct<{
readonly item: Schema.Struct<F>
readonly entryId: Schema.String
readonly key: Schema.optional<Schema.String>
readonly priority: Schema.Literals<
readonly ["high", "normal", "low"]
>
readonly lane: Schema.optional<Schema.Number>
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>
>
}>
const entry: {
Type: Struct.Type<Fields>;
Encoded: Struct.Encoded<Fields>;
DecodingServices: Struct.DecodingServices<Fields>;
EncodingServices: Struct.EncodingServices<Fields>;
Iso: Struct.Iso<Fields>;
fields: Fields;
mapFields: (f: (fields: { readonly item: Schema.Struct<F>; readonly entryId: Schema.String; readonly key: Schema.optional<Schema.String>; readonly priority: Schema.Literals<readonly ['high', 'normal', 'low']>; readonly lane: Schema.optional<Schema.Nu…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly a…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly atte…;
check: (checks_0: Check<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, Schema.Struct.TypeMutableKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readon…;
rebuild: (ast: Objects) => Schema.Struct<{ readonly item: Schema.Struct<F>; readonly entryId: Schema.String; readonly key: Schema.optional<Schema.String>; readonly priority: Schema.Literals<readonly ['high', 'normal', 'low']>; readonly lane: Schema…;
make: (input: { readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readonly timestamps: { r…;
makeOption: (input: { readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readonly timestamps: { r…;
makeEffect: (input: { readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string; readonly priority: 'high' | 'normal' | 'low'; readonly attempts: number; readonly timestamps: { r…;
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; <…;
}
entry),
).Method<{ readonly selector: Struct<{ readonly entryId: optionalKey<String>; readonly key: optional<String>; readonly item: optionalKey<Struct<F>>; }>; readonly options: Struct<...>; }, ... 4 more ..., Derive>.annotate: <A extends MethodAnnotations>(annotations: A) => Method<P, Su, E, Str, Ann & A, Client>annotate({
description: stringdescription: "Remove pending entries matching the selector without preserving them.",
destructive: truedestructive: true,
}),
events: Hyperlink.Method<undefined, Schema.Union<readonly [Schema.TaggedStruct<"Start", {
readonly key: Schema.String;
}>, Schema.TaggedStruct<"Enqueued", {
readonly entries: Schema.$Array<Schema.Struct<{
readonly item: Schema.Struct<F>;
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<...>;
}>;
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<...>]>, Schema.Never, true, Hyperlink.MethodAnnotations & {
...;
}, Hyperlink.Derive>
(property) events: {
kind: MethodKind;
payload: P;
success: Su;
error: E;
stream: Str;
annotations: Ann;
annotate: <A extends MethodAnnotations>(annotations: A) => Method<P, Su, E, Str, Ann & A, Client>;
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; <…;
}
events: import HyperlinkHyperlink.function stream<Schema.Union<readonly [Schema.TaggedStruct<"Start", {
readonly key: Schema.String;
}>, Schema.TaggedStruct<"Enqueued", {
readonly entries: Schema.$Array<Schema.Struct<{
readonly item: Schema.Struct<F>;
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<...>;
}>;
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<...>]>>(success: Schema.Union<...>): Hyperlink.Method<...> (+5 overloads)
Define a stream (a live, idempotent push source) whose elements are success. The
service member surfaces as a Stream<Success, Error> (a property, or (payload) => Stream
when a payload is declared) rather than an Effect — drive dashboard atoms, a CLI
--watch, or a TUI from it. Conventionally named changes when it carries a HyperService's
whole observable state (a snapshot stream); back it with a SubscriptionRef's .changes.
Counts as a query for tools (an idempotent read). success is the element schema and
error (if any) is the stream error schema; both must be encodable (they cross RPC).
payload is a single schema or struct fields — same as Effect's Rpc.make.
changes: Hyperlink.stream(QueueSnapshot).annotate({ description: "Live queue state." }),
tail: Hyperlink.stream(LogLine, { payload: Schema.Struct({ since: Schema.Number }) }),
stream(const eventSchema: Schema.Union<readonly [Schema.TaggedStruct<"Start", {
readonly key: Schema.String;
}>, Schema.TaggedStruct<"Enqueued", {
readonly entries: Schema.$Array<Schema.Struct<{
readonly item: Schema.Struct<F>;
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<...>;
}>;
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<...>]>
const eventSchema: {
Type: { [K in keyof Members]: Members[K]["Type"]; }[number];
Encoded: { [K in keyof Members]: Members[K]["Encoded"]; }[number];
DecodingServices: { [K in keyof Members]: Members[K]["DecodingServices"]; }[number];
EncodingServices: { [K in keyof Members]: Members[K]["EncodingServices"]; }[number];
Iso: { [K in keyof Members]: Members[K]["Iso"]; }[number];
members: Members;
mapMembers: (f: (members: readonly [Schema.TaggedStruct<'Start', { readonly key: Schema.String }>, Schema.TaggedStruct<'Enqueued', { readonly entries: Schema.$Array<Schema.Struct<{ readonly item: Schema.Struct<F>; readonly entryId: Schema.String; read…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<Schema.Struct.ReadonlySide<{ readonly _tag: Schema.tag<'Start'>; readonly key: Schema.String; }, 'Type'> | { readonly entries: ReadonlyArray<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Stru…;
annotateKey: (annotations: Schema.Annotations.Key<Schema.Struct.ReadonlySide<{ readonly _tag: Schema.tag<'Start'>; readonly key: Schema.String }, 'Type'> | { readonly entries: ReadonlyArray<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.T…;
check: (checks_0: Check<Schema.Struct.ReadonlySide<{ readonly _tag: Schema.tag<'Start'>; readonly key: Schema.String }, 'Type'> | { readonly entries: ReadonlyArray<{ readonly item: Schema.Struct.View<F, 'Type', Schema.Struct.TypeOptionalKeys<F>, …;
rebuild: (ast: Union<Objects>) => Schema.Union<readonly [Schema.TaggedStruct<'Start', { readonly key: Schema.String }>, Schema.TaggedStruct<'Enqueued', { readonly entries: Schema.$Array<Schema.Struct<{ readonly item: Schema.Struct<F>; readonly entr…;
make: (input: { readonly key: string; readonly _tag?: 'Start' | undefined } | { readonly entries: ReadonlyArray<{ readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string;…;
makeOption: (input: { readonly key: string; readonly _tag?: 'Start' | undefined } | { readonly entries: ReadonlyArray<{ readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string;…;
makeEffect: (input: { readonly key: string; readonly _tag?: 'Start' | undefined } | { readonly entries: ReadonlyArray<{ readonly item: Struct.MakeInView<F, Struct.TypeOptionalKeys<F> | Struct.TypeConstructorDefaultedKeys<F>>; readonly entryId: string;…;
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; <…;
}
eventSchema).Method<undefined, Union<readonly [TaggedStruct<"Start", { readonly key: String; }>, TaggedStruct<"Enqueued", { readonly entries: $Array<Struct<{ readonly item: Struct<F>; readonly entryId: String; ... 7 more ...; readonly attributes: optional<...>; }>>; readonly priority: Literals<...>; readonly batchId: optionalKey<...>; }>, ... 12 more ..., TaggedStruct<...>]>, Never, true, MethodAnnotations, Derive>.annotate: <A extends MethodAnnotations>(annotations: A) => Method<P, Su, E, Str, Ann & A, Client>annotate({
description: stringdescription: "Discrete entry / worker / queue lifecycle events.",
}),
};
};