-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
import ClientRequest for client only mutations
Reviewed By: alunyov Differential Revision: D50805852 fbshipit-source-id: 222e4e81becfa62b108afdb1fab17189f7163d3b
- Loading branch information
1 parent
c36131a
commit 22a3c89
Showing
7 changed files
with
294 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
...lay-compiler/tests/relay_compiler_integration/fixtures/client_mutation_extension.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
==================================== INPUT ==================================== | ||
//- bar.js | ||
graphql`mutation barMutation { | ||
foo_mutation | ||
}` | ||
|
||
//- relay.config.json | ||
{ | ||
"language": "flow", | ||
"schema": "./schema.graphql", | ||
"eagerEsModules": true, | ||
"featureFlags": { | ||
"enable_relay_resolver_transform": true | ||
}, | ||
"schemaExtensions": [ | ||
"./extensions.graphql" | ||
] | ||
} | ||
|
||
//- schema.graphql | ||
|
||
type Mutation | ||
|
||
|
||
//- extensions.graphql | ||
|
||
extend type Mutation { | ||
foo_mutation: Boolean | ||
} | ||
==================================== OUTPUT =================================== | ||
//- __generated__/barMutation.graphql.js | ||
/** | ||
* <auto-generated> SignedSource<<8c2ec235b8b068c2c2fffbc3aae787b8>> | ||
* @flow | ||
* @lightSyntaxTransform | ||
* @nogrep | ||
*/ | ||
|
||
/* eslint-disable */ | ||
|
||
'use strict'; | ||
|
||
/*:: | ||
import type { ClientRequest, Mutation } from 'relay-runtime'; | ||
export type barMutation$variables = {||}; | ||
export type barMutation$data = {| | ||
+foo_mutation: ?boolean, | ||
|}; | ||
export type barMutation = {| | ||
response: barMutation$data, | ||
variables: barMutation$variables, | ||
|}; | ||
*/ | ||
|
||
var node/*: ClientRequest*/ = (function(){ | ||
var v0 = [ | ||
{ | ||
"kind": "ClientExtension", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "foo_mutation", | ||
"storageKey": null | ||
} | ||
] | ||
} | ||
]; | ||
return { | ||
"fragment": { | ||
"argumentDefinitions": [], | ||
"kind": "Fragment", | ||
"metadata": null, | ||
"name": "barMutation", | ||
"selections": (v0/*: any*/), | ||
"type": "Mutation", | ||
"abstractKey": null | ||
}, | ||
"kind": "Request", | ||
"operation": { | ||
"argumentDefinitions": [], | ||
"kind": "Operation", | ||
"name": "barMutation", | ||
"selections": (v0/*: any*/) | ||
}, | ||
"params": { | ||
"cacheID": "b7409af7b3a13247f776ad3f9192c84b", | ||
"id": null, | ||
"metadata": {}, | ||
"name": "barMutation", | ||
"operationKind": "mutation", | ||
"text": null | ||
} | ||
}; | ||
})(); | ||
|
||
(node/*: any*/).hash = "1f3610a117a92bb877caf826f77fae63"; | ||
|
||
export default ((node/*: any*/)/*: Mutation< | ||
barMutation$variables, | ||
barMutation$data, | ||
>*/); |
28 changes: 28 additions & 0 deletions
28
.../relay-compiler/tests/relay_compiler_integration/fixtures/client_mutation_extension.input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//- bar.js | ||
graphql`mutation barMutation { | ||
foo_mutation | ||
}` | ||
|
||
//- relay.config.json | ||
{ | ||
"language": "flow", | ||
"schema": "./schema.graphql", | ||
"eagerEsModules": true, | ||
"featureFlags": { | ||
"enable_relay_resolver_transform": true | ||
}, | ||
"schemaExtensions": [ | ||
"./extensions.graphql" | ||
] | ||
} | ||
|
||
//- schema.graphql | ||
|
||
type Mutation | ||
|
||
|
||
//- extensions.graphql | ||
|
||
extend type Mutation { | ||
foo_mutation: Boolean | ||
} |
117 changes: 117 additions & 0 deletions
117
...elay-compiler/tests/relay_compiler_integration/fixtures/client_mutation_resolver.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
==================================== INPUT ==================================== | ||
//- foo.js | ||
/** | ||
* @RelayResolver Mutation.foo_mutation: Boolean | ||
*/ | ||
|
||
//- bar.js | ||
graphql`mutation barMutation { | ||
foo_mutation | ||
}` | ||
|
||
//- relay.config.json | ||
{ | ||
"language": "flow", | ||
"schema": "./schema.graphql", | ||
"eagerEsModules": true, | ||
"featureFlags": { | ||
"enable_relay_resolver_transform": true | ||
} | ||
} | ||
|
||
//- schema.graphql | ||
|
||
type Mutation | ||
==================================== OUTPUT =================================== | ||
//- __generated__/barMutation.graphql.js | ||
/** | ||
* <auto-generated> SignedSource<<7f1de50339842bab9cecc72c6fbc076f>> | ||
* @flow | ||
* @lightSyntaxTransform | ||
* @nogrep | ||
*/ | ||
|
||
/* eslint-disable */ | ||
|
||
'use strict'; | ||
|
||
/*:: | ||
import type { ClientRequest, Mutation } from 'relay-runtime'; | ||
import {foo_mutation as mutationFooMutationResolverType} from "../foo.js"; | ||
// Type assertion validating that `mutationFooMutationResolverType` resolver is correctly implemented. | ||
// A type error here indicates that the type signature of the resolver module is incorrect. | ||
(mutationFooMutationResolverType: () => ?boolean); | ||
export type barMutation$variables = {||}; | ||
export type barMutation$data = {| | ||
+foo_mutation: ?boolean, | ||
|}; | ||
export type barMutation = {| | ||
response: barMutation$data, | ||
variables: barMutation$variables, | ||
|}; | ||
*/ | ||
|
||
import {foo_mutation as mutationFooMutationResolver} from './../foo'; | ||
|
||
var node/*: ClientRequest*/ = { | ||
"fragment": { | ||
"argumentDefinitions": [], | ||
"kind": "Fragment", | ||
"metadata": null, | ||
"name": "barMutation", | ||
"selections": [ | ||
{ | ||
"kind": "ClientExtension", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"fragment": null, | ||
"kind": "RelayResolver", | ||
"name": "foo_mutation", | ||
"resolverModule": mutationFooMutationResolver, | ||
"path": "foo_mutation" | ||
} | ||
] | ||
} | ||
], | ||
"type": "Mutation", | ||
"abstractKey": null | ||
}, | ||
"kind": "Request", | ||
"operation": { | ||
"argumentDefinitions": [], | ||
"kind": "Operation", | ||
"name": "barMutation", | ||
"selections": [ | ||
{ | ||
"kind": "ClientExtension", | ||
"selections": [ | ||
{ | ||
"name": "foo_mutation", | ||
"args": null, | ||
"fragment": null, | ||
"kind": "RelayResolver", | ||
"storageKey": null, | ||
"isOutputType": true | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"params": { | ||
"cacheID": "b7409af7b3a13247f776ad3f9192c84b", | ||
"id": null, | ||
"metadata": {}, | ||
"name": "barMutation", | ||
"operationKind": "mutation", | ||
"text": null | ||
} | ||
}; | ||
|
||
(node/*: any*/).hash = "1f3610a117a92bb877caf826f77fae63"; | ||
|
||
export default ((node/*: any*/)/*: Mutation< | ||
barMutation$variables, | ||
barMutation$data, | ||
>*/); |
23 changes: 23 additions & 0 deletions
23
...s/relay-compiler/tests/relay_compiler_integration/fixtures/client_mutation_resolver.input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//- foo.js | ||
/** | ||
* @RelayResolver Mutation.foo_mutation: Boolean | ||
*/ | ||
|
||
//- bar.js | ||
graphql`mutation barMutation { | ||
foo_mutation | ||
}` | ||
|
||
//- relay.config.json | ||
{ | ||
"language": "flow", | ||
"schema": "./schema.graphql", | ||
"eagerEsModules": true, | ||
"featureFlags": { | ||
"enable_relay_resolver_transform": true | ||
} | ||
} | ||
|
||
//- schema.graphql | ||
|
||
type Mutation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters