UNPKG

graphql-helix

Version:

A highly evolved GraphQL HTTP Server 🧬

31 lines (30 loc) • 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getGraphQLParameters = void 0; const index_1 = require("./util/index"); const getGraphQLParameters = (request) => { const { body, method, query: queryParams } = request; let operationName; let query; let variables; let extensions; if ((0, index_1.isHttpMethod)("GET", method)) { operationName = queryParams.operationName; query = queryParams.query; variables = queryParams.variables; extensions = queryParams.extensions; } else if ((0, index_1.isHttpMethod)("POST", method)) { operationName = body === null || body === void 0 ? void 0 : body.operationName; query = body === null || body === void 0 ? void 0 : body.query; variables = body === null || body === void 0 ? void 0 : body.variables; extensions = body === null || body === void 0 ? void 0 : body.extension; } return { operationName, query, variables, extensions, }; }; exports.getGraphQLParameters = getGraphQLParameters;