@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) • 814 B
JavaScript
import _newArrowCheck from 'babel-runtime/helpers/newArrowCheck';
var _this = undefined;
/**
* Creates a GqlRequest using given GqlRequestCompat
*
* @param {GqlRequestCompat<Variables>} gqlRequestCompat
*
* @return {GqlRequest<Variables>}
*
* @example
* const query = `
* query userQuery($userId: ID!) {
* user(userId: $userId) {
* id
* email
* }
* }
* `;
*
* console.log(requestFromCompat({query, variables: {userId: 10}}));
* // {operation: "...", variables: {userId: 10}}
*/
var requestFromCompat = function (_ref) {
var operation = _ref.query,
variables = _ref.variables;
_newArrowCheck(this, _this);
return variables ? { operation: operation, variables: variables } : { operation: operation };
}.bind(undefined);
export default requestFromCompat;