diff --git a/packages/relay-runtime/store/RelayReader.js b/packages/relay-runtime/store/RelayReader.js index 6d2ff9796646b..650c550b153d2 100644 --- a/packages/relay-runtime/store/RelayReader.js +++ b/packages/relay-runtime/store/RelayReader.js @@ -697,7 +697,7 @@ class RelayReader { field: ReaderClientEdgeToServerObject | ReaderClientEdgeToClientObject, record: Record, data: SelectorData, - ): void { + ): ?mixed { const backingField = field.backingField; // Because ReaderClientExtension doesn't have `alias` or `name` and so I don't know @@ -719,7 +719,7 @@ class RelayReader { isSuspenseSentinel(clientEdgeResolverResponse) ) { data[applicationName] = clientEdgeResolverResponse; - return; + return clientEdgeResolverResponse; } const validClientEdgeResolverResponse = @@ -733,14 +733,15 @@ class RelayReader { this._resolverCache, ); this._clientEdgeTraversalPath.push(null); - data[applicationName] = this._readLinkedIds( + const edgeValues = this._readLinkedIds( field.linkedField, storeIDs, record, data, ); this._clientEdgeTraversalPath.pop(); - break; + data[applicationName] = edgeValues; + return edgeValues; case 'SingularConcrete': const [storeID, traversalPathSegment] = @@ -760,14 +761,15 @@ class RelayReader { RelayModernRecord.getDataID(record), prevData, ); - data[applicationName] = this._traverse( + const edgeValue = this._traverse( field.linkedField, storeID, // $FlowFixMe[incompatible-variance] prevData, ); this._clientEdgeTraversalPath.pop(); - break; + data[applicationName] = edgeValue; + return edgeValue; default: (validClientEdgeResolverResponse.kind: empty); } diff --git a/packages/relay-runtime/store/__tests__/RelayReader-RequiredFields-test.js b/packages/relay-runtime/store/__tests__/RelayReader-RequiredFields-test.js index 10f30e9ca683e..8b6de334f8755 100644 --- a/packages/relay-runtime/store/__tests__/RelayReader-RequiredFields-test.js +++ b/packages/relay-runtime/store/__tests__/RelayReader-RequiredFields-test.js @@ -16,7 +16,15 @@ const { } = require('../RelayModernOperationDescriptor'); const {read} = require('../RelayReader'); const RelayRecordSource = require('../RelayRecordSource'); -const {createReaderSelector, getPluralSelector} = require('relay-runtime'); +const { + RelayFeatureFlags, + createReaderSelector, + getPluralSelector, +} = require('relay-runtime'); +const { + LiveResolverCache, +} = require('relay-runtime/store/experimental-live-resolvers/LiveResolverCache'); +const LiveResolverStore = require('relay-runtime/store/experimental-live-resolvers/LiveResolverStore'); describe('RelayReader @required', () => { it('bubbles @required(action: LOG) scalars up to LinkedField', () => { @@ -791,4 +799,154 @@ describe('RelayReader @required', () => { const data = pluralSelector.selectors.map(s => read(source, s).data); expect(data).toEqual([{username: 'Wendy'}, null]); }); + + describe('client edge with @required', () => { + beforeEach(() => { + RelayFeatureFlags.ENABLE_RELAY_RESOLVERS = true; + }); + afterEach(() => { + RelayFeatureFlags.ENABLE_RELAY_RESOLVERS = false; + }); + test('throws when missing required field', () => { + const source = RelayRecordSource.create({ + 'client:root': { + __id: 'client:root', + __typename: '__Root', + me: {__ref: '1'}, + }, + '1': { + __id: '1', + id: '1', + __typename: 'User', + }, + }); + const FooQuery = graphql` + query RelayReaderRequiredFieldsTest25Query { + me { + # client_object resolver will return null for an id of "0" + client_object(id: "0") @required(action: THROW) { + description + } + } + } + `; + const store = new LiveResolverStore(source); + const operation = createOperationDescriptor(FooQuery, {}); + const resolverCache = new LiveResolverCache(() => source, store); + const {missingRequiredFields} = read( + source, + operation.fragment, + resolverCache, + ); + expect(missingRequiredFields).toEqual({ + action: 'THROW', + field: { + owner: 'RelayReaderRequiredFieldsTest25Query', + path: 'me.client_object', + }, + }); + }); + + test('does not throw when required field is present', () => { + const source = RelayRecordSource.create({ + 'client:root': { + __id: 'client:root', + __typename: '__Root', + me: {__ref: '1'}, + }, + '1': { + __id: '1', + id: '1', + __typename: 'User', + birthdate: {__ref: 'client:2'}, + }, + 'client:2': { + month: 3, + day: 11, + }, + }); + const FooQuery = graphql` + query RelayReaderRequiredFieldsTest26Query { + me { + astrological_sign @required(action: THROW) { + name + } + } + } + `; + + const store = new LiveResolverStore(source); + const operation = createOperationDescriptor(FooQuery, {}); + const resolverCache = new LiveResolverCache(() => source, store); + const {data, missingRequiredFields} = read( + source, + operation.fragment, + resolverCache, + ); + expect(data).toEqual({me: {astrological_sign: {name: 'Pisces'}}}); + expect(missingRequiredFields).toBe(null); + }); + + test('does not throw when required plural field is present', () => { + const source = RelayRecordSource.create({ + 'client:root': { + __id: 'client:root', + __typename: '__Root', + me: {__ref: '1'}, + }, + '1': { + __id: '1', + id: '1', + __typename: 'User', + }, + }); + const FooQuery = graphql` + query RelayReaderRequiredFieldsTest27Query { + all_astrological_signs @required(action: THROW) { + name + } + } + `; + + const store = new LiveResolverStore(source); + const operation = createOperationDescriptor(FooQuery, {}); + const resolverCache = new LiveResolverCache(() => source, store); + const {data, missingRequiredFields} = read( + source, + operation.fragment, + resolverCache, + ); + expect(data.all_astrological_signs.length).toBe(12); + expect(missingRequiredFields).toBe(null); + }); + + test('does not throw when @live required field is suspended', () => { + const source = RelayRecordSource.create({ + 'client:root': { + __id: 'client:root', + __typename: '__Root', + }, + }); + const FooQuery = graphql` + query RelayReaderRequiredFieldsTest28Query { + live_user_resolver_always_suspend + @waterfall + @required(action: THROW) { + name + } + } + `; + const store = new LiveResolverStore(source); + const operation = createOperationDescriptor(FooQuery, {}); + const resolverCache = new LiveResolverCache(() => source, store); + const snapshot = read(source, operation.fragment, resolverCache); + expect(snapshot.missingRequiredFields).toEqual(null); + expect(snapshot.missingLiveResolverFields).toEqual([ + { + path: 'RelayReaderRequiredFieldsTest28Query.live_user_resolver_always_suspend', + liveStateID: 'client:root:live_user_resolver_always_suspend', + }, + ]); + }); + }); }); diff --git a/packages/relay-runtime/store/__tests__/__generated__/ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend.graphql.js b/packages/relay-runtime/store/__tests__/__generated__/ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend.graphql.js new file mode 100644 index 0000000000000..cfbba51690459 --- /dev/null +++ b/packages/relay-runtime/store/__tests__/__generated__/ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend.graphql.js @@ -0,0 +1,143 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @oncall relay + * + * @generated SignedSource<> + * @flow + * @lightSyntaxTransform + * @nogrep + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { ConcreteRequest, Query } from 'relay-runtime'; +import type { RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$fragmentType } from "./RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend.graphql"; +export type ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$variables = {| + id: string, +|}; +export type ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$data = {| + +node: ?{| + +$fragmentSpreads: RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$fragmentType, + |}, +|}; +export type ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend = {| + response: ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$data, + variables: ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$variables, +|}; +*/ + +var node/*: ConcreteRequest*/ = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "id" + } +], +v1 = [ + { + "kind": "Variable", + "name": "id", + "variableName": "id" + } +]; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend", + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "args": null, + "kind": "FragmentSpread", + "name": "RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend" + } + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend", + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "kind": "InlineFragment", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + } + ], + "type": "User", + "abstractKey": null + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "6b4377983658f804a7b0a8e3be8b892c", + "id": null, + "metadata": {}, + "name": "ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend", + "operationKind": "query", + "text": "query ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend(\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend\n id\n }\n}\n\nfragment RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend on User {\n name\n id\n}\n" + } +}; +})(); + +if (__DEV__) { + (node/*: any*/).hash = "1ea17c6315e8ba285db304130201310d"; +} + +module.exports = ((node/*: any*/)/*: Query< + ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$variables, + ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$data, +>*/); diff --git a/packages/relay-runtime/store/__tests__/__generated__/RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend.graphql.js b/packages/relay-runtime/store/__tests__/__generated__/RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend.graphql.js new file mode 100644 index 0000000000000..39d4aaaf34ba7 --- /dev/null +++ b/packages/relay-runtime/store/__tests__/__generated__/RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend.graphql.js @@ -0,0 +1,78 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @oncall relay + * + * @generated SignedSource<<385c769ac8e9e37700514ca159c40756>> + * @flow + * @lightSyntaxTransform + * @nogrep + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { ReaderFragment, RefetchableFragment } from 'relay-runtime'; +import type { FragmentType } from "relay-runtime"; +declare export opaque type RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$fragmentType: FragmentType; +type ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$variables = any; +export type RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$data = {| + +id: string, + +name: ?string, + +$fragmentType: RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$fragmentType, +|}; +export type RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$key = { + +$data?: RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$data, + +$fragmentSpreads: RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$fragmentType, + ... +}; +*/ + +var node/*: ReaderFragment*/ = { + "argumentDefinitions": [], + "kind": "Fragment", + "metadata": { + "refetch": { + "connection": null, + "fragmentPathInResult": [ + "node" + ], + "operation": require('./ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend.graphql'), + "identifierField": "id" + } + }, + "name": "RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + } + ], + "type": "User", + "abstractKey": null +}; + +if (__DEV__) { + (node/*: any*/).hash = "1ea17c6315e8ba285db304130201310d"; +} + +module.exports = ((node/*: any*/)/*: RefetchableFragment< + RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$fragmentType, + RefetchableClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$data, + ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend$variables, +>*/); diff --git a/packages/relay-runtime/store/__tests__/__generated__/RelayReaderRequiredFieldsTest25Query.graphql.js b/packages/relay-runtime/store/__tests__/__generated__/RelayReaderRequiredFieldsTest25Query.graphql.js new file mode 100644 index 0000000000000..5a686d021b645 --- /dev/null +++ b/packages/relay-runtime/store/__tests__/__generated__/RelayReaderRequiredFieldsTest25Query.graphql.js @@ -0,0 +1,171 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @oncall relay + * + * @generated SignedSource<> + * @flow + * @lightSyntaxTransform + * @nogrep + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { ConcreteRequest, Query } from 'relay-runtime'; +import type { DataID } from "relay-runtime"; +import {client_object as userClientObjectResolverType} from "../resolvers/UserClientEdgeClientObjectResolver.js"; +// Type assertion validating that `userClientObjectResolverType` resolver is correctly implemented. +// A type error here indicates that the type signature of the resolver module is incorrect. +(userClientObjectResolverType: ( + args: {| + id: string, + |}, +) => ?{| + +id: DataID, +|}); +export type RelayReaderRequiredFieldsTest25Query$variables = {||}; +export type RelayReaderRequiredFieldsTest25Query$data = {| + +me: ?{| + +client_object: {| + +description: ?string, + |}, + |}, +|}; +export type RelayReaderRequiredFieldsTest25Query = {| + response: RelayReaderRequiredFieldsTest25Query$data, + variables: RelayReaderRequiredFieldsTest25Query$variables, +|}; +*/ + +var node/*: ConcreteRequest*/ = (function(){ +var v0 = [ + { + "kind": "Literal", + "name": "id", + "value": "0" + } +], +v1 = { + "alias": null, + "args": (v0/*: any*/), + "concreteType": "ClientObject", + "kind": "LinkedField", + "name": "client_object", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "description", + "storageKey": null + } + ], + "storageKey": "client_object(id:\"0\")" +}; +return { + "fragment": { + "argumentDefinitions": [], + "kind": "Fragment", + "metadata": { + "hasClientEdges": true + }, + "name": "RelayReaderRequiredFieldsTest25Query", + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "User", + "kind": "LinkedField", + "name": "me", + "plural": false, + "selections": [ + { + "kind": "RequiredField", + "field": { + "kind": "ClientEdgeToClientObject", + "concreteType": "ClientObject", + "backingField": { + "alias": null, + "args": (v0/*: any*/), + "fragment": null, + "kind": "RelayResolver", + "name": "client_object", + "resolverModule": require('./../resolvers/UserClientEdgeClientObjectResolver').client_object, + "path": "me.client_object" + }, + "linkedField": (v1/*: any*/) + }, + "action": "THROW", + "path": "me.client_object" + } + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": [], + "kind": "Operation", + "name": "RelayReaderRequiredFieldsTest25Query", + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "User", + "kind": "LinkedField", + "name": "me", + "plural": false, + "selections": [ + { + "kind": "ClientEdgeToClientObject", + "backingField": { + "name": "client_object", + "args": (v0/*: any*/), + "fragment": null, + "kind": "RelayResolver", + "storageKey": "client_object(id:\"0\")", + "isOutputType": false + }, + "linkedField": (v1/*: any*/) + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "4847d92a3b6003ac088ad440f688d84e", + "id": null, + "metadata": {}, + "name": "RelayReaderRequiredFieldsTest25Query", + "operationKind": "query", + "text": "query RelayReaderRequiredFieldsTest25Query {\n me {\n id\n }\n}\n" + } +}; +})(); + +if (__DEV__) { + (node/*: any*/).hash = "6721f9f04ecd26abc9478d3c678ead79"; +} + +module.exports = ((node/*: any*/)/*: Query< + RelayReaderRequiredFieldsTest25Query$variables, + RelayReaderRequiredFieldsTest25Query$data, +>*/); diff --git a/packages/relay-runtime/store/__tests__/__generated__/RelayReaderRequiredFieldsTest26Query.graphql.js b/packages/relay-runtime/store/__tests__/__generated__/RelayReaderRequiredFieldsTest26Query.graphql.js new file mode 100644 index 0000000000000..07533b19779e1 --- /dev/null +++ b/packages/relay-runtime/store/__tests__/__generated__/RelayReaderRequiredFieldsTest26Query.graphql.js @@ -0,0 +1,251 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @oncall relay + * + * @generated SignedSource<<9212d2afc9ddc14004014e0d5c3992f0>> + * @flow + * @lightSyntaxTransform + * @nogrep + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { ConcreteRequest, Query } from 'relay-runtime'; +import type { DataID } from "relay-runtime"; +import type { AstrologicalSignNameResolver$key } from "./../resolvers/__generated__/AstrologicalSignNameResolver.graphql"; +import type { UserAstrologicalSignResolver$key } from "./../resolvers/__generated__/UserAstrologicalSignResolver.graphql"; +import {name as astrologicalSignNameResolverType} from "../resolvers/AstrologicalSignNameResolver.js"; +// Type assertion validating that `astrologicalSignNameResolverType` resolver is correctly implemented. +// A type error here indicates that the type signature of the resolver module is incorrect. +(astrologicalSignNameResolverType: ( + rootKey: AstrologicalSignNameResolver$key, +) => mixed); +import {astrological_sign as userAstrologicalSignResolverType} from "../resolvers/UserAstrologicalSignResolver.js"; +// Type assertion validating that `userAstrologicalSignResolverType` resolver is correctly implemented. +// A type error here indicates that the type signature of the resolver module is incorrect. +(userAstrologicalSignResolverType: ( + rootKey: UserAstrologicalSignResolver$key, +) => ?{| + +id: DataID, +|}); +export type RelayReaderRequiredFieldsTest26Query$variables = {||}; +export type RelayReaderRequiredFieldsTest26Query$data = {| + +me: ?{| + +astrological_sign: {| + +name: ?$Call<((...empty[]) => R) => R, typeof astrologicalSignNameResolverType>, + |}, + |}, +|}; +export type RelayReaderRequiredFieldsTest26Query = {| + response: RelayReaderRequiredFieldsTest26Query$data, + variables: RelayReaderRequiredFieldsTest26Query$variables, +|}; +*/ + +var node/*: ConcreteRequest*/ = (function(){ +var v0 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}; +return { + "fragment": { + "argumentDefinitions": [], + "kind": "Fragment", + "metadata": { + "hasClientEdges": true + }, + "name": "RelayReaderRequiredFieldsTest26Query", + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "User", + "kind": "LinkedField", + "name": "me", + "plural": false, + "selections": [ + { + "kind": "RequiredField", + "field": { + "kind": "ClientEdgeToClientObject", + "concreteType": "AstrologicalSign", + "backingField": { + "alias": null, + "args": null, + "fragment": { + "args": null, + "kind": "FragmentSpread", + "name": "UserAstrologicalSignResolver" + }, + "kind": "RelayResolver", + "name": "astrological_sign", + "resolverModule": require('./../resolvers/UserAstrologicalSignResolver').astrological_sign, + "path": "me.astrological_sign" + }, + "linkedField": { + "alias": null, + "args": null, + "concreteType": "AstrologicalSign", + "kind": "LinkedField", + "name": "astrological_sign", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "fragment": { + "args": null, + "kind": "FragmentSpread", + "name": "AstrologicalSignNameResolver" + }, + "kind": "RelayResolver", + "name": "name", + "resolverModule": require('./../resolvers/AstrologicalSignNameResolver').name, + "path": "me.name" + } + ], + "storageKey": null + } + }, + "action": "THROW", + "path": "me.astrological_sign" + } + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": [], + "kind": "Operation", + "name": "RelayReaderRequiredFieldsTest26Query", + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "User", + "kind": "LinkedField", + "name": "me", + "plural": false, + "selections": [ + { + "kind": "ClientEdgeToClientObject", + "backingField": { + "name": "astrological_sign", + "args": null, + "fragment": { + "kind": "InlineFragment", + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Date", + "kind": "LinkedField", + "name": "birthdate", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "month", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "day", + "storageKey": null + } + ], + "storageKey": null + } + ], + "type": "User", + "abstractKey": null + }, + "kind": "RelayResolver", + "storageKey": null, + "isOutputType": false + }, + "linkedField": { + "alias": null, + "args": null, + "concreteType": "AstrologicalSign", + "kind": "LinkedField", + "name": "astrological_sign", + "plural": false, + "selections": [ + { + "name": "name", + "args": null, + "fragment": { + "kind": "InlineFragment", + "selections": [ + { + "name": "self", + "args": null, + "fragment": { + "kind": "InlineFragment", + "selections": [ + (v0/*: any*/) + ], + "type": "AstrologicalSign", + "abstractKey": null + }, + "kind": "RelayResolver", + "storageKey": null, + "isOutputType": false + } + ], + "type": "AstrologicalSign", + "abstractKey": null + }, + "kind": "RelayResolver", + "storageKey": null, + "isOutputType": false + }, + (v0/*: any*/) + ], + "storageKey": null + } + }, + (v0/*: any*/) + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "9823e24d5d3e64302fecd87b35bba3af", + "id": null, + "metadata": {}, + "name": "RelayReaderRequiredFieldsTest26Query", + "operationKind": "query", + "text": "query RelayReaderRequiredFieldsTest26Query {\n me {\n ...UserAstrologicalSignResolver\n id\n }\n}\n\nfragment UserAstrologicalSignResolver on User {\n birthdate {\n month\n day\n }\n}\n" + } +}; +})(); + +if (__DEV__) { + (node/*: any*/).hash = "5945ab813a6acb50eef24fffbe6bdc50"; +} + +module.exports = ((node/*: any*/)/*: Query< + RelayReaderRequiredFieldsTest26Query$variables, + RelayReaderRequiredFieldsTest26Query$data, +>*/); diff --git a/packages/relay-runtime/store/__tests__/__generated__/RelayReaderRequiredFieldsTest27Query.graphql.js b/packages/relay-runtime/store/__tests__/__generated__/RelayReaderRequiredFieldsTest27Query.graphql.js new file mode 100644 index 0000000000000..d132d957e8cc5 --- /dev/null +++ b/packages/relay-runtime/store/__tests__/__generated__/RelayReaderRequiredFieldsTest27Query.graphql.js @@ -0,0 +1,220 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @oncall relay + * + * @generated SignedSource<<24fa5ee0d2e80d42d10009eafb0c982d>> + * @flow + * @lightSyntaxTransform + * @nogrep + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { ConcreteRequest, Query } from 'relay-runtime'; +import type { DataID } from "relay-runtime"; +import type { AstrologicalSignNameResolver$key } from "./../resolvers/__generated__/AstrologicalSignNameResolver.graphql"; +import type { QueryAllAstrologicalSignsResolver$key } from "./../resolvers/__generated__/QueryAllAstrologicalSignsResolver.graphql"; +import {name as astrologicalSignNameResolverType} from "../resolvers/AstrologicalSignNameResolver.js"; +// Type assertion validating that `astrologicalSignNameResolverType` resolver is correctly implemented. +// A type error here indicates that the type signature of the resolver module is incorrect. +(astrologicalSignNameResolverType: ( + rootKey: AstrologicalSignNameResolver$key, +) => mixed); +import {all_astrological_signs as queryAllAstrologicalSignsResolverType} from "../resolvers/QueryAllAstrologicalSignsResolver.js"; +// Type assertion validating that `queryAllAstrologicalSignsResolverType` resolver is correctly implemented. +// A type error here indicates that the type signature of the resolver module is incorrect. +(queryAllAstrologicalSignsResolverType: ( + rootKey: QueryAllAstrologicalSignsResolver$key, +) => ?$ReadOnlyArray); +export type RelayReaderRequiredFieldsTest27Query$variables = {||}; +export type RelayReaderRequiredFieldsTest27Query$data = {| + +all_astrological_signs: $ReadOnlyArray((...empty[]) => R) => R, typeof astrologicalSignNameResolverType>, + |}>, +|}; +export type RelayReaderRequiredFieldsTest27Query = {| + response: RelayReaderRequiredFieldsTest27Query$data, + variables: RelayReaderRequiredFieldsTest27Query$variables, +|}; +*/ + +var node/*: ConcreteRequest*/ = (function(){ +var v0 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}; +return { + "fragment": { + "argumentDefinitions": [], + "kind": "Fragment", + "metadata": { + "hasClientEdges": true + }, + "name": "RelayReaderRequiredFieldsTest27Query", + "selections": [ + { + "kind": "RequiredField", + "field": { + "kind": "ClientEdgeToClientObject", + "concreteType": "AstrologicalSign", + "backingField": { + "alias": null, + "args": null, + "fragment": { + "args": null, + "kind": "FragmentSpread", + "name": "QueryAllAstrologicalSignsResolver" + }, + "kind": "RelayResolver", + "name": "all_astrological_signs", + "resolverModule": require('./../resolvers/QueryAllAstrologicalSignsResolver').all_astrological_signs, + "path": "all_astrological_signs" + }, + "linkedField": { + "alias": null, + "args": null, + "concreteType": "AstrologicalSign", + "kind": "LinkedField", + "name": "all_astrological_signs", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "fragment": { + "args": null, + "kind": "FragmentSpread", + "name": "AstrologicalSignNameResolver" + }, + "kind": "RelayResolver", + "name": "name", + "resolverModule": require('./../resolvers/AstrologicalSignNameResolver').name, + "path": "name" + } + ], + "storageKey": null + } + }, + "action": "THROW", + "path": "all_astrological_signs" + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": [], + "kind": "Operation", + "name": "RelayReaderRequiredFieldsTest27Query", + "selections": [ + { + "kind": "ClientEdgeToClientObject", + "backingField": { + "name": "all_astrological_signs", + "args": null, + "fragment": { + "kind": "InlineFragment", + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "User", + "kind": "LinkedField", + "name": "me", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null + }, + (v0/*: any*/) + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "RelayResolver", + "storageKey": null, + "isOutputType": false + }, + "linkedField": { + "alias": null, + "args": null, + "concreteType": "AstrologicalSign", + "kind": "LinkedField", + "name": "all_astrological_signs", + "plural": true, + "selections": [ + { + "name": "name", + "args": null, + "fragment": { + "kind": "InlineFragment", + "selections": [ + { + "name": "self", + "args": null, + "fragment": { + "kind": "InlineFragment", + "selections": [ + (v0/*: any*/) + ], + "type": "AstrologicalSign", + "abstractKey": null + }, + "kind": "RelayResolver", + "storageKey": null, + "isOutputType": false + } + ], + "type": "AstrologicalSign", + "abstractKey": null + }, + "kind": "RelayResolver", + "storageKey": null, + "isOutputType": false + }, + (v0/*: any*/) + ], + "storageKey": null + } + } + ] + }, + "params": { + "cacheID": "c37ac49844094f5ea8eac001dfc21ffc", + "id": null, + "metadata": {}, + "name": "RelayReaderRequiredFieldsTest27Query", + "operationKind": "query", + "text": "query RelayReaderRequiredFieldsTest27Query {\n ...QueryAllAstrologicalSignsResolver\n}\n\nfragment QueryAllAstrologicalSignsResolver on Query {\n me {\n __typename\n id\n }\n}\n" + } +}; +})(); + +if (__DEV__) { + (node/*: any*/).hash = "2251dd1ef8dfb9d0586df501107b45be"; +} + +module.exports = ((node/*: any*/)/*: Query< + RelayReaderRequiredFieldsTest27Query$variables, + RelayReaderRequiredFieldsTest27Query$data, +>*/); diff --git a/packages/relay-runtime/store/__tests__/__generated__/RelayReaderRequiredFieldsTest28Query.graphql.js b/packages/relay-runtime/store/__tests__/__generated__/RelayReaderRequiredFieldsTest28Query.graphql.js new file mode 100644 index 0000000000000..aba6c38b594ac --- /dev/null +++ b/packages/relay-runtime/store/__tests__/__generated__/RelayReaderRequiredFieldsTest28Query.graphql.js @@ -0,0 +1,123 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @oncall relay + * + * @generated SignedSource<> + * @flow + * @lightSyntaxTransform + * @nogrep + */ + +/* eslint-disable */ + +'use strict'; + +/*:: +import type { ClientRequest, ClientQuery } from 'relay-runtime'; +import type { LiveState } from "relay-runtime/store/experimental-live-resolvers/LiveResolverStore"; +import type { DataID } from "relay-runtime"; +import {live_user_resolver_always_suspend as queryLiveUserResolverAlwaysSuspendResolverType} from "../resolvers/LiveUserAlwaysSuspendResolver.js"; +// Type assertion validating that `queryLiveUserResolverAlwaysSuspendResolverType` resolver is correctly implemented. +// A type error here indicates that the type signature of the resolver module is incorrect. +(queryLiveUserResolverAlwaysSuspendResolverType: () => LiveState); +export type RelayReaderRequiredFieldsTest28Query$variables = {||}; +export type RelayReaderRequiredFieldsTest28Query$data = {| + +live_user_resolver_always_suspend: {| + +name: ?string, + |}, +|}; +export type RelayReaderRequiredFieldsTest28Query = {| + response: RelayReaderRequiredFieldsTest28Query$data, + variables: RelayReaderRequiredFieldsTest28Query$variables, +|}; +*/ + +var node/*: ClientRequest*/ = { + "fragment": { + "argumentDefinitions": [], + "kind": "Fragment", + "metadata": { + "hasClientEdges": true + }, + "name": "RelayReaderRequiredFieldsTest28Query", + "selections": [ + { + "kind": "RequiredField", + "field": { + "kind": "ClientEdgeToServerObject", + "operation": require('./ClientEdgeQuery_RelayReaderRequiredFieldsTest28Query_live_user_resolver_always_suspend.graphql'), + "backingField": { + "alias": null, + "args": null, + "fragment": null, + "kind": "RelayLiveResolver", + "name": "live_user_resolver_always_suspend", + "resolverModule": require('./../resolvers/LiveUserAlwaysSuspendResolver').live_user_resolver_always_suspend, + "path": "live_user_resolver_always_suspend" + }, + "linkedField": { + "alias": null, + "args": null, + "concreteType": "User", + "kind": "LinkedField", + "name": "live_user_resolver_always_suspend", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + } + ], + "storageKey": null + } + }, + "action": "THROW", + "path": "live_user_resolver_always_suspend" + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": [], + "kind": "Operation", + "name": "RelayReaderRequiredFieldsTest28Query", + "selections": [ + { + "name": "live_user_resolver_always_suspend", + "args": null, + "fragment": null, + "kind": "RelayResolver", + "storageKey": null, + "isOutputType": false + } + ] + }, + "params": { + "cacheID": "fb8240592c2eefb489c064bb56f44668", + "id": null, + "metadata": {}, + "name": "RelayReaderRequiredFieldsTest28Query", + "operationKind": "query", + "text": null + } +}; + +if (__DEV__) { + (node/*: any*/).hash = "1ea17c6315e8ba285db304130201310d"; +} + +module.exports = ((node/*: any*/)/*: ClientQuery< + RelayReaderRequiredFieldsTest28Query$variables, + RelayReaderRequiredFieldsTest28Query$data, +>*/);