| 1303 | * @category constructors |
| 1304 | */ |
| 1305 | export const toWebHandler = <Rpcs extends Rpc.Any, LE>( |
| 1306 | group: RpcGroup.RpcGroup<Rpcs>, |
| 1307 | options: { |
| 1308 | readonly layer: Layer.Layer< |
| 1309 | | Rpc.ToHandler<Rpcs> |
| 1310 | | Rpc.Middleware<Rpcs> |
| 1311 | | RpcSerialization.RpcSerialization |
| 1312 | | HttpRouter.HttpRouter.DefaultServices, |
| 1313 | LE |
| 1314 | > |
| 1315 | readonly disableTracing?: boolean | undefined |
| 1316 | readonly spanPrefix?: string | undefined |
| 1317 | readonly spanAttributes?: Record<string, unknown> | undefined |
| 1318 | readonly disableFatalDefects?: boolean | undefined |
| 1319 | readonly middleware?: ( |
| 1320 | httpApp: HttpApp.Default |
| 1321 | ) => HttpApp.Default< |
| 1322 | never, |
| 1323 | HttpRouter.HttpRouter.DefaultServices |
| 1324 | > |
| 1325 | readonly memoMap?: Layer.MemoMap |
| 1326 | } |
| 1327 | ): { |
| 1328 | readonly handler: (request: globalThis.Request, context?: Context.Context<never> | undefined) => Promise<Response> |
| 1329 | readonly dispose: () => Promise<void> |
| 1330 | } => |
| 1331 | HttpApp.toWebHandlerLayerWith(Layer.mergeAll(options.layer, Layer.scope), { |
| 1332 | memoMap: options?.memoMap, |
| 1333 | middleware: options?.middleware as any, |
| 1334 | toHandler: (r) => Effect.provide(toHttpApp(group, options), r) |
| 1335 | }) |
| 1336 | |
| 1337 | /** |
| 1338 | * Create a protocol that uses the provided `Stream` and `Sink` for communication. |