@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
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkVQWOCGJ2_cjs=require('./chunk-VQWOCGJ2.cjs');require('./chunk-TG5YQ4PB.cjs'),require('./chunk-VPBGZW4P.cjs'),require('./chunk-N7CDHWQH.cjs'),require('./chunk-DCKJT247.cjs'),require('./chunk-7KTPBTH5.cjs'),require('./chunk-24W5I6SJ.cjs'),require('./chunk-HACW42ZZ.cjs'),require('./chunk-H2IJDTA2.cjs'),require('./chunk-PW6Y5MQL.cjs'),require('./chunk-34LCWI5X.cjs'),require('./chunk-LXTVMP5F.cjs'),require('./chunk-2I2AXTKY.cjs'),require('./chunk-GS4CMYKS.cjs'),require('./chunk-OJBL4CXK.cjs'),require('./chunk-DCFOVCJX.cjs'),require('./chunk-FU76HURF.cjs'),require('./chunk-GWUHIIPO.cjs'),require('./chunk-EG4SRTYS.cjs'),require('./chunk-3A5UO6OQ.cjs'),require('./chunk-23RSKVJP.cjs'),require('./chunk-YOJOVQIH.cjs'),require('./chunk-GDLMPZKD.cjs'),require('./chunk-NBBAMC2X.cjs'),require('./chunk-O4PPZOVI.cjs'),require('./chunk-JJY2F6NL.cjs'),require('./chunk-OXEJCIOA.cjs'),require('./chunk-KOSR7235.cjs'),require('./chunk-JHFD3IAU.cjs');function r(e){return new Response(e.body,e)}var p={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};function n(){return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}async function o(){try{return (await chunkVQWOCGJ2_cjs.a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.graphqlEnabled??p.graphqlEnabled}catch{return true}}var u=async e=>{if(await chunkVQWOCGJ2_cjs.b(e),!await o())return n();let s=await chunkVQWOCGJ2_cjs.a.getGraphQL().fetch(e.request,e.locals);return r(s)},d=async e=>{if(await chunkVQWOCGJ2_cjs.b(e),!await o())return n();let s=await chunkVQWOCGJ2_cjs.a.getGraphQL().fetch(e.request,e.locals);return r(s)};exports.GET=d;exports.POST=u;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b,a}from'./chunk-
|
|
2
|
-
|
|
1
|
+
import {b,a}from'./chunk-YLP3EKTQ.js';import'./chunk-N25DOGLQ.js';import'./chunk-KUY4QDAL.js';import'./chunk-LGUHXOEW.js';import'./chunk-ZMH35QYG.js';import'./chunk-GTAKGVUY.js';import'./chunk-5RBGM5N5.js';import'./chunk-A4XM33WO.js';import'./chunk-FAG2645P.js';import'./chunk-IIVBEZC2.js';import'./chunk-I22MSXGL.js';import'./chunk-SBFVITY2.js';import'./chunk-5I3BM5TV.js';import'./chunk-W5GDZG64.js';import'./chunk-OPKZYQV7.js';import'./chunk-3N34WXBS.js';import'./chunk-OXH6CANN.js';import'./chunk-TJ6N5ZPZ.js';import'./chunk-JXJTFBHG.js';import'./chunk-IIPSXKNV.js';import'./chunk-7EY3GXRA.js';import'./chunk-WLSVS3NC.js';import'./chunk-VWXHW74B.js';import'./chunk-CIWLQXB2.js';import'./chunk-YNSKDTFG.js';import'./chunk-VLFM66BZ.js';import'./chunk-NGNXOXI5.js';import'./chunk-O4RKZQYQ.js';import'./chunk-RLW6AQF2.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
|
+
function r(e){return new Response(e.body,e)}var p={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};function n(){return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}async function o(){try{return (await a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.graphqlEnabled??p.graphqlEnabled}catch{return true}}var d=async e=>{if(await b(e),!await o())return n();let s=await a.getGraphQL().fetch(e.request,e.locals);return r(s)},f=async e=>{if(await b(e),!await o())return n();let s=await a.getGraphQL().fetch(e.request,e.locals);return r(s)};export{f as GET,d as POST};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkVQWOCGJ2_cjs=require('./chunk-VQWOCGJ2.cjs');require('./chunk-TG5YQ4PB.cjs'),require('./chunk-VPBGZW4P.cjs'),require('./chunk-N7CDHWQH.cjs'),require('./chunk-DCKJT247.cjs'),require('./chunk-7KTPBTH5.cjs'),require('./chunk-24W5I6SJ.cjs'),require('./chunk-HACW42ZZ.cjs'),require('./chunk-H2IJDTA2.cjs'),require('./chunk-PW6Y5MQL.cjs'),require('./chunk-34LCWI5X.cjs'),require('./chunk-LXTVMP5F.cjs'),require('./chunk-2I2AXTKY.cjs'),require('./chunk-GS4CMYKS.cjs'),require('./chunk-OJBL4CXK.cjs'),require('./chunk-DCFOVCJX.cjs'),require('./chunk-FU76HURF.cjs'),require('./chunk-GWUHIIPO.cjs'),require('./chunk-EG4SRTYS.cjs'),require('./chunk-3A5UO6OQ.cjs'),require('./chunk-23RSKVJP.cjs'),require('./chunk-YOJOVQIH.cjs'),require('./chunk-GDLMPZKD.cjs'),require('./chunk-NBBAMC2X.cjs'),require('./chunk-O4PPZOVI.cjs'),require('./chunk-JJY2F6NL.cjs'),require('./chunk-OXEJCIOA.cjs'),require('./chunk-KOSR7235.cjs'),require('./chunk-JHFD3IAU.cjs');function r(){return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}var n={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};async function s(){try{return (await chunkVQWOCGJ2_cjs.a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.trpcEnabled??n.trpcEnabled}catch{return true}}var l=async e=>(await chunkVQWOCGJ2_cjs.b(e),await s()?chunkVQWOCGJ2_cjs.a.getTRPC().fetch(e.request,e.locals):r());exports.ALL=l;
|
package/dist/api-handler-trpc.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b,a}from'./chunk-
|
|
2
|
-
|
|
1
|
+
import {b,a}from'./chunk-YLP3EKTQ.js';import'./chunk-N25DOGLQ.js';import'./chunk-KUY4QDAL.js';import'./chunk-LGUHXOEW.js';import'./chunk-ZMH35QYG.js';import'./chunk-GTAKGVUY.js';import'./chunk-5RBGM5N5.js';import'./chunk-A4XM33WO.js';import'./chunk-FAG2645P.js';import'./chunk-IIVBEZC2.js';import'./chunk-I22MSXGL.js';import'./chunk-SBFVITY2.js';import'./chunk-5I3BM5TV.js';import'./chunk-W5GDZG64.js';import'./chunk-OPKZYQV7.js';import'./chunk-3N34WXBS.js';import'./chunk-OXH6CANN.js';import'./chunk-TJ6N5ZPZ.js';import'./chunk-JXJTFBHG.js';import'./chunk-IIPSXKNV.js';import'./chunk-7EY3GXRA.js';import'./chunk-WLSVS3NC.js';import'./chunk-VWXHW74B.js';import'./chunk-CIWLQXB2.js';import'./chunk-YNSKDTFG.js';import'./chunk-VLFM66BZ.js';import'./chunk-NGNXOXI5.js';import'./chunk-O4RKZQYQ.js';import'./chunk-RLW6AQF2.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
|
+
function r(){return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}var n={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};async function s(){try{return (await a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.trpcEnabled??n.trpcEnabled}catch{return true}}var p=async e=>(await b(e),await s()?a.getTRPC().fetch(e.request,e.locals):r());export{p as ALL};
|
package/dist/api-handler.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkVQWOCGJ2_cjs=require('./chunk-VQWOCGJ2.cjs');require('./chunk-TG5YQ4PB.cjs'),require('./chunk-VPBGZW4P.cjs'),require('./chunk-N7CDHWQH.cjs'),require('./chunk-DCKJT247.cjs'),require('./chunk-7KTPBTH5.cjs'),require('./chunk-24W5I6SJ.cjs'),require('./chunk-HACW42ZZ.cjs'),require('./chunk-H2IJDTA2.cjs'),require('./chunk-PW6Y5MQL.cjs'),require('./chunk-34LCWI5X.cjs'),require('./chunk-LXTVMP5F.cjs'),require('./chunk-2I2AXTKY.cjs'),require('./chunk-GS4CMYKS.cjs'),require('./chunk-OJBL4CXK.cjs'),require('./chunk-DCFOVCJX.cjs'),require('./chunk-FU76HURF.cjs'),require('./chunk-GWUHIIPO.cjs'),require('./chunk-EG4SRTYS.cjs'),require('./chunk-3A5UO6OQ.cjs'),require('./chunk-23RSKVJP.cjs'),require('./chunk-YOJOVQIH.cjs'),require('./chunk-GDLMPZKD.cjs'),require('./chunk-NBBAMC2X.cjs'),require('./chunk-O4PPZOVI.cjs'),require('./chunk-JJY2F6NL.cjs'),require('./chunk-OXEJCIOA.cjs'),require('./chunk-KOSR7235.cjs'),require('./chunk-JHFD3IAU.cjs');Object.defineProperty(exports,"ALL",{enumerable:true,get:function(){return chunkVQWOCGJ2_cjs.c}});Object.defineProperty(exports,"createKyroHandler",{enumerable:true,get:function(){return chunkVQWOCGJ2_cjs.d}});Object.defineProperty(exports,"kyroInstance",{enumerable:true,get:function(){return chunkVQWOCGJ2_cjs.a}});Object.defineProperty(exports,"warmKyroInstance",{enumerable:true,get:function(){return chunkVQWOCGJ2_cjs.b}});
|
package/dist/api-handler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{c as ALL,d as createKyroHandler,a as kyroInstance,b as warmKyroInstance}from'./chunk-
|
|
1
|
+
export{c as ALL,d as createKyroHandler,a as kyroInstance,b as warmKyroInstance}from'./chunk-YLP3EKTQ.js';import'./chunk-N25DOGLQ.js';import'./chunk-KUY4QDAL.js';import'./chunk-LGUHXOEW.js';import'./chunk-ZMH35QYG.js';import'./chunk-GTAKGVUY.js';import'./chunk-5RBGM5N5.js';import'./chunk-A4XM33WO.js';import'./chunk-FAG2645P.js';import'./chunk-IIVBEZC2.js';import'./chunk-I22MSXGL.js';import'./chunk-SBFVITY2.js';import'./chunk-5I3BM5TV.js';import'./chunk-W5GDZG64.js';import'./chunk-OPKZYQV7.js';import'./chunk-3N34WXBS.js';import'./chunk-OXH6CANN.js';import'./chunk-TJ6N5ZPZ.js';import'./chunk-JXJTFBHG.js';import'./chunk-IIPSXKNV.js';import'./chunk-7EY3GXRA.js';import'./chunk-WLSVS3NC.js';import'./chunk-VWXHW74B.js';import'./chunk-CIWLQXB2.js';import'./chunk-YNSKDTFG.js';import'./chunk-VLFM66BZ.js';import'./chunk-NGNXOXI5.js';import'./chunk-O4RKZQYQ.js';import'./chunk-RLW6AQF2.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{f as SESSION_CONFIG,j as clearSessionCookie,k as createSession,o as deleteSession,h as getClientIp,s as getCurrentUser,l as getSession,g as getSessionIdFromRequest,q as getUserSessions,p as invalidateAllUserSessions,n as refreshSession,i as setSessionCookie,r as updateSessionName,m as validateSession}from'./chunk-SBFVITY2.js';import'./chunk-RLW6AQF2.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkLXTVMP5F_cjs=require('./chunk-LXTVMP5F.cjs');require('./chunk-JHFD3IAU.cjs');Object.defineProperty(exports,"SESSION_CONFIG",{enumerable:true,get:function(){return chunkLXTVMP5F_cjs.f}});Object.defineProperty(exports,"clearSessionCookie",{enumerable:true,get:function(){return chunkLXTVMP5F_cjs.j}});Object.defineProperty(exports,"createSession",{enumerable:true,get:function(){return chunkLXTVMP5F_cjs.k}});Object.defineProperty(exports,"deleteSession",{enumerable:true,get:function(){return chunkLXTVMP5F_cjs.o}});Object.defineProperty(exports,"getClientIp",{enumerable:true,get:function(){return chunkLXTVMP5F_cjs.h}});Object.defineProperty(exports,"getCurrentUser",{enumerable:true,get:function(){return chunkLXTVMP5F_cjs.s}});Object.defineProperty(exports,"getSession",{enumerable:true,get:function(){return chunkLXTVMP5F_cjs.l}});Object.defineProperty(exports,"getSessionIdFromRequest",{enumerable:true,get:function(){return chunkLXTVMP5F_cjs.g}});Object.defineProperty(exports,"getUserSessions",{enumerable:true,get:function(){return chunkLXTVMP5F_cjs.q}});Object.defineProperty(exports,"invalidateAllUserSessions",{enumerable:true,get:function(){return chunkLXTVMP5F_cjs.p}});Object.defineProperty(exports,"refreshSession",{enumerable:true,get:function(){return chunkLXTVMP5F_cjs.n}});Object.defineProperty(exports,"setSessionCookie",{enumerable:true,get:function(){return chunkLXTVMP5F_cjs.i}});Object.defineProperty(exports,"updateSessionName",{enumerable:true,get:function(){return chunkLXTVMP5F_cjs.r}});Object.defineProperty(exports,"validateSession",{enumerable:true,get:function(){return chunkLXTVMP5F_cjs.m}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkVPBGZW4P_cjs=require('./chunk-VPBGZW4P.cjs');require('./chunk-H2IJDTA2.cjs'),require('./chunk-PW6Y5MQL.cjs'),require('./chunk-2I2AXTKY.cjs'),require('./chunk-GS4CMYKS.cjs'),require('./chunk-JHFD3IAU.cjs');Object.defineProperty(exports,"autoBootstrap",{enumerable:true,get:function(){return chunkVPBGZW4P_cjs.e}});Object.defineProperty(exports,"bootstrapAdmin",{enumerable:true,get:function(){return chunkVPBGZW4P_cjs.a}});Object.defineProperty(exports,"bootstrapWithRetry",{enumerable:true,get:function(){return chunkVPBGZW4P_cjs.f}});Object.defineProperty(exports,"buildBootstrapConfig",{enumerable:true,get:function(){return chunkVPBGZW4P_cjs.c}});Object.defineProperty(exports,"checkBootstrapRequired",{enumerable:true,get:function(){return chunkVPBGZW4P_cjs.b}});Object.defineProperty(exports,"getBootstrapFromEnv",{enumerable:true,get:function(){return chunkVPBGZW4P_cjs.d}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{e as autoBootstrap,a as bootstrapAdmin,f as bootstrapWithRetry,c as buildBootstrapConfig,b as checkBootstrapRequired,d as getBootstrapFromEnv}from'./chunk-KUY4QDAL.js';import'./chunk-FAG2645P.js';import'./chunk-IIVBEZC2.js';import'./chunk-5I3BM5TV.js';import'./chunk-W5GDZG64.js';import'./chunk-RLW6AQF2.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var pgCore=require('drizzle-orm/pg-core');var d=pgCore.pgTable("users",{id:pgCore.uuid("id").primaryKey().defaultRandom(),name:pgCore.varchar("name",{length:255}),email:pgCore.varchar("email",{length:255}).notNull(),passwordHash:pgCore.varchar("password_hash",{length:255}),role:pgCore.varchar("role",{length:50}).notNull().default("customer"),tenantId:pgCore.uuid("tenant_id"),emailVerified:pgCore.boolean("email_verified").default(false),avatar:pgCore.varchar("avatar",{length:255}),locked:pgCore.boolean("locked").default(false),lastLogin:pgCore.timestamp("last_login"),failedLoginAttempts:pgCore.integer("failed_login_attempts").default(0),metadata:pgCore.jsonb("metadata").$type(),createdAt:pgCore.timestamp("created_at").defaultNow().notNull(),updatedAt:pgCore.timestamp("updated_at").defaultNow().notNull()},e=>[pgCore.uniqueIndex("users_email_idx").on(e.email),pgCore.index("users_tenant_idx").on(e.tenantId),pgCore.index("users_role_idx").on(e.role)]),c=pgCore.pgTable("roles",{id:pgCore.uuid("id").primaryKey().defaultRandom(),name:pgCore.varchar("name",{length:100}).notNull().unique(),level:pgCore.integer("level").notNull().default(0),inherits:pgCore.text("inherits").array(),description:pgCore.text("description"),permissions:pgCore.jsonb("permissions").$type().default([]),isSystem:pgCore.boolean("is_system").default(false),createdAt:pgCore.timestamp("created_at").defaultNow().notNull(),updatedAt:pgCore.timestamp("updated_at").defaultNow().notNull()},e=>[pgCore.index("roles_level_idx").on(e.level)]),y=pgCore.pgTable("permissions",{id:pgCore.uuid("id").primaryKey().defaultRandom(),roleId:pgCore.uuid("role_id").references(()=>c.id,{onDelete:"cascade"}),resource:pgCore.varchar("resource",{length:100}).notNull(),action:pgCore.varchar("action",{length:50}).notNull(),conditions:pgCore.jsonb("conditions").$type(),createdAt:pgCore.timestamp("created_at").defaultNow().notNull()},e=>[pgCore.index("permissions_role_idx").on(e.roleId),pgCore.index("permissions_resource_idx").on(e.resource)]),m=pgCore.pgTable("sessions",{id:pgCore.uuid("id").primaryKey().defaultRandom(),userId:pgCore.uuid("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),token:pgCore.varchar("token",{length:512}).notNull().unique(),refreshToken:pgCore.varchar("refresh_token",{length:512}),ipAddress:pgCore.varchar("ip_address",{length:45}),userAgent:pgCore.text("user_agent"),expiresAt:pgCore.timestamp("expires_at").notNull(),createdAt:pgCore.timestamp("created_at").defaultNow().notNull()},e=>[pgCore.index("sessions_user_idx").on(e.userId),pgCore.index("sessions_token_idx").on(e.token),pgCore.index("sessions_expires_idx").on(e.expiresAt)]),x=pgCore.pgTable("audit_logs",{id:pgCore.uuid("id").primaryKey().defaultRandom(),action:pgCore.varchar("action",{length:100}).notNull(),userId:pgCore.uuid("user_id").references(()=>d.id,{onDelete:"set null"}),userEmail:pgCore.varchar("user_email",{length:255}),role:pgCore.varchar("role",{length:50}),resource:pgCore.varchar("resource",{length:100}).notNull(),resourceId:pgCore.varchar("resource_id",{length:255}),changes:pgCore.jsonb("changes").$type(),ipAddress:pgCore.varchar("ip_address",{length:45}),userAgent:pgCore.text("user_agent"),success:pgCore.boolean("success").notNull().default(true),error:pgCore.text("error"),metadata:pgCore.jsonb("metadata").$type(),timestamp:pgCore.timestamp("timestamp").defaultNow().notNull()},e=>[pgCore.index("audit_logs_user_idx").on(e.userId),pgCore.index("audit_logs_action_idx").on(e.action),pgCore.index("audit_logs_resource_idx").on(e.resource),pgCore.index("audit_logs_timestamp_idx").on(e.timestamp)]),g=pgCore.pgTable("tenants",{id:pgCore.uuid("id").primaryKey().defaultRandom(),name:pgCore.varchar("name",{length:255}).notNull(),slug:pgCore.varchar("slug",{length:100}).notNull().unique(),settings:pgCore.jsonb("settings").$type().default({}),isActive:pgCore.boolean("is_active").default(true),createdAt:pgCore.timestamp("created_at").defaultNow().notNull(),updatedAt:pgCore.timestamp("updated_at").defaultNow().notNull()},e=>[pgCore.uniqueIndex("tenants_slug_idx").on(e.slug)]),N=pgCore.pgTable("api_keys",{id:pgCore.uuid("id").primaryKey().defaultRandom(),userId:pgCore.uuid("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),name:pgCore.varchar("name",{length:255}).notNull(),key:pgCore.varchar("key",{length:64}).notNull().unique(),keyPrefix:pgCore.varchar("key_prefix",{length:8}).notNull(),permissions:pgCore.jsonb("permissions").$type().default([]),lastUsedAt:pgCore.timestamp("last_used_at"),expiresAt:pgCore.timestamp("expires_at"),createdAt:pgCore.timestamp("created_at").defaultNow().notNull()},e=>[pgCore.index("api_keys_user_idx").on(e.userId),pgCore.index("api_keys_key_idx").on(e.key)]),h=pgCore.pgTable("email_verifications",{id:pgCore.uuid("id").primaryKey().defaultRandom(),userId:pgCore.uuid("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),token:pgCore.varchar("token",{length:64}).notNull().unique(),expiresAt:pgCore.timestamp("expires_at").notNull(),createdAt:pgCore.timestamp("created_at").defaultNow().notNull()},e=>[pgCore.index("email_verifications_token_idx").on(e.token),pgCore.index("email_verifications_user_idx").on(e.userId)]),A=pgCore.pgTable("password_resets",{id:pgCore.uuid("id").primaryKey().defaultRandom(),userId:pgCore.uuid("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),token:pgCore.varchar("token",{length:64}).notNull().unique(),expiresAt:pgCore.timestamp("expires_at").notNull(),usedAt:pgCore.timestamp("used_at"),createdAt:pgCore.timestamp("created_at").defaultNow().notNull()},e=>[pgCore.index("password_resets_token_idx").on(e.token),pgCore.index("password_resets_user_idx").on(e.userId)]),k=pgCore.pgTable("password_history",{id:pgCore.uuid("id").primaryKey().defaultRandom(),userId:pgCore.uuid("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),passwordHash:pgCore.varchar("password_hash",{length:255}).notNull(),createdAt:pgCore.timestamp("created_at").defaultNow().notNull()},e=>[pgCore.index("password_history_user_idx").on(e.userId)]),w=pgCore.pgTable("lockouts",{id:pgCore.uuid("id").primaryKey().defaultRandom(),userId:pgCore.uuid("user_id").notNull().references(()=>d.id,{onDelete:"cascade"}),ipAddress:pgCore.varchar("ip_address",{length:45}),reason:pgCore.varchar("reason",{length:255}),lockedUntil:pgCore.timestamp("locked_until").notNull(),releasedAt:pgCore.timestamp("released_at"),createdAt:pgCore.timestamp("created_at").defaultNow().notNull()},e=>[pgCore.index("lockouts_user_idx").on(e.userId),pgCore.index("lockouts_ip_idx").on(e.ipAddress),pgCore.index("lockouts_locked_until_idx").on(e.lockedUntil)]);exports.a=d;exports.b=c;exports.c=y;exports.d=m;exports.e=x;exports.f=g;exports.g=N;exports.h=h;exports.i=A;exports.j=k;exports.k=w;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkDCFOVCJX_cjs=require('./chunk-DCFOVCJX.cjs'),chunkKOSR7235_cjs=require('./chunk-KOSR7235.cjs'),graphql=require('graphql');var N=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,e){let d=this.getCacheKey(t),y=this.caches.get(d);if(y||(y=new Map,this.caches.set(d,y)),y.has(e)&&!this.pending.get(d)?.has(e))return y.get(e);let s=this.pending.get(d);return s||(s=new Set,this.pending.set(d,s)),s.add(e),this.flushScheduled||(this.flushScheduled=true,queueMicrotask(()=>{this.flushScheduled=false,this.flushAll();})),new Promise(i=>{let o=this.waiting.get(`${d}:${e}`);o||(o=[],this.waiting.set(`${d}:${e}`,o)),o.push(i);})}async flushAll(){for(let[t,e]of this.pending){if(e.size===0)continue;let d=t,y=Array.from(e);this.pending.delete(t);try{let s=await this.db.find({collection:d,where:{id:{in:y}},limit:y.length,tenantId:this.tenantId}),i=this.caches.get(t)||new Map,o=new Map;for(let l of s.docs)o.set(l.id,l),i.set(l.id,l);for(let l of y){let w=this.waiting.get(`${t}:${l}`);if(w){let I=o.get(l);for(let m of w)m(I);this.waiting.delete(`${t}:${l}`);}}}catch(s){console.error(`[RelationLoader] Failed to batch load ${d}:`,s);for(let i of y){let o=this.waiting.get(`${t}:${i}`);if(o){for(let l of o)l(void 0);this.waiting.delete(`${t}:${i}`);}}}}}async loadMany(t,e){return Promise.all(e.map(d=>this.load(t,d)))}resolveOne(t,e){return this.caches.get(this.getCacheKey(t))?.get(e)}};var q=new graphql.GraphQLScalarType({name:"JSON",description:"Arbitrary JSON value",serialize(n){return n},parseValue(n){return n},parseLiteral(n){switch(n.kind){case graphql.Kind.STRING:return n.value;case graphql.Kind.INT:case graphql.Kind.FLOAT:return parseFloat(n.value);case graphql.Kind.BOOLEAN:return n.value;case graphql.Kind.OBJECT:{let t={};for(let e of n.fields)t[e.name.value]=q.parseLiteral(e.value);return t}case graphql.Kind.LIST:return n.values.map(t=>q.parseLiteral(t));case graphql.Kind.NULL:return null;default:return null}}});function ie(n){return t=>{let e=0;return {Field(){e++,e>n&&t.reportError(new Error(`Query exceeds max depth of ${n}`));},leaveField(){e--;}}}}function L(n){return n.split(/[-_]/).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function Z(n){let t=L(n);return t.charAt(0).toLowerCase()+t.slice(1)}function O(n){return n.endsWith("s")&&n.length>1?n.slice(0,-1):n}async function P(n,t,e){let d=n.access?.[t];if(e.apiKey){if(e.apiKey.permissions?.length>0){let s=n.slug,o=`${s}:${t==="read"?"read":t==="create"?"create":"update"}`;return !chunkDCFOVCJX_cjs.e(e.apiKey.permissions,o)&&!chunkDCFOVCJX_cjs.e(e.apiKey.permissions,`${s}:admin`)?{allowed:false}:{allowed:true}}if(d){let s=await chunkDCFOVCJX_cjs.h(d,{req:e.req,user:e.user,tenantId:e.tenantId});return typeof s=="boolean"?{allowed:s}:{allowed:true,extraWhere:s}}return {allowed:true}}if(e.user){let s=n.slug,o=`${s}:${t==="read"?"read":t==="create"?"create":t==="update"?"update":"delete"}`;if(!chunkKOSR7235_cjs.a({id:e.user.id,email:e.user.email,role:e.user.role},o)&&!chunkKOSR7235_cjs.a({id:e.user.id,email:e.user.email,role:e.user.role},`${s}:admin`)&&!d)return {allowed:false}}if(!d)return e.user?{allowed:true}:{allowed:false};let y=await chunkDCFOVCJX_cjs.h(d,{req:e.req,user:e.user,tenantId:e.tenantId});return typeof y=="boolean"?{allowed:y}:{allowed:true,extraWhere:y}}async function x(n,t,e){let d=n.access?.[t];if(e.apiKey){if(e.apiKey.permissions?.length>0){let s=n.slug,i=`${s}:${t}`;return !chunkDCFOVCJX_cjs.e(e.apiKey.permissions,i)&&!chunkDCFOVCJX_cjs.e(e.apiKey.permissions,`${s}:admin`)&&!chunkDCFOVCJX_cjs.e(e.apiKey.permissions,`${s}:*`)?{allowed:false}:{allowed:true}}if(d){let s=await chunkDCFOVCJX_cjs.h(d,{req:e.req,user:e.user,tenantId:e.tenantId});return {allowed:typeof s=="boolean"?s:true}}return {allowed:true}}if(!d){if(!e.user)return {allowed:false};let s=e.user.role;return s==="super_admin"||s==="admin"?{allowed:true}:{allowed:false}}let y=await chunkDCFOVCJX_cjs.h(d,{req:e.req,user:e.user,tenantId:e.tenantId});return typeof y=="boolean"?{allowed:y}:{allowed:true}}function ee(n,t){return n?n.startsWith("http://")||n.startsWith("https://")||n.startsWith("blob:")||n.startsWith("data:")?n:`${(process.env.KYRO_BASE_URL||t||"http://localhost:4321").replace(/\/+$/,"")}${n.startsWith("/")?"":"/"}${n}`:null}function K(n,t){return n&&(n.url&&(n.url=ee(n.url,t)),n.thumbnailUrl&&(n.thumbnailUrl=ee(n.thumbnailUrl,t)),n)}function U(n,t,e,d=false,y="Root",s=new Map){switch(n.type){case "text":case "email":case "password":case "textarea":case "color":case "code":case "markdown":case "date":case "select":case "radio":return n.hasMany?new graphql.GraphQLList(graphql.GraphQLString):graphql.GraphQLString;case "list":return new graphql.GraphQLList(graphql.GraphQLString);case "upload":{let i=n;if(d)return i.hasMany?new graphql.GraphQLList(graphql.GraphQLString):graphql.GraphQLString;if(i.relationTo&&e?.[i.relationTo]){let o=e[i.relationTo];return i.hasMany?new graphql.GraphQLList(o):o}return q}case "image":{if(d)return graphql.GraphQLString;let i=n;return i.relationTo&&e?.[i.relationTo]?e[i.relationTo]:q}case "number":{let i=n.integer?graphql.GraphQLInt:graphql.GraphQLFloat;return n.hasMany?new graphql.GraphQLList(i):i}case "checkbox":return graphql.GraphQLBoolean;case "json":case "richtext":return q;case "blocks":{if(d)return q;let i=n,o=(i.blocks||[]).map(I=>{let m=`Block_${L(I.slug)}`,u=s.get(m);return u||(u=new graphql.GraphQLObjectType({name:m,fields:()=>{let f=k(I.fields||[],t,e,m,s);return f.blockType={type:graphql.GraphQLString},f.name={type:graphql.GraphQLString},f}}),s.set(m,u)),u});if(o.length===0)return q;let l=`${y}_${L(i.name)}_Blocks`,w=s.get(l);return w||(w=new graphql.GraphQLUnionType({name:l,types:o,resolveType:I=>`Block_${L(I.blockType||I.type)}`}),s.set(l,w)),new graphql.GraphQLList(w)}case "tabs":{if(d)return q;let i=n,o=`${y}_${L(i.name)}_Tabs`,l=s.get(o);return l||(l=new graphql.GraphQLObjectType({name:o,fields:()=>k(i.tabs?.flatMap(w=>w.fields||[])||[],t,e,o,s)}),s.set(o,l)),l}case "relationship":{let i=n.relationTo;if((i==="*"||Array.isArray(i)&&i.includes("*"))&&(i=t.getCollections().map(o=>o.slug)),typeof i=="string"){if(d)return n.hasMany?new graphql.GraphQLList(graphql.GraphQLString):graphql.GraphQLString;if(e?.[i])return n.hasMany?new graphql.GraphQLList(e[i]):e[i];let o=t.getCollection(i);if(o)return new graphql.GraphQLObjectType({name:`${L(i)}Ref`,fields:()=>({id:{type:graphql.GraphQLString},...J(o,t,e,s)})})}else if(Array.isArray(i)){if(d)return n.hasMany?new graphql.GraphQLList(q):q;let o=i.map(u=>{if(e?.[u])return e[u];let f=t.getCollection(u);if(f){let c=s.get(`${L(u)}Ref`);return c||(c=new graphql.GraphQLObjectType({name:`${L(u)}Ref`,fields:()=>({id:{type:graphql.GraphQLString},...J(f,t,e,s)})}),s.set(`${L(u)}Ref`,c)),c}return null}).filter(Boolean);if(o.length===0)return q;let l=`${y}_${L(n.name||"Ref")}_PolyUnion`,w=s.get(l);w||(w=new graphql.GraphQLUnionType({name:l,types:o,resolveType:u=>{if(u.__collection&&u.__collection!=="*")return e?.[u.__collection]?e[u.__collection].name:`${L(u.__collection)}Ref`}}),s.set(l,w));let I=`${y}_${L(n.name||"Ref")}_PolyWrapper`,m=s.get(I);return m||(m=new graphql.GraphQLObjectType({name:I,fields:{relationTo:{type:graphql.GraphQLString},value:{type:w}}}),s.set(I,m)),n.hasMany?new graphql.GraphQLList(m):m}return q}case "array":{if(d)return new graphql.GraphQLList(q);let i=n,o=`${y}_${L(i.name)}_ArrayItem`,l=s.get(o);return l||(l=new graphql.GraphQLObjectType({name:o,fields:()=>{let w=k(i.fields||[],t,e,o,s);return w.id={type:graphql.GraphQLString},w}}),s.set(o,l)),new graphql.GraphQLList(l)}case "group":{if(d)return q;let i=n,o=`${y}_${L(i.name)}_Group`,l=s.get(o);return l||(l=new graphql.GraphQLObjectType({name:o,fields:()=>k(i.fields||[],t,e,o,s)}),s.set(o,l)),l}default:return graphql.GraphQLString}}function k(n,t,e,d,y=new Map){let s={};for(let i of n){if(i.type==="tabs"&&!i.name){for(let o of i.tabs||[]){let l=k(o.fields||[],t,e,d,y);Object.assign(s,l);}continue}if(i.type==="row"||i.type==="collapsible"){let o=k(i.fields||[],t,e,d,y);Object.assign(s,o);continue}if(i.name&&i.admin?.hidden!==true){let o=oe(i,t,e,d,y);o&&(s[i.name]=o);}}return s}function J(n,t,e,d=new Map){return k(n.fields,t,e,L(O(n.slug)),d)}function oe(n,t,e,d,y=new Map){if(!n.name)return null;let s=n.deprecated||void 0;if(n.type==="upload"){let o=U(n,t,e,false,d,y),l=n;return {type:o,description:n.admin?.description||n.label,deprecationReason:s,resolve:async(w,I,m)=>{let u=m?.relationLoader,f=w?.[l.name],c=m?.req?.url?new URL(m.req.url).origin:void 0;if(!f)return null;if(l.hasMany){let T=Array.isArray(f)?f:[];return Promise.all(T.map(async g=>{let G=typeof g=="string"?g:g?.id;if(!G||typeof g=="object"&&g?.url)return K(g,c);if(u){let S=u.resolveOne(l.relationTo,G);if(S)return K(S,c);let r=await u.load(l.relationTo,G);return r?K(r,c):null}return {id:G}}))}let b=typeof f=="string"?f:f?.id;if(!b||typeof f=="object"&&f?.url)return K(f,c);if(u){let T=u.resolveOne(l.relationTo,b);if(T)return K(T,c);let g=await u.load(l.relationTo,b);return g?K(g,c):null}return {id:b}}}}return n.type==="relationship"&&!n.hasMany?{type:U(n,t,e,false,d,y),description:n.admin?.description||n.label,deprecationReason:s,resolve:async(l,w,I)=>{let m=I?.relationLoader,u=n,f=l?.[u.name];if(!f)return null;let c=Array.isArray(u.relationTo)||u.relationTo==="*",b=c?f?.relationTo:u.relationTo,T=c?f?.value:f;if(c&&typeof f=="string"&&(b=u.relationTo[0],T=f),c&&b==="*")return null;if(m&&typeof T=="string"&&typeof b=="string"&&b!=="*"){let G=m.resolveOne(b,T);if(G)return c?{relationTo:b,value:{...G,__collection:b}}:G;let S=await m.load(b,T);return S?c?{relationTo:b,value:{...S,__collection:b}}:S:null}let g=typeof T=="object"&&T!==null?T:{id:T};return c?{relationTo:b,value:{...g,__collection:b}}:g}}:n.type==="relationship"&&n.hasMany?{type:U(n,t,e,false,d,y),description:n.admin?.description||n.label,deprecationReason:s,resolve:async(l,w,I)=>{let m=I?.relationLoader,u=n,f=l?.[u.name]||[];if(typeof f=="string")try{f=JSON.parse(f);}catch{}if(Array.isArray(f)||(f=[]),!f.length)return [];let c=Array.isArray(u.relationTo)||u.relationTo==="*";if(m){let b=[];for(let T of f){let g=c?T?.relationTo:u.relationTo,G=c?T?.value:T;if(c&&typeof T=="string"&&(g=u.relationTo[0],G=T),c&&g==="*")continue;if(typeof G=="string"&&typeof g=="string"&&g!=="*"){let r=m.resolveOne(g,G);if(r){b.push(c?{relationTo:g,value:{...r,__collection:g}}:r);continue}let $=await m.load(g,G);if($){b.push(c?{relationTo:g,value:{...$,__collection:g}}:$);continue}continue}let S=typeof G=="object"&&G!==null?G:{id:G};b.push(c?{relationTo:g,value:{...S,__collection:g}}:S);}return b}return f.map(b=>{let T=c?b?.relationTo:u.relationTo,g=c?b?.value:b;c&&typeof b=="string"&&(T=u.relationTo[0],g=b);let G=typeof g=="object"&&g!==null?g:{id:g};return c?{relationTo:T,value:{...G,__collection:T}}:G})}}:n.type==="blocks"?{type:U(n,t,e,false,d,y),description:n.admin?.description||n.label,deprecationReason:s,resolve:l=>{let w=l?.[n.name];if(typeof w=="string")try{w=JSON.parse(w);}catch{}return Array.isArray(w)?w.map(I=>I&&I.data&&I.type?{...I.data,id:I.id,type:I.type,blockType:I.type,name:I.name}:I):w}}:{type:U(n,t,e,false,d,y),description:n.admin?.description||n.label,deprecationReason:s,resolve:o=>{let l=o?.[n.name];if(typeof l=="string"&&["array","group","tabs","blocks","json","richtext","list"].includes(n.type))try{l=JSON.parse(l);}catch{}return l}}}function ne(n){let{registry:t,db:e,user:d,req:y,tenantId:s,apiKey:i,settings:o}=n;if(o?.access?.apiAccess?.graphqlEnabled===false)throw new Error("GraphQL API is disabled");let w=t.getCollections(),I=t.getGlobals(),m={},u={},f=new Map;for(let r of w){m[r.slug]=new graphql.GraphQLObjectType({name:L(O(r.slug)),fields:()=>({id:{type:graphql.GraphQLString},...J(r,t,m,f),...r.timestamps?{createdAt:{type:graphql.GraphQLString},updatedAt:{type:graphql.GraphQLString}}:{},...r.tenantScoped?{tenantId:{type:graphql.GraphQLString}}:{}})});let $={};for(let A of r.fields)A.name&&A.name!=="id"&&($[A.name]={type:U(A,t,m,true)});u[r.slug]=new graphql.GraphQLInputObjectType({name:`${L(O(r.slug))}Input`,fields:()=>$});}let c={},b={};for(let r of I)c[r.slug]=new graphql.GraphQLObjectType({name:`${L(r.slug)}Global`,fields:()=>({id:{type:graphql.GraphQLString},...J({slug:r.slug,fields:r.fields},t,m)})}),b[r.slug]=new graphql.GraphQLInputObjectType({name:`${L(r.slug)}GlobalInput`,fields:()=>{let $={};for(let A of r.fields)A.name&&A.name!=="id"&&($[A.name]={type:U(A,t,m,true)});return $}});let T={};for(let r of w){let $=m[r.slug];$&&(T[Z(r.slug)]={type:new graphql.GraphQLObjectType({name:`${L(O(r.slug))}FindResult`,fields:{docs:{type:new graphql.GraphQLList($)},totalDocs:{type:graphql.GraphQLInt},page:{type:graphql.GraphQLInt},totalPages:{type:graphql.GraphQLInt},hasNextPage:{type:graphql.GraphQLBoolean},hasPrevPage:{type:graphql.GraphQLBoolean}}}),args:{where:{type:graphql.GraphQLString},sort:{type:graphql.GraphQLString},limit:{type:graphql.GraphQLInt},page:{type:graphql.GraphQLInt},draft:{type:graphql.GraphQLBoolean}},resolve:async(A,_,a)=>{let p=await P(r,"read",{user:a.user,req:a.req,tenantId:a.tenantId,apiKey:a.apiKey});if(!p.allowed)throw new Error("Access denied");a.tenantId&&e.setTenantContext({tenantId:a.tenantId,userId:a.user?.id??"",role:a.user?.role,isSuperAdmin:a.user?.role==="super_admin"});let R={};if(_.where)try{R=JSON.parse(_.where);}catch{}p.extraWhere&&(R={...R,...p.extraWhere});let F=_.draft??!!a.user;return e.find({collection:r.slug,where:R,sort:_.sort,limit:_.limit||10,page:_.page||1,tenantId:a.tenantId,draft:F})}},T[Z(O(r.slug))]={type:$,args:{id:{type:graphql.GraphQLString},slug:{type:graphql.GraphQLString},draft:{type:graphql.GraphQLBoolean}},resolve:async(A,_,a)=>{if(!_.id&&!_.slug)throw new Error("Either id or slug is required");if(!(await P(r,"read",{user:a.user,req:a.req,tenantId:a.tenantId,apiKey:a.apiKey})).allowed)throw new Error("Access denied");a.tenantId&&e.setTenantContext({tenantId:a.tenantId,userId:a.user?.id??"",role:a.user?.role,isSuperAdmin:a.user?.role==="super_admin"});let R=_.draft??!!a.user;return _.id?e.findByID({collection:r.slug,id:_.id,tenantId:a.tenantId,draft:R}):(await e.find({collection:r.slug,where:{slug:{equals:_.slug}},limit:1,page:1,tenantId:a.tenantId,draft:R})).docs?.[0]||null}},T[`count${L(r.slug)}`]={type:new graphql.GraphQLObjectType({name:`${L(O(r.slug))}Count`,fields:{totalDocs:{type:graphql.GraphQLInt}}}),args:{where:{type:graphql.GraphQLString}},resolve:async(A,_,a)=>{if(!(await P(r,"read",{user:a.user,req:a.req,tenantId:a.tenantId,apiKey:a.apiKey})).allowed)return {totalDocs:0};let R={};if(_.where)try{R=JSON.parse(_.where);}catch{}return {totalDocs:await e.count({collection:r.slug,where:R,tenantId:a.tenantId})}}});}for(let r of I){let $=c[r.slug];$&&(T[Z(O(r.slug))]={type:$,resolve:async(A,_,a)=>{if(!(await x(r,"read",{user:a.user,req:a.req,tenantId:a.tenantId,apiKey:a.apiKey})).allowed)throw new Error("Access denied: cannot read global");return a.tenantId&&e.setTenantContext({tenantId:a.tenantId,userId:a.user?.id??"",role:a.user?.role,isSuperAdmin:a.user?.role==="super_admin"}),e.findOne({collection:`_globals_${r.slug}`,where:{},tenantId:a.tenantId})}});}let g=new graphql.GraphQLObjectType({name:"Query",fields:T}),G={};for(let r of w){let $=m[r.slug],A=u[r.slug];!$||!A||(G[`create${L(O(r.slug))}`]={type:new graphql.GraphQLObjectType({name:`${L(O(r.slug))}CreateResult`,fields:{doc:{type:$},message:{type:graphql.GraphQLString}}}),args:{data:{type:new graphql.GraphQLNonNull(A)}},resolve:async(_,a,p)=>{if(!(await P(r,"create",{user:p.user,req:p.req,tenantId:p.tenantId,apiKey:p.apiKey})).allowed)throw new Error("Access denied: cannot create");p.tenantId&&e.setTenantContext({tenantId:p.tenantId,userId:p.user?.id??"",role:p.user?.role,isSuperAdmin:p.user?.role==="super_admin"});let z=t.getCreateZodSchema(r.slug).parse(a.data);return {doc:await e.create({collection:r.slug,data:z,tenantId:p.tenantId}),message:"Created successfully"}}},G[`update${L(O(r.slug))}`]={type:new graphql.GraphQLObjectType({name:`${L(O(r.slug))}UpdateResult`,fields:{doc:{type:$},message:{type:graphql.GraphQLString}}}),args:{id:{type:new graphql.GraphQLNonNull(graphql.GraphQLString)},data:{type:new graphql.GraphQLNonNull(A)},baseUpdatedAt:{type:graphql.GraphQLString}},resolve:async(_,a,p)=>{if(!(await P(r,"update",{user:p.user,req:p.req,tenantId:p.tenantId,apiKey:p.apiKey})).allowed)throw new Error("Access denied: cannot update");if(p.tenantId&&e.setTenantContext({tenantId:p.tenantId,userId:p.user?.id??"",role:p.user?.role,isSuperAdmin:p.user?.role==="super_admin"}),a.baseUpdatedAt){let D=await e.findByID({collection:r.slug,id:a.id,tenantId:p.tenantId,draft:true});if(D&&D.updatedAt&&a.baseUpdatedAt!==D.updatedAt)throw new Error(`Revision conflict: document has changed since ${a.baseUpdatedAt}. Current updatedAt: ${D.updatedAt}`)}let z=t.getUpdateZodSchema(r.slug).parse(a.data);return {doc:await e.update({collection:r.slug,id:a.id,data:z,tenantId:p.tenantId}),message:"Updated successfully"}}},G[`delete${L(O(r.slug))}`]={type:new graphql.GraphQLObjectType({name:`${L(O(r.slug))}DeleteResult`,fields:{doc:{type:$},message:{type:graphql.GraphQLString}}}),args:{id:{type:new graphql.GraphQLNonNull(graphql.GraphQLString)}},resolve:async(_,a,p)=>{if(!(await P(r,"delete",{user:p.user,req:p.req,tenantId:p.tenantId,apiKey:p.apiKey})).allowed)throw new Error("Access denied: cannot delete");return p.tenantId&&e.setTenantContext({tenantId:p.tenantId,userId:p.user?.id??"",role:p.user?.role,isSuperAdmin:p.user?.role==="super_admin"}),{doc:await e.delete({collection:r.slug,id:a.id,tenantId:p.tenantId}),message:"Deleted successfully"}}});}for(let r of I){let $=b[r.slug];$&&(G[`update${L(r.slug)}`]={type:new graphql.GraphQLObjectType({name:`${L(r.slug)}UpdateResult`,fields:{doc:{type:c[r.slug]||graphql.GraphQLString},message:{type:graphql.GraphQLString}}}),args:{data:{type:new graphql.GraphQLNonNull($)}},resolve:async(A,_,a)=>{if(!(await x(r,"update",{user:a.user,req:a.req,tenantId:a.tenantId,apiKey:a.apiKey})).allowed)throw new Error("Access denied: cannot update global");a.tenantId&&e.setTenantContext({tenantId:a.tenantId,userId:a.user?.id??"",role:a.user?.role,isSuperAdmin:a.user?.role==="super_admin"});let R=await e.findOne({collection:`_globals_${r.slug}`,where:{},tenantId:a.tenantId}),F;return R?F=await e.update({collection:`_globals_${r.slug}`,id:R.id,data:_.data,tenantId:a.tenantId}):F=await e.create({collection:`_globals_${r.slug}`,data:_.data,tenantId:a.tenantId}),{doc:F,message:"Updated successfully"}}});}let S=new graphql.GraphQLObjectType({name:"Mutation",fields:G});return new graphql.GraphQLSchema({query:g,mutation:S})}function le(n,t,e){return ne({registry:n,db:t,user:e?.user,req:e?.req,tenantId:e?.tenantId,apiKey:e?.apiKey})}
|
|
2
|
+
Object.defineProperty(exports,"e",{enumerable:true,get:function(){return graphql.printSchema}});exports.a=N;exports.b=ie;exports.c=ne;exports.d=le;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
g$1();g$1();g$1();function g(o){let{brand:e,title:t,badge:r,previewText:s=t,bodyHtml:i,ctaText:n,ctaUrl:a,secondaryCtaText:l,secondaryCtaUrl:p}=o,u=e?.siteName||"Lagos Buka",f=e?.logoUrl||"https://resources.lagosbukasantonio.com/lagosbuka.svg",h=e?.logoDarkUrl||e?.logoUrl||f,U=e?.appUrl||"https://lagosbukasantonio.com";return `<!DOCTYPE html>
|
|
1
|
+
'use strict';var chunkGS4CMYKS_cjs=require('./chunk-GS4CMYKS.cjs');function c(o){let{brand:e,title:t,badge:r,previewText:s=t,bodyHtml:i,ctaText:n,ctaUrl:a,secondaryCtaText:l,secondaryCtaUrl:g}=o,m=e?.siteName||"Lagos Buka",d=e?.logoUrl||"https://resources.lagosbukasantonio.com/lagosbuka.svg",f=e?.logoDarkUrl||e?.logoUrl||d,O=e?.appUrl||"https://lagosbukasantonio.com";return `<!DOCTYPE html>
|
|
3
2
|
<html lang="en">
|
|
4
3
|
<head>
|
|
5
4
|
<meta charset="UTF-8">
|
|
@@ -40,14 +39,14 @@ g$1();g$1();g$1();function g(o){let{brand:e,title:t,badge:r,previewText:s=t,body
|
|
|
40
39
|
<table role="presentation" border="0" cellspacing="0" cellpadding="0" style="margin: 0 auto;">
|
|
41
40
|
<tr>
|
|
42
41
|
<td align="center" valign="middle">
|
|
43
|
-
<a href="${
|
|
42
|
+
<a href="${O}" target="_blank" style="text-decoration: none; display: inline-block;">
|
|
44
43
|
<!-- Brand Logo (preferable before site name) -->
|
|
45
44
|
${`
|
|
46
|
-
<img src="${
|
|
47
|
-
<img src="${
|
|
45
|
+
<img src="${d}" alt="${m}" class="logo-light" height="34" style="display: block; margin: 0 auto 8px auto; max-height: 34px; border: 0;" />
|
|
46
|
+
<img src="${f}" alt="${m}" class="logo-dark" height="34" style="display: none; margin: 0 auto 8px auto; max-height: 34px; border: 0;" />
|
|
48
47
|
`}
|
|
49
48
|
<span class="email-brand-text" style="font-size: 15px; font-weight: 700; color: #0b3b24; letter-spacing: -0.2px; display: block;">
|
|
50
|
-
${
|
|
49
|
+
${m}
|
|
51
50
|
</span>
|
|
52
51
|
</a>
|
|
53
52
|
</td>
|
|
@@ -81,8 +80,8 @@ g$1();g$1();g$1();function g(o){let{brand:e,title:t,badge:r,previewText:s=t,body
|
|
|
81
80
|
<a href="${a}" target="_blank" class="email-btn-primary" style="display: inline-block; padding: 12px 24px; background-color: #0b3b24; color: #ffffff; font-size: 13px; font-weight: 600; text-decoration: none; border-radius: 12px; box-shadow: 0 2px 6px rgba(11, 59, 36, 0.15);">
|
|
82
81
|
${n} →
|
|
83
82
|
</a>
|
|
84
|
-
${l&&
|
|
85
|
-
<a href="${
|
|
83
|
+
${l&&g?`
|
|
84
|
+
<a href="${g}" target="_blank" style="display: inline-block; padding: 12px 20px; margin-left: 8px; background-color: #f8fafc; border: 1px solid #e2e8f0; color: #334155; font-size: 13px; font-weight: 500; text-decoration: none; border-radius: 12px;">
|
|
86
85
|
${l}
|
|
87
86
|
</a>
|
|
88
87
|
`:""}
|
|
@@ -98,13 +97,13 @@ g$1();g$1();g$1();function g(o){let{brand:e,title:t,badge:r,previewText:s=t,body
|
|
|
98
97
|
<td class="email-footer" style="padding: 20px 32px; border-top: 1px solid #f1f5f9; background-color: #fafafa; text-align: center;">
|
|
99
98
|
<p class="email-footer-text" style="margin: 0; font-size: 12px; color: #64748b; line-height: 1.5;">
|
|
100
99
|
${e?.address?`${e.address} · `:""}
|
|
101
|
-
<a href="${
|
|
100
|
+
<a href="${O}" target="_blank" style="color: #0b3b24; text-decoration: none; font-weight: 600;">${m}</a>
|
|
102
101
|
</p>
|
|
103
102
|
</td>
|
|
104
103
|
</tr>
|
|
105
104
|
</table>
|
|
106
105
|
</body>
|
|
107
|
-
</html>`}
|
|
106
|
+
</html>`}function y(o,e="User",t){let r="Confirm your email address \u2014 Kyro CMS",s=`
|
|
108
107
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
109
108
|
Hello <strong class="email-strong" style="color: #09090b;">${e}</strong>,
|
|
110
109
|
</p>
|
|
@@ -125,14 +124,14 @@ g$1();g$1();g$1();function g(o){let{brand:e,title:t,badge:r,previewText:s=t,body
|
|
|
125
124
|
<p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
|
|
126
125
|
This verification link will expire in 24 hours. If you did not create an account, you can safely ignore this email.
|
|
127
126
|
</p>
|
|
128
|
-
`,i=
|
|
127
|
+
`,i=c({brand:t,title:"Confirm Your Email Address",previewText:"Please confirm your email address to activate your Kyro CMS account.",bodyHtml:s,ctaText:"Confirm Email Address",ctaUrl:o,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),n=`Welcome, ${e}!
|
|
129
128
|
|
|
130
129
|
Please verify your email address by visiting:
|
|
131
130
|
${o}
|
|
132
131
|
|
|
133
132
|
This link expires in 24 hours.
|
|
134
133
|
|
|
135
|
-
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}
|
|
134
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}function b(o,e="User",t){let r="Reset your password \u2014 Kyro CMS",s=`
|
|
136
135
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
137
136
|
Hello <strong class="email-strong" style="color: #09090b;">${e}</strong>,
|
|
138
137
|
</p>
|
|
@@ -153,14 +152,14 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}g$1();fun
|
|
|
153
152
|
<p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
|
|
154
153
|
For security reasons, this link will expire in 1 hour. If you did not request a password reset, no further action is required.
|
|
155
154
|
</p>
|
|
156
|
-
`,i=
|
|
155
|
+
`,i=c({brand:t,title:"Reset Your Password",previewText:"Use this secure link to reset your Kyro CMS password.",bodyHtml:s,ctaText:"Reset Password",ctaUrl:o}),n=`Hello ${e},
|
|
157
156
|
|
|
158
157
|
Reset your password using the following link:
|
|
159
158
|
${o}
|
|
160
159
|
|
|
161
160
|
This link will expire in 1 hour.
|
|
162
161
|
|
|
163
|
-
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}
|
|
162
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}function x(o="User",e="https://kyro-cms.com",t){let r="Welcome to Kyro CMS!",s=`
|
|
164
163
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
165
164
|
Welcome <strong class="email-strong" style="color: #09090b;">${o}</strong>,
|
|
166
165
|
</p>
|
|
@@ -181,11 +180,11 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:r,html:i,text:n}}g$1();fun
|
|
|
181
180
|
</td>
|
|
182
181
|
</tr>
|
|
183
182
|
</table>
|
|
184
|
-
`,i=
|
|
183
|
+
`,i=c({brand:t,title:"Welcome to Kyro CMS",previewText:"Your account is verified and ready. Start building content applications.",bodyHtml:s,ctaText:"Open Dashboard",ctaUrl:e,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),n=`Welcome to Kyro CMS, ${o}!
|
|
185
184
|
|
|
186
185
|
Your account is active. Log in at ${e} to start building.
|
|
187
186
|
|
|
188
|
-
Documentation: https://kyro-cms.com/docs`;return {subject:r,html:i,text:n}}
|
|
187
|
+
Documentation: https://kyro-cms.com/docs`;return {subject:r,html:i,text:n}}function _(o="User",e,t,r){let s="Security Alert: Password Changed \u2014 Kyro CMS",i=new Date().toUTCString(),n=`
|
|
189
188
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
|
|
190
189
|
Hello <strong class="email-strong" style="color: #09090b;">${o}</strong>,
|
|
191
190
|
</p>
|
|
@@ -212,11 +211,11 @@ Documentation: https://kyro-cms.com/docs`;return {subject:r,html:i,text:n}}g$1()
|
|
|
212
211
|
</td>
|
|
213
212
|
</tr>
|
|
214
213
|
</table>`:""}
|
|
215
|
-
`,a=
|
|
214
|
+
`,a=c({brand:e,title:"Password Updated",previewText:"Your Kyro CMS account password was updated.",bodyHtml:n,ctaText:"Account Security",ctaUrl:"https://kyro-cms.com"}),l=`Security Alert: Your Kyro CMS password was updated at ${i}.
|
|
216
215
|
|
|
217
216
|
If you did not make this change, please reset your password immediately.
|
|
218
217
|
|
|
219
|
-
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:a,text:l}}
|
|
218
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:a,text:l}}function w(o,e,t="User",r){let s="Your one-time login link \u2014 Kyro CMS",i=`
|
|
220
219
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
221
220
|
Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
|
|
222
221
|
</p>
|
|
@@ -242,7 +241,7 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:a,text:l}}g$1();fun
|
|
|
242
241
|
<p class="email-text" style="margin: 0 0 8px; font-size: 12px; color: #71717a;">
|
|
243
242
|
This single-use link will expire in 10 minutes. Never share authentication links with anyone.
|
|
244
243
|
</p>
|
|
245
|
-
`,n=
|
|
244
|
+
`,n=c({brand:r,title:"Sign in to Kyro CMS",previewText:"Your secure magic login link for Kyro CMS.",bodyHtml:i,ctaText:"Sign In Now",ctaUrl:o}),a=`Hello ${t},
|
|
246
245
|
|
|
247
246
|
Sign in to Kyro CMS using the link below:
|
|
248
247
|
${o}${e?`
|
|
@@ -251,7 +250,7 @@ Or enter code: ${e}`:""}
|
|
|
251
250
|
|
|
252
251
|
This link expires in 10 minutes.
|
|
253
252
|
|
|
254
|
-
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}
|
|
253
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}function S(o,e,t="User",r,s,i){let n="Security Alert: Account Temporarily Locked \u2014 Kyro CMS",a=`
|
|
255
254
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
|
|
256
255
|
Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
|
|
257
256
|
</p>
|
|
@@ -278,9 +277,9 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}g$1();fun
|
|
|
278
277
|
</td>
|
|
279
278
|
</tr>
|
|
280
279
|
</table>`:""}
|
|
281
|
-
`,l=
|
|
280
|
+
`,l=c({brand:r,title:"Account Temporarily Locked",previewText:"Your Kyro CMS account was locked due to multiple failed login attempts.",bodyHtml:a,ctaText:"Unlock Instructions",ctaUrl:"https://kyro-cms.com/docs"}),g=`Security Alert: Account temporarily locked for ${t} after ${o} failed login attempts. Unlocks in ${e} minutes.
|
|
282
281
|
|
|
283
|
-
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:n,html:l,text:
|
|
282
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:n,html:l,text:g}}function C(o,e="Editor",t="An Administrator",r){let s="You're invited to join Kyro CMS",i=`
|
|
284
283
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
285
284
|
Hello,
|
|
286
285
|
</p>
|
|
@@ -297,12 +296,12 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:n,html:l,text:p}}g$1();fun
|
|
|
297
296
|
</td>
|
|
298
297
|
</tr>
|
|
299
298
|
</table>
|
|
300
|
-
`,n=
|
|
299
|
+
`,n=c({brand:r,title:"Workspace Invitation",previewText:`You have been invited to join Kyro CMS as an ${e}.`,bodyHtml:i,ctaText:"Accept Invitation",ctaUrl:o,secondaryCtaText:"Documentation",secondaryCtaUrl:"https://kyro-cms.com/docs"}),a=`You're invited to join Kyro CMS as an ${e} by ${t}.
|
|
301
300
|
|
|
302
301
|
Accept your invitation here:
|
|
303
302
|
${o}
|
|
304
303
|
|
|
305
|
-
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}
|
|
304
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}function T(o,e,t="User",r,s="Unknown Device"){let i="Security Alert: New Sign-in to Kyro CMS",n=`
|
|
306
305
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b; text-align: center;">
|
|
307
306
|
Hello <strong class="email-strong" style="color: #09090b;">${t}</strong>,
|
|
308
307
|
</p>
|
|
@@ -330,7 +329,7 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:s,html:n,text:a}}g$1();fun
|
|
|
330
329
|
</td>
|
|
331
330
|
</tr>
|
|
332
331
|
</table>
|
|
333
|
-
`,a=
|
|
332
|
+
`,a=c({brand:r,title:"New Sign-in Detected",previewText:"A new sign-in was detected on your Kyro CMS account.",bodyHtml:n,ctaText:"Review Account Security",ctaUrl:"https://kyro-cms.com"}),l=`Security Alert: New Sign-in to Kyro CMS
|
|
334
333
|
|
|
335
334
|
Hello ${t},
|
|
336
335
|
|
|
@@ -338,7 +337,7 @@ A new sign-in to your account was detected at ${e} from ${o} using ${s}.
|
|
|
338
337
|
|
|
339
338
|
If you did not sign in recently, please reset your password immediately.
|
|
340
339
|
|
|
341
|
-
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:i,html:a,text:l}}
|
|
340
|
+
Kyro CMS \u2014 https://kyro-cms.com`;return {subject:i,html:a,text:l}}function k(o,e="Customer",t,r,s){let i=`Order confirmed #${o}`,n=`
|
|
342
341
|
<p class="email-text" style="margin: 0 0 14px; font-size: 14px; line-height: 1.6; color: #475569; text-align: center;">
|
|
343
342
|
Hi ${e}, thanks for your order. We're getting your food freshly prepared.
|
|
344
343
|
</p>
|
|
@@ -363,13 +362,13 @@ Kyro CMS \u2014 https://kyro-cms.com`;return {subject:i,html:a,text:l}}g$1();fun
|
|
|
363
362
|
<p style="margin: 0; font-size: 12px; color: #94a3b8; text-align: center; line-height: 1.5;">
|
|
364
363
|
You can track the live preparation and delivery status anytime.
|
|
365
364
|
</p>
|
|
366
|
-
`,a=
|
|
365
|
+
`,a=c({brand:s,title:"Order Confirmed",badge:"Order received",previewText:`Your order #${o} has been confirmed.`,bodyHtml:n,ctaText:"Track order live",ctaUrl:r||"https://lagosbukasantonio.com/track-order"}),l=`Hi ${e},
|
|
367
366
|
|
|
368
367
|
Thank you for your order #${o}!
|
|
369
368
|
|
|
370
369
|
Total: ${t}
|
|
371
370
|
|
|
372
|
-
Track your order: ${r||"https://lagosbukasantonio.com"}`;return {subject:i,html:a,text:l}}
|
|
371
|
+
Track your order: ${r||"https://lagosbukasantonio.com"}`;return {subject:i,html:a,text:l}}function E(o,e="Customer",t,r,s){let i=`Your Order #${o} is on the way!`,n=`
|
|
373
372
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
374
373
|
Great news, <strong class="email-strong" style="color: #09090b;">${e}</strong>!
|
|
375
374
|
</p>
|
|
@@ -384,12 +383,12 @@ Track your order: ${r||"https://lagosbukasantonio.com"}`;return {subject:i,html:
|
|
|
384
383
|
</td>
|
|
385
384
|
</tr>
|
|
386
385
|
</table>
|
|
387
|
-
`,a=
|
|
386
|
+
`,a=c({brand:s,title:"Order Shipped",previewText:`Your order #${o} has shipped. Track your package now.`,bodyHtml:n,ctaText:"Track Package",ctaUrl:r}),l=`Hi ${e},
|
|
388
387
|
|
|
389
388
|
Your order #${o} has been shipped!
|
|
390
389
|
|
|
391
390
|
Tracking Number: ${t}
|
|
392
|
-
Track it here: ${r}`;return {subject:i,html:a,text:l}}
|
|
391
|
+
Track it here: ${r}`;return {subject:i,html:a,text:l}}function v(o,e="Customer",t,r){let s=`Your Order #${o} has been delivered`,i=`
|
|
393
392
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
394
393
|
Hi <strong class="email-strong" style="color: #09090b;">${e}</strong>,
|
|
395
394
|
</p>
|
|
@@ -399,11 +398,11 @@ Track it here: ${r}`;return {subject:i,html:a,text:l}}g$1();function R(o,e="Cust
|
|
|
399
398
|
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
400
399
|
We'd love to hear your thoughts. If you have a minute, please leave a review for your items.
|
|
401
400
|
</p>
|
|
402
|
-
`,n=
|
|
401
|
+
`,n=c({brand:r,title:"Order Delivered",previewText:`Your order #${o} has arrived!`,bodyHtml:i,ctaText:"Leave a Review",ctaUrl:t}),a=`Hi ${e},
|
|
403
402
|
|
|
404
403
|
Your order #${o} has been delivered!
|
|
405
404
|
|
|
406
|
-
Leave a review here: ${t}`;return {subject:s,html:n,text:a}}
|
|
405
|
+
Leave a review here: ${t}`;return {subject:s,html:n,text:a}}function A(o,e="Customer",t,r){let s=`Refund Processed for Order #${o}`,i=`
|
|
407
406
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
408
407
|
Hi <strong class="email-strong" style="color: #09090b;">${e}</strong>,
|
|
409
408
|
</p>
|
|
@@ -418,32 +417,32 @@ Leave a review here: ${t}`;return {subject:s,html:n,text:a}}g$1();function I(o,e
|
|
|
418
417
|
</td>
|
|
419
418
|
</tr>
|
|
420
419
|
</table>
|
|
421
|
-
`,n=
|
|
420
|
+
`,n=c({brand:r,title:"Refund Processed",previewText:`We have processed a refund of ${t} for order #${o}.`,bodyHtml:i,ctaText:"View Store",ctaUrl:"https://kyro-cms.com"}),a=`Hi ${e},
|
|
422
421
|
|
|
423
422
|
We have processed a refund of ${t} for order #${o}.
|
|
424
423
|
|
|
425
|
-
View store: https://kyro-cms.com`;return {subject:s,html:n,text:a}}
|
|
424
|
+
View store: https://kyro-cms.com`;return {subject:s,html:n,text:a}}function R(o="Customer",e,t){let r="You left something behind...",s=`
|
|
426
425
|
<p class="email-text" style="margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
427
426
|
Hi <strong class="email-strong" style="color: #09090b;">${o}</strong>,
|
|
428
427
|
</p>
|
|
429
428
|
<p class="email-text" style="margin: 0 0 20px; font-size: 14px; line-height: 1.6; color: #52525b;">
|
|
430
429
|
We noticed you left some great items in your shopping cart. They are still waiting for you, but they might sell out soon!
|
|
431
430
|
</p>
|
|
432
|
-
`,i=
|
|
431
|
+
`,i=c({brand:t,title:"Complete Your Purchase",previewText:"Your shopping cart is waiting for you. Complete your purchase now.",bodyHtml:s,ctaText:"Return to Checkout",ctaUrl:e}),n=`Hi ${o},
|
|
433
432
|
|
|
434
|
-
You left some items in your cart! Complete your purchase here: ${e}`;return {subject:r,html:i,text:n}}function
|
|
433
|
+
You left some items in your cart! Complete your purchase here: ${e}`;return {subject:r,html:i,text:n}}function I(o){return {verifyEmail:(e,t)=>y(e,t,o),resetPassword:(e,t)=>b(e,t,o),welcome:(e,t)=>x(e,t,o),passwordChanged:e=>_(e,o),magicLink:(e,t,r)=>w(e,t,r,o),accountLocked:(e,t,r)=>S(e,t,r,o),newLogin:(e,t,r)=>T(e,t,r,o),userInvite:(e,t,r)=>C(e,t,r,o),orderConfirmation:(e,t,r,s)=>k(e,t,r||"0.00",s,o),orderShipped:(e,t,r,s)=>E(e,t,r||"",s||"",o),orderDelivered:(e,t,r)=>v(e,t,r||"",o),orderRefunded:(e,t,r)=>A(e,t,r||"0.00",o),abandonedCart:(e,t)=>R(e,t||"",o)}}var $=false,h=class o{db;cache={};loaded=false;static SENSITIVE_KEYS=["storage.s3.secret_access_key","storage.r2.secret_access_key","storage.gcs.private_key","storage.backblaze.application_key","storage.wasabi.secret_access_key","storage.ftp.password","storage.bunny.api_key","storage.cloudinary.api_secret","storage.imgix.sign_key","email.smtp.pass","auth.jwt_secret","auth.github_secret","auth.google_secret","auth.app_secret","database.url","redis.url","auth.admin_password"];constructor(e){this.db=e;}async load(){if(!this.loaded){await this.ensureSettingsTable();try{if(typeof this.db?.select=="function"){let e=await this.db.select().from(chunkGS4CMYKS_cjs.a);this.cache=e.reduce((t,r)=>(t[r.key]=r.value,t),{});}await this.loadFromGlobals();}catch{console.warn("ConfigService: Could not load settings from database, using environment fallbacks.");}this.loaded=true;}}async ensureSettingsTable(){if(!$)try{if(typeof this.db?.execute=="function"){let{sql:e}=await import('drizzle-orm');await this.db.execute(e`
|
|
435
434
|
CREATE TABLE IF NOT EXISTS "settings" (
|
|
436
435
|
"key" VARCHAR(255) PRIMARY KEY,
|
|
437
436
|
"value" TEXT NOT NULL,
|
|
438
437
|
"description" TEXT,
|
|
439
438
|
"updated_at" TIMESTAMP DEFAULT NOW()
|
|
440
439
|
)
|
|
441
|
-
`)
|
|
440
|
+
`),$=!0;}else typeof this.db?.exec=="function"&&(this.db.exec(`
|
|
442
441
|
CREATE TABLE IF NOT EXISTS settings (
|
|
443
442
|
key TEXT PRIMARY KEY,
|
|
444
443
|
value TEXT NOT NULL,
|
|
445
444
|
description TEXT,
|
|
446
445
|
updated_at TEXT
|
|
447
446
|
)
|
|
448
|
-
`),K=!0);}catch{}}async loadFromGlobals(){try{let e=null;if(typeof this.db?.findOne=="function")try{let s=await this.db.findOne({collection:"_globals_storage-settings",where:{},draft:!0});s&&(e=s);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:s}=await import('./drizzle-orm-XRTSOQJS.js'),i=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let n of i)try{let a=await this.db.execute(s`SELECT * FROM ${s.raw(n)} LIMIT 1`);if(e=Array.isArray(a)?a[0]:a?.rows?a.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let s=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let i of s)try{if(e=this.db.prepare(`SELECT * FROM ${i} LIMIT 1`).get(),e)break}catch{}}if(!e)return;let t=s=>{if(!s)return null;if(typeof s=="string")try{return JSON.parse(s)}catch{return null}return s},r=e.provider||"local";if(this.cache["storage.type"]=r,r==="local"){let s=t(e.local);this.cache["storage.local.dir"]=s?.uploadDir||"./public/uploads",this.cache["storage.local.url"]=s?.baseUrl||"/uploads";}if(r==="aws"){let s=t(e.aws);this.cache["storage.s3.bucket"]=s?.bucket||"",this.cache["storage.s3.region"]=s?.region||"us-east-1",this.cache["storage.s3.access_key_id"]=s?.accessKeyId||"",this.cache["storage.s3.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.s3.endpoint"]=s?.endpoint||"",this.cache["storage.s3.cdn_url"]=s?.cdnUrl||"",this.cache["storage.s3.prefix"]=s?.prefix||"";}if(r==="r2"){let s=t(e.r2);this.cache["storage.r2.account_id"]=s?.accountId||"",this.cache["storage.r2.access_key_id"]=s?.accessKeyId||"",this.cache["storage.r2.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.r2.bucket"]=s?.bucket||"",this.cache["storage.r2.cdn_url"]=s?.cdnUrl||"",this.cache["storage.r2.prefix"]=s?.prefix||"";}if(r==="cloudinary"){let s=t(e.cloudinary);this.cache["storage.cloudinary.cloud_name"]=s?.cloudName||"",this.cache["storage.cloudinary.api_key"]=s?.apiKey||"",this.cache["storage.cloudinary.api_secret"]=s?.apiSecret||"",this.cache["storage.cloudinary.folder"]=s?.folder||"";}if(r==="ftp"){let s=t(e.ftp);this.cache["storage.ftp.host"]=s?.host||"",this.cache["storage.ftp.port"]=String(s?.port||"21"),this.cache["storage.ftp.user"]=s?.user||"",this.cache["storage.ftp.password"]=s?.password||"",this.cache["storage.ftp.secure"]=s?.secure?"true":"false",this.cache["storage.ftp.base_url"]=s?.baseUrl||"",this.cache["storage.ftp.prefix"]=s?.prefix||"";}}catch(e){console.warn("ConfigService: Could not load storage settings from globals table:",e);}try{let e=null;if(typeof this.db?.findOne=="function")try{let t=await this.db.findOne({collection:"_globals_email-settings",where:{},draft:!0});t&&(e=t);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:t}=await import('./drizzle-orm-XRTSOQJS.js'),r=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let s of r)try{let i=await this.db.execute(t`SELECT * FROM ${t.raw(s)} LIMIT 1`);if(e=Array.isArray(i)?i[0]:i?.rows?i.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let t=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let r of t)try{if(e=this.db.prepare(`SELECT * FROM ${r} LIMIT 1`).get(),e)break}catch{}}if(e){let t=r=>{if(!r)return null;if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return r};if(this.cache["email.provider"]=e.provider||"smtp",this.cache["email.smtp.from"]=e.fromEmail||"",this.cache["email.smtp.from_name"]=e.fromName||"",this.cache["email.smtp.reply_to"]=e.replyTo||"",e.provider==="smtp"){let r=t(e.smtp);this.cache["email.smtp.host"]=r?.host||"",this.cache["email.smtp.port"]=String(r?.port||"587"),this.cache["email.smtp.user"]=r?.username||"",this.cache["email.smtp.pass"]=r?.password||"",this.cache["email.smtp.secure"]=r?.secure?"true":"false";}else if(e.provider==="resend"){let r=t(e.resend);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="sendgrid"){let r=t(e.sendgrid);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="mailgun"){let r=t(e.mailgun);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="ses"){let r=t(e.ses);this.cache["email.smtp.user"]=r?.accessKeyId||"",this.cache["email.smtp.pass"]=r?.secretAccessKey||"";}}}catch(e){console.warn("ConfigService: Could not load email settings from globals table:",e);}}get(e,t,r){return this.cache[e]?this.cache[e]:t&&process.env[t]?process.env[t]:r}getStorageConfig(){let e="local";return typeof globalThis.STORAGE_BUCKET<"u"&&(e="cloudflare_r2"),{type:this.get("storage.type","STORAGE_TYPE",e),s3:{bucket:this.get("storage.s3.bucket","STORAGE_BUCKET"),region:this.get("storage.s3.region","STORAGE_REGION","us-east-1"),accessKeyId:this.get("storage.s3.access_key_id","STORAGE_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.s3.secret_access_key","STORAGE_SECRET_ACCESS_KEY"),endpoint:this.get("storage.s3.endpoint","STORAGE_ENDPOINT"),cdnUrl:this.get("storage.s3.cdn_url","STORAGE_CDN_URL"),prefix:this.get("storage.s3.prefix","STORAGE_PREFIX")},r2:{accountId:this.get("storage.r2.account_id","R2_ACCOUNT_ID"),accessKeyId:this.get("storage.r2.access_key_id","R2_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.r2.secret_access_key","R2_SECRET_ACCESS_KEY"),bucket:this.get("storage.r2.bucket","R2_BUCKET"),cdnUrl:this.get("storage.r2.cdn_url","R2_CDN_URL"),prefix:this.get("storage.r2.prefix","R2_PREFIX")},gcs:{bucket:this.get("storage.gcs.bucket","GCS_BUCKET"),projectId:this.get("storage.gcs.project_id","GCS_PROJECT_ID"),clientEmail:this.get("storage.gcs.client_email","GCS_CLIENT_EMAIL"),privateKey:this.get("storage.gcs.private_key","GCS_PRIVATE_KEY"),cdnUrl:this.get("storage.gcs.cdn_url","GCS_CDN_URL"),prefix:this.get("storage.gcs.prefix","GCS_PREFIX")},digitalocean:{bucket:this.get("storage.digitalocean.bucket","DO_BUCKET"),region:this.get("storage.digitalocean.region","DO_REGION","nyc3"),accessKeyId:this.get("storage.digitalocean.access_key_id","DO_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.digitalocean.secret_access_key","DO_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.digitalocean.cdn_url","DO_CDN_URL"),prefix:this.get("storage.digitalocean.prefix","DO_PREFIX")},backblaze:{bucket:this.get("storage.backblaze.bucket","BB_BUCKET"),accountId:this.get("storage.backblaze.account_id","BB_ACCOUNT_ID"),applicationKeyId:this.get("storage.backblaze.application_key_id","BB_APPLICATION_KEY_ID"),applicationKey:this.get("storage.backblaze.application_key","BB_APPLICATION_KEY"),cdnUrl:this.get("storage.backblaze.cdn_url","BB_CDN_URL"),prefix:this.get("storage.backblaze.prefix","BB_PREFIX")},wasabi:{bucket:this.get("storage.wasabi.bucket","WASABI_BUCKET"),region:this.get("storage.wasabi.region","WASABI_REGION","us-east-1"),accessKeyId:this.get("storage.wasabi.access_key_id","WASABI_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.wasabi.secret_access_key","WASABI_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.wasabi.cdn_url","WASABI_CDN_URL"),prefix:this.get("storage.wasabi.prefix","WASABI_PREFIX")},bunny:{storageZone:this.get("storage.bunny.storage_zone","BUNNY_STORAGE_ZONE"),apiKey:this.get("storage.bunny.api_key","BUNNY_API_KEY"),cdnUrl:this.get("storage.bunny.cdn_url","BUNNY_CDN_URL"),prefix:this.get("storage.bunny.prefix","BUNNY_PREFIX")},ftp:{host:this.get("storage.ftp.host","FTP_HOST"),port:parseInt(this.get("storage.ftp.port","FTP_PORT","21"),10),user:this.get("storage.ftp.user","FTP_USER"),password:this.get("storage.ftp.password","FTP_PASSWORD"),secure:this.get("storage.ftp.secure","FTP_SECURE")==="true",baseUrl:this.get("storage.ftp.base_url","FTP_BASE_URL"),prefix:this.get("storage.ftp.prefix","FTP_PREFIX")},cloudinary:{cloudName:this.get("storage.cloudinary.cloud_name","CLOUDINARY_CLOUD_NAME"),apiKey:this.get("storage.cloudinary.api_key","CLOUDINARY_API_KEY"),apiSecret:this.get("storage.cloudinary.api_secret","CLOUDINARY_API_SECRET"),folder:this.get("storage.cloudinary.folder","CLOUDINARY_FOLDER")},imgix:{domain:this.get("storage.imgix.domain","IMGIX_DOMAIN"),signKey:this.get("storage.imgix.sign_key","IMGIX_SIGN_KEY")},local:{uploadDir:this.get("storage.local.dir","STORAGE_LOCAL_DIR","./public/uploads"),baseUrl:this.get("storage.local.url","STORAGE_LOCAL_URL","/uploads")}}}getEmailConfig(){return {provider:this.get("email.provider","EMAIL_PROVIDER","smtp"),host:this.get("email.smtp.host","SMTP_HOST"),port:parseInt(this.get("email.smtp.port","SMTP_PORT","587"),10),secure:this.get("email.smtp.secure","SMTP_SECURE")==="true",user:this.get("email.smtp.user","SMTP_USER"),pass:this.get("email.smtp.pass","SMTP_PASS"),from:this.get("email.smtp.from","SMTP_FROM","noreply@example.com"),fromName:this.get("email.smtp.from_name","SMTP_FROM_NAME","Kyro CMS"),replyTo:this.get("email.smtp.reply_to","SMTP_REPLY_TO")}}maskSensitive(e,t){return t&&(o.SENSITIVE_KEYS.includes(e)?"********":t)}async set(e,t,r){await this.db.insert(a).values({key:e,value:t,description:r,updatedAt:new Date}).onConflictDoUpdate({target:[a.key],set:{value:t,description:r,updatedAt:new Date}}),this.cache[e]=t;}};var P=class o{transporter;config;templates;transporterInitialized=false;constructor(e,t){this.config=e,this.templates={...O(e.brand),...t};}async ensureTransporter(){if(this.transporterInitialized)return this.transporter;let{default:e}=await import('./nodemailer-NITB45SS.js');return this.config.provider==="smtp"&&this.config.smtp?this.transporter=e.createTransport({host:this.config.smtp.host,port:this.config.smtp.port,secure:this.config.smtp.secure,auth:this.config.smtp.auth}):this.config.provider==="ses"&&this.config.ses&&(this.transporter=e.createTransport({host:`email-smtp.${this.config.ses.region}.amazonaws.com`,port:587,secure:false,auth:{user:this.config.ses.accessKeyId,pass:this.config.ses.secretAccessKey}})),this.transporterInitialized=true,this.transporter}async send(e){let{provider:t,from:r,fromName:s,replyTo:i}=this.config,n=`"${s||"Kyro CMS"}" <${r}>`,a=e.replyTo||i;try{let l;switch(t){case "smtp":case "ses":{let p=await this.ensureTransporter();if(!p)throw new Error(`${t} transporter not initialized`);l=await p.sendMail({from:n,to:Array.isArray(e.to)?e.to.join(", "):e.to,subject:e.subject,html:e.html,text:e.text,replyTo:a});}break;case "resend":l=await this.sendViaResend(n,e,a);break;case "sendgrid":l=await this.sendViaSendGrid(n,e,a);break;case "mailgun":l=await this.sendViaMailgun(n,e,a);break;default:throw new Error(`Unsupported email provider: ${t}`)}return l}catch(l){throw console.error("[EmailTransport] FAILED to send email:",l.message),l.response&&console.error("[EmailTransport] Provider Error Detail:",JSON.stringify(l.response,null,2)),l}}async sendViaResend(e,t,r){let s=this.config.resend?.apiKey;if(!s)throw new Error("Resend API Key missing");let i={from:e,to:t.to,subject:t.subject,html:t.html,text:t.text,reply_to:r},n=await fetch("https://api.resend.com/emails",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){let a=await n.json();throw new Error(`Resend Error: ${JSON.stringify(a)}`)}return n.json()}async sendViaSendGrid(e,t,r){let s=this.config.sendgrid?.apiKey;if(!s)throw new Error("SendGrid API Key missing");let i={personalizations:[{to:Array.isArray(t.to)?t.to.map(a=>({email:a})):[{email:t.to}]}],from:{email:e.match(/<(.+)>/)?.[1]||e,name:e.match(/"(.+)"/)?.[1]},subject:t.subject,content:[{type:"text/plain",value:t.text||""},{type:"text/html",value:t.html}],reply_to:r?{email:r}:void 0},n=await fetch("https://api.sendgrid.com/v3/mail/send",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){let a=await n.json();throw new Error(`SendGrid Error: ${JSON.stringify(a)}`)}return {success:true}}async sendViaMailgun(e,t,r){let{apiKey:s,domain:i,region:n}=this.config.mailgun||{};if(!s||!i)throw new Error("Mailgun config missing");let a=n==="eu"?"api.eu.mailgun.net":"api.mailgun.net",l=btoa(`api:${s}`),p=new URLSearchParams;p.append("from",e);let u=Array.isArray(t.to)?t.to.join(", "):t.to;p.append("to",u),p.append("subject",t.subject),p.append("html",t.html),t.text&&p.append("text",t.text),r&&p.append("h:Reply-To",r);let f=await fetch(`https://${a}/v3/${i}/messages`,{method:"POST",headers:{Authorization:`Basic ${l}`,"Content-Type":"application/x-www-form-urlencoded"},body:p});if(!f.ok){let h=await f.json();throw new Error(`Mailgun Error: ${JSON.stringify(h)}`)}return f.json()}getTemplates(){return this.templates}async verifyConnection(){if(this.config.provider==="smtp"||this.config.provider==="ses")try{let e=await this.ensureTransporter();if(e)return await e.verify(),!0}catch{return false}return !!(this.config.resend?.apiKey||this.config.sendgrid?.apiKey||this.config.mailgun?.apiKey)}static async fetchBrandConfig(e){let t="Kyro CMS",r="https://kyro-cms.com/logo.svg",s="https://kyro-cms.com/logo-white.svg";try{let i=null,n=null;if(typeof e?.findOne=="function")i=await e.findOne({collection:"_globals_store-settings",where:{},draft:!0}),n=await e.findOne({collection:"_globals_brand-settings",where:{},draft:!0});else if(typeof e?.execute=="function"){let{sql:a}=await import('./drizzle-orm-XRTSOQJS.js');try{let l=await e.execute(a`SELECT * FROM "_globals_store-settings" LIMIT 1`);i=Array.isArray(l)?l[0]:l?.rows?l.rows[0]:null;}catch{}try{let l=await e.execute(a`SELECT * FROM "_globals_brand-settings" LIMIT 1`);n=Array.isArray(l)?l[0]:l?.rows?l.rows[0]:null;}catch{}}else if(typeof e?.prepare=="function"){try{i=e.prepare('SELECT * FROM "_globals_store-settings" LIMIT 1').get();}catch{}try{n=e.prepare('SELECT * FROM "_globals_brand-settings" LIMIT 1').get();}catch{}}if(i?.storeName&&(t=i.storeName),n?.identity){let a=typeof n.identity=="string"?JSON.parse(n.identity):n.identity,l=async p=>{if(typeof e?.findOne=="function")return (await e.findOne({collection:"media",where:{id:{equals:p}}}))?.url;if(typeof e?.execute=="function"){let{sql:u}=await import('./drizzle-orm-XRTSOQJS.js');try{let f=await e.execute(u`SELECT url FROM "media" WHERE id = ${p}`);return (Array.isArray(f)?f[0]:f?.rows?f.rows[0]:null)?.url}catch{}}else if(typeof e?.prepare=="function")try{return e.prepare('SELECT url FROM "media" WHERE id = ?').get(p)?.url}catch{}};if(a.primaryLogo){let p=await l(a.primaryLogo);p&&(r=p);}if(a.darkLogo){let p=await l(a.darkLogo);p&&(s=p);}}}catch{}return {siteName:t,logoUrl:r,logoDarkUrl:s,appUrl:process.env.PUBLIC_URL||"https://kyro-cms.com"}}static async fromConfig(e){let t=new b(e);await t.load();let r=t.getEmailConfig();if(!r.provider)return this.fromEnv();let i={brand:await this.fetchBrandConfig(e),provider:r.provider||"smtp",from:r.from||"noreply@example.com",fromName:r.fromName,replyTo:r.replyTo,smtp:r.provider==="smtp"?{host:r.host||"",port:r.port||587,secure:r.secure||false,auth:{user:r.user||"",pass:r.pass||""}}:void 0,resend:r.provider==="resend"?{apiKey:r.pass||""}:void 0,sendgrid:r.provider==="sendgrid"?{apiKey:r.pass||""}:void 0,mailgun:r.provider==="mailgun"?{apiKey:r.pass||"",domain:r.host||"",region:r.secure?"eu":"us"}:void 0,ses:r.provider==="ses"?{accessKeyId:r.user||"",secretAccessKey:r.pass||"",region:r.host||"us-east-1"}:void 0};return new o(i)}static fromEnv(){let e=process.env.EMAIL_PROVIDER||"smtp",t=process.env.SMTP_FROM||process.env.DEFAULT_FROM||"noreply@example.com",r=process.env.SMTP_FROM_NAME||"Kyro CMS",s=process.env.SMTP_REPLY_TO;if(e==="smtp"){let i=process.env.SMTP_HOST,n=process.env.SMTP_USER,a=process.env.SMTP_PASS;return !i||!n||!a?null:new o({provider:"smtp",from:t,fromName:r,replyTo:s,smtp:{host:i,port:parseInt(process.env.SMTP_PORT||"587",10),secure:process.env.SMTP_SECURE==="true",auth:{user:n,pass:a}}})}if(e==="resend"){let i=process.env.RESEND_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"resend",from:t,fromName:r,replyTo:s,resend:{apiKey:i}}):null}if(e==="sendgrid"){let i=process.env.SENDGRID_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"sendgrid",from:t,fromName:r,replyTo:s,sendgrid:{apiKey:i}}):null}if(e==="mailgun"){let i=process.env.MAILGUN_API_KEY||process.env.SMTP_PASS,n=process.env.MAILGUN_DOMAIN||process.env.SMTP_HOST;return !i||!n?null:new o({provider:"mailgun",from:t,fromName:r,replyTo:s,mailgun:{apiKey:i,domain:n,region:process.env.MAILGUN_REGION||(process.env.SMTP_SECURE==="true"?"eu":"us")}})}if(e==="ses"){let i=process.env.AWS_ACCESS_KEY_ID||process.env.SMTP_USER,n=process.env.AWS_SECRET_ACCESS_KEY||process.env.SMTP_PASS,a=process.env.AWS_REGION||process.env.SMTP_HOST||"us-east-1";return !i||!n?null:new o({provider:"ses",from:t,fromName:r,replyTo:s,ses:{accessKeyId:i,secretAccessKey:n,region:a}})}return null}};
|
|
449
|
-
|
|
447
|
+
`),$=!0);}catch{}}async loadFromGlobals(){try{let e=null;if(typeof this.db?.findOne=="function")try{let s=await this.db.findOne({collection:"_globals_storage-settings",where:{},draft:!0});s&&(e=s);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:s}=await import('drizzle-orm'),i=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let n of i)try{let a=await this.db.execute(s`SELECT * FROM ${s.raw(n)} LIMIT 1`);if(e=Array.isArray(a)?a[0]:a?.rows?a.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let s=['"_globals_storage-settings"','"_globals_storage_settings"','"global_storage_settings"'];for(let i of s)try{if(e=this.db.prepare(`SELECT * FROM ${i} LIMIT 1`).get(),e)break}catch{}}if(!e)return;let t=s=>{if(!s)return null;if(typeof s=="string")try{return JSON.parse(s)}catch{return null}return s},r=e.provider||"local";if(this.cache["storage.type"]=r,r==="local"){let s=t(e.local);this.cache["storage.local.dir"]=s?.uploadDir||"./public/uploads",this.cache["storage.local.url"]=s?.baseUrl||"/uploads";}if(r==="aws"){let s=t(e.aws);this.cache["storage.s3.bucket"]=s?.bucket||"",this.cache["storage.s3.region"]=s?.region||"us-east-1",this.cache["storage.s3.access_key_id"]=s?.accessKeyId||"",this.cache["storage.s3.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.s3.endpoint"]=s?.endpoint||"",this.cache["storage.s3.cdn_url"]=s?.cdnUrl||"",this.cache["storage.s3.prefix"]=s?.prefix||"";}if(r==="r2"){let s=t(e.r2);this.cache["storage.r2.account_id"]=s?.accountId||"",this.cache["storage.r2.access_key_id"]=s?.accessKeyId||"",this.cache["storage.r2.secret_access_key"]=s?.secretAccessKey||"",this.cache["storage.r2.bucket"]=s?.bucket||"",this.cache["storage.r2.cdn_url"]=s?.cdnUrl||"",this.cache["storage.r2.prefix"]=s?.prefix||"";}if(r==="cloudinary"){let s=t(e.cloudinary);this.cache["storage.cloudinary.cloud_name"]=s?.cloudName||"",this.cache["storage.cloudinary.api_key"]=s?.apiKey||"",this.cache["storage.cloudinary.api_secret"]=s?.apiSecret||"",this.cache["storage.cloudinary.folder"]=s?.folder||"";}if(r==="ftp"){let s=t(e.ftp);this.cache["storage.ftp.host"]=s?.host||"",this.cache["storage.ftp.port"]=String(s?.port||"21"),this.cache["storage.ftp.user"]=s?.user||"",this.cache["storage.ftp.password"]=s?.password||"",this.cache["storage.ftp.secure"]=s?.secure?"true":"false",this.cache["storage.ftp.base_url"]=s?.baseUrl||"",this.cache["storage.ftp.prefix"]=s?.prefix||"";}}catch(e){console.warn("ConfigService: Could not load storage settings from globals table:",e);}try{let e=null;if(typeof this.db?.findOne=="function")try{let t=await this.db.findOne({collection:"_globals_email-settings",where:{},draft:!0});t&&(e=t);}catch{}if(!e&&typeof this.db?.execute=="function"){let{sql:t}=await import('drizzle-orm'),r=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let s of r)try{let i=await this.db.execute(t`SELECT * FROM ${t.raw(s)} LIMIT 1`);if(e=Array.isArray(i)?i[0]:i?.rows?i.rows[0]:null,e)break}catch{}}else if(!e&&typeof this.db?.prepare=="function"){let t=['"_globals_email-settings"','"_globals_email_settings"','"global_email_settings"'];for(let r of t)try{if(e=this.db.prepare(`SELECT * FROM ${r} LIMIT 1`).get(),e)break}catch{}}if(e){let t=r=>{if(!r)return null;if(typeof r=="string")try{return JSON.parse(r)}catch{return null}return r};if(this.cache["email.provider"]=e.provider||"smtp",this.cache["email.smtp.from"]=e.fromEmail||"",this.cache["email.smtp.from_name"]=e.fromName||"",this.cache["email.smtp.reply_to"]=e.replyTo||"",e.provider==="smtp"){let r=t(e.smtp);this.cache["email.smtp.host"]=r?.host||"",this.cache["email.smtp.port"]=String(r?.port||"587"),this.cache["email.smtp.user"]=r?.username||"",this.cache["email.smtp.pass"]=r?.password||"",this.cache["email.smtp.secure"]=r?.secure?"true":"false";}else if(e.provider==="resend"){let r=t(e.resend);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="sendgrid"){let r=t(e.sendgrid);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="mailgun"){let r=t(e.mailgun);this.cache["email.smtp.pass"]=r?.apiKey||"";}else if(e.provider==="ses"){let r=t(e.ses);this.cache["email.smtp.user"]=r?.accessKeyId||"",this.cache["email.smtp.pass"]=r?.secretAccessKey||"";}}}catch(e){console.warn("ConfigService: Could not load email settings from globals table:",e);}}get(e,t,r){return this.cache[e]?this.cache[e]:t&&process.env[t]?process.env[t]:r}getStorageConfig(){let e="local";return typeof globalThis.STORAGE_BUCKET<"u"&&(e="cloudflare_r2"),{type:this.get("storage.type","STORAGE_TYPE",e),s3:{bucket:this.get("storage.s3.bucket","STORAGE_BUCKET"),region:this.get("storage.s3.region","STORAGE_REGION","us-east-1"),accessKeyId:this.get("storage.s3.access_key_id","STORAGE_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.s3.secret_access_key","STORAGE_SECRET_ACCESS_KEY"),endpoint:this.get("storage.s3.endpoint","STORAGE_ENDPOINT"),cdnUrl:this.get("storage.s3.cdn_url","STORAGE_CDN_URL"),prefix:this.get("storage.s3.prefix","STORAGE_PREFIX")},r2:{accountId:this.get("storage.r2.account_id","R2_ACCOUNT_ID"),accessKeyId:this.get("storage.r2.access_key_id","R2_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.r2.secret_access_key","R2_SECRET_ACCESS_KEY"),bucket:this.get("storage.r2.bucket","R2_BUCKET"),cdnUrl:this.get("storage.r2.cdn_url","R2_CDN_URL"),prefix:this.get("storage.r2.prefix","R2_PREFIX")},gcs:{bucket:this.get("storage.gcs.bucket","GCS_BUCKET"),projectId:this.get("storage.gcs.project_id","GCS_PROJECT_ID"),clientEmail:this.get("storage.gcs.client_email","GCS_CLIENT_EMAIL"),privateKey:this.get("storage.gcs.private_key","GCS_PRIVATE_KEY"),cdnUrl:this.get("storage.gcs.cdn_url","GCS_CDN_URL"),prefix:this.get("storage.gcs.prefix","GCS_PREFIX")},digitalocean:{bucket:this.get("storage.digitalocean.bucket","DO_BUCKET"),region:this.get("storage.digitalocean.region","DO_REGION","nyc3"),accessKeyId:this.get("storage.digitalocean.access_key_id","DO_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.digitalocean.secret_access_key","DO_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.digitalocean.cdn_url","DO_CDN_URL"),prefix:this.get("storage.digitalocean.prefix","DO_PREFIX")},backblaze:{bucket:this.get("storage.backblaze.bucket","BB_BUCKET"),accountId:this.get("storage.backblaze.account_id","BB_ACCOUNT_ID"),applicationKeyId:this.get("storage.backblaze.application_key_id","BB_APPLICATION_KEY_ID"),applicationKey:this.get("storage.backblaze.application_key","BB_APPLICATION_KEY"),cdnUrl:this.get("storage.backblaze.cdn_url","BB_CDN_URL"),prefix:this.get("storage.backblaze.prefix","BB_PREFIX")},wasabi:{bucket:this.get("storage.wasabi.bucket","WASABI_BUCKET"),region:this.get("storage.wasabi.region","WASABI_REGION","us-east-1"),accessKeyId:this.get("storage.wasabi.access_key_id","WASABI_ACCESS_KEY_ID"),secretAccessKey:this.get("storage.wasabi.secret_access_key","WASABI_SECRET_ACCESS_KEY"),cdnUrl:this.get("storage.wasabi.cdn_url","WASABI_CDN_URL"),prefix:this.get("storage.wasabi.prefix","WASABI_PREFIX")},bunny:{storageZone:this.get("storage.bunny.storage_zone","BUNNY_STORAGE_ZONE"),apiKey:this.get("storage.bunny.api_key","BUNNY_API_KEY"),cdnUrl:this.get("storage.bunny.cdn_url","BUNNY_CDN_URL"),prefix:this.get("storage.bunny.prefix","BUNNY_PREFIX")},ftp:{host:this.get("storage.ftp.host","FTP_HOST"),port:parseInt(this.get("storage.ftp.port","FTP_PORT","21"),10),user:this.get("storage.ftp.user","FTP_USER"),password:this.get("storage.ftp.password","FTP_PASSWORD"),secure:this.get("storage.ftp.secure","FTP_SECURE")==="true",baseUrl:this.get("storage.ftp.base_url","FTP_BASE_URL"),prefix:this.get("storage.ftp.prefix","FTP_PREFIX")},cloudinary:{cloudName:this.get("storage.cloudinary.cloud_name","CLOUDINARY_CLOUD_NAME"),apiKey:this.get("storage.cloudinary.api_key","CLOUDINARY_API_KEY"),apiSecret:this.get("storage.cloudinary.api_secret","CLOUDINARY_API_SECRET"),folder:this.get("storage.cloudinary.folder","CLOUDINARY_FOLDER")},imgix:{domain:this.get("storage.imgix.domain","IMGIX_DOMAIN"),signKey:this.get("storage.imgix.sign_key","IMGIX_SIGN_KEY")},local:{uploadDir:this.get("storage.local.dir","STORAGE_LOCAL_DIR","./public/uploads"),baseUrl:this.get("storage.local.url","STORAGE_LOCAL_URL","/uploads")}}}getEmailConfig(){return {provider:this.get("email.provider","EMAIL_PROVIDER","smtp"),host:this.get("email.smtp.host","SMTP_HOST"),port:parseInt(this.get("email.smtp.port","SMTP_PORT","587"),10),secure:this.get("email.smtp.secure","SMTP_SECURE")==="true",user:this.get("email.smtp.user","SMTP_USER"),pass:this.get("email.smtp.pass","SMTP_PASS"),from:this.get("email.smtp.from","SMTP_FROM","noreply@example.com"),fromName:this.get("email.smtp.from_name","SMTP_FROM_NAME","Kyro CMS"),replyTo:this.get("email.smtp.reply_to","SMTP_REPLY_TO")}}maskSensitive(e,t){return t&&(o.SENSITIVE_KEYS.includes(e)?"********":t)}async set(e,t,r){await this.db.insert(chunkGS4CMYKS_cjs.a).values({key:e,value:t,description:r,updatedAt:new Date}).onConflictDoUpdate({target:[chunkGS4CMYKS_cjs.a.key],set:{value:t,description:r,updatedAt:new Date}}),this.cache[e]=t;}};var K=class o{transporter;config;templates;transporterInitialized=false;constructor(e,t){this.config=e,this.templates={...I(e.brand),...t};}async ensureTransporter(){if(this.transporterInitialized)return this.transporter;let{default:e}=await import('nodemailer');return this.config.provider==="smtp"&&this.config.smtp?this.transporter=e.createTransport({host:this.config.smtp.host,port:this.config.smtp.port,secure:this.config.smtp.secure,auth:this.config.smtp.auth}):this.config.provider==="ses"&&this.config.ses&&(this.transporter=e.createTransport({host:`email-smtp.${this.config.ses.region}.amazonaws.com`,port:587,secure:false,auth:{user:this.config.ses.accessKeyId,pass:this.config.ses.secretAccessKey}})),this.transporterInitialized=true,this.transporter}async send(e){let{provider:t,from:r,fromName:s,replyTo:i}=this.config,n=`"${s||"Kyro CMS"}" <${r}>`,a=e.replyTo||i;try{let l;switch(t){case "smtp":case "ses":{let g=await this.ensureTransporter();if(!g)throw new Error(`${t} transporter not initialized`);l=await g.sendMail({from:n,to:Array.isArray(e.to)?e.to.join(", "):e.to,subject:e.subject,html:e.html,text:e.text,replyTo:a});}break;case "resend":l=await this.sendViaResend(n,e,a);break;case "sendgrid":l=await this.sendViaSendGrid(n,e,a);break;case "mailgun":l=await this.sendViaMailgun(n,e,a);break;default:throw new Error(`Unsupported email provider: ${t}`)}return l}catch(l){throw console.error("[EmailTransport] FAILED to send email:",l.message),l.response&&console.error("[EmailTransport] Provider Error Detail:",JSON.stringify(l.response,null,2)),l}}async sendViaResend(e,t,r){let s=this.config.resend?.apiKey;if(!s)throw new Error("Resend API Key missing");let i={from:e,to:t.to,subject:t.subject,html:t.html,text:t.text,reply_to:r},n=await fetch("https://api.resend.com/emails",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){let a=await n.json();throw new Error(`Resend Error: ${JSON.stringify(a)}`)}return n.json()}async sendViaSendGrid(e,t,r){let s=this.config.sendgrid?.apiKey;if(!s)throw new Error("SendGrid API Key missing");let i={personalizations:[{to:Array.isArray(t.to)?t.to.map(a=>({email:a})):[{email:t.to}]}],from:{email:e.match(/<(.+)>/)?.[1]||e,name:e.match(/"(.+)"/)?.[1]},subject:t.subject,content:[{type:"text/plain",value:t.text||""},{type:"text/html",value:t.html}],reply_to:r?{email:r}:void 0},n=await fetch("https://api.sendgrid.com/v3/mail/send",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok){let a=await n.json();throw new Error(`SendGrid Error: ${JSON.stringify(a)}`)}return {success:true}}async sendViaMailgun(e,t,r){let{apiKey:s,domain:i,region:n}=this.config.mailgun||{};if(!s||!i)throw new Error("Mailgun config missing");let a=n==="eu"?"api.eu.mailgun.net":"api.mailgun.net",l=btoa(`api:${s}`),g=new URLSearchParams;g.append("from",e);let m=Array.isArray(t.to)?t.to.join(", "):t.to;g.append("to",m),g.append("subject",t.subject),g.append("html",t.html),t.text&&g.append("text",t.text),r&&g.append("h:Reply-To",r);let d=await fetch(`https://${a}/v3/${i}/messages`,{method:"POST",headers:{Authorization:`Basic ${l}`,"Content-Type":"application/x-www-form-urlencoded"},body:g});if(!d.ok){let f=await d.json();throw new Error(`Mailgun Error: ${JSON.stringify(f)}`)}return d.json()}getTemplates(){return this.templates}async verifyConnection(){if(this.config.provider==="smtp"||this.config.provider==="ses")try{let e=await this.ensureTransporter();if(e)return await e.verify(),!0}catch{return false}return !!(this.config.resend?.apiKey||this.config.sendgrid?.apiKey||this.config.mailgun?.apiKey)}static async fetchBrandConfig(e){let t="Kyro CMS",r="https://kyro-cms.com/logo.svg",s="https://kyro-cms.com/logo-white.svg";try{let i=null,n=null;if(typeof e?.findOne=="function")i=await e.findOne({collection:"_globals_store-settings",where:{},draft:!0}),n=await e.findOne({collection:"_globals_brand-settings",where:{},draft:!0});else if(typeof e?.execute=="function"){let{sql:a}=await import('drizzle-orm');try{let l=await e.execute(a`SELECT * FROM "_globals_store-settings" LIMIT 1`);i=Array.isArray(l)?l[0]:l?.rows?l.rows[0]:null;}catch{}try{let l=await e.execute(a`SELECT * FROM "_globals_brand-settings" LIMIT 1`);n=Array.isArray(l)?l[0]:l?.rows?l.rows[0]:null;}catch{}}else if(typeof e?.prepare=="function"){try{i=e.prepare('SELECT * FROM "_globals_store-settings" LIMIT 1').get();}catch{}try{n=e.prepare('SELECT * FROM "_globals_brand-settings" LIMIT 1').get();}catch{}}if(i?.storeName&&(t=i.storeName),n?.identity){let a=typeof n.identity=="string"?JSON.parse(n.identity):n.identity,l=async g=>{if(typeof e?.findOne=="function")return (await e.findOne({collection:"media",where:{id:{equals:g}}}))?.url;if(typeof e?.execute=="function"){let{sql:m}=await import('drizzle-orm');try{let d=await e.execute(m`SELECT url FROM "media" WHERE id = ${g}`);return (Array.isArray(d)?d[0]:d?.rows?d.rows[0]:null)?.url}catch{}}else if(typeof e?.prepare=="function")try{return e.prepare('SELECT url FROM "media" WHERE id = ?').get(g)?.url}catch{}};if(a.primaryLogo){let g=await l(a.primaryLogo);g&&(r=g);}if(a.darkLogo){let g=await l(a.darkLogo);g&&(s=g);}}}catch{}return {siteName:t,logoUrl:r,logoDarkUrl:s,appUrl:process.env.PUBLIC_URL||"https://kyro-cms.com"}}static async fromConfig(e){let t=new h(e);await t.load();let r=t.getEmailConfig();if(!r.provider)return this.fromEnv();let i={brand:await this.fetchBrandConfig(e),provider:r.provider||"smtp",from:r.from||"noreply@example.com",fromName:r.fromName,replyTo:r.replyTo,smtp:r.provider==="smtp"?{host:r.host||"",port:r.port||587,secure:r.secure||false,auth:{user:r.user||"",pass:r.pass||""}}:void 0,resend:r.provider==="resend"?{apiKey:r.pass||""}:void 0,sendgrid:r.provider==="sendgrid"?{apiKey:r.pass||""}:void 0,mailgun:r.provider==="mailgun"?{apiKey:r.pass||"",domain:r.host||"",region:r.secure?"eu":"us"}:void 0,ses:r.provider==="ses"?{accessKeyId:r.user||"",secretAccessKey:r.pass||"",region:r.host||"us-east-1"}:void 0};return new o(i)}static fromEnv(){let e=process.env.EMAIL_PROVIDER||"smtp",t=process.env.SMTP_FROM||process.env.DEFAULT_FROM||"noreply@example.com",r=process.env.SMTP_FROM_NAME||"Kyro CMS",s=process.env.SMTP_REPLY_TO;if(e==="smtp"){let i=process.env.SMTP_HOST,n=process.env.SMTP_USER,a=process.env.SMTP_PASS;return !i||!n||!a?null:new o({provider:"smtp",from:t,fromName:r,replyTo:s,smtp:{host:i,port:parseInt(process.env.SMTP_PORT||"587",10),secure:process.env.SMTP_SECURE==="true",auth:{user:n,pass:a}}})}if(e==="resend"){let i=process.env.RESEND_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"resend",from:t,fromName:r,replyTo:s,resend:{apiKey:i}}):null}if(e==="sendgrid"){let i=process.env.SENDGRID_API_KEY||process.env.SMTP_PASS;return i?new o({provider:"sendgrid",from:t,fromName:r,replyTo:s,sendgrid:{apiKey:i}}):null}if(e==="mailgun"){let i=process.env.MAILGUN_API_KEY||process.env.SMTP_PASS,n=process.env.MAILGUN_DOMAIN||process.env.SMTP_HOST;return !i||!n?null:new o({provider:"mailgun",from:t,fromName:r,replyTo:s,mailgun:{apiKey:i,domain:n,region:process.env.MAILGUN_REGION||(process.env.SMTP_SECURE==="true"?"eu":"us")}})}if(e==="ses"){let i=process.env.AWS_ACCESS_KEY_ID||process.env.SMTP_USER,n=process.env.AWS_SECRET_ACCESS_KEY||process.env.SMTP_PASS,a=process.env.AWS_REGION||process.env.SMTP_HOST||"us-east-1";return !i||!n?null:new o({provider:"ses",from:t,fromName:r,replyTo:s,ses:{accessKeyId:i,secretAccessKey:n,region:a}})}return null}};
|
|
448
|
+
exports.a=c;exports.b=y;exports.c=b;exports.d=x;exports.e=_;exports.f=w;exports.g=S;exports.h=C;exports.i=T;exports.j=k;exports.k=E;exports.l=v;exports.m=A;exports.n=R;exports.o=I;exports.p=h;exports.q=K;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var e={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"]}},t={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"]}},l={users:e,audit_logs:t};exports.a=e;exports.b=l;
|