Remote / foldkit-remote-domain/server

PageReaderConfig

interface · packages/remote-domain/src/adapter/resume.ts:32

interface PageReaderConfig<A extends InProcessApi, M, Env, RP> {
  readonly views: ReadonlyArray<ViewBinding<any, A>>
  readonly resolvePrincipal: (
    request: NavigationRequest,
    env: Env,
  ) => Effect.Effect<Option.Option<string>, RemoteUnauthenticated, RP>
  readonly middleware: (principal: Option.Option<string>) => Layer.Layer<M>
  readonly confirmWithin?: Duration.Input
}

How a page render reads the Api.

Members

PageReaderConfig.views

property · packages/remote-domain/src/adapter/resume.ts:33

readonly views: ReadonlyArray<ViewBinding<any, A>>

PageReaderConfig.resolvePrincipal

property · packages/remote-domain/src/adapter/resume.ts:42

readonly resolvePrincipal: (
  request: NavigationRequest,
  env: Env,
) => Effect.Effect<Option.Option<string>, RemoteUnauthenticated, RP>

Who the page's request is, decided from the request itself (a session cookie through a resolver), none for a visitor. Refusing fails the render Unauthenticated, as a 401 would. A resolver taking any Request fits, and so does a navigation's (AuthServer.host(…).navigation's); one typed for a script's request does not, since a navigation carries no header a script adds.

PageReaderConfig.middleware

property · packages/remote-domain/src/adapter/resume.ts:51

readonly middleware: (principal: Option.Option<string>) => Layer.Layer<M>

The Api's middleware for one render, trusting the principal decided: as Domain calls an already-authenticated caller in process. Nothing of the request reaches the middleware but what this builds from the principal.

PageReaderConfig.confirmWithin

property · packages/remote-domain/src/adapter/resume.ts:53

readonly confirmWithin?: Duration.Input

How long a read waits for its View. 2 seconds by default.