@kyro-cms/core 0.10.5 → 0.10.7
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.
- package/dist/api-handler-graphql.cjs +1 -1
- package/dist/api-handler-graphql.js +1 -1
- package/dist/api-handler-trpc.cjs +1 -1
- package/dist/api-handler-trpc.js +1 -1
- package/dist/api-handler.cjs +1 -1
- package/dist/api-handler.js +1 -1
- package/dist/{bootstrap-OHGQGMRV.cjs → bootstrap-HIAV5ZFT.cjs} +1 -1
- package/dist/{bootstrap-IVQWSJXZ.js → bootstrap-P7QPQYQP.js} +1 -1
- package/dist/{chunk-VKXQUYYV.js → chunk-CDL7ARXT.js} +1 -1
- package/dist/{chunk-Y7K26TBA.cjs → chunk-CUTFS6N2.cjs} +1 -1
- package/dist/chunk-DGJUBN33.js +1 -0
- package/dist/{chunk-MSSRVZH6.js → chunk-EEWCANFX.js} +1 -1
- package/dist/chunk-F7P36SLX.cjs +74 -0
- package/dist/chunk-FS7GL2BR.js +73 -0
- package/dist/{chunk-6CLRVJPP.cjs → chunk-IFJJ44OQ.cjs} +1 -1
- package/dist/{chunk-F3Z67QWS.cjs → chunk-KIW36TG7.cjs} +4 -4
- package/dist/chunk-LRGAPGG3.js +74 -0
- package/dist/chunk-OQD3WG6Z.cjs +1 -0
- package/dist/chunk-R7DVVXXI.cjs +73 -0
- package/dist/chunk-URCLFIME.js +86 -0
- package/dist/cli/index.cjs +2 -2
- package/dist/cli/index.js +2 -2
- package/dist/client.cjs +1 -1
- package/dist/client.js +1 -1
- package/dist/drizzle/index.cjs +1 -1
- package/dist/drizzle/index.js +1 -1
- package/dist/fields/index.cjs +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/graphql/index.cjs +1 -1
- package/dist/graphql/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/integration.cjs +1 -1
- package/dist/integration.js +1 -1
- package/dist/{media-OUBQTIQP.cjs → media-NSSMOB7N.cjs} +1 -1
- package/dist/{media-L5XDD47D.js → media-RNMCZYPZ.js} +1 -1
- package/dist/{mongo-auth-adapter-YPONSOCY.cjs → mongo-auth-adapter-JYJ4GBZE.cjs} +1 -1
- package/dist/{mongo-auth-adapter-LG5O4LIH.js → mongo-auth-adapter-XI7EPURZ.js} +1 -1
- package/dist/mongodb/index.cjs +1 -1
- package/dist/mongodb/index.js +1 -1
- package/dist/{postgres-auth-adapter-JKDYYULH.cjs → postgres-auth-adapter-E7OGMDD4.cjs} +1 -1
- package/dist/{postgres-auth-adapter-33QOIRXT.js → postgres-auth-adapter-F4KLOGAG.js} +1 -1
- package/dist/{redis-adapter-KECGVSVX.cjs → redis-adapter-AQJVABYT.cjs} +1 -1
- package/dist/{redis-adapter-VAXP43GR.js → redis-adapter-AUKOV74G.js} +1 -1
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.js +1 -1
- package/dist/{schema-KFYUM674.js → schema-5XNROI7I.js} +1 -1
- package/dist/{schema-HIUSHSUI.cjs → schema-6O4JTJRU.cjs} +1 -1
- package/dist/{sqlite-adapter-FP45QCYK.js → sqlite-adapter-5XFLNJDH.js} +1 -1
- package/dist/{sqlite-adapter-Z3IBBI4X.cjs → sqlite-adapter-W53Q32N5.cjs} +1 -1
- package/dist/templates/index.cjs +1 -1
- package/dist/templates/index.js +1 -1
- package/dist/trpc/index.cjs +1 -1
- package/dist/trpc/index.js +1 -1
- package/dist/ws/index.cjs +1 -1
- package/dist/ws/index.js +1 -1
- package/package.json +8 -26
- package/dist/chunk-5J6HXUF6.js +0 -1
- package/dist/chunk-AHSFSERC.cjs +0 -1
- package/dist/chunk-CIE3XMLH.cjs +0 -2
- package/dist/chunk-POWTSLKC.js +0 -21
- package/dist/chunk-PWGS2GPI.js +0 -86
- package/dist/chunk-R6UUTH3T.js +0 -2
- package/dist/chunk-TD6RULJU.cjs +0 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkCUTFS6N2_cjs=require('./chunk-CUTFS6N2.cjs');require('./chunk-R7DVVXXI.cjs'),require('./chunk-UJNSOOYZ.cjs'),require('./chunk-65G73T7Z.cjs'),require('./chunk-CVVW4LXZ.cjs'),require('./chunk-F7P36SLX.cjs'),require('./chunk-KIW36TG7.cjs'),require('./chunk-AJAZ7D3W.cjs'),require('./chunk-WIZ6C5QZ.cjs'),require('./chunk-GFU7AOI3.cjs'),require('./chunk-ET6NN2V2.cjs'),require('./chunk-HVXO3OFB.cjs'),require('./chunk-ISWMETHJ.cjs'),require('./chunk-NY47CFVP.cjs'),require('./chunk-F7SR5IDT.cjs'),require('./chunk-4ORJMSJU.cjs'),require('./chunk-IFJJ44OQ.cjs'),require('./chunk-GYQMNXXW.cjs'),require('./chunk-MIOMMB23.cjs'),require('./chunk-UBHFUFD4.cjs'),require('./chunk-UDSJGML2.cjs'),require('./chunk-ATLSIYRH.cjs'),require('./chunk-DV4LFLPL.cjs'),require('./chunk-Q3Q7BJVQ.cjs'),require('./chunk-OQD3WG6Z.cjs');function a(e){return new Response(e.body,e)}var p=async e=>{await chunkCUTFS6N2_cjs.b();let t=await chunkCUTFS6N2_cjs.a.getGraphQL().fetch(e.request,e.locals);return a(t)},c=async e=>{await chunkCUTFS6N2_cjs.b();let t=await chunkCUTFS6N2_cjs.a.getGraphQL().fetch(e.request,e.locals);return a(t)};exports.GET=c;exports.POST=p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b,a as a$1}from'./chunk-
|
|
1
|
+
import {b,a as a$1}from'./chunk-EEWCANFX.js';import'./chunk-FS7GL2BR.js';import'./chunk-FO3HLBC7.js';import'./chunk-NZ35PV5R.js';import'./chunk-7N6NKCRT.js';import'./chunk-LRGAPGG3.js';import'./chunk-URCLFIME.js';import'./chunk-7WOX27LK.js';import'./chunk-K6WUOU6P.js';import'./chunk-AE6GXUT7.js';import'./chunk-2W4FK6CJ.js';import'./chunk-NRLIGDYF.js';import'./chunk-UVTS2IWM.js';import'./chunk-HLSB2MCK.js';import'./chunk-SL3LZQCF.js';import'./chunk-PP5S2UBV.js';import'./chunk-CDL7ARXT.js';import'./chunk-RHCWCG3O.js';import'./chunk-OG7CNQGU.js';import'./chunk-QRXDCV6K.js';import'./chunk-G6A7OSIG.js';import'./chunk-P7CESLDJ.js';import'./chunk-ZAQOSRP6.js';import'./chunk-KDNYHLD2.js';import'./chunk-DGJUBN33.js';function a(e){return new Response(e.body,e)}var p=async e=>{await b();let t=await a$1.getGraphQL().fetch(e.request,e.locals);return a(t)},c=async e=>{await b();let t=await a$1.getGraphQL().fetch(e.request,e.locals);return a(t)};export{c as GET,p as POST};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkCUTFS6N2_cjs=require('./chunk-CUTFS6N2.cjs');require('./chunk-R7DVVXXI.cjs'),require('./chunk-UJNSOOYZ.cjs'),require('./chunk-65G73T7Z.cjs'),require('./chunk-CVVW4LXZ.cjs'),require('./chunk-F7P36SLX.cjs'),require('./chunk-KIW36TG7.cjs'),require('./chunk-AJAZ7D3W.cjs'),require('./chunk-WIZ6C5QZ.cjs'),require('./chunk-GFU7AOI3.cjs'),require('./chunk-ET6NN2V2.cjs'),require('./chunk-HVXO3OFB.cjs'),require('./chunk-ISWMETHJ.cjs'),require('./chunk-NY47CFVP.cjs'),require('./chunk-F7SR5IDT.cjs'),require('./chunk-4ORJMSJU.cjs'),require('./chunk-IFJJ44OQ.cjs'),require('./chunk-GYQMNXXW.cjs'),require('./chunk-MIOMMB23.cjs'),require('./chunk-UBHFUFD4.cjs'),require('./chunk-UDSJGML2.cjs'),require('./chunk-ATLSIYRH.cjs'),require('./chunk-DV4LFLPL.cjs'),require('./chunk-Q3Q7BJVQ.cjs'),require('./chunk-OQD3WG6Z.cjs');var p=async t=>(await chunkCUTFS6N2_cjs.b(),chunkCUTFS6N2_cjs.a.getTRPC().fetch(t.request,t.locals));exports.ALL=p;
|
package/dist/api-handler-trpc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b,a}from'./chunk-
|
|
1
|
+
import {b,a}from'./chunk-EEWCANFX.js';import'./chunk-FS7GL2BR.js';import'./chunk-FO3HLBC7.js';import'./chunk-NZ35PV5R.js';import'./chunk-7N6NKCRT.js';import'./chunk-LRGAPGG3.js';import'./chunk-URCLFIME.js';import'./chunk-7WOX27LK.js';import'./chunk-K6WUOU6P.js';import'./chunk-AE6GXUT7.js';import'./chunk-2W4FK6CJ.js';import'./chunk-NRLIGDYF.js';import'./chunk-UVTS2IWM.js';import'./chunk-HLSB2MCK.js';import'./chunk-SL3LZQCF.js';import'./chunk-PP5S2UBV.js';import'./chunk-CDL7ARXT.js';import'./chunk-RHCWCG3O.js';import'./chunk-OG7CNQGU.js';import'./chunk-QRXDCV6K.js';import'./chunk-G6A7OSIG.js';import'./chunk-P7CESLDJ.js';import'./chunk-ZAQOSRP6.js';import'./chunk-KDNYHLD2.js';import'./chunk-DGJUBN33.js';var p=async t=>(await b(),a.getTRPC().fetch(t.request,t.locals));export{p as ALL};
|
package/dist/api-handler.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkCUTFS6N2_cjs=require('./chunk-CUTFS6N2.cjs');require('./chunk-R7DVVXXI.cjs'),require('./chunk-UJNSOOYZ.cjs'),require('./chunk-65G73T7Z.cjs'),require('./chunk-CVVW4LXZ.cjs'),require('./chunk-F7P36SLX.cjs'),require('./chunk-KIW36TG7.cjs'),require('./chunk-AJAZ7D3W.cjs'),require('./chunk-WIZ6C5QZ.cjs'),require('./chunk-GFU7AOI3.cjs'),require('./chunk-ET6NN2V2.cjs'),require('./chunk-HVXO3OFB.cjs'),require('./chunk-ISWMETHJ.cjs'),require('./chunk-NY47CFVP.cjs'),require('./chunk-F7SR5IDT.cjs'),require('./chunk-4ORJMSJU.cjs'),require('./chunk-IFJJ44OQ.cjs'),require('./chunk-GYQMNXXW.cjs'),require('./chunk-MIOMMB23.cjs'),require('./chunk-UBHFUFD4.cjs'),require('./chunk-UDSJGML2.cjs'),require('./chunk-ATLSIYRH.cjs'),require('./chunk-DV4LFLPL.cjs'),require('./chunk-Q3Q7BJVQ.cjs'),require('./chunk-OQD3WG6Z.cjs');Object.defineProperty(exports,"ALL",{enumerable:true,get:function(){return chunkCUTFS6N2_cjs.c}});Object.defineProperty(exports,"kyroInstance",{enumerable:true,get:function(){return chunkCUTFS6N2_cjs.a}});Object.defineProperty(exports,"warmKyroInstance",{enumerable:true,get:function(){return chunkCUTFS6N2_cjs.b}});
|
package/dist/api-handler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{c as ALL,a as kyroInstance,b as warmKyroInstance}from'./chunk-
|
|
1
|
+
export{c as ALL,a as kyroInstance,b as warmKyroInstance}from'./chunk-EEWCANFX.js';import'./chunk-FS7GL2BR.js';import'./chunk-FO3HLBC7.js';import'./chunk-NZ35PV5R.js';import'./chunk-7N6NKCRT.js';import'./chunk-LRGAPGG3.js';import'./chunk-URCLFIME.js';import'./chunk-7WOX27LK.js';import'./chunk-K6WUOU6P.js';import'./chunk-AE6GXUT7.js';import'./chunk-2W4FK6CJ.js';import'./chunk-NRLIGDYF.js';import'./chunk-UVTS2IWM.js';import'./chunk-HLSB2MCK.js';import'./chunk-SL3LZQCF.js';import'./chunk-PP5S2UBV.js';import'./chunk-CDL7ARXT.js';import'./chunk-RHCWCG3O.js';import'./chunk-OG7CNQGU.js';import'./chunk-QRXDCV6K.js';import'./chunk-G6A7OSIG.js';import'./chunk-P7CESLDJ.js';import'./chunk-ZAQOSRP6.js';import'./chunk-KDNYHLD2.js';import'./chunk-DGJUBN33.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var chunkUJNSOOYZ_cjs=require('./chunk-UJNSOOYZ.cjs');require('./chunk-AJAZ7D3W.cjs'),require('./chunk-WIZ6C5QZ.cjs'),require('./chunk-ET6NN2V2.cjs'),require('./chunk-
|
|
1
|
+
'use strict';var chunkUJNSOOYZ_cjs=require('./chunk-UJNSOOYZ.cjs');require('./chunk-AJAZ7D3W.cjs'),require('./chunk-WIZ6C5QZ.cjs'),require('./chunk-ET6NN2V2.cjs'),require('./chunk-OQD3WG6Z.cjs');Object.defineProperty(exports,"autoBootstrap",{enumerable:true,get:function(){return chunkUJNSOOYZ_cjs.d}});Object.defineProperty(exports,"bootstrapAdmin",{enumerable:true,get:function(){return chunkUJNSOOYZ_cjs.a}});Object.defineProperty(exports,"bootstrapWithRetry",{enumerable:true,get:function(){return chunkUJNSOOYZ_cjs.e}});Object.defineProperty(exports,"checkBootstrapRequired",{enumerable:true,get:function(){return chunkUJNSOOYZ_cjs.b}});Object.defineProperty(exports,"getBootstrapFromEnv",{enumerable:true,get:function(){return chunkUJNSOOYZ_cjs.c}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{d as autoBootstrap,a as bootstrapAdmin,e as bootstrapWithRetry,b as checkBootstrapRequired,c as getBootstrapFromEnv}from'./chunk-FO3HLBC7.js';import'./chunk-7WOX27LK.js';import'./chunk-K6WUOU6P.js';import'./chunk-2W4FK6CJ.js';import'./chunk-
|
|
1
|
+
export{d as autoBootstrap,a as bootstrapAdmin,e as bootstrapWithRetry,b as checkBootstrapRequired,c as getBootstrapFromEnv}from'./chunk-FO3HLBC7.js';import'./chunk-7WOX27LK.js';import'./chunk-K6WUOU6P.js';import'./chunk-2W4FK6CJ.js';import'./chunk-DGJUBN33.js';
|
|
@@ -129,5 +129,5 @@ import {a,c,b as b$1,d}from'./chunk-ZAQOSRP6.js';import {sql,eq,desc,and,or,ne,i
|
|
|
129
129
|
created_at text NOT NULL,
|
|
130
130
|
updated_at text NOT NULL
|
|
131
131
|
)
|
|
132
|
-
`,await this.executeRaw(sql.raw(s));try{this.dialect==="postgres"?await this.executeRaw(sql.raw("ALTER TABLE kyro_versions ADD COLUMN IF NOT EXISTS autosave integer NOT NULL DEFAULT 0")):await this.executeRaw(sql.raw("ALTER TABLE kyro_versions ADD COLUMN autosave integer NOT NULL DEFAULT 0"));}catch{}this.versionsTableReady=true;}async executeRaw(s){let n=await this.client.execute(s);return Array.isArray(n)?n:Array.isArray(n?.rows)?n.rows:Array.isArray(n?.[0])?n[0]:[]}};function be(f){return new C(f)}var de=createRequire(import.meta.url),ue="node:sqlite",{DatabaseSync:fe}=de(ue);function pe(){return process.env.DB_TYPE==="postgres"?"postgres":"sqlite"}function k(){return randomBytes(16).toString("hex")}async function Ie(){let f=pe();if(f==="sqlite"){let r=resolve(process.cwd(),"data","kyro.db");await mkdir(dirname(r),{recursive:true});let a=new fe(r);return a.exec("PRAGMA journal_mode = WAL"),{db:a,dialect:f,genId:k}}let s=process.env.DATABASE_URL||"postgresql://postgres:postgres@localhost:5432/kyro_cms",n=parseInt(process.env.DB_POOL_MAX||"10",10),e=process.env.DB_SSL==="true",t=ne$1(s,{max:n,ssl:e?"require":false,onnotice:()=>{}});return {db:drizzle(t),dialect:f,genId:k}}async function Ce(f,s){}async function $e(f){let{roles:s}=await import('./schema-
|
|
132
|
+
`,await this.executeRaw(sql.raw(s));try{this.dialect==="postgres"?await this.executeRaw(sql.raw("ALTER TABLE kyro_versions ADD COLUMN IF NOT EXISTS autosave integer NOT NULL DEFAULT 0")):await this.executeRaw(sql.raw("ALTER TABLE kyro_versions ADD COLUMN autosave integer NOT NULL DEFAULT 0"));}catch{}this.versionsTableReady=true;}async executeRaw(s){let n=await this.client.execute(s);return Array.isArray(n)?n:Array.isArray(n?.rows)?n.rows:Array.isArray(n?.[0])?n[0]:[]}};function be(f){return new C(f)}var de=createRequire(import.meta.url),ue="node:sqlite",{DatabaseSync:fe}=de(ue);function pe(){return process.env.DB_TYPE==="postgres"?"postgres":"sqlite"}function k(){return randomBytes(16).toString("hex")}async function Ie(){let f=pe();if(f==="sqlite"){let r=resolve(process.cwd(),"data","kyro.db");await mkdir(dirname(r),{recursive:true});let a=new fe(r);return a.exec("PRAGMA journal_mode = WAL"),{db:a,dialect:f,genId:k}}let s=process.env.DATABASE_URL||"postgresql://postgres:postgres@localhost:5432/kyro_cms",n=parseInt(process.env.DB_POOL_MAX||"10",10),e=process.env.DB_SSL==="true",t=ne$1(s,{max:n,ssl:e?"require":false,onnotice:()=>{}});return {db:drizzle(t),dialect:f,genId:k}}async function Ce(f,s){}async function $e(f){let{roles:s}=await import('./schema-5XNROI7I.js');await f.insert(s).values({name:"super_admin",level:100,inherits:[],description:"Full system access across all tenants",isSystem:true}).onConflictDoNothing();}
|
|
133
133
|
export{b as a,Ee as b,C as c,be as d,k as e,Ie as f,Ce as g,$e as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkR7DVVXXI_cjs=require('./chunk-R7DVVXXI.cjs'),chunkUJNSOOYZ_cjs=require('./chunk-UJNSOOYZ.cjs'),chunkET6NN2V2_cjs=require('./chunk-ET6NN2V2.cjs'),chunkIFJJ44OQ_cjs=require('./chunk-IFJJ44OQ.cjs'),chunkGYQMNXXW_cjs=require('./chunk-GYQMNXXW.cjs'),chunkUDSJGML2_cjs=require('./chunk-UDSJGML2.cjs'),chunkATLSIYRH_cjs=require('./chunk-ATLSIYRH.cjs'),A=require('kyro:config');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var A__default=/*#__PURE__*/_interopDefault(A);exports.a=null;var n=null;async function _(){if(!exports.a)try{let e=A__default.default.default||A__default.default;exports.a=chunkR7DVVXXI_cjs.q(e),await exports.a.init(),await exports.a.loadSettings();let o=exports.a.db,r;if(o instanceof chunkIFJJ44OQ_cjs.c){if(o.dialect==="postgres")r=new chunkGYQMNXXW_cjs.a({db:o.client});else if(o.dialect==="sqlite"){let i=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";r=new chunkET6NN2V2_cjs.a({path:i});}}else if(o instanceof chunkR7DVVXXI_cjs.r){let i=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";r=new chunkET6NN2V2_cjs.a({path:i});}else o instanceof chunkUDSJGML2_cjs.a&&(r=new chunkATLSIYRH_cjs.a({db:o.db}));r?.connect&&await r.connect(),(await chunkUJNSOOYZ_cjs.d(r))?.success,typeof exports.a.startWebSocket=="function"&&exports.a.startWebSocket().catch(i=>{console.error("[Kyro] WebSocket auto-start failed:",i);}),globalThis.__KYRO_INSTANCE__=exports.a;}catch(e){throw exports.a=null,n=null,console.error("[Kyro API] Init failed, will retry:",e),e}}async function v(){n||(n=_()),await n;}var D=async e=>{if(!exports.a){n||(n=_());try{await Promise.race([n,new Promise((l,a)=>setTimeout(()=>a(new Error("Initialization timeout")),3e4))]);}catch{return new Response(JSON.stringify({error:"Service Unavailable",message:"Kyro CMS is still starting up. Please try again in a moment."}),{status:503,headers:{"Content-Type":"application/json","Retry-After":"5"}})}}let r=new URL(e.request.url).pathname,s=__KYRO_API_PATH__;if(r===`${s}/graphql`&&typeof exports.a.getGraphQL=="function"){let a=await exports.a.getGraphQL().fetch(e.request,e.locals);return new Response(a.body,a)}if(r.startsWith(`${s}/trpc/`)&&typeof exports.a.getTRPC=="function"){let a=await exports.a.getTRPC().fetch(e.request,e.locals);return new Response(a.body,a)}return exports.a.getREST().fetch(e.request,e.locals)};exports.b=v;exports.c=D;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var h=Object.create;var e=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var m=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b)=>()=>(a&&(b=a(a=0)),b);var o=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports),p=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:true});},g=(a,b,c,f)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of j(b))!l.call(a,d)&&d!==c&&e(a,d,{get:()=>b[d],enumerable:!(f=i(b,d))||f.enumerable});return a};var q=(a,b,c)=>(c=a!=null?h(k(a)):{},g(b||!a||!a.__esModule?e(c,"default",{value:a,enumerable:true}):c,a)),r=a=>g(e({},"__esModule",{value:true}),a);export{m as a,n as b,o as c,p as d,q as e,r as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {q,r}from'./chunk-
|
|
1
|
+
import {q,r}from'./chunk-FS7GL2BR.js';import {d}from'./chunk-FO3HLBC7.js';import {a as a$1}from'./chunk-2W4FK6CJ.js';import {c}from'./chunk-CDL7ARXT.js';import {a}from'./chunk-RHCWCG3O.js';import {a as a$2}from'./chunk-G6A7OSIG.js';import {a as a$3}from'./chunk-P7CESLDJ.js';import A from'kyro:config';var t=null,n=null;async function _(){if(!t)try{let e=A.default||A;t=q(e),await t.init(),await t.loadSettings();let o=t.db,r$1;if(o instanceof c){if(o.dialect==="postgres")r$1=new a({db:o.client});else if(o.dialect==="sqlite"){let i=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";r$1=new a$1({path:i});}}else if(o instanceof r){let i=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";r$1=new a$1({path:i});}else o instanceof a$2&&(r$1=new a$3({db:o.db}));r$1?.connect&&await r$1.connect(),(await d(r$1))?.success,typeof t.startWebSocket=="function"&&t.startWebSocket().catch(i=>{console.error("[Kyro] WebSocket auto-start failed:",i);}),globalThis.__KYRO_INSTANCE__=t;}catch(e){throw t=null,n=null,console.error("[Kyro API] Init failed, will retry:",e),e}}async function v(){n||(n=_()),await n;}var D=async e=>{if(!t){n||(n=_());try{await Promise.race([n,new Promise((l,a)=>setTimeout(()=>a(new Error("Initialization timeout")),3e4))]);}catch{return new Response(JSON.stringify({error:"Service Unavailable",message:"Kyro CMS is still starting up. Please try again in a moment."}),{status:503,headers:{"Content-Type":"application/json","Retry-After":"5"}})}}let r=new URL(e.request.url).pathname,s=__KYRO_API_PATH__;if(r===`${s}/graphql`&&typeof t.getGraphQL=="function"){let a=await t.getGraphQL().fetch(e.request,e.locals);return new Response(a.body,a)}if(r.startsWith(`${s}/trpc/`)&&typeof t.getTRPC=="function"){let a=await t.getTRPC().fetch(e.request,e.locals);return new Response(a.body,a)}return t.getREST().fetch(e.request,e.locals)};export{t as a,v as b,D as c};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';var chunkNY47CFVP_cjs=require('./chunk-NY47CFVP.cjs'),chunkQ3Q7BJVQ_cjs=require('./chunk-Q3Q7BJVQ.cjs');var Fi=Object.freeze({major:16,minor:14,patch:0,preReleaseTag:null});function L(e,t){throw new Error(t)}function ne(e){return typeof e=="object"&&e!==null}function q(e,t){throw new Error(t??"Unexpected invariant triggered.")}var Ci=/\r\n|[\n\r]/g;function Pe(e,t){let n=0,r=1;for(let i of e.body.matchAll(Ci)){if(typeof i.index=="number"||q(),i.index>=t)break;n=i.index+i[0].length,r+=1;}return {line:r,column:t+1-n}}function _n(e){return Gt(e.source,Pe(e.source,e.start))}function Gt(e,t){let n=e.locationOffset.column-1,r="".padStart(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,o=t.line+s,a=t.line===1?n:0,c=t.column+a,p=`${e.name}:${o}:${c}
|
|
2
|
+
`,l=r.split(/\r\n|[\n\r]/g),f=l[i];if(f.length>120){let h=Math.floor(c/80),I=c%80,N=[];for(let A=0;A<f.length;A+=80)N.push(f.slice(A,A+80));return p+Qr([[`${o} |`,N[0]],...N.slice(1,h+1).map(A=>["|",A]),["|","^".padStart(I)],["|",N[h+1]]])}return p+Qr([[`${o-1} |`,l[i-1]],[`${o} |`,f],["|","^".padStart(c)],[`${o+1} |`,l[i+1]]])}function Qr(e){let t=e.filter(([r,i])=>i!==void 0),n=Math.max(...t.map(([r])=>r.length));return t.map(([r,i])=>r.padStart(n)+(i?" "+i:"")).join(`
|
|
3
|
+
`)}function $i(e){let t=e[0];return t==null||"kind"in t||"length"in t?{nodes:t,source:e[1],positions:e[2],path:e[3],originalError:e[4],extensions:e[5]}:t}var d=class e extends Error{constructor(t,...n){var r,i,s;let{nodes:o,source:a,positions:c,path:p,originalError:l,extensions:f}=$i(n);super(t),this.name="GraphQLError",this.path=p??void 0,this.originalError=l??void 0,this.nodes=Br(Array.isArray(o)?o:o?[o]:void 0);let h=Br((r=this.nodes)===null||r===void 0?void 0:r.map(N=>N.loc).filter(N=>N!=null));this.source=a??(h==null||(i=h[0])===null||i===void 0?void 0:i.source),this.positions=c??h?.map(N=>N.start),this.locations=c&&a?c.map(N=>Pe(a,N)):h?.map(N=>Pe(N.source,N.start));let I=ne(l?.extensions)?l?.extensions:void 0;this.extensions=(s=f??I)!==null&&s!==void 0?s:Object.create(null),Object.defineProperties(this,{message:{writable:true,enumerable:true},name:{enumerable:false},nodes:{enumerable:false},source:{enumerable:false},positions:{enumerable:false},originalError:{enumerable:false}}),l!=null&&l.stack?Object.defineProperty(this,"stack",{value:l.stack,writable:true,configurable:true}):Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:Error().stack,writable:true,configurable:true});}get[Symbol.toStringTag](){return "GraphQLError"}toString(){let t=this.message;if(this.nodes)for(let n of this.nodes)n.loc&&(t+=`
|
|
4
|
+
|
|
5
|
+
`+_n(n.loc));else if(this.source&&this.locations)for(let n of this.locations)t+=`
|
|
6
|
+
|
|
7
|
+
`+Gt(this.source,n);return t}toJSON(){let t={message:this.message};return this.locations!=null&&(t.locations=this.locations),this.path!=null&&(t.path=this.path),this.extensions!=null&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}};function Br(e){return e===void 0||e.length===0?void 0:e}function P(e,t,n){return new d(`Syntax Error: ${n}`,{source:e,positions:[t]})}var ut=class{constructor(t,n,r){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=r;}get[Symbol.toStringTag](){return "Location"}toJSON(){return {start:this.start,end:this.end}}},Qe=class{constructor(t,n,r,i,s,o){this.kind=t,this.start=n,this.end=r,this.line=i,this.column=s,this.value=o,this.prev=null,this.next=null;}get[Symbol.toStringTag](){return "Token"}toJSON(){return {kind:this.kind,value:this.value,line:this.line,column:this.column}}},ct={Name:[],Document:["definitions"],OperationDefinition:["description","name","variableDefinitions","directives","selectionSet"],VariableDefinition:["description","variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["description","name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","directives","locations"],SchemaExtension:["directives","operationTypes"],DirectiveExtension:["name","directives"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"],TypeCoordinate:["name"],MemberCoordinate:["name","memberName"],ArgumentCoordinate:["name","fieldName","argumentName"],DirectiveCoordinate:["name"],DirectiveArgumentCoordinate:["name","argumentName"]},Ui=new Set(Object.keys(ct));function pt(e){let t=e?.kind;return typeof t=="string"&&Ui.has(t)}var K;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription";})(K||(K={}));exports.c=void 0;(function(e){e.QUERY="QUERY",e.MUTATION="MUTATION",e.SUBSCRIPTION="SUBSCRIPTION",e.FIELD="FIELD",e.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",e.FRAGMENT_SPREAD="FRAGMENT_SPREAD",e.INLINE_FRAGMENT="INLINE_FRAGMENT",e.VARIABLE_DEFINITION="VARIABLE_DEFINITION",e.SCHEMA="SCHEMA",e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.FIELD_DEFINITION="FIELD_DEFINITION",e.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.ENUM_VALUE="ENUM_VALUE",e.INPUT_OBJECT="INPUT_OBJECT",e.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION",e.DIRECTIVE_DEFINITION="DIRECTIVE_DEFINITION";})(exports.c||(exports.c={}));exports.d=void 0;(function(e){e.NAME="Name",e.DOCUMENT="Document",e.OPERATION_DEFINITION="OperationDefinition",e.VARIABLE_DEFINITION="VariableDefinition",e.SELECTION_SET="SelectionSet",e.FIELD="Field",e.ARGUMENT="Argument",e.FRAGMENT_SPREAD="FragmentSpread",e.INLINE_FRAGMENT="InlineFragment",e.FRAGMENT_DEFINITION="FragmentDefinition",e.VARIABLE="Variable",e.INT="IntValue",e.FLOAT="FloatValue",e.STRING="StringValue",e.BOOLEAN="BooleanValue",e.NULL="NullValue",e.ENUM="EnumValue",e.LIST="ListValue",e.OBJECT="ObjectValue",e.OBJECT_FIELD="ObjectField",e.DIRECTIVE="Directive",e.NAMED_TYPE="NamedType",e.LIST_TYPE="ListType",e.NON_NULL_TYPE="NonNullType",e.SCHEMA_DEFINITION="SchemaDefinition",e.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",e.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",e.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",e.FIELD_DEFINITION="FieldDefinition",e.INPUT_VALUE_DEFINITION="InputValueDefinition",e.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",e.UNION_TYPE_DEFINITION="UnionTypeDefinition",e.ENUM_TYPE_DEFINITION="EnumTypeDefinition",e.ENUM_VALUE_DEFINITION="EnumValueDefinition",e.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",e.DIRECTIVE_DEFINITION="DirectiveDefinition",e.SCHEMA_EXTENSION="SchemaExtension",e.DIRECTIVE_EXTENSION="DirectiveExtension",e.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",e.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",e.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",e.UNION_TYPE_EXTENSION="UnionTypeExtension",e.ENUM_TYPE_EXTENSION="EnumTypeExtension",e.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension",e.TYPE_COORDINATE="TypeCoordinate",e.MEMBER_COORDINATE="MemberCoordinate",e.ARGUMENT_COORDINATE="ArgumentCoordinate",e.DIRECTIVE_COORDINATE="DirectiveCoordinate",e.DIRECTIVE_ARGUMENT_COORDINATE="DirectiveArgumentCoordinate";})(exports.d||(exports.d={}));function Pt(e){return e===9||e===32}function Be(e){return e>=48&&e<=57}function qr(e){return e>=97&&e<=122||e>=65&&e<=90}function lt(e){return qr(e)||e===95}function Qt(e){return qr(e)||Be(e)||e===95}function Yr(e){var t;let n=Number.MAX_SAFE_INTEGER,r=null,i=-1;for(let o=0;o<e.length;++o){var s;let a=e[o],c=Vi(a);c!==a.length&&(r=(s=r)!==null&&s!==void 0?s:o,i=o,o!==0&&c<n&&(n=c));}return e.map((o,a)=>a===0?o:o.slice(n)).slice((t=r)!==null&&t!==void 0?t:0,i+1)}function Vi(e){let t=0;for(;t<e.length&&Pt(e.charCodeAt(t));)++t;return t}function Kr(e){if(e==="")return true;let t=true,n=false,r=true,i=false;for(let s=0;s<e.length;++s)switch(e.codePointAt(s)){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 11:case 12:case 14:case 15:return false;case 13:return false;case 10:if(t&&!i)return false;i=true,t=true,n=false;break;case 9:case 32:n||(n=t);break;default:r&&(r=n),t=false;}return !(t||r&&i)}function Jr(e,t){let n=e.replace(/"""/g,'\\"""'),r=n.split(/\r\n|[\n\r]/g),i=r.length===1,s=r.length>1&&r.slice(1).every(I=>I.length===0||Pt(I.charCodeAt(0))),o=n.endsWith('\\"""'),a=e.endsWith('"')&&!o,c=e.endsWith("\\"),p=a||c,l=(!i||e.length>70||p||s||o),f="",h=i&&Pt(e.charCodeAt(0));return (l&&!h||s)&&(f+=`
|
|
8
|
+
`),f+=n,(l||p)&&(f+=`
|
|
9
|
+
`),'"""'+f+'"""'}var m;(function(e){e.SOF="<SOF>",e.EOF="<EOF>",e.BANG="!",e.DOLLAR="$",e.AMP="&",e.PAREN_L="(",e.PAREN_R=")",e.DOT=".",e.SPREAD="...",e.COLON=":",e.EQUALS="=",e.AT="@",e.BRACKET_L="[",e.BRACKET_R="]",e.BRACE_L="{",e.PIPE="|",e.BRACE_R="}",e.NAME="Name",e.INT="Int",e.FLOAT="Float",e.STRING="String",e.BLOCK_STRING="BlockString",e.COMMENT="Comment";})(m||(m={}));var dt=class{constructor(t){let n=new Qe(m.SOF,0,0,0,0);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0;}get[Symbol.toStringTag](){return "Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==m.EOF)do if(t.next)t=t.next;else {let n=ji(this,t.end);t.next=n,n.prev=t,t=n;}while(t.kind===m.COMMENT);return t}};function zr(e){return e===m.BANG||e===m.DOLLAR||e===m.AMP||e===m.PAREN_L||e===m.PAREN_R||e===m.DOT||e===m.SPREAD||e===m.COLON||e===m.EQUALS||e===m.AT||e===m.BRACKET_L||e===m.BRACKET_R||e===m.BRACE_L||e===m.PIPE||e===m.BRACE_R}function qe(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function Bt(e,t){return Wr(e.charCodeAt(t))&&Hr(e.charCodeAt(t+1))}function Wr(e){return e>=55296&&e<=56319}function Hr(e){return e>=56320&&e<=57343}function Fe(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return m.EOF;if(n>=32&&n<=126){let r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return "U+"+n.toString(16).toUpperCase().padStart(4,"0")}function J(e,t,n,r,i){let s=e.line,o=1+n-e.lineStart;return new Qe(t,n,r,s,o,i)}function ji(e,t){let n=e.source.body,r=n.length,i=t;for(;i<r;){let s=n.charCodeAt(i);switch(s){case 65279:case 9:case 32:case 44:++i;continue;case 10:++i,++e.line,e.lineStart=i;continue;case 13:n.charCodeAt(i+1)===10?i+=2:++i,++e.line,e.lineStart=i;continue;case 35:return Mi(e,i);case 33:return J(e,m.BANG,i,i+1);case 36:return J(e,m.DOLLAR,i,i+1);case 38:return J(e,m.AMP,i,i+1);case 40:return J(e,m.PAREN_L,i,i+1);case 41:return J(e,m.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return J(e,m.SPREAD,i,i+3);break;case 58:return J(e,m.COLON,i,i+1);case 61:return J(e,m.EQUALS,i,i+1);case 64:return J(e,m.AT,i,i+1);case 91:return J(e,m.BRACKET_L,i,i+1);case 93:return J(e,m.BRACKET_R,i,i+1);case 123:return J(e,m.BRACE_L,i,i+1);case 124:return J(e,m.PIPE,i,i+1);case 125:return J(e,m.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?Yi(e,i):Pi(e,i)}if(Be(s)||s===45)return Gi(e,i,s);if(lt(s))return Ki(e,i);throw P(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:qe(s)||Bt(n,i)?`Unexpected character: ${Fe(e,i)}.`:`Invalid character: ${Fe(e,i)}.`)}return J(e,m.EOF,r,r)}function Mi(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if(s===10||s===13)break;if(qe(s))++i;else if(Bt(n,i))i+=2;else break}return J(e,m.COMMENT,t,i,n.slice(t+1,i))}function Gi(e,t,n){let r=e.source.body,i=t,s=n,o=false;if(s===45&&(s=r.charCodeAt(++i)),s===48){if(s=r.charCodeAt(++i),Be(s))throw P(e.source,i,`Invalid number, unexpected digit after 0: ${Fe(e,i)}.`)}else i=Dn(e,i,s),s=r.charCodeAt(i);if(s===46&&(o=true,s=r.charCodeAt(++i),i=Dn(e,i,s),s=r.charCodeAt(i)),(s===69||s===101)&&(o=true,s=r.charCodeAt(++i),(s===43||s===45)&&(s=r.charCodeAt(++i)),i=Dn(e,i,s),s=r.charCodeAt(i)),s===46||lt(s))throw P(e.source,i,`Invalid number, expected digit but got: ${Fe(e,i)}.`);return J(e,o?m.FLOAT:m.INT,t,i,r.slice(t,i))}function Dn(e,t,n){if(!Be(n))throw P(e.source,t,`Invalid number, expected digit but got: ${Fe(e,t)}.`);let r=e.source.body,i=t+1;for(;Be(r.charCodeAt(i));)++i;return i}function Pi(e,t){let n=e.source.body,r=n.length,i=t+1,s=i,o="";for(;i<r;){let a=n.charCodeAt(i);if(a===34)return o+=n.slice(s,i),J(e,m.STRING,t,i+1,o);if(a===92){o+=n.slice(s,i);let c=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?Qi(e,i):Bi(e,i):qi(e,i);o+=c.value,i+=c.size,s=i;continue}if(a===10||a===13)break;if(qe(a))++i;else if(Bt(n,i))i+=2;else throw P(e.source,i,`Invalid character within String: ${Fe(e,i)}.`)}throw P(e.source,i,"Unterminated string.")}function Qi(e,t){let n=e.source.body,r=0,i=3;for(;i<12;){let s=n.charCodeAt(t+i++);if(s===125){if(i<5||!qe(r))break;return {value:String.fromCodePoint(r),size:i}}if(r=r<<4|ft(s),r<0)break}throw P(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function Bi(e,t){let n=e.source.body,r=Xr(n,t+2);if(qe(r))return {value:String.fromCodePoint(r),size:6};if(Wr(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){let i=Xr(n,t+8);if(Hr(i))return {value:String.fromCodePoint(r,i),size:12}}throw P(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function Xr(e,t){return ft(e.charCodeAt(t))<<12|ft(e.charCodeAt(t+1))<<8|ft(e.charCodeAt(t+2))<<4|ft(e.charCodeAt(t+3))}function ft(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function qi(e,t){let n=e.source.body;switch(n.charCodeAt(t+1)){case 34:return {value:'"',size:2};case 92:return {value:"\\",size:2};case 47:return {value:"/",size:2};case 98:return {value:"\b",size:2};case 102:return {value:"\f",size:2};case 110:return {value:`
|
|
10
|
+
`,size:2};case 114:return {value:"\r",size:2};case 116:return {value:" ",size:2}}throw P(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function Yi(e,t){let n=e.source.body,r=n.length,i=e.lineStart,s=t+3,o=s,a="",c=[];for(;s<r;){let p=n.charCodeAt(s);if(p===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){a+=n.slice(o,s),c.push(a);let l=J(e,m.BLOCK_STRING,t,s+3,Yr(c).join(`
|
|
11
|
+
`));return e.line+=c.length-1,e.lineStart=i,l}if(p===92&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34&&n.charCodeAt(s+3)===34){a+=n.slice(o,s),o=s+1,s+=4;continue}if(p===10||p===13){a+=n.slice(o,s),c.push(a),p===13&&n.charCodeAt(s+1)===10?s+=2:++s,a="",o=s,i=s;continue}if(qe(p))++s;else if(Bt(n,s))s+=2;else throw P(e.source,s,`Invalid character within String: ${Fe(e,s)}.`)}throw P(e.source,s,"Unterminated string.")}function Ki(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if(Qt(s))++i;else break}return J(e,m.NAME,t,i,n.slice(t,i))}function y(e){return qt(e,[])}function qt(e,t){switch(typeof e){case "string":return JSON.stringify(e);case "function":return e.name?`[function ${e.name}]`:"[function]";case "object":return Ji(e,t);default:return String(e)}}function Ji(e,t){if(e===null)return "null";if(t.includes(e))return "[Circular]";let n=[...t,e];if(Xi(e)){let r=e.toJSON();if(r!==e)return typeof r=="string"?r:qt(r,n)}else if(Array.isArray(e))return Wi(e,n);return zi(e,n)}function Xi(e){return typeof e.toJSON=="function"}function zi(e,t){let n=Object.entries(e);return n.length===0?"{}":t.length>2?"["+Hi(e)+"]":"{ "+n.map(([i,s])=>i+": "+qt(s,t)).join(", ")+" }"}function Wi(e,t){if(e.length===0)return "[]";if(t.length>2)return "[Array]";let n=Math.min(10,e.length),r=e.length-n,i=[];for(let s=0;s<n;++s)i.push(qt(e[s],t));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function Hi(e){let t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){let n=e.constructor.name;if(typeof n=="string"&&n!=="")return n}return t}var Zi=globalThis.process&&process.env.NODE_ENV==="production",re=Zi?function(t,n){return t instanceof n}:function(t,n){if(t instanceof n)return true;if(typeof t=="object"&&t!==null){var r;let i=n.prototype[Symbol.toStringTag],s=Symbol.toStringTag in t?t[Symbol.toStringTag]:(r=t.constructor)===null||r===void 0?void 0:r.name;if(i===s){let o=y(t);throw new Error(`Cannot use ${i} "${o}" from another module or realm.
|
|
12
|
+
|
|
13
|
+
Ensure that there is only one instance of "graphql" in the node_modules
|
|
14
|
+
directory. If different versions of "graphql" are the dependencies of other
|
|
15
|
+
relied on modules, use "resolutions" to ensure only one version is installed.
|
|
16
|
+
|
|
17
|
+
https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
18
|
+
|
|
19
|
+
Duplicate "graphql" modules cannot be used at the same time since different
|
|
20
|
+
versions may have different capabilities and behavior. The data from one
|
|
21
|
+
version used in the function from another could produce confusing and
|
|
22
|
+
spurious results.`)}}return false};var Ye=class{constructor(t,n="GraphQL request",r={line:1,column:1}){typeof t=="string"||L(false,`Body must be a string. Received: ${y(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||L(false,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||L(false,"column in locationOffset is 1-indexed and must be positive.");}get[Symbol.toStringTag](){return "Source"}};function Zr(e){return re(e,Ye)}function ei(e,t){let n=new An(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:false,value:n.tokenCount}),r}var An=class{constructor(t,n={}){let{lexer:r,...i}=n;if(r)this._lexer=r;else {let s=Zr(t)?t:new Ye(t);this._lexer=new dt(s);}this._options=i,this._tokenCounter=0;}get tokenCount(){return this._tokenCounter}parseName(){let t=this.expectToken(m.NAME);return this.node(t,{kind:exports.d.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:exports.d.DOCUMENT,definitions:this.many(m.SOF,this.parseDefinition,m.EOF)})}parseDefinition(){if(this.peek(m.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(t&&n.kind===m.BRACE_L)throw P(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(n.kind===m.NAME){switch(n.value){case "schema":return this.parseSchemaDefinition();case "scalar":return this.parseScalarTypeDefinition();case "type":return this.parseObjectTypeDefinition();case "interface":return this.parseInterfaceTypeDefinition();case "union":return this.parseUnionTypeDefinition();case "enum":return this.parseEnumTypeDefinition();case "input":return this.parseInputObjectTypeDefinition();case "directive":return this.parseDirectiveDefinition()}switch(n.value){case "query":case "mutation":case "subscription":return this.parseOperationDefinition();case "fragment":return this.parseFragmentDefinition()}if(t)throw P(this._lexer.source,this._lexer.token.start,"Unexpected description, only GraphQL definitions support descriptions.");if(n.value==="extend")return this.parseTypeSystemExtension()}throw this.unexpected(n)}parseOperationDefinition(){let t=this._lexer.token;if(this.peek(m.BRACE_L))return this.node(t,{kind:exports.d.OPERATION_DEFINITION,operation:K.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let n=this.parseDescription(),r=this.parseOperationType(),i;return this.peek(m.NAME)&&(i=this.parseName()),this.node(t,{kind:exports.d.OPERATION_DEFINITION,operation:r,description:n,name:i,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(false),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(m.NAME);switch(t.value){case "query":return K.QUERY;case "mutation":return K.MUTATION;case "subscription":return K.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(m.PAREN_L,this.parseVariableDefinition,m.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:exports.d.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(m.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(m.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(m.DOLLAR),this.node(t,{kind:exports.d.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:exports.d.SELECTION_SET,selections:this.many(m.BRACE_L,this.parseSelection,m.BRACE_R)})}parseSelection(){return this.peek(m.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),r,i;return this.expectOptionalToken(m.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:exports.d.FIELD,alias:r,name:i,arguments:this.parseArguments(false),directives:this.parseDirectives(false),selectionSet:this.peek(m.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(m.PAREN_L,n,m.PAREN_R)}parseArgument(t=false){let n=this._lexer.token,r=this.parseName();return this.expectToken(m.COLON),this.node(n,{kind:exports.d.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(true)}parseFragment(){let t=this._lexer.token;this.expectToken(m.SPREAD);let n=this.expectOptionalKeyword("on");return !n&&this.peek(m.NAME)?this.node(t,{kind:exports.d.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(false)}):this.node(t,{kind:exports.d.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(false),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){let t=this._lexer.token,n=this.parseDescription();return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===true?this.node(t,{kind:exports.d.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(false),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:exports.d.FRAGMENT_DEFINITION,description:n,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(false),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(t){let n=this._lexer.token;switch(n.kind){case m.BRACKET_L:return this.parseList(t);case m.BRACE_L:return this.parseObject(t);case m.INT:return this.advanceLexer(),this.node(n,{kind:exports.d.INT,value:n.value});case m.FLOAT:return this.advanceLexer(),this.node(n,{kind:exports.d.FLOAT,value:n.value});case m.STRING:case m.BLOCK_STRING:return this.parseStringLiteral();case m.NAME:switch(this.advanceLexer(),n.value){case "true":return this.node(n,{kind:exports.d.BOOLEAN,value:true});case "false":return this.node(n,{kind:exports.d.BOOLEAN,value:false});case "null":return this.node(n,{kind:exports.d.NULL});default:return this.node(n,{kind:exports.d.ENUM,value:n.value})}case m.DOLLAR:if(t)if(this.expectToken(m.DOLLAR),this._lexer.token.kind===m.NAME){let r=this._lexer.token.value;throw P(this._lexer.source,n.start,`Unexpected variable "$${r}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(true)}parseStringLiteral(){let t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:exports.d.STRING,value:t.value,block:t.kind===m.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:exports.d.LIST,values:this.any(m.BRACKET_L,n,m.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:exports.d.OBJECT,fields:this.any(m.BRACE_L,n,m.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,r=this.parseName();return this.expectToken(m.COLON),this.node(n,{kind:exports.d.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(m.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(true)}parseDirective(t){let n=this._lexer.token;return this.expectToken(m.AT),this.node(n,{kind:exports.d.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(m.BRACKET_L)){let r=this.parseTypeReference();this.expectToken(m.BRACKET_R),n=this.node(t,{kind:exports.d.LIST_TYPE,type:r});}else n=this.parseNamedType();return this.expectOptionalToken(m.BANG)?this.node(t,{kind:exports.d.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:exports.d.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(m.STRING)||this.peek(m.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");let r=this.parseConstDirectives(),i=this.many(m.BRACE_L,this.parseOperationTypeDefinition,m.BRACE_R);return this.node(t,{kind:exports.d.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(m.COLON);let r=this.parseNamedType();return this.node(t,{kind:exports.d.OPERATION_TYPE_DEFINITION,operation:n,type:r})}parseScalarTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");let r=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:exports.d.SCALAR_TYPE_DEFINITION,description:n,name:r,directives:i})}parseObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(t,{kind:exports.d.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(m.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(m.BRACE_L,this.parseFieldDefinition,m.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(m.COLON);let s=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(t,{kind:exports.d.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:o})}parseArgumentDefs(){return this.optionalMany(m.PAREN_L,this.parseInputValueDef,m.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(m.COLON);let i=this.parseTypeReference(),s;this.expectOptionalToken(m.EQUALS)&&(s=this.parseConstValueLiteral());let o=this.parseConstDirectives();return this.node(t,{kind:exports.d.INPUT_VALUE_DEFINITION,description:n,name:r,type:i,defaultValue:s,directives:o})}parseInterfaceTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");let r=this.parseName(),i=this.parseImplementsInterfaces(),s=this.parseConstDirectives(),o=this.parseFieldsDefinition();return this.node(t,{kind:exports.d.INTERFACE_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:o})}parseUnionTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseUnionMemberTypes();return this.node(t,{kind:exports.d.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(m.EQUALS)?this.delimitedMany(m.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseEnumValuesDefinition();return this.node(t,{kind:exports.d.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(m.BRACE_L,this.parseEnumValueDefinition,m.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:exports.d.ENUM_VALUE_DEFINITION,description:n,name:r,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw P(this._lexer.source,this._lexer.token.start,`${Yt(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");let r=this.parseName(),i=this.parseConstDirectives(),s=this.parseInputFieldsDefinition();return this.node(t,{kind:exports.d.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(m.BRACE_L,this.parseInputValueDef,m.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===m.NAME)switch(t.value){case "schema":return this.parseSchemaExtension();case "scalar":return this.parseScalarTypeExtension();case "type":return this.parseObjectTypeExtension();case "interface":return this.parseInterfaceTypeExtension();case "union":return this.parseUnionTypeExtension();case "enum":return this.parseEnumTypeExtension();case "input":return this.parseInputObjectTypeExtension();case "directive":if(this._options.experimentalDirectivesOnDirectiveDefinitions)return this.parseDirectiveDefinitionExtension();break}throw this.unexpected(t)}parseSchemaExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");let n=this.parseConstDirectives(),r=this.optionalMany(m.BRACE_L,this.parseOperationTypeDefinition,m.BRACE_R);if(n.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:exports.d.SCHEMA_EXTENSION,directives:n,operationTypes:r})}parseScalarTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");let n=this.parseName(),r=this.parseConstDirectives();if(r.length===0)throw this.unexpected();return this.node(t,{kind:exports.d.SCALAR_TYPE_EXTENSION,name:n,directives:r})}parseObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:exports.d.OBJECT_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseInterfaceTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");let n=this.parseName(),r=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),s=this.parseFieldsDefinition();if(r.length===0&&i.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:exports.d.INTERFACE_TYPE_EXTENSION,name:n,interfaces:r,directives:i,fields:s})}parseUnionTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:exports.d.UNION_TYPE_EXTENSION,name:n,directives:r,types:i})}parseEnumTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:exports.d.ENUM_TYPE_EXTENSION,name:n,directives:r,values:i})}parseInputObjectTypeExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");let n=this.parseName(),r=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(r.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:exports.d.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveDefinitionExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("directive"),this.expectToken(m.AT);let n=this.parseName(),r=this.parseConstDirectives();if(r.length===0)throw this.unexpected();return this.node(t,{kind:exports.d.DIRECTIVE_EXTENSION,name:n,directives:r})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(m.AT);let r=this.parseName(),i=this.parseArgumentDefs(),s=this._options.experimentalDirectivesOnDirectiveDefinitions?this.parseConstDirectives():[],o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");let a=this.parseDirectiveLocations();return this.node(t,{kind:exports.d.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,directives:s,repeatable:o,locations:a})}parseDirectiveLocations(){return this.delimitedMany(m.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(exports.c,n.value))return n;throw this.unexpected(t)}parseSchemaCoordinate(){let t=this._lexer.token,n=this.expectOptionalToken(m.AT),r=this.parseName(),i;!n&&this.expectOptionalToken(m.DOT)&&(i=this.parseName());let s;return (n||i)&&this.expectOptionalToken(m.PAREN_L)&&(s=this.parseName(),this.expectToken(m.COLON),this.expectToken(m.PAREN_R)),n?s?this.node(t,{kind:exports.d.DIRECTIVE_ARGUMENT_COORDINATE,name:r,argumentName:s}):this.node(t,{kind:exports.d.DIRECTIVE_COORDINATE,name:r}):i?s?this.node(t,{kind:exports.d.ARGUMENT_COORDINATE,name:r,fieldName:i,argumentName:s}):this.node(t,{kind:exports.d.MEMBER_COORDINATE,name:r,memberName:i}):this.node(t,{kind:exports.d.TYPE_COORDINATE,name:r})}node(t,n){return this._options.noLocation!==true&&(n.loc=new ut(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){let n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw P(this._lexer.source,n.start,`Expected ${ti(t)}, found ${Yt(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),true):false}expectKeyword(t){let n=this._lexer.token;if(n.kind===m.NAME&&n.value===t)this.advanceLexer();else throw P(this._lexer.source,n.start,`Expected "${t}", found ${Yt(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===m.NAME&&n.value===t?(this.advanceLexer(),true):false}unexpected(t){let n=t??this._lexer.token;return P(this._lexer.source,n.start,`Unexpected ${Yt(n)}.`)}any(t,n,r){this.expectToken(t);let i=[];for(;!this.expectOptionalToken(r);)i.push(n.call(this));return i}optionalMany(t,n,r){if(this.expectOptionalToken(t)){let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}return []}many(t,n,r){this.expectToken(t);let i=[];do i.push(n.call(this));while(!this.expectOptionalToken(r));return i}delimitedMany(t,n){this.expectOptionalToken(t);let r=[];do r.push(n.call(this));while(this.expectOptionalToken(t));return r}advanceLexer(){let{maxTokens:t}=this._options,n=this._lexer.advance();if(n.kind!==m.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw P(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}};function Yt(e){let t=e.value;return ti(e.kind)+(t!=null?` "${t}"`:"")}function ti(e){return zr(e)?`"${e}"`:e}function ee(e,t){let[n,r]=t?[e,t]:[void 0,e],i=" Did you mean ";n&&(i+=n+" ");let s=r.map(c=>`"${c}"`);switch(s.length){case 0:return "";case 1:return i+s[0]+"?";case 2:return i+s[0]+" or "+s[1]+"?"}let o=s.slice(0,5),a=o.pop();return i+o.join(", ")+", or "+a+"?"}function Ln(e){return e}function ye(e,t){let n=Object.create(null);for(let r of e)n[t(r)]=r;return n}function mt(e,t,n){let r=Object.create(null);for(let i of e)r[t(i)]=n(i);return r}function Ce(e,t){let n=Object.create(null);for(let r of Object.keys(e))n[r]=t(e[r],r);return n}function Ke(e,t){let n=0,r=0;for(;n<e.length&&r<t.length;){let i=e.charCodeAt(n),s=t.charCodeAt(r);if(Kt(i)&&Kt(s)){let o=0;do++n,o=o*10+i-xn,i=e.charCodeAt(n);while(Kt(i)&&o>0);let a=0;do++r,a=a*10+s-xn,s=t.charCodeAt(r);while(Kt(s)&&a>0);if(o<a)return -1;if(o>a)return 1}else {if(i<s)return -1;if(i>s)return 1;++n,++r;}}return e.length-t.length}var xn=48,es=57;function Kt(e){return !isNaN(e)&&xn<=e&&e<=es}function ie(e,t){let n=Object.create(null),r=new Rn(e),i=Math.floor(e.length*.4)+1;for(let s of t){let o=r.measure(s,i);o!==void 0&&(n[s]=o);}return Object.keys(n).sort((s,o)=>{let a=n[s]-n[o];return a!==0?a:Ke(s,o)})}var Rn=class{constructor(t){this._input=t,this._inputLowerCase=t.toLowerCase(),this._inputArray=ni(this._inputLowerCase),this._rows=[new Array(t.length+1).fill(0),new Array(t.length+1).fill(0),new Array(t.length+1).fill(0)];}measure(t,n){if(this._input===t)return 0;let r=t.toLowerCase();if(this._inputLowerCase===r)return 1;let i=ni(r),s=this._inputArray;if(i.length<s.length){let l=i;i=s,s=l;}let o=i.length,a=s.length;if(o-a>n)return;let c=this._rows;for(let l=0;l<=a;l++)c[0][l]=l;for(let l=1;l<=o;l++){let f=c[(l-1)%3],h=c[l%3],I=h[0]=l;for(let N=1;N<=a;N++){let A=i[l-1]===s[N-1]?0:1,B=Math.min(f[N]+1,h[N-1]+1,f[N-1]+A);if(l>1&&N>1&&i[l-1]===s[N-2]&&i[l-2]===s[N-1]){let M=c[(l-2)%3][N-2];B=Math.min(B,M+1);}B<I&&(I=B),h[N]=B;}if(I>n)return}let p=c[o%3][a];return p<=n?p:void 0}};function ni(e){let t=e.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=e.charCodeAt(r);return n}function se(e){if(e==null)return Object.create(null);if(Object.getPrototypeOf(e)===null)return e;let t=Object.create(null);for(let[n,r]of Object.entries(e))t[n]=r;return t}function ri(e){return `"${e.replace(ts,ns)}"`}var ts=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function ns(e){return rs[e.charCodeAt(0)]}var rs=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"];var Je=Object.freeze({});function $e(e,t,n=ct){let r=new Map;for(let M of Object.values(exports.d))r.set(M,Xe(t,M));let i,s=Array.isArray(e),o=[e],a=-1,c=[],p=e,l,f,h=[],I=[];do{a++;let M=a===o.length,Ie=M&&c.length!==0;if(M){if(l=I.length===0?void 0:h[h.length-1],p=f,f=I.pop(),Ie)if(s){p=p.slice();let F=0;for(let[G,C]of c){let g=G-F;C===null?(p.splice(g,1),F++):p[g]=C;}}else {p={...p};for(let[F,G]of c)p[F]=G;}a=i.index,o=i.keys,c=i.edits,s=i.inArray,i=i.prev;}else if(f){if(l=s?a:o[a],p=f[l],p==null)continue;h.push(l);}let T;if(!Array.isArray(p)){var N,A;pt(p)||L(false,`Invalid AST Node: ${y(p)}.`);let F=M?(N=r.get(p.kind))===null||N===void 0?void 0:N.leave:(A=r.get(p.kind))===null||A===void 0?void 0:A.enter;if(T=F?.call(t,p,l,f,h,I),T===Je)break;if(T===false){if(!M){h.pop();continue}}else if(T!==void 0&&(c.push([l,T]),!M))if(pt(T))p=T;else {h.pop();continue}}if(T===void 0&&Ie&&c.push([l,p]),M)h.pop();else {var B;i={inArray:s,index:a,keys:o,edits:c,prev:i},s=Array.isArray(p),o=s?p:(B=n[p.kind])!==null&&B!==void 0?B:[],a=-1,c=[],f&&I.push(f),f=p;}}while(i!==void 0);return c.length!==0?c[c.length-1][1]:e}function wn(e){let t=new Array(e.length).fill(null),n=Object.create(null);for(let r of Object.values(exports.d)){let i=false,s=new Array(e.length).fill(void 0),o=new Array(e.length).fill(void 0);for(let c=0;c<e.length;++c){let{enter:p,leave:l}=Xe(e[c],r);i||(i=p!=null||l!=null),s[c]=p,o[c]=l;}if(!i)continue;let a={enter(...c){let p=c[0];for(let f=0;f<e.length;f++)if(t[f]===null){var l;let h=(l=s[f])===null||l===void 0?void 0:l.apply(e[f],c);if(h===false)t[f]=p;else if(h===Je)t[f]=Je;else if(h!==void 0)return h}},leave(...c){let p=c[0];for(let f=0;f<e.length;f++)if(t[f]===null){var l;let h=(l=o[f])===null||l===void 0?void 0:l.apply(e[f],c);if(h===Je)t[f]=Je;else if(h!==void 0&&h!==false)return h}else t[f]===p&&(t[f]=null);}};n[r]=a;}return n}function Xe(e,t){let n=e[t];return typeof n=="object"?n:typeof n=="function"?{enter:n,leave:void 0}:{enter:e.enter,leave:e.leave}}function w(e){return $e(e,ss)}var is=80,ss={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>E(e.definitions,`
|
|
23
|
+
|
|
24
|
+
`)},OperationDefinition:{leave(e){let t=kn(e.variableDefinitions)?S(`(
|
|
25
|
+
`,E(e.variableDefinitions,`
|
|
26
|
+
`),`
|
|
27
|
+
)`):S("(",E(e.variableDefinitions,", "),")"),n=S("",e.description,`
|
|
28
|
+
`)+E([e.operation,E([e.name,t]),E(e.directives," ")]," ");return (n==="query"?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r,description:i})=>S("",i,`
|
|
29
|
+
`)+e+": "+t+S(" = ",n)+S(" ",E(r," "))},SelectionSet:{leave:({selections:e})=>Te(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){let s=S("",e,": ")+t,o=s+S("(",E(n,", "),")");return o.length>is&&(o=s+S(`(
|
|
30
|
+
`,Jt(E(n,`
|
|
31
|
+
`)),`
|
|
32
|
+
)`)),E([o,E(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+S(" ",E(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>E(["...",S("on ",e),E(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i,description:s})=>S("",s,`
|
|
33
|
+
`)+`fragment ${e}${S("(",E(n,", "),")")} on ${t} ${S("",E(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?Jr(e):ri(e)},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+E(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+E(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+S("(",E(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>S("",e,`
|
|
34
|
+
`)+E(["schema",E(t," "),Te(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>S("",e,`
|
|
35
|
+
`)+E(["scalar",t,E(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>S("",e,`
|
|
36
|
+
`)+E(["type",t,S("implements ",E(n," & ")),E(r," "),Te(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>S("",e,`
|
|
37
|
+
`)+t+(kn(n)?S(`(
|
|
38
|
+
`,Jt(E(n,`
|
|
39
|
+
`)),`
|
|
40
|
+
)`):S("(",E(n,", "),")"))+": "+r+S(" ",E(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>S("",e,`
|
|
41
|
+
`)+E([t+": "+n,S("= ",r),E(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>S("",e,`
|
|
42
|
+
`)+E(["interface",t,S("implements ",E(n," & ")),E(r," "),Te(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>S("",e,`
|
|
43
|
+
`)+E(["union",t,E(n," "),S("= ",E(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>S("",e,`
|
|
44
|
+
`)+E(["enum",t,E(n," "),Te(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>S("",e,`
|
|
45
|
+
`)+E([t,E(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>S("",e,`
|
|
46
|
+
`)+E(["input",t,E(n," "),Te(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,directives:r,repeatable:i,locations:s})=>S("",e,`
|
|
47
|
+
`)+"directive @"+t+(kn(n)?S(`(
|
|
48
|
+
`,Jt(E(n,`
|
|
49
|
+
`)),`
|
|
50
|
+
)`):S("(",E(n,", "),")"))+S(" ",E(r," "))+(i?" repeatable":"")+" on "+E(s," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>E(["extend schema",E(e," "),Te(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>E(["extend scalar",e,E(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>E(["extend type",e,S("implements ",E(t," & ")),E(n," "),Te(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>E(["extend interface",e,S("implements ",E(t," & ")),E(n," "),Te(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>E(["extend union",e,E(t," "),S("= ",E(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>E(["extend enum",e,E(t," "),Te(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>E(["extend input",e,E(t," "),Te(n)]," ")},DirectiveExtension:{leave:({name:e,directives:t})=>E(["extend directive @"+e,E(t," ")]," ")},TypeCoordinate:{leave:({name:e})=>e},MemberCoordinate:{leave:({name:e,memberName:t})=>E([e,S(".",t)])},ArgumentCoordinate:{leave:({name:e,fieldName:t,argumentName:n})=>E([e,S(".",t),S("(",n,":)")])},DirectiveCoordinate:{leave:({name:e})=>E(["@",e])},DirectiveArgumentCoordinate:{leave:({name:e,argumentName:t})=>E(["@",e,S("(",t,":)")])}};function E(e,t=""){var n;return (n=e?.filter(r=>r).join(t))!==null&&n!==void 0?n:""}function Te(e){return S(`{
|
|
51
|
+
`,Jt(E(e,`
|
|
52
|
+
`)),`
|
|
53
|
+
}`)}function S(e,t,n=""){return t!=null&&t!==""?e+t+n:""}function Jt(e){return S(" ",e.replace(/\n/g,`
|
|
54
|
+
`))}function kn(e){var t;return (t=e?.some(n=>n.includes(`
|
|
55
|
+
`)))!==null&&t!==void 0?t:false}function ht(e,t){switch(e.kind){case exports.d.NULL:return null;case exports.d.INT:return parseInt(e.value,10);case exports.d.FLOAT:return parseFloat(e.value);case exports.d.STRING:case exports.d.ENUM:case exports.d.BOOLEAN:return e.value;case exports.d.LIST:return e.values.map(n=>ht(n,t));case exports.d.OBJECT:return mt(e.fields,n=>n.name.value,n=>ht(n.value,t));case exports.d.VARIABLE:return t?.[e.name.value]}}function ae(e){if(e!=null||L(false,"Must provide name."),typeof e=="string"||L(false,"Expected name to be a string."),e.length===0)throw new d("Expected name to be a non-empty string.");for(let t=1;t<e.length;++t)if(!Qt(e.charCodeAt(t)))throw new d(`Names must only contain [_a-zA-Z0-9] but "${e}" does not.`);if(!lt(e.charCodeAt(0)))throw new d(`Names must start with [_a-zA-Z] but "${e}" does not.`);return e}function Fn(e){if(e==="true"||e==="false"||e==="null")throw new d(`Enum values cannot be named: ${e}`);return ae(e)}function We(e){return ce(e)||x(e)||R(e)||z(e)||Q(e)||k(e)||$(e)||_(e)}function ce(e){return re(e,ue)}function x(e){return re(e,j)}function R(e){return re(e,yt)}function z(e){return re(e,Tt)}function Q(e){return re(e,Ae)}function k(e){return re(e,Le)}function $(e){return re(e,U)}function _(e){return re(e,b)}function te(e){return ce(e)||Q(e)||k(e)||Et(e)&&te(e.ofType)}function be(e){return ce(e)||x(e)||R(e)||z(e)||Q(e)||Et(e)&&be(e.ofType)}function oe(e){return ce(e)||Q(e)}function pe(e){return x(e)||R(e)||z(e)}function le(e){return R(e)||z(e)}var U=class{constructor(t){We(t)||L(false,`Expected ${y(t)} to be a GraphQL type.`),this.ofType=t;}get[Symbol.toStringTag](){return "GraphQLList"}toString(){return "["+String(this.ofType)+"]"}toJSON(){return this.toString()}},b=class{constructor(t){Nt(t)||L(false,`Expected ${y(t)} to be a GraphQL nullable type.`),this.ofType=t;}get[Symbol.toStringTag](){return "GraphQLNonNull"}toString(){return String(this.ofType)+"!"}toJSON(){return this.toString()}};function Et(e){return $(e)||_(e)}function Nt(e){return We(e)&&!_(e)}function He(e){if(e)return _(e)?e.ofType:e}function zt(e){return ce(e)||x(e)||R(e)||z(e)||Q(e)||k(e)}function W(e){if(e){let t=e;for(;Et(t);)t=t.ofType;return t}}function Wt(e){return typeof e=="function"?e():e}function Ht(e){return typeof e=="function"?e():e}var ue=class{constructor(t){var n,r,i,s;let o=(n=t.parseValue)!==null&&n!==void 0?n:Ln;this.name=ae(t.name),this.description=t.description,this.specifiedByURL=t.specifiedByURL,this.serialize=(r=t.serialize)!==null&&r!==void 0?r:Ln,this.parseValue=o,this.parseLiteral=(i=t.parseLiteral)!==null&&i!==void 0?i:(a,c)=>o(ht(a,c)),this.extensions=se(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=(s=t.extensionASTNodes)!==null&&s!==void 0?s:[],t.specifiedByURL==null||typeof t.specifiedByURL=="string"||L(false,`${this.name} must provide "specifiedByURL" as a string, but got: ${y(t.specifiedByURL)}.`),t.serialize==null||typeof t.serialize=="function"||L(false,`${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`),t.parseLiteral&&(typeof t.parseValue=="function"&&typeof t.parseLiteral=="function"||L(false,`${this.name} must provide both "parseValue" and "parseLiteral" functions.`));}get[Symbol.toStringTag](){return "GraphQLScalarType"}toConfig(){return {name:this.name,description:this.description,specifiedByURL:this.specifiedByURL,serialize:this.serialize,parseValue:this.parseValue,parseLiteral:this.parseLiteral,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}},j=class{constructor(t){var n;this.name=ae(t.name),this.description=t.description,this.isTypeOf=t.isTypeOf,this.extensions=se(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=(n=t.extensionASTNodes)!==null&&n!==void 0?n:[],this._fields=()=>oi(t),this._interfaces=()=>si(t),t.isTypeOf==null||typeof t.isTypeOf=="function"||L(false,`${this.name} must provide "isTypeOf" as a function, but got: ${y(t.isTypeOf)}.`);}get[Symbol.toStringTag](){return "GraphQLObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return {name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:ai(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}};function si(e){var t;let n=Wt((t=e.interfaces)!==null&&t!==void 0?t:[]);return Array.isArray(n)||L(false,`${e.name} interfaces must be an Array or a function which returns an Array.`),n}function oi(e){let t=Ht(e.fields);return ze(t)||L(false,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),Ce(t,(n,r)=>{var i;ze(n)||L(false,`${e.name}.${r} field config must be an object.`),n.resolve==null||typeof n.resolve=="function"||L(false,`${e.name}.${r} field resolver must be a function if provided, but got: ${y(n.resolve)}.`);let s=(i=n.args)!==null&&i!==void 0?i:{};return ze(s)||L(false,`${e.name}.${r} args must be an object with argument names as keys.`),{name:ae(r),description:n.description,type:n.type,args:Cn(s),resolve:n.resolve,subscribe:n.subscribe,deprecationReason:n.deprecationReason,extensions:se(n.extensions),astNode:n.astNode}})}function Cn(e){return Object.entries(e).map(([t,n])=>({name:ae(t),description:n.description,type:n.type,defaultValue:n.defaultValue,deprecationReason:n.deprecationReason,extensions:se(n.extensions),astNode:n.astNode}))}function ze(e){return ne(e)&&!Array.isArray(e)}function ai(e){return Ce(e,t=>({description:t.description,type:t.type,args:$n(t.args),resolve:t.resolve,subscribe:t.subscribe,deprecationReason:t.deprecationReason,extensions:t.extensions,astNode:t.astNode}))}function $n(e){return mt(e,t=>t.name,t=>({description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:t.extensions,astNode:t.astNode}))}function Se(e){return _(e.type)&&e.defaultValue===void 0}var yt=class{constructor(t){var n;this.name=ae(t.name),this.description=t.description,this.resolveType=t.resolveType,this.extensions=se(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=(n=t.extensionASTNodes)!==null&&n!==void 0?n:[],this._fields=oi.bind(void 0,t),this._interfaces=si.bind(void 0,t),t.resolveType==null||typeof t.resolveType=="function"||L(false,`${this.name} must provide "resolveType" as a function, but got: ${y(t.resolveType)}.`);}get[Symbol.toStringTag](){return "GraphQLInterfaceType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}getInterfaces(){return typeof this._interfaces=="function"&&(this._interfaces=this._interfaces()),this._interfaces}toConfig(){return {name:this.name,description:this.description,interfaces:this.getInterfaces(),fields:ai(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}},Tt=class{constructor(t){var n;this.name=ae(t.name),this.description=t.description,this.resolveType=t.resolveType,this.extensions=se(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=(n=t.extensionASTNodes)!==null&&n!==void 0?n:[],this._types=os.bind(void 0,t),t.resolveType==null||typeof t.resolveType=="function"||L(false,`${this.name} must provide "resolveType" as a function, but got: ${y(t.resolveType)}.`);}get[Symbol.toStringTag](){return "GraphQLUnionType"}getTypes(){return typeof this._types=="function"&&(this._types=this._types()),this._types}toConfig(){return {name:this.name,description:this.description,types:this.getTypes(),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}};function os(e){let t=Wt(e.types);return Array.isArray(t)||L(false,`Must provide Array of types or a function which returns such an array for Union ${e.name}.`),t}var Ae=class{constructor(t){var n;this.name=ae(t.name),this.description=t.description,this.extensions=se(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=(n=t.extensionASTNodes)!==null&&n!==void 0?n:[],this._values=typeof t.values=="function"?t.values:ii(this.name,t.values),this._valueLookup=null,this._nameLookup=null;}get[Symbol.toStringTag](){return "GraphQLEnumType"}getValues(){return typeof this._values=="function"&&(this._values=ii(this.name,this._values())),this._values}getValue(t){return this._nameLookup===null&&(this._nameLookup=ye(this.getValues(),n=>n.name)),this._nameLookup[t]}serialize(t){this._valueLookup===null&&(this._valueLookup=new Map(this.getValues().map(r=>[r.value,r])));let n=this._valueLookup.get(t);if(n===void 0)throw new d(`Enum "${this.name}" cannot represent value: ${y(t)}`);return n.name}parseValue(t){if(typeof t!="string"){let r=y(t);throw new d(`Enum "${this.name}" cannot represent non-string value: ${r}.`+Xt(this,r))}let n=this.getValue(t);if(n==null)throw new d(`Value "${t}" does not exist in "${this.name}" enum.`+Xt(this,t));return n.value}parseLiteral(t,n){if(t.kind!==exports.d.ENUM){let i=w(t);throw new d(`Enum "${this.name}" cannot represent non-enum value: ${i}.`+Xt(this,i),{nodes:t})}let r=this.getValue(t.value);if(r==null){let i=w(t);throw new d(`Value "${i}" does not exist in "${this.name}" enum.`+Xt(this,i),{nodes:t})}return r.value}toConfig(){let t=mt(this.getValues(),n=>n.name,n=>({description:n.description,value:n.value,deprecationReason:n.deprecationReason,extensions:n.extensions,astNode:n.astNode}));return {name:this.name,description:this.description,values:t,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}};function Xt(e,t){let n=e.getValues().map(i=>i.name),r=ie(t,n);return ee("the enum value",r)}function ii(e,t){return ze(t)||L(false,`${e} values must be an object with value names as keys.`),Object.entries(t).map(([n,r])=>(ze(r)||L(false,`${e}.${n} must refer to an object with a "value" key representing an internal value but got: ${y(r)}.`),{name:Fn(n),description:r.description,value:r.value!==void 0?r.value:n,deprecationReason:r.deprecationReason,extensions:se(r.extensions),astNode:r.astNode}))}var Le=class{constructor(t){var n,r;this.name=ae(t.name),this.description=t.description,this.extensions=se(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=(n=t.extensionASTNodes)!==null&&n!==void 0?n:[],this.isOneOf=(r=t.isOneOf)!==null&&r!==void 0?r:false,this._fields=as.bind(void 0,t);}get[Symbol.toStringTag](){return "GraphQLInputObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}toConfig(){let t=Ce(this.getFields(),n=>({description:n.description,type:n.type,defaultValue:n.defaultValue,deprecationReason:n.deprecationReason,extensions:n.extensions,astNode:n.astNode}));return {name:this.name,description:this.description,fields:t,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,isOneOf:this.isOneOf}}toString(){return this.name}toJSON(){return this.toString()}};function as(e){let t=Ht(e.fields);return ze(t)||L(false,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),Ce(t,(n,r)=>(!("resolve"in n)||L(false,`${e.name}.${r} field has a resolve property, but Input Types cannot define resolvers.`),{name:ae(r),description:n.description,type:n.type,defaultValue:n.defaultValue,deprecationReason:n.deprecationReason,extensions:se(n.extensions),astNode:n.astNode}))}function Ze(e){return _(e.type)&&e.defaultValue===void 0}function gt(e,t){return e===t?true:_(e)&&_(t)||$(e)&&$(t)?gt(e.ofType,t.ofType):false}function _e(e,t,n){return t===n?true:_(n)?_(t)?_e(e,t.ofType,n.ofType):false:_(t)?_e(e,t.ofType,n):$(n)?$(t)?_e(e,t.ofType,n.ofType):false:$(t)?false:le(n)&&(R(t)||x(t))&&e.isSubType(n,t)}function Zt(e,t,n){return t===n?true:le(t)?le(n)?e.getPossibleTypes(t).some(r=>e.isSubType(n,r)):e.isSubType(t,n):le(n)?e.isSubType(n,t):false}var It=2147483647,vt=-2147483648,Ee=new ue({name:"Int",description:"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.",serialize(e){let t=_t(e);if(typeof t=="boolean")return t?1:0;let n=t;if(typeof t=="string"&&t!==""&&(n=Number(t)),typeof n!="number"||!Number.isInteger(n))throw new d(`Int cannot represent non-integer value: ${y(t)}`);if(n>It||n<vt)throw new d("Int cannot represent non 32-bit signed integer value: "+y(t));return n},parseValue(e){if(typeof e!="number"||!Number.isInteger(e))throw new d(`Int cannot represent non-integer value: ${y(e)}`);if(e>It||e<vt)throw new d(`Int cannot represent non 32-bit signed integer value: ${e}`);return e},parseLiteral(e){if(e.kind!==exports.d.INT)throw new d(`Int cannot represent non-integer value: ${w(e)}`,{nodes:e});let t=parseInt(e.value,10);if(t>It||t<vt)throw new d(`Int cannot represent non 32-bit signed integer value: ${e.value}`,{nodes:e});return t}}),Ot=new ue({name:"Float",description:"The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).",serialize(e){let t=_t(e);if(typeof t=="boolean")return t?1:0;let n=t;if(typeof t=="string"&&t!==""&&(n=Number(t)),typeof n!="number"||!Number.isFinite(n))throw new d(`Float cannot represent non numeric value: ${y(t)}`);return n},parseValue(e){if(typeof e!="number"||!Number.isFinite(e))throw new d(`Float cannot represent non numeric value: ${y(e)}`);return e},parseLiteral(e){if(e.kind!==exports.d.FLOAT&&e.kind!==exports.d.INT)throw new d(`Float cannot represent non numeric value: ${w(e)}`,e);return parseFloat(e.value)}}),O=new ue({name:"String",description:"The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.",serialize(e){let t=_t(e);if(typeof t=="string")return t;if(typeof t=="boolean")return t?"true":"false";if(typeof t=="number"&&Number.isFinite(t))return t.toString();throw new d(`String cannot represent value: ${y(e)}`)},parseValue(e){if(typeof e!="string")throw new d(`String cannot represent a non string value: ${y(e)}`);return e},parseLiteral(e){if(e.kind!==exports.d.STRING)throw new d(`String cannot represent a non string value: ${w(e)}`,{nodes:e});return e.value}}),V=new ue({name:"Boolean",description:"The `Boolean` scalar type represents `true` or `false`.",serialize(e){let t=_t(e);if(typeof t=="boolean")return t;if(Number.isFinite(t))return t!==0;throw new d(`Boolean cannot represent a non boolean value: ${y(t)}`)},parseValue(e){if(typeof e!="boolean")throw new d(`Boolean cannot represent a non boolean value: ${y(e)}`);return e},parseLiteral(e){if(e.kind!==exports.d.BOOLEAN)throw new d(`Boolean cannot represent a non boolean value: ${w(e)}`,{nodes:e});return e.value}}),bt=new ue({name:"ID",description:'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',serialize(e){let t=_t(e);if(typeof t=="string")return t;if(Number.isInteger(t))return String(t);throw new d(`ID cannot represent value: ${y(e)}`)},parseValue(e){if(typeof e=="string")return e;if(typeof e=="number"&&Number.isInteger(e))return e.toString();throw new d(`ID cannot represent value: ${y(e)}`)},parseLiteral(e){if(e.kind!==exports.d.STRING&&e.kind!==exports.d.INT)throw new d("ID cannot represent a non-string and non-integer value: "+w(e),{nodes:e});return e.value}}),St=Object.freeze([O,Ee,Ot,V,bt]);function en(e){return St.some(({name:t})=>e.name===t)}function _t(e){if(ne(e)){if(typeof e.valueOf=="function"){let t=e.valueOf();if(!ne(t))return t}if(typeof e.toJSON=="function")return e.toJSON()}return e}function et(e){return re(e,Oe)}var Oe=class{constructor(t){var n,r,i;this.name=ae(t.name),this.description=t.description,this.locations=t.locations,this.isRepeatable=(n=t.isRepeatable)!==null&&n!==void 0?n:false,this.deprecationReason=t.deprecationReason,this.extensions=se(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=(r=t.extensionASTNodes)!==null&&r!==void 0?r:[],Array.isArray(t.locations)||L(false,`@${t.name} locations must be an Array.`);let s=(i=t.args)!==null&&i!==void 0?i:{};ne(s)&&!Array.isArray(s)||L(false,`@${t.name} args must be an object with argument names as keys.`),this.args=Cn(s);}get[Symbol.toStringTag](){return "GraphQLDirective"}toConfig(){return {name:this.name,description:this.description,locations:this.locations,args:$n(this.args),isRepeatable:this.isRepeatable,deprecationReason:this.deprecationReason,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return "@"+this.name}toJSON(){return this.toString()}},Dt=new Oe({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[exports.c.FIELD,exports.c.FRAGMENT_SPREAD,exports.c.INLINE_FRAGMENT],args:{if:{type:new b(V),description:"Included when true."}}}),At=new Oe({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[exports.c.FIELD,exports.c.FRAGMENT_SPREAD,exports.c.INLINE_FRAGMENT],args:{if:{type:new b(V),description:"Skipped when true."}}}),Lt="No longer supported",xt=new Oe({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[exports.c.FIELD_DEFINITION,exports.c.ARGUMENT_DEFINITION,exports.c.INPUT_FIELD_DEFINITION,exports.c.ENUM_VALUE,exports.c.DIRECTIVE_DEFINITION],args:{reason:{type:O,description:"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",defaultValue:Lt}}}),Un=new Oe({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[exports.c.SCALAR],args:{url:{type:new b(O),description:"The URL that specifies the behavior of this scalar."}}}),Vn=new Oe({name:"oneOf",description:"Indicates exactly one field must be supplied and this field must not be `null`.",locations:[exports.c.INPUT_OBJECT],args:{}}),fe=Object.freeze([Dt,At,xt,Un,Vn]);function tn(e){return fe.some(({name:t})=>t===e.name)}function nn(e){return typeof e=="object"&&typeof e?.[Symbol.iterator]=="function"}function De(e,t){if(_(t)){let n=De(e,t.ofType);return n?.kind===exports.d.NULL?null:n}if(e===null)return {kind:exports.d.NULL};if(e===void 0)return null;if($(t)){let n=t.ofType;if(nn(e)){let r=[];for(let i of e){let s=De(i,n);s!=null&&r.push(s);}return {kind:exports.d.LIST,values:r}}return De(e,n)}if(k(t)){if(!ne(e))return null;let n=[];for(let r of Object.values(t.getFields())){let i=De(e[r.name],r.type);i&&n.push({kind:exports.d.OBJECT_FIELD,name:{kind:exports.d.NAME,value:r.name},value:i});}return {kind:exports.d.OBJECT,fields:n}}if(oe(t)){let n=t.serialize(e);if(n==null)return null;if(typeof n=="boolean")return {kind:exports.d.BOOLEAN,value:n};if(typeof n=="number"&&Number.isFinite(n)){let r=String(n);return ui.test(r)?{kind:exports.d.INT,value:r}:{kind:exports.d.FLOAT,value:r}}if(typeof n=="string")return Q(t)?{kind:exports.d.ENUM,value:n}:t===bt&&ui.test(n)?{kind:exports.d.INT,value:n}:{kind:exports.d.STRING,value:n};throw new TypeError(`Cannot convert value to AST: ${y(n)}.`)}q(false,"Unexpected input type: "+y(t));}var ui=/^-?(?:0|[1-9][0-9]*)$/;var tt=new j({name:"__Schema",description:"A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.",fields:()=>({description:{type:O,resolve:e=>e.description},types:{description:"A list of all types supported by this server.",type:new b(new U(new b(de))),resolve(e){return Object.values(e.getTypeMap())}},queryType:{description:"The type that query operations will be rooted at.",type:new b(de),resolve:e=>e.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:de,resolve:e=>e.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:de,resolve:e=>e.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new b(new U(new b(rn))),args:{includeDeprecated:{type:new b(V),defaultValue:false}},resolve:(e,{includeDeprecated:t})=>t?e.getDirectives():e.getDirectives().filter(n=>n.deprecationReason==null)}})}),rn=new j({name:"__Directive",description:`A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.
|
|
56
|
+
|
|
57
|
+
In some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.`,fields:()=>({name:{type:new b(O),resolve:e=>e.name},description:{type:O,resolve:e=>e.description},isRepeatable:{type:new b(V),resolve:e=>e.isRepeatable},locations:{type:new b(new U(new b(sn))),resolve:e=>e.locations},args:{type:new b(new U(new b(nt))),args:{includeDeprecated:{type:V,defaultValue:false}},resolve(e,{includeDeprecated:t}){return t?e.args:e.args.filter(n=>n.deprecationReason==null)}},isDeprecated:{type:new b(V),resolve:e=>e.deprecationReason!=null},deprecationReason:{type:O,resolve:e=>e.deprecationReason}})}),sn=new Ae({name:"__DirectiveLocation",description:"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.",values:{QUERY:{value:exports.c.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:exports.c.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:exports.c.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:exports.c.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:exports.c.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:exports.c.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:exports.c.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:exports.c.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:exports.c.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:exports.c.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:exports.c.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:exports.c.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:exports.c.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:exports.c.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:exports.c.UNION,description:"Location adjacent to a union definition."},ENUM:{value:exports.c.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:exports.c.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:exports.c.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:exports.c.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."},DIRECTIVE_DEFINITION:{value:exports.c.DIRECTIVE_DEFINITION,description:"Location adjacent to a directive definition."}}}),de=new j({name:"__Type",description:"The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.",fields:()=>({kind:{type:new b(un),resolve(e){if(ce(e))return X.SCALAR;if(x(e))return X.OBJECT;if(R(e))return X.INTERFACE;if(z(e))return X.UNION;if(Q(e))return X.ENUM;if(k(e))return X.INPUT_OBJECT;if($(e))return X.LIST;if(_(e))return X.NON_NULL;q(false,`Unexpected type: "${y(e)}".`);}},name:{type:O,resolve:e=>"name"in e?e.name:void 0},description:{type:O,resolve:e=>"description"in e?e.description:void 0},specifiedByURL:{type:O,resolve:e=>"specifiedByURL"in e?e.specifiedByURL:void 0},fields:{type:new U(new b(on)),args:{includeDeprecated:{type:V,defaultValue:false}},resolve(e,{includeDeprecated:t}){if(x(e)||R(e)){let n=Object.values(e.getFields());return t?n:n.filter(r=>r.deprecationReason==null)}}},interfaces:{type:new U(new b(de)),resolve(e){if(x(e)||R(e))return e.getInterfaces()}},possibleTypes:{type:new U(new b(de)),resolve(e,t,n,{schema:r}){if(le(e))return r.getPossibleTypes(e)}},enumValues:{type:new U(new b(an)),args:{includeDeprecated:{type:V,defaultValue:false}},resolve(e,{includeDeprecated:t}){if(Q(e)){let n=e.getValues();return t?n:n.filter(r=>r.deprecationReason==null)}}},inputFields:{type:new U(new b(nt)),args:{includeDeprecated:{type:V,defaultValue:false}},resolve(e,{includeDeprecated:t}){if(k(e)){let n=Object.values(e.getFields());return t?n:n.filter(r=>r.deprecationReason==null)}}},ofType:{type:de,resolve:e=>"ofType"in e?e.ofType:void 0},isOneOf:{type:V,resolve:e=>{if(k(e))return e.isOneOf}}})}),on=new j({name:"__Field",description:"Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.",fields:()=>({name:{type:new b(O),resolve:e=>e.name},description:{type:O,resolve:e=>e.description},args:{type:new b(new U(new b(nt))),args:{includeDeprecated:{type:V,defaultValue:false}},resolve(e,{includeDeprecated:t}){return t?e.args:e.args.filter(n=>n.deprecationReason==null)}},type:{type:new b(de),resolve:e=>e.type},isDeprecated:{type:new b(V),resolve:e=>e.deprecationReason!=null},deprecationReason:{type:O,resolve:e=>e.deprecationReason}})}),nt=new j({name:"__InputValue",description:"Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.",fields:()=>({name:{type:new b(O),resolve:e=>e.name},description:{type:O,resolve:e=>e.description},type:{type:new b(de),resolve:e=>e.type},defaultValue:{type:O,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(e){let{type:t,defaultValue:n}=e,r=De(n,t);return r?w(r):null}},isDeprecated:{type:new b(V),resolve:e=>e.deprecationReason!=null},deprecationReason:{type:O,resolve:e=>e.deprecationReason}})}),an=new j({name:"__EnumValue",description:"One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.",fields:()=>({name:{type:new b(O),resolve:e=>e.name},description:{type:O,resolve:e=>e.description},isDeprecated:{type:new b(V),resolve:e=>e.deprecationReason!=null},deprecationReason:{type:O,resolve:e=>e.deprecationReason}})}),X;(function(e){e.SCALAR="SCALAR",e.OBJECT="OBJECT",e.INTERFACE="INTERFACE",e.UNION="UNION",e.ENUM="ENUM",e.INPUT_OBJECT="INPUT_OBJECT",e.LIST="LIST",e.NON_NULL="NON_NULL";})(X||(X={}));var un=new Ae({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:X.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:X.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:X.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:X.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:X.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:X.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:X.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:X.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}}),Rt={name:"__schema",type:new b(tt),description:"Access the current type schema of this server.",args:[],resolve:(e,t,n,{schema:r})=>r,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},wt={name:"__type",type:de,description:"Request the type information of a single type.",args:[{name:"name",description:void 0,type:new b(O),defaultValue:void 0,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0}],resolve:(e,{name:t},n,{schema:r})=>r.getType(t),deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},kt={name:"__typename",type:new b(O),description:"The name of the current Object type at runtime.",args:[],resolve:(e,t,n,{parentType:r})=>r.name,deprecationReason:void 0,extensions:Object.create(null),astNode:void 0},Ft=Object.freeze([tt,rn,sn,de,on,nt,an,un]);function rt(e){return Ft.some(({name:t})=>e.name===t)}function jn(e){return re(e,Ue)}function cn(e){if(!jn(e))throw new Error(`Expected ${y(e)} to be a GraphQL schema.`);return e}var Ue=class{constructor(t){var n,r;this.__validationErrors=t.assumeValid===true?[]:void 0,ne(t)||L(false,"Must provide configuration object."),!t.types||Array.isArray(t.types)||L(false,`"types" must be Array if provided but got: ${y(t.types)}.`),!t.directives||Array.isArray(t.directives)||L(false,`"directives" must be Array if provided but got: ${y(t.directives)}.`),this.description=t.description,this.extensions=se(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=(n=t.extensionASTNodes)!==null&&n!==void 0?n:[],this._queryType=t.query,this._mutationType=t.mutation,this._subscriptionType=t.subscription,this._directives=(r=t.directives)!==null&&r!==void 0?r:fe;let i=new Set(t.types);if(t.types!=null)for(let s of t.types)i.delete(s),Ne(s,i);this._queryType!=null&&Ne(this._queryType,i),this._mutationType!=null&&Ne(this._mutationType,i),this._subscriptionType!=null&&Ne(this._subscriptionType,i);for(let s of this._directives)if(et(s))for(let o of s.args)Ne(o.type,i);Ne(tt,i),this._typeMap=Object.create(null),this._subTypeMap=Object.create(null),this._implementationsMap=Object.create(null);for(let s of i){if(s==null)continue;let o=s.name;if(o||L(false,"One of the provided types for building the Schema is missing a name."),this._typeMap[o]!==void 0)throw new Error(`Schema must contain uniquely named types but contains multiple types named "${o}".`);if(this._typeMap[o]=s,R(s)){for(let a of s.getInterfaces())if(R(a)){let c=this._implementationsMap[a.name];c===void 0&&(c=this._implementationsMap[a.name]={objects:[],interfaces:[]}),c.interfaces.push(s);}}else if(x(s)){for(let a of s.getInterfaces())if(R(a)){let c=this._implementationsMap[a.name];c===void 0&&(c=this._implementationsMap[a.name]={objects:[],interfaces:[]}),c.objects.push(s);}}}}get[Symbol.toStringTag](){return "GraphQLSchema"}getQueryType(){return this._queryType}getMutationType(){return this._mutationType}getSubscriptionType(){return this._subscriptionType}getRootType(t){switch(t){case K.QUERY:return this.getQueryType();case K.MUTATION:return this.getMutationType();case K.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(t){return this.getTypeMap()[t]}getPossibleTypes(t){return z(t)?t.getTypes():this.getImplementations(t).objects}getImplementations(t){let n=this._implementationsMap[t.name];return n??{objects:[],interfaces:[]}}isSubType(t,n){let r=this._subTypeMap[t.name];if(r===void 0){if(r=Object.create(null),z(t))for(let i of t.getTypes())r[i.name]=true;else {let i=this.getImplementations(t);for(let s of i.objects)r[s.name]=true;for(let s of i.interfaces)r[s.name]=true;}this._subTypeMap[t.name]=r;}return r[n.name]!==void 0}getDirectives(){return this._directives}getDirective(t){return this.getDirectives().find(n=>n.name===t)}toConfig(){return {description:this.description,query:this.getQueryType(),mutation:this.getMutationType(),subscription:this.getSubscriptionType(),types:Object.values(this.getTypeMap()),directives:this.getDirectives(),extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes,assumeValid:this.__validationErrors!==void 0}}};function Ne(e,t){let n=W(e);if(!t.has(n)){if(t.add(n),z(n))for(let r of n.getTypes())Ne(r,t);else if(x(n)||R(n)){for(let r of n.getInterfaces())Ne(r,t);for(let r of Object.values(n.getFields())){Ne(r.type,t);for(let i of r.args)Ne(i.type,t);}}else if(k(n))for(let r of Object.values(n.getFields()))Ne(r.type,t);}return t}function Pn(e){if(cn(e),e.__validationErrors)return e.__validationErrors;let t=new Gn(e);us(t),cs(t),ps(t);let n=t.getErrors();return e.__validationErrors=n,n}function pn(e){let t=Pn(e);if(t.length!==0)throw new Error(t.map(n=>n.message).join(`
|
|
58
|
+
|
|
59
|
+
`))}var Gn=class{constructor(t){this._errors=[],this.schema=t;}reportError(t,n){let r=Array.isArray(n)?n.filter(Boolean):n;this._errors.push(new d(t,{nodes:r}));}getErrors(){return this._errors}};function us(e){let t=e.schema,n=t.getQueryType();if(!n)e.reportError("Query root type must be provided.",t.astNode);else if(!x(n)){var r;e.reportError(`Query root type must be Object type, it cannot be ${y(n)}.`,(r=Mn(t,K.QUERY))!==null&&r!==void 0?r:n.astNode);}let i=t.getMutationType();if(i&&!x(i)){var s;e.reportError(`Mutation root type must be Object type if provided, it cannot be ${y(i)}.`,(s=Mn(t,K.MUTATION))!==null&&s!==void 0?s:i.astNode);}let o=t.getSubscriptionType();if(o&&!x(o)){var a;e.reportError(`Subscription root type must be Object type if provided, it cannot be ${y(o)}.`,(a=Mn(t,K.SUBSCRIPTION))!==null&&a!==void 0?a:o.astNode);}}function Mn(e,t){var n;return (n=[e.astNode,...e.extensionASTNodes].flatMap(r=>{var i;return (i=r?.operationTypes)!==null&&i!==void 0?i:[]}).find(r=>r.operation===t))===null||n===void 0?void 0:n.type}function cs(e){for(let n of e.schema.getDirectives()){if(!et(n)){e.reportError(`Expected directive but got: ${y(n)}.`,n?.astNode);continue}Ve(e,n),n.locations.length===0&&e.reportError(`Directive @${n.name} must include 1 or more locations.`,n.astNode);for(let r of n.args)if(Ve(e,r),te(r.type)||e.reportError(`The type of @${n.name}(${r.name}:) must be Input Type but got: ${y(r.type)}.`,r.astNode),Se(r)&&r.deprecationReason!=null){var t;e.reportError(`Required argument @${n.name}(${r.name}:) cannot be deprecated.`,[Qn(r.astNode),(t=r.astNode)===null||t===void 0?void 0:t.type]);}}}function Ve(e,t){t.name.startsWith("__")&&e.reportError(`Name "${t.name}" must not begin with "__", which is reserved by GraphQL introspection.`,t.astNode);}function ps(e){let t=Ts(e),n=e.schema.getTypeMap();for(let r of Object.values(n)){if(!zt(r)){e.reportError(`Expected GraphQL named type but got: ${y(r)}.`,r.astNode);continue}rt(r)||Ve(e,r),x(r)||R(r)?(ci(e,r),pi(e,r)):z(r)?ds(e,r):Q(r)?ms(e,r):k(r)&&(hs(e,r),t(r));}}function ci(e,t){let n=Object.values(t.getFields());n.length===0&&e.reportError(`Type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(let o of n){if(Ve(e,o),!be(o.type)){var r;e.reportError(`The type of ${t.name}.${o.name} must be Output Type but got: ${y(o.type)}.`,(r=o.astNode)===null||r===void 0?void 0:r.type);}for(let a of o.args){let c=a.name;if(Ve(e,a),!te(a.type)){var i;e.reportError(`The type of ${t.name}.${o.name}(${c}:) must be Input Type but got: ${y(a.type)}.`,(i=a.astNode)===null||i===void 0?void 0:i.type);}if(Se(a)&&a.deprecationReason!=null){var s;e.reportError(`Required argument ${t.name}.${o.name}(${c}:) cannot be deprecated.`,[Qn(a.astNode),(s=a.astNode)===null||s===void 0?void 0:s.type]);}}}}function pi(e,t){let n=Object.create(null);for(let r of t.getInterfaces()){if(!R(r)){e.reportError(`Type ${y(t)} must only implement Interface types, it cannot implement ${y(r)}.`,Ct(t,r));continue}if(t===r){e.reportError(`Type ${t.name} cannot implement itself because it would create a circular reference.`,Ct(t,r));continue}if(n[r.name]){e.reportError(`Type ${t.name} can only implement ${r.name} once.`,Ct(t,r));continue}n[r.name]=true,fs(e,t,r),ls(e,t,r);}}function ls(e,t,n){let r=t.getFields();for(let c of Object.values(n.getFields())){let p=c.name,l=r[p];if(!l){e.reportError(`Interface field ${n.name}.${p} expected but ${t.name} does not provide it.`,[c.astNode,t.astNode,...t.extensionASTNodes]);continue}if(!_e(e.schema,l.type,c.type)){var i,s;e.reportError(`Interface field ${n.name}.${p} expects type ${y(c.type)} but ${t.name}.${p} is type ${y(l.type)}.`,[(i=c.astNode)===null||i===void 0?void 0:i.type,(s=l.astNode)===null||s===void 0?void 0:s.type]);}for(let f of c.args){let h=f.name,I=l.args.find(N=>N.name===h);if(!I){e.reportError(`Interface field argument ${n.name}.${p}(${h}:) expected but ${t.name}.${p} does not provide it.`,[f.astNode,l.astNode]);continue}if(!gt(f.type,I.type)){var o,a;e.reportError(`Interface field argument ${n.name}.${p}(${h}:) expects type ${y(f.type)} but ${t.name}.${p}(${h}:) is type ${y(I.type)}.`,[(o=f.astNode)===null||o===void 0?void 0:o.type,(a=I.astNode)===null||a===void 0?void 0:a.type]);}}for(let f of l.args){let h=f.name;!c.args.find(N=>N.name===h)&&Se(f)&&e.reportError(`Object field ${t.name}.${p} includes required argument ${h} that is missing from the Interface field ${n.name}.${p}.`,[f.astNode,c.astNode]);}}}function fs(e,t,n){let r=t.getInterfaces();for(let i of n.getInterfaces())r.includes(i)||e.reportError(i===t?`Type ${t.name} cannot implement ${n.name} because it would create a circular reference.`:`Type ${t.name} must implement ${i.name} because it is implemented by ${n.name}.`,[...Ct(n,i),...Ct(t,n)]);}function ds(e,t){let n=t.getTypes();n.length===0&&e.reportError(`Union type ${t.name} must define one or more member types.`,[t.astNode,...t.extensionASTNodes]);let r=Object.create(null);for(let i of n){if(r[i.name]){e.reportError(`Union type ${t.name} can only include type ${i.name} once.`,li(t,i.name));continue}r[i.name]=true,x(i)||e.reportError(`Union type ${t.name} can only include Object types, it cannot include ${y(i)}.`,li(t,String(i)));}}function ms(e,t){let n=t.getValues();n.length===0&&e.reportError(`Enum type ${t.name} must define one or more values.`,[t.astNode,...t.extensionASTNodes]);for(let r of n)Ve(e,r);}function hs(e,t){let n=Object.values(t.getFields());n.length===0&&e.reportError(`Input Object type ${t.name} must define one or more fields.`,[t.astNode,...t.extensionASTNodes]);for(let s of n){if(Ve(e,s),!te(s.type)){var r;e.reportError(`The type of ${t.name}.${s.name} must be Input Type but got: ${y(s.type)}.`,(r=s.astNode)===null||r===void 0?void 0:r.type);}if(Ze(s)&&s.deprecationReason!=null){var i;e.reportError(`Required input field ${t.name}.${s.name} cannot be deprecated.`,[Qn(s.astNode),(i=s.astNode)===null||i===void 0?void 0:i.type]);}t.isOneOf&&ys(t,s,e);}}function ys(e,t,n){if(_(t.type)){var r;n.reportError(`OneOf input field ${e.name}.${t.name} must be nullable.`,(r=t.astNode)===null||r===void 0?void 0:r.type);}t.defaultValue!==void 0&&n.reportError(`OneOf input field ${e.name}.${t.name} cannot have a default value.`,t.astNode);}function Ts(e){let t=Object.create(null),n=[],r=Object.create(null);return i;function i(s){if(t[s.name])return;t[s.name]=true,r[s.name]=n.length;let o=Object.values(s.getFields());for(let a of o)if(_(a.type)&&k(a.type.ofType)){let c=a.type.ofType,p=r[c.name];if(n.push(a),p===void 0)i(c);else {let l=n.slice(p),f=l.map(h=>h.name).join(".");e.reportError(`Cannot reference Input Object "${c.name}" within itself through a series of non-null fields: "${f}".`,l.map(h=>h.astNode));}n.pop();}r[s.name]=void 0;}}function Ct(e,t){let{astNode:n,extensionASTNodes:r}=e;return (n!=null?[n,...r]:r).flatMap(s=>{var o;return (o=s.interfaces)!==null&&o!==void 0?o:[]}).filter(s=>s.name.value===t.name)}function li(e,t){let{astNode:n,extensionASTNodes:r}=e;return (n!=null?[n,...r]:r).flatMap(s=>{var o;return (o=s.types)!==null&&o!==void 0?o:[]}).filter(s=>s.name.value===t)}function Qn(e){var t;return e==null||(t=e.directives)===null||t===void 0?void 0:t.find(n=>n.name.value===xt.name)}function Y(e,t){switch(t.kind){case exports.d.LIST_TYPE:{let n=Y(e,t.type);return n&&new U(n)}case exports.d.NON_NULL_TYPE:{let n=Y(e,t.type);return n&&new b(n)}case exports.d.NAMED_TYPE:return e.getType(t.name.value)}}var je=class{constructor(t,n,r){this._schema=t,this._typeStack=[],this._parentTypeStack=[],this._inputTypeStack=[],this._fieldDefStack=[],this._defaultValueStack=[],this._directive=null,this._argument=null,this._enumValue=null,this._getFieldDef=r??Es,n&&(te(n)&&this._inputTypeStack.push(n),pe(n)&&this._parentTypeStack.push(n),be(n)&&this._typeStack.push(n));}get[Symbol.toStringTag](){return "TypeInfo"}getType(){if(this._typeStack.length>0)return this._typeStack[this._typeStack.length-1]}getParentType(){if(this._parentTypeStack.length>0)return this._parentTypeStack[this._parentTypeStack.length-1]}getInputType(){if(this._inputTypeStack.length>0)return this._inputTypeStack[this._inputTypeStack.length-1]}getParentInputType(){if(this._inputTypeStack.length>1)return this._inputTypeStack[this._inputTypeStack.length-2]}getFieldDef(){if(this._fieldDefStack.length>0)return this._fieldDefStack[this._fieldDefStack.length-1]}getDefaultValue(){if(this._defaultValueStack.length>0)return this._defaultValueStack[this._defaultValueStack.length-1]}getDirective(){return this._directive}getArgument(){return this._argument}getEnumValue(){return this._enumValue}enter(t){let n=this._schema;switch(t.kind){case exports.d.SELECTION_SET:{let i=W(this.getType());this._parentTypeStack.push(pe(i)?i:void 0);break}case exports.d.FIELD:{let i=this.getParentType(),s,o;i&&(s=this._getFieldDef(n,i,t),s&&(o=s.type)),this._fieldDefStack.push(s),this._typeStack.push(be(o)?o:void 0);break}case exports.d.DIRECTIVE:this._directive=n.getDirective(t.name.value);break;case exports.d.OPERATION_DEFINITION:{let i=n.getRootType(t.operation);this._typeStack.push(x(i)?i:void 0);break}case exports.d.INLINE_FRAGMENT:case exports.d.FRAGMENT_DEFINITION:{let i=t.typeCondition,s=i?Y(n,i):W(this.getType());this._typeStack.push(be(s)?s:void 0);break}case exports.d.VARIABLE_DEFINITION:{let i=Y(n,t.type);this._inputTypeStack.push(te(i)?i:void 0);break}case exports.d.ARGUMENT:{var r;let i,s,o=(r=this.getDirective())!==null&&r!==void 0?r:this.getFieldDef();o&&(i=o.args.find(a=>a.name===t.name.value),i&&(s=i.type)),this._argument=i,this._defaultValueStack.push(i?i.defaultValue:void 0),this._inputTypeStack.push(te(s)?s:void 0);break}case exports.d.LIST:{let i=He(this.getInputType()),s=$(i)?i.ofType:i;this._defaultValueStack.push(void 0),this._inputTypeStack.push(te(s)?s:void 0);break}case exports.d.OBJECT_FIELD:{let i=W(this.getInputType()),s,o;k(i)&&(o=i.getFields()[t.name.value],o&&(s=o.type)),this._defaultValueStack.push(o?o.defaultValue:void 0),this._inputTypeStack.push(te(s)?s:void 0);break}case exports.d.ENUM:{let i=W(this.getInputType()),s;Q(i)&&(s=i.getValue(t.value)),this._enumValue=s;break}}}leave(t){switch(t.kind){case exports.d.SELECTION_SET:this._parentTypeStack.pop();break;case exports.d.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case exports.d.DIRECTIVE:this._directive=null;break;case exports.d.OPERATION_DEFINITION:case exports.d.INLINE_FRAGMENT:case exports.d.FRAGMENT_DEFINITION:this._typeStack.pop();break;case exports.d.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case exports.d.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case exports.d.LIST:case exports.d.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case exports.d.ENUM:this._enumValue=null;break;}}};function Es(e,t,n){let r=n.name.value;if(r===Rt.name&&e.getQueryType()===t)return Rt;if(r===wt.name&&e.getQueryType()===t)return wt;if(r===kt.name&&pe(t))return kt;if(x(t)||R(t))return t.getFields()[r]}function $t(e,t){return {enter(...n){let r=n[0];e.enter(r);let i=Xe(t,r.kind).enter;if(i){let s=i.apply(t,n);return s!==void 0&&(e.leave(r),pt(s)&&e.enter(s)),s}},leave(...n){let r=n[0],i=Xe(t,r.kind).leave,s;return i&&(s=i.apply(t,n)),e.leave(r),s}}}function Bn(e){return e.kind===exports.d.OPERATION_DEFINITION||e.kind===exports.d.FRAGMENT_DEFINITION}function qn(e){return e.kind===exports.d.SCHEMA_DEFINITION||xe(e)||e.kind===exports.d.DIRECTIVE_DEFINITION}function xe(e){return e.kind===exports.d.SCALAR_TYPE_DEFINITION||e.kind===exports.d.OBJECT_TYPE_DEFINITION||e.kind===exports.d.INTERFACE_TYPE_DEFINITION||e.kind===exports.d.UNION_TYPE_DEFINITION||e.kind===exports.d.ENUM_TYPE_DEFINITION||e.kind===exports.d.INPUT_OBJECT_TYPE_DEFINITION}function Yn(e){return e.kind===exports.d.SCHEMA_EXTENSION||e.kind===exports.d.DIRECTIVE_EXTENSION||ln(e)}function ln(e){return e.kind===exports.d.SCALAR_TYPE_EXTENSION||e.kind===exports.d.OBJECT_TYPE_EXTENSION||e.kind===exports.d.INTERFACE_TYPE_EXTENSION||e.kind===exports.d.UNION_TYPE_EXTENSION||e.kind===exports.d.ENUM_TYPE_EXTENSION||e.kind===exports.d.INPUT_OBJECT_TYPE_EXTENSION}function Kn(e){return {Document(t){for(let n of t.definitions)if(!Bn(n)){let r=n.kind===exports.d.SCHEMA_DEFINITION||n.kind===exports.d.SCHEMA_EXTENSION?"schema":'"'+n.name.value+'"';e.reportError(new d(`The ${r} definition is not executable.`,{nodes:n}));}return false}}}function Jn(e){return {Field(t){let n=e.getParentType();if(n&&!e.getFieldDef()){let i=e.getSchema(),s=t.name.value,o=ee("to use an inline fragment on",Ns(i,n,s));o===""&&(o=ee(gs(n,s))),e.reportError(new d(`Cannot query field "${s}" on type "${n.name}".`+o,{nodes:t}));}}}}function Ns(e,t,n){if(!le(t))return [];let r=new Set,i=Object.create(null);for(let o of e.getPossibleTypes(t))if(o.getFields()[n]){r.add(o),i[o.name]=1;for(let a of o.getInterfaces()){var s;a.getFields()[n]&&(r.add(a),i[a.name]=((s=i[a.name])!==null&&s!==void 0?s:0)+1);}}return [...r].sort((o,a)=>{let c=i[a.name]-i[o.name];return c!==0?c:R(o)&&e.isSubType(o,a)?-1:R(a)&&e.isSubType(a,o)?1:Ke(o.name,a.name)}).map(o=>o.name)}function gs(e,t){if(x(e)||R(e)){let n=Object.keys(e.getFields());return ie(t,n)}return []}function Xn(e){return {InlineFragment(t){let n=t.typeCondition;if(n){let r=Y(e.getSchema(),n);if(r&&!pe(r)){let i=w(n);e.reportError(new d(`Fragment cannot condition on non composite type "${i}".`,{nodes:n}));}}},FragmentDefinition(t){let n=Y(e.getSchema(),t.typeCondition);if(n&&!pe(n)){let r=w(t.typeCondition);e.reportError(new d(`Fragment "${t.name.value}" cannot condition on non composite type "${r}".`,{nodes:t.typeCondition}));}}}}function zn(e){return {...Wn(e),Argument(t){let n=e.getArgument(),r=e.getFieldDef(),i=e.getParentType();if(!n&&r&&i){let s=t.name.value,o=r.args.map(c=>c.name),a=ie(s,o);e.reportError(new d(`Unknown argument "${s}" on field "${i.name}.${r.name}".`+ee(a),{nodes:t}));}}}}function Wn(e){let t=Object.create(null),n=e.getSchema(),r=n?n.getDirectives():fe;for(let o of r)t[o.name]=o.args.map(a=>a.name);let i=e.getDocument().definitions;for(let o of i)if(o.kind===exports.d.DIRECTIVE_DEFINITION){var s;let a=(s=o.arguments)!==null&&s!==void 0?s:[];t[o.name.value]=a.map(c=>c.name.value);}return {Directive(o){let a=o.name.value,c=t[a];if(o.arguments&&c)for(let p of o.arguments){let l=p.name.value;if(!c.includes(l)){let f=ie(l,c);e.reportError(new d(`Unknown argument "${l}" on directive "@${a}".`+ee(f),{nodes:p}));}}return false}}}function fn(e){let t=Object.create(null),n=e.getSchema(),r=n?n.getDirectives():fe;for(let s of r)t[s.name]=s.locations;let i=e.getDocument().definitions;for(let s of i)s.kind===exports.d.DIRECTIVE_DEFINITION&&(t[s.name.value]=s.locations.map(o=>o.value));return {Directive(s,o,a,c,p){let l=s.name.value,f=t[l];if(!f){e.reportError(new d(`Unknown directive "@${l}".`,{nodes:s}));return}let h=Is(p);h&&!f.includes(h)&&e.reportError(new d(`Directive "@${l}" may not be used on ${h}.`,{nodes:s}));}}}function Is(e){let t=e[e.length-1];switch("kind"in t||q(),t.kind){case exports.d.OPERATION_DEFINITION:return vs(t.operation);case exports.d.FIELD:return exports.c.FIELD;case exports.d.FRAGMENT_SPREAD:return exports.c.FRAGMENT_SPREAD;case exports.d.INLINE_FRAGMENT:return exports.c.INLINE_FRAGMENT;case exports.d.FRAGMENT_DEFINITION:return exports.c.FRAGMENT_DEFINITION;case exports.d.VARIABLE_DEFINITION:return exports.c.VARIABLE_DEFINITION;case exports.d.SCHEMA_DEFINITION:case exports.d.SCHEMA_EXTENSION:return exports.c.SCHEMA;case exports.d.SCALAR_TYPE_DEFINITION:case exports.d.SCALAR_TYPE_EXTENSION:return exports.c.SCALAR;case exports.d.OBJECT_TYPE_DEFINITION:case exports.d.OBJECT_TYPE_EXTENSION:return exports.c.OBJECT;case exports.d.FIELD_DEFINITION:return exports.c.FIELD_DEFINITION;case exports.d.INTERFACE_TYPE_DEFINITION:case exports.d.INTERFACE_TYPE_EXTENSION:return exports.c.INTERFACE;case exports.d.UNION_TYPE_DEFINITION:case exports.d.UNION_TYPE_EXTENSION:return exports.c.UNION;case exports.d.ENUM_TYPE_DEFINITION:case exports.d.ENUM_TYPE_EXTENSION:return exports.c.ENUM;case exports.d.ENUM_VALUE_DEFINITION:return exports.c.ENUM_VALUE;case exports.d.INPUT_OBJECT_TYPE_DEFINITION:case exports.d.INPUT_OBJECT_TYPE_EXTENSION:return exports.c.INPUT_OBJECT;case exports.d.INPUT_VALUE_DEFINITION:{let n=e[e.length-3];return "kind"in n||q(),n.kind===exports.d.INPUT_OBJECT_TYPE_DEFINITION?exports.c.INPUT_FIELD_DEFINITION:exports.c.ARGUMENT_DEFINITION}case exports.d.DIRECTIVE_DEFINITION:case exports.d.DIRECTIVE_EXTENSION:return exports.c.DIRECTIVE_DEFINITION;default:q(false,"Unexpected kind: "+y(t.kind));}}function vs(e){switch(e){case K.QUERY:return exports.c.QUERY;case K.MUTATION:return exports.c.MUTATION;case K.SUBSCRIPTION:return exports.c.SUBSCRIPTION}}function Hn(e){return {FragmentSpread(t){let n=t.name.value;e.getFragment(n)||e.reportError(new d(`Unknown fragment "${n}".`,{nodes:t.name}));}}}function dn(e){let t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),r=Object.create(null);for(let s of e.getDocument().definitions)xe(s)&&(r[s.name.value]=true);let i=[...Object.keys(n),...Object.keys(r)];return {NamedType(s,o,a,c,p){let l=s.name.value;if(!n[l]&&!r[l]){var f;let h=(f=p[2])!==null&&f!==void 0?f:a,I=h!=null&&Os(h);if(I&&fi.includes(l))return;let N=ie(l,I?fi.concat(i):i);e.reportError(new d(`Unknown type "${l}".`+ee(N),{nodes:s}));}}}}var fi=[...St,...Ft].map(e=>e.name);function Os(e){return "kind"in e&&(qn(e)||Yn(e))}function Zn(e){let t=0;return {Document(n){t=n.definitions.filter(r=>r.kind===exports.d.OPERATION_DEFINITION).length;},OperationDefinition(n){!n.name&&t>1&&e.reportError(new d("This anonymous operation must be the only defined operation.",{nodes:n}));}}}var bs=3;function tr(e){function t(n,r=Object.create(null),i=0){if(n.kind===exports.d.FRAGMENT_SPREAD){let s=n.name.value;if(r[s]===true)return false;let o=e.getFragment(s);if(!o)return false;try{return r[s]=!0,t(o,r,i)}finally{r[s]=void 0;}}if(n.kind===exports.d.FIELD&&(n.name.value==="fields"||n.name.value==="interfaces"||n.name.value==="possibleTypes"||n.name.value==="inputFields")&&(i++,i>=bs))return true;if("selectionSet"in n&&n.selectionSet){for(let s of n.selectionSet.selections)if(t(s,r,i))return true}return false}return {Field(n){if((n.name.value==="__schema"||n.name.value==="__type")&&t(n))return e.reportError(new d("Maximum introspection depth exceeded",{nodes:[n]})),false}}}function nr(e){let t=Object.create(null),n=[],r=Object.create(null);return {OperationDefinition:()=>false,FragmentDefinition(s){return i(s),false}};function i(s){if(t[s.name.value])return;let o=s.name.value;t[o]=true;let a=e.getFragmentSpreads(s.selectionSet);if(a.length!==0){r[o]=n.length;for(let c of a){let p=c.name.value,l=r[p];if(n.push(c),l===void 0){let f=e.getFragment(p);f&&i(f);}else {let f=n.slice(l),h=f.slice(0,-1).map(I=>'"'+I.name.value+'"').join(", ");e.reportError(new d(`Cannot spread fragment "${p}" within itself`+(h!==""?` via ${h}.`:"."),{nodes:f}));}n.pop();}r[o]=void 0;}}}function rr(e){let t=Object.create(null);return {OperationDefinition:{enter(){t=Object.create(null);},leave(n){let r=e.getRecursiveVariableUsages(n);for(let{node:i}of r){let s=i.name.value;t[s]!==true&&e.reportError(new d(n.name?`Variable "$${s}" is not defined by operation "${n.name.value}".`:`Variable "$${s}" is not defined.`,{nodes:[i,n]}));}}},VariableDefinition(n){t[n.variable.name.value]=true;}}}function ir(e){let t=[],n=[];return {OperationDefinition(r){return t.push(r),false},FragmentDefinition(r){return n.push(r),false},Document:{leave(){let r=Object.create(null);for(let i of t)for(let s of e.getRecursivelyReferencedFragments(i))r[s.name.value]=true;for(let i of n){let s=i.name.value;r[s]!==true&&e.reportError(new d(`Fragment "${s}" is never used.`,{nodes:i}));}}}}}function sr(e){let t=[];return {OperationDefinition:{enter(){t=[];},leave(n){let r=Object.create(null),i=e.getRecursiveVariableUsages(n);for(let{node:s}of i)r[s.name.value]=true;for(let s of t){let o=s.variable.name.value;r[o]!==true&&e.reportError(new d(n.name?`Variable "$${o}" is never used in operation "${n.name.value}".`:`Variable "$${o}" is never used.`,{nodes:s}));}}},VariableDefinition(n){t.push(n);}}}function mn(e){switch(e.kind){case exports.d.OBJECT:return {...e,fields:Ss(e.fields)};case exports.d.LIST:return {...e,values:e.values.map(mn)};case exports.d.INT:case exports.d.FLOAT:case exports.d.STRING:case exports.d.BOOLEAN:case exports.d.NULL:case exports.d.ENUM:case exports.d.VARIABLE:return e}}function Ss(e){return e.map(t=>({...t,value:mn(t.value)})).sort((t,n)=>Ke(t.name.value,n.name.value))}function mi(e){return Array.isArray(e)?e.map(([t,n])=>`subfields "${t}" conflict because `+mi(n)).join(" and "):e}function cr(e){let t=new En,n=new ur,r=new Map;return {SelectionSet(i){let s=_s(e,r,t,n,e.getParentType(),i);for(let[[o,a],c,p]of s){let l=mi(a);e.reportError(new d(`Fields "${o}" conflict because ${l}. Use different aliases on the fields to fetch both if this was intentional.`,{nodes:c.concat(p)}));}}}}function _s(e,t,n,r,i,s){let o=[],[a,c]=Tn(e,t,i,s);if(As(e,o,t,n,r,a),c.length!==0)for(let p=0;p<c.length;p++){hn(e,o,t,n,r,false,a,c[p]);for(let l=p+1;l<c.length;l++)yn(e,o,t,n,r,false,c[p],c[l]);}return o}function hn(e,t,n,r,i,s,o,a){if(r.has(o,a,s))return;r.add(o,a,s);let c=e.getFragment(a);if(!c)return;let[p,l]=ar(e,n,c);if(o!==p){pr(e,t,n,r,i,s,o,p);for(let f of l)hn(e,t,n,r,i,s,o,f);}}function yn(e,t,n,r,i,s,o,a){if(o===a||i.has(o,a,s))return;i.add(o,a,s);let c=e.getFragment(o),p=e.getFragment(a);if(!c||!p)return;let[l,f]=ar(e,n,c),[h,I]=ar(e,n,p);pr(e,t,n,r,i,s,l,h);for(let N of I)yn(e,t,n,r,i,s,o,N);for(let N of f)yn(e,t,n,r,i,s,N,a);}function Ds(e,t,n,r,i,s,o,a,c){let p=[],[l,f]=Tn(e,t,s,o),[h,I]=Tn(e,t,a,c);pr(e,p,t,n,r,i,l,h);for(let N of I)hn(e,p,t,n,r,i,l,N);for(let N of f)hn(e,p,t,n,r,i,h,N);for(let N of f)for(let A of I)yn(e,p,t,n,r,i,N,A);return p}function As(e,t,n,r,i,s){for(let[o,a]of Object.entries(s))if(a.length>1)for(let c=0;c<a.length;c++)for(let p=c+1;p<a.length;p++){let l=hi(e,n,r,i,false,o,a[c],a[p]);l&&t.push(l);}}function pr(e,t,n,r,i,s,o,a){for(let[c,p]of Object.entries(o)){let l=a[c];if(l)for(let f of p)for(let h of l){let I=hi(e,n,r,i,s,c,f,h);I&&t.push(I);}}}function hi(e,t,n,r,i,s,o,a){let[c,p,l]=o,[f,h,I]=a,N=i||c!==f&&x(c)&&x(f);if(!N){let T=p.name.value,F=h.name.value;if(T!==F)return [[s,`"${T}" and "${F}" are different fields`],[p],[h]];if(!Ls(p,h))return [[s,"they have differing arguments"],[p],[h]]}let A=l?.type,B=I?.type;if(A&&B&&or(A,B))return [[s,`they return conflicting types "${y(A)}" and "${y(B)}"`],[p],[h]];let M=p.selectionSet,Ie=h.selectionSet;if(M&&Ie){let T=Ds(e,t,n,r,N,W(A),M,W(B),Ie);return xs(T,s,p,h)}}function Ls(e,t){let n=e.arguments,r=t.arguments;if(n===void 0||n.length===0)return r===void 0||r.length===0;if(r===void 0||r.length===0||n.length!==r.length)return false;let i=new Map(r.map(({name:s,value:o})=>[s.value,o]));return n.every(s=>{let o=s.value,a=i.get(s.name.value);return a===void 0?false:di(o)===di(a)})}function di(e){return w(mn(e))}function or(e,t){return $(e)?$(t)?or(e.ofType,t.ofType):true:$(t)?true:_(e)?_(t)?or(e.ofType,t.ofType):true:_(t)?true:oe(e)||oe(t)?e!==t:false}function Tn(e,t,n,r){let i=t.get(r);if(i)return i;let s=Object.create(null),o=Object.create(null);yi(e,n,r,s,o);let a=[s,Object.keys(o)];return t.set(r,a),a}function ar(e,t,n){let r=t.get(n.selectionSet);if(r)return r;let i=Y(e.getSchema(),n.typeCondition);return Tn(e,t,i,n.selectionSet)}function yi(e,t,n,r,i){for(let s of n.selections)switch(s.kind){case exports.d.FIELD:{let o=s.name.value,a;(x(t)||R(t))&&(a=t.getFields()[o]);let c=s.alias?s.alias.value:o;r[c]||(r[c]=[]),r[c].push([t,s,a]);break}case exports.d.FRAGMENT_SPREAD:i[s.name.value]=true;break;case exports.d.INLINE_FRAGMENT:{let o=s.typeCondition,a=o?Y(e.getSchema(),o):t;yi(e,a,s.selectionSet,r,i);break}}}function xs(e,t,n,r){if(e.length>0)return [[t,e.map(([i])=>i)],[n,...e.map(([,i])=>i).flat()],[r,...e.map(([,,i])=>i).flat()]]}var En=class{constructor(){this._data=new Map;}has(t,n,r){var i;let s=(i=this._data.get(t))===null||i===void 0?void 0:i.get(n);return s===void 0?false:r?true:r===s}add(t,n,r){let i=this._data.get(t);i===void 0?this._data.set(t,new Map([[n,r]])):i.set(n,r);}},ur=class{constructor(){this._orderedPairSet=new En;}has(t,n,r){return t<n?this._orderedPairSet.has(t,n,r):this._orderedPairSet.has(n,t,r)}add(t,n,r){t<n?this._orderedPairSet.add(t,n,r):this._orderedPairSet.add(n,t,r);}};function lr(e){return {InlineFragment(t){let n=e.getType(),r=e.getParentType();if(pe(n)&&pe(r)&&!Zt(e.getSchema(),n,r)){let i=y(r),s=y(n);e.reportError(new d(`Fragment cannot be spread here as objects of type "${i}" can never be of type "${s}".`,{nodes:t}));}},FragmentSpread(t){let n=t.name.value,r=Rs(e,n),i=e.getParentType();if(r&&i&&!Zt(e.getSchema(),r,i)){let s=y(i),o=y(r);e.reportError(new d(`Fragment "${n}" cannot be spread here as objects of type "${s}" can never be of type "${o}".`,{nodes:t}));}}}}function Rs(e,t){let n=e.getFragment(t);if(n){let r=Y(e.getSchema(),n.typeCondition);if(pe(r))return r}}({[exports.d.SCALAR_TYPE_DEFINITION]:exports.d.SCALAR_TYPE_EXTENSION,[exports.d.OBJECT_TYPE_DEFINITION]:exports.d.OBJECT_TYPE_EXTENSION,[exports.d.INTERFACE_TYPE_DEFINITION]:exports.d.INTERFACE_TYPE_EXTENSION,[exports.d.UNION_TYPE_DEFINITION]:exports.d.UNION_TYPE_EXTENSION,[exports.d.ENUM_TYPE_DEFINITION]:exports.d.ENUM_TYPE_EXTENSION,[exports.d.INPUT_OBJECT_TYPE_DEFINITION]:exports.d.INPUT_OBJECT_TYPE_EXTENSION});function dr(e){return {...mr(e),Field:{leave(t){var n;let r=e.getFieldDef();if(!r)return false;let i=new Set((n=t.arguments)===null||n===void 0?void 0:n.map(s=>s.name.value));for(let s of r.args)if(!i.has(s.name)&&Se(s)){let o=y(s.type);e.reportError(new d(`Field "${r.name}" argument "${s.name}" of type "${o}" is required, but it was not provided.`,{nodes:t}));}}}}}function mr(e){var t;let n=Object.create(null),r=e.getSchema(),i=(t=r?.getDirectives())!==null&&t!==void 0?t:fe;for(let a of i)n[a.name]=ye(a.args.filter(Se),c=>c.name);let s=e.getDocument().definitions;for(let a of s)if(a.kind===exports.d.DIRECTIVE_DEFINITION){var o;let c=(o=a.arguments)!==null&&o!==void 0?o:[];n[a.name.value]=ye(c.filter(Cs),p=>p.name.value);}return {Directive:{leave(a){let c=a.name.value,p=n[c];if(p){var l;let f=(l=a.arguments)!==null&&l!==void 0?l:[],h=new Set(f.map(I=>I.name.value));for(let[I,N]of Object.entries(p))if(!h.has(I)){let A=We(N.type)?y(N.type):w(N.type);e.reportError(new d(`Directive "@${c}" argument "${I}" of type "${A}" is required, but it was not provided.`,{nodes:a}));}}}}}}function Cs(e){return e.type.kind===exports.d.NON_NULL_TYPE&&e.defaultValue==null}function hr(e){return {Field(t){let n=e.getType(),r=t.selectionSet;if(n)if(oe(W(n))){if(r){let i=t.name.value,s=y(n);e.reportError(new d(`Field "${i}" must not have a selection since type "${s}" has no subfields.`,{nodes:r}));}}else if(r){if(r.selections.length===0){let i=t.name.value,s=y(n);e.reportError(new d(`Field "${i}" of type "${s}" must have at least one field selected.`,{nodes:t}));}}else {let i=t.name.value,s=y(n);e.reportError(new d(`Field "${i}" of type "${s}" must have a selection of subfields. Did you mean "${i} { ... }"?`,{nodes:t}));}}}}function Ti(e){return e.map(t=>typeof t=="number"?"["+t.toString()+"]":"."+t).join("")}function yr(e,t,n){return {prev:e,key:t,typename:n}}function ge(e){let t=[],n=e;for(;n;)t.push(n.key),n=n.prev;return t.reverse()}function Ei(e,t,n=$s){return Ut(e,t,n,void 0)}function $s(e,t,n){let r="Invalid value "+y(t);throw e.length>0&&(r+=` at "value${Ti(e)}"`),n.message=r+": "+n.message,n}function Ut(e,t,n,r){if(_(t)){if(e!=null)return Ut(e,t.ofType,n,r);n(ge(r),e,new d(`Expected non-nullable type "${y(t)}" not to be null.`));return}if(e==null)return null;if($(t)){let i=t.ofType;return nn(e)?Array.from(e,(s,o)=>{let a=yr(r,o,void 0);return Ut(s,i,n,a)}):[Ut(e,i,n,r)]}if(k(t)){if(!ne(e)||Array.isArray(e)){n(ge(r),e,new d(`Expected type "${t.name}" to be an object.`));return}let i=Object.create(null),s=t.getFields();for(let o of Object.values(s)){let a=e[o.name];if(a===void 0){if(o.defaultValue!==void 0)i[o.name]=o.defaultValue;else if(_(o.type)){let c=y(o.type);n(ge(r),e,new d(`Field "${o.name}" of required type "${c}" was not provided.`));}continue}i[o.name]=Ut(a,o.type,n,yr(r,o.name,t.name));}for(let o of Object.keys(e))if(!s[o]){let a=ie(o,Object.keys(t.getFields()));n(ge(r),e,new d(`Field "${o}" is not defined by type "${t.name}".`+ee(a)));}if(t.isOneOf){let o=Object.keys(i);o.length!==1&&n(ge(r),e,new d(`Exactly one key must be specified for OneOf type "${t.name}".`));let a=o[0],c=i[a];c===null&&n(ge(r).concat(a),c,new d(`Field "${a}" must be non-null.`));}return {...i}}if(oe(t)){let i;try{i=t.parseValue(e);}catch(s){s instanceof d?n(ge(r),e,s):n(ge(r),e,new d(`Expected type "${t.name}". `+s.message,{originalError:s}));return}return i===void 0&&n(ge(r),e,new d(`Expected type "${t.name}".`)),i}q(false,"Unexpected input type: "+y(t));}function Re(e,t,n){if(e){if(e.kind===exports.d.VARIABLE){let r=e.name.value;if(n==null||n[r]===void 0||!gi(n,r))return;let i=n[r];return i===null&&_(t)?void 0:i}if(_(t))return e.kind===exports.d.NULL?void 0:Re(e,t.ofType,n);if(e.kind===exports.d.NULL)return null;if($(t)){let r=t.ofType;if(e.kind===exports.d.LIST){let s=[];for(let o of e.values)if(Ni(o,n)){if(_(r))return;s.push(null);}else {let a=Re(o,r,n);if(a===void 0)return;s.push(a);}return s}let i=Re(e,r,n);return i===void 0?void 0:[i]}if(k(t)){if(e.kind!==exports.d.OBJECT)return;let r=Object.create(null),i=ye(e.fields,s=>s.name.value);for(let s of Object.values(t.getFields())){let o=i[s.name];if(!o||Ni(o.value,n)){if(s.defaultValue!==void 0)r[s.name]=s.defaultValue;else if(_(s.type))return;continue}let a=Re(o.value,s.type,n);if(a===void 0)return;r[s.name]=a;}if(t.isOneOf){let s=Object.keys(r);if(s.length!==1||r[s[0]]===null)return}return r}if(oe(t)){let r;try{r=t.parseLiteral(e,n);}catch{return}return r===void 0?void 0:r}q(false,"Unexpected input type: "+y(t));}}function Ni(e,t){return e.kind===exports.d.VARIABLE&&(t==null||t[e.name.value]===void 0||!gi(t,e.name.value))}function gi(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Tr(e,t,n){var r;let i=Object.create(null),s=(r=t.arguments)!==null&&r!==void 0?r:[],o=ye(s,a=>a.name.value);for(let a of e.args){let c=a.name,p=a.type,l=o[c];if(!l){if(a.defaultValue!==void 0)i[c]=a.defaultValue;else if(_(p))throw new d(`Argument "${c}" of required type "${y(p)}" was not provided.`,{nodes:t});continue}let f=l.value,h=f.kind===exports.d.NULL;if(f.kind===exports.d.VARIABLE){let N=f.name.value;if(n==null||!Us(n,N)){if(a.defaultValue!==void 0)i[c]=a.defaultValue;else if(_(p))throw new d(`Argument "${c}" of required type "${y(p)}" was provided the variable "$${N}" which was not provided a runtime value.`,{nodes:f});continue}h=n[N]==null;}if(h&&_(p))throw new d(`Argument "${c}" of non-null type "${y(p)}" must not be null.`,{nodes:f});let I=Re(f,p,n);if(I===void 0)throw new d(`Argument "${c}" has invalid value ${w(f)}.`,{nodes:f});i[c]=I;}return {...i}}function Vt(e,t,n){var r;let i=(r=t.directives)===null||r===void 0?void 0:r.find(s=>s.name.value===e.name);if(i)return Tr(e,i,n)}function Us(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function vi(e,t,n,r,i){let s=new Map;return Nr(e,t,n,r,i,s,new Set),s}function Nr(e,t,n,r,i,s,o){for(let a of i.selections)switch(a.kind){case exports.d.FIELD:{if(!Er(n,a))continue;let c=Vs(a),p=s.get(c);p!==void 0?p.push(a):s.set(c,[a]);break}case exports.d.INLINE_FRAGMENT:{if(!Er(n,a)||!Ii(e,a,r))continue;Nr(e,t,n,r,a.selectionSet,s,o);break}case exports.d.FRAGMENT_SPREAD:{let c=a.name.value;if(o.has(c)||!Er(n,a))continue;o.add(c);let p=t[c];if(!p||!Ii(e,p,r))continue;Nr(e,t,n,r,p.selectionSet,s,o);break}}}function Er(e,t){let n=Vt(At,t,e);if(n?.if===true)return false;let r=Vt(Dt,t,e);return r?.if!==false}function Ii(e,t,n){let r=t.typeCondition;if(!r)return true;let i=Y(e,r);return i===n?true:le(i)?e.isSubType(i,n):false}function Vs(e){return e.alias?e.alias.value:e.name.value}function gr(e){return {OperationDefinition(t){if(t.operation==="subscription"){let n=e.getSchema(),r=n.getSubscriptionType();if(r){let i=t.name?t.name.value:null,s=Object.create(null),o=e.getDocument(),a=Object.create(null);for(let p of o.definitions)p.kind===exports.d.FRAGMENT_DEFINITION&&(a[p.name.value]=p);let c=vi(n,a,s,r,t.selectionSet);if(c.size>1){let f=[...c.values()].slice(1).flat();e.reportError(new d(i!=null?`Subscription "${i}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",{nodes:f}));}for(let p of c.values())p[0].name.value.startsWith("__")&&e.reportError(new d(i!=null?`Subscription "${i}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",{nodes:p}));}}}}}function it(e,t){let n=new Map;for(let r of e){let i=t(r),s=n.get(i);s===void 0?n.set(i,[r]):s.push(r);}return n}function Nn(e){return {Field:t,Directive:t};function t(n){var r;let i=(r=n.arguments)!==null&&r!==void 0?r:[],s=it(i,o=>o.name.value);for(let[o,a]of s)a.length>1&&e.reportError(new d(`There can be only one argument named "${o}".`,{nodes:a.map(c=>c.name)}));}}function gn(e){let t=Object.create(null),n=e.getSchema(),r=n?n.getDirectives():fe;for(let c of r)t[c.name]=!c.isRepeatable;let i=e.getDocument().definitions;for(let c of i)c.kind===exports.d.DIRECTIVE_DEFINITION&&(t[c.name.value]=!c.repeatable);let s=Object.create(null),o=Object.create(null),a=Object.create(null);return {enter(c){if(!("directives"in c)||!c.directives)return;let p;if(c.kind===exports.d.SCHEMA_DEFINITION||c.kind===exports.d.SCHEMA_EXTENSION)p=s;else if(xe(c)||ln(c)){let l=c.name.value;p=o[l],p===void 0&&(o[l]=p=Object.create(null));}else if(c.kind===exports.d.DIRECTIVE_DEFINITION||c.kind===exports.d.DIRECTIVE_EXTENSION){let l=c.name.value;p=a[l],p===void 0&&(a[l]=p=Object.create(null));}else p=Object.create(null);for(let l of c.directives){let f=l.name.value;t[f]&&(p[f]?e.reportError(new d(`The directive "@${f}" can only be used once at this location.`,{nodes:[p[f],l]})):p[f]=l);}}}}function Sr(e){let t=Object.create(null);return {OperationDefinition:()=>false,FragmentDefinition(n){let r=n.name.value;return t[r]?e.reportError(new d(`There can be only one fragment named "${r}".`,{nodes:[t[r],n.name]})):t[r]=n.name,false}}}function In(e){let t=[],n=Object.create(null);return {ObjectValue:{enter(){t.push(n),n=Object.create(null);},leave(){let r=t.pop();r||q(),n=r;}},ObjectField(r){let i=r.name.value;n[i]?e.reportError(new d(`There can be only one input field named "${i}".`,{nodes:[n[i],r.name]})):n[i]=r.name;}}}function _r(e){let t=Object.create(null);return {OperationDefinition(n){let r=n.name;return r&&(t[r.value]?e.reportError(new d(`There can be only one operation named "${r.value}".`,{nodes:[t[r.value],r]})):t[r.value]=r),false},FragmentDefinition:()=>false}}function Lr(e){return {OperationDefinition(t){var n;let r=(n=t.variableDefinitions)!==null&&n!==void 0?n:[],i=it(r,s=>s.variable.name.value);for(let[s,o]of i)o.length>1&&e.reportError(new d(`There can be only one variable named "$${s}".`,{nodes:o.map(a=>a.variable.name)}));}}}function xr(e){return {ListValue(t){let n=He(e.getParentInputType());if(!$(n))return Me(e,t),false},ObjectValue(t){let n=W(e.getInputType());if(!k(n))return Me(e,t),false;let r=ye(t.fields,i=>i.name.value);for(let i of Object.values(n.getFields()))if(!r[i.name]&&Ze(i)){let o=y(i.type);e.reportError(new d(`Field "${n.name}.${i.name}" of required type "${o}" was not provided.`,{nodes:t}));}n.isOneOf&&Ms(e,t,n,r);},ObjectField(t){let n=W(e.getParentInputType());if(!e.getInputType()&&k(n)){let i=ie(t.name.value,Object.keys(n.getFields()));e.reportError(new d(`Field "${t.name.value}" is not defined by type "${n.name}".`+ee(i),{nodes:t}));}},NullValue(t){let n=e.getInputType();_(n)&&e.reportError(new d(`Expected value of type "${y(n)}", found ${w(t)}.`,{nodes:t}));},EnumValue:t=>Me(e,t),IntValue:t=>Me(e,t),FloatValue:t=>Me(e,t),StringValue:t=>Me(e,t),BooleanValue:t=>Me(e,t)}}function Me(e,t){let n=e.getInputType();if(!n)return;let r=W(n);if(!oe(r)){let i=y(n);e.reportError(new d(`Expected value of type "${i}", found ${w(t)}.`,{nodes:t}));return}try{if(r.parseLiteral(t,void 0)===void 0){let s=y(n);e.reportError(new d(`Expected value of type "${s}", found ${w(t)}.`,{nodes:t}));}}catch(i){let s=y(n);i instanceof d?e.reportError(i):e.reportError(new d(`Expected value of type "${s}", found ${w(t)}; `+i.message,{nodes:t,originalError:i}));}}function Ms(e,t,n,r){var i;let s=Object.keys(r);if(s.length!==1){e.reportError(new d(`OneOf Input Object "${n.name}" must specify exactly one key.`,{nodes:[t]}));return}let a=(i=r[s[0]])===null||i===void 0?void 0:i.value;(!a||a.kind===exports.d.NULL)&&e.reportError(new d(`Field "${n.name}.${s[0]}" must be non-null.`,{nodes:[t]}));}function Rr(e){return {VariableDefinition(t){let n=Y(e.getSchema(),t.type);if(n!==void 0&&!te(n)){let r=t.variable.name.value,i=w(t.type);e.reportError(new d(`Variable "$${r}" cannot be non-input type "${i}".`,{nodes:t.type}));}}}}function wr(e){let t=Object.create(null);return {OperationDefinition:{enter(){t=Object.create(null);},leave(n){let r=e.getRecursiveVariableUsages(n);for(let{node:i,type:s,defaultValue:o,parentType:a}of r){let c=i.name.value,p=t[c];if(p&&s){let l=e.getSchema(),f=Y(l,p.type);if(f&&!Gs(l,f,p.defaultValue,s,o)){let h=y(f),I=y(s);e.reportError(new d(`Variable "$${c}" of type "${h}" used in position expecting type "${I}".`,{nodes:[p,i]}));}k(a)&&a.isOneOf&&Nt(f)&&e.reportError(new d(`Variable "$${c}" is of type "${f}" but must be non-nullable to be used for OneOf Input Object "${a}".`,{nodes:[p,i]}));}}}},VariableDefinition(n){t[n.variable.name.value]=n;}}}function Gs(e,t,n,r,i){if(_(r)&&!_(t)){if(!(n!=null&&n.kind!==exports.d.NULL)&&!(i!==void 0))return false;let a=r.ofType;return _e(e,t,a)}return _e(e,t,r)}var kr=Object.freeze([tr]),vn=Object.freeze([Kn,_r,Zn,gr,dn,Xn,Rr,hr,Jn,Sr,Hn,ir,lr,nr,Lr,rr,sr,fn,gn,zn,Nn,xr,dr,wr,cr,In,...kr]);var Fr=class{constructor(t,n){this._ast=t,this._fragments=void 0,this._fragmentSpreads=new Map,this._recursivelyReferencedFragments=new Map,this._onError=n;}get[Symbol.toStringTag](){return "ASTValidationContext"}reportError(t){this._onError(t);}getDocument(){return this._ast}getFragment(t){let n;if(this._fragments)n=this._fragments;else {n=Object.create(null);for(let r of this.getDocument().definitions)r.kind===exports.d.FRAGMENT_DEFINITION&&(n[r.name.value]=r);this._fragments=n;}return n[t]}getFragmentSpreads(t){let n=this._fragmentSpreads.get(t);if(!n){n=[];let r=[t],i;for(;i=r.pop();)for(let s of i.selections)s.kind===exports.d.FRAGMENT_SPREAD?n.push(s):s.selectionSet&&r.push(s.selectionSet);this._fragmentSpreads.set(t,n);}return n}getRecursivelyReferencedFragments(t){let n=this._recursivelyReferencedFragments.get(t);if(!n){n=[];let r=Object.create(null),i=[t.selectionSet],s;for(;s=i.pop();)for(let o of this.getFragmentSpreads(s)){let a=o.name.value;if(r[a]!==true){r[a]=true;let c=this.getFragment(a);c&&(n.push(c),i.push(c.selectionSet));}}this._recursivelyReferencedFragments.set(t,n);}return n}};var jt=class extends Fr{constructor(t,n,r,i){super(n,i),this._schema=t,this._typeInfo=r,this._variableUsages=new Map,this._recursiveVariableUsages=new Map;}get[Symbol.toStringTag](){return "ValidationContext"}getSchema(){return this._schema}getVariableUsages(t){let n=this._variableUsages.get(t);if(!n){let r=[],i=new je(this._schema);$e(t,$t(i,{VariableDefinition:()=>false,Variable(s){r.push({node:s,type:i.getInputType(),defaultValue:i.getDefaultValue(),parentType:i.getParentInputType()});}})),n=r,this._variableUsages.set(t,n);}return n}getRecursiveVariableUsages(t){let n=this._recursiveVariableUsages.get(t);if(!n){n=this.getVariableUsages(t);for(let r of this.getRecursivelyReferencedFragments(t))n=n.concat(this.getVariableUsages(r));this._recursiveVariableUsages.set(t,n);}return n}getType(){return this._typeInfo.getType()}getParentType(){return this._typeInfo.getParentType()}getInputType(){return this._typeInfo.getInputType()}getParentInputType(){return this._typeInfo.getParentInputType()}getFieldDef(){return this._typeInfo.getFieldDef()}getDirective(){return this._typeInfo.getDirective()}getArgument(){return this._typeInfo.getArgument()}getEnumValue(){return this._typeInfo.getEnumValue()}};var Qs=Ce(ct,e=>e.filter(t=>t!=="description"));function Oi(e,t,n=vn,r,i=new je(e)){var s;let o=(s=r?.maxErrors)!==null&&s!==void 0?s:100;t||L(false,"Must provide document."),pn(e);let a=Object.freeze({}),c=[],p=new jt(e,t,i,f=>{if(c.length>=o)throw c.push(new d("Too many validation errors, error limit reached. Validation aborted.")),a;c.push(f);}),l=wn(n.map(f=>f(p)));try{$e(t,$t(i,l),Qs);}catch(f){if(f!==a)throw f}return c}function bi(e){return e instanceof Error?e:new Cr(e)}var Cr=class extends Error{constructor(t){super("Unexpected error value: "+y(t)),this.name="NonErrorThrown",this.thrownValue=t;}};function Si(e,t,n){var r;let i=bi(e);return Bs(i)?i:new d(i.message,{nodes:(r=i.nodes)!==null&&r!==void 0?r:t,source:i.source,positions:i.positions,path:n,originalError:i})}function Bs(e){return Array.isArray(e.path)}function _i(e,t){let n=null;for(let i of e.definitions)if(i.kind===exports.d.OPERATION_DEFINITION){var r;if(t==null){if(n)return null;n=i;}else if(((r=i.name)===null||r===void 0?void 0:r.value)===t)return i}return n}function Ur(e){return Eo(e,t=>!tn(t),To)}function To(e){return !en(e)&&!rt(e)}function Eo(e,t,n){let r=e.getDirectives().filter(t),i=Object.values(e.getTypeMap()).filter(n);return [No(e),...r.map(s=>Do(s)),...i.map(s=>Vr(s))].filter(Boolean).join(`
|
|
60
|
+
|
|
61
|
+
`)}function No(e){if(e.description==null&&go(e))return;let t=[],n=e.getQueryType();n&&t.push(` query: ${n.name}`);let r=e.getMutationType();r&&t.push(` mutation: ${r.name}`);let i=e.getSubscriptionType();return i&&t.push(` subscription: ${i.name}`),me(e)+`schema {
|
|
62
|
+
${t.join(`
|
|
63
|
+
`)}
|
|
64
|
+
}`}function go(e){let t=e.getQueryType();if(t&&t.name!=="Query")return false;let n=e.getMutationType();if(n&&n.name!=="Mutation")return false;let r=e.getSubscriptionType();return !(r&&r.name!=="Subscription")}function Vr(e){if(ce(e))return Io(e);if(x(e))return vo(e);if(R(e))return Oo(e);if(z(e))return bo(e);if(Q(e))return So(e);if(k(e))return _o(e);q(false,"Unexpected type: "+y(e));}function Io(e){return me(e)+`scalar ${e.name}`+Ao(e)}function Di(e){let t=e.getInterfaces();return t.length?" implements "+t.map(n=>n.name).join(" & "):""}function vo(e){return me(e)+`type ${e.name}`+Di(e)+Ai(e)}function Oo(e){return me(e)+`interface ${e.name}`+Di(e)+Ai(e)}function bo(e){let t=e.getTypes(),n=t.length?" = "+t.join(" | "):"";return me(e)+"union "+e.name+n}function So(e){let t=e.getValues().map((n,r)=>me(n," ",!r)+" "+n.name+On(n.deprecationReason));return me(e)+`enum ${e.name}`+jr(t)}function _o(e){let t=Object.values(e.getFields()).map((n,r)=>me(n," ",!r)+" "+$r(n));return me(e)+`input ${e.name}`+(e.isOneOf?" @oneOf":"")+jr(t)}function Ai(e){let t=Object.values(e.getFields()).map((n,r)=>me(n," ",!r)+" "+n.name+Li(n.args," ")+": "+String(n.type)+On(n.deprecationReason));return jr(t)}function jr(e){return e.length!==0?` {
|
|
65
|
+
`+e.join(`
|
|
66
|
+
`)+`
|
|
67
|
+
}`:""}function Li(e,t=""){return e.length===0?"":e.every(n=>!n.description)?"("+e.map($r).join(", ")+")":`(
|
|
68
|
+
`+e.map((n,r)=>me(n," "+t,!r)+" "+t+$r(n)).join(`
|
|
69
|
+
`)+`
|
|
70
|
+
`+t+")"}function $r(e){let t=De(e.defaultValue,e.type),n=e.name+": "+String(e.type);return t&&(n+=` = ${w(t)}`),n+On(e.deprecationReason)}function Do(e){return me(e)+"directive @"+e.name+Li(e.args)+On(e.deprecationReason)+(e.isRepeatable?" repeatable":"")+" on "+e.locations.join(" | ")}function On(e){return e==null?"":e!==Lt?` @deprecated(reason: ${w({kind:exports.d.STRING,value:e})})`:" @deprecated"}function Ao(e){return e.specifiedByURL==null?"":` @specifiedBy(url: ${w({kind:exports.d.STRING,value:e.specifiedByURL})})`}function me(e,t="",n=true){let{description:r}=e;if(r==null)return "";let i=w({kind:exports.d.STRING,value:r,block:Kr(r)});return (t&&!n?`
|
|
71
|
+
`+t:t)+i.replace(/\n/g,`
|
|
72
|
+
`+t)+`
|
|
73
|
+
`}var Gr=class{db;tenantID;user;caches=new Map;pending=new Map;waiting=new Map;flushScheduled=false;constructor(t){this.db=t.db,this.tenantID=t.tenantID,this.user=t.user;}getCacheKey(t){return t}async load(t,n){let r=this.getCacheKey(t),i=this.caches.get(r);if(i||(i=new Map,this.caches.set(r,i)),i.has(n))return i.get(n);let s=this.pending.get(r);return s||(s=new Set,this.pending.set(r,s)),s.add(n),i.set(n,void 0),this.flushScheduled||(this.flushScheduled=true,queueMicrotask(()=>{this.flushScheduled=false,this.flushAll();})),new Promise(o=>{this.waiting.set(`${r}:${n}`,o);})}async flushAll(){for(let[t,n]of this.pending){if(n.size===0)continue;let r=this.caches.get(t),i=await this.db.find({collection:t,where:{id:{in:Array.from(n)}},limit:n.size,tenantID:this.tenantID,draft:!!this.user});for(let s of i.docs||[])if(s&&s.id){r.set(s.id,s);let o=this.waiting.get(`${t}:${s.id}`);o&&(o(s),this.waiting.delete(`${t}:${s.id}`));}}for(let[t,n]of this.waiting)n(void 0);this.waiting.clear(),this.pending.clear();}resolveOne(t,n){return this.caches.get(this.getCacheKey(t))?.get(n)}},ke=new ue({name:"JSON",description:"Arbitrary JSON value",serialize(e){return e},parseValue(e){return e},parseLiteral(e){switch(e.kind){case exports.d.STRING:return e.value;case exports.d.INT:case exports.d.FLOAT:return parseFloat(e.value);case exports.d.BOOLEAN:return e.value;case exports.d.OBJECT:{let t={};for(let n of e.fields)t[n.name.value]=ke.parseLiteral(n.value);return t}case exports.d.LIST:return e.values.map(t=>ke.parseLiteral(t));case exports.d.NULL:return null;default:return null}}});function xo(e){return t=>{let n=0;return {Field(){n++,n>e&&t.reportError(new Error(`Query exceeds max depth of ${e}`));},leaveField(){n--;}}}}function H(e){return e.split(/[-_]/).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function Mr(e){let t=H(e);return t.charAt(0).toLowerCase()+t.slice(1)}function he(e){return e.endsWith("s")&&e.length>1?e.slice(0,-1):e}async function st(e,t,n){let r=e.access?.[t];if(n.apiKey){if(n.apiKey.permissions?.length>0){let s=e.slug,a=`${s}:${t==="read"?"read":t==="create"?"create":"update"}`;return !chunkNY47CFVP_cjs.h(n.apiKey.permissions,a)&&!chunkNY47CFVP_cjs.h(n.apiKey.permissions,`${s}:admin`)?{allowed:false}:{allowed:true}}if(r){let s=await chunkNY47CFVP_cjs.a(r,{req:n.req,user:n.user,tenantID:n.tenantID});return typeof s=="boolean"?{allowed:s}:{allowed:true,extraWhere:s}}return {allowed:true}}if(n.user){let s=e.slug,a=`${s}:${t==="read"?"read":t==="create"?"create":t==="update"?"update":"delete"}`;if(!chunkQ3Q7BJVQ_cjs.a({id:n.user.id,email:n.user.email,role:n.user.role},a)&&!chunkQ3Q7BJVQ_cjs.a({id:n.user.id,email:n.user.email,role:n.user.role},`${s}:admin`)&&!r)return {allowed:false}}if(!r)return n.user?{allowed:true}:{allowed:false};let i=await chunkNY47CFVP_cjs.a(r,{req:n.req,user:n.user,tenantID:n.tenantID});return typeof i=="boolean"?{allowed:i}:{allowed:true,extraWhere:i}}async function xi(e,t,n){let r=e.access?.[t];if(n.apiKey){if(n.apiKey.permissions?.length>0){let s=e.slug,o=`${s}:${t}`;return !chunkNY47CFVP_cjs.h(n.apiKey.permissions,o)&&!chunkNY47CFVP_cjs.h(n.apiKey.permissions,`${s}:admin`)&&!chunkNY47CFVP_cjs.h(n.apiKey.permissions,`${s}:*`)?{allowed:false}:{allowed:true}}if(r){let s=await chunkNY47CFVP_cjs.a(r,{req:n.req,user:n.user,tenantID:n.tenantID});return {allowed:typeof s=="boolean"?s:true}}return {allowed:true}}if(!r){if(!n.user)return {allowed:false};let s=n.user.role;return s==="super_admin"||s==="admin"?{allowed:true}:{allowed:false}}let i=await chunkNY47CFVP_cjs.a(r,{req:n.req,user:n.user,tenantID:n.tenantID});return typeof i=="boolean"?{allowed:i}:{allowed:true}}function Ri(e,t){return e?e.startsWith("http://")||e.startsWith("https://")||e.startsWith("blob:")||e.startsWith("data:")?e:`${(process.env.KYRO_BASE_URL||t||"http://localhost:4321").replace(/\/+$/,"")}${e.startsWith("/")?"":"/"}${e}`:null}function we(e,t){return e&&(e.url&&(e.url=Ri(e.url,t)),e.thumbnailUrl&&(e.thumbnailUrl=Ri(e.thumbnailUrl,t)),e)}function ot(e,t,n,r=false){switch(e.type){case "text":case "email":case "password":case "textarea":case "color":case "code":case "markdown":case "date":case "select":case "radio":return O;case "upload":{let i=e;if(r)return i.hasMany?new U(O):O;if(i.relationTo&&n?.[i.relationTo]){let s=n[i.relationTo];return i.hasMany?new U(s):s}return ke}case "image":{if(r)return O;let i=e;return i.relationTo&&n?.[i.relationTo]?n[i.relationTo]:ke}case "number":return e.integer?Ee:Ot;case "checkbox":return V;case "json":case "richtext":case "blocks":case "tabs":return ke;case "relationship":if(typeof e.relationTo=="string"){if(r)return e.hasMany?new U(O):O;if(n?.[e.relationTo])return e.hasMany?new U(n[e.relationTo]):n[e.relationTo];let i=t.getCollection(e.relationTo);if(i)return new j({name:`${H(e.relationTo)}Ref`,fields:()=>({id:{type:O},...Pr(i,t,n)})})}return O;case "array":return new U(O);case "group":return ke;default:return O}}function Pr(e,t,n){let r={};for(let i of e.fields)if(i.name&&i.admin?.hidden!==true){let s=Ro(i,t,n);s&&(r[i.name]=s);}return r}function Ro(e,t,n){if(!e.name)return null;let r=e.deprecated||void 0;if(e.type==="upload"){let s=ot(e,t,n,false),o=e;return {type:e.required?new b(s):s,description:e.admin?.description||e.label,deprecationReason:r,resolve:async(a,c,p)=>{let l=p?.relationLoader,f=a?.[o.name],h=p?.req?.url?new URL(p.req.url).origin:void 0;if(!f)return null;if(o.hasMany){let N=Array.isArray(f)?f:[];return Promise.all(N.map(async A=>{let B=typeof A=="string"?A:A?.id;if(!B||typeof A=="object"&&A?.url)return we(A,h);if(l){let M=l.resolveOne(o.relationTo,B);if(M)return we(M,h);let Ie=await l.load(o.relationTo,B);if(Ie)return we(Ie,h)}return {id:B}}))}let I=typeof f=="string"?f:f?.id;if(!I||typeof f=="object"&&f?.url)return we(f,h);if(l){let N=l.resolveOne(o.relationTo,I);if(N)return we(N,h);let A=await l.load(o.relationTo,I);if(A)return we(A,h)}return {id:I}}}}if(e.type==="relationship"&&!e.hasMany){let s=ot(e,t,n,false);return {type:e.required?new b(s):s,description:e.admin?.description||e.label,deprecationReason:r,resolve:async(o,a,c)=>{let p=c?.relationLoader,l=e,f=o?.[l.name];if(!f)return null;if(p&&typeof f=="string"){let h=p.resolveOne(l.relationTo,f);if(h)return h;let I=await p.load(l.relationTo,f);if(I)return I}return {id:f}}}}if(e.type==="relationship"&&e.hasMany)return {type:ot(e,t,n,false),description:e.admin?.description||e.label,deprecationReason:r,resolve:async(o,a,c)=>{let p=c?.relationLoader,l=e,f=o?.[l.name]||[];if(!f.length)return [];if(p){let h=[];for(let I of f){let N=p.resolveOne(l.relationTo,I);if(N)h.push(N);else {let A=await p.load(l.relationTo,I);h.push(A||{id:I});}}return h}return f.map(h=>({id:h}))}};let i=ot(e,t,n,false);return {type:e.required?new b(i):i,description:e.admin?.description||e.label,deprecationReason:r}}function wi(e){let{registry:t,db:n,user:r,req:i,tenantID:s,apiKey:o,settings:a}=e;if(a?.access?.apiAccess?.graphqlEnabled===false)throw new Error("GraphQL API is disabled");let p=t.getCollections(),l=t.getGlobals(),f={},h={};for(let T of p){f[T.slug]=new j({name:H(he(T.slug)),fields:()=>({id:{type:O},...Pr(T,t,f),...T.timestamps?{createdAt:{type:O},updatedAt:{type:O}}:{},...T.tenantScoped?{tenantID:{type:O}}:{}})});let F={};for(let G of T.fields)G.name&&G.name!=="id"&&(F[G.name]={type:ot(G,t,f,true)});h[T.slug]=new Le({name:`${H(he(T.slug))}Input`,fields:()=>F});}let I={},N={};for(let T of l)I[T.slug]=new j({name:`${H(T.slug)}Global`,fields:()=>({id:{type:O},...Pr({slug:T.slug,fields:T.fields},t,f)})}),N[T.slug]=new Le({name:`${H(T.slug)}GlobalInput`,fields:()=>{let F={};for(let G of T.fields)G.name&&G.name!=="id"&&(F[G.name]={type:ot(G,t,f,true)});return F}});let A={};for(let T of p){let F=f[T.slug];F&&(A[Mr(T.slug)]={type:new j({name:`${H(he(T.slug))}FindResult`,fields:{docs:{type:new U(F)},totalDocs:{type:Ee},page:{type:Ee},totalPages:{type:Ee},hasNextPage:{type:V},hasPrevPage:{type:V}}}),args:{where:{type:O},sort:{type:O},limit:{type:Ee},page:{type:Ee},draft:{type:V}},resolve:async(G,C,g)=>{let D=await st(T,"read",{user:g.user,req:g.req,tenantID:g.tenantID,apiKey:g.apiKey});if(!D.allowed)throw new Error("Access denied");g.tenantID&&n.setTenantContext({tenantId:g.tenantID,userId:g.user?.id??"",role:g.user?.role,isSuperAdmin:g.user?.role==="super_admin"});let Z={};if(C.where)try{Z=JSON.parse(C.where);}catch{}D.extraWhere&&(Z={...Z,...D.extraWhere});let ve=C.draft??!!g.user;return n.find({collection:T.slug,where:Z,sort:C.sort,limit:C.limit||10,page:C.page||1,tenantID:g.tenantID,draft:ve})}},A[Mr(he(T.slug))]={type:F,args:{id:{type:O},slug:{type:O},draft:{type:V}},resolve:async(G,C,g)=>{if(!C.id&&!C.slug)throw new Error("Either id or slug is required");if(!(await st(T,"read",{user:g.user,req:g.req,tenantID:g.tenantID,apiKey:g.apiKey})).allowed)throw new Error("Access denied");g.tenantID&&n.setTenantContext({tenantId:g.tenantID,userId:g.user?.id??"",role:g.user?.role,isSuperAdmin:g.user?.role==="super_admin"});let Z=C.draft??!!g.user;return C.id?n.findByID({collection:T.slug,id:C.id,tenantID:g.tenantID,draft:Z}):(await n.find({collection:T.slug,where:{slug:{equals:C.slug}},limit:1,page:1,tenantID:g.tenantID,draft:Z})).docs?.[0]||null}},A[`count${H(T.slug)}`]={type:new j({name:`${H(he(T.slug))}Count`,fields:{totalDocs:{type:Ee}}}),args:{where:{type:O}},resolve:async(G,C,g)=>{if(!(await st(T,"read",{user:g.user,req:g.req,tenantID:g.tenantID,apiKey:g.apiKey})).allowed)return {totalDocs:0};let Z={};if(C.where)try{Z=JSON.parse(C.where);}catch{}return {totalDocs:await n.count({collection:T.slug,where:Z,tenantID:g.tenantID})}}});}for(let T of l){let F=I[T.slug];F&&(A[Mr(he(T.slug))]={type:F,resolve:async(G,C,g)=>{if(!(await xi(T,"read",{user:g.user,req:g.req,tenantID:g.tenantID,apiKey:g.apiKey})).allowed)throw new Error("Access denied: cannot read global");return g.tenantID&&n.setTenantContext({tenantId:g.tenantID,userId:g.user?.id??"",role:g.user?.role,isSuperAdmin:g.user?.role==="super_admin"}),n.findOne({collection:`_globals_${T.slug}`,where:{},tenantID:g.tenantID})}});}let B=new j({name:"Query",fields:A}),M={};for(let T of p){let F=f[T.slug],G=h[T.slug];!F||!G||(M[`create${H(he(T.slug))}`]={type:new j({name:`${H(he(T.slug))}CreateResult`,fields:{doc:{type:F},message:{type:O}}}),args:{data:{type:new b(G)}},resolve:async(C,g,D)=>{if(!(await st(T,"create",{user:D.user,req:D.req,tenantID:D.tenantID,apiKey:D.apiKey})).allowed)throw new Error("Access denied: cannot create");D.tenantID&&n.setTenantContext({tenantId:D.tenantID,userId:D.user?.id??"",role:D.user?.role,isSuperAdmin:D.user?.role==="super_admin"});let bn=t.getCreateZodSchema(T.slug).parse(g.data);return {doc:await n.create({collection:T.slug,data:bn,tenantID:D.tenantID}),message:"Created successfully"}}},M[`update${H(he(T.slug))}`]={type:new j({name:`${H(he(T.slug))}UpdateResult`,fields:{doc:{type:F},message:{type:O}}}),args:{id:{type:new b(O)},data:{type:new b(G)},baseUpdatedAt:{type:O}},resolve:async(C,g,D)=>{if(!(await st(T,"update",{user:D.user,req:D.req,tenantID:D.tenantID,apiKey:D.apiKey})).allowed)throw new Error("Access denied: cannot update");if(D.tenantID&&n.setTenantContext({tenantId:D.tenantID,userId:D.user?.id??"",role:D.user?.role,isSuperAdmin:D.user?.role==="super_admin"}),g.baseUpdatedAt){let Mt=await n.findByID({collection:T.slug,id:g.id,tenantID:D.tenantID,draft:true});if(Mt&&Mt.updatedAt&&g.baseUpdatedAt!==Mt.updatedAt)throw new Error(`Revision conflict: document has changed since ${g.baseUpdatedAt}. Current updatedAt: ${Mt.updatedAt}`)}let bn=t.getUpdateZodSchema(T.slug).parse(g.data);return {doc:await n.update({collection:T.slug,id:g.id,data:bn,tenantID:D.tenantID}),message:"Updated successfully"}}},M[`delete${H(he(T.slug))}`]={type:new j({name:`${H(he(T.slug))}DeleteResult`,fields:{doc:{type:F},message:{type:O}}}),args:{id:{type:new b(O)}},resolve:async(C,g,D)=>{if(!(await st(T,"delete",{user:D.user,req:D.req,tenantID:D.tenantID,apiKey:D.apiKey})).allowed)throw new Error("Access denied: cannot delete");return D.tenantID&&n.setTenantContext({tenantId:D.tenantID,userId:D.user?.id??"",role:D.user?.role,isSuperAdmin:D.user?.role==="super_admin"}),{doc:await n.delete({collection:T.slug,id:g.id,tenantID:D.tenantID}),message:"Deleted successfully"}}});}for(let T of l){let F=N[T.slug];F&&(M[`update${H(T.slug)}`]={type:new j({name:`${H(T.slug)}UpdateResult`,fields:{doc:{type:I[T.slug]||O},message:{type:O}}}),args:{data:{type:new b(F)}},resolve:async(G,C,g)=>{if(!(await xi(T,"update",{user:g.user,req:g.req,tenantID:g.tenantID,apiKey:g.apiKey})).allowed)throw new Error("Access denied: cannot update global");g.tenantID&&n.setTenantContext({tenantId:g.tenantID,userId:g.user?.id??"",role:g.user?.role,isSuperAdmin:g.user?.role==="super_admin"});let Z=await n.findOne({collection:`_globals_${T.slug}`,where:{},tenantID:g.tenantID}),ve;return Z?ve=await n.update({collection:`_globals_${T.slug}`,id:Z.id,data:C.data,tenantID:g.tenantID}):ve=await n.create({collection:`_globals_${T.slug}`,data:C.data,tenantID:g.tenantID}),{doc:ve,message:"Updated successfully"}}});}let Ie=new j({name:"Mutation",fields:M});return new Ue({query:B,mutation:Ie})}function wo(e,t,n){return wi({registry:e,db:t,user:n?.user,req:n?.req,tenantID:n?.tenantID,apiKey:n?.apiKey})}
|
|
74
|
+
exports.A=Vt;exports.B=vn;exports.C=Oi;exports.D=Si;exports.E=_i;exports.F=Ur;exports.G=Gr;exports.H=xo;exports.I=wi;exports.J=wo;exports.a=Fi;exports.b=d;exports.e=ei;exports.f=w;exports.g=x;exports.h=$;exports.i=_;exports.j=te;exports.k=oe;exports.l=le;exports.m=b;exports.n=Ee;exports.o=O;exports.p=V;exports.q=Oe;exports.r=Dt;exports.s=At;exports.t=Rt;exports.u=wt;exports.v=kt;exports.w=pn;exports.x=Y;exports.y=Ei;exports.z=Re;
|