MCPcopy Create free account
hub / github.com/effect-app/libs / setupRequestContext

Function setupRequestContext

packages/effect-app/src/setupRequest.ts:103–119  ·  view source on GitHub ↗
(
  self: Effect.Effect<A, E, R>,
  requestContext: RequestContext,
  options?: SetupRequestOptions
)

Source from the content-addressed store, hash-verified

101
102// TODO: consider integrating Effect.withParentSpan
103export function setupRequestContext<R, E, A>(
104 self: Effect.Effect<A, E, R>,
105 requestContext: RequestContext,
106 options?: SetupRequestOptions
107) {
108 const layer = Layer.mergeAll(
109 requestStateLayer,
110 Layer.succeed(LocaleRef, requestContext.locale),
111 Layer.succeed(storeId, requestContext.namespace)
112 )
113 return self
114 .pipe(
115 options?.withTransaction === true ? withSqlTransaction : (_) => _,
116 withRequestSpan(requestContext.name),
117 Effect.provide(layer, { local: true })
118 )
119}
120
121export function setupRequestContextWithCustomSpan<R, E, A>(
122 self: Effect.Effect<A, E, R>,

Callers

nothing calls this directly

Calls 4

withRequestSpanFunction · 0.85
pipeMethod · 0.65
succeedMethod · 0.45
provideMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…