@kyro-cms/core 0.12.16 → 0.12.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api-handler-graphql.cjs +1 -1
- package/dist/api-handler-graphql.js +1 -1
- package/dist/api-handler-trpc.cjs +1 -1
- package/dist/api-handler-trpc.js +1 -1
- package/dist/api-handler.cjs +1 -1
- package/dist/api-handler.js +1 -1
- package/dist/{chunk-IQYP3DDJ.cjs → chunk-BIJHVTNO.cjs} +2 -2
- package/dist/{chunk-NI7S5JMH.js → chunk-CIA3BVH3.js} +5 -5
- package/dist/{chunk-ZZIGN5PZ.js → chunk-I4ZACL66.js} +1 -1
- package/dist/{chunk-M5JUPA7G.cjs → chunk-LMIBASPC.cjs} +5 -5
- package/dist/{chunk-RY3BG3AN.cjs → chunk-RL36RMMG.cjs} +1 -1
- package/dist/{chunk-DTSYK7KK.js → chunk-YFRLT77I.js} +2 -2
- package/dist/index.cjs +26 -19
- package/dist/index.d.cts +202 -2
- package/dist/index.d.ts +202 -2
- package/dist/index.js +26 -19
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.js +1 -1
- package/package.json +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import {z,A as A$1}from'./chunk-
|
|
1
|
+
import {z,A as A$1}from'./chunk-YFRLT77I.js';import {d}from'./chunk-O62KJ2J7.js';import {a as a$1}from'./chunk-IKOXCJYO.js';import {c}from'./chunk-3RR6IV5I.js';import {a}from'./chunk-RHCWCG3O.js';import {a as a$2}from'./chunk-W6P4N3Z7.js';import {a as a$3}from'./chunk-IZCTG4RG.js';import m from'kyro:config';var e=null,n=null;async function b(){if(!e){if(globalThis.__KYRO_INSTANCE__)try{await globalThis.__KYRO_INSTANCE__.shutdown();}catch{}try{let t=m.default||m;e=z(t),await e.init(),await e.loadSettings();let a$4=e.db,r;if(a$4 instanceof c){if(a$4.dialect==="postgres")r=new a({db:a$4.client});else if(a$4.dialect==="sqlite"){let s=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";r=new a$1({path:s});}}else if(a$4 instanceof A$1){let s=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";r=new a$1({path:s});}else a$4 instanceof a$2&&(r=new a$3({db:a$4.db}));r?.connect&&await r.connect(),(await d(r))?.success,typeof e.startWebSocket=="function"&&e.startWebSocket().catch(s=>{console.error("[Kyro] WebSocket auto-start failed:",s);}),globalThis.__KYRO_INSTANCE__=e;}catch(t){throw e=null,n=null,console.error("[Kyro API] Init failed, will retry:",t),t}}}async function O(){n||(n=b()),await n;}var g={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};async function A(t){try{return (await e.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.[t]??g[t]??!0}catch{return true}}var q=async t=>{if(!e){n||(n=b());try{await Promise.race([n,new Promise((l,o)=>setTimeout(()=>o(new Error("Initialization timeout")),3e4))]);}catch{return new Response(JSON.stringify({error:"Service Unavailable",message:"Kyro CMS is still starting up. Please try again in a moment."}),{status:503,headers:{"Content-Type":"application/json","Retry-After":"5"}})}}let r=new URL(t.request.url).pathname,i=__KYRO_API_PATH__;if(r===`${i}/graphql`&&typeof e.getGraphQL=="function"){if(!await A("graphqlEnabled"))return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let o=await e.getGraphQL().fetch(t.request,t.locals);return new Response(o.body,o)}if(r.startsWith(`${i}/trpc/`)&&typeof e.getTRPC=="function"){if(!await A("trpcEnabled"))return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let o=await e.getTRPC().fetch(t.request,t.locals);return new Response(o.body,o)}return e.getREST().fetch(t.request,t.locals)};export{e as a,O as b,q as c};
|