@kyro-cms/core 0.12.63 → 0.12.65
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-2F4WPCVA.cjs +120 -0
- package/dist/{chunk-ILSBJI77.cjs → chunk-7JCRN5ZH.cjs} +4 -4
- package/dist/{chunk-W2XYBPEJ.js → chunk-AXT3QPVM.js} +17 -17
- package/dist/{chunk-VZQWWZLY.js → chunk-H5BTDZXQ.js} +1 -1
- package/dist/chunk-HOX6BHKS.js +121 -0
- package/dist/chunk-JW4HRIVP.cjs +20 -0
- package/dist/{chunk-3WSFG6DS.js → chunk-QBYXAKHH.js} +1 -1
- package/dist/{chunk-5DWQGEM2.cjs → chunk-QO5ZWQA3.cjs} +13 -13
- package/dist/chunk-QXWQELAM.js +21 -0
- package/dist/{chunk-75BFTYBS.js → chunk-X473JI7Z.js} +14 -14
- package/dist/{chunk-DFDL5JIO.cjs → chunk-YFUH3SST.cjs} +16 -16
- package/dist/{chunk-YJZTUT7I.cjs → chunk-ZDMJOFKR.cjs} +1 -1
- package/dist/drizzle/index.cjs +1 -1
- package/dist/drizzle/index.js +1 -1
- package/dist/graphql/index.cjs +1 -1
- package/dist/graphql/index.js +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.js +1 -1
- package/dist/integration.cjs +1 -1
- package/dist/integration.d.cts +1 -0
- package/dist/integration.d.ts +1 -0
- package/dist/integration.js +1 -1
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-6424BWOB.cjs +0 -120
- package/dist/chunk-FJPY42VZ.cjs +0 -20
- package/dist/chunk-PCN6QV3Z.js +0 -21
- package/dist/chunk-QE7LORN4.js +0 -121
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';var chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs'),i=require('path'),_=require('fs');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var i__default=/*#__PURE__*/_interopDefault(i);var ___default=/*#__PURE__*/_interopDefault(_);chunkBUNLC3II_cjs.h();var l=n=>{let s=i__default.default.join(process.cwd(),"node_modules","@kyro-cms","core"),e=i__default.default.resolve(s,"src",`${n}.ts`);return ___default.default.existsSync(e)?e:i__default.default.resolve(s,"dist",`${n}.js`)},P=l("api-handler"),x=l("api-handler-graphql"),R=l("api-handler-trpc"),b=["@kyro-cms/core","@kyro-cms/admin","@kyro-cms/astro","@kyro-cms/ai"],N=["@kyro-cms/connect"],O=[...b,...N],E=["better-sqlite3","pg","mongodb","ioredis","sharp","ssh2","cpu-features","ssh2-sftp-client","nodemailer","jsonwebtoken","@mapbox/node-pre-gyp","mock-aws-s3","aws-sdk","nock","cloudflare:workers"],k=["crypto","node:crypto","module","node:module","fs","node:fs","fs/promises","node:fs/promises","path","node:path","util","node:util","stream","node:stream","events","node:events","url","node:url","http","node:http","https","node:https","os","node:os","child_process","node:child_process","assert","node:assert","zlib","node:zlib","buffer","node:buffer"],S=[...b,...E],v=[...O,...k,...E];function T(n={}){let{configPath:s="./kyro.config.ts",apiPath:e="/api",adminPath:r="/admin",admin:g=true,enableGraphQL:c=false,enableTRPC:p=false,enableWebSocket:d=false}=n;return {name:"@kyro-cms/core",hooks:{"astro:config:setup":async({config:u,updateConfig:h,injectRoute:a,logger:o,addDevToolbarApp:I})=>{if(o.info(`Setting up Kyro CMS (API: ${e}, Admin: ${r})`),e===r)throw new Error(`Kyro CMS: apiPath and adminPath cannot be the same ("${e}")`);let f=i__default.default.resolve(u.root.pathname,s),A=f;if(___default.default.existsSync(f)||o.warn(`Kyro config file not found at ${s}. The API will fail to boot if collections are needed.`),h({security:{checkOrigin:false},vite:{ssr:{external:v},build:{rollupOptions:{external:S}},optimizeDeps:{exclude:S},server:{watch:{ignored:["**/*.db","**/*.db-*","**/data/**","**/public/uploads/**","**/.kyro/**"]}},plugins:[{name:"use-sync-external-store-shim-fix",enforce:"pre",resolveId(t){if(t==="use-sync-external-store/shim"||t==="use-sync-external-store/shim/index.js")return "\0virtual:use-sync-external-store-shim";if(t==="use-sync-external-store/shim/with-selector"||t==="use-sync-external-store/shim/with-selector.js")return "\0virtual:use-sync-external-store-shim-with-selector"},load(t){if(t==="\0virtual:use-sync-external-store-shim")return 'export { useSyncExternalStore } from "react";';if(t==="\0virtual:use-sync-external-store-shim-with-selector")return `
|
|
2
|
+
import { useSyncExternalStore, useMemo } from "react";
|
|
3
|
+
export function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
4
|
+
const memoizedSelector = useMemo(() => {
|
|
5
|
+
let last, lastSnap, hasMemo = false;
|
|
6
|
+
return (snap) => {
|
|
7
|
+
if (!hasMemo || !Object.is(lastSnap, snap)) {
|
|
8
|
+
const next = selector(snap);
|
|
9
|
+
if (!hasMemo || !(isEqual ? isEqual(last, next) : Object.is(last, next))) {
|
|
10
|
+
last = next; lastSnap = snap; hasMemo = true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return last;
|
|
14
|
+
};
|
|
15
|
+
}, [selector, isEqual]);
|
|
16
|
+
const getSelection = () => memoizedSelector(getSnapshot());
|
|
17
|
+
const getServerSelection = getServerSnapshot != null ? () => memoizedSelector(getServerSnapshot()) : undefined;
|
|
18
|
+
return useSyncExternalStore(subscribe, getSelection, getServerSelection);
|
|
19
|
+
}
|
|
20
|
+
`}}],resolve:{alias:{debug:"debug/src/node.js","kyro:config":A}},define:{__KYRO_API_PATH__:JSON.stringify(e),__KYRO_ADMIN_PATH__:JSON.stringify(r),__KYRO_ENABLE_GRAPHQL__:JSON.stringify(c),__KYRO_ENABLE_TRPC__:JSON.stringify(p),__KYRO_ENABLE_WS__:JSON.stringify(d)}}}),a({pattern:`${e}/[...path]`,entrypoint:P}),c&&(a({pattern:`${e}/graphql`,entrypoint:x}),o.info(`GraphQL endpoint enabled at ${e}/graphql`)),p&&(a({pattern:`${e}/trpc/[...path]`,entrypoint:R}),o.info(`tRPC endpoint enabled at ${e}/trpc`)),d&&o.info("WebSocket support enabled (auto-starts at first request)"),g!==false)try{let m=(await import('@kyro-cms/admin/integration')).kyroAdmin({basePath:r,apiPath:e,configPath:s});m.hooks?.["astro:config:setup"]&&await m.hooks["astro:config:setup"]({config:u,updateConfig:h,injectRoute:a,logger:o});}catch{}}}}}exports.a=T;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {D,A}from'./chunk-
|
|
1
|
+
import {D,A}from'./chunk-H5BTDZXQ.js';import {e}from'./chunk-TBTQXIHP.js';import {hb}from'./chunk-HOX6BHKS.js';import {a as a$1}from'./chunk-N6MNQIQU.js';import {c}from'./chunk-AXT3QPVM.js';import {a}from'./chunk-ZWDBPEXL.js';import {a as a$2}from'./chunk-5ZEYOFAK.js';import {g}from'./chunk-Y2YAKDEQ.js';import w from'kyro:config';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g();var r=null,l=null;async function b(){if(!r){if(globalThis.__KYRO_INSTANCE__)try{await globalThis.__KYRO_INSTANCE__.shutdown();}catch{}try{let e$1=w.default||w,t=e$1.adapter,o=t&&!t.dialect&&typeof t.connect=="function";if(globalThis.DB&&(!t||o)){let s=globalThis.DB;e$1.adapter=new c({type:"sqlite",client:s}),D.info("Hot-swapped to D1 DrizzleAdapter");}r=A(e$1),await r.init();let a$3=e$1.adapter,p=a$3&&a$3.dialect&&(a$3.dialect==="postgres"||a$3.dialect==="sqlite"),c$1=a$3&&a$3.dialect==="mongodb",n;if(p)a$3.dialect==="postgres"?n=new a({db:a$3.client}):a$3.dialect==="sqlite"&&(n=new hb({db:a$3.rawClient||a$3.client}));else if(o&&!globalThis.DB){let s=process.env.KYRO_AUTH_DB_PATH||"./data/auth.db";n=new a$1({path:s});}else c$1&&(n=new a$2({adapter:a$3}));if(n?.connect)try{await n.connect();}catch(s){D.warn("Auth connect warning:",s);}try{await r.loadSettings();}catch(s){D.warn("loadSettings warning:",s);}try{await e(n);}catch(s){D.warn("autoBootstrap warning:",s);}globalThis.__KYRO_INSTANCE__=r;}catch(e){throw r=null,l=null,D.error("Init failed, will retry:",e),e}}}async function E(e){let t=globalThis.DB?globalThis:null;try{let{env:o}=await import('cloudflare:workers');o&&(t=o);}catch{}if(e)try{t=e.locals?.cfContext?.env||e?.env||t;}catch{}if(!t)try{t=process.env;}catch{}t?.DB&&(globalThis.DB=t.DB),t?.STORAGE_BUCKET&&(globalThis.STORAGE_BUCKET=t.STORAGE_BUCKET),l||(l=b()),await l;}var _={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};function T(e){return r?r.settings?.access?.apiAccess?.[e]??_[e]??true:_[e]??true}var R=async e=>{if(!r)try{await Promise.race([E(e),new Promise((t,o)=>setTimeout(()=>o(new Error("Initialization timeout")),3e4))]);}catch(t){return console.error("[Kyro API] Warm error:",t?.stack||t?.message||t),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"}})}try{let o=new URL(e.request.url).pathname,a=__KYRO_API_PATH__;if(o===`${a}/graphql`&&typeof r.getGraphQL=="function"){if(!T("graphqlEnabled"))return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let n=await r.getGraphQL().fetch(e.request,e.locals);return new Response(n.body,n)}if(o.startsWith(`${a}/trpc/`)&&typeof r.getTRPC=="function"){if(!T("trpcEnabled"))return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}});let n=await r.getTRPC().fetch(e.request,e.locals);return new Response(n.body,n)}return await(await r.getREST()).fetch(e.request,e.locals)}catch(t){return console.error("[Kyro API Execution Error]:",t?.stack||t?.message||t),new Response(JSON.stringify({error:"Internal Server Error",message:t?.message||String(t),stack:t?.stack}),{status:500,headers:{"Content-Type":"application/json"}})}},N=R;export{r as a,E as b,R as c,N as d};
|