import{a as t}from"./chunk-2O6J3K3T.js";import"./chunk-YL6J3L2T.js";import"./chunk-62DM64XC.js";import"./chunk-CC3P7GPW.js";import"./chunk-X3G665AK.js";import"./chunk-TF5C7XJX.js";import"./chunk-DWY47FQV.js";import{setTimeout as a}from"timers/promises";var e;process.once("SIGTERM",()=>{console.log("SIGTERM received, shutting down..."),process.removeAllListeners("SIGINT"),process.exitCode=143,e?.close().finally(()=>process.exit())});process.once("SIGINT",()=>{console.log("SIGINT received, shutting down..."),process.removeAllListeners("SIGTERM"),process.exitCode=130,e?.close().finally(()=>process.exit())});async function n(){let[,,s]=process.argv;if(!s)return process.send?.({type:"error",error:'Missing "name" argument, server cannot be started'},void 0),process.exit(1);try{e=await t({debug:!0,persistenceMode:"stateful",name:s});let r={database:e.database,experimental:{streams:e.experimental.streams},http:e.http,name:e.name,ppg:e.ppg,shadowDatabase:e.shadowDatabase};process.send?.({type:"started",server:r},void 0)}catch(r){console.error(r);let o=r instanceof Error?r.message:String(r);process.send?.({type:"error",error:o},void 0),await a(1e3),process.exit(1)}}n();
