Directory row upserted (first advertise, serves refresh, or A→B dial replace).
dialChanged is true when the dial target moved (membership push for peer rebind).
export class class DirectoryUpsertedclass DirectoryUpserted {
entry: DirectoryEntry;
dialChanged: boolean;
_tag: 'DirectoryUpserted';
previous: DirectoryEntry | undefined;
}
Directory row upserted (first advertise, serves refresh, or A→B dial replace).
dialChanged is true when the dial target moved (membership push for peer rebind).
DirectoryUpserted extends import SchemaSchema.const TaggedClass: {
<Self = never, Brand = {}>(
identifier?: string
): {
<
Tag extends string,
Fields extends Struct.Fields
>(
tag: Tag,
fields: Fields,
annotations?: Annotations.Declaration<
Self,
readonly [TaggedStruct<Tag, Fields>]
>
): [Self] extends [never]
? MissingSelfGeneric<"Schema.TaggedClass">
: Class<
Self,
TaggedStruct<Tag, Fields>,
Brand
>
<
Tag extends string,
S extends Struct<Struct.Fields>
>(
tag: Tag,
schema: S,
annotations?: Annotations.Declaration<
Self,
readonly [
Struct<
Simplify<
{
readonly _tag: tag<Tag>
} & S["fields"]
>
>
]
>
): [Self] extends [never]
? MissingSelfGeneric<"Schema.TaggedClass">
: Class<
Self,
Struct<
Simplify<
{
readonly _tag: tag<Tag>
} & S["fields"]
>
>,
Brand
>
}
}
Defines a schema-backed class with an automatically populated _tag field.
When to use
Use to define class instances that are validated by a schema and participate
in tagged union matching.
Details
The optional identifier parameter overrides the schema identifier;
it defaults to the tag value.
Example (Defining a tagged class)
import { Schema } from "effect"
class Circle extends Schema.TaggedClass<Circle>()("Circle", {
radius: Schema.Number
}) {}
const c = new Circle({ radius: 5 })
console.log(c._tag) // "Circle"
console.log(c.radius) // 5
TaggedClass<class DirectoryUpsertedclass DirectoryUpserted {
entry: DirectoryEntry;
dialChanged: boolean;
_tag: 'DirectoryUpserted';
previous: DirectoryEntry | undefined;
}
Directory row upserted (first advertise, serves refresh, or A→B dial replace).
dialChanged is true when the dial target moved (membership push for peer rebind).
DirectoryUpserted>()(
"DirectoryUpserted",
{
entry: typeof DirectoryEntry(property) entry: {
Type: Self;
Encoded: S["Encoded"];
DecodingServices: S["DecodingServices"];
EncodingServices: S["EncodingServices"];
Iso: S["Iso"];
identifier: string;
fields: S["fields"];
mapFields: (f: (fields: { readonly nodeKey: Schema.String; readonly kind: Schema.Literals<readonly ['Http', 'WebSocket', 'IpcSocket']>; readonly url: Schema.optionalKey<Schema.String>; readonly path: Schema.optionalKey<Schema.String>; readonly serves…;
extend: (identifier: string) => { (fields: NewFields, annotations?: Schema.Annotations.Declaration<Extended, readonly [Schema.Struct<{ [K in keyof { [K in keyof (('kind' | 'url' | 'path' | 'serves' | 'nodeKey') & keyof NewFields extends never ? { …;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<DirectoryEntry, readonly [Schema.Struct<{ readonly nodeKey: Schema.String; readonly kind: Schema.Literals<readonly ['Http', 'WebSocket', 'IpcSocket']>; readonly url: Schema.optionalKey<Schema.String>…;
annotateKey: (annotations: Schema.Annotations.Key<DirectoryEntry>) => Schema.decodeTo<Schema.declareConstructor<DirectoryEntry, { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; reado…;
check: (checks_0: Check<DirectoryEntry>, ...checks: Array<Check<DirectoryEntry>>) => Schema.decodeTo<Schema.declareConstructor<DirectoryEntry, { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly n…;
rebuild: (ast: Declaration) => Schema.decodeTo<Schema.declareConstructor<DirectoryEntry, { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; readonly url?: string | undefined; reado…;
make: (input: { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; readonly url?: string | undefined; readonly path?: string | undefined }, options?: MakeOptions) => DirectoryEntry;
makeOption: (input: { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; readonly url?: string | undefined; readonly path?: string | undefined }, options?: MakeOptions) => Option_.Optio…;
makeEffect: (input: { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; readonly url?: string | undefined; readonly path?: string | undefined }, options?: MakeOptions) => Effect.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; <…;
}
entry: class DirectoryEntryclass DirectoryEntry {
Type: Self;
Encoded: S["Encoded"];
DecodingServices: S["DecodingServices"];
EncodingServices: S["EncodingServices"];
Iso: S["Iso"];
identifier: string;
fields: S["fields"];
mapFields: (f: (fields: { readonly nodeKey: Schema.String; readonly kind: Schema.Literals<readonly ['Http', 'WebSocket', 'IpcSocket']>; readonly url: Schema.optionalKey<Schema.String>; readonly path: Schema.optionalKey<Schema.String>; readonly serves…;
extend: (identifier: string) => { (fields: NewFields, annotations?: Schema.Annotations.Declaration<Extended, readonly [Schema.Struct<{ [K in keyof { [K in keyof (('kind' | 'url' | 'path' | 'serves' | 'nodeKey') & keyof NewFields extends never ? { …;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<DirectoryEntry, readonly [Schema.Struct<{ readonly nodeKey: Schema.String; readonly kind: Schema.Literals<readonly ['Http', 'WebSocket', 'IpcSocket']>; readonly url: Schema.optionalKey<Schema.String>…;
annotateKey: (annotations: Schema.Annotations.Key<DirectoryEntry>) => Schema.decodeTo<Schema.declareConstructor<DirectoryEntry, { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; reado…;
check: (checks_0: Check<DirectoryEntry>, ...checks: Array<Check<DirectoryEntry>>) => Schema.decodeTo<Schema.declareConstructor<DirectoryEntry, { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly n…;
rebuild: (ast: Declaration) => Schema.decodeTo<Schema.declareConstructor<DirectoryEntry, { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; readonly url?: string | undefined; reado…;
make: (input: { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; readonly url?: string | undefined; readonly path?: string | undefined }, options?: MakeOptions) => DirectoryEntry;
makeOption: (input: { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; readonly url?: string | undefined; readonly path?: string | undefined }, options?: MakeOptions) => Option_.Optio…;
makeEffect: (input: { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; readonly url?: string | undefined; readonly path?: string | undefined }, options?: MakeOptions) => Effect.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; <…;
}
Directory row — dial target plus HyperService keys this node serves (listen catalog).
DirectoryEntry,
previous: Schema.optionalKey<
typeof DirectoryEntry
>
(property) previous: {
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<DirectoryEntry, readonly [Schema.Struct<{ readonly nodeKey: Schema.String; readonly kind: Schema.Literals<readonly ['Http', 'WebSocket', 'IpcSocket']>; readonly url: Schema.optionalKey<Schema.String>…;
annotateKey: (annotations: Schema.Annotations.Key<DirectoryEntry>) => Schema.optionalKey<typeof DirectoryEntry>;
check: (checks_0: Check<DirectoryEntry>, ...checks: Array<Check<DirectoryEntry>>) => Schema.optionalKey<typeof DirectoryEntry>;
rebuild: (ast: Declaration) => Schema.optionalKey<typeof DirectoryEntry>;
make: (input: { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; readonly url?: string | undefined; readonly path?: string | undefined }, options?: MakeOptions) => DirectoryEntry;
makeOption: (input: { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; readonly url?: string | undefined; readonly path?: string | undefined }, options?: MakeOptions) => Option_.Optio…;
makeEffect: (input: { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; readonly url?: string | undefined; readonly path?: string | undefined }, options?: MakeOptions) => Effect.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; <…;
}
previous: import SchemaSchema.const optionalKey: optionalKeyLambda
<typeof DirectoryEntry>(self: typeof DirectoryEntry) => Schema.optionalKey<typeof DirectoryEntry>
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(class DirectoryEntryclass DirectoryEntry {
Type: Self;
Encoded: S["Encoded"];
DecodingServices: S["DecodingServices"];
EncodingServices: S["EncodingServices"];
Iso: S["Iso"];
identifier: string;
fields: S["fields"];
mapFields: (f: (fields: { readonly nodeKey: Schema.String; readonly kind: Schema.Literals<readonly ['Http', 'WebSocket', 'IpcSocket']>; readonly url: Schema.optionalKey<Schema.String>; readonly path: Schema.optionalKey<Schema.String>; readonly serves…;
extend: (identifier: string) => { (fields: NewFields, annotations?: Schema.Annotations.Declaration<Extended, readonly [Schema.Struct<{ [K in keyof { [K in keyof (('kind' | 'url' | 'path' | 'serves' | 'nodeKey') & keyof NewFields extends never ? { …;
Rebuild: Rebuild;
ast: Ast;
annotate: (annotations: Schema.Annotations.Bottom<DirectoryEntry, readonly [Schema.Struct<{ readonly nodeKey: Schema.String; readonly kind: Schema.Literals<readonly ['Http', 'WebSocket', 'IpcSocket']>; readonly url: Schema.optionalKey<Schema.String>…;
annotateKey: (annotations: Schema.Annotations.Key<DirectoryEntry>) => Schema.decodeTo<Schema.declareConstructor<DirectoryEntry, { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; reado…;
check: (checks_0: Check<DirectoryEntry>, ...checks: Array<Check<DirectoryEntry>>) => Schema.decodeTo<Schema.declareConstructor<DirectoryEntry, { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly n…;
rebuild: (ast: Declaration) => Schema.decodeTo<Schema.declareConstructor<DirectoryEntry, { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; readonly url?: string | undefined; reado…;
make: (input: { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; readonly url?: string | undefined; readonly path?: string | undefined }, options?: MakeOptions) => DirectoryEntry;
makeOption: (input: { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; readonly url?: string | undefined; readonly path?: string | undefined }, options?: MakeOptions) => Option_.Optio…;
makeEffect: (input: { readonly kind: 'Http' | 'WebSocket' | 'IpcSocket'; readonly serves: ReadonlyArray<string>; readonly nodeKey: string; readonly url?: string | undefined; readonly path?: string | undefined }, options?: MakeOptions) => Effect.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; <…;
}
Directory row — dial target plus HyperService keys this node serves (listen catalog).
DirectoryEntry),
dialChanged: Schema.Boolean(property) dialChanged: {
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?: MakeOptions) => boolean;
makeOption: (input: boolean, options?: MakeOptions) => Option_.Option<boolean>;
makeEffect: (input: boolean, options?: MakeOptions) => Effect.Effect<boolean, 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; <…;
}
dialChanged: import SchemaSchema.const Boolean: 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?: MakeOptions) => boolean;
makeOption: (input: boolean, options?: MakeOptions) => Option_.Option<boolean>;
makeEffect: (input: boolean, options?: MakeOptions) => Effect.Effect<boolean, 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,
},
) {}