Skip to content

Commit

Permalink
fix inclusion
Browse files Browse the repository at this point in the history
  • Loading branch information
zth committed Dec 5, 2024
1 parent 89094ab commit cc5ecd4
Showing 1 changed file with 67 additions and 71 deletions.
138 changes: 67 additions & 71 deletions packages/rescript-relay/rescript-relay-ppx/library/Query.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,84 +9,80 @@ let make ~loc ~moduleName ~hasRawResponseType ~hasAutocodesplitDirective =
(Pmod_structure
(List.concat
[
([
[%stri [@@@ocaml.warning "-32-34-60"]];
[%stri include [%m moduleIdentFromGeneratedModule ["Utils"]]];
[%stri module Operation = [%m moduleIdentFromGeneratedModule []]];
[%stri
module Types = [%m moduleIdentFromGeneratedModule ["Types"]]];
[%stri
let convertVariables :
[%t typeFromGeneratedModule ["Types"; "variables"]] ->
[%t typeFromGeneratedModule ["Types"; "variables"]] =
[%e valFromGeneratedModule ["Internal"; "convertVariables"]]];
[%stri
let convertResponse :
[%t typeFromGeneratedModule ["Types"; "response"]] ->
[%t typeFromGeneratedModule ["Types"; "response"]] =
[%e valFromGeneratedModule ["Internal"; "convertResponse"]]];
[%stri
let convertWrapRawResponse :
[%t typeFromGeneratedModule ["Types"; "rawResponse"]] ->
[%t typeFromGeneratedModule ["Types"; "rawResponse"]] =
[%e
valFromGeneratedModule
["Internal"; "convertWrapRawResponse"]]];
[%stri
external mkQueryRefOpt :
[%t typeFromGeneratedModule ["queryRef"]] option ->
[%t typeFromGeneratedModule ["queryRef"]] option
= "%identity"];
[%stri
external mkQueryRef :
[%t typeFromGeneratedModule ["queryRef"]] ->
[%t typeFromGeneratedModule ["queryRef"]] = "%identity"];
]
@
if not !NonReactUtils.enabled then
[
[
[%stri [@@@ocaml.warning "-32-34-60"]];
[%stri include [%m moduleIdentFromGeneratedModule ["Utils"]]];
[%stri module Operation = [%m moduleIdentFromGeneratedModule []]];
[%stri
module Types = [%m moduleIdentFromGeneratedModule ["Types"]]];
[%stri
let convertVariables :
[%t typeFromGeneratedModule ["Types"; "variables"]] ->
[%t typeFromGeneratedModule ["Types"; "variables"]] =
[%e valFromGeneratedModule ["Internal"; "convertVariables"]]];
[%stri
let convertResponse :
[%t typeFromGeneratedModule ["Types"; "response"]] ->
[%t typeFromGeneratedModule ["Types"; "response"]] =
[%e valFromGeneratedModule ["Internal"; "convertResponse"]]];
[%stri
let convertWrapRawResponse :
[%t typeFromGeneratedModule ["Types"; "rawResponse"]] ->
[%t typeFromGeneratedModule ["Types"; "rawResponse"]] =
[%e
valFromGeneratedModule
["Internal"; "convertWrapRawResponse"]]];
[%stri
external mkQueryRefOpt :
[%t typeFromGeneratedModule ["queryRef"]] option ->
[%t typeFromGeneratedModule ["queryRef"]] option = "%identity"];
[%stri
external mkQueryRef :
[%t typeFromGeneratedModule ["queryRef"]] ->
[%t typeFromGeneratedModule ["queryRef"]] = "%identity"];
]
@ (if not !NonReactUtils.enabled then
[
[%stri
let use =
RescriptRelay_Query.useQuery ~convertVariables
~convertResponse
~node:[%e valFromGeneratedModule ["node"]]];
[%stri
let useLoader =
RescriptRelay_Query.useLoader ~convertVariables
~mkQueryRef:mkQueryRefOpt
~node:[%e valFromGeneratedModule ["node"]]];
[%stri
let usePreloaded =
RescriptRelay_Query.usePreloaded ~convertResponse
~mkQueryRef
~node:[%e valFromGeneratedModule ["node"]]];
]
else [])
@ [
[%stri
let use =
RescriptRelay_Query.useQuery ~convertVariables
~convertResponse
let fetch =
RescriptRelay_Query.fetch ~convertResponse ~convertVariables
~node:[%e valFromGeneratedModule ["node"]]];
[%stri
let useLoader =
RescriptRelay_Query.useLoader ~convertVariables
~mkQueryRef:mkQueryRefOpt
let fetchPromised =
RescriptRelay_Query.fetchPromised ~convertResponse
~convertVariables
~node:[%e valFromGeneratedModule ["node"]]];
[%stri
let usePreloaded =
RescriptRelay_Query.usePreloaded ~convertResponse
~mkQueryRef
let retain =
RescriptRelay_Query.retain ~convertVariables
~node:[%e valFromGeneratedModule ["node"]]];
]
else
[]
@ [
[%stri
let fetch =
RescriptRelay_Query.fetch ~convertResponse
~convertVariables
~node:[%e valFromGeneratedModule ["node"]]];
[%stri
let fetchPromised =
RescriptRelay_Query.fetchPromised ~convertResponse
~convertVariables
~node:[%e valFromGeneratedModule ["node"]]];
(match hasRawResponseType with
| true ->
[%stri
let retain =
RescriptRelay_Query.retain ~convertVariables
~node:[%e valFromGeneratedModule ["node"]]];
(match hasRawResponseType with
| true ->
[%stri
let commitLocalPayload =
RescriptRelay_Query.commitLocalPayload ~convertVariables
~convertWrapRawResponse
~node:[%e valFromGeneratedModule ["node"]]]
| false -> [%stri ()]);
]);
let commitLocalPayload =
RescriptRelay_Query.commitLocalPayload ~convertVariables
~convertWrapRawResponse
~node:[%e valFromGeneratedModule ["node"]]]
| false -> [%stri ()]);
];
(match (!NonReactUtils.enabled, hasAutocodesplitDirective) with
| true, _ -> []
| false, true ->
Expand Down

0 comments on commit cc5ecd4

Please sign in to comment.