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