Represents a GraphQL call variable for use with the GraphQL Batch API.
Represents a GraphQL call variable for use with the GraphQL Batch API.
For example, given a source query identified by "q0", we would make a batch call variable "<ref_q0>" as follows:
new GraphQL.BatchCallVariable('q0', '$.*.actor.id');
The batch API allows streaming responses to the client, re-using information from previous queries via ref_params; the query identifier ("q0" in the example above) combined with a JSONPath to the node to be extended ("$.*.actor.id") allow us to define a supplementary query that retrieves additional information (example: https://fburl.com/65122329) for that node.
https://our.intern.facebook.com/intern/dex/graphql-batch-api
Represents a value passed to a GraphQL call (for example, the value 5 passed
in a call like first(5)
).
Represents a value passed to a GraphQL call (for example, the value 5 passed
in a call like first(5)
).
Represents a variable used in a GraphQL call.
Represents a variable used in a GraphQL call.
For example:
new GraphQL.CallVariable('foo') // variable: <foo>
Represents a GraphQL call such as size(50, 50)
or (size: 32)
.
Represents a GraphQL call such as size(50, 50)
or (size: 32)
.
Represents a field in a GraphQL query.
Represents a field in a GraphQL query.
A field may be simple or arbitrarily complex, including calls, and containing subfields, nested fragments.
Represents a GraphQL mutation.
Represents a GraphQL mutation.
Represents a GraphQL node.
Represents a GraphQL node.
A node may contain zero or more fields and/or query fragments.
Note that we don't actually export this class (rather, we export subclasses
corresponding to fields, fragments, queries and mutations); we do, however,
use GraphQLNode
as a type throughout Dlite.
Base class from which GraphQLMutation and GraphQLSubscription extend.
Base class from which GraphQLMutation and GraphQLSubscription extend.
Represents a root GraphQL query such as viewer() { ... }
or me() { ... }
.
Represents a root GraphQL query such as viewer() { ... }
or me() { ... }
.
Queries may contain zero or more fields, and/or subfragments.
Represents a query fragment in a GraphQL query.
Represents a query fragment in a GraphQL query.
A fragment may contain zero or more fields and/or additional fragments.
Comprises a GraphQL query (see GraphQLQuery
) and a set of values.
Comprises a GraphQL query (see GraphQLQuery
) and a set of values.
In practice, we're don't currently make use of the values anywhere in Dlite,
but we use GraphQLQueryWithValues
widely within Dlite as a type.
Represents a GraphQL subscription.
Represents a GraphQL subscription.
internal
internal
RelayFragmentReference is the return type of fragment composition:
fragment on Foo { ${Child.getFragment('bar', {baz: variables.qux})} }
Whereas a fragment defines a sub-query's structure, a fragment reference is a particular instantiation of the fragment as it is composed within a query or another fragment. It encodes the source fragment, initial variables, and a mapping from variables in the composing query's (or fragment's) scope to variables in the fragment's scope.
The variable mapping is represented by variableMapping
, a dictionary that
maps from names of variables in the parent scope to variables that exist in
the fragment. Example:
// Fragment:
var Container = Relay.createContainer(..., {
initialVariables: {
private: 'foo',
public: 'bar',
variable: null,
},
fragments: {
foo: ...
}
});
// Reference:
${Container.getQuery(
'foo',
// Variable Mapping:
{
public: 'BAR',
variable: variables.source,
}
)}
When evaluating the referenced fragment, $public
will be overridden with
'Bar'
. The value of $variable
will become the value of $source
in the
outer scope. This is analagous to:
function inner(private = 'foo', public = 'bar', variable) {}
function outer(source) {
inner(public = 'BAR', variable = source);
}
Where the value of the inner variable
depends on how outer
is called.
The prepareVariables
function allows for variables to be modified based on
the runtime environment or route name.
internal
internal
Wraps access to query fields.
Note: place proxy methods for GraphQL.Field
here.
internal
internal
Wraps access to query fragments.
Note: place proxy methods for GraphQL.QueryFragment
here.
internal
internal
Represents a GraphQL mutation.
internal
internal
Queries in Relay are represented as trees. Possible nodes include the root, fields, and fragments. Fields can have children, or they can be leaf nodes. Root and fragment nodes must always have children.
RelayQueryNode
provides access to information such as the field name,
generated alias, sub-fields, and call values.
Nodes are immutable; query modification is supported via clone
:
var next = prev.clone(prev.getChildren().filter(f => ...));
Note: Mediating access to actual query nodes is necessary so that we can
replace the current mutable GraphQL nodes with an immutable query
representation. This class *must not* mutate the underlying concreteNode
.
Instead, use an instance variable (see clone()
).
TODO (#6937314): RelayQueryNode support for toJSON/fromJSON
internal
internal
Represents a GraphQL subscription.