@dillonkearns/elm-graphql
Version:
<img src="https://cdn.jsdelivr.net/gh/martimatix/logo-graphqelm/logo.svg" alt="dillonearns/elm-graphql logo" width="40%" align="right">
35 lines (29 loc) • 790 B
JavaScript
import _newArrowCheck from 'babel-runtime/helpers/newArrowCheck';
var _this = undefined;
/**
* Creates a GqlRequest using given GqlRequestCompat
*
* @param {GqlRequest<Variables>} gqlRequest
*
* @return {GqlRequestCompat<Variables>}
*
* @example
* const operation = `
* query userQuery($userId: ID!) {
* user(userId: $userId) {
* id
* email
* }
* }
* `;
*
* console.log(requestToCompat({operation, variables: {userId: 10}}));
* // {query: "...", variables: {userId: 10}}
*/
var requestToCompat = function (_ref) {
var query = _ref.operation,
variables = _ref.variables;
_newArrowCheck(this, _this);
return variables ? { query: query, variables: variables } : { query: query };
}.bind(undefined);
export default requestToCompat;