| 372 | * @since 4.0.0 |
| 373 | */ |
| 374 | export const layerConfig = ( |
| 375 | config: Config.Wrap<D1ClientConfig> |
| 376 | ): Layer.Layer<D1Client | Client.SqlClient, Config.ConfigError> => |
| 377 | Layer.effectContext( |
| 378 | Config.unwrap(config).pipe( |
| 379 | Effect.flatMap(make), |
| 380 | Effect.map((client) => |
| 381 | Context.make(D1Client, client).pipe( |
| 382 | Context.add(Client.SqlClient, client) |
| 383 | ) |
| 384 | ) |
| 385 | ) |
| 386 | ).pipe(Layer.provide(Reactivity.layer)) |
| 387 | |
| 388 | /** |
| 389 | * Creates a layer from a concrete D1 client configuration, providing both `D1Client` and `SqlClient`. |