The served-resources registry — an accumulator serve appends to and httpServer reads.
A plain Ref-backed list (not type-level state), so many serve layers compose under Layer.mergeAll
and the server sees every one. Provided by httpServer (or servedHyperlinksLayer); serve
registers only if it's present (so serve also works standalone).
export class class ServedHyperlinksclass ServedHyperlinks {
key: Identifier;
Service: {
register: (entry: ServedHyperlink) => Effect.Effect<void>;
all: Effect.Effect<ReadonlyArray<ServedHyperlink>>;
};
}
The served-resources registry — an accumulator
serve
appends to and
httpServer
reads.
A plain Ref-backed list (not type-level state), so many serve layers compose under Layer.mergeAll
and the server sees every one. Provided by
httpServer
(or
servedHyperlinksLayer
); serve
registers only if it's present (so serve also works standalone).
ServedHyperlinks extends import ContextContext.const Service: <ServedHyperlinks, {
readonly register: (entry: ServedHyperlink) => Effect.Effect<void>;
readonly all: Effect.Effect<ReadonlyArray<ServedHyperlink>>;
}>() => <Identifier, E, R, Args>(id: Identifier, options?: {
readonly make: ((...args: Args) => Effect.Effect<{
readonly register: (entry: ServedHyperlink) => Effect.Effect<void>;
readonly all: Effect.Effect<ReadonlyArray<ServedHyperlink>>;
}, E, R>) | Effect.Effect<{
readonly register: (entry: ServedHyperlink) => Effect.Effect<void>;
readonly all: Effect.Effect<ReadonlyArray<ServedHyperlink>>;
}, E, R> | undefined;
} | undefined) => Context.ServiceClass<...> & ([...] extends [...] ? unknown : {
...;
}) (+2 overloads)
Creates a Context service key.
When to use
Use when you need to define a context service key for a dependency that must
be provided by the surrounding context.
Details
Call Context.Service("Key") for a function-style key, or use the two-stage
form Context.Service<Self, Shape>()("Key") for class-style service
declarations. The returned key can be yielded as an Effect and passed to
Context.make, Context.add, and the Context getter functions.
Gotchas
The string key is the runtime identity of the service. Reusing the same key
string for unrelated services makes them occupy the same slot in a
Context.
Example (Creating service keys)
import { Context } from "effect"
// Create a simple service
const Database = Context.Service<{
query: (sql: string) => string
}>("Database")
// Create a service class
class Config extends Context.Service<Config, {
port: number
}>()("Config") {}
// Use the services to create contexts
const db = Context.make(Database, {
query: (sql) => `Result: ${sql}`
})
const config = Context.make(Config, { port: 8080 })
Service<
class ServedHyperlinksclass ServedHyperlinks {
key: Identifier;
Service: {
register: (entry: ServedHyperlink) => Effect.Effect<void>;
all: Effect.Effect<ReadonlyArray<ServedHyperlink>>;
};
}
The served-resources registry — an accumulator
serve
appends to and
httpServer
reads.
A plain Ref-backed list (not type-level state), so many serve layers compose under Layer.mergeAll
and the server sees every one. Provided by
httpServer
(or
servedHyperlinksLayer
); serve
registers only if it's present (so serve also works standalone).
ServedHyperlinks,
{
readonly register: (
entry: ServedHyperlink
) => Effect.Effect<void>
register: (entry: ServedHyperlink(parameter) entry: {
groupId: string;
group: RpcGroup.RpcGroup<any>;
kind: string;
readiness: Effect.Effect<Readiness>;
contractHash: string;
nodeLogKey: string;
nodeKinds: ReadonlyArray<ProtocolKind>;
}
entry: ServedHyperlink) => import EffectEffect.interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<void>;
readonly all: Effect.Effect<
ReadonlyArray<ServedHyperlink>
>
(property) all: {
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; <…;
toString: () => string;
toJSON: () => unknown;
}
all: import EffectEffect.interface Effect<out A, out E = never, out R = never>The Effect interface defines a value that lazily describes a workflow or
job. The workflow requires some context R, and may fail with an error of
type E, or succeed with a value of type A.
When to use
Use when you need to represent a lazy, composable workflow that can require
services, fail with a typed error, or succeed with a typed value.
Details
Effect values model resourceful interaction with the outside world,
including synchronous, asynchronous, concurrent, and parallel interaction.
They use a fiber-based concurrency model, with built-in support for
scheduling, fine-grained interruption, structured concurrency, and high
scalability.
To run an Effect value, you need a Runtime, which is a type that is
capable of executing Effect values.
Effect<interface ReadonlyArray<T>ReadonlyArray<ServedHyperlink>>;
}
>()("hyperlink-ts/Hyperlink/ServedHyperlinks") {}