/**
 * We proxy the auth header to the subsystem where it is resolved.
 */ interface FetchParams { url : string ; init : RequestInit ; } interface RequestContext { init : RequestInit ; } interface Middleware { pre ? ( context ) : Promise < FetchParams | void > ; } export class AuthHeaderMiddleware implements Middleware { constructor ( private bearerToken ) { } async pre ( context ) { context . init . headers = Object . assign ( { } , context . init . headers , { authorization : this . bearerToken , } ) ; } }