(request: Request, context?: Context.Context<never> | undefined)
| 279 | | Promise<(request: Request, context?: Context.Context<never> | undefined) => Promise<Response>> |
| 280 | | undefined |
| 281 | function handler(request: Request, context?: Context.Context<never> | undefined): Promise<Response> { |
| 282 | if (handlerCache) { |
| 283 | return handlerCache(request, context) |
| 284 | } |
| 285 | handlerPromise ??= Effect.gen(function*() { |
| 286 | const runtime = yield* (options.memoMap |
| 287 | ? Layer.toRuntimeWithMemoMap(layer, options.memoMap) |
| 288 | : Layer.toRuntime(layer)) |
| 289 | return handlerCache = toWebHandlerRuntime(runtime)( |
| 290 | yield* options.toHandler(runtime), |
| 291 | options.middleware |
| 292 | ) |
| 293 | }).pipe( |
| 294 | Scope.extend(scope), |
| 295 | Effect.runPromise |
| 296 | ) |
| 297 | return handlerPromise.then((f) => f(request, context)) |
| 298 | } |
| 299 | return { dispose, handler } as const |
| 300 | } |
| 301 |
no test coverage detected