From 20626f2c85019ac2240b33ba68df15088d4d0473 Mon Sep 17 00:00:00 2001 From: Robert Balicki Date: Fri, 3 Jun 2022 14:51:58 -0700 Subject: [PATCH] Make __typename selections within concrete linked fields have a string literal flowtype Summary: # What and why * Currently, a selection like `foo { __typename }` will generate a type of `__typename: string`. We have never had a need to generate a more accurate type, hence we generate `string` instead of a string literal for the value of `__typename`. * However, this is problematic for typesafe updaters! This requires assignments of `foo` to be validated, **even though we known statically that the validation can never fail**. * With this change, assigning an array of linked fields is modified as follows: ``` const data = useFragment(graphql`fragment SourceFragment on User { best_friends(count: 5) required(action: THROW) { ...Assignable_user } }`, userRef); const env = useRelayEnvironment(); const onClick = () => { env.commitUpdate(store => { const {updatableData} = store.readUpdatableQuery(graphql` query Updatable_best_friends updatable { best_friends { ...Assignable_user } } `, {}); // WE CAN REPLACE THIS const validateUser = require('SourceFragment').validate; const validBestFriends = data.best_friends.flatMap(bestFriend => { const validBestFriend = validateUser(bestFriend); if (validBestFriend !== false) { return [validBestFriend]; } else { // this case never occurs! return []; } }); updatableData.best_friends = validBestFriends; // WITH THIS updatableData.best_friends = data.best_friends }); } ``` # How Pass around a `enclosing_concrete_linked_field_type: Option` through the codegen. Whenever we visit a linked field, we potentially pass `Some(linked_field_type)`. When we process a scalar field, if that parameter is Some, then we generate an AST with the StringLiteral of tha type. # Rollout This needs to rollout with a rollout. Once this diff is approved, I'll put a rollout in. Reviewed By: alunyov Differential Revision: D36357062 fbshipit-source-id: e06d076e6395183eb7872e47962c81e6cd4db475 --- .../src/file_source/file_categorizer.rs | 15 ++ ...agment-with-connection-es-modules.expected | 3 + ...ragment-with-connection-es-modules.graphql | 3 + .../crates/relay-config/src/typegen_config.rs | 4 + compiler/crates/relay-typegen/src/visit.rs | 153 +++++++++++++----- compiler/crates/relay-typegen/src/write.rs | 4 + ...inationContainerFlowtest_viewer.graphql.js | 4 +- ...RefetchContainerFlowtest_viewer.graphql.js | 4 +- .../ActorChangeTestMutation.graphql.js | 4 +- ...eryEXPERIMENTALTestRegularQuery.graphql.js | 4 +- ...yEXPERIMENTALTestUpdatableQuery.graphql.js | 4 +- ...InlineFragmentAbstractTypeQuery.graphql.js | 4 +- ...ativeMutationTestFeedback2Query.graphql.js | 6 +- ...ativeMutationTestFeedback3Query.graphql.js | 4 +- ...StreamedConnectionTestFeedQuery.graphql.js | 4 +- ...odernEnvironmentLookupTestQuery.graphql.js | 6 +- ...tionTrackerTestFeedbackFragment.graphql.js | 4 +- ...ayOperationTrackerTest1Mutation.graphql.js | 4 +- ...ayOperationTrackerTest2Mutation.graphql.js | 4 +- .../RelayReaderResolverTest24Query.graphql.js | 4 +- ...ayResponseNormalizerTest15Query.graphql.js | 4 +- ...eryAllAstrologicalSignsResolver.graphql.js | 4 +- .../ResolverTest3Query.graphql.js | 4 +- ...ckPayloadGeneratorTest3Fragment.graphql.js | 4 +- 24 files changed, 183 insertions(+), 75 deletions(-) diff --git a/compiler/crates/relay-compiler/src/file_source/file_categorizer.rs b/compiler/crates/relay-compiler/src/file_source/file_categorizer.rs index 3dd9561f1e9e4..3950466fa942a 100644 --- a/compiler/crates/relay-compiler/src/file_source/file_categorizer.rs +++ b/compiler/crates/relay-compiler/src/file_source/file_categorizer.rs @@ -374,23 +374,38 @@ mod tests { }, "projects": { "public": { + "preciseTypenameTypesWithinLinkedFields": { + "kind": "enabled" + }, "schema": "graphql/public.graphql", "language": "flow" }, "internal": { + "preciseTypenameTypesWithinLinkedFields": { + "kind": "enabled" + }, "schema": "graphql/__generated__/internal.graphql", "language": "flow" }, "with_custom_generated_dir": { + "preciseTypenameTypesWithinLinkedFields": { + "kind": "enabled" + }, "schema": "graphql/__generated__/custom.graphql", "output": "graphql/custom-generated", "language": "flow" }, "typescript": { + "preciseTypenameTypesWithinLinkedFields": { + "kind": "enabled" + }, "schema": "graphql/ts_schema.graphql", "language": "typescript" }, "overlapping_generated_dir": { + "preciseTypenameTypesWithinLinkedFields": { + "kind": "enabled" + }, "schema": "graphql/__generated__/custom.graphql", "language": "flow" } diff --git a/compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/refetchable-fragment-with-connection-es-modules.expected b/compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/refetchable-fragment-with-connection-es-modules.expected index 350fa9d5132e3..9323b663e3c97 100644 --- a/compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/refetchable-fragment-with-connection-es-modules.expected +++ b/compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/refetchable-fragment-with-connection-es-modules.expected @@ -21,6 +21,9 @@ fragment refetchableFragmentWithConnectionEsModules_PaginationFragment on Node %project_config% { + "preciseTypenameTypesWithinLinkedFields": { + "kind": "enabled" + }, "eagerEsModules": true, "language": "flow" } diff --git a/compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/refetchable-fragment-with-connection-es-modules.graphql b/compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/refetchable-fragment-with-connection-es-modules.graphql index 1884b68042ebe..8a65c5cb9c415 100644 --- a/compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/refetchable-fragment-with-connection-es-modules.graphql +++ b/compiler/crates/relay-compiler/tests/compile_relay_artifacts/fixtures/refetchable-fragment-with-connection-es-modules.graphql @@ -20,6 +20,9 @@ fragment refetchableFragmentWithConnectionEsModules_PaginationFragment on Node %project_config% { + "preciseTypenameTypesWithinLinkedFields": { + "kind": "enabled" + }, "eagerEsModules": true, "language": "flow" } diff --git a/compiler/crates/relay-config/src/typegen_config.rs b/compiler/crates/relay-config/src/typegen_config.rs index 437d81f38b470..f679aa709719f 100644 --- a/compiler/crates/relay-config/src/typegen_config.rs +++ b/compiler/crates/relay-config/src/typegen_config.rs @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +use common::FeatureFlag; use fnv::FnvBuildHasher; use indexmap::IndexMap; use intern::string_key::StringKey; @@ -87,6 +88,9 @@ pub struct TypegenConfig { #[serde(default)] pub use_import_type_syntax: bool, + /// This feature is used to rollout precise __typename type generation. + pub precise_typename_types_within_linked_fields: FeatureFlag, + /// A map from GraphQL scalar types to a custom JS type, example: /// { "Url": "String" } /// { "Url": {"name:: "MyURL", "path": "../src/MyUrlTypes"} } diff --git a/compiler/crates/relay-typegen/src/visit.rs b/compiler/crates/relay-typegen/src/visit.rs index 6493cfc35600c..b77800e179e07 100644 --- a/compiler/crates/relay-typegen/src/visit.rs +++ b/compiler/crates/relay-typegen/src/visit.rs @@ -54,6 +54,7 @@ pub(crate) fn visit_selections( imported_resolvers: &mut ImportedResolvers, actor_change_status: &mut ActorChangeStatus, custom_scalars: &mut CustomScalarsImports, + enclosing_linked_field_concrete_type: Option, ) -> Vec { let mut type_selections = Vec::new(); for selection in selections { @@ -74,29 +75,45 @@ pub(crate) fn visit_selections( imported_resolvers, actor_change_status, custom_scalars, + enclosing_linked_field_concrete_type, ), - Selection::LinkedField(linked_field) => gen_visit_linked_field( - typegen_context.schema, - &mut type_selections, - linked_field, - |selections| { - visit_selections( - typegen_context, - selections, - encountered_enums, - encountered_fragments, - imported_resolvers, - actor_change_status, - custom_scalars, - ) - }, - ), + Selection::LinkedField(linked_field) => { + let linked_field_type = typegen_context + .schema + .field(linked_field.definition.item) + .type_ + .inner(); + let nested_enclosing_linked_field_concrete_type = + if linked_field_type.is_abstract_type() { + None + } else { + Some(linked_field_type) + }; + gen_visit_linked_field( + typegen_context.schema, + &mut type_selections, + linked_field, + |selections| { + visit_selections( + typegen_context, + selections, + encountered_enums, + encountered_fragments, + imported_resolvers, + actor_change_status, + custom_scalars, + nested_enclosing_linked_field_concrete_type, + ) + }, + ) + } Selection::ScalarField(scalar_field) => visit_scalar_field( typegen_context, &mut type_selections, scalar_field, encountered_enums, custom_scalars, + enclosing_linked_field_concrete_type, ), Selection::Condition(condition) => visit_condition( typegen_context, @@ -107,6 +124,7 @@ pub(crate) fn visit_selections( imported_resolvers, actor_change_status, custom_scalars, + enclosing_linked_field_concrete_type, ), } } @@ -224,6 +242,7 @@ fn visit_inline_fragment( imported_resolvers: &mut ImportedResolvers, actor_change_status: &mut ActorChangeStatus, custom_scalars: &mut CustomScalarsImports, + enclosing_linked_field_concrete_type: Option, ) { if let Some(module_metadata) = ModuleMetadata::find(&inline_fragment.directives) { let name = module_metadata.fragment_name; @@ -261,6 +280,7 @@ fn visit_inline_fragment( imported_resolvers, actor_change_status, custom_scalars, + enclosing_linked_field_concrete_type, ); } else { let mut inline_selections = visit_selections( @@ -271,6 +291,7 @@ fn visit_inline_fragment( imported_resolvers, actor_change_status, custom_scalars, + enclosing_linked_field_concrete_type, ); let mut selections = if let Some(fragment_alias_metadata) = @@ -329,6 +350,7 @@ fn visit_actor_change( imported_resolvers: &mut ImportedResolvers, actor_change_status: &mut ActorChangeStatus, custom_scalars: &mut CustomScalarsImports, + enclosing_linked_field_concrete_type: Option, ) { let linked_field = match &inline_fragment.selections[0] { Selection::LinkedField(linked_field) => linked_field, @@ -354,6 +376,7 @@ fn visit_actor_change( imported_resolvers, actor_change_status, custom_scalars, + enclosing_linked_field_concrete_type, ); type_selections.push(TypeSelection::ScalarField(TypeSelectionScalarField { field_name_or_alias: key, @@ -388,6 +411,7 @@ fn raw_response_visit_inline_fragment( imported_raw_response_types: &mut ImportedRawResponseTypes, runtime_imports: &mut RuntimeImports, custom_scalars: &mut CustomScalarsImports, + enclosing_linked_field_concrete_type: Option, ) { let mut selections = raw_response_visit_selections( typegen_context, @@ -398,6 +422,7 @@ fn raw_response_visit_inline_fragment( imported_raw_response_types, runtime_imports, custom_scalars, + enclosing_linked_field_concrete_type, ); if inline_fragment .directives @@ -475,6 +500,7 @@ fn visit_scalar_field( scalar_field: &ScalarField, encountered_enums: &mut EncounteredEnums, custom_scalars: &mut CustomScalarsImports, + enclosing_linked_field_concrete_type: Option, ) { let field = typegen_context.schema.field(scalar_field.definition.item); let schema_name = field.name.item; @@ -484,12 +510,45 @@ fn visit_scalar_field( schema_name }; let field_type = apply_required_directive_nullability(&field.type_, &scalar_field.directives); + let special_field = ScalarFieldSpecialSchemaField::from_schema_name( + schema_name, + &typegen_context.project_config.schema_config, + ); + + if typegen_context + .project_config + .typegen_config + .precise_typename_types_within_linked_fields + .is_enabled_for(typegen_context.definition_source_location.item) + && matches!(special_field, Some(ScalarFieldSpecialSchemaField::TypeName)) + { + if let Some(concrete_type) = enclosing_linked_field_concrete_type { + // If we are creating a typename selection within a linked field with a concrete type, we generate + // the type e.g. "User", i.e. the concrete string name of the concrete type. + // + // This cannot be done within abstract fields and at the top level (even in fragments), because + // we have the following type hole. With `node { ...Fragment_user }`, `Fragment_user` can be + // unconditionally read out, without checking whether the `node` field actually has a matching + // type at runtime. + // + // Note that passing concrete_type: enclosing_linked_field_concrete_type here has the effect + // of making the emitted fields left-hand-optional, causing the compiler to panic (because + // within updatable fragments/queries, we expect never to generate an optional type.) + return type_selections.push(TypeSelection::ScalarField(TypeSelectionScalarField { + field_name_or_alias: key, + special_field, + value: AST::StringLiteral(StringLiteral( + typegen_context.schema.get_type_name(concrete_type), + )), + conditional: false, + concrete_type: None, + })); + } + } + type_selections.push(TypeSelection::ScalarField(TypeSelectionScalarField { field_name_or_alias: key, - special_field: ScalarFieldSpecialSchemaField::from_schema_name( - schema_name, - &typegen_context.project_config.schema_config, - ), + special_field, value: transform_scalar_type( typegen_context, &field_type, @@ -512,6 +571,7 @@ fn visit_condition( imported_resolvers: &mut ImportedResolvers, actor_change_status: &mut ActorChangeStatus, custom_scalars: &mut CustomScalarsImports, + enclosing_linked_field_concrete_type: Option, ) { let mut selections = visit_selections( typegen_context, @@ -521,6 +581,7 @@ fn visit_condition( imported_resolvers, actor_change_status, custom_scalars, + enclosing_linked_field_concrete_type, ); for selection in selections.iter_mut() { selection.set_conditional(true); @@ -1312,6 +1373,7 @@ pub(crate) fn raw_response_visit_selections( imported_raw_response_types: &mut ImportedRawResponseTypes, runtime_imports: &mut RuntimeImports, custom_scalars: &mut CustomScalarsImports, + enclosing_linked_field_concrete_type: Option, ) -> Vec { let mut type_selections = Vec::new(); for selection in selections { @@ -1341,30 +1403,46 @@ pub(crate) fn raw_response_visit_selections( imported_raw_response_types, runtime_imports, custom_scalars, + enclosing_linked_field_concrete_type, ), - Selection::LinkedField(linked_field) => gen_visit_linked_field( - typegen_context.schema, - &mut type_selections, - linked_field, - |selections| { - raw_response_visit_selections( - typegen_context, - selections, - encountered_enums, - match_fields, - encountered_fragments, - imported_raw_response_types, - runtime_imports, - custom_scalars, - ) - }, - ), + Selection::LinkedField(linked_field) => { + let linked_field_type = typegen_context + .schema + .field(linked_field.definition.item) + .type_ + .inner(); + let nested_enclosing_linked_field_concrete_type = + if linked_field_type.is_abstract_type() { + None + } else { + Some(linked_field_type) + }; + gen_visit_linked_field( + typegen_context.schema, + &mut type_selections, + linked_field, + |selections| { + raw_response_visit_selections( + typegen_context, + selections, + encountered_enums, + match_fields, + encountered_fragments, + imported_raw_response_types, + runtime_imports, + custom_scalars, + nested_enclosing_linked_field_concrete_type, + ) + }, + ) + } Selection::ScalarField(scalar_field) => visit_scalar_field( typegen_context, &mut type_selections, scalar_field, encountered_enums, custom_scalars, + enclosing_linked_field_concrete_type, ), Selection::Condition(condition) => { type_selections.extend(raw_response_visit_selections( @@ -1376,6 +1454,7 @@ pub(crate) fn raw_response_visit_selections( imported_raw_response_types, runtime_imports, custom_scalars, + enclosing_linked_field_concrete_type, )); } } diff --git a/compiler/crates/relay-typegen/src/write.rs b/compiler/crates/relay-typegen/src/write.rs index d326ea74ca5ed..005546a7ba5a3 100644 --- a/compiler/crates/relay-typegen/src/write.rs +++ b/compiler/crates/relay-typegen/src/write.rs @@ -64,6 +64,7 @@ pub(crate) fn write_operation_type_exports_section( &mut imported_resolvers, &mut actor_change_status, &mut custom_scalars, + None, ); let mut imported_raw_response_types = Default::default(); @@ -94,6 +95,7 @@ pub(crate) fn write_operation_type_exports_section( &mut imported_raw_response_types, &mut runtime_imports, &mut custom_scalars, + None, ); Some(( raw_response_selections_to_babel( @@ -229,6 +231,7 @@ pub(crate) fn write_split_operation_type_exports_section( &mut imported_raw_response_types, &mut runtime_imports, &mut custom_scalars, + None, ); let raw_response_type = raw_response_selections_to_babel( typgen_context, @@ -279,6 +282,7 @@ pub(crate) fn write_fragment_type_exports_section( &mut imported_resolvers, &mut actor_change_status, &mut custom_scalars, + None, ); if !fragment_definition.type_condition.is_abstract_type() { let num_concrete_selections = type_selections diff --git a/packages/react-relay/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js b/packages/react-relay/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js index df7f06b3d2ce2..e6cad70d63d7a 100644 --- a/packages/react-relay/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js +++ b/packages/react-relay/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<7c59a604c19417e5b353d555c50639b9>> + * @generated SignedSource<> * @flow * @lightSyntaxTransform * @nogrep @@ -23,7 +23,7 @@ export type ReactRelayPaginationContainerFlowtest_viewer$data = {| +friends: ?{| +edges: ?$ReadOnlyArray, |}, diff --git a/packages/react-relay/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js b/packages/react-relay/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js index 33bb7bfc1566f..f2b2f33d952a6 100644 --- a/packages/react-relay/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js +++ b/packages/react-relay/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<6d04d7f7bf097d5869a1fdf0dea1e659>> * @flow * @lightSyntaxTransform * @nogrep @@ -23,7 +23,7 @@ export type ReactRelayRefetchContainerFlowtest_viewer$data = {| +friends: ?{| +edges: ?$ReadOnlyArray, |}, diff --git a/packages/react-relay/multi-actor/__tests__/__generated__/ActorChangeTestMutation.graphql.js b/packages/react-relay/multi-actor/__tests__/__generated__/ActorChangeTestMutation.graphql.js index 396f973e5d212..e6d07c63af783 100644 --- a/packages/react-relay/multi-actor/__tests__/__generated__/ActorChangeTestMutation.graphql.js +++ b/packages/react-relay/multi-actor/__tests__/__generated__/ActorChangeTestMutation.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<1368ad93306307a1cf613b5a27e29d11>> + * @generated SignedSource<<1fa71075e63b4ef703397e7cd34c59c4>> * @flow * @lightSyntaxTransform * @nogrep @@ -31,7 +31,7 @@ export type ActorChangeTestMutation$variables = {| |}; export type ActorChangeTestMutation$data = {| +commentCreate: ?{| - +__typename: string, + +__typename: "CommentCreateResponsePayload", |}, |}; export type ActorChangeTestMutation = {| diff --git a/packages/relay-runtime/mutations/__tests__/__generated__/readUpdatableQueryEXPERIMENTALTestRegularQuery.graphql.js b/packages/relay-runtime/mutations/__tests__/__generated__/readUpdatableQueryEXPERIMENTALTestRegularQuery.graphql.js index 1074c13e40a0c..424b7e631452f 100644 --- a/packages/relay-runtime/mutations/__tests__/__generated__/readUpdatableQueryEXPERIMENTALTestRegularQuery.graphql.js +++ b/packages/relay-runtime/mutations/__tests__/__generated__/readUpdatableQueryEXPERIMENTALTestRegularQuery.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<1cbd7ade6bcce4248e77df01646af967>> + * @generated SignedSource<<25b5a3e48c8fb3b2cb7c0ada30c4203c>> * @flow * @lightSyntaxTransform * @nogrep @@ -22,7 +22,7 @@ export type readUpdatableQueryEXPERIMENTALTestRegularQuery$variables = {||}; export type readUpdatableQueryEXPERIMENTALTestRegularQuery$data = {| +me: ?{| +__id: string, - +__isreadUpdatableQueryEXPERIMENTALTest_node?: string, + +__isreadUpdatableQueryEXPERIMENTALTest_node?: "User", +author: ?{| +client_best_friend: ?{| +name: ?string, diff --git a/packages/relay-runtime/mutations/__tests__/__generated__/readUpdatableQueryEXPERIMENTALTestUpdatableQuery.graphql.js b/packages/relay-runtime/mutations/__tests__/__generated__/readUpdatableQueryEXPERIMENTALTestUpdatableQuery.graphql.js index 2afe3d28fa43a..b2dd3d19955e0 100644 --- a/packages/relay-runtime/mutations/__tests__/__generated__/readUpdatableQueryEXPERIMENTALTestUpdatableQuery.graphql.js +++ b/packages/relay-runtime/mutations/__tests__/__generated__/readUpdatableQueryEXPERIMENTALTestUpdatableQuery.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<49935802025bd1b1adfb2514b356f970>> * @flow * @lightSyntaxTransform * @nogrep @@ -21,7 +21,7 @@ type readUpdatableQueryEXPERIMENTALTest_user$fragmentType = any; export type readUpdatableQueryEXPERIMENTALTestUpdatableQuery$variables = {||}; export type readUpdatableQueryEXPERIMENTALTestUpdatableQuery$data = {| get me(): ?{| - +__typename: string, + +__typename: "User", +__id: string, +id: string, name: ?string, diff --git a/packages/relay-runtime/store/__tests__/__generated__/RelayExperimentalGraphResponseTransformTestInlineFragmentAbstractTypeQuery.graphql.js b/packages/relay-runtime/store/__tests__/__generated__/RelayExperimentalGraphResponseTransformTestInlineFragmentAbstractTypeQuery.graphql.js index b0c5e3e335f7a..081c59f3ccac2 100644 --- a/packages/relay-runtime/store/__tests__/__generated__/RelayExperimentalGraphResponseTransformTestInlineFragmentAbstractTypeQuery.graphql.js +++ b/packages/relay-runtime/store/__tests__/__generated__/RelayExperimentalGraphResponseTransformTestInlineFragmentAbstractTypeQuery.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<0bb989e10e6b3340a2489294bd4f58b7>> + * @generated SignedSource<<4195c24df962688a655ebf20c36db2d8>> * @flow * @lightSyntaxTransform * @nogrep @@ -20,7 +20,7 @@ export type RelayExperimentalGraphResponseTransformTestInlineFragmentAbstractTyp export type RelayExperimentalGraphResponseTransformTestInlineFragmentAbstractTypeQuery$data = {| +node: ?{| +author?: ?{| - +__typename: string, + +__typename: "User", |}, +name?: ?string, |}, diff --git a/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentExecuteMutationWithDeclarativeMutationTestFeedback2Query.graphql.js b/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentExecuteMutationWithDeclarativeMutationTestFeedback2Query.graphql.js index 7c24518a064bb..09d9839fec58e 100644 --- a/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentExecuteMutationWithDeclarativeMutationTestFeedback2Query.graphql.js +++ b/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentExecuteMutationWithDeclarativeMutationTestFeedback2Query.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<1b921b6df7547efd4ef3135ef82fda4e>> + * @generated SignedSource<<6a2a2db860528c3771c673ec17905c26>> * @flow * @lightSyntaxTransform * @nogrep @@ -24,9 +24,9 @@ export type RelayModernEnvironmentExecuteMutationWithDeclarativeMutationTestFeed +comments: ?{| +__id: string, +edges: ?$ReadOnlyArray, diff --git a/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentExecuteMutationWithDeclarativeMutationTestFeedback3Query.graphql.js b/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentExecuteMutationWithDeclarativeMutationTestFeedback3Query.graphql.js index 3f1ca8be789f3..ea15c3fd8f749 100644 --- a/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentExecuteMutationWithDeclarativeMutationTestFeedback3Query.graphql.js +++ b/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentExecuteMutationWithDeclarativeMutationTestFeedback3Query.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<42ded6de0028876e8626fb9747722146>> * @flow * @lightSyntaxTransform * @nogrep @@ -24,7 +24,7 @@ export type RelayModernEnvironmentExecuteMutationWithDeclarativeMutationTestFeed +comments: ?{| +__id: string, +edges: ?$ReadOnlyArray> + * @generated SignedSource<> * @flow * @lightSyntaxTransform * @nogrep @@ -23,7 +23,7 @@ export type RelayModernEnvironmentExecuteWithDeferredStreamedConnectionTestFeedQ |}; export type RelayModernEnvironmentExecuteWithDeferredStreamedConnectionTestFeedQuery$data = {| +viewer: ?{| - +__typename: string, + +__typename: "Viewer", +$fragmentSpreads: RelayModernEnvironmentExecuteWithDeferredStreamedConnectionTestFeedFragment$fragmentType, |}, |}; diff --git a/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentLookupTestQuery.graphql.js b/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentLookupTestQuery.graphql.js index b0a41dd6fa0ec..76ee2e0a60509 100644 --- a/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentLookupTestQuery.graphql.js +++ b/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentLookupTestQuery.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<96162e83269a33bca7e2abc0d1ddc437>> * @flow * @lightSyntaxTransform * @nogrep @@ -22,7 +22,7 @@ export type RelayModernEnvironmentLookupTestQuery$variables = {| export type RelayModernEnvironmentLookupTestQuery$data = {| +__id: string, +me: ?{| - +__typename: string, + +__typename: "User", +__id: string, +id: string, |}, @@ -33,7 +33,7 @@ export type RelayModernEnvironmentLookupTestQuery$data = {| +__typename: string, +__id: string, +text?: ?{| - +__typename: string, + +__typename: "Text", +__id: string, +text: ?string, |}, diff --git a/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentWithOperationTrackerTestFeedbackFragment.graphql.js b/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentWithOperationTrackerTestFeedbackFragment.graphql.js index 59893f723c689..fcb46853865d9 100644 --- a/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentWithOperationTrackerTestFeedbackFragment.graphql.js +++ b/packages/relay-runtime/store/__tests__/__generated__/RelayModernEnvironmentWithOperationTrackerTestFeedbackFragment.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> * @flow * @lightSyntaxTransform * @nogrep @@ -25,7 +25,7 @@ import type { FragmentType } from "relay-runtime"; declare export opaque type RelayModernEnvironmentWithOperationTrackerTestFeedbackFragment$fragmentType: FragmentType; export type RelayModernEnvironmentWithOperationTrackerTestFeedbackFragment$data = {| +author: ?{| - +__typename: string, + +__typename: "User", +nameRenderer: ?{| +__fragmentPropName?: ?string, +__module_component?: ?string, diff --git a/packages/relay-runtime/store/__tests__/__generated__/RelayOperationTrackerTest1Mutation.graphql.js b/packages/relay-runtime/store/__tests__/__generated__/RelayOperationTrackerTest1Mutation.graphql.js index 9777fd1dd9563..2573f6d2e39e6 100644 --- a/packages/relay-runtime/store/__tests__/__generated__/RelayOperationTrackerTest1Mutation.graphql.js +++ b/packages/relay-runtime/store/__tests__/__generated__/RelayOperationTrackerTest1Mutation.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<915101dbf1215900c857d45d671a1317>> + * @generated SignedSource<> * @flow * @lightSyntaxTransform * @nogrep @@ -31,7 +31,7 @@ export type RelayOperationTrackerTest1Mutation$variables = {| |}; export type RelayOperationTrackerTest1Mutation$data = {| +commentCreate: ?{| - +__typename: string, + +__typename: "CommentCreateResponsePayload", |}, |}; export type RelayOperationTrackerTest1Mutation = {| diff --git a/packages/relay-runtime/store/__tests__/__generated__/RelayOperationTrackerTest2Mutation.graphql.js b/packages/relay-runtime/store/__tests__/__generated__/RelayOperationTrackerTest2Mutation.graphql.js index 98fcb71e0581f..1e39cf1058edc 100644 --- a/packages/relay-runtime/store/__tests__/__generated__/RelayOperationTrackerTest2Mutation.graphql.js +++ b/packages/relay-runtime/store/__tests__/__generated__/RelayOperationTrackerTest2Mutation.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<96a992becd49372f1c88b41b8ee6a0b5>> + * @generated SignedSource<<3a4b6bf961f6858b1e96ad3011fb5e7a>> * @flow * @lightSyntaxTransform * @nogrep @@ -24,7 +24,7 @@ export type RelayOperationTrackerTest2Mutation$variables = {| |}; export type RelayOperationTrackerTest2Mutation$data = {| +commentDelete: ?{| - +__typename: string, + +__typename: "CommentDeleteResponsePayload", |}, |}; export type RelayOperationTrackerTest2Mutation = {| diff --git a/packages/relay-runtime/store/__tests__/__generated__/RelayReaderResolverTest24Query.graphql.js b/packages/relay-runtime/store/__tests__/__generated__/RelayReaderResolverTest24Query.graphql.js index 6f5c77ff6b8ec..a2f878fe0770a 100644 --- a/packages/relay-runtime/store/__tests__/__generated__/RelayReaderResolverTest24Query.graphql.js +++ b/packages/relay-runtime/store/__tests__/__generated__/RelayReaderResolverTest24Query.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<879d6b192baeac75754ee807b0f71f04>> + * @generated SignedSource<<85e299a6abeaad57bcbc308dca453c35>> * @flow * @lightSyntaxTransform * @nogrep @@ -20,7 +20,7 @@ export type RelayReaderResolverTest24Query$variables = {||}; export type RelayReaderResolverTest24Query$data = {| +me: ?{| +client_edge: ?{| - +__typename: string, + +__typename: "User", |}, |}, |}; diff --git a/packages/relay-runtime/store/__tests__/__generated__/RelayResponseNormalizerTest15Query.graphql.js b/packages/relay-runtime/store/__tests__/__generated__/RelayResponseNormalizerTest15Query.graphql.js index 2cdbe79fbfbb7..634f2d5cb4c3d 100644 --- a/packages/relay-runtime/store/__tests__/__generated__/RelayResponseNormalizerTest15Query.graphql.js +++ b/packages/relay-runtime/store/__tests__/__generated__/RelayResponseNormalizerTest15Query.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<274f16de63a33c2ae132d153cba79d46>> + * @generated SignedSource<<3e04fe00d5fcf3fe380b9787d50a3c01>> * @flow * @lightSyntaxTransform * @nogrep @@ -27,7 +27,7 @@ export type RelayResponseNormalizerTest15Query$data = {| +id: string, |}, +author?: ?{| - +__typename: string, + +__typename: "User", +id: string, |}, +id: string, diff --git a/packages/relay-runtime/store/__tests__/resolvers/__generated__/QueryAllAstrologicalSignsResolver.graphql.js b/packages/relay-runtime/store/__tests__/resolvers/__generated__/QueryAllAstrologicalSignsResolver.graphql.js index 80880d15faf7b..361d80d0ca3e9 100644 --- a/packages/relay-runtime/store/__tests__/resolvers/__generated__/QueryAllAstrologicalSignsResolver.graphql.js +++ b/packages/relay-runtime/store/__tests__/resolvers/__generated__/QueryAllAstrologicalSignsResolver.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<8e360dc20ff4755e31c1b41585165d6b>> + * @generated SignedSource<<68d9e3b91517cf2903eff4cdab2e7ac6>> * @flow * @lightSyntaxTransform * @nogrep @@ -20,7 +20,7 @@ import type { FragmentType } from "relay-runtime"; declare export opaque type QueryAllAstrologicalSignsResolver$fragmentType: FragmentType; export type QueryAllAstrologicalSignsResolver$data = {| +me: ?{| - +__typename: string, + +__typename: "User", |}, +$fragmentType: QueryAllAstrologicalSignsResolver$fragmentType, |}; diff --git a/packages/relay-runtime/store/__tests__/resolvers/__generated__/ResolverTest3Query.graphql.js b/packages/relay-runtime/store/__tests__/resolvers/__generated__/ResolverTest3Query.graphql.js index ebb0e32fb0d0f..d2de2947032a3 100644 --- a/packages/relay-runtime/store/__tests__/resolvers/__generated__/ResolverTest3Query.graphql.js +++ b/packages/relay-runtime/store/__tests__/resolvers/__generated__/ResolverTest3Query.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<7deb249c1f48b89d621c20063d73ef87>> + * @generated SignedSource<<57a1a362a54386d52a11c2ed2404a38e>> * @flow * @lightSyntaxTransform * @nogrep @@ -20,7 +20,7 @@ export type ResolverTest3Query$variables = {||}; export type ResolverTest3Query$data = {| +me: ?{| +client_edge: ?{| - +__typename: string, + +__typename: "User", |}, |}, |}; diff --git a/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest3Fragment.graphql.js b/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest3Fragment.graphql.js index bc53d1e338a12..9abf1f89de38f 100644 --- a/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest3Fragment.graphql.js +++ b/packages/relay-test-utils/__tests__/__generated__/RelayMockPayloadGeneratorTest3Fragment.graphql.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<7ce44f936fa3e090ac300fbd76e178ad>> + * @generated SignedSource<<73673d7a5e8544a5571dc18fbe815353>> * @flow * @lightSyntaxTransform * @nogrep @@ -27,7 +27,7 @@ export type RelayMockPayloadGeneratorTest3Fragment$data = {| +author: ?{| +authorID: string, +name?: ?string, - +objectType: string, + +objectType: "User", +username: ?string, |}, +backgroundImage: ?{|