(
request: Request,
context?: Context.Context<ReqR> | undefined
)
| 318 | let handlerPromise: |
| 319 | | Promise<(request: Request, context?: Context.Context<ReqR> | undefined) => Promise<globalThis.Response>> |
| 320 | | undefined |
| 321 | function handler( |
| 322 | request: Request, |
| 323 | context?: Context.Context<ReqR> | undefined |
| 324 | ): Promise<globalThis.Response> { |
| 325 | if (handlerCache) { |
| 326 | return handlerCache(request, context) |
| 327 | } |
| 328 | handlerPromise ??= Effect.runPromise(Effect.gen(function*() { |
| 329 | const context = yield* (options.memoMap |
| 330 | ? Layer.buildWithMemoMap(layer, options.memoMap, scope) |
| 331 | : Layer.buildWithScope(layer, scope)) |
| 332 | return handlerCache = toWebHandlerWith<Provided, R>(context)( |
| 333 | yield* options.toHandler(context), |
| 334 | options.middleware |
| 335 | ) as any |
| 336 | })) |
| 337 | return handlerPromise.then((f) => f(request, context)) |
| 338 | } |
| 339 | return { dispose, handler: handler as any } as const |
| 340 | } |
no test coverage detected
searching dependent graphs…