@kyro-cms/core 0.13.5 → 0.13.6
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 +2 -2
- package/dist/api-handler-trpc.cjs +1 -1
- package/dist/api-handler-trpc.js +2 -2
- package/dist/api-handler.cjs +1 -1
- package/dist/api-handler.js +1 -1
- package/dist/auth-session-4WJUKESW.js +1 -0
- package/dist/auth-session-VHUHDBCL.cjs +1 -0
- package/dist/bootstrap-JYAUQ52D.cjs +1 -0
- package/dist/bootstrap-TTMLNQM3.js +1 -0
- package/dist/chunk-23RSKVJP.cjs +1 -0
- package/dist/chunk-24W5I6SJ.cjs +2 -0
- package/dist/{chunk-CH4TZZI5.js → chunk-2I2AXTKY.cjs} +38 -39
- package/dist/chunk-34LCWI5X.cjs +1 -0
- package/dist/chunk-3A5UO6OQ.cjs +114 -0
- package/dist/chunk-3N34WXBS.js +2 -0
- package/dist/chunk-5BUAWCU6.js +91 -0
- package/dist/{chunk-7NKNSRCB.cjs → chunk-5I3BM5TV.js} +33 -32
- package/dist/chunk-5RBGM5N5.js +3 -0
- package/dist/chunk-7EY3GXRA.js +2 -0
- package/dist/chunk-7KTPBTH5.cjs +1 -0
- package/dist/chunk-A4XM33WO.js +109 -0
- package/dist/chunk-A7763NCF.cjs +19 -0
- package/dist/chunk-AQWTJGML.cjs +1 -0
- package/dist/chunk-CIWLQXB2.js +2 -0
- package/dist/chunk-DCFOVCJX.cjs +1 -0
- package/dist/chunk-DCKJT247.cjs +1 -0
- package/dist/chunk-EG4SRTYS.cjs +2 -0
- package/dist/chunk-FAG2645P.js +2 -0
- package/dist/chunk-FIVTKI25.cjs +3 -0
- package/dist/chunk-FU76HURF.cjs +1 -0
- package/dist/chunk-GDLMPZKD.cjs +2 -0
- package/dist/chunk-GS4CMYKS.cjs +1 -0
- package/dist/chunk-GTAKGVUY.js +2 -0
- package/dist/chunk-GWUHIIPO.cjs +132 -0
- package/dist/chunk-H2IJDTA2.cjs +1 -0
- package/dist/chunk-HACW42ZZ.cjs +108 -0
- package/dist/chunk-HCM2G674.cjs +20 -0
- package/dist/chunk-I22MSXGL.js +2 -0
- package/dist/chunk-IIPSXKNV.js +115 -0
- package/dist/{chunk-WNU76M2C.js → chunk-IIVBEZC2.js} +6 -6
- package/dist/chunk-JHFD3IAU.cjs +1 -0
- package/dist/chunk-JJY2F6NL.cjs +3 -0
- package/dist/chunk-JQ4V2MGJ.cjs +2 -0
- package/dist/chunk-JXJTFBHG.js +3 -0
- package/dist/chunk-KOSR7235.cjs +1 -0
- package/dist/chunk-KUY4QDAL.js +2 -0
- package/dist/chunk-LGUHXOEW.js +3 -0
- package/dist/chunk-LXTVMP5F.cjs +6 -0
- package/dist/chunk-N25DOGLQ.js +5 -0
- package/dist/chunk-N2BMGZIX.cjs +90 -0
- package/dist/chunk-N7CDHWQH.cjs +2 -0
- package/dist/chunk-NBBAMC2X.cjs +1 -0
- package/dist/chunk-NGNXOXI5.js +2 -0
- package/dist/chunk-O4PPZOVI.cjs +1 -0
- package/dist/chunk-O4RKZQYQ.js +2 -0
- package/dist/chunk-OJBL4CXK.cjs +2 -0
- package/dist/chunk-OPKZYQV7.js +3 -0
- package/dist/chunk-OXEJCIOA.cjs +1 -0
- package/dist/chunk-OXH6CANN.js +2 -0
- package/dist/{chunk-EQN3HDES.cjs → chunk-PW6Y5MQL.cjs} +5 -5
- package/dist/chunk-RLW6AQF2.js +2 -0
- package/dist/chunk-SBFVITY2.js +7 -0
- package/dist/chunk-SEJ7LMYY.js +4 -0
- package/dist/chunk-SZY25KAE.js +21 -0
- package/dist/chunk-TG5YQ4PB.cjs +4 -0
- package/dist/chunk-TJ6N5ZPZ.js +133 -0
- package/dist/chunk-V2RMDMWN.js +2 -0
- package/dist/chunk-V4SR7DU5.js +3 -0
- package/dist/chunk-VLFM66BZ.js +4 -0
- package/dist/chunk-VPBGZW4P.cjs +1 -0
- package/dist/chunk-VQWOCGJ2.cjs +1 -0
- package/dist/chunk-VWXHW74B.js +3 -0
- package/dist/chunk-W5GDZG64.js +2 -0
- package/dist/chunk-WLSVS3NC.js +2 -0
- package/dist/chunk-YLP3EKTQ.js +2 -0
- package/dist/chunk-YNSKDTFG.js +2 -0
- package/dist/chunk-YOJOVQIH.cjs +1 -0
- package/dist/chunk-ZE2X3FBU.js +20 -0
- package/dist/chunk-ZMH35QYG.js +2 -0
- package/dist/cli/index.cjs +53 -182
- package/dist/cli/index.js +54 -183
- 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 +30 -30
- package/dist/index.js +31 -31
- package/dist/integration.cjs +1 -1
- package/dist/integration.js +1 -1
- package/dist/local-DKP43BWQ.cjs +1 -0
- package/dist/local-TF5ZMHWW.js +1 -0
- package/dist/media-M3EIZ4QS.cjs +1 -0
- package/dist/media-WYEILC6K.js +1 -0
- package/dist/mongo-auth-adapter-33M5ENM7.cjs +1 -0
- package/dist/mongo-auth-adapter-4ITULS2P.js +1 -0
- package/dist/mongodb/index.cjs +1 -1
- package/dist/mongodb/index.js +1 -1
- package/dist/nodemailer-transport-7F3VLLBW.js +1 -0
- package/dist/nodemailer-transport-WAPZD3SJ.cjs +1 -0
- package/dist/postgres-auth-adapter-7BCPXNBO.js +1 -0
- package/dist/postgres-auth-adapter-HMXFUM5W.cjs +1 -0
- package/dist/redis-adapter-2E5AWMMA.cjs +1 -0
- package/dist/redis-adapter-GFH74CF4.js +1 -0
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.js +1 -1
- package/dist/schema-FNIDQKIJ.cjs +1 -0
- package/dist/schema-KD736QFN.js +1 -0
- package/dist/sqlite-adapter-HL53RLSN.cjs +1 -0
- package/dist/sqlite-adapter-TT6ZASDG.js +1 -0
- 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 +2 -10
- package/dist/WebhookService-CGxHtw7E.d.cts +0 -143
- package/dist/WebhookService-CNC1lYz7.d.ts +0 -143
- package/dist/auth-session-DHVGXHOH.cjs +0 -1
- package/dist/auth-session-O7IIH7EP.js +0 -1
- package/dist/base-A9AJPCG5.d.ts +0 -219
- package/dist/base-C6wyX2nC.d.cts +0 -219
- package/dist/bcryptjs-WIQSWJGK.cjs +0 -1
- package/dist/bcryptjs-ZEEHSMAG.js +0 -2
- package/dist/better-sqlite3-5IISPX34.cjs +0 -1
- package/dist/better-sqlite3-B34RIU4C.js +0 -2
- package/dist/bootstrap-PG2LGDLB.js +0 -1
- package/dist/bootstrap-YD3GLTWX.cjs +0 -1
- package/dist/bowser-SB3ZUPO4.js +0 -11
- package/dist/bowser-VX6B6ZSE.cjs +0 -10
- package/dist/chokidar-5RVQZVHP.cjs +0 -5
- package/dist/chokidar-BOYGRT4Q.js +0 -6
- package/dist/chunk-262YP5XA.cjs +0 -1
- package/dist/chunk-2HA6EKXX.js +0 -24
- package/dist/chunk-2SPWRQ5O.js +0 -122
- package/dist/chunk-2TYITUOC.js +0 -122
- package/dist/chunk-35PGCW3S.cjs +0 -1
- package/dist/chunk-3CIMGC2F.cjs +0 -56
- package/dist/chunk-3KZXF4US.js +0 -2
- package/dist/chunk-3NSZZCOJ.js +0 -2
- package/dist/chunk-3TAUNYEM.js +0 -8
- package/dist/chunk-3VXEK5ZW.cjs +0 -1
- package/dist/chunk-47CXBWMA.js +0 -2
- package/dist/chunk-4BMWWGJN.js +0 -384
- package/dist/chunk-4NTIK6DF.cjs +0 -2
- package/dist/chunk-6E44MQQ5.js +0 -115
- package/dist/chunk-6LWF5MPL.js +0 -20
- package/dist/chunk-6NBZDW53.js +0 -133
- package/dist/chunk-6TPICJ2L.js +0 -7
- package/dist/chunk-6YS6XLOD.cjs +0 -121
- package/dist/chunk-73D2PNHD.cjs +0 -7
- package/dist/chunk-7ACHOBWY.cjs +0 -13
- package/dist/chunk-7GGZA5YU.cjs +0 -2
- package/dist/chunk-7JWQ2PZP.cjs +0 -1
- package/dist/chunk-7KLEANTO.cjs +0 -1
- package/dist/chunk-7MNDQU6K.js +0 -8
- package/dist/chunk-7NH7H3WA.js +0 -10
- package/dist/chunk-7WMMKGEO.cjs +0 -1
- package/dist/chunk-ALTU3FDG.js +0 -2
- package/dist/chunk-BAVN7VDR.cjs +0 -1
- package/dist/chunk-BCEE4NBZ.cjs +0 -2
- package/dist/chunk-BUNLC3II.cjs +0 -1
- package/dist/chunk-C7QCZX7X.js +0 -2
- package/dist/chunk-D6SDGHY6.js +0 -2
- package/dist/chunk-DVWYO3KK.cjs +0 -1
- package/dist/chunk-EHWUALGH.cjs +0 -1
- package/dist/chunk-EML5FDUU.js +0 -2
- package/dist/chunk-EN65ZEK2.cjs +0 -2
- package/dist/chunk-EW424IBO.cjs +0 -1
- package/dist/chunk-EZIDQBXI.cjs +0 -1
- package/dist/chunk-F2O4QO5N.cjs +0 -383
- package/dist/chunk-F4ITQ6XQ.cjs +0 -3
- package/dist/chunk-FK2BG4HU.js +0 -3
- package/dist/chunk-FLMUMPDE.js +0 -2
- package/dist/chunk-GIS6X43A.cjs +0 -3
- package/dist/chunk-GNEVCEJU.cjs +0 -3
- package/dist/chunk-GNOSG3PK.cjs +0 -1
- package/dist/chunk-GQGFNTDZ.js +0 -2
- package/dist/chunk-GTR7JAKP.cjs +0 -3
- package/dist/chunk-HPIJI7TM.js +0 -3
- package/dist/chunk-HPYH7GTS.cjs +0 -1
- package/dist/chunk-HRAY65XH.js +0 -3
- package/dist/chunk-HTYVI2HK.cjs +0 -9
- package/dist/chunk-IKGVPXMK.js +0 -3
- package/dist/chunk-J6V573PE.cjs +0 -1
- package/dist/chunk-JA44K75G.js +0 -2
- package/dist/chunk-JRUQ5ABB.js +0 -4
- package/dist/chunk-JV4HJBXW.js +0 -14
- package/dist/chunk-KEITOXIP.js +0 -2
- package/dist/chunk-KMFLHGD5.cjs +0 -1
- package/dist/chunk-KZHXYXSH.cjs +0 -10
- package/dist/chunk-L3Q64RUX.js +0 -3
- package/dist/chunk-LEBM6ZSZ.cjs +0 -10
- package/dist/chunk-LKRI5X2V.cjs +0 -1
- package/dist/chunk-LQ3YZTPU.cjs +0 -15
- package/dist/chunk-LVBHOZZF.js +0 -4
- package/dist/chunk-LWM4WABU.js +0 -3
- package/dist/chunk-LY7N3UHH.cjs +0 -23
- package/dist/chunk-MCIZG4A3.cjs +0 -1
- package/dist/chunk-MDLJTZLV.cjs +0 -1
- package/dist/chunk-N4FXLQE3.cjs +0 -132
- package/dist/chunk-N5POANYV.js +0 -2
- package/dist/chunk-NGNJSUGL.cjs +0 -1
- package/dist/chunk-NRE6VKL6.cjs +0 -121
- package/dist/chunk-O4YE57OS.cjs +0 -6
- package/dist/chunk-OBYAIJVU.js +0 -11
- package/dist/chunk-OLRCZ6E3.js +0 -2
- package/dist/chunk-OOVNTOZC.cjs +0 -56
- package/dist/chunk-P6JITOFF.js +0 -4
- package/dist/chunk-PITMDQYN.cjs +0 -18
- package/dist/chunk-PYUWSKKP.js +0 -57
- package/dist/chunk-Q5TFO66G.cjs +0 -1
- package/dist/chunk-QO5ZWQA3.cjs +0 -74
- package/dist/chunk-QYN6C3FZ.cjs +0 -114
- package/dist/chunk-REQ622YC.js +0 -3
- package/dist/chunk-RPRGGGIW.js +0 -11
- package/dist/chunk-RVBSJ4UQ.cjs +0 -7
- package/dist/chunk-RYHOWZLK.js +0 -2
- package/dist/chunk-RYXLEFS5.js +0 -2
- package/dist/chunk-SBNMXQNO.cjs +0 -2
- package/dist/chunk-SLMIYECU.js +0 -2
- package/dist/chunk-SRIXRJHL.js +0 -4
- package/dist/chunk-TBHNE4VV.js +0 -2
- package/dist/chunk-TCFL3UWT.cjs +0 -2
- package/dist/chunk-TYQYKKWJ.js +0 -16
- package/dist/chunk-U6KFONKM.js +0 -2
- package/dist/chunk-UNYXWPLZ.cjs +0 -2
- package/dist/chunk-UWHWSWDE.js +0 -2
- package/dist/chunk-V4FAL7AG.js +0 -2
- package/dist/chunk-VQ53TFYA.cjs +0 -1
- package/dist/chunk-VRZC4TTF.cjs +0 -1
- package/dist/chunk-W45TLOOT.js +0 -2
- package/dist/chunk-WAVGRSE6.js +0 -2
- package/dist/chunk-WPM6LFCY.js +0 -2
- package/dist/chunk-WXT2XW7T.js +0 -13
- package/dist/chunk-X473JI7Z.js +0 -75
- package/dist/chunk-X6HUA6EF.cjs +0 -20
- package/dist/chunk-XDPLVJRO.js +0 -21
- package/dist/chunk-XDQVYCIR.cjs +0 -1
- package/dist/chunk-XFYSADHV.cjs +0 -2
- package/dist/chunk-XOR64WUQ.cjs +0 -19
- package/dist/chunk-Y2YAKDEQ.js +0 -2
- package/dist/chunk-YENNL5HG.js +0 -2
- package/dist/chunk-YGI5W4RS.js +0 -2
- package/dist/chunk-YIFKTA5N.js +0 -57
- package/dist/chunk-YUUXFD73.js +0 -19
- package/dist/chunk-ZAKYTBEN.js +0 -3
- package/dist/chunk-ZHA446FA.cjs +0 -1
- package/dist/chunk-ZTLGK6R4.cjs +0 -12
- package/dist/chunk-ZUBJ6RLQ.cjs +0 -1
- package/dist/client.d.cts +0 -1291
- package/dist/client.d.ts +0 -1291
- package/dist/d1-5ZQJOFDX.cjs +0 -1
- package/dist/d1-HPB6B253.js +0 -2
- package/dist/dist-es-3SSNUZST.cjs +0 -1
- package/dist/dist-es-64F22JL2.js +0 -2
- package/dist/dist-es-A5OF2STN.cjs +0 -2
- package/dist/dist-es-BOW5V247.cjs +0 -6
- package/dist/dist-es-CRIMATLL.cjs +0 -2
- package/dist/dist-es-DL3VLVP6.cjs +0 -1
- package/dist/dist-es-F2ZR55UK.js +0 -4
- package/dist/dist-es-IPSSZNFP.js +0 -1
- package/dist/dist-es-M2F7M27Y.js +0 -2
- package/dist/dist-es-M66JKZF5.js +0 -7
- package/dist/dist-es-OKLLRYI3.js +0 -2
- package/dist/dist-es-P25IKLBI.cjs +0 -1
- package/dist/dist-es-SRPWSAF4.cjs +0 -1
- package/dist/dist-es-SVHZDVUF.js +0 -3
- package/dist/dist-es-T2H2W5BX.cjs +0 -3
- package/dist/dist-es-WFI55HKT.js +0 -3
- package/dist/drizzle-orm-47ELDEM6.cjs +0 -1
- package/dist/drizzle-orm-XRTSOQJS.js +0 -1
- package/dist/event-streams-7NAWZW2I.js +0 -1
- package/dist/event-streams-JBMWCI2O.cjs +0 -1
- package/dist/fs-KWBRQ6T6.js +0 -1
- package/dist/fs-ZQYOJOIO.cjs +0 -1
- package/dist/index-NGnJpSgf.d.ts +0 -105
- package/dist/index-Zrg3sZ6R.d.cts +0 -105
- package/dist/jsonwebtoken-DFB6ZBZA.cjs +0 -8
- package/dist/jsonwebtoken-OD67R5JS.js +0 -9
- package/dist/lib-A2D63VXD.cjs +0 -1
- package/dist/lib-JQD2JAOO.js +0 -2
- package/dist/loadSso-JY4WDQPS.cjs +0 -2
- package/dist/loadSso-UQR6545M.js +0 -3
- package/dist/local-6UUGBZ4M.js +0 -1
- package/dist/local-ZYHV3J2K.cjs +0 -1
- package/dist/media-3Z6YW5J4.cjs +0 -1
- package/dist/media-E762GEHL.js +0 -1
- package/dist/mongo-auth-adapter-2H2AXDRH.cjs +0 -1
- package/dist/mongo-auth-adapter-YWMEOC42.js +0 -1
- package/dist/nodemailer-IDML4L6W.cjs +0 -53
- package/dist/nodemailer-NITB45SS.js +0 -54
- package/dist/nodemailer-transport-3VWVUBM5.cjs +0 -1
- package/dist/nodemailer-transport-7RHATUKL.js +0 -1
- package/dist/postgres-auth-adapter-QKBNXVPT.js +0 -1
- package/dist/postgres-auth-adapter-WMLM4UUC.cjs +0 -1
- package/dist/postgres-js-7YBZKGXG.cjs +0 -1
- package/dist/postgres-js-JLFIWOBH.js +0 -1
- package/dist/redis-adapter-EVK2SMKH.cjs +0 -1
- package/dist/redis-adapter-LY2NBSAG.js +0 -1
- package/dist/schema-RT6WSUYC.cjs +0 -1
- package/dist/schema-YFMSJK2P.js +0 -2
- package/dist/signin-N3T2KF5Q.js +0 -3
- package/dist/signin-VFBLX7EL.cjs +0 -2
- package/dist/sqlite-adapter-KPSISY6E.cjs +0 -1
- package/dist/sqlite-adapter-PI6SIY7O.js +0 -1
- package/dist/src-6LAUXXDM.cjs +0 -1
- package/dist/src-QBADSZV4.js +0 -1
- package/dist/sso-oidc-54BIRYR6.cjs +0 -2
- package/dist/sso-oidc-UB7G4END.js +0 -3
- package/dist/sts-WAA6I22C.js +0 -3
- package/dist/sts-YLXXIB3X.cjs +0 -2
- package/dist/types-BCOhfwHC.d.ts +0 -839
- package/dist/types-DxaK39ix.d.cts +0 -330
- package/dist/types-DxaK39ix.d.ts +0 -330
- package/dist/types-QglJ7PwT.d.cts +0 -839
package/dist/chunk-X473JI7Z.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import {e,h}from'./chunk-GQGFNTDZ.js';import {a}from'./chunk-TBHNE4VV.js';import {g}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
|
-
g();g();g();g();var ji=Object.freeze({major:16,minor:14,patch:2,preReleaseTag:null});g();function F(e,t){throw new Error(t)}g();g();g();g();function ae(e){return typeof e=="object"&&e!==null}g();g();function W(e,t){throw new Error(t??"Unexpected invariant triggered.")}var Mi=/\r\n|[\n\r]/g;function Xe(e,t){let n=0,r=1;for(let i of e.body.matchAll(Mi)){if(typeof i.index=="number"||W(),i.index>=t)break;n=i.index+i[0].length,r+=1;}return {line:r,column:t+1-n}}g();function kn(e){return Yt(e.source,Xe(e.source,e.start))}function Yt(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,u=t.column+a,c=`${e.name}:${o}:${u}
|
|
3
|
-
`,f=r.split(/\r\n|[\n\r]/g),d=f[i];if(d.length>120){let h=Math.floor(u/80),v=u%80,g=[];for(let D=0;D<d.length;D+=80)g.push(d.slice(D,D+80));return c+Jr([[`${o} |`,g[0]],...g.slice(1,h+1).map(D=>["|",D]),["|","^".padStart(v)],["|",g[h+1]]])}return c+Jr([[`${o-1} |`,f[i-1]],[`${o} |`,d],["|","^".padStart(u)],[`${o+1} |`,f[i+1]]])}function Jr(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(`
|
|
4
|
-
`)}function Gi(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 m=class e extends Error{constructor(t,...n){var r,i,s;let{nodes:o,source:a,positions:u,path:c,originalError:f,extensions:d}=Gi(n);super(t),this.name="GraphQLError",this.path=c??void 0,this.originalError=f??void 0,this.nodes=Xr(Array.isArray(o)?o:o?[o]:void 0);let h=Xr((r=this.nodes)===null||r===void 0?void 0:r.map(g=>g.loc).filter(g=>g!=null));this.source=a??(h==null||(i=h[0])===null||i===void 0?void 0:i.source),this.positions=u??h?.map(g=>g.start),this.locations=u&&a?u.map(g=>Xe(a,g)):h?.map(g=>Xe(g.source,g.start));let v=ae(f?.extensions)?f?.extensions:void 0;this.extensions=(s=d??v)!==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}}),f!=null&&f.stack?Object.defineProperty(this,"stack",{value:f.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+=`
|
|
5
|
-
|
|
6
|
-
`+kn(n.loc));else if(this.source&&this.locations)for(let n of this.locations)t+=`
|
|
7
|
-
|
|
8
|
-
`+Yt(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 Xr(e){return e===void 0||e.length===0?void 0:e}function J(e,t,n){return new m(`Syntax Error: ${n}`,{source:e,positions:[t]})}g();var ht=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}}},ze=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}}},yt={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"]},Pi=new Set(Object.keys(yt));function Tt(e){let t=e?.kind;return typeof t=="string"&&Pi.has(t)}var Z;(function(e){e.QUERY="query",e.MUTATION="mutation",e.SUBSCRIPTION="subscription";})(Z||(Z={}));g();var _;(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";})(_||(_={}));g();var p;(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";})(p||(p={}));g();g();g();function Kt(e){return e===9||e===32}function We(e){return e>=48&&e<=57}function zr(e){return e>=97&&e<=122||e>=65&&e<=90}function Et(e){return zr(e)||e===95}function Jt(e){return zr(e)||We(e)||e===95}function Wr(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],u=Qi(a);u!==a.length&&(r=(s=r)!==null&&s!==void 0?s:o,i=o,o!==0&&u<n&&(n=u));}return e.map((o,a)=>a===0?o:o.slice(n)).slice((t=r)!==null&&t!==void 0?t:0,i+1)}function Qi(e){let t=0;for(;t<e.length&&Kt(e.charCodeAt(t));)++t;return t}function Hr(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 Zr(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(v=>v.length===0||Kt(v.charCodeAt(0))),o=n.endsWith('\\"""'),a=e.endsWith('"')&&!o,u=e.endsWith("\\"),c=a||u,f=(!i||e.length>70||c||s||o),d="",h=i&&Kt(e.charCodeAt(0));return (f&&!h||s)&&(d+=`
|
|
9
|
-
`),d+=n,(f||c)&&(d+=`
|
|
10
|
-
`),'"""'+d+'"""'}g();var y;(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";})(y||(y={}));var gt=class{constructor(t){let n=new ze(y.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!==y.EOF)do if(t.next)t=t.next;else {let n=Bi(this,t.end);t.next=n,n.prev=t,t=n;}while(t.kind===y.COMMENT);return t}};function ti(e){return e===y.BANG||e===y.DOLLAR||e===y.AMP||e===y.PAREN_L||e===y.PAREN_R||e===y.DOT||e===y.SPREAD||e===y.COLON||e===y.EQUALS||e===y.AT||e===y.BRACKET_L||e===y.BRACKET_R||e===y.BRACE_L||e===y.PIPE||e===y.BRACE_R}function He(e){return e>=0&&e<=55295||e>=57344&&e<=1114111}function Xt(e,t){return ni(e.charCodeAt(t))&&ri(e.charCodeAt(t+1))}function ni(e){return e>=55296&&e<=56319}function ri(e){return e>=56320&&e<=57343}function je(e,t){let n=e.source.body.codePointAt(t);if(n===void 0)return y.EOF;if(n>=32&&n<=126){let r=String.fromCodePoint(n);return r==='"'?`'"'`:`"${r}"`}return "U+"+n.toString(16).toUpperCase().padStart(4,"0")}function ee(e,t,n,r,i){let s=e.line,o=1+n-e.lineStart;return new ze(t,n,r,s,o,i)}function Bi(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 qi(e,i);case 33:return ee(e,y.BANG,i,i+1);case 36:return ee(e,y.DOLLAR,i,i+1);case 38:return ee(e,y.AMP,i,i+1);case 40:return ee(e,y.PAREN_L,i,i+1);case 41:return ee(e,y.PAREN_R,i,i+1);case 46:if(n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)===46)return ee(e,y.SPREAD,i,i+3);break;case 58:return ee(e,y.COLON,i,i+1);case 61:return ee(e,y.EQUALS,i,i+1);case 64:return ee(e,y.AT,i,i+1);case 91:return ee(e,y.BRACKET_L,i,i+1);case 93:return ee(e,y.BRACKET_R,i,i+1);case 123:return ee(e,y.BRACE_L,i,i+1);case 124:return ee(e,y.PIPE,i,i+1);case 125:return ee(e,y.BRACE_R,i,i+1);case 34:return n.charCodeAt(i+1)===34&&n.charCodeAt(i+2)===34?Wi(e,i):Ki(e,i)}if(We(s)||s===45)return Yi(e,i,s);if(Et(s))return Hi(e,i);throw J(e.source,i,s===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:He(s)||Xt(n,i)?`Unexpected character: ${je(e,i)}.`:`Invalid character: ${je(e,i)}.`)}return ee(e,y.EOF,r,r)}function qi(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(He(s))++i;else if(Xt(n,i))i+=2;else break}return ee(e,y.COMMENT,t,i,n.slice(t+1,i))}function Yi(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),We(s))throw J(e.source,i,`Invalid number, unexpected digit after 0: ${je(e,i)}.`)}else i=Fn(e,i,s),s=r.charCodeAt(i);if(s===46&&(o=true,s=r.charCodeAt(++i),i=Fn(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=Fn(e,i,s),s=r.charCodeAt(i)),s===46||Et(s))throw J(e.source,i,`Invalid number, expected digit but got: ${je(e,i)}.`);return ee(e,o?y.FLOAT:y.INT,t,i,r.slice(t,i))}function Fn(e,t,n){if(!We(n))throw J(e.source,t,`Invalid number, expected digit but got: ${je(e,t)}.`);let r=e.source.body,i=t+1;for(;We(r.charCodeAt(i));)++i;return i}function Ki(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),ee(e,y.STRING,t,i+1,o);if(a===92){o+=n.slice(s,i);let u=n.charCodeAt(i+1)===117?n.charCodeAt(i+2)===123?Ji(e,i):Xi(e,i):zi(e,i);o+=u.value,i+=u.size,s=i;continue}if(a===10||a===13)break;if(He(a))++i;else if(Xt(n,i))i+=2;else throw J(e.source,i,`Invalid character within String: ${je(e,i)}.`)}throw J(e.source,i,"Unterminated string.")}function Ji(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||!He(r))break;return {value:String.fromCodePoint(r),size:i}}if(r=r<<4|Nt(s),r<0)break}throw J(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+i)}".`)}function Xi(e,t){let n=e.source.body,r=ei(n,t+2);if(He(r))return {value:String.fromCodePoint(r),size:6};if(ni(r)&&n.charCodeAt(t+6)===92&&n.charCodeAt(t+7)===117){let i=ei(n,t+8);if(ri(i))return {value:String.fromCodePoint(r,i),size:12}}throw J(e.source,t,`Invalid Unicode escape sequence: "${n.slice(t,t+6)}".`)}function ei(e,t){return Nt(e.charCodeAt(t))<<12|Nt(e.charCodeAt(t+1))<<8|Nt(e.charCodeAt(t+2))<<4|Nt(e.charCodeAt(t+3))}function Nt(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function zi(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:`
|
|
11
|
-
`,size:2};case 114:return {value:"\r",size:2};case 116:return {value:" ",size:2}}throw J(e.source,t,`Invalid character escape sequence: "${n.slice(t,t+2)}".`)}function Wi(e,t){let n=e.source.body,r=n.length,i=e.lineStart,s=t+3,o=s,a="",u=[];for(;s<r;){let c=n.charCodeAt(s);if(c===34&&n.charCodeAt(s+1)===34&&n.charCodeAt(s+2)===34){a+=n.slice(o,s),u.push(a);let f=ee(e,y.BLOCK_STRING,t,s+3,Wr(u).join(`
|
|
12
|
-
`));return e.line+=u.length-1,e.lineStart=i,f}if(c===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(c===10||c===13){a+=n.slice(o,s),u.push(a),c===13&&n.charCodeAt(s+1)===10?s+=2:++s,a="",o=s,i=s;continue}if(He(c))++s;else if(Xt(n,s))s+=2;else throw J(e.source,s,`Invalid character within String: ${je(e,s)}.`)}throw J(e.source,s,"Unterminated string.")}function Hi(e,t){let n=e.source.body,r=n.length,i=t+1;for(;i<r;){let s=n.charCodeAt(i);if(Jt(s))++i;else break}return ee(e,y.NAME,t,i,n.slice(t,i))}g();g();function N(e){return zt(e,[])}function zt(e,t){switch(typeof e){case "string":return JSON.stringify(e);case "function":return e.name?`[function ${e.name}]`:"[function]";case "object":return Zi(e,t);default:return String(e)}}function Zi(e,t){if(e===null)return "null";if(t.includes(e))return "[Circular]";let n=[...t,e];if(es(e)){let r=e.toJSON();if(r!==e)return typeof r=="string"?r:zt(r,n)}else if(Array.isArray(e))return ns(e,n);return ts(e,n)}function es(e){return typeof e.toJSON=="function"}function ts(e,t){let n=Object.entries(e);return n.length===0?"{}":t.length>2?"["+rs(e)+"]":"{ "+n.map(([i,s])=>i+": "+zt(s,t)).join(", ")+" }"}function ns(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(zt(e[s],t));return r===1?i.push("... 1 more item"):r>1&&i.push(`... ${r} more items`),"["+i.join(", ")+"]"}function rs(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}g();var is=globalThis.process&&process.env.NODE_ENV==="production",ue=is?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=N(t);throw new Error(`Cannot use ${i} "${o}" from another module or realm.
|
|
13
|
-
|
|
14
|
-
Ensure that there is only one instance of "graphql" in the node_modules
|
|
15
|
-
directory. If different versions of "graphql" are the dependencies of other
|
|
16
|
-
relied on modules, use "resolutions" to ensure only one version is installed.
|
|
17
|
-
|
|
18
|
-
https://yarnpkg.com/en/docs/selective-version-resolutions
|
|
19
|
-
|
|
20
|
-
Duplicate "graphql" modules cannot be used at the same time since different
|
|
21
|
-
versions may have different capabilities and behavior. The data from one
|
|
22
|
-
version used in the function from another could produce confusing and
|
|
23
|
-
spurious results.`)}}return false};var Ze=class{constructor(t,n="GraphQL request",r={line:1,column:1}){typeof t=="string"||F(false,`Body must be a string. Received: ${N(t)}.`),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||F(false,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||F(false,"column in locationOffset is 1-indexed and must be positive.");}get[Symbol.toStringTag](){return "Source"}};function ii(e){return ue(e,Ze)}function si(e,t){let n=new Cn(e,t),r=n.parseDocument();return Object.defineProperty(r,"tokenCount",{enumerable:false,value:n.tokenCount}),r}var Cn=class{constructor(t,n={}){let{lexer:r,...i}=n;if(r)this._lexer=r;else {let s=ii(t)?t:new Ze(t);this._lexer=new gt(s);}this._options=i,this._tokenCounter=0;}get tokenCount(){return this._tokenCounter}parseName(){let t=this.expectToken(y.NAME);return this.node(t,{kind:p.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:p.DOCUMENT,definitions:this.many(y.SOF,this.parseDefinition,y.EOF)})}parseDefinition(){if(this.peek(y.BRACE_L))return this.parseOperationDefinition();let t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(t&&n.kind===y.BRACE_L)throw J(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are not supported on shorthand queries.");if(n.kind===y.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 J(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(y.BRACE_L))return this.node(t,{kind:p.OPERATION_DEFINITION,operation:Z.QUERY,description:void 0,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});let n=this.parseDescription(),r=this.parseOperationType(),i;return this.peek(y.NAME)&&(i=this.parseName()),this.node(t,{kind:p.OPERATION_DEFINITION,operation:r,description:n,name:i,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(false),selectionSet:this.parseSelectionSet()})}parseOperationType(){let t=this.expectToken(y.NAME);switch(t.value){case "query":return Z.QUERY;case "mutation":return Z.MUTATION;case "subscription":return Z.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(y.PAREN_L,this.parseVariableDefinition,y.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:p.VARIABLE_DEFINITION,description:this.parseDescription(),variable:this.parseVariable(),type:(this.expectToken(y.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(y.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){let t=this._lexer.token;return this.expectToken(y.DOLLAR),this.node(t,{kind:p.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:p.SELECTION_SET,selections:this.many(y.BRACE_L,this.parseSelection,y.BRACE_R)})}parseSelection(){return this.peek(y.SPREAD)?this.parseFragment():this.parseField()}parseField(){let t=this._lexer.token,n=this.parseName(),r,i;return this.expectOptionalToken(y.COLON)?(r=n,i=this.parseName()):i=n,this.node(t,{kind:p.FIELD,alias:r,name:i,arguments:this.parseArguments(false),directives:this.parseDirectives(false),selectionSet:this.peek(y.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){let n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(y.PAREN_L,n,y.PAREN_R)}parseArgument(t=false){let n=this._lexer.token,r=this.parseName();return this.expectToken(y.COLON),this.node(n,{kind:p.ARGUMENT,name:r,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(true)}parseFragment(){let t=this._lexer.token;this.expectToken(y.SPREAD);let n=this.expectOptionalKeyword("on");return !n&&this.peek(y.NAME)?this.node(t,{kind:p.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(false)}):this.node(t,{kind:p.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:p.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:p.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 y.BRACKET_L:return this.parseList(t);case y.BRACE_L:return this.parseObject(t);case y.INT:return this.advanceLexer(),this.node(n,{kind:p.INT,value:n.value});case y.FLOAT:return this.advanceLexer(),this.node(n,{kind:p.FLOAT,value:n.value});case y.STRING:case y.BLOCK_STRING:return this.parseStringLiteral();case y.NAME:switch(this.advanceLexer(),n.value){case "true":return this.node(n,{kind:p.BOOLEAN,value:true});case "false":return this.node(n,{kind:p.BOOLEAN,value:false});case "null":return this.node(n,{kind:p.NULL});default:return this.node(n,{kind:p.ENUM,value:n.value})}case y.DOLLAR:if(t)if(this.expectToken(y.DOLLAR),this._lexer.token.kind===y.NAME){let r=this._lexer.token.value;throw J(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:p.STRING,value:t.value,block:t.kind===y.BLOCK_STRING})}parseList(t){let n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:p.LIST,values:this.any(y.BRACKET_L,n,y.BRACKET_R)})}parseObject(t){let n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:p.OBJECT,fields:this.any(y.BRACE_L,n,y.BRACE_R)})}parseObjectField(t){let n=this._lexer.token,r=this.parseName();return this.expectToken(y.COLON),this.node(n,{kind:p.OBJECT_FIELD,name:r,value:this.parseValueLiteral(t)})}parseDirectives(t){let n=[];for(;this.peek(y.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(true)}parseDirective(t){let n=this._lexer.token;return this.expectToken(y.AT),this.node(n,{kind:p.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){let t=this._lexer.token,n;if(this.expectOptionalToken(y.BRACKET_L)){let r=this.parseTypeReference();this.expectToken(y.BRACKET_R),n=this.node(t,{kind:p.LIST_TYPE,type:r});}else n=this.parseNamedType();return this.expectOptionalToken(y.BANG)?this.node(t,{kind:p.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:p.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(y.STRING)||this.peek(y.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(y.BRACE_L,this.parseOperationTypeDefinition,y.BRACE_R);return this.node(t,{kind:p.SCHEMA_DEFINITION,description:n,directives:r,operationTypes:i})}parseOperationTypeDefinition(){let t=this._lexer.token,n=this.parseOperationType();this.expectToken(y.COLON);let r=this.parseNamedType();return this.node(t,{kind:p.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:p.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:p.OBJECT_TYPE_DEFINITION,description:n,name:r,interfaces:i,directives:s,fields:o})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(y.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(y.BRACE_L,this.parseFieldDefinition,y.BRACE_R)}parseFieldDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName(),i=this.parseArgumentDefs();this.expectToken(y.COLON);let s=this.parseTypeReference(),o=this.parseConstDirectives();return this.node(t,{kind:p.FIELD_DEFINITION,description:n,name:r,arguments:i,type:s,directives:o})}parseArgumentDefs(){return this.optionalMany(y.PAREN_L,this.parseInputValueDef,y.PAREN_R)}parseInputValueDef(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseName();this.expectToken(y.COLON);let i=this.parseTypeReference(),s;this.expectOptionalToken(y.EQUALS)&&(s=this.parseConstValueLiteral());let o=this.parseConstDirectives();return this.node(t,{kind:p.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:p.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:p.UNION_TYPE_DEFINITION,description:n,name:r,directives:i,types:s})}parseUnionMemberTypes(){return this.expectOptionalToken(y.EQUALS)?this.delimitedMany(y.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:p.ENUM_TYPE_DEFINITION,description:n,name:r,directives:i,values:s})}parseEnumValuesDefinition(){return this.optionalMany(y.BRACE_L,this.parseEnumValueDefinition,y.BRACE_R)}parseEnumValueDefinition(){let t=this._lexer.token,n=this.parseDescription(),r=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:p.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 J(this._lexer.source,this._lexer.token.start,`${Wt(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:p.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:r,directives:i,fields:s})}parseInputFieldsDefinition(){return this.optionalMany(y.BRACE_L,this.parseInputValueDef,y.BRACE_R)}parseTypeSystemExtension(){let t=this._lexer.lookahead();if(t.kind===y.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(y.BRACE_L,this.parseOperationTypeDefinition,y.BRACE_R);if(n.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:p.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:p.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:p.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:p.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:p.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:p.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:p.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:r,fields:i})}parseDirectiveDefinitionExtension(){let t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("directive"),this.expectToken(y.AT);let n=this.parseName(),r=this.parseConstDirectives();if(r.length===0)throw this.unexpected();return this.node(t,{kind:p.DIRECTIVE_EXTENSION,name:n,directives:r})}parseDirectiveDefinition(){let t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(y.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:p.DIRECTIVE_DEFINITION,description:n,name:r,arguments:i,directives:s,repeatable:o,locations:a})}parseDirectiveLocations(){return this.delimitedMany(y.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){let t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(_,n.value))return n;throw this.unexpected(t)}parseSchemaCoordinate(){let t=this._lexer.token,n=this.expectOptionalToken(y.AT),r=this.parseName(),i;!n&&this.expectOptionalToken(y.DOT)&&(i=this.parseName());let s;return (n||i)&&this.expectOptionalToken(y.PAREN_L)&&(s=this.parseName(),this.expectToken(y.COLON),this.expectToken(y.PAREN_R)),n?s?this.node(t,{kind:p.DIRECTIVE_ARGUMENT_COORDINATE,name:r,argumentName:s}):this.node(t,{kind:p.DIRECTIVE_COORDINATE,name:r}):i?s?this.node(t,{kind:p.ARGUMENT_COORDINATE,name:r,fieldName:i,argumentName:s}):this.node(t,{kind:p.MEMBER_COORDINATE,name:r,memberName:i}):this.node(t,{kind:p.TYPE_COORDINATE,name:r})}node(t,n){return this._options.noLocation!==true&&(n.loc=new ht(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 J(this._lexer.source,n.start,`Expected ${oi(t)}, found ${Wt(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),true):false}expectKeyword(t){let n=this._lexer.token;if(n.kind===y.NAME&&n.value===t)this.advanceLexer();else throw J(this._lexer.source,n.start,`Expected "${t}", found ${Wt(n)}.`)}expectOptionalKeyword(t){let n=this._lexer.token;return n.kind===y.NAME&&n.value===t?(this.advanceLexer(),true):false}unexpected(t){let n=t??this._lexer.token;return J(this._lexer.source,n.start,`Unexpected ${Wt(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!==y.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw J(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}};function Wt(e){let t=e.value;return oi(e.kind)+(t!=null?` "${t}"`:"")}function oi(e){return ti(e)?`"${e}"`:e}g();g();g();g();function se(e,t){let[n,r]=t?[e,t]:[void 0,e],i=" Did you mean ";n&&(i+=n+" ");let s=r.map(u=>`"${u}"`);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+"?"}g();function $n(e){return e}g();function Ie(e,t){let n=Object.create(null);for(let r of e)n[t(r)]=r;return n}g();function vt(e,t,n){let r=Object.create(null);for(let i of e)r[t(i)]=n(i);return r}g();function Me(e,t){let n=Object.create(null);for(let r of Object.keys(e))n[r]=t(e[r],r);return n}g();g();function et(e,t){let n=0,r=0;for(;n<e.length&&r<t.length;){let i=e.charCodeAt(n),s=t.charCodeAt(r);if(Ht(i)&&Ht(s)){let o=0;do++n,o=o*10+i-Un,i=e.charCodeAt(n);while(Ht(i)&&o>0);let a=0;do++r,a=a*10+s-Un,s=t.charCodeAt(r);while(Ht(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 Un=48,ss=57;function Ht(e){return !isNaN(e)&&Un<=e&&e<=ss}function pe(e,t){let n=Object.create(null),r=new Vn(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:et(s,o)})}var Vn=class{constructor(t){this._input=t,this._inputLowerCase=t.toLowerCase(),this._inputArray=ai(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=ai(r),s=this._inputArray;if(i.length<s.length){let f=i;i=s,s=f;}let o=i.length,a=s.length;if(o-a>n)return;let u=this._rows;for(let f=0;f<=a;f++)u[0][f]=f;for(let f=1;f<=o;f++){let d=u[(f-1)%3],h=u[f%3],v=h[0]=f;for(let g=1;g<=a;g++){let D=i[f-1]===s[g-1]?0:1,R=Math.min(d[g]+1,h[g-1]+1,d[g-1]+D);if(f>1&&g>1&&i[f-1]===s[g-2]&&i[f-2]===s[g-1]){let L=u[(f-2)%3][g-2];R=Math.min(R,L+1);}R<v&&(v=R),h[g]=R;}if(v>n)return}let c=u[o%3][a];return c<=n?c:void 0}};function ai(e){let t=e.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=e.charCodeAt(r);return n}g();function ce(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}g();g();function ui(e){return `"${e.replace(os,as)}"`}var os=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function as(e){return us[e.charCodeAt(0)]}var us=["\\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"];g();var tt=Object.freeze({});function Ge(e,t,n=yt){let r=new Map;for(let L of Object.values(p))r.set(L,nt(t,L));let i,s=Array.isArray(e),o=[e],a=-1,u=[],c=e,f,d,h=[],v=[];do{a++;let L=a===o.length,j=L&&u.length!==0;if(L){if(f=v.length===0?void 0:h[h.length-1],c=d,d=v.pop(),j)if(s){c=c.slice();let I=0;for(let[Q,z]of u){let B=Q-I;z===null?(c.splice(B,1),I++):c[B]=z;}}else {c={...c};for(let[I,Q]of u)c[I]=Q;}a=i.index,o=i.keys,u=i.edits,s=i.inArray,i=i.prev;}else if(d){if(f=s?a:o[a],c=d[f],c==null)continue;h.push(f);}let Y;if(!Array.isArray(c)){var g,D;Tt(c)||F(false,`Invalid AST Node: ${N(c)}.`);let I=L?(g=r.get(c.kind))===null||g===void 0?void 0:g.leave:(D=r.get(c.kind))===null||D===void 0?void 0:D.enter;if(Y=I?.call(t,c,f,d,h,v),Y===tt)break;if(Y===false){if(!L){h.pop();continue}}else if(Y!==void 0&&(u.push([f,Y]),!L))if(Tt(Y))c=Y;else {h.pop();continue}}if(Y===void 0&&j&&u.push([f,c]),L)h.pop();else {var R;i={inArray:s,index:a,keys:o,edits:u,prev:i},s=Array.isArray(c),o=s?c:(R=n[c.kind])!==null&&R!==void 0?R:[],a=-1,u=[],d&&v.push(d),d=c;}}while(i!==void 0);return u.length!==0?u[u.length-1][1]:e}function jn(e){let t=new Array(e.length).fill(null),n=Object.create(null);for(let r of Object.values(p)){let i=false,s=new Array(e.length).fill(void 0),o=new Array(e.length).fill(void 0);for(let u=0;u<e.length;++u){let{enter:c,leave:f}=nt(e[u],r);i||(i=c!=null||f!=null),s[u]=c,o[u]=f;}if(!i)continue;let a={enter(...u){let c=u[0];for(let d=0;d<e.length;d++)if(t[d]===null){var f;let h=(f=s[d])===null||f===void 0?void 0:f.apply(e[d],u);if(h===false)t[d]=c;else if(h===tt)t[d]=tt;else if(h!==void 0)return h}},leave(...u){let c=u[0];for(let d=0;d<e.length;d++)if(t[d]===null){var f;let h=(f=o[d])===null||f===void 0?void 0:f.apply(e[d],u);if(h===tt)t[d]=tt;else if(h!==void 0&&h!==false)return h}else t[d]===c&&(t[d]=null);}};n[r]=a;}return n}function nt(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 U(e){return Ge(e,cs)}var ps=80,cs={Name:{leave:e=>e.value},Variable:{leave:e=>"$"+e.name},Document:{leave:e=>O(e.definitions,`
|
|
24
|
-
|
|
25
|
-
`)},OperationDefinition:{leave(e){let t=Mn(e.variableDefinitions)?x(`(
|
|
26
|
-
`,O(e.variableDefinitions,`
|
|
27
|
-
`),`
|
|
28
|
-
)`):x("(",O(e.variableDefinitions,", "),")"),n=x("",e.description,`
|
|
29
|
-
`)+O([e.operation,O([e.name,t]),O(e.directives," ")]," ");return (n==="query"?"":n+" ")+e.selectionSet}},VariableDefinition:{leave:({variable:e,type:t,defaultValue:n,directives:r,description:i})=>x("",i,`
|
|
30
|
-
`)+e+": "+t+x(" = ",n)+x(" ",O(r," "))},SelectionSet:{leave:({selections:e})=>Oe(e)},Field:{leave({alias:e,name:t,arguments:n,directives:r,selectionSet:i}){let s=x("",e,": ")+t,o=s+x("(",O(n,", "),")");return o.length>ps&&(o=s+x(`(
|
|
31
|
-
`,Zt(O(n,`
|
|
32
|
-
`)),`
|
|
33
|
-
)`)),O([o,O(r," "),i]," ")}},Argument:{leave:({name:e,value:t})=>e+": "+t},FragmentSpread:{leave:({name:e,directives:t})=>"..."+e+x(" ",O(t," "))},InlineFragment:{leave:({typeCondition:e,directives:t,selectionSet:n})=>O(["...",x("on ",e),O(t," "),n]," ")},FragmentDefinition:{leave:({name:e,typeCondition:t,variableDefinitions:n,directives:r,selectionSet:i,description:s})=>x("",s,`
|
|
34
|
-
`)+`fragment ${e}${x("(",O(n,", "),")")} on ${t} ${x("",O(r," ")," ")}`+i},IntValue:{leave:({value:e})=>e},FloatValue:{leave:({value:e})=>e},StringValue:{leave:({value:e,block:t})=>t?Zr(e):ui(e)},BooleanValue:{leave:({value:e})=>e?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:e})=>e},ListValue:{leave:({values:e})=>"["+O(e,", ")+"]"},ObjectValue:{leave:({fields:e})=>"{"+O(e,", ")+"}"},ObjectField:{leave:({name:e,value:t})=>e+": "+t},Directive:{leave:({name:e,arguments:t})=>"@"+e+x("(",O(t,", "),")")},NamedType:{leave:({name:e})=>e},ListType:{leave:({type:e})=>"["+e+"]"},NonNullType:{leave:({type:e})=>e+"!"},SchemaDefinition:{leave:({description:e,directives:t,operationTypes:n})=>x("",e,`
|
|
35
|
-
`)+O(["schema",O(t," "),Oe(n)]," ")},OperationTypeDefinition:{leave:({operation:e,type:t})=>e+": "+t},ScalarTypeDefinition:{leave:({description:e,name:t,directives:n})=>x("",e,`
|
|
36
|
-
`)+O(["scalar",t,O(n," ")]," ")},ObjectTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>x("",e,`
|
|
37
|
-
`)+O(["type",t,x("implements ",O(n," & ")),O(r," "),Oe(i)]," ")},FieldDefinition:{leave:({description:e,name:t,arguments:n,type:r,directives:i})=>x("",e,`
|
|
38
|
-
`)+t+(Mn(n)?x(`(
|
|
39
|
-
`,Zt(O(n,`
|
|
40
|
-
`)),`
|
|
41
|
-
)`):x("(",O(n,", "),")"))+": "+r+x(" ",O(i," "))},InputValueDefinition:{leave:({description:e,name:t,type:n,defaultValue:r,directives:i})=>x("",e,`
|
|
42
|
-
`)+O([t+": "+n,x("= ",r),O(i," ")]," ")},InterfaceTypeDefinition:{leave:({description:e,name:t,interfaces:n,directives:r,fields:i})=>x("",e,`
|
|
43
|
-
`)+O(["interface",t,x("implements ",O(n," & ")),O(r," "),Oe(i)]," ")},UnionTypeDefinition:{leave:({description:e,name:t,directives:n,types:r})=>x("",e,`
|
|
44
|
-
`)+O(["union",t,O(n," "),x("= ",O(r," | "))]," ")},EnumTypeDefinition:{leave:({description:e,name:t,directives:n,values:r})=>x("",e,`
|
|
45
|
-
`)+O(["enum",t,O(n," "),Oe(r)]," ")},EnumValueDefinition:{leave:({description:e,name:t,directives:n})=>x("",e,`
|
|
46
|
-
`)+O([t,O(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:e,name:t,directives:n,fields:r})=>x("",e,`
|
|
47
|
-
`)+O(["input",t,O(n," "),Oe(r)]," ")},DirectiveDefinition:{leave:({description:e,name:t,arguments:n,directives:r,repeatable:i,locations:s})=>x("",e,`
|
|
48
|
-
`)+"directive @"+t+(Mn(n)?x(`(
|
|
49
|
-
`,Zt(O(n,`
|
|
50
|
-
`)),`
|
|
51
|
-
)`):x("(",O(n,", "),")"))+x(" ",O(r," "))+(i?" repeatable":"")+" on "+O(s," | ")},SchemaExtension:{leave:({directives:e,operationTypes:t})=>O(["extend schema",O(e," "),Oe(t)]," ")},ScalarTypeExtension:{leave:({name:e,directives:t})=>O(["extend scalar",e,O(t," ")]," ")},ObjectTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>O(["extend type",e,x("implements ",O(t," & ")),O(n," "),Oe(r)]," ")},InterfaceTypeExtension:{leave:({name:e,interfaces:t,directives:n,fields:r})=>O(["extend interface",e,x("implements ",O(t," & ")),O(n," "),Oe(r)]," ")},UnionTypeExtension:{leave:({name:e,directives:t,types:n})=>O(["extend union",e,O(t," "),x("= ",O(n," | "))]," ")},EnumTypeExtension:{leave:({name:e,directives:t,values:n})=>O(["extend enum",e,O(t," "),Oe(n)]," ")},InputObjectTypeExtension:{leave:({name:e,directives:t,fields:n})=>O(["extend input",e,O(t," "),Oe(n)]," ")},DirectiveExtension:{leave:({name:e,directives:t})=>O(["extend directive @"+e,O(t," ")]," ")},TypeCoordinate:{leave:({name:e})=>e},MemberCoordinate:{leave:({name:e,memberName:t})=>O([e,x(".",t)])},ArgumentCoordinate:{leave:({name:e,fieldName:t,argumentName:n})=>O([e,x(".",t),x("(",n,":)")])},DirectiveCoordinate:{leave:({name:e})=>O(["@",e])},DirectiveArgumentCoordinate:{leave:({name:e,argumentName:t})=>O(["@",e,x("(",t,":)")])}};function O(e,t=""){var n;return (n=e?.filter(r=>r).join(t))!==null&&n!==void 0?n:""}function Oe(e){return x(`{
|
|
52
|
-
`,Zt(O(e,`
|
|
53
|
-
`)),`
|
|
54
|
-
}`)}function x(e,t,n=""){return t!=null&&t!==""?e+t+n:""}function Zt(e){return x(" ",e.replace(/\n/g,`
|
|
55
|
-
`))}function Mn(e){var t;return (t=e?.some(n=>n.includes(`
|
|
56
|
-
`)))!==null&&t!==void 0?t:false}g();function rt(e,t){switch(e.kind){case p.NULL:return null;case p.INT:return parseInt(e.value,10);case p.FLOAT:return parseFloat(e.value);case p.STRING:case p.ENUM:case p.BOOLEAN:return e.value;case p.LIST:return e.values.map(n=>rt(n,t));case p.OBJECT:return vt(e.fields,n=>n.name.value,n=>rt(n.value,t));case p.VARIABLE:return t?.[e.name.value]}}g();function de(e){if(e!=null||F(false,"Must provide name."),typeof e=="string"||F(false,"Expected name to be a string."),e.length===0)throw new m("Expected name to be a non-empty string.");for(let t=1;t<e.length;++t)if(!Jt(e.charCodeAt(t)))throw new m(`Names must only contain [_a-zA-Z0-9] but "${e}" does not.`);if(!Et(e.charCodeAt(0)))throw new m(`Names must start with [_a-zA-Z] but "${e}" does not.`);return e}function Gn(e){if(e==="true"||e==="false"||e==="null")throw new m(`Enum values cannot be named: ${e}`);return de(e)}function st(e){return he(e)||C(e)||$(e)||ne(e)||X(e)||V(e)||q(e)||w(e)}function he(e){return ue(e,me)}function C(e){return ue(e,G)}function $(e){return ue(e,It)}function ne(e){return ue(e,ke)}function X(e){return ue(e,Fe)}function V(e){return ue(e,Ce)}function q(e){return ue(e,M)}function w(e){return ue(e,A)}function oe(e){return he(e)||X(e)||V(e)||Ot(e)&&oe(e.ofType)}function Le(e){return he(e)||C(e)||$(e)||ne(e)||X(e)||Ot(e)&&Le(e.ofType)}function le(e){return he(e)||X(e)}function ye(e){return C(e)||$(e)||ne(e)}function Te(e){return $(e)||ne(e)}var M=class{constructor(t){st(t)||F(false,`Expected ${N(t)} to be a GraphQL type.`),this.ofType=t;}get[Symbol.toStringTag](){return "GraphQLList"}toString(){return "["+String(this.ofType)+"]"}toJSON(){return this.toString()}},A=class{constructor(t){bt(t)||F(false,`Expected ${N(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 Ot(e){return q(e)||w(e)}function bt(e){return st(e)&&!w(e)}function ot(e){if(e)return w(e)?e.ofType:e}function tn(e){return he(e)||C(e)||$(e)||ne(e)||X(e)||V(e)}function re(e){if(e){let t=e;for(;Ot(t);)t=t.ofType;return t}}function nn(e){return typeof e=="function"?e():e}function rn(e){return typeof e=="function"?e():e}var me=class{constructor(t){var n,r,i,s;let o=(n=t.parseValue)!==null&&n!==void 0?n:$n;this.name=de(t.name),this.description=t.description,this.specifiedByURL=t.specifiedByURL,this.serialize=(r=t.serialize)!==null&&r!==void 0?r:$n,this.parseValue=o,this.parseLiteral=(i=t.parseLiteral)!==null&&i!==void 0?i:(a,u)=>o(rt(a,u)),this.extensions=ce(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=(s=t.extensionASTNodes)!==null&&s!==void 0?s:[],t.specifiedByURL==null||typeof t.specifiedByURL=="string"||F(false,`${this.name} must provide "specifiedByURL" as a string, but got: ${N(t.specifiedByURL)}.`),t.serialize==null||typeof t.serialize=="function"||F(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"||F(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()}},G=class{constructor(t){var n;this.name=de(t.name),this.description=t.description,this.isTypeOf=t.isTypeOf,this.extensions=ce(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=(n=t.extensionASTNodes)!==null&&n!==void 0?n:[],this._fields=()=>li(t),this._interfaces=()=>ci(t),t.isTypeOf==null||typeof t.isTypeOf=="function"||F(false,`${this.name} must provide "isTypeOf" as a function, but got: ${N(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:fi(this.getFields()),isTypeOf:this.isTypeOf,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}};function ci(e){var t;let n=nn((t=e.interfaces)!==null&&t!==void 0?t:[]);return Array.isArray(n)||F(false,`${e.name} interfaces must be an Array or a function which returns an Array.`),n}function li(e){let t=rn(e.fields);return it(t)||F(false,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),Me(t,(n,r)=>{var i;it(n)||F(false,`${e.name}.${r} field config must be an object.`),n.resolve==null||typeof n.resolve=="function"||F(false,`${e.name}.${r} field resolver must be a function if provided, but got: ${N(n.resolve)}.`);let s=(i=n.args)!==null&&i!==void 0?i:{};return it(s)||F(false,`${e.name}.${r} args must be an object with argument names as keys.`),{name:de(r),description:n.description,type:n.type,args:Pn(s),resolve:n.resolve,subscribe:n.subscribe,deprecationReason:n.deprecationReason,extensions:ce(n.extensions),astNode:n.astNode}})}function Pn(e){return Object.entries(e).map(([t,n])=>({name:de(t),description:n.description,type:n.type,defaultValue:n.defaultValue,deprecationReason:n.deprecationReason,extensions:ce(n.extensions),astNode:n.astNode}))}function it(e){return ae(e)&&!Array.isArray(e)}function fi(e){return Me(e,t=>({description:t.description,type:t.type,args:Qn(t.args),resolve:t.resolve,subscribe:t.subscribe,deprecationReason:t.deprecationReason,extensions:t.extensions,astNode:t.astNode}))}function Qn(e){return vt(e,t=>t.name,t=>({description:t.description,type:t.type,defaultValue:t.defaultValue,deprecationReason:t.deprecationReason,extensions:t.extensions,astNode:t.astNode}))}function xe(e){return w(e.type)&&e.defaultValue===void 0}var It=class{constructor(t){var n;this.name=de(t.name),this.description=t.description,this.resolveType=t.resolveType,this.extensions=ce(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=(n=t.extensionASTNodes)!==null&&n!==void 0?n:[],this._fields=li.bind(void 0,t),this._interfaces=ci.bind(void 0,t),t.resolveType==null||typeof t.resolveType=="function"||F(false,`${this.name} must provide "resolveType" as a function, but got: ${N(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:fi(this.getFields()),resolveType:this.resolveType,extensions:this.extensions,astNode:this.astNode,extensionASTNodes:this.extensionASTNodes}}toString(){return this.name}toJSON(){return this.toString()}},ke=class{constructor(t){var n;this.name=de(t.name),this.description=t.description,this.resolveType=t.resolveType,this.extensions=ce(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=(n=t.extensionASTNodes)!==null&&n!==void 0?n:[],this._types=ls.bind(void 0,t),t.resolveType==null||typeof t.resolveType=="function"||F(false,`${this.name} must provide "resolveType" as a function, but got: ${N(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 ls(e){let t=nn(e.types);return Array.isArray(t)||F(false,`Must provide Array of types or a function which returns such an array for Union ${e.name}.`),t}var Fe=class{constructor(t){var n;this.name=de(t.name),this.description=t.description,this.extensions=ce(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=(n=t.extensionASTNodes)!==null&&n!==void 0?n:[],this._values=typeof t.values=="function"?t.values:pi(this.name,t.values),this._valueLookup=null,this._nameLookup=null;}get[Symbol.toStringTag](){return "GraphQLEnumType"}getValues(){return typeof this._values=="function"&&(this._values=pi(this.name,this._values())),this._values}getValue(t){return this._nameLookup===null&&(this._nameLookup=Ie(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 m(`Enum "${this.name}" cannot represent value: ${N(t)}`);return n.name}parseValue(t){if(typeof t!="string"){let r=N(t);throw new m(`Enum "${this.name}" cannot represent non-string value: ${r}.`+en(this,r))}let n=this.getValue(t);if(n==null)throw new m(`Value "${t}" does not exist in "${this.name}" enum.`+en(this,t));return n.value}parseLiteral(t,n){if(t.kind!==p.ENUM){let i=U(t);throw new m(`Enum "${this.name}" cannot represent non-enum value: ${i}.`+en(this,i),{nodes:t})}let r=this.getValue(t.value);if(r==null){let i=U(t);throw new m(`Value "${i}" does not exist in "${this.name}" enum.`+en(this,i),{nodes:t})}return r.value}toConfig(){let t=vt(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 en(e,t){let n=e.getValues().map(i=>i.name),r=pe(t,n);return se("the enum value",r)}function pi(e,t){return it(t)||F(false,`${e} values must be an object with value names as keys.`),Object.entries(t).map(([n,r])=>(it(r)||F(false,`${e}.${n} must refer to an object with a "value" key representing an internal value but got: ${N(r)}.`),{name:Gn(n),description:r.description,value:r.value!==void 0?r.value:n,deprecationReason:r.deprecationReason,extensions:ce(r.extensions),astNode:r.astNode}))}var Ce=class{constructor(t){var n,r;this.name=de(t.name),this.description=t.description,this.extensions=ce(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=fs.bind(void 0,t);}get[Symbol.toStringTag](){return "GraphQLInputObjectType"}getFields(){return typeof this._fields=="function"&&(this._fields=this._fields()),this._fields}toConfig(){let t=Me(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 fs(e){let t=rn(e.fields);return it(t)||F(false,`${e.name} fields must be an object with field names as keys or a function which returns such an object.`),Me(t,(n,r)=>(!("resolve"in n)||F(false,`${e.name}.${r} field has a resolve property, but Input Types cannot define resolvers.`),{name:de(r),description:n.description,type:n.type,defaultValue:n.defaultValue,deprecationReason:n.deprecationReason,extensions:ce(n.extensions),astNode:n.astNode}))}function at(e){return w(e.type)&&e.defaultValue===void 0}function _t(e,t){return e===t?true:w(e)&&w(t)||q(e)&&q(t)?_t(e.ofType,t.ofType):false}function Re(e,t,n){return t===n?true:w(n)?w(t)?Re(e,t.ofType,n.ofType):false:w(t)?Re(e,t.ofType,n):q(n)?q(t)?Re(e,t.ofType,n.ofType):false:q(t)?false:Te(n)&&($(t)||C(t))&&e.isSubType(n,t)}function sn(e,t,n){return t===n?true:Te(t)?Te(n)?e.getPossibleTypes(t).some(r=>e.isSubType(n,r)):e.isSubType(t,n):Te(n)?e.isSubType(n,t):false}g();g();var St=2147483647,Dt=-2147483648,be=new me({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=Rt(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 m(`Int cannot represent non-integer value: ${N(t)}`);if(n>St||n<Dt)throw new m("Int cannot represent non 32-bit signed integer value: "+N(t));return n},parseValue(e){if(typeof e!="number"||!Number.isInteger(e))throw new m(`Int cannot represent non-integer value: ${N(e)}`);if(e>St||e<Dt)throw new m(`Int cannot represent non 32-bit signed integer value: ${e}`);return e},parseLiteral(e){if(e.kind!==p.INT)throw new m(`Int cannot represent non-integer value: ${U(e)}`,{nodes:e});let t=parseInt(e.value,10);if(t>St||t<Dt)throw new m(`Int cannot represent non 32-bit signed integer value: ${e.value}`,{nodes:e});return t}}),At=new me({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=Rt(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 m(`Float cannot represent non numeric value: ${N(t)}`);return n},parseValue(e){if(typeof e!="number"||!Number.isFinite(e))throw new m(`Float cannot represent non numeric value: ${N(e)}`);return e},parseLiteral(e){if(e.kind!==p.FLOAT&&e.kind!==p.INT)throw new m(`Float cannot represent non numeric value: ${U(e)}`,e);return parseFloat(e.value)}}),S=new me({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=Rt(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 m(`String cannot represent value: ${N(e)}`)},parseValue(e){if(typeof e!="string")throw new m(`String cannot represent a non string value: ${N(e)}`);return e},parseLiteral(e){if(e.kind!==p.STRING)throw new m(`String cannot represent a non string value: ${U(e)}`,{nodes:e});return e.value}}),K=new me({name:"Boolean",description:"The `Boolean` scalar type represents `true` or `false`.",serialize(e){let t=Rt(e);if(typeof t=="boolean")return t;if(Number.isFinite(t))return t!==0;throw new m(`Boolean cannot represent a non boolean value: ${N(t)}`)},parseValue(e){if(typeof e!="boolean")throw new m(`Boolean cannot represent a non boolean value: ${N(e)}`);return e},parseLiteral(e){if(e.kind!==p.BOOLEAN)throw new m(`Boolean cannot represent a non boolean value: ${U(e)}`,{nodes:e});return e.value}}),Lt=new me({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=Rt(e);if(typeof t=="string")return t;if(Number.isInteger(t))return String(t);throw new m(`ID cannot represent value: ${N(e)}`)},parseValue(e){if(typeof e=="string")return e;if(typeof e=="number"&&Number.isInteger(e))return e.toString();throw new m(`ID cannot represent value: ${N(e)}`)},parseLiteral(e){if(e.kind!==p.STRING&&e.kind!==p.INT)throw new m("ID cannot represent a non-string and non-integer value: "+U(e),{nodes:e});return e.value}}),xt=Object.freeze([S,be,At,K,Lt]);function on(e){return xt.some(({name:t})=>e.name===t)}function Rt(e){if(ae(e)){if(typeof e.valueOf=="function"){let t=e.valueOf();if(!ae(t))return t}if(typeof e.toJSON=="function")return e.toJSON()}return e}function ut(e){return ue(e,Ae)}var Ae=class{constructor(t){var n,r,i;this.name=de(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=ce(t.extensions),this.astNode=t.astNode,this.extensionASTNodes=(r=t.extensionASTNodes)!==null&&r!==void 0?r:[],Array.isArray(t.locations)||F(false,`@${t.name} locations must be an Array.`);let s=(i=t.args)!==null&&i!==void 0?i:{};ae(s)&&!Array.isArray(s)||F(false,`@${t.name} args must be an object with argument names as keys.`),this.args=Pn(s);}get[Symbol.toStringTag](){return "GraphQLDirective"}toConfig(){return {name:this.name,description:this.description,locations:this.locations,args:Qn(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()}},wt=new Ae({name:"include",description:"Directs the executor to include this field or fragment only when the `if` argument is true.",locations:[_.FIELD,_.FRAGMENT_SPREAD,_.INLINE_FRAGMENT],args:{if:{type:new A(K),description:"Included when true."}}}),kt=new Ae({name:"skip",description:"Directs the executor to skip this field or fragment when the `if` argument is true.",locations:[_.FIELD,_.FRAGMENT_SPREAD,_.INLINE_FRAGMENT],args:{if:{type:new A(K),description:"Skipped when true."}}}),Ft="No longer supported",Ct=new Ae({name:"deprecated",description:"Marks an element of a GraphQL schema as no longer supported.",locations:[_.FIELD_DEFINITION,_.ARGUMENT_DEFINITION,_.INPUT_FIELD_DEFINITION,_.ENUM_VALUE,_.DIRECTIVE_DEFINITION],args:{reason:{type:S,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:Ft}}}),Bn=new Ae({name:"specifiedBy",description:"Exposes a URL that specifies the behavior of this scalar.",locations:[_.SCALAR],args:{url:{type:new A(S),description:"The URL that specifies the behavior of this scalar."}}}),qn=new Ae({name:"oneOf",description:"Indicates exactly one field must be supplied and this field must not be `null`.",locations:[_.INPUT_OBJECT],args:{}}),Ee=Object.freeze([wt,kt,Ct,Bn,qn]);function an(e){return Ee.some(({name:t})=>t===e.name)}g();g();g();function un(e){return typeof e=="object"&&typeof e?.[Symbol.iterator]=="function"}function we(e,t){if(w(t)){let n=we(e,t.ofType);return n?.kind===p.NULL?null:n}if(e===null)return {kind:p.NULL};if(e===void 0)return null;if(q(t)){let n=t.ofType;if(un(e)){let r=[];for(let i of e){let s=we(i,n);s!=null&&r.push(s);}return {kind:p.LIST,values:r}}return we(e,n)}if(V(t)){if(!ae(e))return null;let n=[];for(let r of Object.values(t.getFields())){let i=we(e[r.name],r.type);i&&n.push({kind:p.OBJECT_FIELD,name:{kind:p.NAME,value:r.name},value:i});}return {kind:p.OBJECT,fields:n}}if(le(t)){let n=t.serialize(e);if(n==null)return null;if(typeof n=="boolean")return {kind:p.BOOLEAN,value:n};if(typeof n=="number"&&Number.isFinite(n)){let r=String(n);return di.test(r)?{kind:p.INT,value:r}:{kind:p.FLOAT,value:r}}if(typeof n=="string")return X(t)?{kind:p.ENUM,value:n}:t===Lt&&di.test(n)?{kind:p.INT,value:n}:{kind:p.STRING,value:n};throw new TypeError(`Cannot convert value to AST: ${N(n)}.`)}W(false,"Unexpected input type: "+N(t));}var di=/^-?(?:0|[1-9][0-9]*)$/;var pt=new G({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:S,resolve:e=>e.description},types:{description:"A list of all types supported by this server.",type:new A(new M(new A(Ne))),resolve(e){return Object.values(e.getTypeMap())}},queryType:{description:"The type that query operations will be rooted at.",type:new A(Ne),resolve:e=>e.getQueryType()},mutationType:{description:"If this server supports mutation, the type that mutation operations will be rooted at.",type:Ne,resolve:e=>e.getMutationType()},subscriptionType:{description:"If this server support subscription, the type that subscription operations will be rooted at.",type:Ne,resolve:e=>e.getSubscriptionType()},directives:{description:"A list of all directives supported by this server.",type:new A(new M(new A(pn))),args:{includeDeprecated:{type:new A(K),defaultValue:false}},resolve:(e,{includeDeprecated:t})=>t?e.getDirectives():e.getDirectives().filter(n=>n.deprecationReason==null)}})}),pn=new G({name:"__Directive",description:`A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.
|
|
57
|
-
|
|
58
|
-
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 A(S),resolve:e=>e.name},description:{type:S,resolve:e=>e.description},isRepeatable:{type:new A(K),resolve:e=>e.isRepeatable},locations:{type:new A(new M(new A(cn))),resolve:e=>e.locations},args:{type:new A(new M(new A(ct))),args:{includeDeprecated:{type:K,defaultValue:false}},resolve(e,{includeDeprecated:t}){return t?e.args:e.args.filter(n=>n.deprecationReason==null)}},isDeprecated:{type:new A(K),resolve:e=>e.deprecationReason!=null},deprecationReason:{type:S,resolve:e=>e.deprecationReason}})}),cn=new Fe({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:_.QUERY,description:"Location adjacent to a query operation."},MUTATION:{value:_.MUTATION,description:"Location adjacent to a mutation operation."},SUBSCRIPTION:{value:_.SUBSCRIPTION,description:"Location adjacent to a subscription operation."},FIELD:{value:_.FIELD,description:"Location adjacent to a field."},FRAGMENT_DEFINITION:{value:_.FRAGMENT_DEFINITION,description:"Location adjacent to a fragment definition."},FRAGMENT_SPREAD:{value:_.FRAGMENT_SPREAD,description:"Location adjacent to a fragment spread."},INLINE_FRAGMENT:{value:_.INLINE_FRAGMENT,description:"Location adjacent to an inline fragment."},VARIABLE_DEFINITION:{value:_.VARIABLE_DEFINITION,description:"Location adjacent to a variable definition."},SCHEMA:{value:_.SCHEMA,description:"Location adjacent to a schema definition."},SCALAR:{value:_.SCALAR,description:"Location adjacent to a scalar definition."},OBJECT:{value:_.OBJECT,description:"Location adjacent to an object type definition."},FIELD_DEFINITION:{value:_.FIELD_DEFINITION,description:"Location adjacent to a field definition."},ARGUMENT_DEFINITION:{value:_.ARGUMENT_DEFINITION,description:"Location adjacent to an argument definition."},INTERFACE:{value:_.INTERFACE,description:"Location adjacent to an interface definition."},UNION:{value:_.UNION,description:"Location adjacent to a union definition."},ENUM:{value:_.ENUM,description:"Location adjacent to an enum definition."},ENUM_VALUE:{value:_.ENUM_VALUE,description:"Location adjacent to an enum value definition."},INPUT_OBJECT:{value:_.INPUT_OBJECT,description:"Location adjacent to an input object type definition."},INPUT_FIELD_DEFINITION:{value:_.INPUT_FIELD_DEFINITION,description:"Location adjacent to an input object field definition."},DIRECTIVE_DEFINITION:{value:_.DIRECTIVE_DEFINITION,description:"Location adjacent to a directive definition."}}}),Ne=new G({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 A(dn),resolve(e){if(he(e))return te.SCALAR;if(C(e))return te.OBJECT;if($(e))return te.INTERFACE;if(ne(e))return te.UNION;if(X(e))return te.ENUM;if(V(e))return te.INPUT_OBJECT;if(q(e))return te.LIST;if(w(e))return te.NON_NULL;W(false,`Unexpected type: "${N(e)}".`);}},name:{type:S,resolve:e=>"name"in e?e.name:void 0},description:{type:S,resolve:e=>"description"in e?e.description:void 0},specifiedByURL:{type:S,resolve:e=>"specifiedByURL"in e?e.specifiedByURL:void 0},fields:{type:new M(new A(ln)),args:{includeDeprecated:{type:K,defaultValue:false}},resolve(e,{includeDeprecated:t}){if(C(e)||$(e)){let n=Object.values(e.getFields());return t?n:n.filter(r=>r.deprecationReason==null)}}},interfaces:{type:new M(new A(Ne)),resolve(e){if(C(e)||$(e))return e.getInterfaces()}},possibleTypes:{type:new M(new A(Ne)),resolve(e,t,n,{schema:r}){if(Te(e))return r.getPossibleTypes(e)}},enumValues:{type:new M(new A(fn)),args:{includeDeprecated:{type:K,defaultValue:false}},resolve(e,{includeDeprecated:t}){if(X(e)){let n=e.getValues();return t?n:n.filter(r=>r.deprecationReason==null)}}},inputFields:{type:new M(new A(ct)),args:{includeDeprecated:{type:K,defaultValue:false}},resolve(e,{includeDeprecated:t}){if(V(e)){let n=Object.values(e.getFields());return t?n:n.filter(r=>r.deprecationReason==null)}}},ofType:{type:Ne,resolve:e=>"ofType"in e?e.ofType:void 0},isOneOf:{type:K,resolve:e=>{if(V(e))return e.isOneOf}}})}),ln=new G({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 A(S),resolve:e=>e.name},description:{type:S,resolve:e=>e.description},args:{type:new A(new M(new A(ct))),args:{includeDeprecated:{type:K,defaultValue:false}},resolve(e,{includeDeprecated:t}){return t?e.args:e.args.filter(n=>n.deprecationReason==null)}},type:{type:new A(Ne),resolve:e=>e.type},isDeprecated:{type:new A(K),resolve:e=>e.deprecationReason!=null},deprecationReason:{type:S,resolve:e=>e.deprecationReason}})}),ct=new G({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 A(S),resolve:e=>e.name},description:{type:S,resolve:e=>e.description},type:{type:new A(Ne),resolve:e=>e.type},defaultValue:{type:S,description:"A GraphQL-formatted string representing the default value for this input value.",resolve(e){let{type:t,defaultValue:n}=e,r=we(n,t);return r?U(r):null}},isDeprecated:{type:new A(K),resolve:e=>e.deprecationReason!=null},deprecationReason:{type:S,resolve:e=>e.deprecationReason}})}),fn=new G({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 A(S),resolve:e=>e.name},description:{type:S,resolve:e=>e.description},isDeprecated:{type:new A(K),resolve:e=>e.deprecationReason!=null},deprecationReason:{type:S,resolve:e=>e.deprecationReason}})}),te;(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";})(te||(te={}));var dn=new Fe({name:"__TypeKind",description:"An enum describing what kind of type a given `__Type` is.",values:{SCALAR:{value:te.SCALAR,description:"Indicates this type is a scalar."},OBJECT:{value:te.OBJECT,description:"Indicates this type is an object. `fields` and `interfaces` are valid fields."},INTERFACE:{value:te.INTERFACE,description:"Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields."},UNION:{value:te.UNION,description:"Indicates this type is a union. `possibleTypes` is a valid field."},ENUM:{value:te.ENUM,description:"Indicates this type is an enum. `enumValues` is a valid field."},INPUT_OBJECT:{value:te.INPUT_OBJECT,description:"Indicates this type is an input object. `inputFields` is a valid field."},LIST:{value:te.LIST,description:"Indicates this type is a list. `ofType` is a valid field."},NON_NULL:{value:te.NON_NULL,description:"Indicates this type is a non-null. `ofType` is a valid field."}}}),$t={name:"__schema",type:new A(pt),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},Ut={name:"__type",type:Ne,description:"Request the type information of a single type.",args:[{name:"name",description:void 0,type:new A(S),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},Vt={name:"__typename",type:new A(S),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},jt=Object.freeze([pt,pn,cn,Ne,ln,ct,fn,dn]);function lt(e){return jt.some(({name:t})=>e.name===t)}g();function Yn(e){return ue(e,Pe)}function mn(e){if(!Yn(e))throw new Error(`Expected ${N(e)} to be a GraphQL schema.`);return e}var Pe=class{constructor(t){var n,r;this.__validationErrors=t.assumeValid===true?[]:void 0,ae(t)||F(false,"Must provide configuration object."),!t.types||Array.isArray(t.types)||F(false,`"types" must be Array if provided but got: ${N(t.types)}.`),!t.directives||Array.isArray(t.directives)||F(false,`"directives" must be Array if provided but got: ${N(t.directives)}.`),this.description=t.description,this.extensions=ce(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:Ee;let i=new Set(t.types);if(t.types!=null)for(let s of t.types)i.delete(s),_e(s,i);this._queryType!=null&&_e(this._queryType,i),this._mutationType!=null&&_e(this._mutationType,i),this._subscriptionType!=null&&_e(this._subscriptionType,i);for(let s of this._directives)if(ut(s))for(let o of s.args)_e(o.type,i);_e(pt,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||F(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,$(s)){for(let a of s.getInterfaces())if($(a)){let u=this._implementationsMap[a.name];u===void 0&&(u=this._implementationsMap[a.name]={objects:[],interfaces:[]}),u.interfaces.push(s);}}else if(C(s)){for(let a of s.getInterfaces())if($(a)){let u=this._implementationsMap[a.name];u===void 0&&(u=this._implementationsMap[a.name]={objects:[],interfaces:[]}),u.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 Z.QUERY:return this.getQueryType();case Z.MUTATION:return this.getMutationType();case Z.SUBSCRIPTION:return this.getSubscriptionType()}}getTypeMap(){return this._typeMap}getType(t){return this.getTypeMap()[t]}getPossibleTypes(t){return ne(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),ne(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 _e(e,t){let n=re(e);if(!t.has(n)){if(t.add(n),ne(n))for(let r of n.getTypes())_e(r,t);else if(C(n)||$(n)){for(let r of n.getInterfaces())_e(r,t);for(let r of Object.values(n.getFields())){_e(r.type,t);for(let i of r.args)_e(i.type,t);}}else if(V(n))for(let r of Object.values(n.getFields()))_e(r.type,t);}return t}function Xn(e){if(mn(e),e.__validationErrors)return e.__validationErrors;let t=new Jn(e);ds(t),ms(t),hs(t);let n=t.getErrors();return e.__validationErrors=n,n}function hn(e){let t=Xn(e);if(t.length!==0)throw new Error(t.map(n=>n.message).join(`
|
|
59
|
-
|
|
60
|
-
`))}var Jn=class{constructor(t){this._errors=[],this.schema=t;}reportError(t,n){let r=Array.isArray(n)?n.filter(Boolean):n;this._errors.push(new m(t,{nodes:r}));}getErrors(){return this._errors}};function ds(e){let t=e.schema,n=t.getQueryType();if(!n)e.reportError("Query root type must be provided.",t.astNode);else if(!C(n)){var r;e.reportError(`Query root type must be Object type, it cannot be ${N(n)}.`,(r=Kn(t,Z.QUERY))!==null&&r!==void 0?r:n.astNode);}let i=t.getMutationType();if(i&&!C(i)){var s;e.reportError(`Mutation root type must be Object type if provided, it cannot be ${N(i)}.`,(s=Kn(t,Z.MUTATION))!==null&&s!==void 0?s:i.astNode);}let o=t.getSubscriptionType();if(o&&!C(o)){var a;e.reportError(`Subscription root type must be Object type if provided, it cannot be ${N(o)}.`,(a=Kn(t,Z.SUBSCRIPTION))!==null&&a!==void 0?a:o.astNode);}}function Kn(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 ms(e){for(let n of e.schema.getDirectives()){if(!ut(n)){e.reportError(`Expected directive but got: ${N(n)}.`,n?.astNode);continue}Qe(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(Qe(e,r),oe(r.type)||e.reportError(`The type of @${n.name}(${r.name}:) must be Input Type but got: ${N(r.type)}.`,r.astNode),xe(r)&&r.deprecationReason!=null){var t;e.reportError(`Required argument @${n.name}(${r.name}:) cannot be deprecated.`,[zn(r.astNode),(t=r.astNode)===null||t===void 0?void 0:t.type]);}}}function Qe(e,t){t.name.startsWith("__")&&e.reportError(`Name "${t.name}" must not begin with "__", which is reserved by GraphQL introspection.`,t.astNode);}function hs(e){let t=Is(e),n=e.schema.getTypeMap();for(let r of Object.values(n)){if(!tn(r)){e.reportError(`Expected GraphQL named type but got: ${N(r)}.`,r.astNode);continue}lt(r)||Qe(e,r),C(r)||$(r)?(mi(e,r),hi(e,r)):ne(r)?Es(e,r):X(r)?Ns(e,r):V(r)&&(gs(e,r),t(r));}}function mi(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(Qe(e,o),!Le(o.type)){var r;e.reportError(`The type of ${t.name}.${o.name} must be Output Type but got: ${N(o.type)}.`,(r=o.astNode)===null||r===void 0?void 0:r.type);}for(let a of o.args){let u=a.name;if(Qe(e,a),!oe(a.type)){var i;e.reportError(`The type of ${t.name}.${o.name}(${u}:) must be Input Type but got: ${N(a.type)}.`,(i=a.astNode)===null||i===void 0?void 0:i.type);}if(xe(a)&&a.deprecationReason!=null){var s;e.reportError(`Required argument ${t.name}.${o.name}(${u}:) cannot be deprecated.`,[zn(a.astNode),(s=a.astNode)===null||s===void 0?void 0:s.type]);}}}}function hi(e,t){let n=Object.create(null);for(let r of t.getInterfaces()){if(!$(r)){e.reportError(`Type ${N(t)} must only implement Interface types, it cannot implement ${N(r)}.`,Mt(t,r));continue}if(t===r){e.reportError(`Type ${t.name} cannot implement itself because it would create a circular reference.`,Mt(t,r));continue}if(n[r.name]){e.reportError(`Type ${t.name} can only implement ${r.name} once.`,Mt(t,r));continue}n[r.name]=true,Ts(e,t,r),ys(e,t,r);}}function ys(e,t,n){let r=t.getFields();for(let u of Object.values(n.getFields())){let c=u.name,f=r[c];if(!f){e.reportError(`Interface field ${n.name}.${c} expected but ${t.name} does not provide it.`,[u.astNode,t.astNode,...t.extensionASTNodes]);continue}if(!Re(e.schema,f.type,u.type)){var i,s;e.reportError(`Interface field ${n.name}.${c} expects type ${N(u.type)} but ${t.name}.${c} is type ${N(f.type)}.`,[(i=u.astNode)===null||i===void 0?void 0:i.type,(s=f.astNode)===null||s===void 0?void 0:s.type]);}for(let d of u.args){let h=d.name,v=f.args.find(g=>g.name===h);if(!v){e.reportError(`Interface field argument ${n.name}.${c}(${h}:) expected but ${t.name}.${c} does not provide it.`,[d.astNode,f.astNode]);continue}if(!_t(d.type,v.type)){var o,a;e.reportError(`Interface field argument ${n.name}.${c}(${h}:) expects type ${N(d.type)} but ${t.name}.${c}(${h}:) is type ${N(v.type)}.`,[(o=d.astNode)===null||o===void 0?void 0:o.type,(a=v.astNode)===null||a===void 0?void 0:a.type]);}}for(let d of f.args){let h=d.name;!u.args.find(g=>g.name===h)&&xe(d)&&e.reportError(`Object field ${t.name}.${c} includes required argument ${h} that is missing from the Interface field ${n.name}.${c}.`,[d.astNode,u.astNode]);}}}function Ts(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}.`,[...Mt(n,i),...Mt(t,n)]);}function Es(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.`,yi(t,i.name));continue}r[i.name]=true,C(i)||e.reportError(`Union type ${t.name} can only include Object types, it cannot include ${N(i)}.`,yi(t,String(i)));}}function Ns(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)Qe(e,r);}function gs(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(Qe(e,s),!oe(s.type)){var r;e.reportError(`The type of ${t.name}.${s.name} must be Input Type but got: ${N(s.type)}.`,(r=s.astNode)===null||r===void 0?void 0:r.type);}if(at(s)&&s.deprecationReason!=null){var i;e.reportError(`Required input field ${t.name}.${s.name} cannot be deprecated.`,[zn(s.astNode),(i=s.astNode)===null||i===void 0?void 0:i.type]);}t.isOneOf&&vs(t,s,e);}}function vs(e,t,n){if(w(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 Is(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(w(a.type)&&V(a.type.ofType)){let u=a.type.ofType,c=r[u.name];if(n.push(a),c===void 0)i(u);else {let f=n.slice(c),d=f.map(h=>h.name).join(".");e.reportError(`Cannot reference Input Object "${u.name}" within itself through a series of non-null fields: "${d}".`,f.map(h=>h.astNode));}n.pop();}r[s.name]=void 0;}}function Mt(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 yi(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 zn(e){var t;return e==null||(t=e.directives)===null||t===void 0?void 0:t.find(n=>n.name.value===Ct.name)}g();g();g();function H(e,t){switch(t.kind){case p.LIST_TYPE:{let n=H(e,t.type);return n&&new M(n)}case p.NON_NULL_TYPE:{let n=H(e,t.type);return n&&new A(n)}case p.NAMED_TYPE:return e.getType(t.name.value)}}var Be=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??Os,n&&(oe(n)&&this._inputTypeStack.push(n),ye(n)&&this._parentTypeStack.push(n),Le(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 p.SELECTION_SET:{let i=re(this.getType());this._parentTypeStack.push(ye(i)?i:void 0);break}case p.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(Le(o)?o:void 0);break}case p.DIRECTIVE:this._directive=n.getDirective(t.name.value);break;case p.OPERATION_DEFINITION:{let i=n.getRootType(t.operation);this._typeStack.push(C(i)?i:void 0);break}case p.INLINE_FRAGMENT:case p.FRAGMENT_DEFINITION:{let i=t.typeCondition,s=i?H(n,i):re(this.getType());this._typeStack.push(Le(s)?s:void 0);break}case p.VARIABLE_DEFINITION:{let i=H(n,t.type);this._inputTypeStack.push(oe(i)?i:void 0);break}case p.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(oe(s)?s:void 0);break}case p.LIST:{let i=ot(this.getInputType()),s=q(i)?i.ofType:i;this._defaultValueStack.push(void 0),this._inputTypeStack.push(oe(s)?s:void 0);break}case p.OBJECT_FIELD:{let i=re(this.getInputType()),s,o;V(i)&&(o=i.getFields()[t.name.value],o&&(s=o.type)),this._defaultValueStack.push(o?o.defaultValue:void 0),this._inputTypeStack.push(oe(s)?s:void 0);break}case p.ENUM:{let i=re(this.getInputType()),s;X(i)&&(s=i.getValue(t.value)),this._enumValue=s;break}}}leave(t){switch(t.kind){case p.SELECTION_SET:this._parentTypeStack.pop();break;case p.FIELD:this._fieldDefStack.pop(),this._typeStack.pop();break;case p.DIRECTIVE:this._directive=null;break;case p.OPERATION_DEFINITION:case p.INLINE_FRAGMENT:case p.FRAGMENT_DEFINITION:this._typeStack.pop();break;case p.VARIABLE_DEFINITION:this._inputTypeStack.pop();break;case p.ARGUMENT:this._argument=null,this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case p.LIST:case p.OBJECT_FIELD:this._defaultValueStack.pop(),this._inputTypeStack.pop();break;case p.ENUM:this._enumValue=null;break;}}};function Os(e,t,n){let r=n.name.value;if(r===$t.name&&e.getQueryType()===t)return $t;if(r===Ut.name&&e.getQueryType()===t)return Ut;if(r===Vt.name&&ye(t))return Vt;if(C(t)||$(t))return t.getFields()[r]}function Gt(e,t){return {enter(...n){let r=n[0];e.enter(r);let i=nt(t,r.kind).enter;if(i){let s=i.apply(t,n);return s!==void 0&&(e.leave(r),Tt(s)&&e.enter(s)),s}},leave(...n){let r=n[0],i=nt(t,r.kind).leave,s;return i&&(s=i.apply(t,n)),e.leave(r),s}}}g();g();g();function Wn(e){return e.kind===p.OPERATION_DEFINITION||e.kind===p.FRAGMENT_DEFINITION}function Hn(e){return e.kind===p.SCHEMA_DEFINITION||$e(e)||e.kind===p.DIRECTIVE_DEFINITION}function $e(e){return e.kind===p.SCALAR_TYPE_DEFINITION||e.kind===p.OBJECT_TYPE_DEFINITION||e.kind===p.INTERFACE_TYPE_DEFINITION||e.kind===p.UNION_TYPE_DEFINITION||e.kind===p.ENUM_TYPE_DEFINITION||e.kind===p.INPUT_OBJECT_TYPE_DEFINITION}function Zn(e){return e.kind===p.SCHEMA_EXTENSION||e.kind===p.DIRECTIVE_EXTENSION||yn(e)}function yn(e){return e.kind===p.SCALAR_TYPE_EXTENSION||e.kind===p.OBJECT_TYPE_EXTENSION||e.kind===p.INTERFACE_TYPE_EXTENSION||e.kind===p.UNION_TYPE_EXTENSION||e.kind===p.ENUM_TYPE_EXTENSION||e.kind===p.INPUT_OBJECT_TYPE_EXTENSION}function er(e){return {Document(t){for(let n of t.definitions)if(!Wn(n)){let r=n.kind===p.SCHEMA_DEFINITION||n.kind===p.SCHEMA_EXTENSION?"schema":'"'+n.name.value+'"';e.reportError(new m(`The ${r} definition is not executable.`,{nodes:n}));}return false}}}g();function tr(e){return {Field(t){let n=e.getParentType();if(n&&!e.getFieldDef()){let i=e.getSchema(),s=t.name.value,o=se("to use an inline fragment on",bs(i,n,s));o===""&&(o=se(_s(n,s))),e.reportError(new m(`Cannot query field "${s}" on type "${n.name}".`+o,{nodes:t}));}}}}function bs(e,t,n){if(!Te(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 u=i[a.name]-i[o.name];return u!==0?u:$(o)&&e.isSubType(o,a)?-1:$(a)&&e.isSubType(a,o)?1:et(o.name,a.name)}).map(o=>o.name)}function _s(e,t){if(C(e)||$(e)){let n=Object.keys(e.getFields());return pe(t,n)}return []}g();function nr(e){return {InlineFragment(t){let n=t.typeCondition;if(n){let r=H(e.getSchema(),n);if(r&&!ye(r)){let i=U(n);e.reportError(new m(`Fragment cannot condition on non composite type "${i}".`,{nodes:n}));}}},FragmentDefinition(t){let n=H(e.getSchema(),t.typeCondition);if(n&&!ye(n)){let r=U(t.typeCondition);e.reportError(new m(`Fragment "${t.name.value}" cannot condition on non composite type "${r}".`,{nodes:t.typeCondition}));}}}}g();function rr(e){return {...ir(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(u=>u.name),a=pe(s,o);e.reportError(new m(`Unknown argument "${s}" on field "${i.name}.${r.name}".`+se(a),{nodes:t}));}}}}function ir(e){let t=Object.create(null),n=e.getSchema(),r=n?n.getDirectives():Ee;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===p.DIRECTIVE_DEFINITION){var s;let a=(s=o.arguments)!==null&&s!==void 0?s:[];t[o.name.value]=a.map(u=>u.name.value);}return {Directive(o){let a=o.name.value,u=t[a];if(o.arguments&&u)for(let c of o.arguments){let f=c.name.value;if(!u.includes(f)){let d=pe(f,u);e.reportError(new m(`Unknown argument "${f}" on directive "@${a}".`+se(d),{nodes:c}));}}return false}}}g();function Tn(e){let t=Object.create(null),n=e.getSchema(),r=n?n.getDirectives():Ee;for(let s of r)t[s.name]=s.locations;let i=e.getDocument().definitions;for(let s of i)s.kind===p.DIRECTIVE_DEFINITION&&(t[s.name.value]=s.locations.map(o=>o.value));return {Directive(s,o,a,u,c){let f=s.name.value,d=t[f];if(!d){e.reportError(new m(`Unknown directive "@${f}".`,{nodes:s}));return}let h=Ss(c);h&&!d.includes(h)&&e.reportError(new m(`Directive "@${f}" may not be used on ${h}.`,{nodes:s}));}}}function Ss(e){let t=e[e.length-1];switch("kind"in t||W(),t.kind){case p.OPERATION_DEFINITION:return Ds(t.operation);case p.FIELD:return _.FIELD;case p.FRAGMENT_SPREAD:return _.FRAGMENT_SPREAD;case p.INLINE_FRAGMENT:return _.INLINE_FRAGMENT;case p.FRAGMENT_DEFINITION:return _.FRAGMENT_DEFINITION;case p.VARIABLE_DEFINITION:return _.VARIABLE_DEFINITION;case p.SCHEMA_DEFINITION:case p.SCHEMA_EXTENSION:return _.SCHEMA;case p.SCALAR_TYPE_DEFINITION:case p.SCALAR_TYPE_EXTENSION:return _.SCALAR;case p.OBJECT_TYPE_DEFINITION:case p.OBJECT_TYPE_EXTENSION:return _.OBJECT;case p.FIELD_DEFINITION:return _.FIELD_DEFINITION;case p.INTERFACE_TYPE_DEFINITION:case p.INTERFACE_TYPE_EXTENSION:return _.INTERFACE;case p.UNION_TYPE_DEFINITION:case p.UNION_TYPE_EXTENSION:return _.UNION;case p.ENUM_TYPE_DEFINITION:case p.ENUM_TYPE_EXTENSION:return _.ENUM;case p.ENUM_VALUE_DEFINITION:return _.ENUM_VALUE;case p.INPUT_OBJECT_TYPE_DEFINITION:case p.INPUT_OBJECT_TYPE_EXTENSION:return _.INPUT_OBJECT;case p.INPUT_VALUE_DEFINITION:{let n=e[e.length-3];return "kind"in n||W(),n.kind===p.INPUT_OBJECT_TYPE_DEFINITION?_.INPUT_FIELD_DEFINITION:_.ARGUMENT_DEFINITION}case p.DIRECTIVE_DEFINITION:case p.DIRECTIVE_EXTENSION:return _.DIRECTIVE_DEFINITION;default:W(false,"Unexpected kind: "+N(t.kind));}}function Ds(e){switch(e){case Z.QUERY:return _.QUERY;case Z.MUTATION:return _.MUTATION;case Z.SUBSCRIPTION:return _.SUBSCRIPTION}}g();function sr(e){return {FragmentSpread(t){let n=t.name.value;e.getFragment(n)||e.reportError(new m(`Unknown fragment "${n}".`,{nodes:t.name}));}}}g();function En(e){let t=e.getSchema(),n=t?t.getTypeMap():Object.create(null),r=Object.create(null);for(let s of e.getDocument().definitions)$e(s)&&(r[s.name.value]=true);let i=[...Object.keys(n),...Object.keys(r)];return {NamedType(s,o,a,u,c){let f=s.name.value;if(!n[f]&&!r[f]){var d;let h=(d=c[2])!==null&&d!==void 0?d:a,v=h!=null&&As(h);if(v&&Ti.includes(f))return;let g=pe(f,v?Ti.concat(i):i);e.reportError(new m(`Unknown type "${f}".`+se(g),{nodes:s}));}}}}var Ti=[...xt,...jt].map(e=>e.name);function As(e){return "kind"in e&&(Hn(e)||Zn(e))}g();function or(e){let t=0;return {Document(n){t=n.definitions.filter(r=>r.kind===p.OPERATION_DEFINITION).length;},OperationDefinition(n){!n.name&&t>1&&e.reportError(new m("This anonymous operation must be the only defined operation.",{nodes:n}));}}}g();g();var Ls=3;function ur(e){function t(n,r=Object.create(null),i=0){if(n.kind===p.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===p.FIELD&&(n.name.value==="fields"||n.name.value==="interfaces"||n.name.value==="possibleTypes"||n.name.value==="inputFields")&&(i++,i>=Ls))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 m("Maximum introspection depth exceeded",{nodes:[n]})),false}}}g();function pr(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 u of a){let c=u.name.value,f=r[c];if(n.push(u),f===void 0){let d=e.getFragment(c);d&&i(d);}else {let d=n.slice(f),h=d.slice(0,-1).map(v=>'"'+v.name.value+'"').join(", ");e.reportError(new m(`Cannot spread fragment "${c}" within itself`+(h!==""?` via ${h}.`:"."),{nodes:d}));}n.pop();}r[o]=void 0;}}}g();function cr(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 m(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;}}}g();function lr(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 m(`Fragment "${s}" is never used.`,{nodes:i}));}}}}}g();function fr(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 m(n.name?`Variable "$${o}" is never used in operation "${n.name.value}".`:`Variable "$${o}" is never used.`,{nodes:s}));}}},VariableDefinition(n){t.push(n);}}}g();g();function Nn(e){switch(e.kind){case p.OBJECT:return {...e,fields:xs(e.fields)};case p.LIST:return {...e,values:e.values.map(Nn)};case p.INT:case p.FLOAT:case p.STRING:case p.BOOLEAN:case p.NULL:case p.ENUM:case p.VARIABLE:return e}}function xs(e){return e.map(t=>({...t,value:Nn(t.value)})).sort((t,n)=>et(t.name.value,n.name.value))}function Ni(e){return Array.isArray(e)?e.map(([t,n])=>`subfields "${t}" conflict because `+Ni(n)).join(" and "):e}function yr(e){let t=new On,n=new hr,r=new Map;return {SelectionSet(i){let s=Rs(e,r,t,n,e.getParentType(),i);for(let[[o,a],u,c]of s){let f=Ni(a);e.reportError(new m(`Fields "${o}" conflict because ${f}. Use different aliases on the fields to fetch both if this was intentional.`,{nodes:u.concat(c)}));}}}}function Rs(e,t,n,r,i,s){let o=[],[a,u]=In(e,t,i,s);if(ks(e,o,t,n,r,a),u.length!==0)for(let c=0;c<u.length;c++){gn(e,o,t,n,r,false,a,u[c]);for(let f=c+1;f<u.length;f++)vn(e,o,t,n,r,false,u[c],u[f]);}return o}function gn(e,t,n,r,i,s,o,a){if(r.has(o,a,s))return;r.add(o,a,s);let u=e.getFragment(a);if(!u)return;let[c,f]=mr(e,n,u);if(o!==c){Tr(e,t,n,r,i,s,o,c);for(let d of f)gn(e,t,n,r,i,s,o,d);}}function vn(e,t,n,r,i,s,o,a){if(o===a||i.has(o,a,s))return;i.add(o,a,s);let u=e.getFragment(o),c=e.getFragment(a);if(!u||!c)return;let[f,d]=mr(e,n,u),[h,v]=mr(e,n,c);Tr(e,t,n,r,i,s,f,h);for(let g of v)vn(e,t,n,r,i,s,o,g);for(let g of d)vn(e,t,n,r,i,s,g,a);}function ws(e,t,n,r,i,s,o,a,u){let c=[],[f,d]=In(e,t,s,o),[h,v]=In(e,t,a,u);Tr(e,c,t,n,r,i,f,h);for(let g of v)gn(e,c,t,n,r,i,f,g);for(let g of d)gn(e,c,t,n,r,i,h,g);for(let g of d)for(let D of v)vn(e,c,t,n,r,i,g,D);return c}function ks(e,t,n,r,i,s){for(let[o,a]of Object.entries(s))if(a.length>1)for(let u=0;u<a.length;u++)for(let c=u+1;c<a.length;c++){let f=gi(e,n,r,i,false,o,a[u],a[c]);f&&t.push(f);}}function Tr(e,t,n,r,i,s,o,a){for(let[u,c]of Object.entries(o)){let f=a[u];if(f)for(let d of c)for(let h of f){let v=gi(e,n,r,i,s,u,d,h);v&&t.push(v);}}}function gi(e,t,n,r,i,s,o,a){let[u,c,f]=o,[d,h,v]=a,g=i||u!==d&&C(u)&&C(d);if(!g){let Y=c.name.value,I=h.name.value;if(Y!==I)return [[s,`"${Y}" and "${I}" are different fields`],[c],[h]];if(!Fs(c,h))return [[s,"they have differing arguments"],[c],[h]]}let D=f?.type,R=v?.type;if(D&&R&&dr(D,R))return [[s,`they return conflicting types "${N(D)}" and "${N(R)}"`],[c],[h]];let L=c.selectionSet,j=h.selectionSet;if(L&&j){let Y=ws(e,t,n,r,g,re(D),L,re(R),j);return Cs(Y,s,c,h)}}function Fs(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:Ei(o)===Ei(a)})}function Ei(e){return U(Nn(e))}function dr(e,t){return q(e)?q(t)?dr(e.ofType,t.ofType):true:q(t)?true:w(e)?w(t)?dr(e.ofType,t.ofType):true:w(t)?true:le(e)||le(t)?e!==t:false}function In(e,t,n,r){let i=t.get(r);if(i)return i;let s=Object.create(null),o=Object.create(null);vi(e,n,r,s,o);let a=[s,Object.keys(o)];return t.set(r,a),a}function mr(e,t,n){let r=t.get(n.selectionSet);if(r)return r;let i=H(e.getSchema(),n.typeCondition);return In(e,t,i,n.selectionSet)}function vi(e,t,n,r,i){for(let s of n.selections)switch(s.kind){case p.FIELD:{let o=s.name.value,a;(C(t)||$(t))&&(a=t.getFields()[o]);let u=s.alias?s.alias.value:o;r[u]||(r[u]=[]),r[u].push([t,s,a]);break}case p.FRAGMENT_SPREAD:i[s.name.value]=true;break;case p.INLINE_FRAGMENT:{let o=s.typeCondition,a=o?H(e.getSchema(),o):t;vi(e,a,s.selectionSet,r,i);break}}}function Cs(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 On=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);}},hr=class{constructor(){this._orderedPairSet=new On;}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);}};g();function Er(e){return {InlineFragment(t){let n=e.getType(),r=e.getParentType();if(ye(n)&&ye(r)&&!sn(e.getSchema(),n,r)){let i=N(r),s=N(n);e.reportError(new m(`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=$s(e,n),i=e.getParentType();if(r&&i&&!sn(e.getSchema(),r,i)){let s=N(i),o=N(r);e.reportError(new m(`Fragment "${n}" cannot be spread here as objects of type "${s}" can never be of type "${o}".`,{nodes:t}));}}}}function $s(e,t){let n=e.getFragment(t);if(n){let r=H(e.getSchema(),n.typeCondition);if(ye(r))return r}}g();({[p.SCALAR_TYPE_DEFINITION]:p.SCALAR_TYPE_EXTENSION,[p.OBJECT_TYPE_DEFINITION]:p.OBJECT_TYPE_EXTENSION,[p.INTERFACE_TYPE_DEFINITION]:p.INTERFACE_TYPE_EXTENSION,[p.UNION_TYPE_DEFINITION]:p.UNION_TYPE_EXTENSION,[p.ENUM_TYPE_DEFINITION]:p.ENUM_TYPE_EXTENSION,[p.INPUT_OBJECT_TYPE_DEFINITION]:p.INPUT_OBJECT_TYPE_EXTENSION});g();function gr(e){return {...vr(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)&&xe(s)){let o=N(s.type);e.reportError(new m(`Field "${r.name}" argument "${s.name}" of type "${o}" is required, but it was not provided.`,{nodes:t}));}}}}}function vr(e){var t;let n=Object.create(null),r=e.getSchema(),i=(t=r?.getDirectives())!==null&&t!==void 0?t:Ee;for(let a of i)n[a.name]=Ie(a.args.filter(xe),u=>u.name);let s=e.getDocument().definitions;for(let a of s)if(a.kind===p.DIRECTIVE_DEFINITION){var o;let u=(o=a.arguments)!==null&&o!==void 0?o:[];n[a.name.value]=Ie(u.filter(Ms),c=>c.name.value);}return {Directive:{leave(a){let u=a.name.value,c=n[u];if(c){var f;let d=(f=a.arguments)!==null&&f!==void 0?f:[],h=new Set(d.map(v=>v.name.value));for(let[v,g]of Object.entries(c))if(!h.has(v)){let D=st(g.type)?N(g.type):U(g.type);e.reportError(new m(`Directive "@${u}" argument "${v}" of type "${D}" is required, but it was not provided.`,{nodes:a}));}}}}}}function Ms(e){return e.type.kind===p.NON_NULL_TYPE&&e.defaultValue==null}g();function Ir(e){return {Field(t){let n=e.getType(),r=t.selectionSet;if(n)if(le(re(n))){if(r){let i=t.name.value,s=N(n);e.reportError(new m(`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=N(n);e.reportError(new m(`Field "${i}" of type "${s}" must have at least one field selected.`,{nodes:t}));}}else {let i=t.name.value,s=N(n);e.reportError(new m(`Field "${i}" of type "${s}" must have a selection of subfields. Did you mean "${i} { ... }"?`,{nodes:t}));}}}}g();g();g();g();function Ii(e){return e.map(t=>typeof t=="number"?"["+t.toString()+"]":"."+t).join("")}g();g();function Or(e,t,n){return {prev:e,key:t,typename:n}}function Se(e){let t=[],n=e;for(;n;)t.push(n.key),n=n.prev;return t.reverse()}function Oi(e,t,n=Gs){return Pt(e,t,n,void 0)}function Gs(e,t,n){let r="Invalid value "+N(t);throw e.length>0&&(r+=` at "value${Ii(e)}"`),n.message=r+": "+n.message,n}function Pt(e,t,n,r){if(w(t)){if(e!=null)return Pt(e,t.ofType,n,r);n(Se(r),e,new m(`Expected non-nullable type "${N(t)}" not to be null.`));return}if(e==null)return null;if(q(t)){let i=t.ofType;return un(e)?Array.from(e,(s,o)=>{let a=Or(r,o,void 0);return Pt(s,i,n,a)}):[Pt(e,i,n,r)]}if(V(t)){if(!ae(e)||Array.isArray(e)){n(Se(r),e,new m(`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(w(o.type)){let u=N(o.type);n(Se(r),e,new m(`Field "${o.name}" of required type "${u}" was not provided.`));}continue}i[o.name]=Pt(a,o.type,n,Or(r,o.name,t.name));}for(let o of Object.keys(e))if(!s[o]){let a=pe(o,Object.keys(t.getFields()));n(Se(r),e,new m(`Field "${o}" is not defined by type "${t.name}".`+se(a)));}if(t.isOneOf){let o=Object.keys(i);o.length!==1&&n(Se(r),e,new m(`Exactly one key must be specified for OneOf type "${t.name}".`));let a=o[0],u=i[a];u===null&&n(Se(r).concat(a),u,new m(`Field "${a}" must be non-null.`));}return {...i}}if(le(t)){let i;try{i=t.parseValue(e);}catch(s){s instanceof m?n(Se(r),e,s):n(Se(r),e,new m(`Expected type "${t.name}". `+s.message,{originalError:s}));return}return i===void 0&&n(Se(r),e,new m(`Expected type "${t.name}".`)),i}W(false,"Unexpected input type: "+N(t));}g();function Ue(e,t,n){if(e){if(e.kind===p.VARIABLE){let r=e.name.value;if(n==null||n[r]===void 0||!_i(n,r))return;let i=n[r];return i===null&&w(t)?void 0:i}if(w(t))return e.kind===p.NULL?void 0:Ue(e,t.ofType,n);if(e.kind===p.NULL)return null;if(q(t)){let r=t.ofType;if(e.kind===p.LIST){let s=[];for(let o of e.values)if(bi(o,n)){if(w(r))return;s.push(null);}else {let a=Ue(o,r,n);if(a===void 0)return;s.push(a);}return s}let i=Ue(e,r,n);return i===void 0?void 0:[i]}if(V(t)){if(e.kind!==p.OBJECT)return;let r=Object.create(null),i=Ie(e.fields,s=>s.name.value);for(let s of Object.values(t.getFields())){let o=i[s.name];if(!o||bi(o.value,n)){if(s.defaultValue!==void 0)r[s.name]=s.defaultValue;else if(w(s.type))return;continue}let a=Ue(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(le(t)){let r;try{r=t.parseLiteral(e,n);}catch{return}return r===void 0?void 0:r}W(false,"Unexpected input type: "+N(t));}}function bi(e,t){return e.kind===p.VARIABLE&&(t==null||t[e.name.value]===void 0||!_i(t,e.name.value))}function _i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function br(e,t,n){var r;let i=Object.create(null),s=(r=t.arguments)!==null&&r!==void 0?r:[],o=Ie(s,a=>a.name.value);for(let a of e.args){let u=a.name,c=a.type,f=o[u];if(!f){if(a.defaultValue!==void 0)i[u]=a.defaultValue;else if(w(c))throw new m(`Argument "${u}" of required type "${N(c)}" was not provided.`,{nodes:t});continue}let d=f.value,h=d.kind===p.NULL;if(d.kind===p.VARIABLE){let g=d.name.value;if(n==null||!Ps(n,g)){if(a.defaultValue!==void 0)i[u]=a.defaultValue;else if(w(c))throw new m(`Argument "${u}" of required type "${N(c)}" was provided the variable "$${g}" which was not provided a runtime value.`,{nodes:d});continue}h=n[g]==null;}if(h&&w(c))throw new m(`Argument "${u}" of non-null type "${N(c)}" must not be null.`,{nodes:d});let v=Ue(d,c,n);if(v===void 0)throw new m(`Argument "${u}" has invalid value ${U(d)}.`,{nodes:d});i[u]=v;}return {...i}}function Qt(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 br(e,i,n)}function Ps(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Di(e,t,n,r,i){let s=new Map;return Sr(e,t,n,r,i,s,new Set),s}function Sr(e,t,n,r,i,s,o){for(let a of i.selections)switch(a.kind){case p.FIELD:{if(!_r(n,a))continue;let u=Qs(a),c=s.get(u);c!==void 0?c.push(a):s.set(u,[a]);break}case p.INLINE_FRAGMENT:{if(!_r(n,a)||!Si(e,a,r))continue;Sr(e,t,n,r,a.selectionSet,s,o);break}case p.FRAGMENT_SPREAD:{let u=a.name.value;if(o.has(u)||!_r(n,a))continue;o.add(u);let c=t[u];if(!c||!Si(e,c,r))continue;Sr(e,t,n,r,c.selectionSet,s,o);break}}}function _r(e,t){let n=Qt(kt,t,e);if(n?.if===true)return false;let r=Qt(wt,t,e);return r?.if!==false}function Si(e,t,n){let r=t.typeCondition;if(!r)return true;let i=H(e,r);return i===n?true:Te(i)?e.isSubType(i,n):false}function Qs(e){return e.alias?e.alias.value:e.name.value}function Dr(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 c of o.definitions)c.kind===p.FRAGMENT_DEFINITION&&(a[c.name.value]=c);let u=Di(n,a,s,r,t.selectionSet);if(u.size>1){let d=[...u.values()].slice(1).flat();e.reportError(new m(i!=null?`Subscription "${i}" must select only one top level field.`:"Anonymous Subscription must select only one top level field.",{nodes:d}));}for(let c of u.values())c[0].name.value.startsWith("__")&&e.reportError(new m(i!=null?`Subscription "${i}" must not select an introspection top level field.`:"Anonymous Subscription must not select an introspection top level field.",{nodes:c}));}}}}}g();g();function ft(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}g();function bn(e){return {Field:t,Directive:t};function t(n){var r;let i=(r=n.arguments)!==null&&r!==void 0?r:[],s=ft(i,o=>o.name.value);for(let[o,a]of s)a.length>1&&e.reportError(new m(`There can be only one argument named "${o}".`,{nodes:a.map(u=>u.name)}));}}g();g();function _n(e){let t=Object.create(null),n=e.getSchema(),r=n?n.getDirectives():Ee;for(let u of r)t[u.name]=!u.isRepeatable;let i=e.getDocument().definitions;for(let u of i)u.kind===p.DIRECTIVE_DEFINITION&&(t[u.name.value]=!u.repeatable);let s=Object.create(null),o=Object.create(null),a=Object.create(null);return {enter(u){if(!("directives"in u)||!u.directives)return;let c;if(u.kind===p.SCHEMA_DEFINITION||u.kind===p.SCHEMA_EXTENSION)c=s;else if($e(u)||yn(u)){let f=u.name.value;c=o[f],c===void 0&&(o[f]=c=Object.create(null));}else if(u.kind===p.DIRECTIVE_DEFINITION||u.kind===p.DIRECTIVE_EXTENSION){let f=u.name.value;c=a[f],c===void 0&&(a[f]=c=Object.create(null));}else c=Object.create(null);for(let f of u.directives){let d=f.name.value;t[d]&&(c[d]?e.reportError(new m(`The directive "@${d}" can only be used once at this location.`,{nodes:[c[d],f]})):c[d]=f);}}}}g();g();g();function wr(e){let t=Object.create(null);return {OperationDefinition:()=>false,FragmentDefinition(n){let r=n.name.value;return t[r]?e.reportError(new m(`There can be only one fragment named "${r}".`,{nodes:[t[r],n.name]})):t[r]=n.name,false}}}g();function Sn(e){let t=[],n=Object.create(null);return {ObjectValue:{enter(){t.push(n),n=Object.create(null);},leave(){let r=t.pop();r||W(),n=r;}},ObjectField(r){let i=r.name.value;n[i]?e.reportError(new m(`There can be only one input field named "${i}".`,{nodes:[n[i],r.name]})):n[i]=r.name;}}}g();function kr(e){let t=Object.create(null);return {OperationDefinition(n){let r=n.name;return r&&(t[r.value]?e.reportError(new m(`There can be only one operation named "${r.value}".`,{nodes:[t[r.value],r]})):t[r.value]=r),false},FragmentDefinition:()=>false}}g();g();g();function $r(e){return {OperationDefinition(t){var n;let r=(n=t.variableDefinitions)!==null&&n!==void 0?n:[],i=ft(r,s=>s.variable.name.value);for(let[s,o]of i)o.length>1&&e.reportError(new m(`There can be only one variable named "$${s}".`,{nodes:o.map(a=>a.variable.name)}));}}}g();function Ur(e){return {ListValue(t){let n=ot(e.getParentInputType());if(!q(n))return qe(e,t),false},ObjectValue(t){let n=re(e.getInputType());if(!V(n))return qe(e,t),false;let r=Ie(t.fields,i=>i.name.value);for(let i of Object.values(n.getFields()))if(!r[i.name]&&at(i)){let o=N(i.type);e.reportError(new m(`Field "${n.name}.${i.name}" of required type "${o}" was not provided.`,{nodes:t}));}n.isOneOf&&qs(e,t,n,r);},ObjectField(t){let n=re(e.getParentInputType());if(!e.getInputType()&&V(n)){let i=pe(t.name.value,Object.keys(n.getFields()));e.reportError(new m(`Field "${t.name.value}" is not defined by type "${n.name}".`+se(i),{nodes:t}));}},NullValue(t){let n=e.getInputType();w(n)&&e.reportError(new m(`Expected value of type "${N(n)}", found ${U(t)}.`,{nodes:t}));},EnumValue:t=>qe(e,t),IntValue:t=>qe(e,t),FloatValue:t=>qe(e,t),StringValue:t=>qe(e,t),BooleanValue:t=>qe(e,t)}}function qe(e,t){let n=e.getInputType();if(!n)return;let r=re(n);if(!le(r)){let i=N(n);e.reportError(new m(`Expected value of type "${i}", found ${U(t)}.`,{nodes:t}));return}try{if(r.parseLiteral(t,void 0)===void 0){let s=N(n);e.reportError(new m(`Expected value of type "${s}", found ${U(t)}.`,{nodes:t}));}}catch(i){let s=N(n);i instanceof m?e.reportError(i):e.reportError(new m(`Expected value of type "${s}", found ${U(t)}; `+i.message,{nodes:t,originalError:i}));}}function qs(e,t,n,r){var i;let s=Object.keys(r);if(s.length!==1){e.reportError(new m(`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===p.NULL)&&e.reportError(new m(`Field "${n.name}.${s[0]}" must be non-null.`,{nodes:[t]}));}g();function Vr(e){return {VariableDefinition(t){let n=H(e.getSchema(),t.type);if(n!==void 0&&!oe(n)){let r=t.variable.name.value,i=U(t.type);e.reportError(new m(`Variable "$${r}" cannot be non-input type "${i}".`,{nodes:t.type}));}}}}g();function jr(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 u=i.name.value,c=t[u];if(c&&s){let f=e.getSchema(),d=H(f,c.type);if(d&&!Ys(f,d,c.defaultValue,s,o)){let h=N(d),v=N(s);e.reportError(new m(`Variable "$${u}" of type "${h}" used in position expecting type "${v}".`,{nodes:[c,i]}));}V(a)&&a.isOneOf&&bt(d)&&e.reportError(new m(`Variable "$${u}" is of type "${d}" but must be non-nullable to be used for OneOf Input Object "${a}".`,{nodes:[c,i]}));}}}},VariableDefinition(n){t[n.variable.name.value]=n;}}}function Ys(e,t,n,r,i){if(w(r)&&!w(t)){if(!(n!=null&&n.kind!==p.NULL)&&!(i!==void 0))return false;let a=r.ofType;return Re(e,t,a)}return Re(e,t,r)}var Mr=Object.freeze([ur]),Dn=Object.freeze([er,kr,or,Dr,En,nr,Vr,Ir,tr,wr,sr,lr,Er,pr,$r,cr,fr,Tn,_n,rr,bn,Ur,gr,jr,yr,Sn,...Mr]);g();var Gr=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===p.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===p.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 u=this.getFragment(a);u&&(n.push(u),i.push(u.selectionSet));}}this._recursivelyReferencedFragments.set(t,n);}return n}};var Bt=class extends Gr{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 Be(this._schema);Ge(t,Gt(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 Js=Me(yt,e=>e.filter(t=>t!=="description"));function Ai(e,t,n=Dn,r,i=new Be(e)){var s;let o=(s=r?.maxErrors)!==null&&s!==void 0?s:100;t||F(false,"Must provide document."),hn(e);let a=Object.freeze({}),u=[],c=new Bt(e,t,i,d=>{if(u.length>=o)throw u.push(new m("Too many validation errors, error limit reached. Validation aborted.")),a;u.push(d);}),f=jn(n.map(d=>d(c)));try{Ge(t,Gt(i,f),Js);}catch(d){if(d!==a)throw d}return u}g();g();function Li(e){return e instanceof Error?e:new Pr(e)}var Pr=class extends Error{constructor(t){super("Unexpected error value: "+N(t)),this.name="NonErrorThrown",this.thrownValue=t;}};function xi(e,t,n){var r;let i=Li(e);return Xs(i)?i:new m(i.message,{nodes:(r=i.nodes)!==null&&r!==void 0?r:t,source:i.source,positions:i.positions,path:n,originalError:i})}function Xs(e){return Array.isArray(e.path)}g();g();g();g();g();g();g();function Ri(e,t){let n=null;for(let i of e.definitions)if(i.kind===p.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}g();function Br(e){return Oo(e,t=>!an(t),Io)}function Io(e){return !on(e)&&!lt(e)}function Oo(e,t,n){let r=e.getDirectives().filter(t),i=Object.values(e.getTypeMap()).filter(n);return [bo(e),...r.map(s=>wo(s)),...i.map(s=>qr(s))].filter(Boolean).join(`
|
|
61
|
-
|
|
62
|
-
`)}function bo(e){if(e.description==null&&_o(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}`),ve(e)+`schema {
|
|
63
|
-
${t.join(`
|
|
64
|
-
`)}
|
|
65
|
-
}`}function _o(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 qr(e){if(he(e))return So(e);if(C(e))return Do(e);if($(e))return Ao(e);if(ne(e))return Lo(e);if(X(e))return xo(e);if(V(e))return Ro(e);W(false,"Unexpected type: "+N(e));}function So(e){return ve(e)+`scalar ${e.name}`+ko(e)}function wi(e){let t=e.getInterfaces();return t.length?" implements "+t.map(n=>n.name).join(" & "):""}function Do(e){return ve(e)+`type ${e.name}`+wi(e)+ki(e)}function Ao(e){return ve(e)+`interface ${e.name}`+wi(e)+ki(e)}function Lo(e){let t=e.getTypes(),n=t.length?" = "+t.join(" | "):"";return ve(e)+"union "+e.name+n}function xo(e){let t=e.getValues().map((n,r)=>ve(n," ",!r)+" "+n.name+An(n.deprecationReason));return ve(e)+`enum ${e.name}`+Yr(t)}function Ro(e){let t=Object.values(e.getFields()).map((n,r)=>ve(n," ",!r)+" "+Qr(n));return ve(e)+`input ${e.name}`+(e.isOneOf?" @oneOf":"")+Yr(t)}function ki(e){let t=Object.values(e.getFields()).map((n,r)=>ve(n," ",!r)+" "+n.name+Fi(n.args," ")+": "+String(n.type)+An(n.deprecationReason));return Yr(t)}function Yr(e){return e.length!==0?` {
|
|
66
|
-
`+e.join(`
|
|
67
|
-
`)+`
|
|
68
|
-
}`:""}function Fi(e,t=""){return e.length===0?"":e.every(n=>!n.description)?"("+e.map(Qr).join(", ")+")":`(
|
|
69
|
-
`+e.map((n,r)=>ve(n," "+t,!r)+" "+t+Qr(n)).join(`
|
|
70
|
-
`)+`
|
|
71
|
-
`+t+")"}function Qr(e){let t=we(e.defaultValue,e.type),n=e.name+": "+String(e.type);return t&&(n+=` = ${U(t)}`),n+An(e.deprecationReason)}function wo(e){return ve(e)+"directive @"+e.name+Fi(e.args)+An(e.deprecationReason)+(e.isRepeatable?" repeatable":"")+" on "+e.locations.join(" | ")}function An(e){return e==null?"":e!==Ft?` @deprecated(reason: ${U({kind:p.STRING,value:e})})`:" @deprecated"}function ko(e){return e.specifiedByURL==null?"":` @specifiedBy(url: ${U({kind:p.STRING,value:e.specifiedByURL})})`}function ve(e,t="",n=true){let{description:r}=e;if(r==null)return "";let i=U({kind:p.STRING,value:r,block:Hr(r)});return (t&&!n?`
|
|
72
|
-
`+t:t)+i.replace(/\n/g,`
|
|
73
|
-
`+t)+`
|
|
74
|
-
`}g();var Ln=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)&&!this.pending.get(r)?.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),this.flushScheduled||(this.flushScheduled=true,queueMicrotask(()=>{this.flushScheduled=false,this.flushAll();})),new Promise(o=>{let a=this.waiting.get(`${r}:${n}`);a||(a=[],this.waiting.set(`${r}:${n}`,a)),a.push(o);})}async flushAll(){for(let[t,n]of this.pending){if(n.size===0)continue;let r=t,i=Array.from(n);this.pending.delete(t);try{let s=await this.db.find({collection:r,where:{id:{in:i}},limit:i.length,tenantId:this.tenantId}),o=this.caches.get(t)||new Map,a=new Map;for(let u of s.docs)a.set(u.id,u),o.set(u.id,u);for(let u of i){let c=this.waiting.get(`${t}:${u}`);if(c){let f=a.get(u);for(let d of c)d(f);this.waiting.delete(`${t}:${u}`);}}}catch(s){console.error(`[RelationLoader] Failed to batch load ${r}:`,s);for(let o of i){let a=this.waiting.get(`${t}:${o}`);if(a){for(let u of a)u(void 0);this.waiting.delete(`${t}:${o}`);}}}}}async loadMany(t,n){return Promise.all(n.map(r=>this.load(t,r)))}resolveOne(t,n){return this.caches.get(this.getCacheKey(t))?.get(n)}};var fe=new me({name:"JSON",description:"Arbitrary JSON value",serialize(e){return e},parseValue(e){return e},parseLiteral(e){switch(e.kind){case p.STRING:return e.value;case p.INT:case p.FLOAT:return parseFloat(e.value);case p.BOOLEAN:return e.value;case p.OBJECT:{let t={};for(let n of e.fields)t[n.name.value]=fe.parseLiteral(n.value);return t}case p.LIST:return e.values.map(t=>fe.parseLiteral(t));case p.NULL:return null;default:return null}}});function Co(e){return t=>{let n=0;return {Field(){n++,n>e&&t.reportError(new Error(`Query exceeds max depth of ${e}`));},leaveField(){n--;}}}}function P(e){return e.split(/[-_]/).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function Kr(e){let t=P(e);return t.charAt(0).toLowerCase()+t.slice(1)}function ge(e){return e.endsWith("s")&&e.length>1?e.slice(0,-1):e}async function dt(e$1,t,n){let r=e$1.access?.[t];if(n.apiKey){if(n.apiKey.permissions?.length>0){let s=e$1.slug,a=`${s}:${t==="read"?"read":t==="create"?"create":"update"}`;return !e(n.apiKey.permissions,a)&&!e(n.apiKey.permissions,`${s}:admin`)?{allowed:false}:{allowed:true}}if(r){let s=await h(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$1.slug,a$1=`${s}:${t==="read"?"read":t==="create"?"create":t==="update"?"update":"delete"}`;if(!a({id:n.user.id,email:n.user.email,role:n.user.role},a$1)&&!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 h(r,{req:n.req,user:n.user,tenantId:n.tenantId});return typeof i=="boolean"?{allowed:i}:{allowed:true,extraWhere:i}}async function Ci(e$1,t,n){let r=e$1.access?.[t];if(n.apiKey){if(n.apiKey.permissions?.length>0){let s=e$1.slug,o=`${s}:${t}`;return !e(n.apiKey.permissions,o)&&!e(n.apiKey.permissions,`${s}:admin`)&&!e(n.apiKey.permissions,`${s}:*`)?{allowed:false}:{allowed:true}}if(r){let s=await h(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 h(r,{req:n.req,user:n.user,tenantId:n.tenantId});return typeof i=="boolean"?{allowed:i}:{allowed:true}}function $i(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 Ve(e,t){return e&&(e.url&&(e.url=$i(e.url,t)),e.thumbnailUrl&&(e.thumbnailUrl=$i(e.thumbnailUrl,t)),e)}function Ye(e,t,n,r=false,i="Root",s=new Map){switch(e.type){case "text":case "email":case "password":case "textarea":case "color":case "code":case "markdown":case "date":case "select":case "radio":return e.hasMany?new M(S):S;case "list":return new M(S);case "upload":{let o=e;if(r)return o.hasMany?new M(S):S;if(o.relationTo&&n?.[o.relationTo]){let a=n[o.relationTo];return o.hasMany?new M(a):a}return fe}case "image":{if(r)return S;let o=e;return o.relationTo&&n?.[o.relationTo]?n[o.relationTo]:fe}case "number":{let o=e.integer?be:At;return e.hasMany?new M(o):o}case "checkbox":return K;case "json":case "richtext":return fe;case "blocks":{if(r)return fe;let o=e,a=(o.blocks||[]).map(f=>{let d=`Block_${P(f.slug)}`,h=s.get(d);return h||(h=new G({name:d,fields:()=>{let v=Ke(f.fields||[],t,n,d,s);return v.blockType={type:S},v.name={type:S},v}}),s.set(d,h)),h});if(a.length===0)return fe;let u=`${i}_${P(o.name)}_Blocks`,c=s.get(u);return c||(c=new ke({name:u,types:a,resolveType:f=>`Block_${P(f.blockType||f.type)}`}),s.set(u,c)),new M(c)}case "tabs":{if(r)return fe;let o=e,a=`${i}_${P(o.name)}_Tabs`,u=s.get(a);return u||(u=new G({name:a,fields:()=>Ke(o.tabs?.flatMap(c=>c.fields||[])||[],t,n,a,s)}),s.set(a,u)),u}case "relationship":{let o=e.relationTo;if((o==="*"||Array.isArray(o)&&o.includes("*"))&&(o=t.getCollections().map(a=>a.slug)),typeof o=="string"){if(r)return e.hasMany?new M(S):S;if(n?.[o])return e.hasMany?new M(n[o]):n[o];let a=t.getCollection(o);if(a)return new G({name:`${P(o)}Ref`,fields:()=>({id:{type:S},...xn(a,t,n,s)})})}else if(Array.isArray(o)){if(r)return e.hasMany?new M(fe):fe;let a=o.map(h=>{if(n?.[h])return n[h];let v=t.getCollection(h);if(v){let g=s.get(`${P(h)}Ref`);return g||(g=new G({name:`${P(h)}Ref`,fields:()=>({id:{type:S},...xn(v,t,n,s)})}),s.set(`${P(h)}Ref`,g)),g}return null}).filter(Boolean);if(a.length===0)return fe;let u=`${i}_${P(e.name||"Ref")}_PolyUnion`,c=s.get(u);c||(c=new ke({name:u,types:a,resolveType:h=>{if(h.__collection&&h.__collection!=="*")return n?.[h.__collection]?n[h.__collection].name:`${P(h.__collection)}Ref`}}),s.set(u,c));let f=`${i}_${P(e.name||"Ref")}_PolyWrapper`,d=s.get(f);return d||(d=new G({name:f,fields:{relationTo:{type:S},value:{type:c}}}),s.set(f,d)),e.hasMany?new M(d):d}return fe}case "array":{if(r)return new M(fe);let o=e,a=`${i}_${P(o.name)}_ArrayItem`,u=s.get(a);return u||(u=new G({name:a,fields:()=>{let c=Ke(o.fields||[],t,n,a,s);return c.id={type:S},c}}),s.set(a,u)),new M(u)}case "group":{if(r)return fe;let o=e,a=`${i}_${P(o.name)}_Group`,u=s.get(a);return u||(u=new G({name:a,fields:()=>Ke(o.fields||[],t,n,a,s)}),s.set(a,u)),u}default:return S}}function Ke(e,t,n,r,i=new Map){let s={};for(let o of e){if(o.type==="tabs"&&!o.name){for(let a of o.tabs||[]){let u=Ke(a.fields||[],t,n,r,i);Object.assign(s,u);}continue}if(o.type==="row"||o.type==="collapsible"){let a=Ke(o.fields||[],t,n,r,i);Object.assign(s,a);continue}if(o.name&&o.admin?.hidden!==true){let a=$o(o,t,n,r,i);a&&(s[o.name]=a);}}return s}function xn(e,t,n,r=new Map){return Ke(e.fields,t,n,P(ge(e.slug)),r)}function $o(e,t,n,r,i=new Map){if(!e.name)return null;let s=e.deprecated||void 0;if(e.type==="upload"){let a=Ye(e,t,n,false,r,i),u=e;return {type:a,description:e.admin?.description||e.label,deprecationReason:s,resolve:async(c,f,d)=>{let h=d?.relationLoader,v=c?.[u.name],g=d?.req?.url?new URL(d.req.url).origin:void 0;if(!v)return null;if(u.hasMany){let R=Array.isArray(v)?v:[];return Promise.all(R.map(async L=>{let j=typeof L=="string"?L:L?.id;if(!j||typeof L=="object"&&L?.url)return Ve(L,g);if(h){let Y=h.resolveOne(u.relationTo,j);if(Y)return Ve(Y,g);let I=await h.load(u.relationTo,j);return I?Ve(I,g):null}return {id:j}}))}let D=typeof v=="string"?v:v?.id;if(!D||typeof v=="object"&&v?.url)return Ve(v,g);if(h){let R=h.resolveOne(u.relationTo,D);if(R)return Ve(R,g);let L=await h.load(u.relationTo,D);return L?Ve(L,g):null}return {id:D}}}}return e.type==="relationship"&&!e.hasMany?{type:Ye(e,t,n,false,r,i),description:e.admin?.description||e.label,deprecationReason:s,resolve:async(u,c,f)=>{let d=f?.relationLoader,h=e,v=u?.[h.name];if(!v)return null;let g=Array.isArray(h.relationTo)||h.relationTo==="*",D=g?v?.relationTo:h.relationTo,R=g?v?.value:v;if(g&&typeof v=="string"&&(D=h.relationTo[0],R=v),g&&D==="*")return null;if(d&&typeof R=="string"&&typeof D=="string"&&D!=="*"){let j=d.resolveOne(D,R);if(j)return g?{relationTo:D,value:{...j,__collection:D}}:j;let Y=await d.load(D,R);return Y?g?{relationTo:D,value:{...Y,__collection:D}}:Y:null}let L=typeof R=="object"&&R!==null?R:{id:R};return g?{relationTo:D,value:{...L,__collection:D}}:L}}:e.type==="relationship"&&e.hasMany?{type:Ye(e,t,n,false,r,i),description:e.admin?.description||e.label,deprecationReason:s,resolve:async(u,c,f)=>{let d=f?.relationLoader,h=e,v=u?.[h.name]||[];if(typeof v=="string")try{v=JSON.parse(v);}catch{}if(Array.isArray(v)||(v=[]),!v.length)return [];let g=Array.isArray(h.relationTo)||h.relationTo==="*";if(d){let D=[];for(let R of v){let L=g?R?.relationTo:h.relationTo,j=g?R?.value:R;if(g&&typeof R=="string"&&(L=h.relationTo[0],j=R),g&&L==="*")continue;if(typeof j=="string"&&typeof L=="string"&&L!=="*"){let I=d.resolveOne(L,j);if(I){D.push(g?{relationTo:L,value:{...I,__collection:L}}:I);continue}let Q=await d.load(L,j);if(Q){D.push(g?{relationTo:L,value:{...Q,__collection:L}}:Q);continue}continue}let Y=typeof j=="object"&&j!==null?j:{id:j};D.push(g?{relationTo:L,value:{...Y,__collection:L}}:Y);}return D}return v.map(D=>{let R=g?D?.relationTo:h.relationTo,L=g?D?.value:D;g&&typeof D=="string"&&(R=h.relationTo[0],L=D);let j=typeof L=="object"&&L!==null?L:{id:L};return g?{relationTo:R,value:{...j,__collection:R}}:j})}}:e.type==="blocks"?{type:Ye(e,t,n,false,r,i),description:e.admin?.description||e.label,deprecationReason:s,resolve:u=>{let c=u?.[e.name];if(typeof c=="string")try{c=JSON.parse(c);}catch{}return Array.isArray(c)?c.map(f=>f&&f.data&&f.type?{...f.data,id:f.id,type:f.type,blockType:f.type,name:f.name}:f):c}}:{type:Ye(e,t,n,false,r,i),description:e.admin?.description||e.label,deprecationReason:s,resolve:a=>{let u=a?.[e.name];if(typeof u=="string"&&["array","group","tabs","blocks","json","richtext","list"].includes(e.type))try{u=JSON.parse(u);}catch{}return u}}}function Ui(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 c=t.getCollections(),f=t.getGlobals(),d={},h={},v=new Map;for(let I of c){d[I.slug]=new G({name:P(ge(I.slug)),fields:()=>({id:{type:S},...xn(I,t,d,v),...I.timestamps?{createdAt:{type:S},updatedAt:{type:S}}:{},...I.tenantScoped?{tenantId:{type:S}}:{}})});let Q={};for(let z of I.fields)z.name&&z.name!=="id"&&(Q[z.name]={type:Ye(z,t,d,true)});h[I.slug]=new Ce({name:`${P(ge(I.slug))}Input`,fields:()=>Q});}let g={},D={};for(let I of f)g[I.slug]=new G({name:`${P(I.slug)}Global`,fields:()=>({id:{type:S},...xn({slug:I.slug,fields:I.fields},t,d)})}),D[I.slug]=new Ce({name:`${P(I.slug)}GlobalInput`,fields:()=>{let Q={};for(let z of I.fields)z.name&&z.name!=="id"&&(Q[z.name]={type:Ye(z,t,d,true)});return Q}});let R={};for(let I of c){let Q=d[I.slug];Q&&(R[Kr(I.slug)]={type:new G({name:`${P(ge(I.slug))}FindResult`,fields:{docs:{type:new M(Q)},totalDocs:{type:be},page:{type:be},totalPages:{type:be},hasNextPage:{type:K},hasPrevPage:{type:K}}}),args:{where:{type:S},sort:{type:S},limit:{type:be},page:{type:be},draft:{type:K}},resolve:async(z,B,b)=>{let k=await dt(I,"read",{user:b.user,req:b.req,tenantId:b.tenantId,apiKey:b.apiKey});if(!k.allowed)throw new Error("Access denied");b.tenantId&&n.setTenantContext({tenantId:b.tenantId,userId:b.user?.id??"",role:b.user?.role,isSuperAdmin:b.user?.role==="super_admin"});let ie={};if(B.where)try{ie=JSON.parse(B.where);}catch{}k.extraWhere&&(ie={...ie,...k.extraWhere});let De=B.draft??!!b.user;return n.find({collection:I.slug,where:ie,sort:B.sort,limit:B.limit||10,page:B.page||1,tenantId:b.tenantId,draft:De})}},R[Kr(ge(I.slug))]={type:Q,args:{id:{type:S},slug:{type:S},draft:{type:K}},resolve:async(z,B,b)=>{if(!B.id&&!B.slug)throw new Error("Either id or slug is required");if(!(await dt(I,"read",{user:b.user,req:b.req,tenantId:b.tenantId,apiKey:b.apiKey})).allowed)throw new Error("Access denied");b.tenantId&&n.setTenantContext({tenantId:b.tenantId,userId:b.user?.id??"",role:b.user?.role,isSuperAdmin:b.user?.role==="super_admin"});let ie=B.draft??!!b.user;return B.id?n.findByID({collection:I.slug,id:B.id,tenantId:b.tenantId,draft:ie}):(await n.find({collection:I.slug,where:{slug:{equals:B.slug}},limit:1,page:1,tenantId:b.tenantId,draft:ie})).docs?.[0]||null}},R[`count${P(I.slug)}`]={type:new G({name:`${P(ge(I.slug))}Count`,fields:{totalDocs:{type:be}}}),args:{where:{type:S}},resolve:async(z,B,b)=>{if(!(await dt(I,"read",{user:b.user,req:b.req,tenantId:b.tenantId,apiKey:b.apiKey})).allowed)return {totalDocs:0};let ie={};if(B.where)try{ie=JSON.parse(B.where);}catch{}return {totalDocs:await n.count({collection:I.slug,where:ie,tenantId:b.tenantId})}}});}for(let I of f){let Q=g[I.slug];Q&&(R[Kr(ge(I.slug))]={type:Q,resolve:async(z,B,b)=>{if(!(await Ci(I,"read",{user:b.user,req:b.req,tenantId:b.tenantId,apiKey:b.apiKey})).allowed)throw new Error("Access denied: cannot read global");return b.tenantId&&n.setTenantContext({tenantId:b.tenantId,userId:b.user?.id??"",role:b.user?.role,isSuperAdmin:b.user?.role==="super_admin"}),n.findOne({collection:`_globals_${I.slug}`,where:{},tenantId:b.tenantId})}});}let L=new G({name:"Query",fields:R}),j={};for(let I of c){let Q=d[I.slug],z=h[I.slug];!Q||!z||(j[`create${P(ge(I.slug))}`]={type:new G({name:`${P(ge(I.slug))}CreateResult`,fields:{doc:{type:Q},message:{type:S}}}),args:{data:{type:new A(z)}},resolve:async(B,b,k)=>{if(!(await dt(I,"create",{user:k.user,req:k.req,tenantId:k.tenantId,apiKey:k.apiKey})).allowed)throw new Error("Access denied: cannot create");k.tenantId&&n.setTenantContext({tenantId:k.tenantId,userId:k.user?.id??"",role:k.user?.role,isSuperAdmin:k.user?.role==="super_admin"});let Rn=t.getCreateZodSchema(I.slug).parse(b.data);return {doc:await n.create({collection:I.slug,data:Rn,tenantId:k.tenantId}),message:"Created successfully"}}},j[`update${P(ge(I.slug))}`]={type:new G({name:`${P(ge(I.slug))}UpdateResult`,fields:{doc:{type:Q},message:{type:S}}}),args:{id:{type:new A(S)},data:{type:new A(z)},baseUpdatedAt:{type:S}},resolve:async(B,b,k)=>{if(!(await dt(I,"update",{user:k.user,req:k.req,tenantId:k.tenantId,apiKey:k.apiKey})).allowed)throw new Error("Access denied: cannot update");if(k.tenantId&&n.setTenantContext({tenantId:k.tenantId,userId:k.user?.id??"",role:k.user?.role,isSuperAdmin:k.user?.role==="super_admin"}),b.baseUpdatedAt){let qt=await n.findByID({collection:I.slug,id:b.id,tenantId:k.tenantId,draft:true});if(qt&&qt.updatedAt&&b.baseUpdatedAt!==qt.updatedAt)throw new Error(`Revision conflict: document has changed since ${b.baseUpdatedAt}. Current updatedAt: ${qt.updatedAt}`)}let Rn=t.getUpdateZodSchema(I.slug).parse(b.data);return {doc:await n.update({collection:I.slug,id:b.id,data:Rn,tenantId:k.tenantId}),message:"Updated successfully"}}},j[`delete${P(ge(I.slug))}`]={type:new G({name:`${P(ge(I.slug))}DeleteResult`,fields:{doc:{type:Q},message:{type:S}}}),args:{id:{type:new A(S)}},resolve:async(B,b,k)=>{if(!(await dt(I,"delete",{user:k.user,req:k.req,tenantId:k.tenantId,apiKey:k.apiKey})).allowed)throw new Error("Access denied: cannot delete");return k.tenantId&&n.setTenantContext({tenantId:k.tenantId,userId:k.user?.id??"",role:k.user?.role,isSuperAdmin:k.user?.role==="super_admin"}),{doc:await n.delete({collection:I.slug,id:b.id,tenantId:k.tenantId}),message:"Deleted successfully"}}});}for(let I of f){let Q=D[I.slug];Q&&(j[`update${P(I.slug)}`]={type:new G({name:`${P(I.slug)}UpdateResult`,fields:{doc:{type:g[I.slug]||S},message:{type:S}}}),args:{data:{type:new A(Q)}},resolve:async(z,B,b)=>{if(!(await Ci(I,"update",{user:b.user,req:b.req,tenantId:b.tenantId,apiKey:b.apiKey})).allowed)throw new Error("Access denied: cannot update global");b.tenantId&&n.setTenantContext({tenantId:b.tenantId,userId:b.user?.id??"",role:b.user?.role,isSuperAdmin:b.user?.role==="super_admin"});let ie=await n.findOne({collection:`_globals_${I.slug}`,where:{},tenantId:b.tenantId}),De;return ie?De=await n.update({collection:`_globals_${I.slug}`,id:ie.id,data:B.data,tenantId:b.tenantId}):De=await n.create({collection:`_globals_${I.slug}`,data:B.data,tenantId:b.tenantId}),{doc:De,message:"Updated successfully"}}});}let Y=new G({name:"Mutation",fields:j});return new Pe({query:L,mutation:Y})}function Uo(e,t,n){return Ui({registry:e,db:t,user:n?.user,req:n?.req,tenantId:n?.tenantId,apiKey:n?.apiKey})}
|
|
75
|
-
export{Ue as A,Qt as B,Dn as C,Ai as D,xi as E,Ri as F,Br as G,Ln as H,Co as I,Ui as J,Uo as K,ji as a,m as b,_ as c,p as d,si as e,U as f,rt as g,C as h,q as i,w as j,oe as k,le as l,Te as m,A as n,be as o,S as p,K as q,Ae as r,wt as s,kt as t,$t as u,Ut as v,Vt as w,hn as x,H as y,Oi as z};
|
package/dist/chunk-X6HUA6EF.cjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),r=require('path'),m=require('fs');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var r__default=/*#__PURE__*/_interopDefault(r);var m__default=/*#__PURE__*/_interopDefault(m);chunkBUNLC3II_cjs.h();var l=o=>{let s=r__default.default.join(process.cwd(),"node_modules","@kyro-cms","core"),e=r__default.default.resolve(s,"src",`${o}.ts`);return m__default.default.existsSync(e)?e:r__default.default.resolve(s,"dist",`${o}.js`)},E=l("api-handler"),A=l("api-handler-graphql"),P=l("api-handler-trpc"),S=["@kyro-cms/core","@kyro-cms/admin","@kyro-cms/astro","@kyro-cms/ai"],x=["@kyro-cms/connect"],R=[...S,...x],_=["better-sqlite3","pg","mongodb","ioredis","sharp","ssh2","cpu-features","ssh2-sftp-client","nodemailer","jsonwebtoken","@mapbox/node-pre-gyp","mock-aws-s3","aws-sdk","nock","cloudflare:workers"],N=["crypto","node:crypto","module","node:module","fs","node:fs","fs/promises","node:fs/promises","path","node:path","util","node:util","stream","node:stream","events","node:events","url","node:url","http","node:http","https","node:https","os","node:os","child_process","node:child_process","assert","node:assert","zlib","node:zlib","buffer","node:buffer"],h=[...S,..._],O=[...R,...N,..._];function k(o={}){let{configPath:s="./kyro.config.ts",apiPath:e="/api",adminPath:a="/admin",admin:v=true,enableGraphQL:c=false,enableTRPC:p=false,enableWebSocket:d=false}=o;return {name:"@kyro-cms/core",hooks:{"astro:config:setup":async({config:y,updateConfig:b,injectRoute:i,logger:n,addDevToolbarApp:T})=>{if(n.info(`Setting up Kyro CMS (API: ${e}, Admin: ${a})`),e===a)throw new Error(`Kyro CMS: apiPath and adminPath cannot be the same ("${e}")`);let u=r__default.default.resolve(y.root.pathname,s),g=u;m__default.default.existsSync(u)||n.warn(`Kyro config file not found at ${s}. The API will fail to boot if collections are needed.`),b({security:{checkOrigin:false},vite:{ssr:{external:O},build:{rollupOptions:{external:h}},optimizeDeps:{exclude:h},server:{watch:{ignored:["**/*.db","**/*.db-*","**/data/**","**/public/uploads/**","**/.kyro/**"]}},plugins:[{name:"use-sync-external-store-shim-fix",enforce:"pre",resolveId(t){if(t==="use-sync-external-store/shim"||t==="use-sync-external-store/shim/index.js")return "\0virtual:use-sync-external-store-shim";if(t==="use-sync-external-store/shim/with-selector"||t==="use-sync-external-store/shim/with-selector.js")return "\0virtual:use-sync-external-store-shim-with-selector"},load(t){if(t==="\0virtual:use-sync-external-store-shim")return 'export { useSyncExternalStore } from "react";';if(t==="\0virtual:use-sync-external-store-shim-with-selector")return `
|
|
2
|
-
import { useSyncExternalStore, useMemo } from "react";
|
|
3
|
-
export function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
4
|
-
const memoizedSelector = useMemo(() => {
|
|
5
|
-
let last, lastSnap, hasMemo = false;
|
|
6
|
-
return (snap) => {
|
|
7
|
-
if (!hasMemo || !Object.is(lastSnap, snap)) {
|
|
8
|
-
const next = selector(snap);
|
|
9
|
-
if (!hasMemo || !(isEqual ? isEqual(last, next) : Object.is(last, next))) {
|
|
10
|
-
last = next; lastSnap = snap; hasMemo = true;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return last;
|
|
14
|
-
};
|
|
15
|
-
}, [selector, isEqual]);
|
|
16
|
-
const getSelection = () => memoizedSelector(getSnapshot());
|
|
17
|
-
const getServerSelection = getServerSnapshot != null ? () => memoizedSelector(getServerSnapshot()) : undefined;
|
|
18
|
-
return useSyncExternalStore(subscribe, getSelection, getServerSelection);
|
|
19
|
-
}
|
|
20
|
-
`}}],resolve:{alias:{debug:"debug/src/node.js","kyro:config":g}},define:{__KYRO_API_PATH__:JSON.stringify(e),__KYRO_ADMIN_PATH__:JSON.stringify(a),__KYRO_ENABLE_GRAPHQL__:JSON.stringify(c),__KYRO_ENABLE_TRPC__:JSON.stringify(p),__KYRO_ENABLE_WS__:JSON.stringify(d)}}}),i({pattern:`${e}/[...path]`,entrypoint:E}),c&&(i({pattern:`${e}/graphql`,entrypoint:A}),n.info(`GraphQL endpoint enabled at ${e}/graphql`)),p&&(i({pattern:`${e}/trpc/[...path]`,entrypoint:P}),n.info(`tRPC endpoint enabled at ${e}/trpc`)),d&&n.info("WebSocket support enabled (auto-starts at first request)");}}}}exports.a=k;
|
package/dist/chunk-XDPLVJRO.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import {g}from'./chunk-Y2YAKDEQ.js';import r from'path';import m from'fs';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
|
-
g();var l=o=>{let s=r.join(process.cwd(),"node_modules","@kyro-cms","core"),e=r.resolve(s,"src",`${o}.ts`);return m.existsSync(e)?e:r.resolve(s,"dist",`${o}.js`)},E=l("api-handler"),A=l("api-handler-graphql"),P=l("api-handler-trpc"),S=["@kyro-cms/core","@kyro-cms/admin","@kyro-cms/astro","@kyro-cms/ai"],x=["@kyro-cms/connect"],R=[...S,...x],_=["better-sqlite3","pg","mongodb","ioredis","sharp","ssh2","cpu-features","ssh2-sftp-client","nodemailer","jsonwebtoken","@mapbox/node-pre-gyp","mock-aws-s3","aws-sdk","nock","cloudflare:workers"],N=["crypto","node:crypto","module","node:module","fs","node:fs","fs/promises","node:fs/promises","path","node:path","util","node:util","stream","node:stream","events","node:events","url","node:url","http","node:http","https","node:https","os","node:os","child_process","node:child_process","assert","node:assert","zlib","node:zlib","buffer","node:buffer"],h=[...S,..._],O=[...R,...N,..._];function k(o={}){let{configPath:s="./kyro.config.ts",apiPath:e="/api",adminPath:a="/admin",admin:v=true,enableGraphQL:c=false,enableTRPC:p=false,enableWebSocket:d=false}=o;return {name:"@kyro-cms/core",hooks:{"astro:config:setup":async({config:y,updateConfig:b,injectRoute:i,logger:n,addDevToolbarApp:T})=>{if(n.info(`Setting up Kyro CMS (API: ${e}, Admin: ${a})`),e===a)throw new Error(`Kyro CMS: apiPath and adminPath cannot be the same ("${e}")`);let u=r.resolve(y.root.pathname,s),g=u;m.existsSync(u)||n.warn(`Kyro config file not found at ${s}. The API will fail to boot if collections are needed.`),b({security:{checkOrigin:false},vite:{ssr:{external:O},build:{rollupOptions:{external:h}},optimizeDeps:{exclude:h},server:{watch:{ignored:["**/*.db","**/*.db-*","**/data/**","**/public/uploads/**","**/.kyro/**"]}},plugins:[{name:"use-sync-external-store-shim-fix",enforce:"pre",resolveId(t){if(t==="use-sync-external-store/shim"||t==="use-sync-external-store/shim/index.js")return "\0virtual:use-sync-external-store-shim";if(t==="use-sync-external-store/shim/with-selector"||t==="use-sync-external-store/shim/with-selector.js")return "\0virtual:use-sync-external-store-shim-with-selector"},load(t){if(t==="\0virtual:use-sync-external-store-shim")return 'export { useSyncExternalStore } from "react";';if(t==="\0virtual:use-sync-external-store-shim-with-selector")return `
|
|
3
|
-
import { useSyncExternalStore, useMemo } from "react";
|
|
4
|
-
export function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
5
|
-
const memoizedSelector = useMemo(() => {
|
|
6
|
-
let last, lastSnap, hasMemo = false;
|
|
7
|
-
return (snap) => {
|
|
8
|
-
if (!hasMemo || !Object.is(lastSnap, snap)) {
|
|
9
|
-
const next = selector(snap);
|
|
10
|
-
if (!hasMemo || !(isEqual ? isEqual(last, next) : Object.is(last, next))) {
|
|
11
|
-
last = next; lastSnap = snap; hasMemo = true;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return last;
|
|
15
|
-
};
|
|
16
|
-
}, [selector, isEqual]);
|
|
17
|
-
const getSelection = () => memoizedSelector(getSnapshot());
|
|
18
|
-
const getServerSelection = getServerSnapshot != null ? () => memoizedSelector(getServerSnapshot()) : undefined;
|
|
19
|
-
return useSyncExternalStore(subscribe, getSelection, getServerSelection);
|
|
20
|
-
}
|
|
21
|
-
`}}],resolve:{alias:{debug:"debug/src/node.js","kyro:config":g}},define:{__KYRO_API_PATH__:JSON.stringify(e),__KYRO_ADMIN_PATH__:JSON.stringify(a),__KYRO_ENABLE_GRAPHQL__:JSON.stringify(c),__KYRO_ENABLE_TRPC__:JSON.stringify(p),__KYRO_ENABLE_WS__:JSON.stringify(d)}}}),i({pattern:`${e}/[...path]`,entrypoint:E}),c&&(i({pattern:`${e}/graphql`,entrypoint:A}),n.info(`GraphQL endpoint enabled at ${e}/graphql`)),p&&(i({pattern:`${e}/trpc/[...path]`,entrypoint:P}),n.info(`tRPC endpoint enabled at ${e}/trpc`)),d&&n.info("WebSocket support enabled (auto-starts at first request)");}}}}export{k as a};
|
package/dist/chunk-XDQVYCIR.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();var t={slug:"users",label:"Users",auth:true,fields:[{name:"name",type:"text",label:"Name"},{name:"email",type:"email",required:true},{name:"passwordHash",type:"text",label:"Password Hash",admin:{hidden:true}},{name:"role",type:"select",options:[{label:"Super Admin",value:"super_admin"},{label:"Admin",value:"admin"},{label:"Editor",value:"editor"},{label:"Author",value:"author"},{label:"Customer",value:"customer"},{label:"Guest",value:"guest"}],required:true},{name:"avatar",type:"upload",relationTo:"media",label:"Profile Picture"},{name:"tenantId",type:"text",label:"Tenant"},{name:"emailVerified",type:"checkbox",label:"Email Verified"},{name:"locked",type:"checkbox"},{name:"lastLogin",type:"date",time:true,label:"Last Login",admin:{readOnly:true}},{name:"failedLoginAttempts",type:"number",label:"Failed Login Attempts",admin:{readOnly:true}},{name:"metadata",type:"json",label:"Metadata",admin:{hidden:true}}],timestamps:true,admin:{useAsTitle:"email",defaultColumns:["email","role","tenantId","lastLogin"]}},a={slug:"audit_logs",label:"Audit Logs",access:{create:()=>false,update:()=>false,delete:()=>false},fields:[{name:"action",type:"text",required:true},{name:"userId",type:"text",label:"User ID"},{name:"userEmail",type:"email",label:"User Email"},{name:"role",type:"text"},{name:"resource",type:"text",label:"Resource",required:true},{name:"resourceId",type:"text",label:"Resource ID"},{name:"changes",type:"json",label:"Changes"},{name:"ipAddress",type:"text",label:"IP Address"},{name:"userAgent",type:"text",label:"User Agent"},{name:"success",type:"checkbox"},{name:"error",type:"text",label:"Error"},{name:"metadata",type:"json",label:"Metadata"},{name:"timestamp",type:"date",time:true,required:true,admin:{readOnly:true}}],admin:{defaultColumns:["action","userEmail","resource","success","timestamp"]}},r={users:t,audit_logs:a};exports.a=t;exports.b=r;
|
package/dist/chunk-XFYSADHV.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkZTLGK6R4_cjs=require('./chunk-ZTLGK6R4.cjs'),chunkVQ53TFYA_cjs=require('./chunk-VQ53TFYA.cjs'),chunkF4ITQ6XQ_cjs=require('./chunk-F4ITQ6XQ.cjs'),chunkZUBJ6RLQ_cjs=require('./chunk-ZUBJ6RLQ.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),crypto=require('crypto');chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();var A=class extends chunkVQ53TFYA_cjs.a{dialect="mongodb";client;db;database;connectionString;constructor(i){if(super(),i.connectionString){this.connectionString=i.connectionString;try{let e=new URL(i.connectionString);this.database=e.pathname.replace(/^\//,"")||"kyro_cms";}catch{this.database="kyro_cms";}}else this.client=i.client,this.database=i.database;}async connect(){if(this.connectionString&&!this.client){let i;try{let e=await import('./lib-A2D63VXD.cjs');i=e.MongoClient??e.default?.MongoClient;}catch{chunkF4ITQ6XQ_cjs.a(["mongodb"]);let n=await import('./lib-A2D63VXD.cjs');i=n.MongoClient??n.default?.MongoClient;}this.client=new i(this.connectionString),await this.client.connect();}else if(this.client&&typeof this.client.connect=="function")try{await this.client.connect();}catch{}this.client&&(this.db=this.client.db(this.database),this.connected=true);}async disconnect(){this.client&&(await this.client.close(),this.connected=false);}getMongoCollection(i){if(!this.db&&this.client&&(this.db=this.client.db(this.database),this.connected=true),!this.db)throw new Error("MongoDB not connected");return this.db.collection(i)}async find(i){let{collection:e,where:n={},sort:s,limit:t=10,page:o=1,tenantId:r,select:a,draft:l}=i,d=this.getCollectionConfig(e),f=this.getMongoCollection(e),u={...n};this.tenantContext&&d.tenantScoped&&(u=chunkVQ53TFYA_cjs.c({where:u},e,this.tenantContext,chunkVQ53TFYA_cjs.b).where||{});let g=this.buildFilter(u,d.tenantScoped?r:void 0),c=d.fields.find(h=>h.name==="status"),p=c?.type==="select"&&Array.isArray(c.options)&&c.options.some(h=>h.value==="published");!l&&p&&(g.status="published");let y=this.parseSort(s),$={[y.field]:y.direction==="asc"?1:-1},O=(o-1)*t,[x,M]=await Promise.all([f.find(g).sort($).skip(O).limit(t).project(this.buildProjection(a)).toArray(),f.countDocuments(g)]),C=x.map(h=>this.processResult(h,d));return this.tenantContext&&!this.tenantContext.isSuperAdmin&&(C=C.filter(h=>chunkVQ53TFYA_cjs.d(h,e,this.tenantContext,chunkVQ53TFYA_cjs.b))),l&&(C=await Promise.all(C.map(async h=>{let m=await this.getMongoCollection(`${e}_versions`).findOne({document_id:h.id},{sort:{createdAt:-1}});if(m){let F=typeof m.data=="string"?JSON.parse(m.data):m.data&&typeof m.data=="object"?m.data:{};return {...h,...F,status:h.status,_hasUnpublishedChanges:m.status==="draft"}}return h}))),{docs:C,...this.calculatePagination(o,t,M)}}buildIdFilter(i,e,n){let s=String(i||""),t=/^[0-9a-fA-F]{24}$/.test(s),o=[{_id:s},{id:s},{slug:s},{orderNumber:s}];if(t)try{let{ObjectId:a}=chunkZTLGK6R4_cjs.a();o.unshift({_id:new a(s)});}catch{}let r={$or:o};return e&&n?.tenantScoped&&(r.tenantId=e),r}async findByID(i){let{collection:e,id:n,tenantId:s,draft:t}=i,o=this.getCollectionConfig(e),r=this.getMongoCollection(e);if(this.tenantContext&&o.tenantScoped){let g={_id:n,tenantId:this.tenantContext.tenantId};if(!chunkVQ53TFYA_cjs.d(g,e,this.tenantContext,chunkVQ53TFYA_cjs.b))return null}let a=this.buildIdFilter(n,s,o),l=o.fields.find(g=>g.name==="status"),d=l?.type==="select"&&Array.isArray(l.options)&&l.options.some(g=>g.value==="published");!t&&d&&(a.status="published");let f=await r.findOne(a);if(!f)return null;let u=this.processResult(f,o);if(t){let c=await this.getMongoCollection(`${e}_versions`).findOne({document_id:u.id},{sort:{createdAt:-1}});if(c){let p=typeof c.data=="string"?JSON.parse(c.data):c.data&&typeof c.data=="object"?c.data:{};u={...u,...p,status:u.status,_hasUnpublishedChanges:c.status==="draft"};}}return u}async create(i){let{collection:e,data:n,tenantId:s}=i,t=this.getCollectionConfig(e),o=this.getMongoCollection(e),r=this.prepareData(n,t),a=r.id||this.generateId();delete r.id;let l={...r,_id:a};return s&&t.tenantScoped&&(l.tenantId=s),await o.insertOne(l),this.processResult(l,t)}async update(i){let{collection:e,id:n,data:s,tenantId:t}=i,o=this.getCollectionConfig(e),r=this.getMongoCollection(e),a=this.buildIdFilter(n,t,o),l=this.prepareData(s,o),d=await r.findOneAndUpdate(a,{$set:l},{returnDocument:"after"});if(!d)throw new Error(`Document not found: ${e}/${n}`);return this.processResult(d,o)}async delete(i){let{collection:e,id:n,tenantId:s}=i,t=this.getCollectionConfig(e),o=this.getMongoCollection(e),r=this.buildIdFilter(n,s,t),a=await o.findOneAndDelete(r);if(!a)throw new Error(`Document not found: ${e}/${n}`);return this.processResult(a,t)}async count(i){let{collection:e,where:n={},tenantId:s}=i,t=this.getCollectionConfig(e),o=this.getMongoCollection(e),r=this.buildFilter(n,t.tenantScoped?s:void 0);return o.countDocuments(r)}async findOne(i){let{collection:e,where:n={},tenantId:s,draft:t}=i,o=this.getCollectionConfig(e),r=this.getMongoCollection(e),a=this.buildFilter(n,o.tenantScoped?s:void 0),l=o.fields.find(g=>g.name==="status"),d=l?.type==="select"&&Array.isArray(l.options)&&l.options.some(g=>g.value==="published");!t&&d&&(a.status="published");let f=await r.findOne(a);if(!f)return null;let u=this.processResult(f,o);if(t){let c=await this.getMongoCollection(`${e}_versions`).findOne({document_id:u.id},{sort:{createdAt:-1}});if(c){let p=typeof c.data=="string"?JSON.parse(c.data):c.data&&typeof c.data=="object"?c.data:{};u={...u,...p,status:u.status};}}return u}async findVersions(i){let{collection:e,documentId:n,sort:s,limit:t=10,page:o=1,tenantId:r}=i,a=this.getCollectionConfig(e),l=this.getMongoCollection(`${e}_versions`),d={document_id:n,autosave:{$ne:true}};r&&a.tenantScoped&&(d.tenant_id=r);let f=(o-1)*t,u=this.parseSort(s),g={[u.field]:u.direction==="asc"?1:-1},[c,p]=await Promise.all([l.find(d).sort(g).skip(f).limit(t).toArray(),l.countDocuments(d)]);return {docs:c.map(y=>this.processResult(y,{})),...this.calculatePagination(o,t,p)}}async findVersionByID(i){let{collection:e,versionId:n,tenantId:s}=i,t=this.getCollectionConfig(e),o=this.getMongoCollection(`${e}_versions`),r={_id:n};s&&t.tenantScoped&&(r.tenant_id=s);let a=await o.findOne(r);return a?this.processResult(a,{}):null}async createVersion(i){let{collection:e,documentId:n,data:s,status:t,createdBy:o,changeDescription:r,tenantId:a,autosave:l}=i,d=this.getCollectionConfig(e),f=this.getMongoCollection(`${e}_versions`);if(l){let c={document_id:n,collection_slug:e,autosave:true};a&&d.tenantScoped&&(c.tenant_id=a);let p=await f.findOne(c);if(p){let y=new Date().toISOString();return await f.updateOne({_id:p._id},{$set:{data:s,status:t,updatedAt:y}}),this.processResult({...p,data:s,status:t,updatedAt:y},{})}}let u=new Date().toISOString(),g={_id:this.generateId(),document_id:n,collection_slug:e,data:s,status:t,autosave:l===true,created_by:o,change_description:r,createdAt:u,updatedAt:u};if(a&&d.tenantScoped&&(g.tenant_id=a),await f.insertOne(g),!l){let c=this.getCollectionConfig(e);c.versions?.maxPerDoc&&await this.deleteVersions({collection:e,documentId:n,keepLatest:c.versions.maxPerDoc,tenantId:a});}return this.processResult(g,{})}async updateLatestVersion(i){return this.createVersion({...i,autosave:true})}async deleteVersions(i){let{collection:e,documentId:n,keepLatest:s,tenantId:t}=i,o=this.getCollectionConfig(e),r=this.getMongoCollection(`${e}_versions`);if(s){let a={document_id:n,autosave:{$ne:true}};t&&o.tenantScoped&&(a.tenant_id=t);let d=(await r.find(a).sort({createdAt:-1}).limit(s).project({_id:1}).toArray()).map(f=>f._id);d.length>0&&await r.deleteMany({document_id:n,autosave:{$ne:true},_id:{$nin:d},...t&&o.tenantScoped?{tenant_id:t}:{}});}else {let a={document_id:n};t&&o.tenantScoped&&(a.tenant_id=t),await r.deleteMany(a);}}async migrate(){for(let i of this.collections.values()){let e=this.getMongoCollection(i.slug);await e.createIndex({_id:1}),i.tenantScoped&&await e.createIndex({tenantId:1}),i.timestamps&&await e.createIndex({createdAt:-1});for(let n of i.fields)n.unique&&n.name&&await e.createIndex({[n.name]:1},{unique:true}),n.indexed&&n.name&&await e.createIndex({[n.name]:1});}}getCollectionConfig(i){if(i.startsWith("_globals_")){let n=i.replace("_globals_",""),s=this.globals.get(n);if(!s)throw new Error(`Global "${n}" not found`);return s}let e=this.collections.get(i);if(!e)throw new Error(`Collection "${i}" not found`);return e}buildFilter(i={},e){let n={};e&&(n.tenantId=e);for(let[s,t]of Object.entries(i))if(s==="AND"&&Array.isArray(t)){let o=t.map(r=>this.buildFilter(r));Object.assign(n,...o);}else if(s==="OR"&&Array.isArray(t))n.$or=t.map(o=>this.buildFilter(o));else if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let o={};if(t.equals!==void 0){n[s==="id"?"_id":s]=t.equals;continue}t.not_equals!==void 0&&(o.$ne=t.not_equals),t.in!==void 0&&(o.$in=t.in),t.not_in!==void 0&&(o.$nin=t.not_in),t.greater_than!==void 0&&(o.$gt=t.greater_than),t.greater_than_equal!==void 0&&(o.$gte=t.greater_than_equal),t.less_than!==void 0&&(o.$lt=t.less_than),t.less_than_equal!==void 0&&(o.$lte=t.less_than_equal),t.like!==void 0&&(o.$regex=new RegExp(t.like.replace(/%/g,".*"),"i")),t.not_like!==void 0&&(o.$not=new RegExp(t.not_like.replace(/%/g,".*"),"i")),t.contains!==void 0&&(o.$regex=new RegExp(`.*${t.contains}.*`,"i")),t.exists!==void 0&&(o.$exists=t.exists),Object.keys(o).length>0&&(n[s==="id"?"_id":s]=o);}else n[s==="id"?"_id":s]=t;return n}buildProjection(i){if(!i||i.length===0)return;let e={_id:1};for(let n of i)e[n]=1;return e}processResult(i,e){if(!i)return null;let n={...i};for(let s of Object.keys(n))/^\d+$/.test(s)&&delete n[s];return i._id&&(n.id=String(i._id),delete n._id),delete n.__v,n.createdAt&&(n.createdAt=new Date(n.createdAt).toISOString()),n.updatedAt&&(n.updatedAt=new Date(n.updatedAt).toISOString()),chunkZUBJ6RLQ_cjs.a(n)}generateId(){let i=Date.now().toString(16).padStart(12,"0"),e=crypto.randomBytes(6).toString("hex");return i+e}};function j(v){return new A(v)}
|
|
2
|
-
exports.a=A;exports.b=j;
|
package/dist/chunk-XOR64WUQ.cjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkVQ53TFYA_cjs=require('./chunk-VQ53TFYA.cjs'),chunkZUBJ6RLQ_cjs=require('./chunk-ZUBJ6RLQ.cjs'),chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),module$1=require('module'),crypto=require('crypto');chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.h();function E(m){let t=[];for(let a of m)if(a.type==="tabs"&&"tabs"in a)for(let n of a.tabs)t.push(...E(n.fields));else a.type==="row"&&"fields"in a?t.push(...E(a.fields)):a.type==="collapsible"&&"fields"in a?t.push(...E(a.fields)):t.push(a);return t}function w(m,t){let a=t,n=m[a.name];if(a.type==="json"||a.type==="richtext"||a.type==="array"||a.type==="group"||a.type==="blocks"||a.type==="list"||a.type==="relationship-block")try{n=n?JSON.parse(n):null;}catch{n=null;}if(a.type==="checkbox"&&(n=!!n),a.type==="date"&&n)try{let i=new Date(n);isNaN(i.getTime())?n=null:n=i.toISOString();}catch{n=null;}if((a.type==="upload"||a.type==="image")&&n)try{let i=JSON.parse(n);Array.isArray(i)?n=i.map(o=>typeof o=="object"&&o!==null?o:{id:o}):n=typeof i=="object"?i:{id:i};}catch{n=typeof n=="string"?{id:n}:n;}return n}var R;function P(){return R||(R=module$1.createRequire("file:///")("node:sqlite").DatabaseSync,R)}function U(m,t){return Array.isArray(m)?m.map(a=>{if(!a||typeof a!="object")return a;let n=a.data?{...a.data}:void 0;if(!n)return a;let i=t.find(o=>o.slug===a.type||o.slug===a.slug);if(!i||!Array.isArray(i.fields))return a;for(let o of i.fields){if(o.name&&(o.type==="upload"||o.type==="image")&&n[o.name]){let e=n[o.name];Array.isArray(e)?n[o.name]=e.map(s=>typeof s=="string"?{id:s}:s):typeof e=="string"&&(n[o.name]={id:e});}if(o.type==="blocks"&&o.name&&n[o.name]){let e=o.blocks||[];n[o.name]=U(n[o.name],e);}}return {...a,data:n}}):m}function I(m,t){try{return m.prepare(`PRAGMA table_info(${t})`).all().map(n=>n.name)}catch{return []}}var L=class extends chunkVQ53TFYA_cjs.a{db;path;migrations=new Map;versionsTableName="kyro_versions";constructor(t){super(),this.path=t.path,t.db?this.db=t.db:this.db=null;}async connect(){if(!this.db)this.db=new(P())(this.path||":memory:");else try{this.db.exec("SELECT 1");}catch{this.db=new(P())(this.path||":memory:");}if(this.db&&typeof this.db.prepare=="function"&&!this.db.prepare.__wrapped){let t=this.db.prepare.bind(this.db),a=n=>{let i=t(n),o=e=>typeof e=="boolean"?e?1:0:e===void 0?null:e;return new Proxy(i,{get(e,s,r){if(s==="all")return (...c)=>e.all(...c.map(o));if(s==="get")return (...c)=>e.get(...c.map(o));if(s==="run")return (...c)=>e.run(...c.map(o));let l=Reflect.get(e,s,r);return typeof l=="function"?l.bind(e):l}})};a.__wrapped=true,this.db.prepare=a;}this.db.exec("PRAGMA journal_mode = WAL"),this.db.exec("PRAGMA foreign_keys = ON"),this.connected=true;}async disconnect(){if(this.db){try{this.db.close();}catch{}this.db=null;}this.connected=false;}ensureTable(t,a){let n=a||this.getTableNameFor(t.slug),i=["id TEXT PRIMARY KEY"];for(let s of E(t.fields)){if(!s.name||s.name==="id")continue;let r=this.fieldToSQL(s);r&&i.push(r);}let o=E(t.fields);o.some(s=>s.name==="createdAt")||i.push(`${this.col("createdAt")} TEXT DEFAULT (datetime('now'))`),o.some(s=>s.name==="updatedAt")||i.push(`${this.col("updatedAt")} TEXT DEFAULT (datetime('now'))`),o.some(s=>s.name==="status")||i.push("status TEXT DEFAULT 'draft'"),o.some(s=>s.name==="hasDraft")||i.push("hasDraft INTEGER DEFAULT 0"),t.tenantScoped&&i.push("tenant_id TEXT NOT NULL");let e=I(this.db,n);if(e.length===0){let s=`CREATE TABLE IF NOT EXISTS ${n} (${i.join(", ")})`;this.db.exec(s),this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${n}_status ON ${n}(status)`);for(let r of E(t.fields))r.name&&r.indexed&&this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${n}_${r.name} ON ${n}(${this.col(r.name)})`),r.name&&r.unique&&this.db.exec(`CREATE UNIQUE INDEX IF NOT EXISTS idx_${n}_${r.name}_unique ON ${n}(${this.col(r.name)})`);}else {let s=new Set(e);for(let r of i){let l=r.split(" ")[0].replace(/^"/,"").replace(/"$/,"");if(!s.has(l)&&l!=="id")try{l==="status"?this.db.exec(`ALTER TABLE ${n} ADD COLUMN ${this.col(l)} TEXT DEFAULT 'published'`):l==="hasDraft"?this.db.exec(`ALTER TABLE ${n} ADD COLUMN ${this.col(l)} INTEGER DEFAULT 0`):this.db.exec(`ALTER TABLE ${n} ADD COLUMN ${this.col(l)} TEXT`);}catch{}}}this.migrations.set(n,true);}ensureVersionsTable(){this.db.exec(`
|
|
2
|
-
CREATE TABLE IF NOT EXISTS ${this.versionsTableName} (
|
|
3
|
-
id TEXT PRIMARY KEY,
|
|
4
|
-
collection_slug TEXT NOT NULL,
|
|
5
|
-
document_id TEXT NOT NULL,
|
|
6
|
-
tenant_id TEXT,
|
|
7
|
-
version INTEGER NOT NULL,
|
|
8
|
-
status TEXT NOT NULL DEFAULT 'draft',
|
|
9
|
-
autosave INTEGER NOT NULL DEFAULT 0,
|
|
10
|
-
data TEXT NOT NULL,
|
|
11
|
-
created_by TEXT,
|
|
12
|
-
change_description TEXT,
|
|
13
|
-
published_at TEXT,
|
|
14
|
-
created_at TEXT DEFAULT (datetime('now')),
|
|
15
|
-
updated_at TEXT DEFAULT (datetime('now'))
|
|
16
|
-
)
|
|
17
|
-
`);try{this.db.exec(`ALTER TABLE ${this.versionsTableName} ADD COLUMN autosave INTEGER NOT NULL DEFAULT 0`);}catch{}this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${this.versionsTableName}_doc ON ${this.versionsTableName}(collection_slug, document_id)`),this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${this.versionsTableName}_status ON ${this.versionsTableName}(status)`),this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${this.versionsTableName}_autosave ON ${this.versionsTableName}(autosave)`);}resolveCol(t,a){let n=a.replace(/^-/,""),i=I(this.db,t);if(!i.includes(n)){if(n==="created_at"&&i.includes("createdAt"))return '"createdAt"';if(n==="createdAt"&&i.includes("created_at"))return '"created_at"';if(n==="updated_at"&&i.includes("updatedAt"))return '"updatedAt"';if(n==="updatedAt"&&i.includes("updated_at"))return '"updated_at"'}return this.col(n)}col(t){return `"${t}"`}fieldToSQL(t){switch(t.type){case "text":case "email":case "password":case "textarea":case "color":case "icon":case "code":case "markdown":case "url":return this.col(t.name)+" TEXT";case "number":return this.col(t.name)+" REAL";case "checkbox":return this.col(t.name)+" INTEGER DEFAULT 0";case "date":return this.col(t.name)+" TEXT";case "select":case "radio":return this.col(t.name)+" TEXT";case "relationship":case "upload":case "image":return this.col(t.name)+" TEXT";case "json":case "richtext":case "array":case "group":case "blocks":return this.col(t.name)+" TEXT";default:return null}}parseGlobalsSlug(t){if(t.startsWith("_globals_")){let a=t.replace("_globals_","");return {isGlobal:true,globalSlug:a,tableName:`global_${a.replace(/-/g,"_")}`}}return {isGlobal:false,globalSlug:"",tableName:this.getTableNameFor(t)}}buildWhere(t,a){let n=[],i=[];for(let[o,e]of Object.entries(t)){let s=o.toUpperCase();if((s==="AND"||s==="OR")&&Array.isArray(e)){let l=[];for(let c of e)if(typeof c=="object"&&c!==null){let d=this.buildWhere(c,a);d.clause&&(l.push(`(${d.clause})`),i.push(...d.params));}l.length>0&&n.push(`(${l.join(` ${s} `)})`);continue}let r=this.resolveCol(a,o);typeof e=="object"&&e!==null&&!Array.isArray(e)?(e.equals!==void 0&&(n.push(`${r} = ?`),i.push(e.equals)),e.not_equals!==void 0&&(n.push(`${r} != ?`),i.push(e.not_equals)),e.in!==void 0&&Array.isArray(e.in)&&(e.in.length===0?n.push("1 = 0"):(n.push(`${r} IN (${e.in.map(()=>"?").join(", ")})`),i.push(...e.in))),e.contains!==void 0&&(n.push(`LOWER(${r}) LIKE LOWER(?)`),i.push(`%${e.contains}%`)),e.like!==void 0&&(n.push(`LOWER(${r}) LIKE LOWER(?)`),i.push(e.like)),e.greater_than!==void 0&&(n.push(`${r} > ?`),i.push(e.greater_than)),e.greater_than_equal!==void 0&&(n.push(`${r} >= ?`),i.push(e.greater_than_equal)),e.less_than!==void 0&&(n.push(`${r} < ?`),i.push(e.less_than)),e.less_than_equal!==void 0&&(n.push(`${r} <= ?`),i.push(e.less_than_equal))):e!==void 0&&(n.push(`${r} = ?`),i.push(e));}return {clause:n.join(" AND "),params:i}}async find(t){let{collection:a,where:n={},sort:i,limit:o=10,page:e=1,tenantId:s,select:r,draft:l=false}=t,c=this.parseGlobalsSlug(a),d=c.isGlobal?this.globals.get(c.globalSlug):this.getCollection(a);this.ensureTable(d,c.tableName);let y=c.tableName,h=`SELECT * FROM ${y}`,f=[],u=[],g={...n};this.tenantContext&&d.tenantScoped&&(g=chunkVQ53TFYA_cjs.c({where:g},a,this.tenantContext,chunkVQ53TFYA_cjs.b).where||{});let b=d.fields.find(p=>p.name==="status"),T=b?.type==="select"&&Array.isArray(b.options)&&b.options.some(p=>p.value==="published");if(!l&&T&&(u.push("status = ?"),f.push("published")),s&&d.tenantScoped&&(u.push("tenant_id = ?"),f.push(s)),g&&Object.keys(g).length>0){let p=this.buildWhere(g,y);p.clause&&(u.push(`(${p.clause})`),f.push(...p.params));}u.length>0&&(h+=` WHERE ${u.join(" AND ")}`);let $=i||"-createdAt",j=this.resolveCol(y,$),M=$.startsWith("-")?"DESC":"ASC";h+=` ORDER BY ${j} ${M}`;let V=h.replace("SELECT *","SELECT COUNT(*) as count"),S=this.db.prepare(V).get(...f)?.count||0;h+=" LIMIT ? OFFSET ?",f.push(o,(e-1)*o);let N=this.db.prepare(h).all(...f).map(p=>this.rowToDoc(p,d));return this.tenantContext&&!this.tenantContext.isSuperAdmin&&(N=N.filter(p=>chunkVQ53TFYA_cjs.d(p,a,this.tenantContext,chunkVQ53TFYA_cjs.b))),l&&(N=await Promise.all(N.map(async p=>{let D=this.db.prepare(`SELECT * FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? AND tenant_id IS NULL ORDER BY version DESC LIMIT 1`).get(a,p.id);if(D){let X=D.data?JSON.parse(D.data):{};return chunkZUBJ6RLQ_cjs.a({...p,...X,status:p.status,_hasUnpublishedChanges:D.status==="draft"})}return p}))),N=N.map(p=>chunkZUBJ6RLQ_cjs.a(p)),{docs:N,totalDocs:S,limit:o,totalPages:Math.ceil(S/o),page:e,pagingCounter:(e-1)*o+1,hasPrevPage:e>1,hasNextPage:e<Math.ceil(S/o),prevPage:e>1?e-1:null,nextPage:e<Math.ceil(S/o)?e+1:null}}async findByID(t){let{collection:a,id:n,tenantId:i,draft:o=false}=t,e=this.parseGlobalsSlug(a),s=e.isGlobal?this.globals.get(e.globalSlug):this.getCollection(a);this.ensureTable(s,e.tableName);let l=`SELECT * FROM ${e.tableName} WHERE id = ?`,c=[n];if(this.tenantContext&&s.tenantScoped){let u={id:n,tenant_id:this.tenantContext.tenantId};if(!chunkVQ53TFYA_cjs.d(u,a,this.tenantContext,chunkVQ53TFYA_cjs.b))return null}let d=s.fields.find(u=>u.name==="status"),y=d?.type==="select"&&Array.isArray(d.options)&&d.options.some(u=>u.value==="published");!o&&y&&(l+=" AND status = ?",c.push("published")),i&&s.tenantScoped&&(l+=" AND tenant_id = ?",c.push(i));let h=this.db.prepare(l).get(...c);if(!h)return null;let f=this.rowToDoc(h,s);if(o){let u=this.db.prepare(`SELECT * FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? AND tenant_id IS NULL ORDER BY version DESC LIMIT 1`).get(a,f.id);if(u){let g=u.data?JSON.parse(u.data):{};f={...f,...g,status:f.status,_hasUnpublishedChanges:u.status==="draft"};}}return chunkZUBJ6RLQ_cjs.a(f)}async create(t){let{collection:a,data:n,tenantId:i}=t,o=this.parseGlobalsSlug(a),e=o.isGlobal?this.globals.get(o.globalSlug):this.getCollection(a);this.ensureTable(e,o.tableName);let s=o.tableName,r=o.isGlobal?o.globalSlug:n.id||this.generateId(),l=this.prepareData(n,e);l.id=r;let c=new Date().toISOString();l.created_at=c,l.updated_at=c,i&&e.tenantScoped&&(l.tenant_id=i);let d=Object.keys(l),y=I(this.db,s),h={};for(let T of d)y.includes(T)&&(h[T]=l[T]);let f=Object.keys(h),u=f.map(T=>this.col(T)),g=f.map(()=>"?").join(", "),b=Object.values(h).map(T=>T!==null&&typeof T=="object"?JSON.stringify(T):T);return this.db.prepare(`INSERT OR REPLACE INTO ${s} (${u.join(", ")}) VALUES (${g})`).run(...b),this.ensureVersionsTable(),this.findByID({collection:a,id:r,tenantId:i,draft:true})}async update(t){let{collection:a,id:n,data:i,tenantId:o}=t,e=this.parseGlobalsSlug(a),s=e.isGlobal?this.globals.get(e.globalSlug):this.getCollection(a);this.ensureTable(s,e.tableName);let r=e.tableName,l=this.prepareData(i,s);l.updated_at=new Date().toISOString();let c=I(this.db,r),d={};for(let b of Object.keys(l))c.includes(b)&&(d[b]=l[b]);let h=Object.keys(d).map(b=>`${this.col(b)} = ?`).join(", "),f=Object.values(d).map(b=>b!==null&&typeof b=="object"?JSON.stringify(b):b),u=`UPDATE ${r} SET ${h} WHERE id = ?`,g=[...f,n];return o&&s.tenantScoped&&(u+=" AND tenant_id = ?",g.push(o)),this.db.prepare(u).run(...g),this.ensureVersionsTable(),this.findByID({collection:a,id:n,tenantId:o,draft:true})}async delete(t){let{collection:a,id:n,tenantId:i}=t,o=this.parseGlobalsSlug(a),e=o.isGlobal?this.globals.get(o.globalSlug):this.getCollection(a);this.ensureTable(e,o.tableName),this.ensureVersionsTable();let s=await this.findByID({collection:a,id:n,tenantId:i,draft:true});if(!s)throw new Error(`Document not found: ${a}/${n}`);let l=`DELETE FROM ${o.tableName} WHERE id = ?`,c=[n];return i&&e.tenantScoped&&(l+=" AND tenant_id = ?",c.push(i)),this.db.prepare(l).run(...c),s}async count(t){let{collection:a,tenantId:n}=t,i=this.parseGlobalsSlug(a),o=i.isGlobal?this.globals.get(i.globalSlug):this.getCollection(a);this.ensureTable(o,i.tableName);let e=i.tableName,s=`SELECT COUNT(*) as count FROM ${e}`,r=[],l=[];if(n&&o.tenantScoped&&(r.push("tenant_id = ?"),l.push(n)),t.where&&Object.keys(t.where).length>0){let d=this.buildWhere(t.where,e);d.clause&&(r.push(`(${d.clause})`),l.push(...d.params));}return r.length>0&&(s+=` WHERE ${r.join(" AND ")}`),this.db.prepare(s).get(...l)?.count||0}async findOne(t){let a=this.parseGlobalsSlug(t.collection);if(a.isGlobal){let i=this.globals.get(a.globalSlug);if(!i)throw new Error(`Global "${a.globalSlug}" not found in adapter`);this.ensureTable(i,a.tableName);let o=`SELECT * FROM ${a.tableName}`,e=[],s=[],r=i.fields.find(d=>d.name==="status"),l=r?.type==="select"&&Array.isArray(r.options)&&r.options.some(d=>d.value==="published");!t.draft&&i.versions&&l&&e.push("status = 'published'"),e.length>0&&(o+=` WHERE ${e.join(" AND ")}`),o+=" LIMIT 1";let c=this.db.prepare(o).get(...s);if(c){let d=this.rowToDoc(c,i);if(t.draft){let y=this.db.prepare(`SELECT * FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? AND tenant_id IS NULL ORDER BY version DESC LIMIT 1`).get(t.collection,a.globalSlug);if(y){let h=y.data?JSON.parse(y.data):{};d={...d,...h,status:d.status,_hasUnpublishedChanges:y.status==="draft"};}}return d}return null}return (await this.find({...t,limit:1})).docs[0]||null}async findVersions(t){this.ensureVersionsTable();let{collection:a,documentId:n,tenantId:i,limit:o=20,page:e=1}=t,s=["collection_slug = ?","document_id = ?","autosave = 0"],r=[a,n];i?(s.push("tenant_id = ?"),r.push(i)):s.push("tenant_id IS NULL");let l=`WHERE ${s.join(" AND ")}`,d=this.db.prepare(`SELECT COUNT(*) as count FROM ${this.versionsTableName} ${l}`).get(...r)?.count||0,y=(e-1)*o;return {docs:this.db.prepare(`SELECT * FROM ${this.versionsTableName} ${l} ORDER BY version DESC LIMIT ? OFFSET ?`).all(...r,o,y).map(u=>this.rowToVersion(u)),totalDocs:d,limit:o,totalPages:Math.ceil(d/o),page:e,pagingCounter:(e-1)*o+1,hasPrevPage:e>1,hasNextPage:e<Math.ceil(d/o),prevPage:e>1?e-1:null,nextPage:e<Math.ceil(d/o)?e+1:null}}async findVersionByID(t){this.ensureVersionsTable();let a=this.db.prepare(`SELECT * FROM ${this.versionsTableName} WHERE id = ? AND collection_slug = ? LIMIT 1`).get(t.versionId,t.collection);return a?this.rowToVersion(a):null}async createVersion(t){this.ensureVersionsTable();let a=new Date().toISOString();if(t.autosave){let s=`SELECT * FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? AND autosave = 1`,r=[t.collection,t.documentId];t.tenantId?(s+=" AND tenant_id = ?",r.push(t.tenantId)):s+=" AND tenant_id IS NULL",s+=" LIMIT 1";let l=this.db.prepare(s).get(...r);if(l){this.db.prepare(`UPDATE ${this.versionsTableName} SET data = ?, status = ?, updated_at = ? WHERE id = ?`).run(JSON.stringify(t.data),t.status,a,l.id);let c=await this.findVersionByID({collection:t.collection,versionId:l.id});if(c)return c}}let n=this.generateId(),o=(this.db.prepare(`SELECT version FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? AND autosave = 0 ORDER BY version DESC LIMIT 1`).get(t.collection,t.documentId)?.version??0)+1;if(this.db.prepare(`INSERT INTO ${this.versionsTableName} (
|
|
18
|
-
id, collection_slug, document_id, tenant_id, version, status, autosave, data, created_by, change_description, published_at, created_at, updated_at
|
|
19
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(n,t.collection,t.documentId,t.tenantId??null,o,t.status,t.autosave?1:0,JSON.stringify(t.data),t.createdBy??null,t.changeDescription??null,t.status==="published"?a:null,a,a),!t.autosave){let r=this.collections.get(t.collection)?.versions?.maxPerDoc;r&&r>0&&await this.deleteVersions({collection:t.collection,documentId:t.documentId,keepLatest:r,tenantId:t.tenantId});}return await this.findVersionByID({collection:t.collection,versionId:n})}async updateLatestVersion(t){return this.createVersion({...t,autosave:true})}async deleteVersions(t){this.ensureVersionsTable();let{collection:a,documentId:n,keepLatest:i,tenantId:o}=t;if(i&&i>0){let e=this.db.prepare(`SELECT id, status, autosave FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? ORDER BY version DESC`).all(a,n),s=0,r=[];for(let l of e)l.status==="published"||l.autosave===1||(s++,s>i&&r.push(l.id));for(let l of r)this.db.prepare(`DELETE FROM ${this.versionsTableName} WHERE id = ?`).run(l);}else {let e=`DELETE FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ?`,s=[a,n];o&&(e+=" AND tenant_id = ?",s.push(o)),this.db.prepare(e).run(...s);}}rowToVersion(t){return {id:String(t.id),collection:t.collection_slug,documentId:t.document_id,version:t.version,status:t.status,data:t.data?JSON.parse(t.data):{},createdBy:t.created_by??void 0,changeDescription:t.change_description??void 0,publishedAt:t.published_at??null,createdAt:t.created_at,updatedAt:t.updated_at}}prepareData(t,a){let n={},i=E(a.fields),o=(e,s)=>{let r=e;if(r.type==="json"||r.type==="richtext"||r.type==="array"||r.type==="group"||r.type==="blocks"||r.type==="list"||r.type==="relationship-block")return s!=null?JSON.stringify(s):null;if(r.type==="checkbox")return s?1:0;if(r.type==="number")return s!==null&&s!==""?Number(s):null;if(r.type==="upload"||r.type==="image"){if(s==null)return null;if(Array.isArray(s)){let l=s.map(c=>typeof c=="string"?c:typeof c=="object"?c.id||c._id||c:String(c));return JSON.stringify(l)}return typeof s=="string"?s:typeof s=="object"?JSON.stringify(s):String(s)}else if(e.type==="relationship"){if(s==null)return null;if(Array.isArray(s)){let l=s.map(c=>typeof c=="string"?c:typeof c=="object"?JSON.stringify({relationTo:e.relationTo,value:c.id||c}):String(c));return JSON.stringify(l)}return typeof s=="string"?s:typeof s=="object"?JSON.stringify({relationTo:e.relationTo,value:s.id||s}):String(s)}return s};for(let e of i){if(!e.name||e.name==="id"||a.fields.some(l=>l.type==="tabs"&&l.name&&"tabs"in l&&l.tabs.some(c=>c.fields.some(d=>d.name===e.name))))continue;let r=t[e.name];r!==void 0&&(n[e.name]=o(e,r));}for(let e of a.fields)if(e.type==="tabs"&&"tabs"in e&&e.name){let s=t[e.name];if(s&&typeof s=="object"){for(let r of e.tabs)for(let l of r.fields)if(l.name&&l.name!=="id"){let c=s[l.name];c!==void 0&&(n[l.name]=o(l,c));}}}return n}rowToDoc(t,a){let n={id:t.id};for(let i of E(a.fields)){if(!i.name||i.name==="id")continue;let o=i,e=t[o.name];if(o.type==="json"||o.type==="richtext"||o.type==="array"||o.type==="group"||o.type==="blocks"||o.type==="list"||o.type==="relationship-block")try{e=e?JSON.parse(e):null;}catch{e=null;}if(o.type==="blocks"&&e&&Array.isArray(e)){let s=o.blocks||[];e=U(e,s);}if(i.type==="checkbox"&&(e=!!e),i.type==="date"&&e)try{let s=new Date(e);isNaN(s.getTime())?(console.warn(`[LocalAdapter] Invalid date value for field "${i.name}":`,e),e=null):e=s.toISOString();}catch{e=null;}if((i.type==="upload"||i.type==="image")&&e)try{let s=JSON.parse(e);Array.isArray(s)?e=s.map(r=>typeof r=="object"&&r!==null?r:{id:r}):e=typeof s=="object"?s:{id:s};}catch{e={id:e};}if(i.type==="relationship"&&e)try{let s=JSON.parse(e);Array.isArray(s),e=s;}catch{e={relationTo:Array.isArray(i.relationTo)?i.relationTo[0]:i.relationTo,value:e};}n[i.name]=e;}for(let i of a.fields)if(!(!i.name||i.name==="id"||i.name==="row"||i.name==="collapsible")&&i.type==="tabs"&&"tabs"in i){let o={};for(let e of i.tabs)for(let s of e.fields)s.name&&s.name!=="id"&&(o[s.name]=w(t,s));n[i.name]=o;}if(a.timestamps){let i=t.createdAt||t.created_at,o=t.updatedAt||t.updated_at;if(i)try{let e=new Date(i);isNaN(e.getTime())||(n.createdAt=e.toISOString());}catch{}if(o)try{let e=new Date(o);isNaN(e.getTime())||(n.updatedAt=e.toISOString());}catch{}}a.tenantScoped&&(n.tenantId=t.tenant_id),n.status=t.status??"published",n.hasDraft=t.hasDraft?!!t.hasDraft:false;for(let i of Object.keys(n))/^\d+$/.test(i)&&delete n[i];return n}generateId(){let t=Date.now().toString(16).padStart(12,"0"),a=crypto.randomBytes(6).toString("hex");return t+a}getMediaById(t){try{let a=this.getTableNameFor("media"),n=this.db.prepare(`SELECT id, url, thumbnail_url FROM ${a} WHERE id = ?`).get(t);if(n)return {id:n.id,url:n.url,thumbnailUrl:n.thumbnail_url||n.url}}catch{}return null}getTableNameFor(t){return t.replace(/-/g,"_")}async migrate(){for(let t of this.collections.values())this.ensureTable(t);}async rollback(){}async transaction(t){return new Promise((a,n)=>{let i=this.db.transaction(async()=>t({db:this.db}));try{let o=i();a(o);}catch(o){n(o);}})}getDatabase(){return this.db}exec(t){this.db.exec(t);}prepare(t){return this.db.prepare(t)}};function k(m){return new L(m||{})}exports.a=L;exports.b=k;
|
package/dist/chunk-Y2YAKDEQ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'path';import'url';var require$1; if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); require$1 = createRequire(import.meta.url); }
|
|
2
|
-
var a=Object.create;var r=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var d=(t=>typeof require$1<"u"?require$1:typeof Proxy<"u"?new Proxy(t,{get:(e,o)=>(typeof require$1<"u"?require$1:e)[o]}):t)(function(t){if(typeof require$1<"u")return require$1.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var s=(t,e)=>()=>(t&&(e=t(t=0)),e);var g=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),h=(t,e)=>{for(var o in e)r(t,o,{get:e[o],enumerable:true});},n=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of c(e))!l.call(t,m)&&m!==o&&r(t,m,{get:()=>e[m],enumerable:!(i=p(e,m))||i.enumerable});return t};var x=(t,e,o)=>(o=t!=null?a(f(t)):{},n(e||!t||!t.__esModule?r(o,"default",{value:t,enumerable:true}):o,t)),u=t=>n(r({},"__esModule",{value:true}),t);var _=s(()=>{});export{d as a,s as b,g as c,h as d,x as e,u as f,_ as g};
|