nuxt-graphql-middleware 4.2.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/client/200.html +9 -9
  2. package/dist/client/404.html +9 -9
  3. package/dist/client/_nuxt/{BBbivCOF.js → B4FhP7a6.js} +1 -1
  4. package/dist/client/_nuxt/CH4m2wxh.js +25 -0
  5. package/dist/client/_nuxt/{DbuEOF3O.js → CPd6XBwJ.js} +1 -1
  6. package/dist/client/_nuxt/{Ch07F_Ul.js → GKcsigNx.js} +1 -1
  7. package/dist/client/_nuxt/{BKf42UCq.js → VR7nYXIq.js} +1 -1
  8. package/dist/client/_nuxt/builds/latest.json +1 -1
  9. package/dist/client/_nuxt/builds/meta/172a2fbf-9aed-4d11-81c4-ac46ab9b664c.json +1 -0
  10. package/dist/client/index.html +9 -9
  11. package/dist/module.d.mts +18 -14
  12. package/dist/module.d.ts +18 -14
  13. package/dist/module.json +1 -1
  14. package/dist/module.mjs +72 -36
  15. package/dist/runtime/clientOptions/index.d.ts +2 -0
  16. package/dist/runtime/clientOptions/index.js +3 -0
  17. package/dist/runtime/composables/nuxtApp.js +1 -1
  18. package/dist/runtime/composables/useAsyncGraphqlQuery.d.ts +4 -2
  19. package/dist/runtime/composables/useAsyncGraphqlQuery.js +26 -10
  20. package/dist/runtime/composables/useGraphqlMutation.d.ts +2 -2
  21. package/dist/runtime/composables/useGraphqlMutation.js +19 -2
  22. package/dist/runtime/composables/useGraphqlQuery.d.ts +2 -2
  23. package/dist/runtime/composables/useGraphqlQuery.js +29 -4
  24. package/dist/runtime/composables/useGraphqlUploadMutation.d.ts +2 -2
  25. package/dist/runtime/composables/useGraphqlUploadMutation.js +19 -3
  26. package/dist/runtime/{composables/shared.d.ts → helpers/composables.d.ts} +8 -1
  27. package/dist/runtime/helpers/composables.js +17 -0
  28. package/dist/runtime/server/tsconfig.json +3 -0
  29. package/dist/runtime/server/utils/index.d.ts +3 -0
  30. package/dist/runtime/server/utils/index.js +12 -0
  31. package/dist/runtime/server/utils/useGraphqlMutation.d.ts +7 -0
  32. package/dist/runtime/server/utils/useGraphqlMutation.js +20 -0
  33. package/dist/runtime/server/utils/useGraphqlQuery.d.ts +7 -0
  34. package/dist/runtime/server/utils/useGraphqlQuery.js +21 -0
  35. package/dist/runtime/serverHandler/helpers/index.d.ts +9 -5
  36. package/dist/runtime/serverHandler/helpers/index.js +40 -9
  37. package/dist/runtime/serverHandler/index.js +15 -7
  38. package/dist/runtime/serverHandler/upload.js +16 -7
  39. package/dist/runtime/serverOptions/defineGraphqlServerOptions.d.ts +2 -1
  40. package/dist/runtime/settings/index.d.ts +2 -1
  41. package/dist/runtime/settings/index.js +2 -1
  42. package/dist/runtime/types.d.ts +52 -1
  43. package/package.json +6 -2
  44. package/dist/client/_nuxt/CaoFd9E8.js +0 -25
  45. package/dist/client/_nuxt/builds/meta/fff2eb15-13a3-4063-86e7-990068006f7e.json +0 -1
  46. package/dist/runtime/composables/server.d.ts +0 -11
  47. package/dist/runtime/composables/server.js +0 -29
  48. package/dist/runtime/composables/shared.js +0 -5
  49. /package/dist/client/_nuxt/{entry.DlumAtbg.css → entry.D9ltLgme.css} +0 -0
  50. /package/dist/client/_nuxt/{error-404.C_4C5G96.css → error-404.SWzu_puR.css} +0 -0
  51. /package/dist/client/_nuxt/{error-500.CBAEdpZV.css → error-500.Bkv_zTjr.css} +0 -0
  52. /package/dist/client/_nuxt/{index.DCCKx2Zk.css → index.D19Q16VT.css} +0 -0
