From 08c667a688d1165ddc600661a5b4f2dcc9182283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Wa=C5=82ach?= <35966385+PatrykWalach@users.noreply.github.com> Date: Thu, 26 Dec 2024 16:31:33 +0100 Subject: [PATCH 1/4] add `kind` to `normalizationAst` --- .../src/entrypoint_artifact.rs | 9 +++++--- .../src/imperatively_loaded_fields.rs | 9 ++++++-- libs/isograph-react/src/core/cache.ts | 6 +++--- libs/isograph-react/src/core/check.ts | 6 +++--- libs/isograph-react/src/core/entrypoint.ts | 21 ++++++++++++------- .../src/core/garbageCollection.ts | 6 +++--- libs/isograph-react/src/core/logging.ts | 4 ++-- .../src/core/makeNetworkRequest.ts | 6 +++--- 8 files changed, 41 insertions(+), 26 deletions(-) diff --git a/crates/graphql_artifact_generation/src/entrypoint_artifact.rs b/crates/graphql_artifact_generation/src/entrypoint_artifact.rs index 2702ec2f..ee34a88f 100644 --- a/crates/graphql_artifact_generation/src/entrypoint_artifact.rs +++ b/crates/graphql_artifact_generation/src/entrypoint_artifact.rs @@ -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 @@ -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\ + {}normalizationAst: {normalization_ast_text},\n\ + }};\n\ const artifact: IsographEntrypoint<\n\ {}{entrypoint_params_typename},\n\ {}{entrypoint_output_type_name}\n\ @@ -313,7 +316,7 @@ impl EntrypointArtifactInfo<'_> { {}}},\n\ }};\n\n\ export default artifact;\n", - " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", + " "," "," ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", ) } } diff --git a/crates/graphql_artifact_generation/src/imperatively_loaded_fields.rs b/crates/graphql_artifact_generation/src/imperatively_loaded_fields.rs index 6f2de199..9bb3867c 100644 --- a/crates/graphql_artifact_generation/src/imperatively_loaded_fields.rs +++ b/crates/graphql_artifact_generation/src/imperatively_loaded_fields.rs @@ -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\ + {}normalizationAst: {normalization_ast},\n\ + }};\n\ const artifact: RefetchQueryNormalizationArtifact = {{\n\ {}kind: \"RefetchQuery\",\n\ {}networkRequestInfo: {{\n\ @@ -72,6 +75,8 @@ impl ImperativelyLoadedEntrypointArtifactInfo { " ", " ", " ", + " ", + " ", ) } @@ -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, diff --git a/libs/isograph-react/src/core/cache.ts b/libs/isograph-react/src/core/cache.ts index 088331e5..7c3430d2 100644 --- a/libs/isograph-react/src/core/cache.ts +++ b/libs/isograph-react/src/core/cache.ts @@ -16,7 +16,7 @@ import { } from './IsographEnvironment'; import { IsographEntrypoint, - NormalizationAst, + type NormalizationAstNodes, NormalizationInlineFragment, NormalizationLinkedField, NormalizationScalarField, @@ -142,7 +142,7 @@ export type NetworkResponseObject = { export function normalizeData( environment: IsographEnvironment, - normalizationAst: NormalizationAst, + normalizationAst: NormalizationAstNodes, networkResponse: NetworkResponseObject, variables: Variables, nestedRefetchQueries: RefetchQueryNormalizationArtifactWrapper[], @@ -376,7 +376,7 @@ export type EncounteredIds = Map>; */ function normalizeDataIntoRecord( environment: IsographEnvironment, - normalizationAst: NormalizationAst, + normalizationAst: NormalizationAstNodes, networkResponseParentRecord: NetworkResponseObject, targetParentRecord: StoreRecord, targetParentRecordLink: Link, diff --git a/libs/isograph-react/src/core/check.ts b/libs/isograph-react/src/core/check.ts index 1e7d0b21..6ed25c0a 100644 --- a/libs/isograph-react/src/core/check.ts +++ b/libs/isograph-react/src/core/check.ts @@ -1,5 +1,5 @@ import { getParentRecordKey } from './cache'; -import { NormalizationAst } from './entrypoint'; +import { NormalizationAstNodes } from './entrypoint'; import { Variables } from './FragmentReference'; import { getLink, @@ -30,7 +30,7 @@ export type CheckResult = export function check( environment: IsographEnvironment, - normalizationAst: NormalizationAst, + normalizationAst: NormalizationAstNodes, variables: Variables, root: Link, ): CheckResult { @@ -53,7 +53,7 @@ export function check( function checkFromRecord( environment: IsographEnvironment, - normalizationAst: NormalizationAst, + normalizationAst: NormalizationAstNodes, variables: Variables, record: StoreRecord, recordLink: Link, diff --git a/libs/isograph-react/src/core/entrypoint.ts b/libs/isograph-react/src/core/entrypoint.ts index 694fc728..cb105220 100644 --- a/libs/isograph-react/src/core/entrypoint.ts +++ b/libs/isograph-react/src/core/entrypoint.ts @@ -16,18 +16,19 @@ export type ReaderWithRefetchQueries< readonly nestedRefetchQueries: RefetchQueryNormalizationArtifactWrapper[]; }; -export type NetworkRequestInfo = { +export type NetworkRequestInfo = { readonly kind: 'NetworkRequestInfo'; readonly queryText: string; - readonly normalizationAst: NormalizationAst; + readonly normalizationAst: TNormalizationAst; }; // This type should be treated as an opaque type. export type IsographEntrypoint< TReadFromStore extends { parameters: object; data: object }, TClientFieldValue, + TNormalizationAst = NormalizationAst > = { readonly kind: 'Entrypoint'; - readonly networkRequestInfo: NetworkRequestInfo; + readonly networkRequestInfo: NetworkRequestInfo; readonly readerWithRefetchQueries: ReaderWithRefetchQueries< TReadFromStore, TClientFieldValue @@ -50,7 +51,13 @@ export type NormalizationAstNode = | NormalizationScalarField | NormalizationLinkedField | NormalizationInlineFragment; -export type NormalizationAst = ReadonlyArray; + +export type NormalizationAstNodes = ReadonlyArray; + +export type NormalizationAst = { + kind: 'NormalizationAst'; + normalizationAst: NormalizationAstNodes; +}; export type NormalizationScalarField = { readonly kind: 'Scalar'; @@ -62,20 +69,20 @@ export type NormalizationLinkedField = { readonly kind: 'Linked'; readonly fieldName: string; readonly arguments: Arguments | null; - readonly selections: NormalizationAst; + readonly selections: NormalizationAstNodes; readonly concreteType: TypeName | null; }; export type NormalizationInlineFragment = { readonly kind: 'InlineFragment'; readonly type: string; - readonly selections: NormalizationAst; + readonly selections: NormalizationAstNodes; }; // This is more like an entrypoint, but one specifically for a refetch query/mutation export type RefetchQueryNormalizationArtifact = { readonly kind: 'RefetchQuery'; - readonly networkRequestInfo: NetworkRequestInfo; + readonly networkRequestInfo: NetworkRequestInfo; readonly concreteType: TypeName; }; diff --git a/libs/isograph-react/src/core/garbageCollection.ts b/libs/isograph-react/src/core/garbageCollection.ts index 1442a179..4a6ceac8 100644 --- a/libs/isograph-react/src/core/garbageCollection.ts +++ b/libs/isograph-react/src/core/garbageCollection.ts @@ -9,10 +9,10 @@ import { type TypeName, } from './IsographEnvironment'; import { getParentRecordKey } from './cache'; -import { NormalizationAst } from './entrypoint'; +import { NormalizationAstNodes } from './entrypoint'; export type RetainedQuery = { - readonly normalizationAst: NormalizationAst; + readonly normalizationAst: NormalizationAstNodes; readonly variables: {}; readonly root: Link; }; @@ -108,7 +108,7 @@ function recordReachableIdsFromRecord( store: IsographStore, currentRecord: StoreRecord, mutableRetainedIds: RetainedIds, - selections: NormalizationAst, + selections: NormalizationAstNodes, variables: Variables | null, ) { for (const selection of selections) { diff --git a/libs/isograph-react/src/core/logging.ts b/libs/isograph-react/src/core/logging.ts index a19610bb..5e9ace9e 100644 --- a/libs/isograph-react/src/core/logging.ts +++ b/libs/isograph-react/src/core/logging.ts @@ -7,7 +7,7 @@ import { } from './IsographEnvironment'; import { IsographEntrypoint, - NormalizationAst, + type NormalizationAstNodes, RefetchQueryNormalizationArtifact, } from './entrypoint'; import { FragmentReference, Variables } from './FragmentReference'; @@ -25,7 +25,7 @@ export type LogMessage = } | { kind: 'AboutToNormalize'; - normalizationAst: NormalizationAst; + normalizationAst: NormalizationAstNodes; networkResponse: NetworkResponseObject; variables: Variables; } diff --git a/libs/isograph-react/src/core/makeNetworkRequest.ts b/libs/isograph-react/src/core/makeNetworkRequest.ts index 18957eb2..a3e971e7 100644 --- a/libs/isograph-react/src/core/makeNetworkRequest.ts +++ b/libs/isograph-react/src/core/makeNetworkRequest.ts @@ -46,7 +46,7 @@ export function maybeMakeNetworkRequest< case 'IfNecessary': { const result = check( environment, - artifact.networkRequestInfo.normalizationAst, + artifact.networkRequestInfo.normalizationAst.normalizationAst, variables, { __link: ROOT_ID, @@ -116,7 +116,7 @@ export function makeNetworkRequest< if (status.kind === 'UndisposedIncomplete') { normalizeData( environment, - artifact.networkRequestInfo.normalizationAst, + artifact.networkRequestInfo.normalizationAst.normalizationAst, networkResponse.data ?? {}, variables, artifact.kind === 'Entrypoint' @@ -125,7 +125,7 @@ export function makeNetworkRequest< root, ); const retainedQuery = { - normalizationAst: artifact.networkRequestInfo.normalizationAst, + normalizationAst: artifact.networkRequestInfo.normalizationAst.normalizationAst, variables, root, }; From 94fa2060a84aedd9d89103333bb9b9950ba84ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Wa=C5=82ach?= <35966385+PatrykWalach@users.noreply.github.com> Date: Thu, 26 Dec 2024 16:34:39 +0100 Subject: [PATCH 2/4] build demos --- .../src/entrypoint_artifact.rs | 2 +- .../src/imperatively_loaded_fields.rs | 2 +- .../__isograph/Query/HomePage/__refetch__0.ts | 351 ++++++------- .../__isograph/Query/HomePage/entrypoint.ts | 321 ++++++------ .../Query/PullRequest/entrypoint.ts | 271 +++++----- .../Query/RepositoryPage/entrypoint.ts | 491 +++++++++--------- .../__isograph/Query/UserPage/entrypoint.ts | 355 ++++++------- .../User/RepositoryConnection/entrypoint.ts | 321 ++++++------ .../AdItem/AdItemDisplay/entrypoint.ts | 83 +-- .../BlogItem/BlogItemMoreDetail/entrypoint.ts | 73 +-- .../Image/ImageDisplay/entrypoint.ts | 73 +-- .../Mutation/SetTagline/entrypoint.ts | 67 +-- .../Pet/PetCheckinsCard/__refetch__0.ts | 99 ++-- .../Pet/PetCheckinsCard/entrypoint.ts | 125 ++--- .../Pet/PetCheckinsCardList/__refetch__0.ts | 99 ++-- .../Pet/PetCheckinsCardList/entrypoint.ts | 125 ++--- .../__isograph/Query/HomeRoute/entrypoint.ts | 63 +-- .../__isograph/Query/Newsfeed/entrypoint.ts | 195 +++---- .../__isograph/Query/PetByName/entrypoint.ts | 51 +- .../Query/PetCheckinListRoute/__refetch__0.ts | 89 ++-- .../Query/PetCheckinListRoute/entrypoint.ts | 103 ++-- .../PetDetailDeferredRoute/entrypoint.ts | 51 +- .../Query/PetDetailRoute/__refetch__0.ts | 357 ++++++------- .../Query/PetDetailRoute/__refetch__1.ts | 359 ++++++------- .../Query/PetDetailRoute/__refetch__2.ts | 351 ++++++------- .../Query/PetDetailRoute/__refetch__3.ts | 99 ++-- .../Query/PetDetailRoute/__refetch__4.ts | 107 ++-- .../Query/PetDetailRoute/entrypoint.ts | 335 ++++++------ .../Query/PetFavoritePhrase/entrypoint.ts | 61 +-- .../NewsfeedPaginationComponent/entrypoint.ts | 225 ++++---- .../__isograph/Query/HomePage/entrypoint.ts | 99 ++-- libs/isograph-react/src/core/entrypoint.ts | 2 +- .../src/core/makeNetworkRequest.ts | 6 +- .../__isograph/Query/meName/entrypoint.ts | 43 +- .../Query/meNameSuccessor/entrypoint.ts | 105 ++-- .../__isograph/Query/nodeField/entrypoint.ts | 51 +- .../__isograph/Query/subquery/entrypoint.ts | 67 +-- 37 files changed, 2888 insertions(+), 2789 deletions(-) diff --git a/crates/graphql_artifact_generation/src/entrypoint_artifact.rs b/crates/graphql_artifact_generation/src/entrypoint_artifact.rs index ee34a88f..0eeff472 100644 --- a/crates/graphql_artifact_generation/src/entrypoint_artifact.rs +++ b/crates/graphql_artifact_generation/src/entrypoint_artifact.rs @@ -296,7 +296,7 @@ impl EntrypointArtifactInfo<'_> { const queryText = '{query_text}';\n\n\ const normalizationAst: NormalizationAst = {{\n\ {}kind: \"NormalizationAst\",\n\ - {}normalizationAst: {normalization_ast_text},\n\ + {}selections: {normalization_ast_text},\n\ }};\n\ const artifact: IsographEntrypoint<\n\ {}{entrypoint_params_typename},\n\ diff --git a/crates/graphql_artifact_generation/src/imperatively_loaded_fields.rs b/crates/graphql_artifact_generation/src/imperatively_loaded_fields.rs index 9bb3867c..f71f2543 100644 --- a/crates/graphql_artifact_generation/src/imperatively_loaded_fields.rs +++ b/crates/graphql_artifact_generation/src/imperatively_loaded_fields.rs @@ -56,7 +56,7 @@ impl ImperativelyLoadedEntrypointArtifactInfo { const queryText = '{query_text}';\n\n\ const normalizationAst: NormalizationAst = {{\n\ {}kind: \"NormalizationAst\",\n\ - {}normalizationAst: {normalization_ast},\n\ + {}selections: {normalization_ast},\n\ }};\n\ const artifact: RefetchQueryNormalizationArtifact = {{\n\ {}kind: \"RefetchQuery\",\n\ diff --git a/demos/github-demo/src/isograph-components/__isograph/Query/HomePage/__refetch__0.ts b/demos/github-demo/src/isograph-components/__isograph/Query/HomePage/__refetch__0.ts index 6373b761..28569e18 100644 --- a/demos/github-demo/src/isograph-components/__isograph/Query/HomePage/__refetch__0.ts +++ b/demos/github-demo/src/isograph-components/__isograph/Query/HomePage/__refetch__0.ts @@ -38,183 +38,186 @@ const queryText = 'query User__refetch ($id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "node", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, + ], ], - ], - concreteType: null, - selections: [ - { - kind: "InlineFragment", - type: "User", - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "avatarUrl", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "login", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Linked", - fieldName: "repositories", - arguments: [ - [ - "first", - { kind: "Literal", value: 10 }, - ], - - [ - "after", - { kind: "Literal", value: null }, - ], - ], - concreteType: "RepositoryConnection", - selections: [ - { - kind: "Linked", - fieldName: "edges", - arguments: null, - concreteType: "RepositoryEdge", - selections: [ - { - kind: "Linked", - fieldName: "node", - arguments: null, - concreteType: "Repository", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "description", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "forkCount", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "nameWithOwner", - arguments: null, - }, - { - kind: "Linked", - fieldName: "owner", - arguments: null, - concreteType: null, - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "login", - arguments: null, - }, - ], - }, - { - kind: "Linked", - fieldName: "pullRequests", - arguments: null, - concreteType: "PullRequestConnection", - selections: [ - { - kind: "Scalar", - fieldName: "totalCount", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "stargazerCount", - arguments: null, - }, - { - kind: "Linked", - fieldName: "watchers", - arguments: null, - concreteType: "UserConnection", - selections: [ - { - kind: "Scalar", - fieldName: "totalCount", - arguments: null, - }, - ], - }, - ], - }, + concreteType: null, + selections: [ + { + kind: "InlineFragment", + type: "User", + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "avatarUrl", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "login", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Linked", + fieldName: "repositories", + arguments: [ + [ + "first", + { kind: "Literal", value: 10 }, ], - }, - { - kind: "Linked", - fieldName: "pageInfo", - arguments: null, - concreteType: "PageInfo", - selections: [ - { - kind: "Scalar", - fieldName: "endCursor", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "hasNextPage", - arguments: null, - }, + + [ + "after", + { kind: "Literal", value: null }, ], - }, - ], - }, - ], - }, - ], - }, -]; + ], + concreteType: "RepositoryConnection", + selections: [ + { + kind: "Linked", + fieldName: "edges", + arguments: null, + concreteType: "RepositoryEdge", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: null, + concreteType: "Repository", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "description", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "forkCount", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "nameWithOwner", + arguments: null, + }, + { + kind: "Linked", + fieldName: "owner", + arguments: null, + concreteType: null, + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "login", + arguments: null, + }, + ], + }, + { + kind: "Linked", + fieldName: "pullRequests", + arguments: null, + concreteType: "PullRequestConnection", + selections: [ + { + kind: "Scalar", + fieldName: "totalCount", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "stargazerCount", + arguments: null, + }, + { + kind: "Linked", + fieldName: "watchers", + arguments: null, + concreteType: "UserConnection", + selections: [ + { + kind: "Scalar", + fieldName: "totalCount", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + { + kind: "Linked", + fieldName: "pageInfo", + arguments: null, + concreteType: "PageInfo", + selections: [ + { + kind: "Scalar", + fieldName: "endCursor", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "hasNextPage", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + ], + }, + ], +}; const artifact: RefetchQueryNormalizationArtifact = { kind: "RefetchQuery", networkRequestInfo: { diff --git a/demos/github-demo/src/isograph-components/__isograph/Query/HomePage/entrypoint.ts b/demos/github-demo/src/isograph-components/__isograph/Query/HomePage/entrypoint.ts index 362f1222..66036f98 100644 --- a/demos/github-demo/src/isograph-components/__isograph/Query/HomePage/entrypoint.ts +++ b/demos/github-demo/src/isograph-components/__isograph/Query/HomePage/entrypoint.ts @@ -43,167 +43,170 @@ const queryText = 'query HomePage {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "viewer", - arguments: null, - concreteType: "User", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "avatarUrl", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "login", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Linked", - fieldName: "repositories", - arguments: [ - [ - "first", - { kind: "Literal", value: 10 }, - ], - - [ - "after", - { kind: "Literal", value: null }, - ], - ], - concreteType: "RepositoryConnection", - selections: [ - { - kind: "Linked", - fieldName: "edges", - arguments: null, - concreteType: "RepositoryEdge", - selections: [ - { - kind: "Linked", - fieldName: "node", - arguments: null, - concreteType: "Repository", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "description", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "forkCount", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "nameWithOwner", - arguments: null, - }, - { - kind: "Linked", - fieldName: "owner", - arguments: null, - concreteType: null, - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "login", - arguments: null, - }, - ], - }, - { - kind: "Linked", - fieldName: "pullRequests", - arguments: null, - concreteType: "PullRequestConnection", - selections: [ - { - kind: "Scalar", - fieldName: "totalCount", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "stargazerCount", - arguments: null, - }, - { - kind: "Linked", - fieldName: "watchers", - arguments: null, - concreteType: "UserConnection", - selections: [ - { - kind: "Scalar", - fieldName: "totalCount", - arguments: null, - }, - ], - }, - ], - }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "viewer", + arguments: null, + concreteType: "User", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "avatarUrl", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "login", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Linked", + fieldName: "repositories", + arguments: [ + [ + "first", + { kind: "Literal", value: 10 }, ], - }, - { - kind: "Linked", - fieldName: "pageInfo", - arguments: null, - concreteType: "PageInfo", - selections: [ - { - kind: "Scalar", - fieldName: "endCursor", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "hasNextPage", - arguments: null, - }, + + [ + "after", + { kind: "Literal", value: null }, ], - }, - ], - }, - ], - }, -]; + ], + concreteType: "RepositoryConnection", + selections: [ + { + kind: "Linked", + fieldName: "edges", + arguments: null, + concreteType: "RepositoryEdge", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: null, + concreteType: "Repository", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "description", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "forkCount", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "nameWithOwner", + arguments: null, + }, + { + kind: "Linked", + fieldName: "owner", + arguments: null, + concreteType: null, + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "login", + arguments: null, + }, + ], + }, + { + kind: "Linked", + fieldName: "pullRequests", + arguments: null, + concreteType: "PullRequestConnection", + selections: [ + { + kind: "Scalar", + fieldName: "totalCount", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "stargazerCount", + arguments: null, + }, + { + kind: "Linked", + fieldName: "watchers", + arguments: null, + concreteType: "UserConnection", + selections: [ + { + kind: "Scalar", + fieldName: "totalCount", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + { + kind: "Linked", + fieldName: "pageInfo", + arguments: null, + concreteType: "PageInfo", + selections: [ + { + kind: "Scalar", + fieldName: "endCursor", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "hasNextPage", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__HomePage__param, Query__HomePage__output_type diff --git a/demos/github-demo/src/isograph-components/__isograph/Query/PullRequest/entrypoint.ts b/demos/github-demo/src/isograph-components/__isograph/Query/PullRequest/entrypoint.ts index 75db112b..1d34e645 100644 --- a/demos/github-demo/src/isograph-components/__isograph/Query/PullRequest/entrypoint.ts +++ b/demos/github-demo/src/isograph-components/__isograph/Query/PullRequest/entrypoint.ts @@ -33,144 +33,147 @@ const queryText = 'query PullRequest ($repositoryOwner: String!, $repositoryName },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "repository", - arguments: [ - [ - "owner", - { kind: "Variable", name: "repositoryOwner" }, - ], +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "repository", + arguments: [ + [ + "owner", + { kind: "Variable", name: "repositoryOwner" }, + ], - [ - "name", - { kind: "Variable", name: "repositoryName" }, - ], - ], - concreteType: "Repository", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Linked", - fieldName: "pullRequest", - arguments: [ - [ - "number", - { kind: "Variable", name: "pullRequestNumber" }, - ], + [ + "name", + { kind: "Variable", name: "repositoryName" }, ], - concreteType: "PullRequest", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "bodyHTML", - arguments: null, - }, - { - kind: "Linked", - fieldName: "comments", - arguments: [ - [ - "last", - { kind: "Literal", value: 10 }, - ], + ], + concreteType: "Repository", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Linked", + fieldName: "pullRequest", + arguments: [ + [ + "number", + { kind: "Variable", name: "pullRequestNumber" }, ], - concreteType: "IssueCommentConnection", - selections: [ - { - kind: "Linked", - fieldName: "edges", - arguments: null, - concreteType: "IssueCommentEdge", - selections: [ - { - kind: "Linked", - fieldName: "node", - arguments: null, - concreteType: "IssueComment", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Linked", - fieldName: "author", - arguments: null, - concreteType: null, - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "login", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "bodyText", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "createdAt", - arguments: null, - }, - ], - }, + ], + concreteType: "PullRequest", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "bodyHTML", + arguments: null, + }, + { + kind: "Linked", + fieldName: "comments", + arguments: [ + [ + "last", + { kind: "Literal", value: 10 }, ], - }, - ], - }, - { - kind: "Scalar", - fieldName: "title", - arguments: null, - }, - ], - }, - ], - }, - { - kind: "Linked", - fieldName: "viewer", - arguments: null, - concreteType: "User", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "avatarUrl", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - ], - }, -]; + ], + concreteType: "IssueCommentConnection", + selections: [ + { + kind: "Linked", + fieldName: "edges", + arguments: null, + concreteType: "IssueCommentEdge", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: null, + concreteType: "IssueComment", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Linked", + fieldName: "author", + arguments: null, + concreteType: null, + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "login", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "bodyText", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "createdAt", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + { + kind: "Scalar", + fieldName: "title", + arguments: null, + }, + ], + }, + ], + }, + { + kind: "Linked", + fieldName: "viewer", + arguments: null, + concreteType: "User", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "avatarUrl", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__PullRequest__param, Query__PullRequest__output_type diff --git a/demos/github-demo/src/isograph-components/__isograph/Query/RepositoryPage/entrypoint.ts b/demos/github-demo/src/isograph-components/__isograph/Query/RepositoryPage/entrypoint.ts index 6be9f97c..05c8c2ce 100644 --- a/demos/github-demo/src/isograph-components/__isograph/Query/RepositoryPage/entrypoint.ts +++ b/demos/github-demo/src/isograph-components/__isograph/Query/RepositoryPage/entrypoint.ts @@ -58,254 +58,257 @@ const queryText = 'query RepositoryPage ($repositoryName: String!, $repositoryOw },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "repository", - arguments: [ - [ - "name", - { kind: "Variable", name: "repositoryName" }, - ], +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "repository", + arguments: [ + [ + "name", + { kind: "Variable", name: "repositoryName" }, + ], - [ - "owner", - { kind: "Variable", name: "repositoryOwner" }, - ], - ], - concreteType: "Repository", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "nameWithOwner", - arguments: null, - }, - { - kind: "Linked", - fieldName: "parent", - arguments: null, - concreteType: "Repository", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "nameWithOwner", - arguments: null, - }, - { - kind: "Linked", - fieldName: "owner", - arguments: null, - concreteType: null, - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "login", - arguments: null, - }, - ], - }, + [ + "owner", + { kind: "Variable", name: "repositoryOwner" }, ], - }, - { - kind: "Linked", - fieldName: "pullRequests", - arguments: [ - [ - "last", - { kind: "Variable", name: "first" }, + ], + concreteType: "Repository", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "nameWithOwner", + arguments: null, + }, + { + kind: "Linked", + fieldName: "parent", + arguments: null, + concreteType: "Repository", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "nameWithOwner", + arguments: null, + }, + { + kind: "Linked", + fieldName: "owner", + arguments: null, + concreteType: null, + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "login", + arguments: null, + }, + ], + }, ], - ], - concreteType: "PullRequestConnection", - selections: [ - { - kind: "Linked", - fieldName: "edges", - arguments: null, - concreteType: "PullRequestEdge", - selections: [ - { - kind: "Linked", - fieldName: "node", - arguments: null, - concreteType: "PullRequest", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Linked", - fieldName: "author", - arguments: null, - concreteType: null, - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "login", - arguments: null, - }, - { - kind: "InlineFragment", - type: "User", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "twitterUsername", - arguments: null, - }, - ], - }, - ], - }, - { - kind: "Scalar", - fieldName: "closed", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "createdAt", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "number", - arguments: null, - }, - { - kind: "Linked", - fieldName: "repository", - arguments: null, - concreteType: "Repository", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Linked", - fieldName: "owner", - arguments: null, - concreteType: null, - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "login", - arguments: null, - }, - ], - }, - ], - }, - { - kind: "Scalar", - fieldName: "title", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "totalCommentsCount", - arguments: null, - }, - ], - }, + }, + { + kind: "Linked", + fieldName: "pullRequests", + arguments: [ + [ + "last", + { kind: "Variable", name: "first" }, ], - }, - ], - }, - { - kind: "Scalar", - fieldName: "stargazerCount", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "viewerHasStarred", - arguments: null, - }, - ], - }, - { - kind: "Linked", - fieldName: "viewer", - arguments: null, - concreteType: "User", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "avatarUrl", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - ], - }, -]; + ], + concreteType: "PullRequestConnection", + selections: [ + { + kind: "Linked", + fieldName: "edges", + arguments: null, + concreteType: "PullRequestEdge", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: null, + concreteType: "PullRequest", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Linked", + fieldName: "author", + arguments: null, + concreteType: null, + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "login", + arguments: null, + }, + { + kind: "InlineFragment", + type: "User", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "twitterUsername", + arguments: null, + }, + ], + }, + ], + }, + { + kind: "Scalar", + fieldName: "closed", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "createdAt", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "number", + arguments: null, + }, + { + kind: "Linked", + fieldName: "repository", + arguments: null, + concreteType: "Repository", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Linked", + fieldName: "owner", + arguments: null, + concreteType: null, + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "login", + arguments: null, + }, + ], + }, + ], + }, + { + kind: "Scalar", + fieldName: "title", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "totalCommentsCount", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + { + kind: "Scalar", + fieldName: "stargazerCount", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "viewerHasStarred", + arguments: null, + }, + ], + }, + { + kind: "Linked", + fieldName: "viewer", + arguments: null, + concreteType: "User", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "avatarUrl", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__RepositoryPage__param, Query__RepositoryPage__output_type diff --git a/demos/github-demo/src/isograph-components/__isograph/Query/UserPage/entrypoint.ts b/demos/github-demo/src/isograph-components/__isograph/Query/UserPage/entrypoint.ts index 348b9cb3..6727e887 100644 --- a/demos/github-demo/src/isograph-components/__isograph/Query/UserPage/entrypoint.ts +++ b/demos/github-demo/src/isograph-components/__isograph/Query/UserPage/entrypoint.ts @@ -43,185 +43,188 @@ const queryText = 'query UserPage ($userLogin: String!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "user", - arguments: [ - [ - "login", - { kind: "Variable", name: "userLogin" }, - ], - ], - concreteType: "User", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Linked", - fieldName: "repositories", - arguments: [ - [ - "first", - { kind: "Literal", value: 10 }, - ], - - [ - "after", - { kind: "Literal", value: null }, - ], +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "user", + arguments: [ + [ + "login", + { kind: "Variable", name: "userLogin" }, ], - concreteType: "RepositoryConnection", - selections: [ - { - kind: "Linked", - fieldName: "edges", - arguments: null, - concreteType: "RepositoryEdge", - selections: [ - { - kind: "Linked", - fieldName: "node", - arguments: null, - concreteType: "Repository", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "description", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "forkCount", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "nameWithOwner", - arguments: null, - }, - { - kind: "Linked", - fieldName: "owner", - arguments: null, - concreteType: null, - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "login", - arguments: null, - }, - ], - }, - { - kind: "Linked", - fieldName: "pullRequests", - arguments: null, - concreteType: "PullRequestConnection", - selections: [ - { - kind: "Scalar", - fieldName: "totalCount", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "stargazerCount", - arguments: null, - }, - { - kind: "Linked", - fieldName: "watchers", - arguments: null, - concreteType: "UserConnection", - selections: [ - { - kind: "Scalar", - fieldName: "totalCount", - arguments: null, - }, - ], - }, - ], - }, + ], + concreteType: "User", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Linked", + fieldName: "repositories", + arguments: [ + [ + "first", + { kind: "Literal", value: 10 }, ], - }, - { - kind: "Linked", - fieldName: "pageInfo", - arguments: null, - concreteType: "PageInfo", - selections: [ - { - kind: "Scalar", - fieldName: "endCursor", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "hasNextPage", - arguments: null, - }, + + [ + "after", + { kind: "Literal", value: null }, ], - }, - ], - }, - ], - }, - { - kind: "Linked", - fieldName: "viewer", - arguments: null, - concreteType: "User", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "avatarUrl", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - ], - }, -]; + ], + concreteType: "RepositoryConnection", + selections: [ + { + kind: "Linked", + fieldName: "edges", + arguments: null, + concreteType: "RepositoryEdge", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: null, + concreteType: "Repository", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "description", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "forkCount", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "nameWithOwner", + arguments: null, + }, + { + kind: "Linked", + fieldName: "owner", + arguments: null, + concreteType: null, + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "login", + arguments: null, + }, + ], + }, + { + kind: "Linked", + fieldName: "pullRequests", + arguments: null, + concreteType: "PullRequestConnection", + selections: [ + { + kind: "Scalar", + fieldName: "totalCount", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "stargazerCount", + arguments: null, + }, + { + kind: "Linked", + fieldName: "watchers", + arguments: null, + concreteType: "UserConnection", + selections: [ + { + kind: "Scalar", + fieldName: "totalCount", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + { + kind: "Linked", + fieldName: "pageInfo", + arguments: null, + concreteType: "PageInfo", + selections: [ + { + kind: "Scalar", + fieldName: "endCursor", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "hasNextPage", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + { + kind: "Linked", + fieldName: "viewer", + arguments: null, + concreteType: "User", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "avatarUrl", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__UserPage__param, Query__UserPage__output_type diff --git a/demos/github-demo/src/isograph-components/__isograph/User/RepositoryConnection/entrypoint.ts b/demos/github-demo/src/isograph-components/__isograph/User/RepositoryConnection/entrypoint.ts index 1c2e894c..a2a76eb5 100644 --- a/demos/github-demo/src/isograph-components/__isograph/User/RepositoryConnection/entrypoint.ts +++ b/demos/github-demo/src/isograph-components/__isograph/User/RepositoryConnection/entrypoint.ts @@ -40,168 +40,171 @@ const queryText = 'query RepositoryConnection ($first: Int, $after: String, $id: },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "node", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, + ], ], - ], - concreteType: null, - selections: [ - { - kind: "InlineFragment", - type: "User", - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Linked", - fieldName: "repositories", - arguments: [ - [ - "first", - { kind: "Variable", name: "first" }, - ], - - [ - "after", - { kind: "Variable", name: "after" }, - ], - ], - concreteType: "RepositoryConnection", - selections: [ - { - kind: "Linked", - fieldName: "edges", - arguments: null, - concreteType: "RepositoryEdge", - selections: [ - { - kind: "Linked", - fieldName: "node", - arguments: null, - concreteType: "Repository", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "description", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "forkCount", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "nameWithOwner", - arguments: null, - }, - { - kind: "Linked", - fieldName: "owner", - arguments: null, - concreteType: null, - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "login", - arguments: null, - }, - ], - }, - { - kind: "Linked", - fieldName: "pullRequests", - arguments: null, - concreteType: "PullRequestConnection", - selections: [ - { - kind: "Scalar", - fieldName: "totalCount", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "stargazerCount", - arguments: null, - }, - { - kind: "Linked", - fieldName: "watchers", - arguments: null, - concreteType: "UserConnection", - selections: [ - { - kind: "Scalar", - fieldName: "totalCount", - arguments: null, - }, - ], - }, - ], - }, + concreteType: null, + selections: [ + { + kind: "InlineFragment", + type: "User", + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Linked", + fieldName: "repositories", + arguments: [ + [ + "first", + { kind: "Variable", name: "first" }, ], - }, - { - kind: "Linked", - fieldName: "pageInfo", - arguments: null, - concreteType: "PageInfo", - selections: [ - { - kind: "Scalar", - fieldName: "endCursor", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "hasNextPage", - arguments: null, - }, + + [ + "after", + { kind: "Variable", name: "after" }, ], - }, - ], - }, - ], - }, - ], - }, -]; + ], + concreteType: "RepositoryConnection", + selections: [ + { + kind: "Linked", + fieldName: "edges", + arguments: null, + concreteType: "RepositoryEdge", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: null, + concreteType: "Repository", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "description", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "forkCount", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "nameWithOwner", + arguments: null, + }, + { + kind: "Linked", + fieldName: "owner", + arguments: null, + concreteType: null, + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "login", + arguments: null, + }, + ], + }, + { + kind: "Linked", + fieldName: "pullRequests", + arguments: null, + concreteType: "PullRequestConnection", + selections: [ + { + kind: "Scalar", + fieldName: "totalCount", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "stargazerCount", + arguments: null, + }, + { + kind: "Linked", + fieldName: "watchers", + arguments: null, + concreteType: "UserConnection", + selections: [ + { + kind: "Scalar", + fieldName: "totalCount", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + { + kind: "Linked", + fieldName: "pageInfo", + arguments: null, + concreteType: "PageInfo", + selections: [ + { + kind: "Scalar", + fieldName: "endCursor", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "hasNextPage", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< User__RepositoryConnection__param, User__RepositoryConnection__output_type diff --git a/demos/pet-demo/src/components/__isograph/AdItem/AdItemDisplay/entrypoint.ts b/demos/pet-demo/src/components/__isograph/AdItem/AdItemDisplay/entrypoint.ts index 4e09394a..a0c1928f 100644 --- a/demos/pet-demo/src/components/__isograph/AdItem/AdItemDisplay/entrypoint.ts +++ b/demos/pet-demo/src/components/__isograph/AdItem/AdItemDisplay/entrypoint.ts @@ -15,47 +15,50 @@ const queryText = 'query AdItemDisplay ($id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "node", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, - ], - ], - concreteType: null, - selections: [ - { - kind: "InlineFragment", - type: "AdItem", - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "advertiser", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "message", - arguments: null, - }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, ], - }, - ], - }, -]; + ], + concreteType: null, + selections: [ + { + kind: "InlineFragment", + type: "AdItem", + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "advertiser", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "message", + arguments: null, + }, + ], + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< AdItem__AdItemDisplay__param, AdItem__AdItemDisplay__output_type diff --git a/demos/pet-demo/src/components/__isograph/BlogItem/BlogItemMoreDetail/entrypoint.ts b/demos/pet-demo/src/components/__isograph/BlogItem/BlogItemMoreDetail/entrypoint.ts index 105ff064..e725426d 100644 --- a/demos/pet-demo/src/components/__isograph/BlogItem/BlogItemMoreDetail/entrypoint.ts +++ b/demos/pet-demo/src/components/__isograph/BlogItem/BlogItemMoreDetail/entrypoint.ts @@ -14,42 +14,45 @@ const queryText = 'query BlogItemMoreDetail ($id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "node", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, - ], - ], - concreteType: null, - selections: [ - { - kind: "InlineFragment", - type: "BlogItem", - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "moreContent", - arguments: null, - }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, ], - }, - ], - }, -]; + ], + concreteType: null, + selections: [ + { + kind: "InlineFragment", + type: "BlogItem", + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "moreContent", + arguments: null, + }, + ], + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< BlogItem__BlogItemMoreDetail__param, BlogItem__BlogItemMoreDetail__output_type diff --git a/demos/pet-demo/src/components/__isograph/Image/ImageDisplay/entrypoint.ts b/demos/pet-demo/src/components/__isograph/Image/ImageDisplay/entrypoint.ts index 369e9373..0040205e 100644 --- a/demos/pet-demo/src/components/__isograph/Image/ImageDisplay/entrypoint.ts +++ b/demos/pet-demo/src/components/__isograph/Image/ImageDisplay/entrypoint.ts @@ -14,42 +14,45 @@ const queryText = 'query ImageDisplay ($id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "node", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, - ], - ], - concreteType: null, - selections: [ - { - kind: "InlineFragment", - type: "Image", - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "url", - arguments: null, - }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, ], - }, - ], - }, -]; + ], + concreteType: null, + selections: [ + { + kind: "InlineFragment", + type: "Image", + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "url", + arguments: null, + }, + ], + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Image__ImageDisplay__param, Image__ImageDisplay__output_type diff --git a/demos/pet-demo/src/components/__isograph/Mutation/SetTagline/entrypoint.ts b/demos/pet-demo/src/components/__isograph/Mutation/SetTagline/entrypoint.ts index 054f5b22..bea919c2 100644 --- a/demos/pet-demo/src/components/__isograph/Mutation/SetTagline/entrypoint.ts +++ b/demos/pet-demo/src/components/__isograph/Mutation/SetTagline/entrypoint.ts @@ -13,39 +13,42 @@ const queryText = 'mutation SetTagline ($input: SetPetTaglineParams!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "set_pet_tagline", - arguments: [ - [ - "input", - { kind: "Variable", name: "input" }, - ], - ], - concreteType: "SetPetTaglineResponse", - selections: [ - { - kind: "Linked", - fieldName: "pet", - arguments: null, - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "tagline", - arguments: null, - }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "set_pet_tagline", + arguments: [ + [ + "input", + { kind: "Variable", name: "input" }, ], - }, - ], - }, -]; + ], + concreteType: "SetPetTaglineResponse", + selections: [ + { + kind: "Linked", + fieldName: "pet", + arguments: null, + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "tagline", + arguments: null, + }, + ], + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Mutation__SetTagline__param, Mutation__SetTagline__output_type diff --git a/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCard/__refetch__0.ts b/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCard/__refetch__0.ts index d97fd72b..ee3626fd 100644 --- a/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCard/__refetch__0.ts +++ b/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCard/__refetch__0.ts @@ -12,55 +12,58 @@ const queryText = 'mutation Pet__make_super ($checkin_id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "make_checkin_super", - arguments: [ - [ - "checkin_id", - { kind: "Variable", name: "checkin_id" }, - ], - ], - concreteType: "MakeCheckinSuperResponse", - selections: [ - { - kind: "Linked", - fieldName: "checkin", - arguments: null, - concreteType: null, - selections: [ - { - kind: "InlineFragment", - type: "Checkin", - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "location", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "time", - arguments: null, - }, - ], - }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "make_checkin_super", + arguments: [ + [ + "checkin_id", + { kind: "Variable", name: "checkin_id" }, ], - }, - ], - }, -]; + ], + concreteType: "MakeCheckinSuperResponse", + selections: [ + { + kind: "Linked", + fieldName: "checkin", + arguments: null, + concreteType: null, + selections: [ + { + kind: "InlineFragment", + type: "Checkin", + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "location", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "time", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + ], +}; const artifact: RefetchQueryNormalizationArtifact = { kind: "RefetchQuery", networkRequestInfo: { diff --git a/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCard/entrypoint.ts b/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCard/entrypoint.ts index dfd7fc50..3c9235f7 100644 --- a/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCard/entrypoint.ts +++ b/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCard/entrypoint.ts @@ -21,70 +21,73 @@ const queryText = 'query PetCheckinsCard ($skip: Int, $limit: Int, $id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "node", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, + ], ], - ], - concreteType: null, - selections: [ - { - kind: "InlineFragment", - type: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Linked", - fieldName: "checkins", - arguments: [ - [ - "skip", - { kind: "Variable", name: "skip" }, - ], + concreteType: null, + selections: [ + { + kind: "InlineFragment", + type: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Linked", + fieldName: "checkins", + arguments: [ + [ + "skip", + { kind: "Variable", name: "skip" }, + ], - [ - "limit", - { kind: "Variable", name: "limit" }, + [ + "limit", + { kind: "Variable", name: "limit" }, + ], ], - ], - concreteType: "Checkin", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "location", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "time", - arguments: null, - }, - ], - }, - ], - }, - ], - }, -]; + concreteType: "Checkin", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "location", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "time", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Pet__PetCheckinsCard__param, Pet__PetCheckinsCard__output_type diff --git a/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCardList/__refetch__0.ts b/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCardList/__refetch__0.ts index d97fd72b..ee3626fd 100644 --- a/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCardList/__refetch__0.ts +++ b/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCardList/__refetch__0.ts @@ -12,55 +12,58 @@ const queryText = 'mutation Pet__make_super ($checkin_id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "make_checkin_super", - arguments: [ - [ - "checkin_id", - { kind: "Variable", name: "checkin_id" }, - ], - ], - concreteType: "MakeCheckinSuperResponse", - selections: [ - { - kind: "Linked", - fieldName: "checkin", - arguments: null, - concreteType: null, - selections: [ - { - kind: "InlineFragment", - type: "Checkin", - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "location", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "time", - arguments: null, - }, - ], - }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "make_checkin_super", + arguments: [ + [ + "checkin_id", + { kind: "Variable", name: "checkin_id" }, ], - }, - ], - }, -]; + ], + concreteType: "MakeCheckinSuperResponse", + selections: [ + { + kind: "Linked", + fieldName: "checkin", + arguments: null, + concreteType: null, + selections: [ + { + kind: "InlineFragment", + type: "Checkin", + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "location", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "time", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + ], +}; const artifact: RefetchQueryNormalizationArtifact = { kind: "RefetchQuery", networkRequestInfo: { diff --git a/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCardList/entrypoint.ts b/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCardList/entrypoint.ts index 4de5ac26..82083760 100644 --- a/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCardList/entrypoint.ts +++ b/demos/pet-demo/src/components/__isograph/Pet/PetCheckinsCardList/entrypoint.ts @@ -21,70 +21,73 @@ const queryText = 'query PetCheckinsCardList ($skip: Int!, $limit: Int!, $id: ID },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "node", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, + ], ], - ], - concreteType: null, - selections: [ - { - kind: "InlineFragment", - type: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Linked", - fieldName: "checkins", - arguments: [ - [ - "skip", - { kind: "Variable", name: "skip" }, - ], + concreteType: null, + selections: [ + { + kind: "InlineFragment", + type: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Linked", + fieldName: "checkins", + arguments: [ + [ + "skip", + { kind: "Variable", name: "skip" }, + ], - [ - "limit", - { kind: "Variable", name: "limit" }, + [ + "limit", + { kind: "Variable", name: "limit" }, + ], ], - ], - concreteType: "Checkin", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "location", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "time", - arguments: null, - }, - ], - }, - ], - }, - ], - }, -]; + concreteType: "Checkin", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "location", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "time", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Pet__PetCheckinsCardList__param, Pet__PetCheckinsCardList__output_type diff --git a/demos/pet-demo/src/components/__isograph/Query/HomeRoute/entrypoint.ts b/demos/pet-demo/src/components/__isograph/Query/HomeRoute/entrypoint.ts index dcfe8ae2..956cda1a 100644 --- a/demos/pet-demo/src/components/__isograph/Query/HomeRoute/entrypoint.ts +++ b/demos/pet-demo/src/components/__isograph/Query/HomeRoute/entrypoint.ts @@ -13,36 +13,39 @@ const queryText = 'query HomeRoute {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "pets", - arguments: null, - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "picture", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "tagline", - arguments: null, - }, - ], - }, -]; +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "pets", + arguments: null, + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "picture", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "tagline", + arguments: null, + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__HomeRoute__param, Query__HomeRoute__output_type diff --git a/demos/pet-demo/src/components/__isograph/Query/Newsfeed/entrypoint.ts b/demos/pet-demo/src/components/__isograph/Query/Newsfeed/entrypoint.ts index d2414e40..cb47034e 100644 --- a/demos/pet-demo/src/components/__isograph/Query/Newsfeed/entrypoint.ts +++ b/demos/pet-demo/src/components/__isograph/Query/Newsfeed/entrypoint.ts @@ -27,104 +27,107 @@ const queryText = 'query Newsfeed {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "viewer", - arguments: null, - concreteType: "Viewer", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Linked", - fieldName: "newsfeed", - arguments: [ - [ - "skip", - { kind: "Literal", value: 0 }, - ], - - [ - "limit", - { kind: "Literal", value: 6 }, - ], - ], - concreteType: null, - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "InlineFragment", - type: "AdItem", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "viewer", + arguments: null, + concreteType: "Viewer", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Linked", + fieldName: "newsfeed", + arguments: [ + [ + "skip", + { kind: "Literal", value: 0 }, ], - }, - { - kind: "InlineFragment", - type: "BlogItem", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "author", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "content", - arguments: null, - }, - { - kind: "Linked", - fieldName: "image", - arguments: null, - concreteType: "Image", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "title", - arguments: null, - }, + + [ + "limit", + { kind: "Literal", value: 6 }, ], - }, - ], - }, - ], - }, -]; + ], + concreteType: null, + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "InlineFragment", + type: "AdItem", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + ], + }, + { + kind: "InlineFragment", + type: "BlogItem", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "author", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "content", + arguments: null, + }, + { + kind: "Linked", + fieldName: "image", + arguments: null, + concreteType: "Image", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "title", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__Newsfeed__param, Query__Newsfeed__output_type diff --git a/demos/pet-demo/src/components/__isograph/Query/PetByName/entrypoint.ts b/demos/pet-demo/src/components/__isograph/Query/PetByName/entrypoint.ts index b70ba544..e5622088 100644 --- a/demos/pet-demo/src/components/__isograph/Query/PetByName/entrypoint.ts +++ b/demos/pet-demo/src/components/__isograph/Query/PetByName/entrypoint.ts @@ -11,31 +11,34 @@ const queryText = 'query PetByName ($name: String!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "petByName", - arguments: [ - [ - "name", - { kind: "Variable", name: "name" }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "petByName", + arguments: [ + [ + "name", + { kind: "Variable", name: "name" }, + ], ], - ], - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - ], - }, -]; + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__PetByName__param, Query__PetByName__output_type diff --git a/demos/pet-demo/src/components/__isograph/Query/PetCheckinListRoute/__refetch__0.ts b/demos/pet-demo/src/components/__isograph/Query/PetCheckinListRoute/__refetch__0.ts index b73c63ca..c6775a61 100644 --- a/demos/pet-demo/src/components/__isograph/Query/PetCheckinListRoute/__refetch__0.ts +++ b/demos/pet-demo/src/components/__isograph/Query/PetCheckinListRoute/__refetch__0.ts @@ -11,50 +11,53 @@ const queryText = 'mutation Query__make_super ($checkin_id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "make_checkin_super", - arguments: [ - [ - "checkin_id", - { kind: "Variable", name: "checkin_id" }, - ], - ], - concreteType: "MakeCheckinSuperResponse", - selections: [ - { - kind: "Linked", - fieldName: "checkin", - arguments: null, - concreteType: null, - selections: [ - { - kind: "InlineFragment", - type: "Checkin", - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "location", - arguments: null, - }, - ], - }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "make_checkin_super", + arguments: [ + [ + "checkin_id", + { kind: "Variable", name: "checkin_id" }, ], - }, - ], - }, -]; + ], + concreteType: "MakeCheckinSuperResponse", + selections: [ + { + kind: "Linked", + fieldName: "checkin", + arguments: null, + concreteType: null, + selections: [ + { + kind: "InlineFragment", + type: "Checkin", + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "location", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + ], +}; const artifact: RefetchQueryNormalizationArtifact = { kind: "RefetchQuery", networkRequestInfo: { diff --git a/demos/pet-demo/src/components/__isograph/Query/PetCheckinListRoute/entrypoint.ts b/demos/pet-demo/src/components/__isograph/Query/PetCheckinListRoute/entrypoint.ts index 2bc40039..545e3555 100644 --- a/demos/pet-demo/src/components/__isograph/Query/PetCheckinListRoute/entrypoint.ts +++ b/demos/pet-demo/src/components/__isograph/Query/PetCheckinListRoute/entrypoint.ts @@ -18,59 +18,62 @@ const queryText = 'query PetCheckinListRoute ($id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "pet", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "pet", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, + ], ], - ], - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Linked", - fieldName: "checkins", - arguments: [ - [ - "skip", - { kind: "Literal", value: 0 }, - ], + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Linked", + fieldName: "checkins", + arguments: [ + [ + "skip", + { kind: "Literal", value: 0 }, + ], - [ - "limit", - { kind: "Literal", value: 1 }, + [ + "limit", + { kind: "Literal", value: 1 }, + ], ], - ], - concreteType: "Checkin", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "location", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - ], - }, -]; + concreteType: "Checkin", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "location", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__PetCheckinListRoute__param, Query__PetCheckinListRoute__output_type diff --git a/demos/pet-demo/src/components/__isograph/Query/PetDetailDeferredRoute/entrypoint.ts b/demos/pet-demo/src/components/__isograph/Query/PetDetailDeferredRoute/entrypoint.ts index 15d46f99..ca1481b5 100644 --- a/demos/pet-demo/src/components/__isograph/Query/PetDetailDeferredRoute/entrypoint.ts +++ b/demos/pet-demo/src/components/__isograph/Query/PetDetailDeferredRoute/entrypoint.ts @@ -11,31 +11,34 @@ const queryText = 'query PetDetailDeferredRoute ($id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "pet", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "pet", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, + ], ], - ], - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - ], - }, -]; + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__PetDetailDeferredRoute__param, Query__PetDetailDeferredRoute__output_type diff --git a/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__0.ts b/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__0.ts index 52a40343..56ae2104 100644 --- a/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__0.ts +++ b/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__0.ts @@ -38,187 +38,190 @@ const queryText = 'query Pet__refetch ($id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "node", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, + ], ], - ], - concreteType: null, - selections: [ - { - kind: "InlineFragment", - type: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "age", - arguments: null, - }, - { - kind: "Linked", - fieldName: "best_friend_relationship", - arguments: null, - concreteType: "BestFriendRelationship", - selections: [ - { - kind: "Linked", - fieldName: "best_friend", - arguments: null, - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "picture", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "picture_together", - arguments: null, - }, - ], - }, - { - kind: "Linked", - fieldName: "checkins", - arguments: [ - [ - "skip", - { kind: "Literal", value: null }, + concreteType: null, + selections: [ + { + kind: "InlineFragment", + type: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "age", + arguments: null, + }, + { + kind: "Linked", + fieldName: "best_friend_relationship", + arguments: null, + concreteType: "BestFriendRelationship", + selections: [ + { + kind: "Linked", + fieldName: "best_friend", + arguments: null, + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "picture", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "picture_together", + arguments: null, + }, ], + }, + { + kind: "Linked", + fieldName: "checkins", + arguments: [ + [ + "skip", + { kind: "Literal", value: null }, + ], - [ - "limit", - { kind: "Literal", value: null }, + [ + "limit", + { kind: "Literal", value: null }, + ], ], - ], - concreteType: "Checkin", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "location", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "time", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "favorite_phrase", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "nickname", - arguments: null, - }, - { - kind: "Linked", - fieldName: "potential_new_best_friends", - arguments: null, - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - ], - }, - { - kind: "Linked", - fieldName: "stats", - arguments: null, - concreteType: "PetStats", - selections: [ - { - kind: "Scalar", - fieldName: "cuteness", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "energy", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "hunger", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "intelligence", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "sociability", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "weight", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "tagline", - arguments: null, - }, - ], - }, - ], - }, -]; + concreteType: "Checkin", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "location", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "time", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "favorite_phrase", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "nickname", + arguments: null, + }, + { + kind: "Linked", + fieldName: "potential_new_best_friends", + arguments: null, + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + ], + }, + { + kind: "Linked", + fieldName: "stats", + arguments: null, + concreteType: "PetStats", + selections: [ + { + kind: "Scalar", + fieldName: "cuteness", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "energy", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "hunger", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "intelligence", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "sociability", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "weight", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "tagline", + arguments: null, + }, + ], + }, + ], + }, + ], +}; const artifact: RefetchQueryNormalizationArtifact = { kind: "RefetchQuery", networkRequestInfo: { diff --git a/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__1.ts b/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__1.ts index 512986f9..92d7c8df 100644 --- a/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__1.ts +++ b/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__1.ts @@ -37,189 +37,192 @@ const queryText = 'mutation Query__set_best_friend ($id: ID!, $new_best_friend_i },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "set_pet_best_friend", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, - ], +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "set_pet_best_friend", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, + ], - [ - "new_best_friend_id", - { kind: "Variable", name: "new_best_friend_id" }, + [ + "new_best_friend_id", + { kind: "Variable", name: "new_best_friend_id" }, + ], ], - ], - concreteType: "SetBestFriendResponse", - selections: [ - { - kind: "Linked", - fieldName: "pet", - arguments: null, - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "age", - arguments: null, - }, - { - kind: "Linked", - fieldName: "best_friend_relationship", - arguments: null, - concreteType: "BestFriendRelationship", - selections: [ - { - kind: "Linked", - fieldName: "best_friend", - arguments: null, - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "picture", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "picture_together", - arguments: null, - }, - ], - }, - { - kind: "Linked", - fieldName: "checkins", - arguments: [ - [ - "skip", - { kind: "Literal", value: null }, + concreteType: "SetBestFriendResponse", + selections: [ + { + kind: "Linked", + fieldName: "pet", + arguments: null, + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "age", + arguments: null, + }, + { + kind: "Linked", + fieldName: "best_friend_relationship", + arguments: null, + concreteType: "BestFriendRelationship", + selections: [ + { + kind: "Linked", + fieldName: "best_friend", + arguments: null, + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "picture", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "picture_together", + arguments: null, + }, ], + }, + { + kind: "Linked", + fieldName: "checkins", + arguments: [ + [ + "skip", + { kind: "Literal", value: null }, + ], - [ - "limit", - { kind: "Literal", value: null }, + [ + "limit", + { kind: "Literal", value: null }, + ], ], - ], - concreteType: "Checkin", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "location", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "time", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "favorite_phrase", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "nickname", - arguments: null, - }, - { - kind: "Linked", - fieldName: "potential_new_best_friends", - arguments: null, - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - ], - }, - { - kind: "Linked", - fieldName: "stats", - arguments: null, - concreteType: "PetStats", - selections: [ - { - kind: "Scalar", - fieldName: "cuteness", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "energy", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "hunger", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "intelligence", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "sociability", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "weight", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "tagline", - arguments: null, - }, - ], - }, - ], - }, -]; + concreteType: "Checkin", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "location", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "time", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "favorite_phrase", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "nickname", + arguments: null, + }, + { + kind: "Linked", + fieldName: "potential_new_best_friends", + arguments: null, + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + ], + }, + { + kind: "Linked", + fieldName: "stats", + arguments: null, + concreteType: "PetStats", + selections: [ + { + kind: "Scalar", + fieldName: "cuteness", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "energy", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "hunger", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "intelligence", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "sociability", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "weight", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "tagline", + arguments: null, + }, + ], + }, + ], + }, + ], +}; const artifact: RefetchQueryNormalizationArtifact = { kind: "RefetchQuery", networkRequestInfo: { diff --git a/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__2.ts b/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__2.ts index f76fd47f..13510348 100644 --- a/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__2.ts +++ b/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__2.ts @@ -37,184 +37,187 @@ const queryText = 'mutation Query__set_pet_tagline ($input: SetPetTaglineParams! },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "set_pet_tagline", - arguments: [ - [ - "input", - { kind: "Variable", name: "input" }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "set_pet_tagline", + arguments: [ + [ + "input", + { kind: "Variable", name: "input" }, + ], ], - ], - concreteType: "SetPetTaglineResponse", - selections: [ - { - kind: "Linked", - fieldName: "pet", - arguments: null, - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "age", - arguments: null, - }, - { - kind: "Linked", - fieldName: "best_friend_relationship", - arguments: null, - concreteType: "BestFriendRelationship", - selections: [ - { - kind: "Linked", - fieldName: "best_friend", - arguments: null, - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "picture", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "picture_together", - arguments: null, - }, - ], - }, - { - kind: "Linked", - fieldName: "checkins", - arguments: [ - [ - "skip", - { kind: "Literal", value: null }, + concreteType: "SetPetTaglineResponse", + selections: [ + { + kind: "Linked", + fieldName: "pet", + arguments: null, + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "age", + arguments: null, + }, + { + kind: "Linked", + fieldName: "best_friend_relationship", + arguments: null, + concreteType: "BestFriendRelationship", + selections: [ + { + kind: "Linked", + fieldName: "best_friend", + arguments: null, + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "picture", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "picture_together", + arguments: null, + }, ], + }, + { + kind: "Linked", + fieldName: "checkins", + arguments: [ + [ + "skip", + { kind: "Literal", value: null }, + ], - [ - "limit", - { kind: "Literal", value: null }, + [ + "limit", + { kind: "Literal", value: null }, + ], ], - ], - concreteType: "Checkin", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "location", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "time", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "favorite_phrase", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "nickname", - arguments: null, - }, - { - kind: "Linked", - fieldName: "potential_new_best_friends", - arguments: null, - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - ], - }, - { - kind: "Linked", - fieldName: "stats", - arguments: null, - concreteType: "PetStats", - selections: [ - { - kind: "Scalar", - fieldName: "cuteness", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "energy", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "hunger", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "intelligence", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "sociability", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "weight", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "tagline", - arguments: null, - }, - ], - }, - ], - }, -]; + concreteType: "Checkin", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "location", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "time", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "favorite_phrase", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "nickname", + arguments: null, + }, + { + kind: "Linked", + fieldName: "potential_new_best_friends", + arguments: null, + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + ], + }, + { + kind: "Linked", + fieldName: "stats", + arguments: null, + concreteType: "PetStats", + selections: [ + { + kind: "Scalar", + fieldName: "cuteness", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "energy", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "hunger", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "intelligence", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "sociability", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "weight", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "tagline", + arguments: null, + }, + ], + }, + ], + }, + ], +}; const artifact: RefetchQueryNormalizationArtifact = { kind: "RefetchQuery", networkRequestInfo: { diff --git a/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__3.ts b/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__3.ts index 0c8c993b..8ea84f92 100644 --- a/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__3.ts +++ b/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__3.ts @@ -12,55 +12,58 @@ const queryText = 'mutation Query__make_super ($checkin_id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "make_checkin_super", - arguments: [ - [ - "checkin_id", - { kind: "Variable", name: "checkin_id" }, - ], - ], - concreteType: "MakeCheckinSuperResponse", - selections: [ - { - kind: "Linked", - fieldName: "checkin", - arguments: null, - concreteType: null, - selections: [ - { - kind: "InlineFragment", - type: "Checkin", - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "location", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "time", - arguments: null, - }, - ], - }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "make_checkin_super", + arguments: [ + [ + "checkin_id", + { kind: "Variable", name: "checkin_id" }, ], - }, - ], - }, -]; + ], + concreteType: "MakeCheckinSuperResponse", + selections: [ + { + kind: "Linked", + fieldName: "checkin", + arguments: null, + concreteType: null, + selections: [ + { + kind: "InlineFragment", + type: "Checkin", + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "location", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "time", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + ], +}; const artifact: RefetchQueryNormalizationArtifact = { kind: "RefetchQuery", networkRequestInfo: { diff --git a/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__4.ts b/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__4.ts index 0dd86e03..41f1ffe9 100644 --- a/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__4.ts +++ b/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/__refetch__4.ts @@ -12,59 +12,62 @@ const queryText = 'query Query__refetch_pet_stats ($id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "pet", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, - ], - ], - concreteType: "Pet", - selections: [ - { - kind: "Linked", - fieldName: "stats", - arguments: null, - concreteType: "PetStats", - selections: [ - { - kind: "Scalar", - fieldName: "cuteness", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "energy", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "hunger", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "intelligence", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "sociability", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "weight", - arguments: null, - }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "pet", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, ], - }, - ], - }, -]; + ], + concreteType: "Pet", + selections: [ + { + kind: "Linked", + fieldName: "stats", + arguments: null, + concreteType: "PetStats", + selections: [ + { + kind: "Scalar", + fieldName: "cuteness", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "energy", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "hunger", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "intelligence", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "sociability", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "weight", + arguments: null, + }, + ], + }, + ], + }, + ], +}; const artifact: RefetchQueryNormalizationArtifact = { kind: "RefetchQuery", networkRequestInfo: { diff --git a/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/entrypoint.ts b/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/entrypoint.ts index d61e7803..575e34a1 100644 --- a/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/entrypoint.ts +++ b/demos/pet-demo/src/components/__isograph/Query/PetDetailRoute/entrypoint.ts @@ -51,176 +51,179 @@ const queryText = 'query PetDetailRoute ($id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "pet", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, - ], - ], - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "age", - arguments: null, - }, - { - kind: "Linked", - fieldName: "best_friend_relationship", - arguments: null, - concreteType: "BestFriendRelationship", - selections: [ - { - kind: "Linked", - fieldName: "best_friend", - arguments: null, - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "picture", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "picture_together", - arguments: null, - }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "pet", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, ], - }, - { - kind: "Linked", - fieldName: "checkins", - arguments: [ - [ - "skip", - { kind: "Literal", value: null }, + ], + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "age", + arguments: null, + }, + { + kind: "Linked", + fieldName: "best_friend_relationship", + arguments: null, + concreteType: "BestFriendRelationship", + selections: [ + { + kind: "Linked", + fieldName: "best_friend", + arguments: null, + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "picture", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "picture_together", + arguments: null, + }, ], + }, + { + kind: "Linked", + fieldName: "checkins", + arguments: [ + [ + "skip", + { kind: "Literal", value: null }, + ], - [ - "limit", - { kind: "Literal", value: null }, + [ + "limit", + { kind: "Literal", value: null }, + ], ], - ], - concreteType: "Checkin", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "location", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "time", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "favorite_phrase", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "nickname", - arguments: null, - }, - { - kind: "Linked", - fieldName: "potential_new_best_friends", - arguments: null, - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - ], - }, - { - kind: "Linked", - fieldName: "stats", - arguments: null, - concreteType: "PetStats", - selections: [ - { - kind: "Scalar", - fieldName: "cuteness", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "energy", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "hunger", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "intelligence", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "sociability", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "weight", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "tagline", - arguments: null, - }, - ], - }, -]; + concreteType: "Checkin", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "location", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "time", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "favorite_phrase", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "nickname", + arguments: null, + }, + { + kind: "Linked", + fieldName: "potential_new_best_friends", + arguments: null, + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + ], + }, + { + kind: "Linked", + fieldName: "stats", + arguments: null, + concreteType: "PetStats", + selections: [ + { + kind: "Scalar", + fieldName: "cuteness", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "energy", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "hunger", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "intelligence", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "sociability", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "weight", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "tagline", + arguments: null, + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__PetDetailRoute__param, Query__PetDetailRoute__output_type diff --git a/demos/pet-demo/src/components/__isograph/Query/PetFavoritePhrase/entrypoint.ts b/demos/pet-demo/src/components/__isograph/Query/PetFavoritePhrase/entrypoint.ts index 4aee60bb..7590f788 100644 --- a/demos/pet-demo/src/components/__isograph/Query/PetFavoritePhrase/entrypoint.ts +++ b/demos/pet-demo/src/components/__isograph/Query/PetFavoritePhrase/entrypoint.ts @@ -12,36 +12,39 @@ const queryText = 'query PetFavoritePhrase ($id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "pet", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "pet", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, + ], ], - ], - concreteType: "Pet", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "favorite_phrase", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - ], - }, -]; + concreteType: "Pet", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "favorite_phrase", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__PetFavoritePhrase__param, Query__PetFavoritePhrase__output_type diff --git a/demos/pet-demo/src/components/__isograph/Viewer/NewsfeedPaginationComponent/entrypoint.ts b/demos/pet-demo/src/components/__isograph/Viewer/NewsfeedPaginationComponent/entrypoint.ts index c5d2f1aa..fd8db833 100644 --- a/demos/pet-demo/src/components/__isograph/Viewer/NewsfeedPaginationComponent/entrypoint.ts +++ b/demos/pet-demo/src/components/__isograph/Viewer/NewsfeedPaginationComponent/entrypoint.ts @@ -30,120 +30,123 @@ const queryText = 'query NewsfeedPaginationComponent ($skip: Int!, $limit: Int!, },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "node", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, + ], ], - ], - concreteType: null, - selections: [ - { - kind: "InlineFragment", - type: "Viewer", - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Linked", - fieldName: "newsfeed", - arguments: [ - [ - "skip", - { kind: "Variable", name: "skip" }, - ], - - [ - "limit", - { kind: "Variable", name: "limit" }, - ], - ], - concreteType: null, - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "InlineFragment", - type: "AdItem", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, + concreteType: null, + selections: [ + { + kind: "InlineFragment", + type: "Viewer", + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Linked", + fieldName: "newsfeed", + arguments: [ + [ + "skip", + { kind: "Variable", name: "skip" }, ], - }, - { - kind: "InlineFragment", - type: "BlogItem", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "author", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "content", - arguments: null, - }, - { - kind: "Linked", - fieldName: "image", - arguments: null, - concreteType: "Image", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - ], - }, - { - kind: "Scalar", - fieldName: "title", - arguments: null, - }, + + [ + "limit", + { kind: "Variable", name: "limit" }, ], - }, - ], - }, - ], - }, - ], - }, -]; + ], + concreteType: null, + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "InlineFragment", + type: "AdItem", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + ], + }, + { + kind: "InlineFragment", + type: "BlogItem", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "author", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "content", + arguments: null, + }, + { + kind: "Linked", + fieldName: "image", + arguments: null, + concreteType: "Image", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + ], + }, + { + kind: "Scalar", + fieldName: "title", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Viewer__NewsfeedPaginationComponent__param, Viewer__NewsfeedPaginationComponent__output_type diff --git a/demos/vite-demo/src/components/__isograph/Query/HomePage/entrypoint.ts b/demos/vite-demo/src/components/__isograph/Query/HomePage/entrypoint.ts index 7667834a..0c8065a5 100644 --- a/demos/vite-demo/src/components/__isograph/Query/HomePage/entrypoint.ts +++ b/demos/vite-demo/src/components/__isograph/Query/HomePage/entrypoint.ts @@ -15,56 +15,59 @@ const queryText = 'query HomePage {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "getAllPokemon", - arguments: [ - [ - "take", - { kind: "Literal", value: 232 }, - ], +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "getAllPokemon", + arguments: [ + [ + "take", + { kind: "Literal", value: 232 }, + ], - [ - "offset", - { kind: "Literal", value: 93 }, + [ + "offset", + { kind: "Literal", value: 93 }, + ], ], - ], - concreteType: "Pokemon", - selections: [ - { - kind: "Scalar", - fieldName: "bulbapediaPage", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "forme", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "key", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "num", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "species", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "sprite", - arguments: null, - }, - ], - }, -]; + concreteType: "Pokemon", + selections: [ + { + kind: "Scalar", + fieldName: "bulbapediaPage", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "forme", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "key", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "num", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "species", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "sprite", + arguments: null, + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__HomePage__param, Query__HomePage__output_type diff --git a/libs/isograph-react/src/core/entrypoint.ts b/libs/isograph-react/src/core/entrypoint.ts index cb105220..96e98815 100644 --- a/libs/isograph-react/src/core/entrypoint.ts +++ b/libs/isograph-react/src/core/entrypoint.ts @@ -56,7 +56,7 @@ export type NormalizationAstNodes = ReadonlyArray; export type NormalizationAst = { kind: 'NormalizationAst'; - normalizationAst: NormalizationAstNodes; + selections: NormalizationAstNodes; }; export type NormalizationScalarField = { diff --git a/libs/isograph-react/src/core/makeNetworkRequest.ts b/libs/isograph-react/src/core/makeNetworkRequest.ts index a3e971e7..fa6529e0 100644 --- a/libs/isograph-react/src/core/makeNetworkRequest.ts +++ b/libs/isograph-react/src/core/makeNetworkRequest.ts @@ -46,7 +46,7 @@ export function maybeMakeNetworkRequest< case 'IfNecessary': { const result = check( environment, - artifact.networkRequestInfo.normalizationAst.normalizationAst, + artifact.networkRequestInfo.normalizationAst.selections, variables, { __link: ROOT_ID, @@ -116,7 +116,7 @@ export function makeNetworkRequest< if (status.kind === 'UndisposedIncomplete') { normalizeData( environment, - artifact.networkRequestInfo.normalizationAst.normalizationAst, + artifact.networkRequestInfo.normalizationAst.selections, networkResponse.data ?? {}, variables, artifact.kind === 'Entrypoint' @@ -125,7 +125,7 @@ export function makeNetworkRequest< root, ); const retainedQuery = { - normalizationAst: artifact.networkRequestInfo.normalizationAst.normalizationAst, + normalizationAst: artifact.networkRequestInfo.normalizationAst.selections, variables, root, }; diff --git a/libs/isograph-react/src/tests/__isograph/Query/meName/entrypoint.ts b/libs/isograph-react/src/tests/__isograph/Query/meName/entrypoint.ts index 81294fca..deea61e3 100644 --- a/libs/isograph-react/src/tests/__isograph/Query/meName/entrypoint.ts +++ b/libs/isograph-react/src/tests/__isograph/Query/meName/entrypoint.ts @@ -11,26 +11,29 @@ const queryText = 'query meName {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "me", - arguments: null, - concreteType: "Economist", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - ], - }, -]; +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "me", + arguments: null, + concreteType: "Economist", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__meName__param, Query__meName__output_type diff --git a/libs/isograph-react/src/tests/__isograph/Query/meNameSuccessor/entrypoint.ts b/libs/isograph-react/src/tests/__isograph/Query/meNameSuccessor/entrypoint.ts index c1262b19..a2e836a5 100644 --- a/libs/isograph-react/src/tests/__isograph/Query/meNameSuccessor/entrypoint.ts +++ b/libs/isograph-react/src/tests/__isograph/Query/meNameSuccessor/entrypoint.ts @@ -18,57 +18,60 @@ const queryText = 'query meNameSuccessor {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "me", - arguments: null, - concreteType: "Economist", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - { - kind: "Linked", - fieldName: "successor", - arguments: null, - concreteType: "Economist", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Linked", - fieldName: "successor", - arguments: null, - concreteType: "Economist", - selections: [ - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "name", - arguments: null, - }, - ], - }, - ], - }, - ], - }, -]; +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "me", + arguments: null, + concreteType: "Economist", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + { + kind: "Linked", + fieldName: "successor", + arguments: null, + concreteType: "Economist", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Linked", + fieldName: "successor", + arguments: null, + concreteType: "Economist", + selections: [ + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "name", + arguments: null, + }, + ], + }, + ], + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__meNameSuccessor__param, Query__meNameSuccessor__output_type diff --git a/libs/isograph-react/src/tests/__isograph/Query/nodeField/entrypoint.ts b/libs/isograph-react/src/tests/__isograph/Query/nodeField/entrypoint.ts index 083b2d32..c012c1a0 100644 --- a/libs/isograph-react/src/tests/__isograph/Query/nodeField/entrypoint.ts +++ b/libs/isograph-react/src/tests/__isograph/Query/nodeField/entrypoint.ts @@ -11,31 +11,34 @@ const queryText = 'query nodeField ($id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "node", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, + ], ], - ], - concreteType: null, - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - ], - }, -]; + concreteType: null, + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__nodeField__param, Query__nodeField__output_type diff --git a/libs/isograph-react/src/tests/__isograph/Query/subquery/entrypoint.ts b/libs/isograph-react/src/tests/__isograph/Query/subquery/entrypoint.ts index e22e746b..fceffcb0 100644 --- a/libs/isograph-react/src/tests/__isograph/Query/subquery/entrypoint.ts +++ b/libs/isograph-react/src/tests/__isograph/Query/subquery/entrypoint.ts @@ -13,39 +13,42 @@ const queryText = 'query subquery ($id: ID!) {\ },\ }'; -const normalizationAst: NormalizationAst = [ - { - kind: "Linked", - fieldName: "query", - arguments: null, - concreteType: "Query", - selections: [ - { - kind: "Linked", - fieldName: "node", - arguments: [ - [ - "id", - { kind: "Variable", name: "id" }, +const normalizationAst: NormalizationAst = { + kind: "NormalizationAst", + selections: [ + { + kind: "Linked", + fieldName: "query", + arguments: null, + concreteType: "Query", + selections: [ + { + kind: "Linked", + fieldName: "node", + arguments: [ + [ + "id", + { kind: "Variable", name: "id" }, + ], ], - ], - concreteType: null, - selections: [ - { - kind: "Scalar", - fieldName: "__typename", - arguments: null, - }, - { - kind: "Scalar", - fieldName: "id", - arguments: null, - }, - ], - }, - ], - }, -]; + concreteType: null, + selections: [ + { + kind: "Scalar", + fieldName: "__typename", + arguments: null, + }, + { + kind: "Scalar", + fieldName: "id", + arguments: null, + }, + ], + }, + ], + }, + ], +}; const artifact: IsographEntrypoint< Query__subquery__param, Query__subquery__output_type From 97dd1c58ac8eac266a6fbf564c352d659a8426a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Wa=C5=82ach?= <35966385+PatrykWalach@users.noreply.github.com> Date: Thu, 26 Dec 2024 16:40:52 +0100 Subject: [PATCH 3/4] format --- libs/isograph-react/src/core/entrypoint.ts | 2 +- libs/isograph-react/src/core/makeNetworkRequest.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/isograph-react/src/core/entrypoint.ts b/libs/isograph-react/src/core/entrypoint.ts index 96e98815..a935ef0d 100644 --- a/libs/isograph-react/src/core/entrypoint.ts +++ b/libs/isograph-react/src/core/entrypoint.ts @@ -25,7 +25,7 @@ export type NetworkRequestInfo = { export type IsographEntrypoint< TReadFromStore extends { parameters: object; data: object }, TClientFieldValue, - TNormalizationAst = NormalizationAst + TNormalizationAst = NormalizationAst, > = { readonly kind: 'Entrypoint'; readonly networkRequestInfo: NetworkRequestInfo; diff --git a/libs/isograph-react/src/core/makeNetworkRequest.ts b/libs/isograph-react/src/core/makeNetworkRequest.ts index fa6529e0..b29cd68e 100644 --- a/libs/isograph-react/src/core/makeNetworkRequest.ts +++ b/libs/isograph-react/src/core/makeNetworkRequest.ts @@ -125,7 +125,8 @@ export function makeNetworkRequest< root, ); const retainedQuery = { - normalizationAst: artifact.networkRequestInfo.normalizationAst.selections, + normalizationAst: + artifact.networkRequestInfo.normalizationAst.selections, variables, root, }; From 96bef8c7f5d519673eb520222a83760d713ecfbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Wa=C5=82ach?= <35966385+PatrykWalach@users.noreply.github.com> Date: Thu, 26 Dec 2024 16:43:19 +0100 Subject: [PATCH 4/4] fix tests --- libs/isograph-react/src/tests/garbageCollection.test.ts | 3 ++- libs/isograph-react/src/tests/meNameSuccessor.ts | 2 +- libs/isograph-react/src/tests/nodeQuery.ts | 3 ++- libs/isograph-react/src/tests/normalizeData.test.ts | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/isograph-react/src/tests/garbageCollection.test.ts b/libs/isograph-react/src/tests/garbageCollection.test.ts index ba6e9cfd..25310bde 100644 --- a/libs/isograph-react/src/tests/garbageCollection.test.ts +++ b/libs/isograph-react/src/tests/garbageCollection.test.ts @@ -55,7 +55,8 @@ export const meNameField = iso(` import { meNameSuccessorRetainedQuery } from './meNameSuccessor'; const meNameEntrypoint = iso(`entrypoint Query.meName`); const meNameRetainedQuery = { - normalizationAst: meNameEntrypoint.networkRequestInfo.normalizationAst, + normalizationAst: + meNameEntrypoint.networkRequestInfo.normalizationAst.selections, variables: {}, root: { __link: ROOT_ID, __typename: 'Query' }, }; diff --git a/libs/isograph-react/src/tests/meNameSuccessor.ts b/libs/isograph-react/src/tests/meNameSuccessor.ts index b3267816..c32290f6 100644 --- a/libs/isograph-react/src/tests/meNameSuccessor.ts +++ b/libs/isograph-react/src/tests/meNameSuccessor.ts @@ -16,7 +16,7 @@ export const meNameField = iso(` const meNameSuccessorEntrypoint = iso(`entrypoint Query.meNameSuccessor`); export const meNameSuccessorRetainedQuery = { normalizationAst: - meNameSuccessorEntrypoint.networkRequestInfo.normalizationAst, + meNameSuccessorEntrypoint.networkRequestInfo.normalizationAst.selections, variables: {}, root: { __link: ROOT_ID, diff --git a/libs/isograph-react/src/tests/nodeQuery.ts b/libs/isograph-react/src/tests/nodeQuery.ts index 0dd93b52..c3e362a0 100644 --- a/libs/isograph-react/src/tests/nodeQuery.ts +++ b/libs/isograph-react/src/tests/nodeQuery.ts @@ -13,7 +13,8 @@ export const nodeField = iso(` `)(() => {}); const nodeFieldEntrypoint = iso(`entrypoint Query.nodeField`); export const nodeFieldRetainedQuery: RetainedQuery = { - normalizationAst: nodeFieldEntrypoint.networkRequestInfo.normalizationAst, + normalizationAst: + nodeFieldEntrypoint.networkRequestInfo.normalizationAst.selections, variables: { id: 0 }, root: { __link: ROOT_ID, __typename: 'Query' }, }; diff --git a/libs/isograph-react/src/tests/normalizeData.test.ts b/libs/isograph-react/src/tests/normalizeData.test.ts index 7e7a846d..b323fcf3 100644 --- a/libs/isograph-react/src/tests/normalizeData.test.ts +++ b/libs/isograph-react/src/tests/normalizeData.test.ts @@ -35,7 +35,7 @@ describe('normalizeData', () => { normalizeData( environment, - entrypoint.networkRequestInfo.normalizationAst, + entrypoint.networkRequestInfo.normalizationAst.selections, { query: { node____id___v_id: { __typename: 'Economist', id: '1' } }, },