Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kind to normalization ast #297

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions crates/graphql_artifact_generation/src/entrypoint_artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub(crate) fn generate_entrypoint_artifacts_with_client_field_traversal_result<'
generate_refetch_query_artifact_import(&refetch_paths_with_variables, file_extensions);

let normalization_ast_text =
generate_normalization_ast_text(schema, merged_selection_map.values(), 0);
generate_normalization_ast_text(schema, merged_selection_map.values(), 1);

let concrete_type = schema.server_field_data.object(
if schema
Expand Down Expand Up @@ -294,7 +294,10 @@ impl EntrypointArtifactInfo<'_> {
import readerResolver from './{resolver_reader_file_name}{ts_file_extension}';\n\
{refetch_query_artifact_import}\n\n\
const queryText = '{query_text}';\n\n\
const normalizationAst: NormalizationAst = {normalization_ast_text};\n\
const normalizationAst: NormalizationAst = {{\n\
{}kind: \"NormalizationAst\",\n\
{}selections: {normalization_ast_text},\n\
}};\n\
const artifact: IsographEntrypoint<\n\
{}{entrypoint_params_typename},\n\
{}{entrypoint_output_type_name}\n\
Expand All @@ -313,7 +316,7 @@ impl EntrypointArtifactInfo<'_> {
{}}},\n\
}};\n\n\
export default artifact;\n",
" ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ",
" "," "," ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ",
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ impl ImperativelyLoadedEntrypointArtifactInfo {
format!(
"import type {{ IsographEntrypoint, ReaderAst, FragmentReference, NormalizationAst, RefetchQueryNormalizationArtifact }} from '@isograph/react';\n\
const queryText = '{query_text}';\n\n\
const normalizationAst: NormalizationAst = {normalization_ast};\n\
const normalizationAst: NormalizationAst = {{\n\
{}kind: \"NormalizationAst\",\n\
{}selections: {normalization_ast},\n\
}};\n\
const artifact: RefetchQueryNormalizationArtifact = {{\n\
{}kind: \"RefetchQuery\",\n\
{}networkRequestInfo: {{\n\
Expand All @@ -72,6 +75,8 @@ impl ImperativelyLoadedEntrypointArtifactInfo {
" ",
" ",
" ",
" ",
" ",

)
}
Expand Down Expand Up @@ -103,7 +108,7 @@ pub(crate) fn get_artifact_for_imperatively_loaded_field(
);

let normalization_ast_text =
generate_normalization_ast_text(schema, merged_selection_set.values(), 0);
generate_normalization_ast_text(schema, merged_selection_set.values(), 1);

ImperativelyLoadedEntrypointArtifactInfo {
normalization_ast_text,
Expand Down
Loading
Loading