@@ -1 +1 @@
1
- import{u as S,d as B,r as q,a as P,o as E,b as I,c as T,e as U,f as V,h as A,g as R,p as F,n as H,i as x,j,k as L,l as D,m as M,q as $,w as G,s as K,_ as Q,t as W,v as J,x as _,y as C,z as X,A as Y,B as Z}from"./CaoFd9E8.js";import{u as ee}from"./BBbivCOF.js";async function O(t,r=S()){const{path:l,matched:p}=r.resolve(t);if(!p.length||(r._routePreloaded||(r._routePreloaded=new Set),r._routePreloaded.has(l)))return;const e=r._preloadPromises=r._preloadPromises||[];if(e.length>4)return Promise.all(e).then(()=>O(t,r));r._routePreloaded.add(l);const n=p.map(u=>{var a;return(a=u.components)==null?void 0:a.default}).filter(u=>typeof u=="function");for(const u of n){const a=Promise.resolve(u()).catch(()=>{}).finally(()=>e.splice(e.indexOf(a)));e.push(a)}await Promise.all(e)}const te=(...t)=>t.find(r=>r!==void 0);function re(t){const r=t.componentName||"NuxtLink";function l(e,n){if(!e||t.trailingSlash!=="append"&&t.trailingSlash!=="remove")return e;if(typeof e=="string")return z(e,t.trailingSlash);const u="path"in e&&e.path!==void 0?e.path:n(e).path;return{...e,name:void 0,path:z(u,t.trailingSlash)}}function p(e){const n=S(),u=$(),a=x(()=>!!e.target&&e.target!=="_self"),d=x(()=>{const h=e.to||e.href||"";return typeof h=="string"&&j(h,{acceptRelative:!0})}),y=R("RouterLink"),m=y&&typeof y!="string"?y.useLink:void 0,g=x(()=>{if(e.external)return!0;const h=e.to||e.href||"";return typeof h=="object"?!1:h===""||d.value}),i=x(()=>{const h=e.to||e.href||"";return g.value?h:l(h,n.resolve)}),c=g.value||m==null?void 0:m({...e,to:i}),b=x(()=>{var h;if(!i.value||d.value)return i.value;if(g.value){const k=typeof i.value=="object"&&"path"in i.value?L(i.value):i.value,w=typeof k=="object"?n.resolve(k).href:k;return l(w,n.resolve)}return typeof i.value=="object"?((h=n.resolve(i.value))==null?void 0:h.href)??null:l(D(u.app.baseURL,i.value),n.resolve)});return{to:i,hasTarget:a,isAbsoluteUrl:d,isExternal:g,href:b,isActive:(c==null?void 0:c.isActive)??x(()=>i.value===n.currentRoute.value.path),isExactActive:(c==null?void 0:c.isExactActive)??x(()=>i.value===n.currentRoute.value.path),route:(c==null?void 0:c.route)??x(()=>n.resolve(i.value)),async navigate(){await M(b.value,{replace:e.replace,external:g.value||a.value})}}}return B({name:r,props:{to:{type:[String,Object],default:void 0,required:!1},href:{type:[String,Object],default:void 0,required:!1},target:{type:String,default:void 0,required:!1},rel:{type:String,default:void 0,required:!1},noRel:{type:Boolean,default:void 0,required:!1},prefetch:{type:Boolean,default:void 0,required:!1},prefetchOn:{type:[String,Object],default:void 0,required:!1},noPrefetch:{type:Boolean,default:void 0,required:!1},activeClass:{type:String,default:void 0,required:!1},exactActiveClass:{type:String,default:void 0,required:!1},prefetchedClass:{type:String,default:void 0,required:!1},replace:{type:Boolean,default:void 0,required:!1},ariaCurrentValue:{type:String,default:void 0,required:!1},external:{type:Boolean,default:void 0,required:!1},custom:{type:Boolean,default:void 0,required:!1}},useLink:p,setup(e,{slots:n}){const u=S(),{to:a,href:d,navigate:y,isExternal:m,hasTarget:g,isAbsoluteUrl:i}=p(e),c=q(!1),b=q(null),h=o=>{var f;b.value=e.custom?(f=o==null?void 0:o.$el)==null?void 0:f.nextElementSibling:o==null?void 0:o.$el};function k(o){var f,s;return!c.value&&(typeof e.prefetchOn=="string"?e.prefetchOn===o:((f=e.prefetchOn)==null?void 0:f[o])??((s=t.prefetchOn)==null?void 0:s[o]))&&(e.prefetch??t.prefetch)!==!1&&e.noPrefetch!==!0&&e.target!=="_blank"&&!oe()}async function w(o=P()){if(c.value)return;c.value=!0;const f=typeof a.value=="string"?a.value:m.value?L(a.value):u.resolve(a.value).fullPath;await Promise.all([o.hooks.callHook("link:prefetch",f).catch(()=>{}),!m.value&&!g.value&&O(a.value,u).catch(()=>{})])}if(k("visibility")){const o=P();let f,s=null;E(()=>{const v=ae();I(()=>{f=T(()=>{var N;(N=b==null?void 0:b.value)!=null&&N.tagName&&(s=v.observe(b.value,async()=>{s==null||s(),s=null,await w(o)}))})})}),U(()=>{f&&V(f),s==null||s(),s=null})}return()=>{var s;if(!m.value&&!g.value){const v={ref:h,to:a.value,activeClass:e.activeClass||t.activeClass,exactActiveClass:e.exactActiveClass||t.exactActiveClass,replace:e.replace,ariaCurrentValue:e.ariaCurrentValue,custom:e.custom};return e.custom||(k("interaction")&&(v.onPointerenter=w.bind(null,void 0),v.onFocus=w.bind(null,void 0)),c.value&&(v.class=e.prefetchedClass||t.prefetchedClass),v.rel=e.rel||void 0),A(R("RouterLink"),v,n.default)}const o=e.target||null,f=te(e.noRel?"":e.rel,t.externalRelAttribute,i.value||g.value?"noopener noreferrer":"")||null;return e.custom?n.default?n.default({href:d.value,navigate:y,prefetch:w,get route(){if(!d.value)return;const v=new URL(d.value,window.location.href);return{path:v.pathname,fullPath:v.pathname,get query(){return F(v.search)},hash:v.hash,params:{},name:void 0,matched:[],redirectedFrom:void 0,meta:{},href:d.value}},rel:f,target:o,isExternal:m.value||g.value,isActive:!1,isExactActive:!1}):null:A("a",{ref:b,href:d.value||null,rel:f,target:o},(s=n.default)==null?void 0:s.call(n))}}})}const ne=re(H);function z(t,r){const l=r==="append"?G:K;return j(t)&&!t.startsWith("http")?t:l(t,!0)}function ae(){const t=P();if(t._observer)return t._observer;let r=null;const l=new Map,p=(n,u)=>(r||(r=new IntersectionObserver(a=>{for(const d of a){const y=l.get(d.target);(d.isIntersecting||d.intersectionRatio>0)&&y&&y()}})),l.set(n,u),r.observe(n),()=>{l.delete(n),r.unobserve(n),l.size===0&&(r.disconnect(),r=null)});return t._observer={observe:p}}function oe(){const t=navigator.connection;return!!(t&&(t.saveData||/2g/.test(t.effectiveType)))}const ie={class:"antialiased bg-white dark:bg-black dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-black"},se={class:"max-w-520px text-center z-20"},le=["textContent"],ue=["textContent"],ce={class:"flex items-center justify-center w-full"},fe={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:404},statusMessage:{type:String,default:"Not Found"},description:{type:String,default:"Sorry, the page you are looking for could not be found."},backHome:{type:String,default:"Go back home"}},setup(t){const r=t;return ee({title:`${r.statusCode} - ${r.statusMessage} | ${r.appName}`,script:[{children:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver((e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)})).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{children:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}h1,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(l,p)=>{const e=ne;return W(),J("div",ie,[p[0]||(p[0]=_("div",{class:"fixed left-0 right-0 spotlight z-10"},null,-1)),_("div",se,[_("h1",{class:"font-medium mb-8 sm:text-10xl text-8xl",textContent:C(t.statusCode)},null,8,le),_("p",{class:"font-light leading-tight mb-16 px-8 sm:px-0 sm:text-4xl text-xl",textContent:C(t.description)},null,8,ue),_("div",ce,[X(e,{to:"/",class:"cursor-pointer gradient-border px-4 py-2 sm:px-6 sm:py-3 sm:text-xl text-md"},{default:Y(()=>[Z(C(t.backHome),1)]),_:1})])])])}}},ve=Q(fe,[["__scopeId","data-v-28c488d2"]]);export{ve as default};
1
+ import{u as S,d as B,r as q,a as P,o as E,b as I,c as T,e as U,f as V,h as A,g as R,p as F,n as H,i as x,j,k as L,l as D,m as M,q as $,w as G,s as K,_ as Q,t as W,v as J,x as _,y as C,z as X,A as Y,B as Z}from"./CH4m2wxh.js";import{u as ee}from"./B4FhP7a6.js";async function O(t,r=S()){const{path:l,matched:p}=r.resolve(t);if(!p.length||(r._routePreloaded||(r._routePreloaded=new Set),r._routePreloaded.has(l)))return;const e=r._preloadPromises=r._preloadPromises||[];if(e.length>4)return Promise.all(e).then(()=>O(t,r));r._routePreloaded.add(l);const n=p.map(u=>{var a;return(a=u.components)==null?void 0:a.default}).filter(u=>typeof u=="function");for(const u of n){const a=Promise.resolve(u()).catch(()=>{}).finally(()=>e.splice(e.indexOf(a)));e.push(a)}await Promise.all(e)}const te=(...t)=>t.find(r=>r!==void 0);function re(t){const r=t.componentName||"NuxtLink";function l(e,n){if(!e||t.trailingSlash!=="append"&&t.trailingSlash!=="remove")return e;if(typeof e=="string")return z(e,t.trailingSlash);const u="path"in e&&e.path!==void 0?e.path:n(e).path;return{...e,name:void 0,path:z(u,t.trailingSlash)}}function p(e){const n=S(),u=$(),a=x(()=>!!e.target&&e.target!=="_self"),d=x(()=>{const h=e.to||e.href||"";return typeof h=="string"&&j(h,{acceptRelative:!0})}),y=R("RouterLink"),m=y&&typeof y!="string"?y.useLink:void 0,g=x(()=>{if(e.external)return!0;const h=e.to||e.href||"";return typeof h=="object"?!1:h===""||d.value}),i=x(()=>{const h=e.to||e.href||"";return g.value?h:l(h,n.resolve)}),c=g.value||m==null?void 0:m({...e,to:i}),b=x(()=>{var h;if(!i.value||d.value)return i.value;if(g.value){const k=typeof i.value=="object"&&"path"in i.value?L(i.value):i.value,w=typeof k=="object"?n.resolve(k).href:k;return l(w,n.resolve)}return typeof i.value=="object"?((h=n.resolve(i.value))==null?void 0:h.href)??null:l(D(u.app.baseURL,i.value),n.resolve)});return{to:i,hasTarget:a,isAbsoluteUrl:d,isExternal:g,href:b,isActive:(c==null?void 0:c.isActive)??x(()=>i.value===n.currentRoute.value.path),isExactActive:(c==null?void 0:c.isExactActive)??x(()=>i.value===n.currentRoute.value.path),route:(c==null?void 0:c.route)??x(()=>n.resolve(i.value)),async navigate(){await M(b.value,{replace:e.replace,external:g.value||a.value})}}}return B({name:r,props:{to:{type:[String,Object],default:void 0,required:!1},href:{type:[String,Object],default:void 0,required:!1},target:{type:String,default:void 0,required:!1},rel:{type:String,default:void 0,required:!1},noRel:{type:Boolean,default:void 0,required:!1},prefetch:{type:Boolean,default:void 0,required:!1},prefetchOn:{type:[String,Object],default:void 0,required:!1},noPrefetch:{type:Boolean,default:void 0,required:!1},activeClass:{type:String,default:void 0,required:!1},exactActiveClass:{type:String,default:void 0,required:!1},prefetchedClass:{type:String,default:void 0,required:!1},replace:{type:Boolean,default:void 0,required:!1},ariaCurrentValue:{type:String,default:void 0,required:!1},external:{type:Boolean,default:void 0,required:!1},custom:{type:Boolean,default:void 0,required:!1}},useLink:p,setup(e,{slots:n}){const u=S(),{to:a,href:d,navigate:y,isExternal:m,hasTarget:g,isAbsoluteUrl:i}=p(e),c=q(!1),b=q(null),h=o=>{var f;b.value=e.custom?(f=o==null?void 0:o.$el)==null?void 0:f.nextElementSibling:o==null?void 0:o.$el};function k(o){var f,s;return!c.value&&(typeof e.prefetchOn=="string"?e.prefetchOn===o:((f=e.prefetchOn)==null?void 0:f[o])??((s=t.prefetchOn)==null?void 0:s[o]))&&(e.prefetch??t.prefetch)!==!1&&e.noPrefetch!==!0&&e.target!=="_blank"&&!oe()}async function w(o=P()){if(c.value)return;c.value=!0;const f=typeof a.value=="string"?a.value:m.value?L(a.value):u.resolve(a.value).fullPath;await Promise.all([o.hooks.callHook("link:prefetch",f).catch(()=>{}),!m.value&&!g.value&&O(a.value,u).catch(()=>{})])}if(k("visibility")){const o=P();let f,s=null;E(()=>{const v=ae();I(()=>{f=T(()=>{var N;(N=b==null?void 0:b.value)!=null&&N.tagName&&(s=v.observe(b.value,async()=>{s==null||s(),s=null,await w(o)}))})})}),U(()=>{f&&V(f),s==null||s(),s=null})}return()=>{var s;if(!m.value&&!g.value){const v={ref:h,to:a.value,activeClass:e.activeClass||t.activeClass,exactActiveClass:e.exactActiveClass||t.exactActiveClass,replace:e.replace,ariaCurrentValue:e.ariaCurrentValue,custom:e.custom};return e.custom||(k("interaction")&&(v.onPointerenter=w.bind(null,void 0),v.onFocus=w.bind(null,void 0)),c.value&&(v.class=e.prefetchedClass||t.prefetchedClass),v.rel=e.rel||void 0),A(R("RouterLink"),v,n.default)}const o=e.target||null,f=te(e.noRel?"":e.rel,t.externalRelAttribute,i.value||g.value?"noopener noreferrer":"")||null;return e.custom?n.default?n.default({href:d.value,navigate:y,prefetch:w,get route(){if(!d.value)return;const v=new URL(d.value,window.location.href);return{path:v.pathname,fullPath:v.pathname,get query(){return F(v.search)},hash:v.hash,params:{},name:void 0,matched:[],redirectedFrom:void 0,meta:{},href:d.value}},rel:f,target:o,isExternal:m.value||g.value,isActive:!1,isExactActive:!1}):null:A("a",{ref:b,href:d.value||null,rel:f,target:o},(s=n.default)==null?void 0:s.call(n))}}})}const ne=re(H);function z(t,r){const l=r==="append"?G:K;return j(t)&&!t.startsWith("http")?t:l(t,!0)}function ae(){const t=P();if(t._observer)return t._observer;let r=null;const l=new Map,p=(n,u)=>(r||(r=new IntersectionObserver(a=>{for(const d of a){const y=l.get(d.target);(d.isIntersecting||d.intersectionRatio>0)&&y&&y()}})),l.set(n,u),r.observe(n),()=>{l.delete(n),r.unobserve(n),l.size===0&&(r.disconnect(),r=null)});return t._observer={observe:p}}function oe(){const t=navigator.connection;return!!(t&&(t.saveData||/2g/.test(t.effectiveType)))}const ie={class:"antialiased bg-white dark:bg-black dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-black"},se={class:"max-w-520px text-center z-20"},le=["textContent"],ue=["textContent"],ce={class:"flex items-center justify-center w-full"},fe={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:404},statusMessage:{type:String,default:"Not Found"},description:{type:String,default:"Sorry, the page you are looking for could not be found."},backHome:{type:String,default:"Go back home"}},setup(t){const r=t;return ee({title:`${r.statusCode} - ${r.statusMessage} | ${r.appName}`,script:[{children:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver((e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)})).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{children:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}h1,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(l,p)=>{const e=ne;return W(),J("div",ie,[p[0]||(p[0]=_("div",{class:"fixed left-0 right-0 spotlight z-10"},null,-1)),_("div",se,[_("h1",{class:"font-medium mb-8 sm:text-10xl text-8xl",textContent:C(t.statusCode)},null,8,le),_("p",{class:"font-light leading-tight mb-16 px-8 sm:px-0 sm:text-4xl text-xl",textContent:C(t.description)},null,8,ue),_("div",ce,[X(e,{to:"/",class:"cursor-pointer gradient-border px-4 py-2 sm:px-6 sm:py-3 sm:text-xl text-md"},{default:Y(()=>[Z(C(t.backHome),1)]),_:1})])])])}}},ve=Q(fe,[["__scopeId","data-v-28c488d2"]]);export{ve as default};
@@ -1,2 +1,2 @@
1
- import{d as K,t as z,v as T,J as W,r as ne,E as xe,i as X,I as Ne,K as Ae,L as G,M as Se,N as Pe,O as $,x as O,P as Ee,Q as ze,R as j,S as R,y as J,T as We,U as Ue,V as ee,W as ye,z as q,A as de,B as Fe,X as Re,_ as Je}from"./CaoFd9E8.js";const De=K({__name:"NIcon",props:{icon:{}},setup(i){return(e,t)=>(z(),T("div",{class:W(["n-icon",e.icon])},null,2))}});typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Qe=i=>typeof i<"u";function Ge(i){return JSON.parse(JSON.stringify(i))}function Ve(i,e,t,o={}){var n,r,a;const{clone:u=!1,passive:l=!1,eventName:s,deep:c=!1,defaultValue:f,shouldEmit:h}=o,d=Ne(),y=t||(d==null?void 0:d.emit)||((n=d==null?void 0:d.$emit)==null?void 0:n.bind(d))||((a=(r=d==null?void 0:d.proxy)==null?void 0:r.$emit)==null?void 0:a.bind(d==null?void 0:d.proxy));let v=s;e||(e="modelValue"),v=v||`update:${e.toString()}`;const m=p=>u?typeof u=="function"?u(p):Ge(p):p,g=()=>Qe(i[e])?m(i[e]):f,x=p=>{h?h(p)&&y(v,p):y(v,p)};if(l){const p=g(),A=ne(p);let _=!1;return xe(()=>i[e],S=>{_||(_=!0,A.value=m(S),Ae(()=>_=!1))}),xe(A,S=>{!_&&(S!==i[e]||c)&&x(S)},{deep:c}),A}else return X({get(){return g()},set(p){x(p)}})}const Ke={class:"n-text-input flex flex items-center border n-border-base rounded py-1 pl-1 pr-2 focus-within:n-focus-base focus-within:border-context n-bg-base"},Xe=K({__name:"NTextInput",props:{modelValue:{default:""},icon:{},placeholder:{},disabled:{type:Boolean},autofocus:{type:Boolean},autocomplete:{},readonly:{type:Boolean},type:{default:"text"}},setup(i,{emit:e}){const n=Ve(i,"modelValue",e,{passive:!0});return(r,a)=>{const u=De;return z(),T("div",Ke,[G(r.$slots,"icon",{},()=>[r.icon?(z(),j(u,{key:0,icon:r.icon,class:"ml-0.3em mr-0.1em text-1.1em op50"},null,8,["icon"])):R("",!0)]),Se(O("input",Ee({"onUpdate:modelValue":a[0]||(a[0]=l=>ze(n)?n.value=l:null)},r.$props,{class:"ml-0.4em w-full flex-auto n-bg-base !outline-none"}),null,16),[[Pe,$(n)]])])}}}),Me=K({__name:"Tag",props:{green:{type:Boolean},orange:{type:Boolean},text:{}},setup(i){const e=i,t=X(()=>e.green?"bg-green-400:10 text-green-400":e.orange?"bg-orange-400:10 text-orange-400":"bg-gray-400:10 text-gray");return(o,n)=>(z(),T("span",{class:W(["mx-0.5 select-none whitespace-nowrap rounded px-1.5 py-0.5 text-xs inline-block",$(t)])},J(o.text),3))}});let Z;const te=[];function Oe(i){if(te.push(i),!(typeof window>"u"))return window.__NUXT_DEVTOOLS__&&te.forEach(e=>e(window.__NUXT_DEVTOOLS__)),Object.defineProperty(window,"__NUXT_DEVTOOLS__",{set(e){e&&te.forEach(t=>t(e))},get(){return Z.value},configurable:!0}),()=>{te.splice(te.indexOf(i),1)}}function He(){Z||(Z=We(),Oe(e));function i(){Ue(Z)}function e(t){Z.value=t,t.host&&t.host.hooks.hook("host:update:reactivity",i)}return Z}const Ye=He(),Ze=["innerHTML"],qe={class:"shiki"},je=["textContent"],et=K({__name:"NCodeBlock",props:{code:{},lang:{},lines:{type:Boolean,default:!0},transformRendered:{}},emits:["loaded"],setup(i,{emit:e}){const t=i,o=e,n=X(()=>{var a;const r=t.lang==="text"?{code:t.code,supported:!1}:((a=Ye.value)==null?void 0:a.devtools.renderCodeHighlight(t.code,t.lang))||{code:t.code,supported:!1};return r.supported&&t.transformRendered&&(r.code=t.transformRendered(r.code)),r.supported&&Ae(()=>o("loaded")),r});return(r,a)=>r.lang&&n.value.supported?(z(),T("pre",{key:0,class:W(["n-code-block",r.lines?"n-code-block-lines":""]),innerHTML:n.value.code},null,10,Ze)):(z(),T("pre",{key:1,class:W(["n-code-block",r.lines?"n-code-block-lines":""])},[O("pre",qe,[O("code",null,[(z(!0),T(ee,null,ye(r.code.split(`
1
+ import{d as K,t as z,v as T,J as W,r as ne,E as xe,i as X,I as Ne,K as Ae,L as G,M as Se,N as Pe,O as $,x as O,P as Ee,Q as ze,R as j,S as R,y as J,T as We,U as Ue,V as ee,W as ye,z as q,A as de,B as Fe,X as Re,_ as Je}from"./CH4m2wxh.js";const De=K({__name:"NIcon",props:{icon:{}},setup(i){return(e,t)=>(z(),T("div",{class:W(["n-icon",e.icon])},null,2))}});typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Qe=i=>typeof i<"u";function Ge(i){return JSON.parse(JSON.stringify(i))}function Ve(i,e,t,o={}){var n,r,a;const{clone:u=!1,passive:l=!1,eventName:s,deep:c=!1,defaultValue:f,shouldEmit:h}=o,d=Ne(),y=t||(d==null?void 0:d.emit)||((n=d==null?void 0:d.$emit)==null?void 0:n.bind(d))||((a=(r=d==null?void 0:d.proxy)==null?void 0:r.$emit)==null?void 0:a.bind(d==null?void 0:d.proxy));let v=s;e||(e="modelValue"),v=v||`update:${e.toString()}`;const m=p=>u?typeof u=="function"?u(p):Ge(p):p,g=()=>Qe(i[e])?m(i[e]):f,x=p=>{h?h(p)&&y(v,p):y(v,p)};if(l){const p=g(),A=ne(p);let _=!1;return xe(()=>i[e],S=>{_||(_=!0,A.value=m(S),Ae(()=>_=!1))}),xe(A,S=>{!_&&(S!==i[e]||c)&&x(S)},{deep:c}),A}else return X({get(){return g()},set(p){x(p)}})}const Ke={class:"n-text-input flex flex items-center border n-border-base rounded py-1 pl-1 pr-2 focus-within:n-focus-base focus-within:border-context n-bg-base"},Xe=K({__name:"NTextInput",props:{modelValue:{default:""},icon:{},placeholder:{},disabled:{type:Boolean},autofocus:{type:Boolean},autocomplete:{},readonly:{type:Boolean},type:{default:"text"}},setup(i,{emit:e}){const n=Ve(i,"modelValue",e,{passive:!0});return(r,a)=>{const u=De;return z(),T("div",Ke,[G(r.$slots,"icon",{},()=>[r.icon?(z(),j(u,{key:0,icon:r.icon,class:"ml-0.3em mr-0.1em text-1.1em op50"},null,8,["icon"])):R("",!0)]),Se(O("input",Ee({"onUpdate:modelValue":a[0]||(a[0]=l=>ze(n)?n.value=l:null)},r.$props,{class:"ml-0.4em w-full flex-auto n-bg-base !outline-none"}),null,16),[[Pe,$(n)]])])}}}),Me=K({__name:"Tag",props:{green:{type:Boolean},orange:{type:Boolean},text:{}},setup(i){const e=i,t=X(()=>e.green?"bg-green-400:10 text-green-400":e.orange?"bg-orange-400:10 text-orange-400":"bg-gray-400:10 text-gray");return(o,n)=>(z(),T("span",{class:W(["mx-0.5 select-none whitespace-nowrap rounded px-1.5 py-0.5 text-xs inline-block",$(t)])},J(o.text),3))}});let Z;const te=[];function Oe(i){if(te.push(i),!(typeof window>"u"))return window.__NUXT_DEVTOOLS__&&te.forEach(e=>e(window.__NUXT_DEVTOOLS__)),Object.defineProperty(window,"__NUXT_DEVTOOLS__",{set(e){e&&te.forEach(t=>t(e))},get(){return Z.value},configurable:!0}),()=>{te.splice(te.indexOf(i),1)}}function He(){Z||(Z=We(),Oe(e));function i(){Ue(Z)}function e(t){Z.value=t,t.host&&t.host.hooks.hook("host:update:reactivity",i)}return Z}const Ye=He(),Ze=["innerHTML"],qe={class:"shiki"},je=["textContent"],et=K({__name:"NCodeBlock",props:{code:{},lang:{},lines:{type:Boolean,default:!0},transformRendered:{}},emits:["loaded"],setup(i,{emit:e}){const t=i,o=e,n=X(()=>{var a;const r=t.lang==="text"?{code:t.code,supported:!1}:((a=Ye.value)==null?void 0:a.devtools.renderCodeHighlight(t.code,t.lang))||{code:t.code,supported:!1};return r.supported&&t.transformRendered&&(r.code=t.transformRendered(r.code)),r.supported&&Ae(()=>o("loaded")),r});return(r,a)=>r.lang&&n.value.supported?(z(),T("pre",{key:0,class:W(["n-code-block",r.lines?"n-code-block-lines":""]),innerHTML:n.value.code},null,10,Ze)):(z(),T("pre",{key:1,class:W(["n-code-block",r.lines?"n-code-block-lines":""])},[O("pre",qe,[O("code",null,[(z(!0),T(ee,null,ye(r.code.split(`
2
2
  `),(u,l)=>(z(),T(ee,{key:l},[O("span",{class:"line",textContent:J(u)},null,8,je),a[0]||(a[0]=O("br",null,null,-1))],64))),128))])])],2))}}),tt={flex:"~ gap-3","items-center":""},rt=K({__name:"NIconTitle",props:{icon:{},text:{}},setup(i){return(e,t)=>(z(),T("div",tt,[e.icon?(z(),T("div",{key:0,class:W(e.icon)},null,2)):R("",!0),G(e.$slots,"default",{},()=>[O("div",null,J(e.text),1)])]))}}),nt=["open"],it={"text-base":""},ot={key:0,"text-sm":"",op50:""},at=K({__name:"NSectionBlock",props:{icon:{},text:{},description:{},containerClass:{default:""},headerClass:{},collapse:{type:Boolean,default:!0},open:{type:Boolean,default:!0},padding:{type:[Boolean,String],default:!0}},setup(i){const t=Ve(i,"open",void 0,{passive:!0});function o(n){t.value=n.target.open}return(n,r)=>{const a=De,u=rt;return z(),T(ee,null,[O("details",{open:$(t),onToggle:r[0]||(r[0]=(...l)=>o&&o(...l))},[O("summary",{class:W(["cursor-pointer select-none hover:bg-active p4",n.collapse?"":"pointer-events-none"])},[q(u,{icon:n.icon,text:n.text,"text-xl":"",transition:"",class:W([$(t)?"op100":"op60",n.headerClass])},{default:de(()=>[O("div",null,[O("div",it,[G(n.$slots,"text",{},()=>[Fe(J(n.text),1)],!0)]),n.description||n.$slots.description?(z(),T("div",ot,[G(n.$slots,"description",{},()=>[Fe(J(n.description),1)],!0)])):R("",!0)]),r[1]||(r[1]=O("div",{class:"flex-auto"},null,-1)),G(n.$slots,"actions",{},void 0,!0),n.collapse?(z(),j(a,{key:0,icon:"carbon-chevron-down",class:"chevron","cursor-pointer":"","place-self-start":"","text-base":"",op75:"",transition:"","duration-500":""})):R("",!0)]),_:3},8,["icon","text","class"])],2),r._lazyshow1||$(t)?(r._lazyshow1=!0,z(),T(ee,null,[Se(O("div",{class:W(["flex flex-col flex-gap2 pb6 pt2",typeof n.padding=="string"?n.padding:n.padding?"px4":""])},[G(n.$slots,"details",{},void 0,!0),O("div",{class:W([n.containerClass,"mt1"])},[G(n.$slots,"default",{},void 0,!0)],2),G(n.$slots,"footer",{},void 0,!0)],2),[[Re,$(t)]])],64)):R("v-show-if",!0)],40,nt),r[2]||(r[2]=O("div",{class:"x-divider"},null,-1))],64)}}}),ut=Je(at,[["__scopeId","data-v-c51ec814"]]),lt={class:"h-full of-auto p2"},st={class:"p5"},ct={class:"font-mono mb4 font-bold text-3xl"},ft={key:0,class:"mb3"},dt=["href"],ht={key:0,class:"font-mono bg-red-900 text-red-100 p2"},vt=K({__name:"DocumentDetail",props:{id:{},content:{},isValid:{type:Boolean},errors:{},filename:{},relativePath:{},name:{},operation:{},serverApiPrefix:{}},setup(i){const e=i,t=X(()=>(e.errors||[]).map(n=>n.message)),o=X(()=>{if(e.operation)return`${e.serverApiPrefix}/${e.operation}/${e.name}`});return(n,r)=>{const a=Me,u=et,l=ut;return z(),T("div",lt,[O("div",st,[O("h2",ct,J(n.name),1),$(o)?(z(),T("div",ft,[n.operation==="query"?(z(),j(a,{key:0,green:"",text:"GET"})):(z(),j(a,{key:1,orange:"",text:"POST"})),O("a",{class:"n-transition n-link n-link-base hover:n-link-hover ml2",target:"_blank",href:$(o)},J($(o)),9,dt)])):R("",!0)]),q(l,{text:"Document",description:n.relativePath,padding:"px4"},{default:de(()=>[q(u,{code:n.content,lang:"graphql"},null,8,["code"])]),_:1},8,["description"]),q(l,{text:"Errors",description:$(t).length+" errors",padding:"px4"},{default:de(()=>[$(t).length?(z(),T("div",ht,[(z(!0),T(ee,null,ye($(t),(s,c)=>(z(),T("div",{key:c},J(s),1))),128))])):R("",!0)]),_:1},8,["description"])])}}});var M=function(){return M=Object.assign||function(e){for(var t,o=1,n=arguments.length;o<n;o++){t=arguments[o];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},M.apply(this,arguments)};function pt(i,e,t,o){function n(r){return r instanceof t?r:new t(function(a){a(r)})}return new(t||(t=Promise))(function(r,a){function u(c){try{s(o.next(c))}catch(f){a(f)}}function l(c){try{s(o.throw(c))}catch(f){a(f)}}function s(c){c.done?r(c.value):n(c.value).then(u,l)}s((o=o.apply(i,[])).next())})}function yt(i,e){var t={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},o,n,r,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(s){return function(c){return l([s,c])}}function l(s){if(o)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(t=0)),t;)try{if(o=1,n&&(r=s[0]&2?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[s[0]&2,r.value]),s[0]){case 0:case 1:r=s;break;case 4:return t.label++,{value:s[1],done:!1};case 5:t.label++,n=s[1],s=[0];continue;case 7:s=t.ops.pop(),t.trys.pop();continue;default:if(r=t.trys,!(r=r.length>0&&r[r.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!r||s[1]>r[0]&&s[1]<r[3])){t.label=s[1];break}if(s[0]===6&&t.label<r[1]){t.label=r[1],r=s;break}if(r&&t.label<r[2]){t.label=r[2],t.ops.push(s);break}r[2]&&t.ops.pop(),t.trys.pop();continue}s=e.call(i,t)}catch(c){s=[6,c],n=0}finally{o=r=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function F(i){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&i[e],o=0;if(t)return t.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&o>=i.length&&(i=void 0),{value:i&&i[o++],done:!i}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function B(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var o=t.call(i),n,r=[],a;try{for(;(e===void 0||e-- >0)&&!(n=o.next()).done;)r.push(n.value)}catch(u){a={error:u}}finally{try{n&&!n.done&&(t=o.return)&&t.call(o)}finally{if(a)throw a.error}}return r}var mt="ENTRIES",ke="KEYS",Le="VALUES",I="",ae=function(){function i(e,t){var o=e._tree,n=Array.from(o.keys());this.set=e,this._type=t,this._path=n.length>0?[{node:o,keys:n}]:[]}return i.prototype.next=function(){var e=this.dive();return this.backtrack(),e},i.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var e=Y(this._path),t=e.node,o=e.keys;if(Y(o)===I)return{done:!1,value:this.result()};var n=t.get(Y(o));return this._path.push({node:n,keys:Array.from(n.keys())}),this.dive()},i.prototype.backtrack=function(){if(this._path.length!==0){var e=Y(this._path).keys;e.pop(),!(e.length>0)&&(this._path.pop(),this.backtrack())}},i.prototype.key=function(){return this.set._prefix+this._path.map(function(e){var t=e.keys;return Y(t)}).filter(function(e){return e!==I}).join("")},i.prototype.value=function(){return Y(this._path).node.get(I)},i.prototype.result=function(){switch(this._type){case Le:return this.value();case ke:return this.key();default:return[this.key(),this.value()]}},i.prototype[Symbol.iterator]=function(){return this},i}(),Y=function(i){return i[i.length-1]},gt=function(i,e,t){var o=new Map;if(e===void 0)return o;for(var n=e.length+1,r=n+t,a=new Uint8Array(r*n).fill(t+1),u=0;u<n;++u)a[u]=u;for(var l=1;l<r;++l)a[l*n]=l;return Be(i,e,t,o,a,1,n,""),o},Be=function(i,e,t,o,n,r,a,u){var l,s,c=r*a;try{e:for(var f=F(i.keys()),h=f.next();!h.done;h=f.next()){var d=h.value;if(d===I){var y=n[c-1];y<=t&&o.set(u,[i.get(d),y])}else{for(var v=r,m=0;m<d.length;++m,++v){for(var g=d[m],x=a*v,p=x-a,A=n[x],_=Math.max(0,v-t-1),S=Math.min(a-1,v+t),w=_;w<S;++w){var C=g!==e[w],E=n[p+w]+ +C,D=n[p+w+1]+1,k=n[x+w]+1,b=n[x+w+1]=Math.min(E,D,k);b<A&&(A=b)}if(A>t)continue e}Be(i.get(d),e,t,o,n,v,a,u+d)}}}catch(L){l={error:L}}finally{try{h&&!h.done&&(s=f.return)&&s.call(f)}finally{if(l)throw l.error}}},ue=function(){function i(e,t){e===void 0&&(e=new Map),t===void 0&&(t=""),this._size=void 0,this._tree=e,this._prefix=t}return i.prototype.atPrefix=function(e){var t,o;if(!e.startsWith(this._prefix))throw new Error("Mismatched prefix");var n=B(oe(this._tree,e.slice(this._prefix.length)),2),r=n[0],a=n[1];if(r===void 0){var u=B(me(a),2),l=u[0],s=u[1];try{for(var c=F(l.keys()),f=c.next();!f.done;f=c.next()){var h=f.value;if(h!==I&&h.startsWith(s)){var d=new Map;return d.set(h.slice(s.length),l.get(h)),new i(d,e)}}}catch(y){t={error:y}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(t)throw t.error}}}return new i(r,e)},i.prototype.clear=function(){this._size=void 0,this._tree.clear()},i.prototype.delete=function(e){return this._size=void 0,xt(this._tree,e)},i.prototype.entries=function(){return new ae(this,mt)},i.prototype.forEach=function(e){var t,o;try{for(var n=F(this),r=n.next();!r.done;r=n.next()){var a=B(r.value,2),u=a[0],l=a[1];e(u,l,this)}}catch(s){t={error:s}}finally{try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}},i.prototype.fuzzyGet=function(e,t){return gt(this._tree,e,t)},i.prototype.get=function(e){var t=he(this._tree,e);return t!==void 0?t.get(I):void 0},i.prototype.has=function(e){var t=he(this._tree,e);return t!==void 0&&t.has(I)},i.prototype.keys=function(){return new ae(this,ke)},i.prototype.set=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var o=le(this._tree,e);return o.set(I,t),this},Object.defineProperty(i.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var e=this.entries();!e.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),i.prototype.update=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var o=le(this._tree,e);return o.set(I,t(o.get(I))),this},i.prototype.fetch=function(e,t){if(typeof e!="string")throw new Error("key must be a string");this._size=void 0;var o=le(this._tree,e),n=o.get(I);return n===void 0&&o.set(I,n=t()),n},i.prototype.values=function(){return new ae(this,Le)},i.prototype[Symbol.iterator]=function(){return this.entries()},i.from=function(e){var t,o,n=new i;try{for(var r=F(e),a=r.next();!a.done;a=r.next()){var u=B(a.value,2),l=u[0],s=u[1];n.set(l,s)}}catch(c){t={error:c}}finally{try{a&&!a.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}return n},i.fromObject=function(e){return i.from(Object.entries(e))},i}(),oe=function(i,e,t){var o,n;if(t===void 0&&(t=[]),e.length===0||i==null)return[i,t];try{for(var r=F(i.keys()),a=r.next();!a.done;a=r.next()){var u=a.value;if(u!==I&&e.startsWith(u))return t.push([i,u]),oe(i.get(u),e.slice(u.length),t)}}catch(l){o={error:l}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return t.push([i,e]),oe(void 0,"",t)},he=function(i,e){var t,o;if(e.length===0||i==null)return i;try{for(var n=F(i.keys()),r=n.next();!r.done;r=n.next()){var a=r.value;if(a!==I&&e.startsWith(a))return he(i.get(a),e.slice(a.length))}}catch(u){t={error:u}}finally{try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}},le=function(i,e){var t,o,n=e.length;e:for(var r=0;i&&r<n;){try{for(var a=(t=void 0,F(i.keys())),u=a.next();!u.done;u=a.next()){var l=u.value;if(l!==I&&e[r]===l[0]){for(var s=Math.min(n-r,l.length),c=1;c<s&&e[r+c]===l[c];)++c;var f=i.get(l);if(c===l.length)i=f;else{var h=new Map;h.set(l.slice(c),f),i.set(e.slice(r,r+c),h),i.delete(l),i=h}r+=c;continue e}}}catch(y){t={error:y}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(t)throw t.error}}var d=new Map;return i.set(e.slice(r),d),d}return i},xt=function(i,e){var t=B(oe(i,e),2),o=t[0],n=t[1];if(o!==void 0){if(o.delete(I),o.size===0)Te(n);else if(o.size===1){var r=B(o.entries().next().value,2),a=r[0],u=r[1];Ie(n,a,u)}}},Te=function(i){if(i.length!==0){var e=B(me(i),2),t=e[0],o=e[1];if(t.delete(o),t.size===0)Te(i.slice(0,-1));else if(t.size===1){var n=B(t.entries().next().value,2),r=n[0],a=n[1];r!==I&&Ie(i.slice(0,-1),r,a)}}},Ie=function(i,e,t){if(i.length!==0){var o=B(me(i),2),n=o[0],r=o[1];n.set(r+e,t),n.delete(r)}},me=function(i){return i[i.length-1]},re,ge="or",$e="and",Ft="and_not",wt=function(){function i(e){if((e==null?void 0:e.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');var t=e.autoVacuum==null||e.autoVacuum===!0?fe:e.autoVacuum;this._options=M(M(M({},ce),e),{autoVacuum:t,searchOptions:M(M({},we),e.searchOptions||{}),autoSuggestOptions:M(M({},St),e.autoSuggestOptions||{})}),this._index=new ue,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=pe,this.addFields(this._options.fields)}return i.prototype.add=function(e){var t,o,n,r,a,u,l=this._options,s=l.extractField,c=l.tokenize,f=l.processTerm,h=l.fields,d=l.idField,y=s(e,d);if(y==null)throw new Error('MiniSearch: document does not have ID field "'.concat(d,'"'));if(this._idToShortId.has(y))throw new Error("MiniSearch: duplicate ID ".concat(y));var v=this.addDocumentId(y);this.saveStoredFields(v,e);try{for(var m=F(h),g=m.next();!g.done;g=m.next()){var x=g.value,p=s(e,x);if(p!=null){var A=c(p.toString(),x),_=this._fieldIds[x],S=new Set(A).size;this.addFieldLength(v,_,this._documentCount-1,S);try{for(var w=(n=void 0,F(A)),C=w.next();!C.done;C=w.next()){var E=C.value,D=f(E,x);if(Array.isArray(D))try{for(var k=(a=void 0,F(D)),b=k.next();!b.done;b=k.next()){var L=b.value;this.addTerm(_,v,L)}}catch(V){a={error:V}}finally{try{b&&!b.done&&(u=k.return)&&u.call(k)}finally{if(a)throw a.error}}else D&&this.addTerm(_,v,D)}}catch(V){n={error:V}}finally{try{C&&!C.done&&(r=w.return)&&r.call(w)}finally{if(n)throw n.error}}}}}catch(V){t={error:V}}finally{try{g&&!g.done&&(o=m.return)&&o.call(m)}finally{if(t)throw t.error}}},i.prototype.addAll=function(e){var t,o;try{for(var n=F(e),r=n.next();!r.done;r=n.next()){var a=r.value;this.add(a)}}catch(u){t={error:u}}finally{try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}},i.prototype.addAllAsync=function(e,t){var o=this;t===void 0&&(t={});var n=t.chunkSize,r=n===void 0?10:n,a={chunk:[],promise:Promise.resolve()},u=e.reduce(function(c,f,h){var d=c.chunk,y=c.promise;return d.push(f),(h+1)%r===0?{chunk:[],promise:y.then(function(){return new Promise(function(v){return setTimeout(v,0)})}).then(function(){return o.addAll(d)})}:{chunk:d,promise:y}},a),l=u.chunk,s=u.promise;return s.then(function(){return o.addAll(l)})},i.prototype.remove=function(e){var t,o,n,r,a,u,l=this._options,s=l.tokenize,c=l.processTerm,f=l.extractField,h=l.fields,d=l.idField,y=f(e,d);if(y==null)throw new Error('MiniSearch: document does not have ID field "'.concat(d,'"'));var v=this._idToShortId.get(y);if(v==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(y,": it is not in the index"));try{for(var m=F(h),g=m.next();!g.done;g=m.next()){var x=g.value,p=f(e,x);if(p!=null){var A=s(p.toString(),x),_=this._fieldIds[x],S=new Set(A).size;this.removeFieldLength(v,_,this._documentCount,S);try{for(var w=(n=void 0,F(A)),C=w.next();!C.done;C=w.next()){var E=C.value,D=c(E,x);if(Array.isArray(D))try{for(var k=(a=void 0,F(D)),b=k.next();!b.done;b=k.next()){var L=b.value;this.removeTerm(_,v,L)}}catch(V){a={error:V}}finally{try{b&&!b.done&&(u=k.return)&&u.call(k)}finally{if(a)throw a.error}}else D&&this.removeTerm(_,v,D)}}catch(V){n={error:V}}finally{try{C&&!C.done&&(r=w.return)&&r.call(w)}finally{if(n)throw n.error}}}}}catch(V){t={error:V}}finally{try{g&&!g.done&&(o=m.return)&&o.call(m)}finally{if(t)throw t.error}}this._storedFields.delete(v),this._documentIds.delete(v),this._idToShortId.delete(y),this._fieldLength.delete(v),this._documentCount-=1},i.prototype.removeAll=function(e){var t,o;if(e)try{for(var n=F(e),r=n.next();!r.done;r=n.next()){var a=r.value;this.remove(a)}}catch(u){t={error:u}}finally{try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new ue,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},i.prototype.discard=function(e){var t=this,o=this._idToShortId.get(e);if(o==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(e,": it is not in the index"));this._idToShortId.delete(e),this._documentIds.delete(o),this._storedFields.delete(o),(this._fieldLength.get(o)||[]).forEach(function(n,r){t.removeFieldLength(o,r,t._documentCount,n)}),this._fieldLength.delete(o),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},i.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var e=this._options.autoVacuum,t=e.minDirtFactor,o=e.minDirtCount,n=e.batchSize,r=e.batchWait;this.conditionalVacuum({batchSize:n,batchWait:r},{minDirtCount:o,minDirtFactor:t})}},i.prototype.discardAll=function(e){var t,o,n=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var r=F(e),a=r.next();!a.done;a=r.next()){var u=a.value;this.discard(u)}}catch(l){t={error:l}}finally{try{a&&!a.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}}finally{this._options.autoVacuum=n}this.maybeAutoVacuum()},i.prototype.replace=function(e){var t=this._options,o=t.idField,n=t.extractField,r=n(e,o);this.discard(r),this.add(e)},i.prototype.vacuum=function(e){return e===void 0&&(e={}),this.conditionalVacuum(e)},i.prototype.conditionalVacuum=function(e,t){var o=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var n=o._enqueuedVacuumConditions;return o._enqueuedVacuumConditions=pe,o.performVacuuming(e,n)}),this._enqueuedVacuum)):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(e),this._currentVacuum)},i.prototype.performVacuuming=function(e,t){return pt(this,void 0,void 0,function(){var o,n,r,a,u,l,s,c,f,h,d,y,v,m,g,x,p,A,_,S,w,C,E,D,k;return yt(this,function(b){switch(b.label){case 0:if(o=this._dirtCount,!this.vacuumConditionsMet(t))return[3,10];n=e.batchSize||ve.batchSize,r=e.batchWait||ve.batchWait,a=1,b.label=1;case 1:b.trys.push([1,7,8,9]),u=F(this._index),l=u.next(),b.label=2;case 2:if(l.done)return[3,6];s=B(l.value,2),c=s[0],f=s[1];try{for(h=(C=void 0,F(f)),d=h.next();!d.done;d=h.next()){y=B(d.value,2),v=y[0],m=y[1];try{for(g=(D=void 0,F(m)),x=g.next();!x.done;x=g.next())p=B(x.value,1),A=p[0],!this._documentIds.has(A)&&(m.size<=1?f.delete(v):m.delete(A))}catch(L){D={error:L}}finally{try{x&&!x.done&&(k=g.return)&&k.call(g)}finally{if(D)throw D.error}}}}catch(L){C={error:L}}finally{try{d&&!d.done&&(E=h.return)&&E.call(h)}finally{if(C)throw C.error}}return this._index.get(c).size===0&&this._index.delete(c),a%n!==0?[3,4]:[4,new Promise(function(L){return setTimeout(L,r)})];case 3:b.sent(),b.label=4;case 4:a+=1,b.label=5;case 5:return l=u.next(),[3,2];case 6:return[3,9];case 7:return _=b.sent(),S={error:_},[3,9];case 8:try{l&&!l.done&&(w=u.return)&&w.call(u)}finally{if(S)throw S.error}return[7];case 9:this._dirtCount-=o,b.label=10;case 10:return[4,null];case 11:return b.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},i.prototype.vacuumConditionsMet=function(e){if(e==null)return!0;var t=e.minDirtCount,o=e.minDirtFactor;return t=t||fe.minDirtCount,o=o||fe.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=o},Object.defineProperty(i.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),i.prototype.has=function(e){return this._idToShortId.has(e)},i.prototype.getStoredFields=function(e){var t=this._idToShortId.get(e);if(t!=null)return this._storedFields.get(t)},i.prototype.search=function(e,t){var o,n;t===void 0&&(t={});var r=this.executeQuery(e,t),a=[];try{for(var u=F(r),l=u.next();!l.done;l=u.next()){var s=B(l.value,2),c=s[0],f=s[1],h=f.score,d=f.terms,y=f.match,v=d.length||1,m={id:this._documentIds.get(c),score:h*v,terms:Object.keys(y),queryTerms:d,match:y};Object.assign(m,this._storedFields.get(c)),(t.filter==null||t.filter(m))&&a.push(m)}}catch(g){o={error:g}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(o)throw o.error}}return e===i.wildcard&&t.boostDocument==null&&this._options.searchOptions.boostDocument==null||a.sort(_e),a},i.prototype.autoSuggest=function(e,t){var o,n,r,a;t===void 0&&(t={}),t=M(M({},this._options.autoSuggestOptions),t);var u=new Map;try{for(var l=F(this.search(e,t)),s=l.next();!s.done;s=l.next()){var c=s.value,f=c.score,h=c.terms,d=h.join(" "),y=u.get(d);y!=null?(y.score+=f,y.count+=1):u.set(d,{score:f,terms:h,count:1})}}catch(_){o={error:_}}finally{try{s&&!s.done&&(n=l.return)&&n.call(l)}finally{if(o)throw o.error}}var v=[];try{for(var m=F(u),g=m.next();!g.done;g=m.next()){var x=B(g.value,2),y=x[0],p=x[1],f=p.score,h=p.terms,A=p.count;v.push({suggestion:y,terms:h,score:f/A})}}catch(_){r={error:_}}finally{try{g&&!g.done&&(a=m.return)&&a.call(m)}finally{if(r)throw r.error}}return v.sort(_e),v},Object.defineProperty(i.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),i.loadJSON=function(e,t){if(t==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(e),t)},i.getDefault=function(e){if(ce.hasOwnProperty(e))return se(ce,e);throw new Error('MiniSearch: unknown option "'.concat(e,'"'))},i.loadJS=function(e,t){var o,n,r,a,u,l,s=e.index,c=e.documentCount,f=e.nextId,h=e.documentIds,d=e.fieldIds,y=e.fieldLength,v=e.averageFieldLength,m=e.storedFields,g=e.dirtCount,x=e.serializationVersion;if(x!==1&&x!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var p=new i(t);p._documentCount=c,p._nextId=f,p._documentIds=ie(h),p._idToShortId=new Map,p._fieldIds=d,p._fieldLength=ie(y),p._avgFieldLength=v,p._storedFields=ie(m),p._dirtCount=g||0,p._index=new ue;try{for(var A=F(p._documentIds),_=A.next();!_.done;_=A.next()){var S=B(_.value,2),w=S[0],C=S[1];p._idToShortId.set(C,w)}}catch(U){o={error:U}}finally{try{_&&!_.done&&(n=A.return)&&n.call(A)}finally{if(o)throw o.error}}try{for(var E=F(s),D=E.next();!D.done;D=E.next()){var k=B(D.value,2),b=k[0],L=k[1],V=new Map;try{for(var P=(u=void 0,F(Object.keys(L))),N=P.next();!N.done;N=P.next()){var Q=N.value,H=L[Q];x===1&&(H=H.ds),V.set(parseInt(Q,10),ie(H))}}catch(U){u={error:U}}finally{try{N&&!N.done&&(l=P.return)&&l.call(P)}finally{if(u)throw u.error}}p._index.set(b,V)}}catch(U){r={error:U}}finally{try{D&&!D.done&&(a=E.return)&&a.call(E)}finally{if(r)throw r.error}}return p},i.prototype.executeQuery=function(e,t){var o=this;if(t===void 0&&(t={}),e===i.wildcard)return this.executeWildcardQuery(t);if(typeof e!="string"){var n=M(M(M({},t),e),{queries:void 0}),r=e.queries.map(function(m){return o.executeQuery(m,n)});return this.combineResults(r,n.combineWith)}var a=this._options,u=a.tokenize,l=a.processTerm,s=a.searchOptions,c=M(M({tokenize:u,processTerm:l},s),t),f=c.tokenize,h=c.processTerm,d=f(e).flatMap(function(m){return h(m)}).filter(function(m){return!!m}),y=d.map(At(c)),v=y.map(function(m){return o.executeQuerySpec(m,c)});return this.combineResults(v,c.combineWith)},i.prototype.executeQuerySpec=function(e,t){var o,n,r,a,u=M(M({},this._options.searchOptions),t),l=(u.fields||this._options.fields).reduce(function(Q,H){var U;return M(M({},Q),(U={},U[H]=se(u.boost,H)||1,U))},{}),s=u.boostDocument,c=u.weights,f=u.maxFuzzy,h=u.bm25,d=M(M({},we.weights),c),y=d.fuzzy,v=d.prefix,m=this._index.get(e.term),g=this.termResults(e.term,e.term,1,m,l,s,h),x,p;if(e.prefix&&(x=this._index.atPrefix(e.term)),e.fuzzy){var A=e.fuzzy===!0?.2:e.fuzzy,_=A<1?Math.min(f,Math.round(e.term.length*A)):A;_&&(p=this._index.fuzzyGet(e.term,_))}if(x)try{for(var S=F(x),w=S.next();!w.done;w=S.next()){var C=B(w.value,2),E=C[0],D=C[1],k=E.length-e.term.length;if(k){p==null||p.delete(E);var b=v*E.length/(E.length+.3*k);this.termResults(e.term,E,b,D,l,s,h,g)}}}catch(Q){o={error:Q}}finally{try{w&&!w.done&&(n=S.return)&&n.call(S)}finally{if(o)throw o.error}}if(p)try{for(var L=F(p.keys()),V=L.next();!V.done;V=L.next()){var E=V.value,P=B(p.get(E),2),N=P[0],k=P[1];if(k){var b=y*E.length/(E.length+k);this.termResults(e.term,E,b,N,l,s,h,g)}}}catch(Q){r={error:Q}}finally{try{V&&!V.done&&(a=L.return)&&a.call(L)}finally{if(r)throw r.error}}return g},i.prototype.executeWildcardQuery=function(e){var t,o,n=new Map,r=M(M({},this._options.searchOptions),e);try{for(var a=F(this._documentIds),u=a.next();!u.done;u=a.next()){var l=B(u.value,2),s=l[0],c=l[1],f=r.boostDocument?r.boostDocument(c,"",this._storedFields.get(s)):1;n.set(s,{score:f,terms:[],match:{}})}}catch(h){t={error:h}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(t)throw t.error}}return n},i.prototype.combineResults=function(e,t){if(t===void 0&&(t=ge),e.length===0)return new Map;var o=t.toLowerCase();return e.reduce(bt[o])||new Map},i.prototype.toJSON=function(){var e,t,o,n,r=[];try{for(var a=F(this._index),u=a.next();!u.done;u=a.next()){var l=B(u.value,2),s=l[0],c=l[1],f={};try{for(var h=(o=void 0,F(c)),d=h.next();!d.done;d=h.next()){var y=B(d.value,2),v=y[0],m=y[1];f[v]=Object.fromEntries(m)}}catch(g){o={error:g}}finally{try{d&&!d.done&&(n=h.return)&&n.call(h)}finally{if(o)throw o.error}}r.push([s,f])}}catch(g){e={error:g}}finally{try{u&&!u.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:r,serializationVersion:2}},i.prototype.termResults=function(e,t,o,n,r,a,u,l){var s,c,f,h,d;if(l===void 0&&(l=new Map),n==null)return l;try{for(var y=F(Object.keys(r)),v=y.next();!v.done;v=y.next()){var m=v.value,g=r[m],x=this._fieldIds[m],p=n.get(x);if(p!=null){var A=p.size,_=this._avgFieldLength[x];try{for(var S=(f=void 0,F(p.keys())),w=S.next();!w.done;w=S.next()){var C=w.value;if(!this._documentIds.has(C)){this.removeTerm(x,C,t),A-=1;continue}var E=a?a(this._documentIds.get(C),t,this._storedFields.get(C)):1;if(E){var D=p.get(C),k=this._fieldLength.get(C)[x],b=Ct(D,A,this._documentCount,k,_,u),L=o*g*E*b,V=l.get(C);if(V){V.score+=L,Et(V.terms,e);var P=se(V.match,t);P?P.push(m):V.match[t]=[m]}else l.set(C,{score:L,terms:[e],match:(d={},d[t]=[m],d)})}}}catch(N){f={error:N}}finally{try{w&&!w.done&&(h=S.return)&&h.call(S)}finally{if(f)throw f.error}}}}}catch(N){s={error:N}}finally{try{v&&!v.done&&(c=y.return)&&c.call(y)}finally{if(s)throw s.error}}return l},i.prototype.addTerm=function(e,t,o){var n=this._index.fetch(o,Ce),r=n.get(e);if(r==null)r=new Map,r.set(t,1),n.set(e,r);else{var a=r.get(t);r.set(t,(a||0)+1)}},i.prototype.removeTerm=function(e,t,o){if(!this._index.has(o)){this.warnDocumentChanged(t,e,o);return}var n=this._index.fetch(o,Ce),r=n.get(e);r==null||r.get(t)==null?this.warnDocumentChanged(t,e,o):r.get(t)<=1?r.size<=1?n.delete(e):r.delete(t):r.set(t,r.get(t)-1),this._index.get(o).size===0&&this._index.delete(o)},i.prototype.warnDocumentChanged=function(e,t,o){var n,r;try{for(var a=F(Object.keys(this._fieldIds)),u=a.next();!u.done;u=a.next()){var l=u.value;if(this._fieldIds[l]===t){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(e),' has changed before removal: term "').concat(o,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(s){n={error:s}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}},i.prototype.addDocumentId=function(e){var t=this._nextId;return this._idToShortId.set(e,t),this._documentIds.set(t,e),this._documentCount+=1,this._nextId+=1,t},i.prototype.addFields=function(e){for(var t=0;t<e.length;t++)this._fieldIds[e[t]]=t},i.prototype.addFieldLength=function(e,t,o,n){var r=this._fieldLength.get(e);r==null&&this._fieldLength.set(e,r=[]),r[t]=n;var a=this._avgFieldLength[t]||0,u=a*o+n;this._avgFieldLength[t]=u/(o+1)},i.prototype.removeFieldLength=function(e,t,o,n){if(o===1){this._avgFieldLength[t]=0;return}var r=this._avgFieldLength[t]*o-n;this._avgFieldLength[t]=r/(o-1)},i.prototype.saveStoredFields=function(e,t){var o,n,r=this._options,a=r.storeFields,u=r.extractField;if(!(a==null||a.length===0)){var l=this._storedFields.get(e);l==null&&this._storedFields.set(e,l={});try{for(var s=F(a),c=s.next();!c.done;c=s.next()){var f=c.value,h=u(t,f);h!==void 0&&(l[f]=h)}}catch(d){o={error:d}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}}},i.wildcard=Symbol("*"),i}(),se=function(i,e){return Object.prototype.hasOwnProperty.call(i,e)?i[e]:void 0},bt=(re={},re[ge]=function(i,e){var t,o;try{for(var n=F(e.keys()),r=n.next();!r.done;r=n.next()){var a=r.value,u=i.get(a);if(u==null)i.set(a,e.get(a));else{var l=e.get(a),s=l.score,c=l.terms,f=l.match;u.score=u.score+s,u.match=Object.assign(u.match,f),be(u.terms,c)}}}catch(h){t={error:h}}finally{try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}return i},re[$e]=function(i,e){var t,o,n=new Map;try{for(var r=F(e.keys()),a=r.next();!a.done;a=r.next()){var u=a.value,l=i.get(u);if(l!=null){var s=e.get(u),c=s.score,f=s.terms,h=s.match;be(l.terms,f),n.set(u,{score:l.score+c,terms:l.terms,match:Object.assign(l.match,h)})}}}catch(d){t={error:d}}finally{try{a&&!a.done&&(o=r.return)&&o.call(r)}finally{if(t)throw t.error}}return n},re[Ft]=function(i,e){var t,o;try{for(var n=F(e.keys()),r=n.next();!r.done;r=n.next()){var a=r.value;i.delete(a)}}catch(u){t={error:u}}finally{try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}return i},re),_t={k:1.2,b:.7,d:.5},Ct=function(i,e,t,o,n,r){var a=r.k,u=r.b,l=r.d,s=Math.log(1+(t-e+.5)/(e+.5));return s*(l+i*(a+1)/(i+a*(1-u+u*o/n)))},At=function(i){return function(e,t,o){var n=typeof i.fuzzy=="function"?i.fuzzy(e,t,o):i.fuzzy||!1,r=typeof i.prefix=="function"?i.prefix(e,t,o):i.prefix===!0;return{term:e,fuzzy:n,prefix:r}}},ce={idField:"id",extractField:function(i,e){return i[e]},tokenize:function(i){return i.split(zt)},processTerm:function(i){return i.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(i,e){typeof(console==null?void 0:console[i])=="function"&&console[i](e)},autoVacuum:!0},we={combineWith:ge,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:_t},St={combineWith:$e,prefix:function(i,e,t){return e===t.length-1}},ve={batchSize:1e3,batchWait:10},pe={minDirtFactor:.1,minDirtCount:20},fe=M(M({},ve),pe),Et=function(i,e){i.includes(e)||i.push(e)},be=function(i,e){var t,o;try{for(var n=F(e),r=n.next();!r.done;r=n.next()){var a=r.value;i.includes(a)||i.push(a)}}catch(u){t={error:u}}finally{try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(t)throw t.error}}},_e=function(i,e){var t=i.score,o=e.score;return o-t},Ce=function(){return new Map},ie=function(i){var e,t,o=new Map;try{for(var n=F(Object.keys(i)),r=n.next();!r.done;r=n.next()){var a=r.value;o.set(parseInt(a,10),i[a])}}catch(u){e={error:u}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return o},zt=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;const Dt={class:"relative",style:{height:"100vh"}},Vt={class:"flex h-full"},Mt={class:"h-full border-r border-r-gray-800 of-auto","h-full":"",style:{width:"22rem","min-width":"0",flex:"0 0 auto"}},Ot={flex:"~ col gap2",border:"b base",class:"border-b-gray-800 p3 flex-1"},kt=["onClick"],Lt={style:{width:"6rem"},class:"text-left"},Bt=["onClick"],Tt={key:0,class:"h-full relative w-full of-auto"},It="nuxt-graphql-middleware",Nt=K({__name:"index",setup(i){let e=new wt({fields:["content","name","filename"],storeFields:["id","content","isValid","errors","filename","relativePath","name","operation"],searchOptions:{fuzzy:.7}});const t=ne(""),o=ne([]),n=ne(""),r=ne(""),a=X(()=>{if(t.value)return o.value.find(c=>c.id===t.value)});async function u(c){e.removeAll(),o.value=c.filter(f=>!!f.operation),await e.addAll(c)}Oe(async c=>{const f=c.devtools.extendClientRpc(It,{documentsUpdated(y){u(y)}}),h=await f.getDocuments();u(h);const d=await f.getModuleOptions();r.value=d.serverApiPrefix});function l(c){const f=document.createElement("textarea");f.value=c.content,f.style.top="0",f.style.left="0",f.style.position="fixed",document.body.appendChild(f),f.focus(),f.select();try{const h=document.execCommand("copy")}catch{}document.body.removeChild(f)}const s=X(()=>n.value?e.search(n.value):o.value);return(c,f)=>{const h=Xe,d=Me,y=vt;return z(),T("div",Dt,[O("div",Vt,[O("div",Mt,[O("div",Ot,[q(h,{modelValue:$(n),"onUpdate:modelValue":f[0]||(f[0]=v=>ze(n)?n.value=v:null),placeholder:"Search documents...",icon:"carbon-search",class:"w-full"},null,8,["modelValue"])]),(z(!0),T(ee,null,ye($(s),v=>(z(),T("div",{key:v.content,class:"relative group"},[O("button",{class:W(["text-secondary hover:n-bg-hover flex select-none truncate px2 py2 font-mono text-sm w-full",{"text-red-500":!v.isValid}]),onClick:m=>t.value=v.id},[O("div",Lt,[v.operation==="query"?(z(),j(d,{key:0,green:"",text:"Query"})):v.operation==="mutation"?(z(),j(d,{key:1,orange:"",text:"Mutation"})):R("",!0)]),O("div",null,J(v.name),1)],10,kt),O("button",{class:"absolute right-0 top-0 text-sm h-full flex items-center opacity-0 group-hover:opacity-100 pr2",onClick:m=>l(v)},f[1]||(f[1]=[O("span",null,"Copy",-1)]),8,Bt)]))),128))]),f[2]||(f[2]=O("div",{class:"splitpanes__splitter"},null,-1)),$(a)?(z(),T("div",Tt,[q(y,Ee($(a),{"server-api-prefix":$(r)}),null,16,["server-api-prefix"])])):R("",!0)])])}}});export{Nt as default};
@@ -1 +1 @@
1
- {"id":"fff2eb15-13a3-4063-86e7-990068006f7e","timestamp":1729345399877}
1
+ {"id":"172a2fbf-9aed-4d11-81c4-ac46ab9b664c","timestamp":1731677992311}
@@ -0,0 +1 @@
1
+ {"id":"172a2fbf-9aed-4d11-81c4-ac46ab9b664c","timestamp":1731677992311,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -1,11 +1,11 @@
1
1
  <!DOCTYPE html><html data-capo=""><head><meta charset="utf-8">
2
2
  <meta name="viewport" content="width=device-width, initial-scale=1">
3
- <link rel="stylesheet" href="/__nuxt-graphql-middleware/_nuxt/entry.DlumAtbg.css">
4
- <link rel="modulepreload" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/CaoFd9E8.js">
5
- <link rel="prefetch" as="style" crossorigin href="/__nuxt-graphql-middleware/_nuxt/error-404.C_4C5G96.css">
6
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/Ch07F_Ul.js">
7
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/BBbivCOF.js">
8
- <link rel="prefetch" as="style" crossorigin href="/__nuxt-graphql-middleware/_nuxt/error-500.CBAEdpZV.css">
9
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/DbuEOF3O.js">
10
- <script type="module" src="/__nuxt-graphql-middleware/_nuxt/CaoFd9E8.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1729345409102,false]</script>
11
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"fff2eb15-13a3-4063-86e7-990068006f7e",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
3
+ <link rel="stylesheet" href="/__nuxt-graphql-middleware/_nuxt/entry.D9ltLgme.css">
4
+ <link rel="modulepreload" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/CH4m2wxh.js">
5
+ <link rel="prefetch" as="style" crossorigin href="/__nuxt-graphql-middleware/_nuxt/error-404.SWzu_puR.css">
6
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/GKcsigNx.js">
7
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/B4FhP7a6.js">
8
+ <link rel="prefetch" as="style" crossorigin href="/__nuxt-graphql-middleware/_nuxt/error-500.Bkv_zTjr.css">
9
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-graphql-middleware/_nuxt/CPd6XBwJ.js">
10
+ <script type="module" src="/__nuxt-graphql-middleware/_nuxt/CH4m2wxh.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1731678001894,false]</script>
11
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-graphql-middleware",buildId:"172a2fbf-9aed-4d11-81c4-ac46ab9b664c",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
package/dist/module.d.mts CHANGED
@@ -4,14 +4,17 @@ import { SchemaASTConfig } from '@graphql-codegen/schema-ast';
4
4
  import { TypeScriptDocumentsPluginConfig } from '@graphql-codegen/typescript-operations';
5
5
  import { H3Event } from 'h3';
6
6
  import { FetchOptions, FetchResponse, FetchError } from 'ofetch';
7
- import { GraphqlServerResponse } from '#graphql-middleware/types';
8
- import { GraphqlMiddlewareResponseUnion } from '#build/nuxt-graphql-middleware';
7
+ import { ContextType, GraphqlServerResponse } from '#graphql-middleware/types';
8
+ import { GraphqlMiddlewareResponseUnion } from '#nuxt-graphql-middleware/generated-types';
9
9
 
10
- type GraphqlMiddlewareGraphqlEndpointMethod = (event?: H3Event, operation?: string, operationName?: string) => string | Promise<string> | undefined;
11
- type GraphqlMiddlewareServerFetchOptionsMethod = (event?: H3Event, operation?: string, operationName?: string) => FetchOptions | Promise<FetchOptions>;
12
- type GraphqlMiddlewareOnServerResponseMethod<ServerReponse, T> = (event: H3Event, response: FetchResponse<ServerReponse>, operation?: string, operationName?: string) => T | Promise<T>;
13
- type GraphqlMiddlewareOnServerErrorMethod = (event: H3Event, error: FetchError, operation?: string, operationName?: string) => any | Promise<any>;
14
- type GraphqlMiddlewareDoRequestMethodContext = {
10
+ type GraphqlMiddlewareRequestContext<C extends ContextType = ContextType> = {
11
+ client?: Partial<C>;
12
+ };
13
+ type GraphqlMiddlewareGraphqlEndpointMethod<C extends ContextType> = (event?: H3Event, operation?: string, operationName?: string, context?: GraphqlMiddlewareRequestContext<C>) => string | Promise<string> | undefined;
14
+ type GraphqlMiddlewareServerFetchOptionsMethod<C extends ContextType> = (event?: H3Event, operation?: string, operationName?: string, context?: GraphqlMiddlewareRequestContext<C>) => FetchOptions | Promise<FetchOptions>;
15
+ type GraphqlMiddlewareOnServerResponseMethod<ServerReponse, T, C extends ContextType> = (event: H3Event, response: FetchResponse<ServerReponse>, operation?: string, operationName?: string, context?: GraphqlMiddlewareRequestContext<C>) => T | Promise<T>;
16
+ type GraphqlMiddlewareOnServerErrorMethod<C extends ContextType> = (event: H3Event, error: FetchError, operation?: string, operationName?: string, context?: GraphqlMiddlewareRequestContext<C>) => any | Promise<any>;
17
+ type GraphqlMiddlewareDoRequestMethodContext<C extends ContextType> = {
15
18
  /**
16
19
  * The incoming request event from H3.
17
20
  */
@@ -50,12 +53,13 @@ type GraphqlMiddlewareDoRequestMethodContext = {
50
53
  * 0=[Binary File]
51
54
  */
52
55
  formData?: FormData;
56
+ context: GraphqlMiddlewareRequestContext<C>;
53
57
  };
54
- type GraphqlMiddlewareDoRequestMethod<T> = (context: GraphqlMiddlewareDoRequestMethodContext) => Promise<T>;
58
+ type GraphqlMiddlewareDoRequestMethod<T, C extends ContextType> = (context: GraphqlMiddlewareDoRequestMethodContext<C>) => Promise<T>;
55
59
  /**
56
60
  * Configuration options during runtime.
57
61
  */
58
- type GraphqlMiddlewareServerOptions<Additions extends object = object, CustomResponse = GraphqlServerResponse<GraphqlMiddlewareResponseUnion> & Additions> = {
62
+ type GraphqlMiddlewareServerOptions<Additions extends object = object, C extends ContextType = ContextType, CustomResponse = GraphqlServerResponse<GraphqlMiddlewareResponseUnion> & Additions> = {
59
63
  /**
60
64
  * Custom callback to return the GraphQL endpoint per request.
61
65
  *
@@ -71,7 +75,7 @@ type GraphqlMiddlewareServerOptions<Additions extends object = object, CustomRes
71
75
  * }
72
76
  * ```
73
77
  */
74
- graphqlEndpoint?: GraphqlMiddlewareGraphqlEndpointMethod;
78
+ graphqlEndpoint?: GraphqlMiddlewareGraphqlEndpointMethod<C>;
75
79
  /**
76
80
  * Provide the options for the ofetch request to the GraphQL server.
77
81
  *
@@ -93,7 +97,7 @@ type GraphqlMiddlewareServerOptions<Additions extends object = object, CustomRes
93
97
  * }
94
98
  * ```
95
99
  */
96
- serverFetchOptions?: GraphqlMiddlewareServerFetchOptionsMethod;
100
+ serverFetchOptions?: GraphqlMiddlewareServerFetchOptionsMethod<C>;
97
101
  /**
98
102
  * Handle the response from the GraphQL server.
99
103
  *
@@ -124,7 +128,7 @@ type GraphqlMiddlewareServerOptions<Additions extends object = object, CustomRes
124
128
  * }
125
129
  * ```
126
130
  */
127
- onServerResponse?: GraphqlMiddlewareOnServerResponseMethod<GraphqlServerResponse<GraphqlMiddlewareResponseUnion>, CustomResponse>;
131
+ onServerResponse?: GraphqlMiddlewareOnServerResponseMethod<GraphqlServerResponse<GraphqlMiddlewareResponseUnion>, CustomResponse, C>;
128
132
  /**
129
133
  * Handle a fetch error from the GraphQL request.
130
134
  *
@@ -154,7 +158,7 @@ type GraphqlMiddlewareServerOptions<Additions extends object = object, CustomRes
154
158
  * }
155
159
  * ```
156
160
  */
157
- onServerError?: GraphqlMiddlewareOnServerErrorMethod;
161
+ onServerError?: GraphqlMiddlewareOnServerErrorMethod<C>;
158
162
  /**
159
163
  * Provide a custom fetch method for requests to the GraphQL server.
160
164
  *
@@ -192,7 +196,7 @@ type GraphqlMiddlewareServerOptions<Additions extends object = object, CustomRes
192
196
  * }
193
197
  * ```
194
198
  */
195
- doGraphqlRequest?: GraphqlMiddlewareDoRequestMethod<CustomResponse>;
199
+ doGraphqlRequest?: GraphqlMiddlewareDoRequestMethod<CustomResponse, C>;
196
200
  };
197
201
 
198
202
  interface ModuleOptions {
package/dist/module.d.ts CHANGED
@@ -4,14 +4,17 @@ import { SchemaASTConfig } from '@graphql-codegen/schema-ast';
4
4
  import { TypeScriptDocumentsPluginConfig } from '@graphql-codegen/typescript-operations';
5
5
  import { H3Event } from 'h3';
6
6
  import { FetchOptions, FetchResponse, FetchError } from 'ofetch';
7
- import { GraphqlServerResponse } from '#graphql-middleware/types';
8
- import { GraphqlMiddlewareResponseUnion } from '#build/nuxt-graphql-middleware';
7
+ import { ContextType, GraphqlServerResponse } from '#graphql-middleware/types';
8
+ import { GraphqlMiddlewareResponseUnion } from '#nuxt-graphql-middleware/generated-types';
9
9
 
10
- type GraphqlMiddlewareGraphqlEndpointMethod = (event?: H3Event, operation?: string, operationName?: string) => string | Promise<string> | undefined;
11
- type GraphqlMiddlewareServerFetchOptionsMethod = (event?: H3Event, operation?: string, operationName?: string) => FetchOptions | Promise<FetchOptions>;
12
- type GraphqlMiddlewareOnServerResponseMethod<ServerReponse, T> = (event: H3Event, response: FetchResponse<ServerReponse>, operation?: string, operationName?: string) => T | Promise<T>;
13
- type GraphqlMiddlewareOnServerErrorMethod = (event: H3Event, error: FetchError, operation?: string, operationName?: string) => any | Promise<any>;
14
- type GraphqlMiddlewareDoRequestMethodContext = {
10
+ type GraphqlMiddlewareRequestContext<C extends ContextType = ContextType> = {
11
+ client?: Partial<C>;
12
+ };
13
+ type GraphqlMiddlewareGraphqlEndpointMethod<C extends ContextType> = (event?: H3Event, operation?: string, operationName?: string, context?: GraphqlMiddlewareRequestContext<C>) => string | Promise<string> | undefined;
14
+ type GraphqlMiddlewareServerFetchOptionsMethod<C extends ContextType> = (event?: H3Event, operation?: string, operationName?: string, context?: GraphqlMiddlewareRequestContext<C>) => FetchOptions | Promise<FetchOptions>;
15
+ type GraphqlMiddlewareOnServerResponseMethod<ServerReponse, T, C extends ContextType> = (event: H3Event, response: FetchResponse<ServerReponse>, operation?: string, operationName?: string, context?: GraphqlMiddlewareRequestContext<C>) => T | Promise<T>;
16
+ type GraphqlMiddlewareOnServerErrorMethod<C extends ContextType> = (event: H3Event, error: FetchError, operation?: string, operationName?: string, context?: GraphqlMiddlewareRequestContext<C>) => any | Promise<any>;
17
+ type GraphqlMiddlewareDoRequestMethodContext<C extends ContextType> = {
15
18
  /**
16
19
  * The incoming request event from H3.
17
20
  */
@@ -50,12 +53,13 @@ type GraphqlMiddlewareDoRequestMethodContext = {
50
53
  * 0=[Binary File]
51
54
  */
52
55
  formData?: FormData;
56
+ context: GraphqlMiddlewareRequestContext<C>;
53
57
  };
54
- type GraphqlMiddlewareDoRequestMethod<T> = (context: GraphqlMiddlewareDoRequestMethodContext) => Promise<T>;
58
+ type GraphqlMiddlewareDoRequestMethod<T, C extends ContextType> = (context: GraphqlMiddlewareDoRequestMethodContext<C>) => Promise<T>;
55
59
  /**
56
60
  * Configuration options during runtime.
57
61
  */
58
- type GraphqlMiddlewareServerOptions<Additions extends object = object, CustomResponse = GraphqlServerResponse<GraphqlMiddlewareResponseUnion> & Additions> = {
62
+ type GraphqlMiddlewareServerOptions<Additions extends object = object, C extends ContextType = ContextType, CustomResponse = GraphqlServerResponse<GraphqlMiddlewareResponseUnion> & Additions> = {
59
63
  /**
60
64
  * Custom callback to return the GraphQL endpoint per request.
61
65
  *
@@ -71,7 +75,7 @@ type GraphqlMiddlewareServerOptions<Additions extends object = object, CustomRes
71
75
  * }
72
76
  * ```
73
77
  */
74
- graphqlEndpoint?: GraphqlMiddlewareGraphqlEndpointMethod;
78
+ graphqlEndpoint?: GraphqlMiddlewareGraphqlEndpointMethod<C>;
75
79
  /**
76
80
  * Provide the options for the ofetch request to the GraphQL server.
77
81
  *
@@ -93,7 +97,7 @@ type GraphqlMiddlewareServerOptions<Additions extends object = object, CustomRes
93
97
  * }
94
98
  * ```
95
99
  */
96
- serverFetchOptions?: GraphqlMiddlewareServerFetchOptionsMethod;
100
+ serverFetchOptions?: GraphqlMiddlewareServerFetchOptionsMethod<C>;
97
101
  /**
98
102
  * Handle the response from the GraphQL server.
99
103
  *
@@ -124,7 +128,7 @@ type GraphqlMiddlewareServerOptions<Additions extends object = object, CustomRes
124
128
  * }
125
129
  * ```
126
130
  */
127
- onServerResponse?: GraphqlMiddlewareOnServerResponseMethod<GraphqlServerResponse<GraphqlMiddlewareResponseUnion>, CustomResponse>;
131
+ onServerResponse?: GraphqlMiddlewareOnServerResponseMethod<GraphqlServerResponse<GraphqlMiddlewareResponseUnion>, CustomResponse, C>;
128
132
  /**
129
133
  * Handle a fetch error from the GraphQL request.
130
134
  *
@@ -154,7 +158,7 @@ type GraphqlMiddlewareServerOptions<Additions extends object = object, CustomRes
154
158
  * }
155
159
  * ```
156
160
  */
157
- onServerError?: GraphqlMiddlewareOnServerErrorMethod;
161
+ onServerError?: GraphqlMiddlewareOnServerErrorMethod<C>;
158
162
  /**
159
163
  * Provide a custom fetch method for requests to the GraphQL server.
160
164
  *
@@ -192,7 +196,7 @@ type GraphqlMiddlewareServerOptions<Additions extends object = object, CustomRes
192
196
  * }
193
197
  * ```
194
198
  */
195
- doGraphqlRequest?: GraphqlMiddlewareDoRequestMethod<CustomResponse>;
199
+ doGraphqlRequest?: GraphqlMiddlewareDoRequestMethod<CustomResponse, C>;
196
200
  };
197
201
 
198
202
  interface ModuleOptions {
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-graphql-middleware",
3
3
  "configKey": "graphqlMiddleware",
4
- "version": "4.2.0",
4
+ "version": "4.3.0",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.13.0"
7
7
  },
package/dist/module.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { fileURLToPath } from 'url';
2
2
  import { dirname, resolve, relative } from 'pathe';
3
3
  import { defu } from 'defu';
4
- import { useLogger, resolveAlias, resolveFiles, defineNuxtModule, createResolver, addImports, addTemplate, addServerHandler, addPlugin, updateTemplates } from '@nuxt/kit';
4
+ import { useLogger, resolveAlias, resolveFiles, defineNuxtModule, createResolver, addImports, addServerImports, addTemplate, addServerHandler, addPlugin, updateTemplates } from '@nuxt/kit';
5
5
  import inquirer from 'inquirer';
6
6
  import { onDevToolsInitialized, extendServerRpc } from '@nuxt/devtools-kit';
7
7
  import { existsSync } from 'fs';
@@ -21,7 +21,7 @@ import { pascalCase } from 'change-case-all';
21
21
  import colors from 'picocolors';
22
22
 
23
23
  const name = "nuxt-graphql-middleware";
24
- const version = "4.2.0";
24
+ const version = "4.3.0";
25
25
 
26
26
  const DEVTOOLS_UI_ROUTE = "/__nuxt-graphql-middleware";
27
27
  const DEVTOOLS_UI_LOCAL_PORT = 3300;
@@ -239,10 +239,10 @@ const plugin$1 = (_schema, documents, config) => {
239
239
  import type { GraphqlResponse } from '#graphql-middleware-server-options-build'
240
240
  import type {
241
241
  ${imports.join(",\n ")}
242
- } from './graphql-operations'
242
+ } from './../graphql-operations'
243
243
 
244
244
 
245
- declare module '#build/nuxt-graphql-middleware' {
245
+ declare module '#nuxt-graphql-middleware/generated-types' {
246
246
  export type GraphqlMiddlewareResponseUnion = ${resultTypes.join(" | ")}
247
247
  ${code}
248
248
  }
@@ -445,7 +445,6 @@ async function autoImportDocuments(patterns = [], srcResolver) {
445
445
  if (!patterns.length) {
446
446
  return Promise.resolve([]);
447
447
  }
448
- console.log({ patterns });
449
448
  const files = (await resolveFiles(srcResolver(), patterns, {
450
449
  followSymbolicLinks: false
451
450
  })).filter((path) => {
@@ -774,6 +773,7 @@ const module = defineNuxtModule({
774
773
  const moduleResolver = createResolver(import.meta.url);
775
774
  const serverResolver = createResolver(nuxt.options.serverDir);
776
775
  const srcResolver = createResolver(nuxt.options.srcDir);
776
+ const appResolver = createResolver(nuxt.options.dir.app);
777
777
  const rootDir = nuxt.options.rootDir;
778
778
  const rootResolver = createResolver(rootDir);
779
779
  const schemaPath = await getSchemaPath(
@@ -885,37 +885,30 @@ const module = defineNuxtModule({
885
885
  graphqlEndpoint: options.graphqlEndpoint || ""
886
886
  };
887
887
  if (options.includeComposables) {
888
- addImports({
889
- from: moduleResolver.resolve("./runtime/composables/useGraphqlQuery"),
890
- name: "useGraphqlQuery"
891
- });
892
- addImports({
893
- from: moduleResolver.resolve(
894
- "./runtime/composables/useGraphqlMutation"
895
- ),
896
- name: "useGraphqlMutation"
897
- });
898
- addImports({
899
- from: moduleResolver.resolve("./runtime/composables/useGraphqlState"),
900
- name: "useGraphqlState"
901
- });
902
- addImports({
903
- from: moduleResolver.resolve(
904
- "./runtime/composables/useAsyncGraphqlQuery"
905
- ),
906
- name: "useAsyncGraphqlQuery"
907
- });
908
- nuxt.options.alias["#graphql-composable"] = moduleResolver.resolve(
909
- "runtime/composables/server"
910
- );
888
+ const nuxtComposables = [
889
+ "useGraphqlQuery",
890
+ "useGraphqlMutation",
891
+ "useGraphqlState",
892
+ "useAsyncGraphqlQuery"
893
+ ];
911
894
  if (options.enableFileUploads) {
895
+ nuxtComposables.push("useGraphqlUploadMutation");
896
+ }
897
+ nuxtComposables.forEach((name2) => {
912
898
  addImports({
913
- from: moduleResolver.resolve(
914
- "./runtime/composables/useGraphqlUploadMutation"
915
- ),
916
- name: "useGraphqlUploadMutation"
899
+ from: moduleResolver.resolve("./runtime/composables/" + name2),
900
+ name: name2
917
901
  });
918
- }
902
+ });
903
+ const serverUtils = ["useGraphqlQuery", "useGraphqlMutation"].map(
904
+ (name2) => {
905
+ return {
906
+ from: moduleResolver.resolve("./runtime/server/utils/" + name2),
907
+ name: name2
908
+ };
909
+ }
910
+ );
911
+ addServerImports(serverUtils);
919
912
  }
920
913
  Object.values(GraphqlMiddlewareTemplate).forEach((filename) => {
921
914
  const result = addTemplate({
@@ -932,6 +925,8 @@ const module = defineNuxtModule({
932
925
  nuxt.options.alias["#graphql-documents"] = result.dst;
933
926
  } else if (result.dst.includes(GraphqlMiddlewareTemplate.OperationTypes)) {
934
927
  nuxt.options.alias["#graphql-operations"] = result.dst;
928
+ } else if (result.dst.includes(GraphqlMiddlewareTemplate.ComposableContext)) {
929
+ nuxt.options.alias["#nuxt-graphql-middleware/generated-types"] = result.dst;
935
930
  }
936
931
  });
937
932
  addTemplate({
@@ -942,7 +937,7 @@ const module = defineNuxtModule({
942
937
  import type {
943
938
  GraphqlMiddlewareQuery,
944
939
  GraphqlMiddlewareMutation,
945
- } from '#build/nuxt-graphql-middleware'
940
+ } from '#nuxt-graphql-middleware/generated-types'
946
941
 
947
942
  declare module '#graphql-documents' {
948
943
  type Documents = {
@@ -1004,10 +999,10 @@ export { serverOptions }
1004
999
  import type { GraphqlMiddlewareServerOptions } from '${moduleTypesPath}'
1005
1000
  ${serverOptionsLineTypes}
1006
1001
  import type { GraphqlServerResponse } from '#graphql-middleware/types'
1007
- import type { GraphqlMiddlewareResponseUnion } from '#build/nuxt-graphql-middleware'
1002
+ import type { GraphqlMiddlewareResponseUnion } from '#nuxt-graphql-middleware/generated-types'
1008
1003
 
1009
1004
  type GraphqlResponseAdditions =
1010
- typeof serverOptions extends GraphqlMiddlewareServerOptions<infer R> ? R : {}
1005
+ typeof serverOptions extends GraphqlMiddlewareServerOptions<infer R, any, any> ? R : {}
1011
1006
 
1012
1007
  export type GraphqlResponse<T> = GraphqlServerResponse<T> & GraphqlResponseAdditions
1013
1008
 
@@ -1017,6 +1012,47 @@ export { serverOptions }
1017
1012
  `;
1018
1013
  }
1019
1014
  });
1015
+ const getClientOptionsImport = () => {
1016
+ const clientOptionsPath = appResolver.resolve(
1017
+ "graphqlMiddleware.clientOptions"
1018
+ );
1019
+ if (fileExists(clientOptionsPath)) {
1020
+ const pathRelative = relative(nuxt.options.buildDir, clientOptionsPath);
1021
+ return `import clientOptions from '${pathRelative}'`;
1022
+ }
1023
+ };
1024
+ const clientOptionsImport = getClientOptionsImport();
1025
+ const clientOptionsTemplate = addTemplate({
1026
+ filename: "graphqlMiddleware.clientOptions.mjs",
1027
+ write: true,
1028
+ getContents: () => {
1029
+ if (clientOptionsImport) {
1030
+ return `${clientOptionsImport}
1031
+ export { clientOptions }`;
1032
+ }
1033
+ return `export const clientOptions = {}`;
1034
+ }
1035
+ });
1036
+ addTemplate({
1037
+ filename: "graphqlMiddleware.clientOptions.d.ts",
1038
+ write: true,
1039
+ getContents: () => {
1040
+ if (clientOptionsImport) {
1041
+ return `import { GraphqlClientOptions } from '#graphql-middleware/types'
1042
+ ${clientOptionsImport}
1043
+
1044
+ export type GraphqlClientContext = typeof clientOptions extends GraphqlClientOptions<infer R> ? R : {}
1045
+
1046
+ export { clientOptions }`;
1047
+ }
1048
+ return `import { GraphqlClientOptions } from '#graphql-middleware/types'
1049
+ export const clientOptions: GraphqlClientOptions
1050
+
1051
+ export type GraphqlClientContext = {}
1052
+ `;
1053
+ }
1054
+ });
1055
+ nuxt.options.alias["#graphql-middleware-client-options"] = clientOptionsTemplate.dst;
1020
1056
  nuxt.options.nitro.externals = nuxt.options.nitro.externals || {};
1021
1057
  nuxt.options.nitro.externals.inline = nuxt.options.nitro.externals.inline || [];
1022
1058
  nuxt.options.nitro.externals.inline.push(template.dst);
@@ -0,0 +1,2 @@
1
+ import type { GraphqlClientOptions, ContextType } from './../types.js';
2
+ export declare function defineGraphqlClientOptions<T extends ContextType>(options: GraphqlClientOptions<T>): GraphqlClientOptions<T>;
@@ -0,0 +1,3 @@
1
+ export function defineGraphqlClientOptions(options) {
2
+ return options;
3
+ }
@@ -1,5 +1,5 @@
1
1
  import { useGraphqlState } from "./useGraphqlState.js";
2
- import { getEndpoint } from "./shared.js";
2
+ import { getEndpoint } from "./../helpers/composables.js";
3
3
  import { hash } from "ohash";
4
4
  import { GraphqlMiddlewareCache } from "../helpers/ClientCache.js";
5
5
  import { useNuxtApp, useAppConfig } from "#imports";
@@ -1,13 +1,15 @@
1
- import { type GraphqlMiddlewareQueryName, type KeysOf, type PickFrom } from './shared.js';
1
+ import { type GraphqlMiddlewareQueryName, type KeysOf, type PickFrom } from './../helpers/composables.js';
2
2
  import type { FetchOptions } from 'ofetch';
3
3
  import { type Ref } from 'vue';
4
- import type { GraphqlMiddlewareQuery } from '#build/nuxt-graphql-middleware';
4
+ import { type GraphqlClientContext } from '#graphql-middleware-client-options';
5
+ import type { GraphqlMiddlewareQuery } from '#nuxt-graphql-middleware/generated-types';
5
6
  import type { GraphqlResponse } from '#graphql-middleware-server-options-build';
6
7
  import type { RequestCacheOptions } from '#graphql-middleware/types';
7
8
  import type { AsyncData, AsyncDataOptions, NuxtError } from '#app';
8
9
  type AsyncGraphqlQueryOptions<ResponseType, DefaultT, Keys extends KeysOf<DefaultT>, F> = AsyncDataOptions<ResponseType, DefaultT, Keys> & {
9
10
  graphqlCaching?: RequestCacheOptions;
10
11
  fetchOptions?: F;
12
+ clientContext?: Partial<GraphqlClientContext>;
11
13
  };
12
14
  /**
13
15
  * Wrapper for useAsyncData to perform a single GraphQL query.