Schema.Struct<{
readonly supervising: Schema.Boolean
readonly armed: Schema.Boolean
readonly activeInstances: Schema.Number
readonly nextTriggerRun: Schema.optionalKey<Schema.DateTimeUtc>
readonly nextScheduleTransition: Schema.optionalKey<Schema.DateTimeUtc>
readonly nextPollCadence: Schema.optionalKey<Schema.Duration>
readonly runsStarted: Schema.Number
readonly runsSucceeded: Schema.Number
readonly runsFailed: Schema.Number
readonly lastRunStartedAt: Schema.optionalKey<Schema.DateTimeUtc>
readonly lastRunDurationMillis: Schema.optionalKey<Schema.Number>
}>The current-state snapshot of a managed process — the wire form of the engine's
ProcessSnapshot (plus supervising). The element of the reactive status field:
status.get reads it once, status.changes streams it.
export const const processStatus: Schema.Struct<{
readonly supervising: Schema.Boolean;
readonly armed: Schema.Boolean;
readonly activeInstances: Schema.Number;
readonly nextTriggerRun: Schema.optionalKey<Schema.DateTimeUtc>;
readonly nextScheduleTransition: Schema.optionalKey<Schema.DateTimeUtc>;
readonly nextPollCadence: Schema.optionalKey<Schema.Duration>;
readonly runsStarted: Schema.Number;
readonly runsSucceeded: Schema.Number;
readonly runsFailed: Schema.Number;
readonly lastRunStartedAt: Schema.optionalKey<...>;
readonly lastRunDurationMillis: Schema.optionalKey<...>;
}>
const processStatus: {
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 supervising: Schema.Boolean; readonly armed: Schema.Boolean; readonly activeInstances: Schema.Number; readonly nextTriggerRun: Schema.optionalKey<Schema.DateTimeUtc>; readonly nextScheduleTransition: Schema.optional…;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<{ readonly supervising: boolean; readonly armed: boolean; readonly activeInstances: number; readonly runsStarted: number; readonly runsSucceeded: number; readonly runsFailed: number; readonly nextTri…;
annotateKey: (annotations: Schema.Annotations.Key<{ readonly supervising: boolean; readonly armed: boolean; readonly activeInstances: number; readonly runsStarted: number; readonly runsSucceeded: number; readonly runsFailed: number; readonly nextTrigge…;
check: (checks_0: Check<{ readonly supervising: boolean; readonly armed: boolean; readonly activeInstances: number; readonly runsStarted: number; readonly runsSucceeded: number; readonly runsFailed: number; readonly nextTriggerRun?: DateTime.Utc …;
rebuild: (ast: Objects) => Schema.Struct<{ readonly supervising: Schema.Boolean; readonly armed: Schema.Boolean; readonly activeInstances: Schema.Number; readonly nextTriggerRun: Schema.optionalKey<Schema.DateTimeUtc>; readonly nextScheduleTransiti…;
make: (input: { readonly supervising: boolean; readonly armed: boolean; readonly activeInstances: number; readonly runsStarted: number; readonly runsSucceeded: number; readonly runsFailed: number; readonly nextTriggerRun?: DateTime.Utc | undefin…;
makeOption: (input: { readonly supervising: boolean; readonly armed: boolean; readonly activeInstances: number; readonly runsStarted: number; readonly runsSucceeded: number; readonly runsFailed: number; readonly nextTriggerRun?: DateTime.Utc | undefin…;
makeEffect: (input: { readonly supervising: boolean; readonly armed: boolean; readonly activeInstances: number; readonly runsStarted: number; readonly runsSucceeded: number; readonly runsFailed: number; readonly nextTriggerRun?: DateTime.Utc | undefin…;
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 current-state snapshot of a managed process — the wire form of the engine's
ProcessSnapshot
(plus supervising). The element of the reactive status field:
status.get reads it once, status.changes streams it.
processStatus = import SchemaSchema.function Struct<{
readonly supervising: Schema.Boolean;
readonly armed: Schema.Boolean;
readonly activeInstances: Schema.Number;
readonly nextTriggerRun: Schema.optionalKey<Schema.DateTimeUtc>;
readonly nextScheduleTransition: Schema.optionalKey<Schema.DateTimeUtc>;
readonly nextPollCadence: Schema.optionalKey<Schema.Duration>;
readonly runsStarted: Schema.Number;
readonly runsSucceeded: Schema.Number;
readonly runsFailed: Schema.Number;
readonly lastRunStartedAt: Schema.optionalKey<...>;
readonly lastRunDurationMillis: Schema.optionalKey<...>;
}>(fields: {
readonly supervising: Schema.Boolean;
readonly armed: Schema.Boolean;
readonly activeInstances: Schema.Number;
readonly nextTriggerRun: Schema.optionalKey<Schema.DateTimeUtc>;
readonly nextScheduleTransition: Schema.optionalKey<Schema.DateTimeUtc>;
readonly nextPollCadence: Schema.optionalKey<Schema.Duration>;
readonly runsStarted: Schema.Number;
readonly runsSucceeded: Schema.Number;
readonly runsFailed: Schema.Number;
readonly lastRunStartedAt: Schema.optionalKey<...>;
readonly lastRunDurationMillis: Schema.optionalKey<...>;
}): Schema.Struct<...>
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 }
Struct({
supervising: Schema.Boolean(property) supervising: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<boolean, readonly []>) => Schema.Boolean;
annotateKey: (annotations: Schema.Annotations.Key<boolean>) => Schema.Boolean;
check: (checks_0: Check<boolean>, ...checks: Array<Check<boolean>>) => Schema.Boolean;
rebuild: (ast: Boolean) => Schema.Boolean;
make: (input: boolean, options?: Schema.MakeOptions) => boolean;
makeOption: (input: boolean, options?: Schema.MakeOptions) => Option.Option<boolean>;
makeEffect: (input: boolean, options?: Schema.MakeOptions) => Effect.Effect<boolean, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
supervising: import SchemaSchema.const Boolean: Schema.Booleanconst Boolean: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<boolean, readonly []>) => Schema.Boolean;
annotateKey: (annotations: Schema.Annotations.Key<boolean>) => Schema.Boolean;
check: (checks_0: Check<boolean>, ...checks: Array<Check<boolean>>) => Schema.Boolean;
rebuild: (ast: Boolean) => Schema.Boolean;
make: (input: boolean, options?: Schema.MakeOptions) => boolean;
makeOption: (input: boolean, options?: Schema.MakeOptions) => Option.Option<boolean>;
makeEffect: (input: boolean, options?: Schema.MakeOptions) => Effect.Effect<boolean, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
Boolean
.
Schema for boolean values. Validates that the input is typeof "boolean".
When to use
Use to validate values that are already JavaScript booleans.
Boolean,
armed: Schema.Boolean(property) armed: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<boolean, readonly []>) => Schema.Boolean;
annotateKey: (annotations: Schema.Annotations.Key<boolean>) => Schema.Boolean;
check: (checks_0: Check<boolean>, ...checks: Array<Check<boolean>>) => Schema.Boolean;
rebuild: (ast: Boolean) => Schema.Boolean;
make: (input: boolean, options?: Schema.MakeOptions) => boolean;
makeOption: (input: boolean, options?: Schema.MakeOptions) => Option.Option<boolean>;
makeEffect: (input: boolean, options?: Schema.MakeOptions) => Effect.Effect<boolean, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
armed: import SchemaSchema.const Boolean: Schema.Booleanconst Boolean: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<boolean, readonly []>) => Schema.Boolean;
annotateKey: (annotations: Schema.Annotations.Key<boolean>) => Schema.Boolean;
check: (checks_0: Check<boolean>, ...checks: Array<Check<boolean>>) => Schema.Boolean;
rebuild: (ast: Boolean) => Schema.Boolean;
make: (input: boolean, options?: Schema.MakeOptions) => boolean;
makeOption: (input: boolean, options?: Schema.MakeOptions) => Option.Option<boolean>;
makeEffect: (input: boolean, options?: Schema.MakeOptions) => Effect.Effect<boolean, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
Boolean
.
Schema for boolean values. Validates that the input is typeof "boolean".
When to use
Use to validate values that are already JavaScript booleans.
Boolean,
activeInstances: Schema.Number(property) activeInstances: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<number, readonly []>) => Schema.Number;
annotateKey: (annotations: Schema.Annotations.Key<number>) => Schema.Number;
check: (checks_0: Check<number>, ...checks: Array<Check<number>>) => Schema.Number;
rebuild: (ast: Number) => Schema.Number;
make: (input: number, options?: Schema.MakeOptions) => number;
makeOption: (input: number, options?: Schema.MakeOptions) => Option.Option<number>;
makeEffect: (input: number, options?: Schema.MakeOptions) => Effect.Effect<number, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
activeInstances: import SchemaSchema.const Number: Schema.Numberconst Number: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<number, readonly []>) => Schema.Number;
annotateKey: (annotations: Schema.Annotations.Key<number>) => Schema.Number;
check: (checks_0: Check<number>, ...checks: Array<Check<number>>) => Schema.Number;
rebuild: (ast: Number) => Schema.Number;
make: (input: number, options?: Schema.MakeOptions) => number;
makeOption: (input: number, options?: Schema.MakeOptions) => Option.Option<number>;
makeEffect: (input: number, options?: Schema.MakeOptions) => Effect.Effect<number, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
Number
.
Schema for number values, including NaN, Infinity, and -Infinity.
Details
Default JSON serializer:
- Finite numbers are serialized as numbers.
- Non-finite values are serialized as strings (
"NaN", "Infinity", "-Infinity").
Number,
nextTriggerRun: Schema.optionalKey<Schema.DateTimeUtc>(property) nextTriggerRun: {
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<DateTime.Utc, readonly []>) => Schema.optionalKey<Schema.DateTimeUtc>;
annotateKey: (annotations: Schema.Annotations.Key<DateTime.Utc>) => Schema.optionalKey<Schema.DateTimeUtc>;
check: (checks_0: Check<DateTime.Utc>, ...checks: Array<Check<DateTime.Utc>>) => Schema.optionalKey<Schema.DateTimeUtc>;
rebuild: (ast: Declaration) => Schema.optionalKey<Schema.DateTimeUtc>;
make: (input: DateTime.Utc, options?: Schema.MakeOptions) => DateTime.Utc;
makeOption: (input: DateTime.Utc, options?: Schema.MakeOptions) => Option.Option<DateTime.Utc>;
makeEffect: (input: DateTime.Utc, options?: Schema.MakeOptions) => Effect.Effect<DateTime.Utc, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
nextTriggerRun: import SchemaSchema.const optionalKey: optionalKeyLambda
<Schema.DateTimeUtc>(self: Schema.DateTimeUtc) => Schema.optionalKey<Schema.DateTimeUtc>
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(import SchemaSchema.const DateTimeUtc: Schema.DateTimeUtcconst DateTimeUtc: {
Rebuild: DateTimeUtc;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<DateTime.Utc, readonly []>) => Schema.DateTimeUtc;
annotateKey: (annotations: Schema.Annotations.Key<DateTime.Utc>) => Schema.DateTimeUtc;
check: (checks_0: Check<DateTime.Utc>, ...checks: Array<Check<DateTime.Utc>>) => Schema.DateTimeUtc;
rebuild: (ast: Declaration) => Schema.DateTimeUtc;
make: (input: DateTime.Utc, options?: Schema.MakeOptions) => DateTime.Utc;
makeOption: (input: DateTime.Utc, options?: Schema.MakeOptions) => Option.Option<DateTime.Utc>;
makeEffect: (input: DateTime.Utc, options?: Schema.MakeOptions) => Effect.Effect<DateTime.Utc, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
DateTimeUtc
.
Schema for DateTime.Utc values.
When to use
Use to validate existing DateTime.Utc schema values and use the default JSON
codec that represents them as UTC ISO strings.
Details
The default JSON codec decodes UTC ISO strings into DateTime.Utc values and
encodes DateTime.Utc values as UTC ISO strings.
DateTimeUtc),
nextScheduleTransition: Schema.optionalKey<Schema.DateTimeUtc>(property) nextScheduleTransition: {
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<DateTime.Utc, readonly []>) => Schema.optionalKey<Schema.DateTimeUtc>;
annotateKey: (annotations: Schema.Annotations.Key<DateTime.Utc>) => Schema.optionalKey<Schema.DateTimeUtc>;
check: (checks_0: Check<DateTime.Utc>, ...checks: Array<Check<DateTime.Utc>>) => Schema.optionalKey<Schema.DateTimeUtc>;
rebuild: (ast: Declaration) => Schema.optionalKey<Schema.DateTimeUtc>;
make: (input: DateTime.Utc, options?: Schema.MakeOptions) => DateTime.Utc;
makeOption: (input: DateTime.Utc, options?: Schema.MakeOptions) => Option.Option<DateTime.Utc>;
makeEffect: (input: DateTime.Utc, options?: Schema.MakeOptions) => Effect.Effect<DateTime.Utc, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
nextScheduleTransition: import SchemaSchema.const optionalKey: optionalKeyLambda
<Schema.DateTimeUtc>(self: Schema.DateTimeUtc) => Schema.optionalKey<Schema.DateTimeUtc>
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(import SchemaSchema.const DateTimeUtc: Schema.DateTimeUtcconst DateTimeUtc: {
Rebuild: DateTimeUtc;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<DateTime.Utc, readonly []>) => Schema.DateTimeUtc;
annotateKey: (annotations: Schema.Annotations.Key<DateTime.Utc>) => Schema.DateTimeUtc;
check: (checks_0: Check<DateTime.Utc>, ...checks: Array<Check<DateTime.Utc>>) => Schema.DateTimeUtc;
rebuild: (ast: Declaration) => Schema.DateTimeUtc;
make: (input: DateTime.Utc, options?: Schema.MakeOptions) => DateTime.Utc;
makeOption: (input: DateTime.Utc, options?: Schema.MakeOptions) => Option.Option<DateTime.Utc>;
makeEffect: (input: DateTime.Utc, options?: Schema.MakeOptions) => Effect.Effect<DateTime.Utc, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
DateTimeUtc
.
Schema for DateTime.Utc values.
When to use
Use to validate existing DateTime.Utc schema values and use the default JSON
codec that represents them as UTC ISO strings.
Details
The default JSON codec decodes UTC ISO strings into DateTime.Utc values and
encodes DateTime.Utc values as UTC ISO strings.
DateTimeUtc),
nextPollCadence: Schema.optionalKey<Schema.Duration>(property) nextPollCadence: {
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<Duration.Duration, readonly []>) => Schema.optionalKey<Schema.Duration>;
annotateKey: (annotations: Schema.Annotations.Key<Duration.Duration>) => Schema.optionalKey<Schema.Duration>;
check: (checks_0: Check<Duration.Duration>, ...checks: Array<Check<Duration.Duration>>) => Schema.optionalKey<Schema.Duration>;
rebuild: (ast: Declaration) => Schema.optionalKey<Schema.Duration>;
make: (input: Duration.Duration, options?: Schema.MakeOptions) => Duration.Duration;
makeOption: (input: Duration.Duration, options?: Schema.MakeOptions) => Option.Option<Duration.Duration>;
makeEffect: (input: Duration.Duration, options?: Schema.MakeOptions) => Effect.Effect<Duration.Duration, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
nextPollCadence: import SchemaSchema.const optionalKey: optionalKeyLambda
<Schema.Duration>(self: Schema.Duration) => Schema.optionalKey<Schema.Duration>
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(import SchemaSchema.const Duration: Schema.Durationconst Duration: {
Rebuild: Duration;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<Duration.Duration, readonly []>) => Schema.Duration;
annotateKey: (annotations: Schema.Annotations.Key<Duration.Duration>) => Schema.Duration;
check: (checks_0: Check<Duration.Duration>, ...checks: Array<Check<Duration.Duration>>) => Schema.Duration;
rebuild: (ast: Declaration) => Schema.Duration;
make: (input: Duration.Duration, options?: Schema.MakeOptions) => Duration.Duration;
makeOption: (input: Duration.Duration, options?: Schema.MakeOptions) => Option.Option<Duration.Duration>;
makeEffect: (input: Duration.Duration, options?: Schema.MakeOptions) => Effect.Effect<Duration.Duration, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
Duration
.
Schema for Duration values.
Details
The default JSON serializer encodes Duration as a tagged object with the
duration type and value.
Example (Defining a Duration schema)
import { Duration, Schema } from "effect"
Schema.decodeUnknownSync(Schema.Duration)(Duration.seconds(5))
// => Duration(5s)
Duration),
runsStarted: Schema.Number(property) runsStarted: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<number, readonly []>) => Schema.Number;
annotateKey: (annotations: Schema.Annotations.Key<number>) => Schema.Number;
check: (checks_0: Check<number>, ...checks: Array<Check<number>>) => Schema.Number;
rebuild: (ast: Number) => Schema.Number;
make: (input: number, options?: Schema.MakeOptions) => number;
makeOption: (input: number, options?: Schema.MakeOptions) => Option.Option<number>;
makeEffect: (input: number, options?: Schema.MakeOptions) => Effect.Effect<number, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
runsStarted: import SchemaSchema.const Number: Schema.Numberconst Number: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<number, readonly []>) => Schema.Number;
annotateKey: (annotations: Schema.Annotations.Key<number>) => Schema.Number;
check: (checks_0: Check<number>, ...checks: Array<Check<number>>) => Schema.Number;
rebuild: (ast: Number) => Schema.Number;
make: (input: number, options?: Schema.MakeOptions) => number;
makeOption: (input: number, options?: Schema.MakeOptions) => Option.Option<number>;
makeEffect: (input: number, options?: Schema.MakeOptions) => Effect.Effect<number, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
Number
.
Schema for number values, including NaN, Infinity, and -Infinity.
Details
Default JSON serializer:
- Finite numbers are serialized as numbers.
- Non-finite values are serialized as strings (
"NaN", "Infinity", "-Infinity").
Number,
runsSucceeded: Schema.Number(property) runsSucceeded: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<number, readonly []>) => Schema.Number;
annotateKey: (annotations: Schema.Annotations.Key<number>) => Schema.Number;
check: (checks_0: Check<number>, ...checks: Array<Check<number>>) => Schema.Number;
rebuild: (ast: Number) => Schema.Number;
make: (input: number, options?: Schema.MakeOptions) => number;
makeOption: (input: number, options?: Schema.MakeOptions) => Option.Option<number>;
makeEffect: (input: number, options?: Schema.MakeOptions) => Effect.Effect<number, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
runsSucceeded: import SchemaSchema.const Number: Schema.Numberconst Number: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<number, readonly []>) => Schema.Number;
annotateKey: (annotations: Schema.Annotations.Key<number>) => Schema.Number;
check: (checks_0: Check<number>, ...checks: Array<Check<number>>) => Schema.Number;
rebuild: (ast: Number) => Schema.Number;
make: (input: number, options?: Schema.MakeOptions) => number;
makeOption: (input: number, options?: Schema.MakeOptions) => Option.Option<number>;
makeEffect: (input: number, options?: Schema.MakeOptions) => Effect.Effect<number, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
Number
.
Schema for number values, including NaN, Infinity, and -Infinity.
Details
Default JSON serializer:
- Finite numbers are serialized as numbers.
- Non-finite values are serialized as strings (
"NaN", "Infinity", "-Infinity").
Number,
runsFailed: Schema.Number(property) runsFailed: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<number, readonly []>) => Schema.Number;
annotateKey: (annotations: Schema.Annotations.Key<number>) => Schema.Number;
check: (checks_0: Check<number>, ...checks: Array<Check<number>>) => Schema.Number;
rebuild: (ast: Number) => Schema.Number;
make: (input: number, options?: Schema.MakeOptions) => number;
makeOption: (input: number, options?: Schema.MakeOptions) => Option.Option<number>;
makeEffect: (input: number, options?: Schema.MakeOptions) => Effect.Effect<number, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
runsFailed: import SchemaSchema.const Number: Schema.Numberconst Number: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<number, readonly []>) => Schema.Number;
annotateKey: (annotations: Schema.Annotations.Key<number>) => Schema.Number;
check: (checks_0: Check<number>, ...checks: Array<Check<number>>) => Schema.Number;
rebuild: (ast: Number) => Schema.Number;
make: (input: number, options?: Schema.MakeOptions) => number;
makeOption: (input: number, options?: Schema.MakeOptions) => Option.Option<number>;
makeEffect: (input: number, options?: Schema.MakeOptions) => Effect.Effect<number, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
Number
.
Schema for number values, including NaN, Infinity, and -Infinity.
Details
Default JSON serializer:
- Finite numbers are serialized as numbers.
- Non-finite values are serialized as strings (
"NaN", "Infinity", "-Infinity").
Number,
lastRunStartedAt: Schema.optionalKey<Schema.DateTimeUtc>(property) lastRunStartedAt: {
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<DateTime.Utc, readonly []>) => Schema.optionalKey<Schema.DateTimeUtc>;
annotateKey: (annotations: Schema.Annotations.Key<DateTime.Utc>) => Schema.optionalKey<Schema.DateTimeUtc>;
check: (checks_0: Check<DateTime.Utc>, ...checks: Array<Check<DateTime.Utc>>) => Schema.optionalKey<Schema.DateTimeUtc>;
rebuild: (ast: Declaration) => Schema.optionalKey<Schema.DateTimeUtc>;
make: (input: DateTime.Utc, options?: Schema.MakeOptions) => DateTime.Utc;
makeOption: (input: DateTime.Utc, options?: Schema.MakeOptions) => Option.Option<DateTime.Utc>;
makeEffect: (input: DateTime.Utc, options?: Schema.MakeOptions) => Effect.Effect<DateTime.Utc, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
lastRunStartedAt: import SchemaSchema.const optionalKey: optionalKeyLambda
<Schema.DateTimeUtc>(self: Schema.DateTimeUtc) => Schema.optionalKey<Schema.DateTimeUtc>
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(import SchemaSchema.const DateTimeUtc: Schema.DateTimeUtcconst DateTimeUtc: {
Rebuild: DateTimeUtc;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<DateTime.Utc, readonly []>) => Schema.DateTimeUtc;
annotateKey: (annotations: Schema.Annotations.Key<DateTime.Utc>) => Schema.DateTimeUtc;
check: (checks_0: Check<DateTime.Utc>, ...checks: Array<Check<DateTime.Utc>>) => Schema.DateTimeUtc;
rebuild: (ast: Declaration) => Schema.DateTimeUtc;
make: (input: DateTime.Utc, options?: Schema.MakeOptions) => DateTime.Utc;
makeOption: (input: DateTime.Utc, options?: Schema.MakeOptions) => Option.Option<DateTime.Utc>;
makeEffect: (input: DateTime.Utc, options?: Schema.MakeOptions) => Effect.Effect<DateTime.Utc, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
DateTimeUtc
.
Schema for DateTime.Utc values.
When to use
Use to validate existing DateTime.Utc schema values and use the default JSON
codec that represents them as UTC ISO strings.
Details
The default JSON codec decodes UTC ISO strings into DateTime.Utc values and
encodes DateTime.Utc values as UTC ISO strings.
DateTimeUtc),
lastRunDurationMillis: Schema.optionalKey<Schema.Number>(property) lastRunDurationMillis: {
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<number, readonly []>) => Schema.optionalKey<Schema.Number>;
annotateKey: (annotations: Schema.Annotations.Key<number>) => Schema.optionalKey<Schema.Number>;
check: (checks_0: Check<number>, ...checks: Array<Check<number>>) => Schema.optionalKey<Schema.Number>;
rebuild: (ast: Number) => Schema.optionalKey<Schema.Number>;
make: (input: number, options?: Schema.MakeOptions) => number;
makeOption: (input: number, options?: Schema.MakeOptions) => Option.Option<number>;
makeEffect: (input: number, options?: Schema.MakeOptions) => Effect.Effect<number, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
lastRunDurationMillis: import SchemaSchema.const optionalKey: optionalKeyLambda
<Schema.Number>(self: Schema.Number) => Schema.optionalKey<Schema.Number>
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(import SchemaSchema.const Number: Schema.Numberconst Number: {
Rebuild: Rebuild;
Iso: Iso;
ast: Ast;
Type: T;
Encoded: E;
DecodingServices: RD;
EncodingServices: RE;
annotate: (annotations: Schema.Annotations.Bottom<number, readonly []>) => Schema.Number;
annotateKey: (annotations: Schema.Annotations.Key<number>) => Schema.Number;
check: (checks_0: Check<number>, ...checks: Array<Check<number>>) => Schema.Number;
rebuild: (ast: Number) => Schema.Number;
make: (input: number, options?: Schema.MakeOptions) => number;
makeOption: (input: number, options?: Schema.MakeOptions) => Option.Option<number>;
makeEffect: (input: number, options?: Schema.MakeOptions) => Effect.Effect<number, Schema.SchemaError, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
Type-level representation of
Number
.
Schema for number values, including NaN, Infinity, and -Infinity.
Details
Default JSON serializer:
- Finite numbers are serialized as numbers.
- Non-finite values are serialized as strings (
"NaN", "Infinity", "-Infinity").
Number),
});