@platformos/pos-cli
Version:
Manage your platformOS application
1 lines • 438 kB
JavaScript
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).GraphiQLExplorer=f()}}(function(){return function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){return o(e[i][1][r]||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}({1:[function(require,module,exports){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();exports.defaultValue=defaultValue;var React=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}("undefined"!=typeof window?window.React:void 0!==global?global.React:null),_graphql=require("graphql");function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}var defaultColors={keyword:"#B11A04",def:"#D2054E",property:"#1F61A0",qualifier:"#1C92A9",attribute:"#8B2BB9",number:"#2882F9",string:"#D64292",builtin:"#D47509",string2:"#0B7FC7",variable:"#397D13",atom:"#CA9800"},defaultArrowOpen=React.createElement("svg",{width:"12",height:"9"},React.createElement("path",{fill:"#666",d:"M 0 2 L 9 2 L 4.5 7.5 z"})),defaultArrowClosed=React.createElement("svg",{width:"12",height:"9"},React.createElement("path",{fill:"#666",d:"M 0 0 L 0 9 L 5.5 4.5 z"})),defaultCheckboxChecked=React.createElement("svg",{style:{marginRight:"3px",marginLeft:"-3px"},width:"12",height:"12",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{d:"M16 0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16V2C18 0.9 17.1 0 16 0ZM16 16H2V2H16V16ZM14.99 6L13.58 4.58L6.99 11.17L4.41 8.6L2.99 10.01L6.99 14L14.99 6Z",fill:"#666"})),defaultCheckboxUnchecked=React.createElement("svg",{style:{marginRight:"3px",marginLeft:"-3px"},width:"12",height:"12",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{d:"M16 2V16H2V2H16ZM16 0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16V2C18 0.9 17.1 0 16 0Z",fill:"#CCC"}));function Checkbox(e){return e.checked?e.styleConfig.checkboxChecked:e.styleConfig.checkboxUnchecked}function defaultGetDefaultFieldNames(e){var t=e.getFields();if(t.id){var n=["id"];return t.email?n.push("email"):t.name&&n.push("name"),n}if(t.edges)return["edges"];if(t.node)return["node"];if(t.nodes)return["nodes"];var r=[];return Object.keys(t).forEach(function(e){(0,_graphql.isLeafType)(t[e].type)&&r.push(e)}),r.length?r.slice(0,2):["__typename"]}function isRequiredArgument(e){return(0,_graphql.isNonNullType)(e.type)&&void 0===e.defaultValue}function unwrapInputType(e){for(var t=e;(0,_graphql.isWrappingType)(t);)t=t.ofType;return t}function coerceArgValue(e,t){if((0,_graphql.isScalarType)(e))try{switch(e.name){case"String":return{kind:"StringValue",value:String(e.parseValue(t))};case"Float":return{kind:"FloatValue",value:String(e.parseValue(parseFloat(t)))};case"Int":return{kind:"IntValue",value:String(e.parseValue(parseInt(t,10)))};case"Boolean":try{var n=JSON.parse(t);return"boolean"==typeof n?{kind:"BooleanValue",value:n}:{kind:"BooleanValue",value:!1}}catch(e){return{kind:"BooleanValue",value:!1}}default:return{kind:"StringValue",value:String(e.parseValue(t))}}}catch(e){return console.error("error coercing arg value",e,t),{kind:"StringValue",value:t}}else try{var r=e.parseValue(t);return r?{kind:"EnumValue",value:String(r)}:{kind:"EnumValue",value:e.getValues()[0].name}}catch(t){return{kind:"EnumValue",value:e.getValues()[0].name}}}var InputArgView=function(e){function t(){var e,n,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return n=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r._getArgSelection=function(){return r.props.selection.fields.find(function(e){return e.name.value===r.props.arg.name})},r._removeArg=function(){var e=r.props.selection,t=r._getArgSelection();r._previousArgSelection=t,r.props.modifyFields(e.fields.filter(function(e){return e!==t}))},r._addArg=function(){var e=r.props,t=e.selection,n=e.arg,a=e.getDefaultScalarArgValue,i=e.parentField,o=e.makeDefaultArg,l=unwrapInputType(n.type),s=null;if(r._previousArgSelection)s=r._previousArgSelection;else if((0,_graphql.isInputObjectType)(l)){var u=l.getFields();s={kind:"ObjectField",name:{kind:"Name",value:n.name},value:{kind:"ObjectValue",fields:defaultInputObjectFields(a,o,i,Object.keys(u).map(function(e){return u[e]}))}}}else(0,_graphql.isLeafType)(l)&&(s={kind:"ObjectField",name:{kind:"Name",value:n.name},value:a(i,n,l)});s?r.props.modifyFields([].concat(_toConsumableArray(t.fields||[]),[s])):console.error("Unable to add arg for argType",l)},r._setArgValue=function(e){var t=r.props.selection,n=r._getArgSelection();if(n){var a=unwrapInputType(r.props.arg.type);if((0,_graphql.isLeafType)(a)){var i=e.target.value;r.props.modifyFields((t.fields||[]).map(function(e){return e===n?_extends({},e,{value:coerceArgValue(a,i)}):e}))}else console.warn("Unable to handle non leaf types in setArgValue")}else console.error("missing arg selection when setting arg value")},r._modifyChildFields=function(e){r.props.modifyFields(r.props.selection.fields.map(function(t){return t.name.value===r.props.arg.name?_extends({},t,{value:{kind:"ObjectValue",fields:e}}):t}))},_possibleConstructorReturn(r,n)}return _inherits(t,React.PureComponent),_createClass(t,[{key:"render",value:function(){var e=this.props,t=e.arg,n=e.parentField,r=this._getArgSelection();return React.createElement(AbstractArgView,{argValue:r?r.value:null,arg:t,parentField:n,addArg:this._addArg,removeArg:this._removeArg,setArgFields:this._modifyChildFields,setArgValue:this._setArgValue,getDefaultScalarArgValue:this.props.getDefaultScalarArgValue,makeDefaultArg:this.props.makeDefaultArg,onRunOperation:this.props.onRunOperation,styleConfig:this.props.styleConfig})}}]),t}();function defaultValue(e){if((0,_graphql.isEnumType)(e))return{kind:"EnumValue",value:e.getValues()[0].name};switch(e.name){case"String":return{kind:"StringValue",value:""};case"Float":return{kind:"FloatValue",value:"1.5"};case"Int":return{kind:"IntValue",value:"10"};case"Boolean":return{kind:"BooleanValue",value:!1};default:return{kind:"StringValue",value:""}}}function defaultGetDefaultScalarArgValue(e,t,n){return defaultValue(n)}var ArgView=function(e){function t(){var e,n,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return n=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r._getArgSelection=function(){return(r.props.selection.arguments||[]).find(function(e){return e.name.value===r.props.arg.name})},r._removeArg=function(){var e=r.props.selection,t=r._getArgSelection();r._previousArgSelection=t,r.props.modifyArguments((e.arguments||[]).filter(function(e){return e!==t}))},r._addArg=function(){var e=r.props,t=e.selection,n=e.getDefaultScalarArgValue,a=e.makeDefaultArg,i=e.parentField,o=e.arg,l=unwrapInputType(o.type),s=null;if(r._previousArgSelection)s=r._previousArgSelection;else if((0,_graphql.isInputObjectType)(l)){var u=l.getFields();s={kind:"Argument",name:{kind:"Name",value:o.name},value:{kind:"ObjectValue",fields:defaultInputObjectFields(n,a,i,Object.keys(u).map(function(e){return u[e]}))}}}else(0,_graphql.isLeafType)(l)&&(s={kind:"Argument",name:{kind:"Name",value:o.name},value:n(i,o,l)});s?r.props.modifyArguments([].concat(_toConsumableArray(t.arguments||[]),[s])):console.error("Unable to add arg for argType",l)},r._setArgValue=function(e){var t=r.props.selection,n=r._getArgSelection();if(n){var a=unwrapInputType(r.props.arg.type);if((0,_graphql.isLeafType)(a)){var i=e.target.value;r.props.modifyArguments((t.arguments||[]).map(function(e){return e===n?_extends({},e,{value:coerceArgValue(a,i)}):e}))}else console.warn("Unable to handle non leaf types in setArgValue")}else console.error("missing arg selection when setting arg value")},r._setArgFields=function(e){var t=r.props.selection,n=r._getArgSelection();n?r.props.modifyArguments((t.arguments||[]).map(function(t){return t===n?_extends({},t,{value:{kind:"ObjectValue",fields:e}}):t})):console.error("missing arg selection when setting arg value")},_possibleConstructorReturn(r,n)}return _inherits(t,React.PureComponent),_createClass(t,[{key:"render",value:function(){var e=this.props,t=e.arg,n=e.parentField,r=this._getArgSelection();return React.createElement(AbstractArgView,{argValue:r?r.value:null,arg:t,parentField:n,addArg:this._addArg,removeArg:this._removeArg,setArgFields:this._setArgFields,setArgValue:this._setArgValue,getDefaultScalarArgValue:this.props.getDefaultScalarArgValue,makeDefaultArg:this.props.makeDefaultArg,onRunOperation:this.props.onRunOperation,styleConfig:this.props.styleConfig})}}]),t}();function isRunShortcut(e){return e.metaKey&&"Enter"===e.key}var ScalarInput=function(e){function t(){var e,n,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return n=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r._handleChange=function(e){r.props.setArgValue(e)},_possibleConstructorReturn(r,n)}return _inherits(t,React.PureComponent),_createClass(t,[{key:"componentDidMount",value:function(){var e=this._ref,t=document.activeElement;!e||!t||t instanceof HTMLTextAreaElement||(e.focus(),e.setSelectionRange(0,e.value.length))}},{key:"render",value:function(){var e=this,t=this.props,n=t.arg,r=t.argValue,a=t.styleConfig,i=unwrapInputType(n.type),o="string"==typeof r.value?r.value:"",l="StringValue"===this.props.argValue.kind?a.colors.string:a.colors.number;return React.createElement("span",{style:{color:l}},"String"===i.name?'"':"",React.createElement("input",{style:{border:"none",borderBottom:"1px solid #888",outline:"none",width:Math.max(1,o.length)+"ch",color:l},ref:function(t){e._ref=t},type:"text",onKeyDown:function(t){isRunShortcut(t)&&e.props.onRunOperation(t)},onChange:this._handleChange,value:o}),"String"===i.name?'"':"")}}]),t}(),AbstractArgView=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,React.PureComponent),_createClass(t,[{key:"render",value:function(){var e=this,t=this.props,n=t.argValue,r=t.arg,a=t.styleConfig,i=unwrapInputType(r.type),o=null;if(n)if("Variable"===n.kind)o=React.createElement("span",{style:{color:a.colors.variable}},"$",n.name.value);else if((0,_graphql.isScalarType)(i))o="Boolean"===i.name?React.createElement("select",{style:{color:a.colors.builtin},onChange:this.props.setArgValue,value:"BooleanValue"===n.kind?n.value:void 0},React.createElement("option",{key:"true",value:"true"},"true"),React.createElement("option",{key:"false",value:"false"},"false")):React.createElement(ScalarInput,{setArgValue:this.props.setArgValue,arg:r,argValue:n,onRunOperation:this.props.onRunOperation,styleConfig:this.props.styleConfig});else if((0,_graphql.isEnumType)(i))"EnumValue"===n.kind?o=React.createElement("select",{style:{backgroundColor:"white",color:a.colors.string2},onChange:this.props.setArgValue,value:n.value},i.getValues().map(function(e){return React.createElement("option",{key:e.name,value:e.name},e.name)})):console.error("arg mismatch between arg and selection",i,n);else if((0,_graphql.isInputObjectType)(i))if("ObjectValue"===n.kind){var l=i.getFields();o=React.createElement("div",{style:{marginLeft:16}},Object.keys(l).sort().map(function(t){return React.createElement(InputArgView,{key:t,arg:l[t],parentField:e.props.parentField,selection:n,modifyFields:e.props.setArgFields,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig})}))}else console.error("arg mismatch between arg and selection",i,n);return React.createElement("div",{style:{cursor:"pointer",minHeight:"16px",WebkitUserSelect:"none",userSelect:"none"},"data-arg-name":r.name,"data-arg-type":i.name},React.createElement("span",{style:{cursor:"pointer"},onClick:n?this.props.removeArg:this.props.addArg},(0,_graphql.isInputObjectType)(i)?React.createElement("span",null,n?this.props.styleConfig.arrowOpen:this.props.styleConfig.arrowClosed):React.createElement(Checkbox,{checked:!!n,styleConfig:this.props.styleConfig}),React.createElement("span",{style:{color:a.colors.attribute},title:r.description},r.name,isRequiredArgument(r)?"*":"",":"))," ",o||React.createElement("span",null))}}]),t}(),AbstractView=function(e){function t(){var e,n,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return n=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r._addFragment=function(){r.props.modifySelections([].concat(_toConsumableArray(r.props.selections),[r._previousSelection||{kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:r.props.implementingType.name}},selectionSet:{kind:"SelectionSet",selections:r.props.getDefaultFieldNames(r.props.implementingType).map(function(e){return{kind:"Field",name:{kind:"Name",value:e}}})}}]))},r._removeFragment=function(){var e=r._getSelection();r._previousSelection=e,r.props.modifySelections(r.props.selections.filter(function(t){return t!==e}))},r._getSelection=function(){var e=r.props.selections.find(function(e){return"InlineFragment"===e.kind&&e.typeCondition&&r.props.implementingType.name===e.typeCondition.name.value});return e?"InlineFragment"===e.kind?e:void 0:null},r._modifyChildSelections=function(e){var t=r._getSelection();r.props.modifySelections(r.props.selections.map(function(n){return n===t?{directives:n.directives,kind:"InlineFragment",typeCondition:{kind:"NamedType",name:{kind:"Name",value:r.props.implementingType.name}},selectionSet:{kind:"SelectionSet",selections:e}}:n}))},_possibleConstructorReturn(r,n)}return _inherits(t,React.PureComponent),_createClass(t,[{key:"render",value:function(){var e=this,t=this.props,n=t.implementingType,r=t.schema,a=t.getDefaultFieldNames,i=t.styleConfig,o=this._getSelection(),l=n.getFields(),s=o&&o.selectionSet?o.selectionSet.selections:[];return React.createElement("div",null,React.createElement("span",{style:{cursor:"pointer"},onClick:o?this._removeFragment:this._addFragment},React.createElement(Checkbox,{checked:!!o,styleConfig:this.props.styleConfig}),React.createElement("span",{style:{color:i.colors.atom}},this.props.implementingType.name)),o?React.createElement("div",{style:{marginLeft:16}},Object.keys(l).sort().map(function(t){return React.createElement(FieldView,{key:t,field:l[t],selections:s,modifySelections:e._modifyChildSelections,schema:r,getDefaultFieldNames:a,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig})})):null)}}]),t}();function defaultInputObjectFields(e,t,n,r){var a=[],i=!0,o=!1,l=void 0;try{for(var s,u=r[Symbol.iterator]();!(i=(s=u.next()).done);i=!0){var c=s.value;if((0,_graphql.isRequiredInputField)(c)||t&&t(n,c)){var p=unwrapInputType(c.type);(0,_graphql.isInputObjectType)(p)?function(){var r=p.getFields();a.push({kind:"ObjectField",name:{kind:"Name",value:c.name},value:{kind:"ObjectValue",fields:defaultInputObjectFields(e,t,n,Object.keys(r).map(function(e){return r[e]}))}})}():(0,_graphql.isLeafType)(p)&&a.push({kind:"ObjectField",name:{kind:"Name",value:c.name},value:e(n,c,p)})}}}catch(e){o=!0,l=e}finally{try{!i&&u.return&&u.return()}finally{if(o)throw l}}return a}function defaultArgs(e,t,n){var r=[],a=!0,i=!1,o=void 0;try{for(var l,s=n.args[Symbol.iterator]();!(a=(l=s.next()).done);a=!0){var u=l.value;if(isRequiredArgument(u)||t&&t(n,u)){var c=unwrapInputType(u.type);(0,_graphql.isInputObjectType)(c)?function(){var a=c.getFields();r.push({kind:"Argument",name:{kind:"Name",value:u.name},value:{kind:"ObjectValue",fields:defaultInputObjectFields(e,t,n,Object.keys(a).map(function(e){return a[e]}))}})}():(0,_graphql.isLeafType)(c)&&r.push({kind:"Argument",name:{kind:"Name",value:u.name},value:e(n,u,c)})}}}catch(e){i=!0,o=e}finally{try{!a&&s.return&&s.return()}finally{if(i)throw o}}return r}var FieldView=function(e){function t(){var e,n,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return n=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r._addAllFieldsToSelections=function(e){var t={kind:"SelectionSet",selections:e?Object.keys(e).map(function(e){return{kind:"Field",name:{kind:"Name",value:e},arguments:[]}}):[]},n=[].concat(_toConsumableArray(r.props.selections.filter(function(e){return"InlineFragment"===e.kind||e.name.value!==r.props.field.name})),[{kind:"Field",name:{kind:"Name",value:r.props.field.name},arguments:defaultArgs(r.props.getDefaultScalarArgValue,r.props.makeDefaultArg,r.props.field),selectionSet:t}]);r.props.modifySelections(n)},r._addFieldToSelections=function(e){var t=[].concat(_toConsumableArray(r.props.selections),[r._previousSelection||{kind:"Field",name:{kind:"Name",value:r.props.field.name},arguments:defaultArgs(r.props.getDefaultScalarArgValue,r.props.makeDefaultArg,r.props.field)}]);r.props.modifySelections(t)},r._handleUpdateSelections=function(e){if(r._getSelection()&&!e.altKey)r._removeFieldFromSelections();else{var t=(0,_graphql.getNamedType)(r.props.field.type),n=(0,_graphql.isObjectType)(t)&&t.getFields();n&&e.altKey?r._addAllFieldsToSelections(n):r._addFieldToSelections(n)}},r._removeFieldFromSelections=function(){var e=r._getSelection();r._previousSelection=e,r.props.modifySelections(r.props.selections.filter(function(t){return t!==e}))},r._getSelection=function(){var e=r.props.selections.find(function(e){return"Field"===e.kind&&r.props.field.name===e.name.value});return e?"Field"===e.kind?e:void 0:null},r._setArguments=function(e){var t=r._getSelection();t?r.props.modifySelections(r.props.selections.map(function(n){return n===t?{alias:t.alias,arguments:e,directives:t.directives,kind:"Field",name:t.name,selectionSet:t.selectionSet}:n})):console.error("Missing selection when setting arguments",e)},r._modifyChildSelections=function(e){r.props.modifySelections(r.props.selections.map(function(t){if("Field"!==t.kind||r.props.field.name!==t.name.value)return t;if("Field"!==t.kind)throw new Error("invalid selection");return{alias:t.alias,arguments:t.arguments,directives:t.directives,kind:"Field",name:t.name,selectionSet:{kind:"SelectionSet",selections:e}}}))},_possibleConstructorReturn(r,n)}return _inherits(t,React.PureComponent),_createClass(t,[{key:"render",value:function(){var e=this,n=this.props,r=n.field,a=n.schema,i=n.getDefaultFieldNames,o=n.styleConfig,l=this._getSelection(),s=function(e){for(var t=e;(0,_graphql.isWrappingType)(t);)t=t.ofType;return t}(r.type),u=r.args.sort(function(e,t){return e.name.localeCompare(t.name)}),c=React.createElement("div",{className:"graphiql-explorer-node"},React.createElement("span",{title:r.description,style:{cursor:"pointer",display:"inline-flex",alignItems:"center",minHeight:"16px",WebkitUserSelect:"none",userSelect:"none"},"data-field-name":r.name,"data-field-type":s.name,onClick:this._handleUpdateSelections},(0,_graphql.isObjectType)(s)?React.createElement("span",null,l?this.props.styleConfig.arrowOpen:this.props.styleConfig.arrowClosed):null,(0,_graphql.isObjectType)(s)?null:React.createElement(Checkbox,{checked:!!l,styleConfig:this.props.styleConfig}),React.createElement("span",{style:{color:o.colors.property}},r.name)),l&&u.length?React.createElement("div",{style:{marginLeft:16}},u.map(function(t){return React.createElement(ArgView,{key:t.name,parentField:r,arg:t,selection:l,modifyArguments:e._setArguments,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig})})):null);if(l&&((0,_graphql.isObjectType)(s)||(0,_graphql.isInterfaceType)(s)||(0,_graphql.isUnionType)(s))){var p=(0,_graphql.isUnionType)(s)?{}:s.getFields(),d=l&&l.selectionSet?l.selectionSet.selections:[];return React.createElement("div",null,c,React.createElement("div",{style:{marginLeft:16}},Object.keys(p).sort().map(function(n){return React.createElement(t,{key:n,field:p[n],selections:d,modifySelections:e._modifyChildSelections,schema:a,getDefaultFieldNames:i,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig})}),(0,_graphql.isInterfaceType)(s)||(0,_graphql.isUnionType)(s)?a.getPossibleTypes(s).map(function(t){return React.createElement(AbstractView,{key:t.name,implementingType:t,selections:d,modifySelections:e._modifyChildSelections,schema:a,getDefaultFieldNames:i,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig})}):null))}return c}}]),t}();var DEFAULT_DOCUMENT={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",variableDefinitions:[],name:{kind:"Name",value:"MyQuery"},directives:[],selectionSet:{kind:"SelectionSet",selections:[]}}]},parseQueryMemoize=null;function memoizeParseQuery(e){if(parseQueryMemoize&&parseQueryMemoize[0]===e)return parseQueryMemoize[1];var t=function(e){try{return e.trim()?(0,_graphql.parse)(e,{noLocation:!0}):null}catch(e){return new Error(e)}}(e);return t?t instanceof Error?parseQueryMemoize?parseQueryMemoize[1]:DEFAULT_DOCUMENT:(parseQueryMemoize=[e,t],t):DEFAULT_DOCUMENT}var defaultStyles={buttonStyle:{fontSize:"1.2em",padding:"0px",backgroundColor:"white",border:"none",margin:"5px 0px",height:"40px",width:"100%",display:"block",maxWidth:"none"},explorerActionsStyle:{margin:"4px -8px -8px",paddingLeft:"8px",bottom:"0px",width:"100%",textAlign:"center",background:"none",borderTop:"none",borderBottom:"none"}},RootView=function(e){function t(){var e,n,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return n=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r._modifySelections=function(e){var t=r.props.definition;0===t.selectionSet.selections.length&&r._previousOperationDef&&(t=r._previousOperationDef);var n=void 0;0===e.length?(r._previousOperationDef=t,n=null):"FragmentDefinition"===t.kind?n=_extends({},t,{selectionSet:_extends({},t.selectionSet,{selections:e})}):"OperationDefinition"===t.kind&&(n=_extends({},t,{selectionSet:_extends({},t.selectionSet,{selections:e})})),r.props.onEdit(n)},r._onOperationRename=function(e){return r.props.onOperationRename(e.target.value)},r._handlePotentialRun=function(e){isRunShortcut(e)&&r.props.onRunOperation(r.props.name)},_possibleConstructorReturn(r,n)}return _inherits(t,React.PureComponent),_createClass(t,[{key:"render",value:function(){var e=this,t=this.props,n=t.operation,r=t.name,a=t.definition,i=t.schema,o=t.getDefaultFieldNames,l=t.styleConfig,s=this.props.fields||{},u=a.selectionSet.selections,c=this.props.name||capitalize(n)+" Name";return React.createElement("div",{id:n+"-"+(r||"unknown"),style:{borderBottom:"1px solid #d6d6d6",marginBottom:"0em",paddingBottom:"1em"}},React.createElement("div",{style:{color:l.colors.keyword,paddingBottom:4}},n," ",React.createElement("span",{style:{color:l.colors.def}},React.createElement("input",{style:{color:l.colors.def,border:"none",borderBottom:"1px solid #888",outline:"none",width:Math.max(4,c.length)+"ch"},autoComplete:"false",placeholder:capitalize(n)+" Name",value:this.props.name,onKeyDown:this._handlePotentialRun,onChange:this._onOperationRename})),this.props.onTypeName?React.createElement("span",null,React.createElement("br",null),"on "+this.props.onTypeName):""),Object.keys(s).sort().map(function(t){return React.createElement(FieldView,{key:t,field:s[t],selections:u,modifySelections:e._modifySelections,schema:i,getDefaultFieldNames:o,getDefaultScalarArgValue:e.props.getDefaultScalarArgValue,makeDefaultArg:e.props.makeDefaultArg,onRunOperation:e.props.onRunOperation,styleConfig:e.props.styleConfig})}))}}]),t}();function Attribution(){return React.createElement("div",{style:{fontFamily:"sans-serif",display:"flex",flexDirection:"column",alignItems:"center",margin:"1em",marginTop:0,flexGrow:1,justifyContent:"flex-end"}},React.createElement("div",{style:{borderTop:"1px solid #d6d6d6",paddingTop:"1em",width:"100%",textAlign:"center"}},"GraphiQL Explorer by ",React.createElement("a",{href:"https://www.onegraph.com"},"OneGraph")),React.createElement("div",null,"Contribute on"," ",React.createElement("a",{href:"https://github.com/OneGraph/graphiql-explorer"},"GitHub")))}var Explorer=function(e){function t(){var e,n,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return n=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r._resetScroll=function(){var e=r._ref;e&&(e.scrollLeft=0)},r._onEdit=function(e){return r.props.onEdit(e)},_possibleConstructorReturn(r,n)}return _inherits(t,React.PureComponent),_createClass(t,[{key:"componentDidMount",value:function(){this._resetScroll()}},{key:"render",value:function(){var e=this,t=this.props,n=t.schema,r=t.query,a=t.makeDefaultArg;if(!n)return React.createElement("div",{style:{fontFamily:"sans-serif"},className:"error-container"},"No Schema Available");var i={colors:this.props.colors||defaultColors,checkboxChecked:this.props.checkboxChecked||defaultCheckboxChecked,checkboxUnchecked:this.props.checkboxUnchecked||defaultCheckboxUnchecked,arrowClosed:this.props.arrowClosed||defaultArrowClosed,arrowOpen:this.props.arrowOpen||defaultArrowOpen,styles:this.props.styles?_extends({},defaultStyles,this.props.styles):defaultStyles},o=n.getQueryType(),l=n.getMutationType(),s=n.getSubscriptionType();if(!o&&!l&&!s)return React.createElement("div",null,"Missing query type");var u=o&&o.getFields(),c=l&&l.getFields(),p=s&&s.getFields(),d=memoizeParseQuery(r),f=this.props.getDefaultFieldNames||defaultGetDefaultFieldNames,m=this.props.getDefaultScalarArgValue||defaultGetDefaultScalarArgValue,g=d.definitions.map(function(e){return"FragmentDefinition"===e.kind?e:"OperationDefinition"===e.kind?e:null}).filter(Boolean),h=0===g.length?DEFAULT_DOCUMENT.definitions:g,y=function(t){var n=d.definitions,r=1===d.definitions.length&&d.definitions[0]===DEFAULT_DOCUMENT.definitions[0],a=r?[]:n.filter(function(e){return"OperationDefinition"===e.kind&&e.operation===t}),i="My"+capitalize(t)+(0===a.length?"":a.length+1),o={kind:"OperationDefinition",operation:t,name:{kind:"Name",value:i},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__typename # Placeholder value",loc:null},arguments:[],directives:[],selectionSet:null,loc:null}],loc:null},loc:null},l=r?[o]:[].concat(_toConsumableArray(d.definitions),[o]),s=_extends({},d,{definitions:l});e.props.onEdit((0,_graphql.print)(s))};return React.createElement("div",{ref:function(t){e._ref=t},style:{fontSize:12,textOverflow:"ellipsis",whiteSpace:"nowrap",margin:0,padding:8,fontFamily:'Consolas, Inconsolata, "Droid Sans Mono", Monaco, monospace'},className:"graphiql-explorer-root"},h.map(function(t,r){var o=t&&t.name&&t.name.value,l="FragmentDefinition"===t.kind?"fragment":t&&t.operation||"query",s="FragmentDefinition"===t.kind&&"NamedType"===t.typeCondition.kind&&n.getType(t.typeCondition.name.value),g=s instanceof _graphql.GraphQLObjectType?s.getFields():null,h="query"===l?u:"mutation"===l?c:"subscription"===l?p:"FragmentDefinition"===t.kind?g:null,y="FragmentDefinition"===t.kind?t.typeCondition.name.value:null;return React.createElement(RootView,{key:r,fields:h,operation:l,name:o,definition:t,onOperationRename:function(n){var r,a,i,o,l=(i=_extends({},r=t,{name:null==(a=n)||""===a?null:{kind:"Name",value:a,loc:void 0}}),o=d.definitions.map(function(e){return r===e?i:e}),_extends({},d,{definitions:o}));e.props.onEdit((0,_graphql.print)(l))},onTypeName:y,onEdit:function(n){var r=_extends({},d,{definitions:d.definitions.map(function(e){return e===t?n:e})}),a=(0,_graphql.print)(r);e.props.onEdit(a)},schema:n,getDefaultFieldNames:f,getDefaultScalarArgValue:m,makeDefaultArg:a,onRunOperation:function(){e.props.onRunOperation&&e.props.onRunOperation(o)},styleConfig:i})}),React.createElement("div",{className:"variable-editor-title",style:i.styles.explorerActionsStyle},u?React.createElement("button",{className:"toolbar-button",style:i.styles.buttonStyle,type:"link",onClick:function(){return y("query")}},"+ ADD NEW QUERY"):null,c?React.createElement("button",{className:"toolbar-button",style:i.styles.buttonStyle,type:"link",onClick:function(){return y("mutation")}},"+ ADD NEW MUTATION"):null,p?React.createElement("button",{className:"toolbar-button",style:i.styles.buttonStyle,type:"link",onClick:function(){return y("subscription")}},"+ ADD NEW SUBSCRIPTION"):null))}}]),t}();Explorer.defaultProps={getDefaultFieldNames:defaultGetDefaultFieldNames,getDefaultScalarArgValue:defaultGetDefaultScalarArgValue};var ErrorBoundary=function(e){function t(){var e,n,r;_classCallCheck(this,t);for(var a=arguments.length,i=Array(a),o=0;o<a;o++)i[o]=arguments[o];return n=r=_possibleConstructorReturn(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(i))),r.state={hasError:!1,error:null,errorInfo:null},_possibleConstructorReturn(r,n)}return _inherits(t,React.Component),_createClass(t,[{key:"componentDidCatch",value:function(e,t){this.setState({hasError:!0,error:e,errorInfo:t}),console.error("Error in component",e,t)}},{key:"render",value:function(){return this.state.hasError?React.createElement("div",{style:{padding:18,fontFamily:"sans-serif"}},React.createElement("div",null,"Something went wrong"),React.createElement("details",{style:{whiteSpace:"pre-wrap"}},this.state.error?this.state.error.toString():null,React.createElement("br",null),this.state.errorInfo?this.state.errorInfo.componentStack:null)):this.props.children}}]),t}(),ExplorerWrapper=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,React.PureComponent),_createClass(t,[{key:"render",value:function(){var e=this.props.showAttribution?React.createElement(Attribution,null):null;return React.createElement("div",{className:"historyPaneWrap",style:{height:"100%",width:this.props.width,zIndex:7,display:this.props.explorerIsOpen?"block":"none"}},React.createElement("div",{className:"history-title-bar"},React.createElement("div",{className:"history-title"},this.props.title),React.createElement("div",{className:"doc-explorer-rhs"},React.createElement("div",{className:"docExplorerHide",onClick:this.props.onToggleExplorer},"✕"))),React.createElement("div",{className:"history-contents"},React.createElement("div",{style:{overflow:"scroll",width:"100%",display:"flex",flexDirection:"column",minHeight:"100%"}},React.createElement(ErrorBoundary,null,React.createElement(Explorer,this.props)),e)))}}]),t}();ExplorerWrapper.defaultValue=defaultValue,ExplorerWrapper.defaultProps={width:380,title:"Explorer"},exports.default=ExplorerWrapper}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{graphql:13}],2:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Explorer=void 0;var e,_Explorer=require("./Explorer"),_Explorer2=(e=_Explorer)&&e.__esModule?e:{default:e};exports.Explorer=_Explorer2.default,exports.default=_Explorer2.default},{"./Explorer":1}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GraphQLError=GraphQLError;var _printError=require("./printError"),_location=require("../language/location");function GraphQLError(message,nodes,source,positions,path,originalError,extensions){var _nodes=Array.isArray(nodes)?0!==nodes.length?nodes:void 0:nodes?[nodes]:void 0,_source=source;if(!_source&&_nodes){var node=_nodes[0];_source=node&&node.loc&&node.loc.source}var _locations,_positions=positions;!_positions&&_nodes&&(_positions=_nodes.reduce(function(list,node){return node.loc&&list.push(node.loc.start),list},[])),_positions&&0===_positions.length&&(_positions=void 0),positions&&source?_locations=positions.map(function(pos){return(0,_location.getLocation)(source,pos)}):_nodes&&(_locations=_nodes.reduce(function(list,node){return node.loc&&list.push((0,_location.getLocation)(node.loc.source,node.loc.start)),list},[]));var _extensions=extensions||originalError&&originalError.extensions;Object.defineProperties(this,{message:{value:message,enumerable:!0,writable:!0},locations:{value:_locations||void 0,enumerable:Boolean(_locations)},path:{value:path||void 0,enumerable:Boolean(path)},nodes:{value:_nodes||void 0},source:{value:_source||void 0},positions:{value:_positions||void 0},originalError:{value:originalError},extensions:{value:_extensions||void 0,enumerable:Boolean(_extensions)}}),originalError&&originalError.stack?Object.defineProperty(this,"stack",{value:originalError.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,GraphQLError):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}GraphQLError.prototype=Object.create(Error.prototype,{constructor:{value:GraphQLError},name:{value:"GraphQLError"},toString:{value:function(){return(0,_printError.printError)(this)}}})},{"../language/location":39,"./printError":7}],4:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatError=function(error){error||(0,_invariant.default)(0,"Received null or undefined error.");var message=error.message||"An unknown error occurred.",locations=error.locations,path=error.path,extensions=error.extensions;return extensions?{message:message,locations:locations,path:path,extensions:extensions}:{message:message,locations:locations,path:path}};var obj,_invariant=(obj=require("../jsutils/invariant"))&&obj.__esModule?obj:{default:obj}},{"../jsutils/invariant":19}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"GraphQLError",{enumerable:!0,get:function(){return _GraphQLError.GraphQLError}}),Object.defineProperty(exports,"syntaxError",{enumerable:!0,get:function(){return _syntaxError.syntaxError}}),Object.defineProperty(exports,"locatedError",{enumerable:!0,get:function(){return _locatedError.locatedError}}),Object.defineProperty(exports,"printError",{enumerable:!0,get:function(){return _printError.printError}}),Object.defineProperty(exports,"formatError",{enumerable:!0,get:function(){return _formatError.formatError}});var _GraphQLError=require("./GraphQLError"),_syntaxError=require("./syntaxError"),_locatedError=require("./locatedError"),_printError=require("./printError"),_formatError=require("./formatError")},{"./GraphQLError":3,"./formatError":4,"./locatedError":6,"./printError":7,"./syntaxError":8}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.locatedError=function(originalError,nodes,path){if(originalError&&Array.isArray(originalError.path))return originalError;return new _GraphQLError.GraphQLError(originalError&&originalError.message,originalError&&originalError.nodes||nodes,originalError&&originalError.source,originalError&&originalError.positions,path,originalError)};var _GraphQLError=require("./GraphQLError")},{"./GraphQLError":3}],7:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.printError=function(error){var printedLocations=[];if(error.nodes){var _iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _step,_iterator=error.nodes[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0){var node=_step.value;node.loc&&printedLocations.push(highlightSourceAtLocation(node.loc.source,(0,_location.getLocation)(node.loc.source,node.loc.start)))}}catch(err){_didIteratorError=!0,_iteratorError=err}finally{try{_iteratorNormalCompletion||null==_iterator.return||_iterator.return()}finally{if(_didIteratorError)throw _iteratorError}}}else if(error.source&&error.locations){var source=error.source,_iteratorNormalCompletion2=!0,_didIteratorError2=!1,_iteratorError2=void 0;try{for(var _step2,_iterator2=error.locations[Symbol.iterator]();!(_iteratorNormalCompletion2=(_step2=_iterator2.next()).done);_iteratorNormalCompletion2=!0){var location=_step2.value;printedLocations.push(highlightSourceAtLocation(source,location))}}catch(err){_didIteratorError2=!0,_iteratorError2=err}finally{try{_iteratorNormalCompletion2||null==_iterator2.return||_iterator2.return()}finally{if(_didIteratorError2)throw _iteratorError2}}}return 0===printedLocations.length?error.message:[error.message].concat(printedLocations).join("\n\n")+"\n"};var _location=require("../language/location");function highlightSourceAtLocation(source,location){var firstLineColumnOffset=source.locationOffset.column-1,body=whitespace(firstLineColumnOffset)+source.body,lineIndex=location.line-1,lineOffset=source.locationOffset.line-1,lineNum=location.line+lineOffset,columnOffset=1===location.line?firstLineColumnOffset:0,columnNum=location.column+columnOffset,lines=body.split(/\r\n|[\n\r]/g);return"".concat(source.name," (").concat(lineNum,":").concat(columnNum,")\n")+function(lines){var existingLines=lines.filter(function(_ref){_ref[0];var line=_ref[1];return void 0!==line}),padLen=0,_iteratorNormalCompletion3=!0,_didIteratorError3=!1,_iteratorError3=void 0;try{for(var _step3,_iterator3=existingLines[Symbol.iterator]();!(_iteratorNormalCompletion3=(_step3=_iterator3.next()).done);_iteratorNormalCompletion3=!0){var _ref4=_step3.value,prefix=_ref4[0];padLen=Math.max(padLen,prefix.length)}}catch(err){_didIteratorError3=!0,_iteratorError3=err}finally{try{_iteratorNormalCompletion3||null==_iterator3.return||_iterator3.return()}finally{if(_didIteratorError3)throw _iteratorError3}}return existingLines.map(function(_ref3){var str,prefix=_ref3[0],line=_ref3[1];return whitespace(padLen-(str=prefix).length)+str+line}).join("\n")}([["".concat(lineNum-1,": "),lines[lineIndex-1]],["".concat(lineNum,": "),lines[lineIndex]],["",whitespace(columnNum-1)+"^"],["".concat(lineNum+1,": "),lines[lineIndex+1]]])}function whitespace(len){return Array(len+1).join(" ")}},{"../language/location":39}],8:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.syntaxError=function(source,position,description){return new _GraphQLError.GraphQLError("Syntax Error: ".concat(description),void 0,source,[position])};var _GraphQLError=require("./GraphQLError")},{"./GraphQLError":3}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.execute=function(argsOrSchema,document,rootValue,contextValue,variableValues,operationName,fieldResolver){return 1===arguments.length?executeImpl(argsOrSchema.schema,argsOrSchema.document,argsOrSchema.rootValue,argsOrSchema.contextValue,argsOrSchema.variableValues,argsOrSchema.operationName,argsOrSchema.fieldResolver):executeImpl(argsOrSchema,document,rootValue,contextValue,variableValues,operationName,fieldResolver)},exports.responsePathAsArray=responsePathAsArray,exports.addPath=addPath,exports.assertValidExecutionArguments=assertValidExecutionArguments,exports.buildExecutionContext=buildExecutionContext,exports.collectFields=collectFields,exports.buildResolveInfo=buildResolveInfo,exports.resolveFieldValueOrError=resolveFieldValueOrError,exports.getFieldDef=getFieldDef,exports.defaultFieldResolver=void 0;var _iterall=require("iterall"),_GraphQLError=require("../error/GraphQLError"),_locatedError=require("../error/locatedError"),_inspect=_interopRequireDefault(require("../jsutils/inspect")),_invariant=_interopRequireDefault(require("../jsutils/invariant")),_isInvalid=_interopRequireDefault(require("../jsutils/isInvalid")),_isNullish=_interopRequireDefault(require("../jsutils/isNullish")),_isPromise=_interopRequireDefault(require("../jsutils/isPromise")),_memoize=_interopRequireDefault(require("../jsutils/memoize3")),_promiseForObject=_interopRequireDefault(require("../jsutils/promiseForObject")),_promiseReduce=_interopRequireDefault(require("../jsutils/promiseReduce")),_getOperationRootType=require("../utilities/getOperationRootType"),_typeFromAST=require("../utilities/typeFromAST"),_kinds=require("../language/kinds"),_values=require("./values"),_definition=require("../type/definition"),_introspection=require("../type/introspection"),_directives=require("../type/directives"),_validate=require("../type/validate");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _typeof(obj){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function executeImpl(schema,document,rootValue,contextValue,variableValues,operationName,fieldResolver){assertValidExecutionArguments(schema,document,variableValues);var exeContext=buildExecutionContext(schema,document,rootValue,contextValue,variableValues,operationName,fieldResolver);return Array.isArray(exeContext)?{errors:exeContext}:function buildResponse(exeContext,data){if((0,_isPromise.default)(data))return data.then(function(resolved){return buildResponse(exeContext,resolved)});return 0===exeContext.errors.length?{data:data}:{errors:exeContext.errors,data:data}}(exeContext,function(exeContext,operation,rootValue){var type=(0,_getOperationRootType.getOperationRootType)(exeContext.schema,operation),fields=collectFields(exeContext,type,operation.selectionSet,Object.create(null),Object.create(null)),path=void 0;try{var result="mutation"===operation.operation?function(exeContext,parentType,sourceValue,path,fields){return(0,_promiseReduce.default)(Object.keys(fields),function(results,responseName){var fieldNodes=fields[responseName],fieldPath=addPath(path,responseName),result=resolveField(exeContext,parentType,sourceValue,fieldNodes,fieldPath);return void 0===result?results:(0,_isPromise.default)(result)?result.then(function(resolvedResult){return results[responseName]=resolvedResult,results}):(results[responseName]=result,results)},Object.create(null))}(exeContext,type,rootValue,path,fields):executeFields(exeContext,type,rootValue,path,fields);return(0,_isPromise.default)(result)?result.then(void 0,function(error){return exeContext.errors.push(error),Promise.resolve(null)}):result}catch(error){return exeContext.errors.push(error),null}}(exeContext,exeContext.operation,rootValue))}function responsePathAsArray(path){for(var flattened=[],curr=path;curr;)flattened.push(curr.key),curr=curr.prev;return flattened.reverse()}function addPath(prev,key){return{prev:prev,key:key}}function assertValidExecutionArguments(schema,document,rawVariableValues){document||(0,_invariant.default)(0,"Must provide document"),(0,_validate.assertValidSchema)(schema),rawVariableValues&&"object"!==_typeof(rawVariableValues)&&(0,_invariant.default)(0,"Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.")}function buildExecutionContext(schema,document,rootValue,contextValue,rawVariableValues,operationName,fieldResolver){for(var operation,variableValues,errors=[],hasMultipleAssumedOperations=!1,fragments=Object.create(null),i=0;i<document.definitions.length;i++){var definition=document.definitions[i];switch(definition.kind){case _kinds.Kind.OPERATION_DEFINITION:!operationName&&operation?hasMultipleAssumedOperations=!0:(!operationName||definition.name&&definition.name.value===operationName)&&(operation=definition);break;case _kinds.Kind.FRAGMENT_DEFINITION:fragments[definition.name.value]=definition}}if(operation?hasMultipleAssumedOperations&&errors.push(new _GraphQLError.GraphQLError("Must provide operation name if query contains multiple operations.")):operationName?errors.push(new _GraphQLError.GraphQLError('Unknown operation named "'.concat(operationName,'".'))):errors.push(new _GraphQLError.GraphQLError("Must provide an operation.")),operation){var coercedVariableValues=(0,_values.getVariableValues)(schema,operation.variableDefinitions||[],rawVariableValues||{});coercedVariableValues.errors?errors.push.apply(errors,coercedVariableValues.errors):variableValues=coercedVariableValues.coerced}return 0!==errors.length?errors:(operation||(0,_invariant.default)(0,"Has operation if no errors."),variableValues||(0,_invariant.default)(0,"Has variables if no errors."),{schema:schema,fragments:fragments,rootValue:rootValue,contextValue:contextValue,operation:operation,variableValues:variableValues,fieldResolver:fieldResolver||defaultFieldResolver,errors:errors})}function executeFields(exeContext,parentType,sourceValue,path,fields){for(var results=Object.create(null),containsPromise=!1,i=0,keys=Object.keys(fields);i<keys.length;++i){var responseName=keys[i],result=resolveField(exeContext,parentType,sourceValue,fields[responseName],addPath(path,responseName));void 0!==result&&(results[responseName]=result,!containsPromise&&(0,_isPromise.default)(result)&&(containsPromise=!0))}return containsPromise?(0,_promiseForObject.default)(results):results}function collectFields(exeContext,runtimeType,selectionSet,fields,visitedFragmentNames){for(var i=0;i<selectionSet.selections.length;i++){var selection=selectionSet.selections[i];switch(selection.kind){case _kinds.Kind.FIELD:if(!shouldIncludeNode(exeContext,selection))continue;var name=(node=selection).alias?node.alias.value:node.name.value;fields[name]||(fields[name]=[]),fields[name].push(selection);break;case _kinds.Kind.INLINE_FRAGMENT:if(!shouldIncludeNode(exeContext,selection)||!doesFragmentConditionMatch(exeContext,selection,runtimeType))continue;collectFields(exeContext,runtimeType,selection.selectionSet,fields,visitedFragmentNames);break;case _kinds.Kind.FRAGMENT_SPREAD:var fragName=selection.name.value;if(visitedFragmentNames[fragName]||!shouldIncludeNode(exeContext,selection))continue;visitedFragmentNames[fragName]=!0;var fragment=exeContext.fragments[fragName];if(!fragment||!doesFragmentConditionMatch(exeContext,fragment,runtimeType))continue;collectFields(exeContext,runtimeType,fragment.selectionSet,fields,visitedFragmentNames)}}var node;return fields}function shouldIncludeNode(exeContext,node){var skip=(0,_values.getDirectiveValues)(_directives.GraphQLSkipDirective,node,exeContext.variableValues);if(skip&&!0===skip.if)return!1;var include=(0,_values.getDirectiveValues)(_directives.GraphQLIncludeDirective,node,exeContext.variableValues);return!include||!1!==include.if}function doesFragmentConditionMatch(exeContext,fragment,type){var typeConditionNode=fragment.typeCondition;if(!typeConditionNode)return!0;var conditionalType=(0,_typeFromAST.typeFromAST)(exeContext.schema,typeConditionNode);return conditionalType===type||!!(0,_definition.isAbstractType)(conditionalType)&&exeContext.schema.isPossibleType(conditionalType,type)}function resolveField(exeContext,parentType,source,fieldNodes,path){var fieldName=fieldNodes[0].name.value,fieldDef=getFieldDef(exeContext.schema,parentType,fieldName);if(fieldDef){var resolveFn=fieldDef.resolve||exeContext.fieldResolver,info=buildResolveInfo(exeContext,fieldDef,fieldNodes,parentType,path),result=resolveFieldValueOrError(exeContext,fieldDef,fieldNodes,resolveFn,source,info);return completeValueCatchingError(exeContext,fieldDef.type,fieldNodes,info,path,result)}}function buildResolveInfo(exeContext,fieldDef,fieldNodes,parentType,path){return{fieldName:fieldDef.name,fieldNodes:fieldNodes,returnType:fieldDef.type,parentType:parentType,path:path,schema:exeContext.schema,fragments:exeContext.fragments,rootValue:exeContext.rootValue,operation:exeContext.operation,variableValues:exeContext.vari