Hyperlinkv0.9.0-beta.0

Hyperlink

Hyperlink.serveRemoteconstsrc/Hyperlink.ts:4360
<S extends Spec, Impl extends ServeImplOf<S, any>>(
  tag: {
    readonly [wireKeySym]: string
    readonly [specSym]: FlatSpec
    readonly [specTypeSym]?: S
    readonly [groupSym]: RpcGroupOf<S>
  },
  impl: Impl
): Layer.Layer<HandlerContextOf<S>, never, ServeRequirements<Impl>>

A HyperService's served-only handler layer — mounts the tag's group handlers (wire members only, no local grant), with the handlers' requirement R preserved (not erased). This is the served-only counterpart to serve, which additionally grants Local so members stay callable in-process. serveRemote's R rides the layer's requirement channel, so a per-HyperService Layer.provide discharges this HyperService's dependency in isolation:

Hyperlink.serveRemote(SeasonMatches, seasonMatchesImpl).pipe(Layer.provide(importHandlersLayer))

The point of serveRemote is the run-time-requirement case: N HyperServices needing different implementations of the same tag, each isolated — merge the layers onto one RpcServer (groups are prefix-keyed).

Plain impls infer R via ServeRequirements. For a Driver, use serveRemoteDriver so the driver's R is the Layer requirement (no toolkit retype).

Source src/Hyperlink.ts:436012 lines
export const serveRemote = <S extends Spec, Impl extends ServeImplOf<S, any>>(
  tag: {
    readonly [wireKeySym]: string;
    readonly [specSym]: FlatSpec;
    readonly [specTypeSym]?: S;
    readonly [groupSym]: RpcGroupOf<S>;
  },
  impl: Impl,
): Layer.Layer<HandlerContextOf<S>, never, ServeRequirements<Impl>> =>
  retype<Layer.Layer<HandlerContextOf<S>, never, ServeRequirements<Impl>>>(
    serveRemoteHandlers(tag, impl, undefined) as never,
  );
Referenced by 3 symbols