MCPcopy Create free account
hub / github.com/Effect-TS/effect / layerClientSecurity

Function layerClientSecurity

packages/effect/src/http-api/HttpApiMiddleware.ts:690–709  ·  view source on GitHub ↗
(
  tag: Context.Key<Id, any> & { readonly security: Security },
  key: Key,
  credential: Effect.Effect<
    UnionToIntersection<HttpApiSecurity.HttpApiSecurity.Type<Security[Key]>>,
    Id[typeof TypeId]["clientError"],
    R
  >
)

Source from the content-addressed store, hash-verified

688 * @since 4.1.8
689 */
690export const layerClientSecurity = <
691 Id extends AnyId,
692 Security extends Record<string, HttpApiSecurity.HttpApiSecurity>,
693 const Key extends keyof Security & string,
694 R
695>(
696 tag: Context.Key<Id, any> & { readonly security: Security },
697 key: Key,
698 credential: Effect.Effect<
699 UnionToIntersection<HttpApiSecurity.HttpApiSecurity.Type<Security[Key]>>,
700 Id[typeof TypeId]["clientError"],
701 R
702 >
703): Layer.Layer<ForClient<Id>, never, R> => {
704 const security = tag.security[key]
705 return layerClient(
706 tag,
707 ({ next, request }) => Effect.flatMap(credential, (value) => next(securityEncode(request, security, value)))
708 )
709}

Callers

nothing calls this directly

Calls 3

securityEncodeFunction · 0.90
layerClientFunction · 0.70
nextFunction · 0.70

Tested by

no test coverage detected