UNPKG

@redocly/graphql-docs

Version:

Redocly GraphQL docs

4 lines (3 loc) 1.22 kB
var r=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var s=(t,e)=>{for(var n in e)r(t,n,{get:e[n],enumerable:!0})},E=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of f(e))!c.call(t,i)&&i!==n&&r(t,i,{get:()=>e[i],enumerable:!(a=d(e,i))||a.enumerable});return t};var g=t=>E(r({},"__esModule",{value:!0}),t);var b={};s(b,{getOperationExample:()=>u,getOperationResponseExample:()=>y,getOperationVariablesExample:()=>$});module.exports=g(b);var p=require("../type"),o=require("./field-example"),m=require("./variables-example");function u({operationType:t,operation:e,expandLevel:n,multilineArguments:a,translate:i}){const l=(0,m.getVariablesExample)(e.args,a),x=(0,o.getFieldExample)({field:e,multilineArguments:a,indentation:1,translate:i,maxLevel:n});return`${t} ${e.name}${l} { ${x} }`}function y({responseType:t,expandLevel:e}){return{data:(0,p.getTypeExample)({type:t,expandLevel:e})}}function $({args:t,expandLevel:e}){return t.reduce((n,a)=>(n[a.name]=(0,p.getTypeExample)({type:a.type,expandLevel:e}),n),{})}0&&(module.exports={getOperationExample,getOperationResponseExample,getOperationVariablesExample});