You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
=>Handlermapi--^ Handler for the query. This links the query to the code you've written to handle it.
79
90
->QueryDocumentVariableValue--^ A validated query document. Build one with 'compileQuery'.
80
91
->MaybeName--^ An optional name. If 'Nothing', then executes the only operation in the query. If @Just "something"@, executes the query named @"something".
@@ -83,59 +94,59 @@ executeQuery
83
94
executeQuery handler document name variables =
84
95
case getOperation document name variables of
85
96
Left e ->pure (ExecutionFailure (singleError e))
86
-
Right operation -> toResult <$> resolve @m@api handler operation
97
+
Right operation -> toResult <$> resolve @m@api handler (Justoperation)
87
98
where
88
99
toResult (Result errors result) =
89
100
case result of
90
-
-- TODO: Prevent this at compile time.
101
+
-- TODO: Prevent this at compile time. Particularly frustrating since
102
+
-- we *know* that api has an object definition.
91
103
ValueObject object ->
92
104
caseNonEmpty.nonEmpty errors of
93
105
Nothing->Success object
94
106
Just errs ->PartialSuccess object (map toError errs)
95
107
v ->ExecutionFailure (singleError (NonObjectResult v))
=>Handlermapi--^ Handler for the query. This links the query to the code you've written to handle it.
103
119
->Text--^ The text of a query document. Will be parsed and then executed.
104
120
->MaybeName--^ An optional name for the operation within document to run. If 'Nothing', execute the only operation in the document. If @Just "something"@, execute the query or mutation named @"something"@.
105
121
->VariableValues--^ Values for variables defined in the query document. A map of 'Variable' to 'Value'.
106
122
->mResponse--^ The outcome of running the query.
107
123
interpretQuery handler query name variables =
108
-
case parseQuery query of
109
-
Left err ->pure (PreExecutionFailure (Error err []:|[]))
110
-
Right parsed ->
111
-
case validate parsed of
112
-
Left errs ->pure (PreExecutionFailure (map toError errs))
113
-
Right document ->
114
-
executeQuery @api@m handler document name variables
115
-
124
+
case makeSchema @api>>=flip compileQuery query of
125
+
Left err ->pure (PreExecutionFailure (toError err :|[]))
126
+
Right document -> executeQuery @api@m handler document name variables
116
127
117
128
--| Interpret an anonymous GraphQL query.
118
129
--
119
130
-- Anonymous queries have no name and take no variables.
0 commit comments