@@ -18,6 +18,7 @@ package org.cufy.graphkt.ktor
1818import io.ktor.server.application.*
1919import org.cufy.graphkt.AdvancedGraphktApi
2020import org.cufy.graphkt.GraphktEngineFactory
21+ import org.cufy.graphkt.WithEngine
2122import org.cufy.graphkt.schema.*
2223import kotlin.time.Duration
2324
@@ -28,7 +29,9 @@ import kotlin.time.Duration
2829 * @author LSafer
2930 * @since 2.0.0
3031 */
31- class Configuration <TConfiguration > : WithDeferredBuilder {
32+ class Configuration <TConfiguration > :
33+ WithEngine <TConfiguration >,
34+ WithDeferredBuilder {
3235 /* *
3336 * True, to enable `graphql-ws` implementation.
3437 *
@@ -43,19 +46,13 @@ class Configuration<TConfiguration> : WithDeferredBuilder {
4346 */
4447 var connectionInitWaitTimeout: Duration ? = null
4548
46- /* *
47- * The engine factory.
48- */
4949 @AdvancedGraphktApi(" Use `engine()` instead" )
50- var engineFactory: GraphktEngineFactory <TConfiguration >? = null
50+ override var engineFactory: GraphktEngineFactory <TConfiguration >? = null
5151
5252 /* blocks */
5353
54- /* *
55- * Code to be executed to configure the engine.
56- */
5754 @AdvancedGraphktApi(" Use `engine()` instead" )
58- val engineBlock: MutableList <TConfiguration .() - > Unit > = mutableListOf ()
55+ override val engineBlock: MutableList <TConfiguration .() - > Unit > = mutableListOf ()
5956
6057 /* *
6158 * Code to be executed to configure the schema.
@@ -98,32 +95,6 @@ fun <TConfiguration> Configuration<TConfiguration>.disableWebsocket() {
9895 websocket = false
9996}
10097
101- /* *
102- * Set the engine factory.
103- *
104- * @param factory the engine factory.
105- * @param block the engine configuration.
106- * @since 2.0.0
107- */
108- @OptIn(AdvancedGraphktApi ::class )
109- fun <TConfiguration > Configuration<TConfiguration>.engine (
110- factory : GraphktEngineFactory <TConfiguration >,
111- block : TConfiguration .() -> Unit = {}
112- ) {
113- engineFactory = factory
114- engineBlock + = block
115- }
116-
117- /* *
118- * Configure the engine with the given [block].
119- */
120- @OptIn(AdvancedGraphktApi ::class )
121- fun <TConfiguration > Configuration<TConfiguration>.engine (
122- block : TConfiguration .() -> Unit
123- ) {
124- engineBlock + = block
125- }
126-
12798/* *
12899 * Configure the schema with the given [block].
129100 */
0 commit comments