@prisma/cli-dev 0.9.0 → 0.10.1

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.
Files changed (40) hide show
  1. package/dist/chunk-4QNO2WQL.js +31 -0
  2. package/dist/chunk-FON2L4R6.js +3 -0
  3. package/dist/chunk-M6TFCQLD.js +2 -0
  4. package/dist/chunk-OE4BCZ2F.js +11 -0
  5. package/dist/chunk-SZYQ5TDI.js +15 -0
  6. package/dist/chunk-ZPUL6EAC.js +30 -0
  7. package/dist/index.js +5 -112
  8. package/dist/list-URPVLN6C.js +5 -0
  9. package/dist/{prompt-AVJG6SAC.js → prompt-KJRFDAR5.js} +1 -1
  10. package/dist/remove-LXPTJUNN.js +9 -0
  11. package/dist/start-M7MH244V.js +13 -0
  12. package/dist/stop-LEO7ZSSO.js +5 -0
  13. package/package.json +5 -2
  14. package/dist/accelerate-6KR7K7Y5.js +0 -494
  15. package/dist/chunk-6CY7FTXB.js +0 -12
  16. package/dist/chunk-7LVVKN3Q.js +0 -2
  17. package/dist/chunk-C743SY2X.js +0 -2
  18. package/dist/chunk-IUA2KLPR.js +0 -34
  19. package/dist/chunk-J2EYU3K5.js +0 -2
  20. package/dist/chunk-MKAOBCJL.js +0 -2
  21. package/dist/chunk-PKHPXFYF.js +0 -4
  22. package/dist/chunk-VMZVNK7U.js +0 -2
  23. package/dist/chunk-VN3SER5K.js +0 -2
  24. package/dist/chunk-WAQNVDRS.js +0 -15
  25. package/dist/chunk-ZZ7TGN5J.js +0 -2
  26. package/dist/client-ROT4AZYN.js +0 -2
  27. package/dist/dist-44BN73S3.js +0 -24
  28. package/dist/dist-FF6JPL3Y.js +0 -2
  29. package/dist/dist-OWTPHSRP.js +0 -2
  30. package/dist/http-exception-IXDDLQOJ.js +0 -2
  31. package/dist/list-AF7WT6HT.js +0 -5
  32. package/dist/logger-5NORX5VG.js +0 -2
  33. package/dist/nodefs-MQZB2OFY.js +0 -2
  34. package/dist/opfs-ahp-W7WVBYAH.js +0 -4
  35. package/dist/pg_dump-F2HW5KLY.js +0 -3
  36. package/dist/proxy-signals-TJILVQAL.js +0 -2
  37. package/dist/remove-BWVQMMM4.js +0 -9
  38. package/dist/stop-XM5K7ZMT.js +0 -5
  39. package/dist/tiny-4VNDEAK3.js +0 -2
  40. package/dist/utility-5QZDATLM.js +0 -2
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import"./chunk-J2EYU3K5.js";import{createServer as g}from"net";var a=6e4,l=class d extends EventTarget{constructor(t){super(),this.socket=null,this.active=!1,this.db=t.db,this.closeOnDetach=t.closeOnDetach??!1,this.inspect=t.inspect??!1,this.debug=t.debug??!1,this.id=d.nextHandlerId++,this.log("constructor: created new handler")}get handlerId(){return this.id}log(t,...n){this.debug&&console.log(`[PGLiteSocketHandler#${this.id}] ${t}`,...n)}async attach(t){if(this.log(`attach: attaching socket from ${t.remoteAddress}:${t.remotePort}`),this.socket)throw new Error("Socket already attached");return this.socket=t,this.active=!0,this.log("attach: waiting for PGlite to be ready"),await this.db.waitReady,this.log("attach: acquiring exclusive lock on PGlite instance"),await new Promise(n=>{this.db.runExclusive(()=>(n(),new Promise((i,r)=>{this.resolveLock=i,this.rejectLock=r})))}),this.log("attach: setting up socket event handlers"),t.on("data",n=>this.handleData(n)),t.on("error",n=>this.handleError(n)),t.on("close",()=>this.handleClose()),this}detach(t){return this.log(`detach: detaching socket, close=${t??this.closeOnDetach}`),this.socket?(this.socket.removeAllListeners("data"),this.socket.removeAllListeners("error"),this.socket.removeAllListeners("close"),(t??this.closeOnDetach)&&this.socket.writable&&(this.log("detach: closing socket"),this.socket.end()),this.log("detach: releasing exclusive lock on PGlite instance"),this.resolveLock?.(),this.socket=null,this.active=!1,this):(this.log("detach: no socket attached, nothing to do"),this)}get isAttached(){return this.socket!==null}async handleData(t){if(!this.socket||!this.active){this.log("handleData: no active socket, ignoring data");return}this.log(`handleData: received ${t.length} bytes`),this.inspectData("incoming",t);try{this.log("handleData: sending data to PGlite for processing");let n=await this.db.execProtocolRaw(new Uint8Array(t));this.log(`handleData: received ${n.length} bytes from PGlite`),this.inspectData("outgoing",n),this.socket&&this.socket.writable&&this.active?(this.log("handleData: writing response to socket"),this.socket.write(Buffer.from(n)),this.dispatchEvent(new CustomEvent("data",{detail:{incoming:t.length,outgoing:n.length}}))):this.log("handleData: socket no longer writable or active, discarding response")}catch(n){this.log("handleData: error processing data:",n),this.handleError(n)}}handleError(t){this.log("handleError:",t),this.dispatchEvent(new CustomEvent("error",{detail:t})),this.log("handleError: rejecting exclusive lock on PGlite instance"),this.rejectLock?.(t),this.resolveLock=void 0,this.rejectLock=void 0,this.detach(!0)}handleClose(){this.log("handleClose: socket closed"),this.dispatchEvent(new CustomEvent("close")),this.detach(!1)}inspectData(t,n){if(this.inspect){console.log("-".repeat(75)),console.log(t==="incoming"?"-> incoming":"<- outgoing",n.length,"bytes");for(let i=0;i<n.length;i+=16){let r=Math.min(16,n.length-i),c="";for(let s=0;s<16;s++)if(s<r){let o=n[i+s];c+=o.toString(16).padStart(2,"0")+" "}else c+=" ";let h="";for(let s=0;s<r;s++){let o=n[i+s];h+=o>=32&&o<=126?String.fromCharCode(o):"."}console.log(`${i.toString(16).padStart(8,"0")} ${c} ${h}`)}}}};l.nextHandlerId=1;var u=l,v=class extends EventTarget{constructor(e){super(),this.server=null,this.active=!1,this.activeHandler=null,this.connectionQueue=[],this.handlerCount=0,this.db=e.db,e.path?this.path=e.path:(this.port=e.port||5432,this.host=e.host||"127.0.0.1"),this.inspect=e.inspect??!1,this.debug=e.debug??!1,this.connectionQueueTimeout=e.connectionQueueTimeout??a,this.log(`constructor: created server on ${this.host}:${this.port}`),this.log(`constructor: connection queue timeout: ${this.connectionQueueTimeout}ms`)}log(e,...t){this.debug&&console.log(`[PGLiteSocketServer] ${e}`,...t)}async start(){if(this.log(`start: starting server on ${this.getServerConn()}`),this.server)throw new Error("Socket server already started");return this.active=!0,this.server=g(e=>this.handleConnection(e)),new Promise((e,t)=>{if(!this.server)return t(new Error("Server not initialized"));this.server.on("error",n=>{this.log("start: server error:",n),this.dispatchEvent(new CustomEvent("error",{detail:n})),t(n)}),this.path?this.server.listen(this.path,()=>{this.log(`start: server listening on ${this.getServerConn()}`),this.dispatchEvent(new CustomEvent("listening",{detail:{path:this.path}})),e()}):this.server.listen(this.port,this.host,()=>{this.log(`start: server listening on ${this.getServerConn()}`),this.dispatchEvent(new CustomEvent("listening",{detail:{port:this.port,host:this.host}})),e()})})}getServerConn(){return this.path?this.path:`${this.host}:${this.port}`}async stop(){return this.log("stop: stopping server"),this.active=!1,this.log(`stop: clearing connection queue (${this.connectionQueue.length} connections)`),this.connectionQueue.forEach(e=>{clearTimeout(e.timeoutId),e.socket.writable&&(this.log(`stop: closing queued connection from ${e.clientInfo.clientAddress}:${e.clientInfo.clientPort}`),e.socket.end())}),this.connectionQueue=[],this.activeHandler&&(this.log(`stop: detaching active handler #${this.activeHandlerId}`),this.activeHandler.detach(!0),this.activeHandler=null),this.server?new Promise(e=>{if(!this.server)return e();this.server.close(()=>{this.log("stop: server closed"),this.server=null,this.dispatchEvent(new CustomEvent("close")),e()})}):(this.log("stop: server not running, nothing to do"),Promise.resolve())}get activeHandlerId(){return this.activeHandler?.handlerId??null}async handleConnection(e){let t={clientAddress:e.remoteAddress||"unknown",clientPort:e.remotePort||0};if(this.log(`handleConnection: new connection from ${t.clientAddress}:${t.clientPort}`),!this.active){this.log("handleConnection: server not active, closing connection"),e.end();return}if(!this.activeHandler||!this.activeHandler.isAttached){this.log("handleConnection: no active handler, attaching socket directly"),this.dispatchEvent(new CustomEvent("connection",{detail:t})),await this.attachSocketToNewHandler(e,t);return}this.log(`handleConnection: active handler #${this.activeHandlerId} exists, queueing connection`),this.enqueueConnection(e,t)}enqueueConnection(e,t){this.log(`enqueueConnection: queueing connection from ${t.clientAddress}:${t.clientPort}, timeout: ${this.connectionQueueTimeout}ms`);let n=setTimeout(()=>{this.log(`enqueueConnection: timeout for connection from ${t.clientAddress}:${t.clientPort}`),this.connectionQueue=this.connectionQueue.filter(i=>i.socket!==e),e.writable&&(this.log("enqueueConnection: closing timed out connection"),e.end()),this.dispatchEvent(new CustomEvent("queueTimeout",{detail:{...t,queueSize:this.connectionQueue.length}}))},this.connectionQueueTimeout);this.connectionQueue.push({socket:e,clientInfo:t,timeoutId:n}),this.log(`enqueueConnection: connection queued, queue size: ${this.connectionQueue.length}`),this.dispatchEvent(new CustomEvent("queuedConnection",{detail:{...t,queueSize:this.connectionQueue.length}}))}processNextInQueue(){if(this.log(`processNextInQueue: processing next connection, queue size: ${this.connectionQueue.length}`),this.connectionQueue.length===0||!this.active){this.log("processNextInQueue: no connections in queue or server not active, nothing to do");return}let e=this.connectionQueue.shift();if(e){if(this.log(`processNextInQueue: processing connection from ${e.clientInfo.clientAddress}:${e.clientInfo.clientPort}`),clearTimeout(e.timeoutId),!e.socket.writable){this.log("processNextInQueue: socket no longer writable, skipping to next connection"),this.processNextInQueue();return}this.attachSocketToNewHandler(e.socket,e.clientInfo).catch(t=>{this.log("processNextInQueue: error attaching socket:",t),this.dispatchEvent(new CustomEvent("error",{detail:t})),this.processNextInQueue()})}}async attachSocketToNewHandler(e,t){this.handlerCount++,this.log(`attachSocketToNewHandler: creating new handler for ${t.clientAddress}:${t.clientPort} (handler #${this.handlerCount})`);let n=new u({db:this.db,closeOnDetach:!0,inspect:this.inspect,debug:this.debug});n.addEventListener("error",i=>{this.log(`handler #${n.handlerId}: error from handler:`,i.detail),this.dispatchEvent(new CustomEvent("error",{detail:i.detail}))}),n.addEventListener("close",()=>{this.log(`handler #${n.handlerId}: closed`),this.activeHandler===n&&(this.log(`handler #${n.handlerId}: was active handler, processing next connection in queue`),this.activeHandler=null,this.processNextInQueue())});try{this.activeHandler=n,this.log(`handler #${n.handlerId}: attaching socket`),await n.attach(e),this.dispatchEvent(new CustomEvent("connection",{detail:t}))}catch(i){throw this.log(`handler #${n.handlerId}: error attaching socket:`,i),this.activeHandler=null,e.writable&&e.end(),i}}};export{a as CONNECTION_QUEUE_TIMEOUT,u as PGLiteSocketHandler,v as PGLiteSocketServer};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import"./chunk-J2EYU3K5.js";import{createServer as A}from"http";import{Http2ServerRequest as w}from"http2";import{Readable as P}from"stream";import F from"crypto";var l=class extends Error{static name="RequestError";constructor(e,r){super(e,r)}},U=e=>e instanceof l?e:new l(e.message,{cause:e}),B=global.Request,y=class extends B{constructor(e,r){typeof e=="object"&&u in e&&(e=e[u]()),typeof r?.body?.getReader<"u"&&(r.duplex??="half"),super(e,r)}},L=(e,r,s,t)=>{let a=[],n=s.rawHeaders;for(let c=0;c<n.length;c+=2){let{[c]:h,[c+1]:p}=n;h.charCodeAt(0)!==58&&a.push([h,p])}let o={method:e,headers:a,signal:t.signal};if(e==="TRACE"){o.method="GET";let c=new y(r,o);return Object.defineProperty(c,"method",{get(){return"TRACE"}}),c}return e==="GET"||e==="HEAD"||("rawBody"in s&&s.rawBody instanceof Buffer?o.body=new ReadableStream({start(c){c.enqueue(s.rawBody),c.close()}}):o.body=P.toWeb(s)),new y(r,o)},u=Symbol("getRequestCache"),x=Symbol("requestCache"),m=Symbol("incomingKey"),v=Symbol("urlKey"),d=Symbol("abortControllerKey"),g=Symbol("getAbortController"),R={get method(){return this[m].method||"GET"},get url(){return this[v]},[g](){return this[u](),this[d]},[u](){return this[d]||=new AbortController,this[x]||=L(this.method,this[v],this[m],this[d])}};["body","bodyUsed","cache","credentials","destination","headers","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach(e=>{Object.defineProperty(R,e,{get(){return this[u]()[e]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(R,e,{value:function(){return this[u]()[e]()}})});Object.setPrototypeOf(R,y.prototype);var k=(e,r)=>{let s=Object.create(R);s[m]=e;let t=e.url||"";if(t[0]!=="/"&&(t.startsWith("http://")||t.startsWith("https://"))){if(e instanceof w)throw new l("Absolute URL for :path is not allowed in HTTP/2");try{let c=new URL(t);s[v]=c.href}catch(c){throw new l("Invalid absolute URL",{cause:c})}return s}let a=(e instanceof w?e.authority:e.headers.host)||r;if(!a)throw new l("Missing host header");let n;if(e instanceof w){if(n=e.scheme,!(n==="http"||n==="https"))throw new l("Unsupported scheme")}else n=e.socket&&e.socket.encrypted?"https":"http";let o=new URL(`${n}://${a}${t}`);if(o.hostname.length!==a.length&&o.hostname!==a.replace(/:\d+$/,""))throw new l("Invalid host header");return s[v]=o.href,s},q=Symbol("responseCache"),i=Symbol("getResponseCache"),f=Symbol("cache"),C=global.Response,b=class H{#r;#e;[i](){return delete this[f],this[q]||=new C(this.#r,this.#e)}constructor(r,s){let t;if(this.#r=r,s instanceof H){let a=s[q];if(a){this.#e=a,this[i]();return}else this.#e=s.#e,t=new Headers(s.#e.headers)}else this.#e=s;(typeof r=="string"||typeof r?.getReader<"u"||r instanceof Blob||r instanceof Uint8Array)&&(t||=s?.headers||{"content-type":"text/plain; charset=UTF-8"},this[f]=[s?.status||200,r,t])}get headers(){let r=this[f];return r?(r[2]instanceof Headers||(r[2]=new Headers(r[2])),r[2]):this[i]().headers}get status(){return this[f]?.[0]??this[i]().status}get ok(){let r=this.status;return r>=200&&r<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(e=>{Object.defineProperty(b.prototype,e,{get(){return this[i]()[e]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(b.prototype,e,{value:function(){return this[i]()[e]()}})});Object.setPrototypeOf(b,C);Object.setPrototypeOf(b.prototype,C.prototype);function S(e,r){if(e.locked)throw new TypeError("ReadableStream is locked.");if(r.destroyed){e.cancel();return}let s=e.getReader();return r.on("close",t),r.on("error",t),s.read().then(n,t),s.closed.finally(()=>{r.off("close",t),r.off("error",t)});function t(o){s.cancel(o).catch(()=>{}),o&&r.destroy(o)}function a(){s.read().then(n,t)}function n({done:o,value:c}){try{if(o)r.end();else if(!r.write(c))r.once("drain",a);else return s.read().then(n,t)}catch(h){t(h)}}}var T=e=>{let r={};e instanceof Headers||(e=new Headers(e??void 0));let s=[];for(let[t,a]of e)t==="set-cookie"?s.push(a):r[t]=a;return s.length>0&&(r["set-cookie"]=s),r["content-type"]??="text/plain; charset=UTF-8",r},G="x-hono-already-sent",K=global.fetch;typeof global.crypto>"u"&&(global.crypto=F);global.fetch=(e,r)=>(r={compress:!1,...r},K(e,r));var $=/^no$/i,D=/^(application\/json\b|text\/(?!event-stream\b))/i,_=()=>new Response(null,{status:400}),O=e=>new Response(null,{status:e instanceof Error&&(e.name==="TimeoutError"||e.constructor.name==="TimeoutError")?504:500}),E=(e,r)=>{let s=e instanceof Error?e:new Error("unknown error",{cause:e});s.code==="ERR_STREAM_PREMATURE_CLOSE"?console.info("The user aborted a request."):(console.error(e),r.headersSent||r.writeHead(500,{"Content-Type":"text/plain"}),r.end(`Error: ${s.message}`),r.destroy(s))},j=async(e,r)=>{let[s,t,a]=e[f];if(a instanceof Headers&&(a=T(a)),typeof t=="string"?a["Content-Length"]=Buffer.byteLength(t):t instanceof Uint8Array?a["Content-Length"]=t.byteLength:t instanceof Blob&&(a["Content-Length"]=t.size),r.writeHead(s,a),typeof t=="string"||t instanceof Uint8Array)r.end(t);else if(t instanceof Blob)r.end(new Uint8Array(await t.arrayBuffer()));else return S(t,r)?.catch(n=>E(n,r))},I=async(e,r,s={})=>{if(e instanceof Promise)if(s.errorHandler)try{e=await e}catch(a){let n=await s.errorHandler(a);if(!n)return;e=n}else e=await e.catch(O);if(f in e)return j(e,r);let t=T(e.headers);if(e.body){let{"transfer-encoding":a,"content-encoding":n,"content-length":o,"x-accel-buffering":c,"content-type":h}=t;if(a||n||o||c&&$.test(c)||!D.test(h))r.writeHead(e.status,t),await S(e.body,r);else{let p=await e.arrayBuffer();t["content-length"]=p.byteLength,r.writeHead(e.status,t),r.end(new Uint8Array(p))}}else t[G]||(r.writeHead(e.status,t),r.end())},M=(e,r={})=>(r.overrideGlobalObjects!==!1&&global.Request!==y&&(Object.defineProperty(global,"Request",{value:y}),Object.defineProperty(global,"Response",{value:b})),async(s,t)=>{let a,n;try{if(n=k(s,r.hostname),t.on("close",()=>{n[d]&&(s.errored?n[d].abort(s.errored.toString()):t.writableFinished||n[d].abort("Client connection prematurely closed."))}),a=e(n,{incoming:s,outgoing:t}),f in a)return j(a,t)}catch(o){if(a)return E(o,t);if(r.errorHandler){if(a=await r.errorHandler(n?o:U(o)),!a)return}else n?a=O(o):a=_()}try{return await I(a,t,r)}catch(o){return E(o,t)}}),W=e=>{let r=e.fetch,s=M(r,{hostname:e.hostname,overrideGlobalObjects:e.overrideGlobalObjects});return(e.createServer||A)(e.serverOptions||{},s)},Y=(e,r)=>{let s=W(e);return s.listen(e?.port??3e3,e.hostname,()=>{let t=s.address();r&&r(t)}),s};export{l as RequestError,W as createAdaptorServer,M as getRequestListener,Y as serve};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-ZZ7TGN5J.js";import"./chunk-J2EYU3K5.js";export{a as HTTPException};
@@ -1,5 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as v,g as M,l as R}from"./chunk-IUA2KLPR.js";import"./chunk-C743SY2X.js";import"./chunk-J2EYU3K5.js";function u(i,t=i){return`\x1B]8;;${i.toString()}\x07${t.toString()}\x1B]8;;\x07`}function B(i){return typeof i=="object"&&i!==null}function G(i){return B(i)&&typeof i.length=="number"}function N(i){return Array.isArray(i)?i:i===void 0?[]:G(i)||i instanceof Set?Array.from(i):[i]}var h=N;var A=new WeakMap,$=new WeakMap,g=class{constructor(t,e){this.value=t,$.set(this,e)}set value(t){A.set(this,t)}get value(){let t=A.get(this),e=$.get(this);return e.get&&(t=e.get(t)),t===void 0?t="":t=String(t),t}},p=g;var W=class{constructor(t,e){this.list=[],this.load(t,e)}load(t,e){for(let n of h(t)){let r=new Map(e.list.map(s=>[s,new p(n[s.name],s)]));this.list.push(r)}}},E=W;var x=class{constructor(t){this.left=t.left,this.right=t.right}length(){return this.left.length+this.right.length}},T=x;var z=new WeakMap,b=class{constructor(t={}){this.name=t.name,this.width=t.width,this.maxWidth=t.maxWidth,this.minWidth=t.minWidth,this.noWrap=t.noWrap,this.break=t.break,this.contentWrappable=t.contentWrappable,this.contentWidth=t.contentWidth,this.minContentWidth=t.minContentWidth,this.padding=t.padding||{left:" ",right:" "},this.generatedWidth=null}set padding(t){z.set(this,new T(t))}get padding(){return z.get(this)}get wrappedContentWidth(){return Math.max(this.generatedWidth-this.padding.length(),0)}isResizable(){return!this.isFixed()}isFixed(){return this.width!==void 0||this.noWrap||!this.contentWrappable}generateWidth(){this.generatedWidth=this.width||this.contentWidth+this.padding.length()}generateMinWidth(){this.minWidth=this.minContentWidth+this.padding.length()}},w=b;var y=new WeakMap,k=class i{constructor(t){this.list=[];for(let e of h(t))this.add(e)}totalWidth(){return this.list.length?this.list.map(t=>t.generatedWidth).reduce((t,e)=>t+e):0}totalFixedWidth(){return this.getFixed().map(t=>t.generatedWidth).reduce((t,e)=>t+e,0)}get(t){return this.list.find(e=>e.name===t)}getResizable(){return this.list.filter(t=>t.isResizable())}getFixed(){return this.list.filter(t=>t.isFixed())}add(t){let e=t instanceof w?t:new w(t);return this.list.push(e),e}get maxWidth(){y.get(this)}set maxWidth(t){y.set(this,t)}autoSize(){let t=y.get(this);for(let n of this.list)n.generateWidth(),n.generateMinWidth();for(let n of this.list)n.maxWidth!==void 0&&n.generatedWidth>n.maxWidth&&(n.generatedWidth=n.maxWidth),n.minWidth!==void 0&&n.generatedWidth<n.minWidth&&(n.generatedWidth=n.minWidth);let e={total:this.totalWidth(),view:t,diff:this.totalWidth()-t,totalFixed:this.totalFixedWidth(),totalResizable:Math.max(t-this.totalFixedWidth(),0)};if(e.diff>0){let n=this.getResizable();for(let o of n)o.generatedWidth=Math.floor(e.totalResizable/n.length);let r=this.list.filter(o=>o.generatedWidth>o.contentWidth),s=this.list.filter(o=>o.generatedWidth<o.contentWidth),a=0;for(let o of r){let c=o.generatedWidth;o.generateWidth(),a+=c-o.generatedWidth}for(let o of s)o.generatedWidth+=Math.floor(a/s.length)}return this}static getColumns(t){let e=new i;for(let n of h(t))for(let r in n){let s=e.get(r);s||(s=e.add({name:r,contentWidth:0,minContentWidth:0}))}return e}},j=k;var m={chunk:/[^\s-]+?-\b|\S+|\s+|\r\n?|\n/g,ansiEscapeSequence:/\u001b.*?m/g},C=class{constructor(t="",e={}){this._lines=String(t).split(/\r\n|\n/g),this.options={eol:`
3
- `,width:30,...e}}lines(){return this._lines.map(F,this).map(t=>t.match(m.chunk)||["~~empty~~"]).map(t=>this.options.break?t.map(K,this):t).map(t=>t.flat()).map(t=>t.reduce((e,n)=>{let r=e[e.length-1];return S(n).length+S(r).length>this.options.width?e.push(n):e[e.length-1]+=n,e},[""])).flat().map(F,this).filter(t=>t.trim()).map(t=>t.replace("~~empty~~",""))}wrap(){return this.lines().join(this.options.eol)}toString(){return this.wrap()}static wrap(t,e){return new this(t,e).wrap()}static lines(t,e){return new this(t,e).lines()}static isWrappable(t=""){let e=String(t).match(m.chunk);return e?e.length>1:!1}static getChunks(t){return t.match(m.chunk)||[]}};function F(i){return this.options.noTrim?i:i.trim()}function S(i){return i.replace(m.ansiEscapeSequence,"")}function K(i){if(S(i).length>this.options.width){let t=i.split(""),e,n=[];for(;(e=t.splice(0,this.options.width)).length;)n.push(e.join(""));return n}else return i}var d=C;var U=/\u001b.*?m/g;function f(i){return i.replace(U,"")}function _(i){return U.test(i)}function V(i){let t=i.map(e=>e.length);return Math.max(...t)}function H(i,t,e){let n=i.length-f(i).length;return i=i||"",(t.left||"")+i.padEnd(e-t.length()+n)+(t.right||"")}function O(i){return d.getChunks(i).reduce((e,n)=>Math.max(n.length,e),0)}function D(i){let e=i.reduce((n,r)=>{for(let s of Object.keys(r))n.includes(s)||n.push(s);return n},[]).filter(n=>!i.some(s=>{let a=s[n];return a!==void 0&&typeof a!="string"||typeof a=="string"&&/\S+/.test(a)}));return i.map(n=>{for(let r of e)delete n[r];return n})}function P(i={},t={}){let e=Object.assign({},i);return typeof e.padding=="object"?(e.padding.left===void 0&&(e.padding.left=t.padding.left),e.padding.right===void 0&&(e.padding.right=t.padding.right)):e.padding=t.padding,e.maxWidth===void 0&&(e.maxWidth=t.maxWidth),e.columns===void 0&&(e.columns=t.columns),e.eol===void 0&&(e.eol=t.eol),e}var L=class{constructor(t,e={}){let n={padding:{left:" ",right:" "},maxWidth:80,columns:[],eol:`
4
- `};this.options=P(e,n),this.rows=null,this.columns=null,this.load(t)}load(t){let e=this.options;e.ignoreEmptyColumns&&(t=D(t)),this.columns=j.getColumns(t),this.columns.maxWidth=e.maxWidth;for(let n of this.columns.list)n.padding=e.padding,n.noWrap=e.noWrap,n.break=e.break,e.break&&(n.contentWrappable=!0);for(let n of e.columns){let r=this.columns.get(n.name);r&&(n.padding&&(r.padding.left=n.padding.left,r.padding.right=n.padding.right),r.width=n.width,r.maxWidth=n.maxWidth,r.minWidth=n.minWidth,r.noWrap=n.noWrap,r.break=n.break,n.break&&(r.contentWrappable=!0),r.get=n.get)}for(let n of h(t))for(let r in n){let s=this.columns.get(r),o=new p(n[r],s).value;_(o)&&(o=f(o)),o.length>s.contentWidth&&(s.contentWidth=o.length);let c=O(o);c>s.minContentWidth&&(s.minContentWidth=c),s.contentWrappable||(s.contentWrappable=d.isWrappable(o))}return this.columns.autoSize(),this.rows=new E(t,this.columns),this}getWrapped(){return this.columns.autoSize(),this.rows.list.map(t=>{let e=[];for(let[n,r]of t.entries())n.noWrap?e.push(r.value.split(/\r\n?|\n/)):e.push(d.lines(r.value,{width:n.wrappedContentWidth,break:n.break,noTrim:this.options.noTrim}));return e})}getLines(){let t=this.getWrapped(),e=[];return t.forEach(n=>{let r=V(n);for(let s=0;s<r;s++){let a=[];n.forEach(o=>{a.push(o[s]||"")}),e.push(a)}}),e}renderLines(){return this.getLines().map(e=>e.reduce((n,r,s)=>{let a=this.columns.list[s];return n+H(r,a.padding,a.generatedWidth)},""))}toString(){return this.renderLines().join(this.options.eol)+this.options.eol}},q=L;var J={...R},Q={description:"List available servers",name:"ls"},$t={args:J,meta:Q,run:async i=>{let t=await M.scan({debug:i.args.debug}),e=new q([{name:l("name"),status:l("status"),urls:l("urls")},...t.map(n=>({name:n.name,status:n.status,urls:X(n)}))]);v.log(e.toString())}};function l(i){return`\x1B[1m${i}\x1B[0m`}function X(i){if(i.status!=="running")return"";let t=Y(i),e=Z(i),n=tt(i);return[t?`${l("DATABASE_URL")}: ${t}`:null,e?`${l("TCP")}: ${e}`:null,n?`${l("Terminal")}: ${n}`:null].filter(Boolean).join(`
5
- `)}function Y(i){let{url:t}=i.exports?.ppg||{};if(!t)return"";let e=new URL(t),n=e.searchParams.get("api_key");return e.searchParams.set("api_key",`${n.slice(0,4)}...${n.slice(-4)}`),u(t,e)}function Z(i){let{connectionString:t,prismaORMConnectionString:e}=i.exports?.database||{};if(!e&&!t)return"";let n=new URL(e||t);return u(n,`${n.protocol}//...@${n.host}/...`)}function tt(i){let{connectionString:t,terminalCommand:e}=i.exports?.database||{};if(!t||!e)return"";let n=new URL(t);return u(e,`...psql -h ${n.hostname} -p ${n.port} ...`)}export{$t as ListCommand};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import"./chunk-J2EYU3K5.js";function c(){let{process:o,Deno:r}=globalThis;return!(typeof r?.noColor=="boolean"?r.noColor:o!==void 0?"NO_COLOR"in o?.env:!1)}var m=o=>{let[r,e]=[",","."];return o.map(n=>n.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+r)).join(e)},d=o=>{let r=Date.now()-o;return m([r<1e3?r+"ms":Math.round(r/1e3)+"s"])},$=o=>{if(c())switch(o/100|0){case 5:return`\x1B[31m${o}\x1B[0m`;case 4:return`\x1B[33m${o}\x1B[0m`;case 3:return`\x1B[36m${o}\x1B[0m`;case 2:return`\x1B[32m${o}\x1B[0m`}return`${o}`};function s(o,r,e,t,n=0,l){let a=r==="<--"?`${r} ${e} ${t}`:`${r} ${e} ${t} ${$(n)} ${l}`;o(a)}var x=(o=console.log)=>async function(e,t){let{method:n,url:l}=e.req,a=l.slice(l.indexOf("/",8));s(o,"<--",n,a);let i=Date.now();await t(),s(o,"-->",n,a,e.res.status,d(i))};export{x as logger};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{i as m,m as i,n}from"./chunk-7LVVKN3Q.js";import"./chunk-J2EYU3K5.js";import*as o from"fs";import*as r from"path";m();var u=class extends n{constructor(s){super(s),this.rootDir=r.resolve(s),o.existsSync(r.join(this.rootDir))||o.mkdirSync(this.rootDir)}async init(s,e){return this.pg=s,{emscriptenOpts:{...e,preRun:[...e.preRun||[],t=>{let p=t.FS.filesystems.NODEFS;t.FS.mkdir(i),t.FS.mount(p,{root:this.rootDir},i)}]}}}async closeFs(){this.pg.Module.FS.quit()}};export{u as NodeFS};
@@ -1,4 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{d as s,e as m,f as M,g as o,h as W,i as z,o as R,p as H}from"./chunk-7LVVKN3Q.js";import"./chunk-J2EYU3K5.js";z();var L="state.txt",J="data",v={DIR:16384,FILE:32768},_,I,N,j,f,k,y,T,F,O,S,l,A,E,P,g,w,D,C,x,q=class extends R{constructor(t,{initialPoolSize:e=1e3,maintainedPoolSize:a=100,debug:i=!1}={}){super(t,{debug:i}),m(this,l),m(this,_),m(this,I),m(this,N),m(this,j),m(this,f),m(this,k,new Map),m(this,y,new Map),m(this,T,0),m(this,F,new Map),m(this,O,new Map),this.lastCheckpoint=0,this.checkpointInterval=1e3*60,this.poolCounter=0,m(this,S,new Set),this.initialPoolSize=e,this.maintainedPoolSize=a}async init(t,e){return await o(this,l,A).call(this),super.init(t,e)}async syncToFs(t=!1){await this.maybeCheckpointState(),await this.maintainPool(),t||this.flush()}async closeFs(){for(let t of s(this,y).values())t.close();s(this,f).flush(),s(this,f).close(),this.pg.Module.FS.quit()}async maintainPool(t){t=t||this.maintainedPoolSize;let e=t-this.state.pool.length,a=[];for(let i=0;i<e;i++)a.push(new Promise(async r=>{++this.poolCounter;let h=`${(Date.now()-1704063600).toString(16).padStart(8,"0")}-${this.poolCounter.toString(16).padStart(8,"0")}`,c=await s(this,N).getFileHandle(h,{create:!0}),d=await c.createSyncAccessHandle();s(this,k).set(h,c),s(this,y).set(h,d),o(this,l,P).call(this,{opp:"createPoolFile",args:[h]}),this.state.pool.push(h),r()}));for(let i=0;i>e;i--)a.push(new Promise(async r=>{let h=this.state.pool.pop();o(this,l,P).call(this,{opp:"deletePoolFile",args:[h]});let c=s(this,k).get(h);s(this,y).get(h)?.close(),await s(this,N).removeEntry(c.name),s(this,k).delete(h),s(this,y).delete(h),r()}));await Promise.all(a)}_createPoolFileState(t){this.state.pool.push(t)}_deletePoolFileState(t){let e=this.state.pool.indexOf(t);e>-1&&this.state.pool.splice(e,1)}async maybeCheckpointState(){Date.now()-this.lastCheckpoint>this.checkpointInterval&&await this.checkpointState()}async checkpointState(){let t=new TextEncoder().encode(JSON.stringify(this.state));s(this,f).truncate(0),s(this,f).write(t,{at:0}),s(this,f).flush(),this.lastCheckpoint=Date.now()}flush(){for(let t of s(this,S))try{t.flush()}catch{}s(this,S).clear()}chmod(t,e){o(this,l,E).call(this,{opp:"chmod",args:[t,e]},()=>{this._chmodState(t,e)})}_chmodState(t,e){let a=o(this,l,w).call(this,t);a.mode=e}close(t){let e=o(this,l,D).call(this,t);s(this,F).delete(t),s(this,O).delete(e)}fstat(t){let e=o(this,l,D).call(this,t);return this.lstat(e)}lstat(t){let e=o(this,l,w).call(this,t),a=e.type==="file"?s(this,y).get(e.backingFilename).getSize():0,i=4096;return{dev:0,ino:0,mode:e.mode,nlink:1,uid:0,gid:0,rdev:0,size:a,blksize:i,blocks:Math.ceil(a/i),atime:e.lastModified,mtime:e.lastModified,ctime:e.lastModified}}mkdir(t,e){o(this,l,E).call(this,{opp:"mkdir",args:[t,e]},()=>{this._mkdirState(t,e)})}_mkdirState(t,e){let a=o(this,l,g).call(this,t),i=a.pop(),r=[],h=this.state.root;for(let d of a){if(r.push(t),!Object.prototype.hasOwnProperty.call(h.children,d))if(e?.recursive)this.mkdir(r.join("/"));else throw new p("ENOENT","No such file or directory");if(h.children[d].type!=="directory")throw new p("ENOTDIR","Not a directory");h=h.children[d]}if(Object.prototype.hasOwnProperty.call(h.children,i))throw new p("EEXIST","File exists");let c={type:"directory",lastModified:Date.now(),mode:e?.mode||v.DIR,children:{}};h.children[i]=c}open(t,e,a){if(o(this,l,w).call(this,t).type!=="file")throw new p("EISDIR","Is a directory");let i=o(this,l,C).call(this);return s(this,F).set(i,t),s(this,O).set(t,i),i}readdir(t){let e=o(this,l,w).call(this,t);if(e.type!=="directory")throw new p("ENOTDIR","Not a directory");return Object.keys(e.children)}read(t,e,a,i,r){let h=o(this,l,D).call(this,t),c=o(this,l,w).call(this,h);if(c.type!=="file")throw new p("EISDIR","Is a directory");return s(this,y).get(c.backingFilename).read(new Uint8Array(e.buffer,a,i),{at:r})}rename(t,e){o(this,l,E).call(this,{opp:"rename",args:[t,e]},()=>{this._renameState(t,e,!0)})}_renameState(t,e,a=!1){let i=o(this,l,g).call(this,t),r=i.pop(),h=o(this,l,w).call(this,i.join("/"));if(!Object.prototype.hasOwnProperty.call(h.children,r))throw new p("ENOENT","No such file or directory");let c=o(this,l,g).call(this,e),d=c.pop(),n=o(this,l,w).call(this,c.join("/"));if(a&&Object.prototype.hasOwnProperty.call(n.children,d)){let u=n.children[d];s(this,y).get(u.backingFilename).truncate(0),this.state.pool.push(u.backingFilename)}n.children[d]=h.children[r],delete h.children[r]}rmdir(t){o(this,l,E).call(this,{opp:"rmdir",args:[t]},()=>{this._rmdirState(t)})}_rmdirState(t){let e=o(this,l,g).call(this,t),a=e.pop(),i=o(this,l,w).call(this,e.join("/"));if(!Object.prototype.hasOwnProperty.call(i.children,a))throw new p("ENOENT","No such file or directory");let r=i.children[a];if(r.type!=="directory")throw new p("ENOTDIR","Not a directory");if(Object.keys(r.children).length>0)throw new p("ENOTEMPTY","Directory not empty");delete i.children[a]}truncate(t,e=0){let a=o(this,l,w).call(this,t);if(a.type!=="file")throw new p("EISDIR","Is a directory");let i=s(this,y).get(a.backingFilename);if(!i)throw new p("ENOENT","No such file or directory");i.truncate(e),s(this,S).add(i)}unlink(t){o(this,l,E).call(this,{opp:"unlink",args:[t]},()=>{this._unlinkState(t,!0)})}_unlinkState(t,e=!1){let a=o(this,l,g).call(this,t),i=a.pop(),r=o(this,l,w).call(this,a.join("/"));if(!Object.prototype.hasOwnProperty.call(r.children,i))throw new p("ENOENT","No such file or directory");let h=r.children[i];if(h.type!=="file")throw new p("EISDIR","Is a directory");if(delete r.children[i],e){let c=s(this,y).get(h.backingFilename);c?.truncate(0),s(this,S).add(c),s(this,O).has(t)&&(s(this,F).delete(s(this,O).get(t)),s(this,O).delete(t))}this.state.pool.push(h.backingFilename)}utimes(t,e,a){o(this,l,E).call(this,{opp:"utimes",args:[t,e,a]},()=>{this._utimesState(t,e,a)})}_utimesState(t,e,a){let i=o(this,l,w).call(this,t);i.lastModified=a}writeFile(t,e,a){let i=o(this,l,g).call(this,t),r=i.pop(),h=o(this,l,w).call(this,i.join("/"));if(Object.prototype.hasOwnProperty.call(h.children,r)){let n=h.children[r];n.lastModified=Date.now(),o(this,l,P).call(this,{opp:"setLastModified",args:[t,n.lastModified]})}else{if(this.state.pool.length===0)throw new Error("No more file handles available in the pool");let n={type:"file",lastModified:Date.now(),mode:a?.mode||v.FILE,backingFilename:this.state.pool.pop()};h.children[r]=n,o(this,l,P).call(this,{opp:"createFileNode",args:[t,n]})}let c=h.children[r],d=s(this,y).get(c.backingFilename);e.length>0&&(d.write(typeof e=="string"?new TextEncoder().encode(e):new Uint8Array(e),{at:0}),t.startsWith("/pg_wal")&&s(this,S).add(d))}_createFileNodeState(t,e){let a=o(this,l,g).call(this,t),i=a.pop(),r=o(this,l,w).call(this,a.join("/"));r.children[i]=e;let h=this.state.pool.indexOf(e.backingFilename);return h>-1&&this.state.pool.splice(h,1),e}_setLastModifiedState(t,e){let a=o(this,l,w).call(this,t);a.lastModified=e}write(t,e,a,i,r){let h=o(this,l,D).call(this,t),c=o(this,l,w).call(this,h);if(c.type!=="file")throw new p("EISDIR","Is a directory");let d=s(this,y).get(c.backingFilename);if(!d)throw new p("EBADF","Bad file descriptor");let n=d.write(new Uint8Array(e,a,i),{at:r});return h.startsWith("/pg_wal")&&s(this,S).add(d),n}};_=new WeakMap,I=new WeakMap,N=new WeakMap,j=new WeakMap,f=new WeakMap,k=new WeakMap,y=new WeakMap,T=new WeakMap,F=new WeakMap,O=new WeakMap,S=new WeakMap,l=new WeakSet,A=async function(){M(this,_,await navigator.storage.getDirectory()),M(this,I,await o(this,l,x).call(this,this.dataDir,{create:!0})),M(this,N,await o(this,l,x).call(this,J,{from:s(this,I),create:!0})),M(this,j,await s(this,I).getFileHandle(L,{create:!0})),M(this,f,await s(this,j).createSyncAccessHandle());let t=new ArrayBuffer(s(this,f).getSize());s(this,f).read(t,{at:0});let e,a=new TextDecoder().decode(t).split(`
3
- `),i=!1;try{e=JSON.parse(a[0])}catch{e={root:{type:"directory",lastModified:Date.now(),mode:v.DIR,children:{}},pool:[]},s(this,f).truncate(0),s(this,f).write(new TextEncoder().encode(JSON.stringify(e)),{at:0}),i=!0}this.state=e;let r=a.slice(1).filter(Boolean).map(n=>JSON.parse(n));for(let n of r){let u=`_${n.opp}State`;if(typeof this[u]=="function")try{this[u].bind(this)(...n.args)}catch(b){console.warn("Error applying OPFS AHP WAL entry",n,b)}}let h=[],c=async n=>{if(n.type==="file")try{let u=await s(this,N).getFileHandle(n.backingFilename),b=await u.createSyncAccessHandle();s(this,k).set(n.backingFilename,u),s(this,y).set(n.backingFilename,b)}catch(u){console.error("Error opening file handle for node",n,u)}else for(let u of Object.values(n.children))h.push(c(u))};await c(this.state.root);let d=[];for(let n of this.state.pool)d.push(new Promise(async u=>{s(this,k).has(n)&&console.warn("File handle already exists for pool file",n);let b=await s(this,N).getFileHandle(n),B=await b.createSyncAccessHandle();s(this,k).set(n,b),s(this,y).set(n,B),u()}));await Promise.all([...h,...d]),await this.maintainPool(i?this.initialPoolSize:this.maintainedPoolSize)},E=function(t,e){let a=o(this,l,P).call(this,t);try{e()}catch(i){throw s(this,f).truncate(a),i}},P=function(t){let e=JSON.stringify(t),a=new TextEncoder().encode(`
4
- ${e}`),i=s(this,f).getSize();return s(this,f).write(a,{at:i}),s(this,S).add(s(this,f)),i},g=function(t){return t.split("/").filter(Boolean)},w=function(t,e){let a=o(this,l,g).call(this,t),i=e||this.state.root;for(let r of a){if(i.type!=="directory")throw new p("ENOTDIR","Not a directory");if(!Object.prototype.hasOwnProperty.call(i.children,r))throw new p("ENOENT","No such file or directory");i=i.children[r]}return i},D=function(t){let e=s(this,F).get(t);if(!e)throw new p("EBADF","Bad file descriptor");return e},C=function(){let t=++W(this,T)._;for(;s(this,F).has(t);)W(this,T)._++;return t},x=async function(t,e){let a=o(this,l,g).call(this,t),i=e?.from||s(this,_);for(let r of a)i=await i.getDirectoryHandle(r,{create:e?.create});return i};var p=class extends Error{constructor(t,e){super(e),typeof t=="number"?this.code=t:typeof t=="string"&&(this.code=H[t])}};export{q as OpfsAhpFS};
@@ -1,3 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import"./chunk-J2EYU3K5.js";var S=class extends Error{constructor(t){super(`Exit with code ${t}`),this.code=t}},v=class{appendFileSync(t,e,r={}){throw new Error("appendFileSync not implemented")}fsyncSync(t){throw new Error("fsyncSync not implemented")}linkSync(t,e){throw new Error("linkSync not implemented")}mkdirSync(t,e={}){throw new Error("mkdirSync not implemented")}readdirSync(t,e={}){throw new Error("readdirSync not implemented")}readFileSync(t,e={}){throw new Error("readFileSync not implemented")}readlinkSync(t,e={}){throw new Error("readlinkSync not implemented")}renameSync(t,e){throw new Error("renameSync not implemented")}rmdirSync(t,e={}){throw new Error("rmdirSync not implemented")}setFlagsSync(t,e){throw new Error("setFlagsSync not implemented")}statSync(t,e={}){throw new Error("statSync not implemented")}symlinkSync(t,e,r="file"){throw new Error("symlinkSync not implemented")}truncateSync(t,e=0){throw new Error("truncateSync not implemented")}unlinkSync(t){throw new Error("unlinkSync not implemented")}utimesSync(t,e,r){throw new Error("utimesSync not implemented")}writeFileSync(t,e,r={}){throw new Error("writeFileSync not implemented")}},P=class{constructor(t={}){if(this.args=t.args||[],this.env=t.env||{},this.fs=t.fs||new v,!this.fs)throw new Error("File system implementation required");this.fds=new Map([[0,{type:"stdio"}],[1,{type:"stdio"}],[2,{type:"stdio"}],[3,{type:"directory",preopenPath:"/"}]]),this.nextFd=this.fds.size,this.textDecoder=new TextDecoder,this.textEncoder=new TextEncoder,this.args_get=this.args_get.bind(this),this.args_sizes_get=this.args_sizes_get.bind(this),this.environ_get=this.environ_get.bind(this),this.environ_sizes_get=this.environ_sizes_get.bind(this),this.clock_res_get=this.clock_res_get.bind(this),this.clock_time_get=this.clock_time_get.bind(this),this.fd_close=this.fd_close.bind(this),this.fd_seek=this.fd_seek.bind(this),this.fd_write=this.fd_write.bind(this),this.fd_read=this.fd_read.bind(this),this.fd_fdstat_get=this.fd_fdstat_get.bind(this),this.fd_fdstat_set_flags=this.fd_fdstat_set_flags.bind(this),this.fd_prestat_get=this.fd_prestat_get.bind(this),this.fd_prestat_dir_name=this.fd_prestat_dir_name.bind(this),this.path_open=this.path_open.bind(this),this.path_filestat_get=this.path_filestat_get.bind(this),this.proc_exit=this.proc_exit.bind(this),this.fd_advise=this.fd_advise.bind(this),this.fd_allocate=this.fd_allocate.bind(this),this.fd_datasync=this.fd_datasync.bind(this),this.fd_filestat_get=this.fd_filestat_get.bind(this),this.fd_filestat_set_size=this.fd_filestat_set_size.bind(this),this.fd_filestat_set_times=this.fd_filestat_set_times.bind(this),this.fd_pread=this.fd_pread.bind(this),this.fd_pwrite=this.fd_pwrite.bind(this),this.fd_readdir=this.fd_readdir.bind(this),this.fd_renumber=this.fd_renumber.bind(this),this.fd_sync=this.fd_sync.bind(this),this.fd_tell=this.fd_tell.bind(this),this.path_create_directory=this.path_create_directory.bind(this),this.path_filestat_set_times=this.path_filestat_set_times.bind(this),this.path_link=this.path_link.bind(this),this.path_readlink=this.path_readlink.bind(this),this.path_remove_directory=this.path_remove_directory.bind(this),this.path_rename=this.path_rename.bind(this),this.path_symlink=this.path_symlink.bind(this),this.path_unlink_file=this.path_unlink_file.bind(this),this.poll_oneoff=this.poll_oneoff.bind(this),this.sock_accept=this.sock_accept.bind(this),this.sock_recv=this.sock_recv.bind(this),this.sock_send=this.sock_send.bind(this),this.sock_shutdown=this.sock_shutdown.bind(this),this.random_get=this.random_get.bind(this),this.sched_yield=this.sched_yield.bind(this)}setup(t){this.wasm=t}start(t){this.setup(t);try{return t._start&&t._start(),0}catch(e){if(e instanceof S)return e.code;throw e}}stdin(){return new Uint8Array}stdout(t){let e=this.textDecoder.decode(t).replace(/\n$/g,"");e&&console.log(e)}stderr(t){let e=this.textDecoder.decode(t).replace(/\n$/g,"");e&&console.error(e)}args_get(t,e){let r=new DataView(this.wasm.memory.buffer),s=new Uint8Array(this.wasm.memory.buffer);for(let i of this.args){r.setUint32(t,e,!0),t+=4;let n=this.textEncoder.encode(i);s.set(n,e),s[e+n.length]=0,e+=n.length+1}return 0}args_sizes_get(t,e){let r=new DataView(this.wasm.memory.buffer);r.setUint32(t,this.args.length,!0);let s=this.args.reduce((i,n)=>i+n.length+1,0);return r.setUint32(e,s,!0),0}environ_get(t,e){let r=new DataView(this.wasm.memory.buffer),s=new Uint8Array(this.wasm.memory.buffer);for(let[i,n]of Object.entries(this.env)){r.setUint32(t,e,!0),t+=4;let f=`${i}=${n}\0`,d=this.textEncoder.encode(f);s.set(d,e),e+=d.length}return 0}environ_sizes_get(t,e){let r=new DataView(this.wasm.memory.buffer),s=Object.keys(this.env).length;r.setUint32(t,s,!0);let i=Object.entries(this.env).reduce((n,[f,d])=>n+f.length+d.length+2,0);return r.setUint32(e,i,!0),0}clock_res_get(t,e){let r=new DataView(this.wasm.memory.buffer),s;switch(t){case 0:s=1000000n;break;case 1:s=1000n;break;default:return 28}return r.setBigUint64(e,s,!0),0}clock_time_get(t,e,r){let s=new DataView(this.wasm.memory.buffer),i;switch(t){case 0:{let n=Date.now();i=BigInt(n)*1000000n;break}case 1:{i=BigInt(Math.round(performance.now()*1e6));break}default:return 28}return s.setBigUint64(r,i,!0),0}fd_close(t){return this.fds.get(t)?(this.fds.delete(t),0):8}fd_seek(t,e,r,s){let i=this.fds.get(t);if(!i)return 8;if(i.type==="stdio")return 70;var n=null;let f=0,d=Number(e);try{n=this.fs.statSync(i.handle.path)}catch{return 29}switch(r){case 0:f=d;break;case 1:f=Number(i.handle.position)+d;break;case 2:f=Number(n.size)+d;break;default:return console.error("fd_seek invalid mode",r),28}return i.handle.position=f,new DataView(this.wasm.memory.buffer).setBigUint64(s,BigInt(f),!0),0}fd_write(t,e,r,s){let i=0,n=[],f=new DataView(this.wasm.memory.buffer),d=new Uint8Array(this.wasm.memory.buffer);for(let a=0;a<r;a++){let h=e+a*8,o=f.getUint32(h,!0),c=f.getUint32(h+4,!0);n.push(new Uint8Array(d.buffer,o,c)),i+=c}let l;if(n.length===1)l=n[0];else{l=new Uint8Array(i);let a=0;for(let h of n)l.set(h,a),a+=h.length}if(t===1)this.stdout(l);else if(t===2)this.stderr(l);else{let a=this.fds.get(t);if(!a)return 8;a.handle.position+=i;try{this.fs.writeFileSync(a.handle.path,l)}catch{return 29}}return f.setUint32(s,i,!0),0}fd_read(t,e,r,s){let i=this.fds.get(t);if(!i)return 8;let n=0,f=new DataView(this.wasm.memory.buffer),d=new Uint8Array(this.wasm.memory.buffer);try{let l;t===0?l=this.stdin():l=this.fs.readFileSync(i.handle.path);for(let a=0;a<r;a++){let h=e+a*8,o=f.getUint32(h,!0),c=f.getUint32(h+4,!0),m=i.handle.position,y=Math.min(m+c,l.length),p=y-m;if(p<=0||(d.set(new Uint8Array(l.slice(m,y)),o),n+=p,i.handle.position+=p,p<c))break}return f.setUint32(s,n,!0),0}catch{return 29}}path_open(t,e,r,s,i,n,f,d,l){var a=this.fds.get(t);if(!a)return 8;let h=new Uint8Array(this.wasm.memory.buffer).slice(r,r+s),o=this.textDecoder.decode(h),c=o;var m=0;let y=new DataView(this.wasm.memory.buffer);a.preopenPath&&(o.startsWith("/")&&(c=o.slice(1)),c=a.preopenPath+(a.preopenPath.endsWith("/")?"":"/")+c);var p=!1,u=null;let _=(i&1)==1,T=(i&2)==2,b=(i&4)==4,U=(i&8)==8;try{u=this.fs.statSync(c),p=!0}catch{}if((b||U)&&b&&p)return y.setUint32(l,m,!0),20;let D={path:c,position:0},B="file";m=this.nextFd++;let x={type:B,handle:D,fd:m};return this.fds.set(m,x),a=this.fds.get(m),a.handle.position=0,U&&(a.handle.size=0),y.setUint32(l,m,!0),0}proc_exit(t){throw new S(t)}fd_fdstat_get(t,e){let r=this.fds.get(t);if(!r)return 8;let s=new DataView(this.wasm.memory.buffer),i;switch(r.type){case"stdio":i=2;break;case"directory":i=3;break;case"file":i=4;break;default:i=0}s.setUint8(e,i);let n=0;r.append&&(n|=1),s.setUint16(e+2,n,!0);let f=0n;r.type==="file"?f=2097254:r.type==="directory"&&(f=100688384);let d=BigInt(f);return s.setBigUint64(e+8,d,!0),s.setBigUint64(e+16,d,!0),0}fd_fdstat_set_flags(t,e){let r=this.fds.get(t);if(!r)return 8;if(e&~31)return 28;if(r.type==="stdio")return 58;try{return r.append=!!(e&1),r.handle&&typeof this.fs.setFlagsSync=="function"&&this.fs.setFlagsSync(r.handle,e),0}catch{return 29}}fd_prestat_get(t,e){let r=this.fds.get(t);if(!r||r.type!=="directory"||!r.preopenPath)return 8;let s=new DataView(this.wasm.memory.buffer);s.setUint8(e,0);let i=r.preopenPath.length;return s.setUint32(e+4,i,!0),0}fd_prestat_dir_name(t,e,r){let s=this.fds.get(t);if(!s||s.type!=="directory"||!s.preopenPath)return 8;if(r<s.preopenPath.length)return 37;let i=new Uint8Array(this.wasm.memory.buffer),n=this.textEncoder.encode(s.preopenPath);return i.set(n,e),0}path_filestat_get(t,e,r,s,i){let n=this.fds.get(t);if(!n)return 8;let f=new Uint8Array(this.wasm.memory.buffer),d=new Uint8Array(f.buffer,r,s),l=this.textDecoder.decode(d);try{let a=l;n.preopenPath&&(l.startsWith("/")&&(a=l.slice(1)),a=n.preopenPath+(n.preopenPath.endsWith("/")?"":"/")+a);let h=this.fs.statSync(a,{followSymlinks:(e&void 0)!==0}),o=new DataView(this.wasm.memory.buffer);o.setBigUint64(i,BigInt(h.dev||0),!0),o.setBigUint64(i+8,BigInt(h.ino||0),!0);let c=0;return h.isFile()?c=4:h.isDirectory()?c=3:h.isSymbolicLink()?c=7:h.isCharacterDevice()?c=2:h.isBlockDevice()?c=1:h.isFIFO()&&(c=6),o.setUint8(i+16,c),o.setBigUint64(i+24,BigInt(h.nlink||1),!0),o.setBigUint64(i+32,BigInt(h.size||0),!0),o.setBigUint64(i+40,BigInt(h.atimeMs*1e6),!0),o.setBigUint64(i+48,BigInt(h.mtimeMs*1e6),!0),o.setBigUint64(i+56,BigInt(h.ctimeMs*1e6),!0),0}catch(a){return a.code==="ENOENT"?44:a.code==="EACCES"?2:29}}fd_advise(t,e,r,s){let i=this.fds.get(t);return i?i.type!=="file"?8:0:8}fd_allocate(t,e,r){let s=this.fds.get(t);if(!s||s.type!=="file")return 8;try{let i=this.fs.statSync(s.handle.path),n=Number(e)+Number(r);if(n>i.size){let f=new Uint8Array(n-i.size);this.fs.appendFileSync(s.handle.path,f)}return 0}catch{return 29}}fd_datasync(t){let e=this.fds.get(t);if(!e||e.type!=="file")return 8;try{return typeof this.fs.fsyncSync=="function"&&this.fs.fsyncSync(e.handle.path),0}catch{return 29}}fd_filestat_get(t,e){let r=this.fds.get(t);if(!r||!r.handle)return 8;let s=new DataView(this.wasm.memory.buffer),i=this.fs.statSync(r.handle.path);return s.setBigUint64(e,BigInt(i.dev),!0),s.setBigUint64(e+8,BigInt(i.ino),!0),s.setUint8(e+16,i.filetype),s.setBigUint64(e+24,BigInt(i.nlink),!0),s.setBigUint64(e+32,BigInt(i.size),!0),s.setBigUint64(e+38,BigInt(i.atime),!0),s.setBigUint64(e+46,BigInt(i.mtime),!0),s.setBigUint64(e+52,BigInt(i.ctime),!0),0}fd_filestat_set_size(t,e){let r=this.fds.get(t);if(!r||r.type!=="file")return 8;try{return this.fs.truncateSync(r.handle.path,Number(e)),0}catch{return 29}}fd_filestat_set_times(t,e,r,s){let i=this.fds.get(t);if(!i||i.type!=="file")return 8;try{let n={atime:Number(e)/1e9,mtime:Number(r)/1e9};return this.fs.utimesSync(i.handle.path,n.atime,n.mtime),0}catch{return 29}}fd_pread(t,e,r,s,i){let n=this.fds.get(t);if(!n||n.type!=="file")return 8;try{let f=this.fs.readFileSync(n.handle.path),d=0,l=new DataView(this.wasm.memory.buffer),a=new Uint8Array(this.wasm.memory.buffer),h=Number(s);for(let o=0;o<r;o++){let c=e+o*8,m=l.getUint32(c,!0),y=l.getUint32(c+4,!0),p=h+d,u=Math.min(p+y,f.length),_=u-p;if(_<=0||(a.set(new Uint8Array(f.slice(p,u)),m),d+=_,_<y))break}return l.setUint32(i,d,!0),0}catch{return 29}}fd_pwrite(t,e,r,s,i){let n=this.fds.get(t);if(!n||n.type!=="file")return 8;try{let f=0,d=[],l=new DataView(this.wasm.memory.buffer),a=new Uint8Array(this.wasm.memory.buffer);for(let m=0;m<r;m++){let y=e+m*8,p=l.getUint32(y,!0),u=l.getUint32(y+4,!0);d.push(new Uint8Array(a.buffer,p,u)),f+=u}let h;if(d.length===1)h=d[0];else{h=new Uint8Array(f);let m=0;for(let y of d)h.set(y,m),m+=y.length}let o=this.fs.readFileSync(n.handle.path),c=new Uint8Array(Math.max(Number(s)+h.length,o.length));return c.set(o),c.set(h,Number(s)),this.fs.writeFileSync(n.handle.path,c),l.setUint32(i,f,!0),0}catch{return 29}}fd_readdir(t,e,r,s,i){let n=this.fds.get(t);if(!n)return 8;if(n.type!=="directory")return 54;try{let f=this.fs.readdirSync(n.handle.path,{withFileTypes:!0}),d=new DataView(this.wasm.memory.buffer),l=new Uint8Array(this.wasm.memory.buffer),a=0,h=0,o=Number(s);for(let c=o;c<f.length;c++){let m=f[c],y=m.name,p=this.textEncoder.encode(y),u=24+p.length;if(a+u>r)break;d.setBigUint64(e+a,BigInt(c+1),!0),d.setBigUint64(e+a+8,0n,!0),d.setUint32(e+a+16,p.length,!0);let _=0;m.isFile()?_=4:m.isDirectory()&&(_=3),d.setUint8(e+a+20,_),l.set(p,e+a+24),a+=u,h++}return d.setUint32(i,a,!0),0}catch{return 29}}fd_renumber(t,e){let r=this.fds.get(t);return r?(this.fds.delete(e),this.fds.set(e,r),this.fds.delete(t),0):8}fd_sync(t){let e=this.fds.get(t);if(!e||e.type!=="file")return 8;try{return typeof this.fs.fsyncSync=="function"&&this.fs.fsyncSync(e.handle.path),0}catch{return 29}}fd_tell(t,e){let r=this.fds.get(t);return r?r.type!=="file"?8:(new DataView(this.wasm.memory.buffer).setBigUint64(e,BigInt(r.handle.position),!0),0):8}path_create_directory(t,e,r){let s=this.fds.get(t);if(!s)return 8;let i=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,e,r));try{let n=i;return s.preopenPath&&(i.startsWith("/")&&(n=i.slice(1)),n=s.preopenPath+"/"+n),this.fs.mkdirSync(n),0}catch{return 29}}path_filestat_set_times(t,e,r,s,i,n,f){let d=this.fds.get(t);if(!d)return 8;let l=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,r,s));try{let a=l;d.preopenPath&&(l.startsWith("/")&&(a=l.slice(1)),a=d.preopenPath+"/"+a);let h={atime:Number(i)/1e9,mtime:Number(n)/1e9};return this.fs.utimesSync(a,h.atime,h.mtime),0}catch{return 29}}path_link(t,e,r,s,i,n,f){let d=this.fds.get(t),l=this.fds.get(i);if(!d||!l)return 8;let a=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,r,s)),h=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,n,f));try{let o=a,c=h;return d.preopenPath&&(a.startsWith("/")&&(o=a.slice(1)),o=d.preopenPath+"/"+o),l.preopenPath&&(h.startsWith("/")&&(c=h.slice(1)),c=l.preopenPath+"/"+c),this.fs.linkSync(o,c),0}catch{return 29}}path_readlink(t,e,r,s,i,n){let f=this.fds.get(t);if(!f)return 8;let d=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,e,r));try{let l=d;f.preopenPath&&(d.startsWith("/")&&(l=d.slice(1)),l=f.preopenPath+"/"+l);let a=this.fs.readlinkSync(l),h=this.textEncoder.encode(a);return h.length>i?61:(new Uint8Array(this.wasm.memory.buffer).set(h,s),new DataView(this.wasm.memory.buffer).setUint32(n,h.length,!0),0)}catch{return 29}}path_remove_directory(t,e,r){let s=this.fds.get(t);if(!s)return 8;let i=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,e,r));try{let n=i;return s.preopenPath&&(i.startsWith("/")&&(n=i.slice(1)),n=s.preopenPath+"/"+n),this.fs.rmdirSync(n),0}catch{return 29}}path_rename(t,e,r,s,i,n){let f=this.fds.get(t),d=this.fds.get(s);if(!f||!d)return 8;let l=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,e,r)),a=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,i,n));try{let h=l,o=a;return f.preopenPath&&(l.startsWith("/")&&(h=l.slice(1)),h=f.preopenPath+"/"+h),d.preopenPath&&(a.startsWith("/")&&(o=a.slice(1)),o=d.preopenPath+"/"+o),this.fs.renameSync(h,o),0}catch{return 29}}path_symlink(t,e,r,s,i){let n=this.fds.get(r);if(!n)return 8;let f=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,t,e)),d=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,s,i));try{let l=d;return n.preopenPath&&(d.startsWith("/")&&(l=d.slice(1)),l=n.preopenPath+"/"+l),this.fs.symlinkSync(f,l),0}catch{return 29}}path_unlink_file(t,e,r){let s=this.fds.get(t);if(!s)return 8;let i=this.textDecoder.decode(new Uint8Array(this.wasm.memory.buffer,e,r));try{let n=i;return s.preopenPath&&(i.startsWith("/")&&(n=i.slice(1)),n=s.preopenPath+"/"+n),this.fs.unlinkSync(n),0}catch{return 29}}poll_oneoff(t,e,r,s){let i=new DataView(this.wasm.memory.buffer),n=0;for(let f=0;f<r;f++){let d=t+f*48,l=i.getBigUint64(d,!0),a=i.getUint8(d+8),h=e+n*32;i.setBigUint64(h,l,!0),i.setUint8(h+8,a),i.setUint8(h+9,1),i.setUint16(h+10,0,!0),n++}return i.setUint32(s,n,!0),0}random_get(t,e){let r=new Uint8Array(this.wasm.memory.buffer,t,e);return crypto.getRandomValues(r),0}sched_yield(){return os.sched_yield(),0}sock_accept(t,e){return 52}sock_recv(t,e,r){return 52}sock_send(t,e,r){return 52}sock_shutdown(t,e){return 52}};console.log("easywasi");var F=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";function I(t,e){return{...t,...Object.fromEntries(["appendFileSync","fsyncSync","linkSync","setFlagsSync","mkdirSync","readdirSync","readFileSync","readlinkSync","renameSync","rmdirSync","statSync","symlinkSync","truncateSync","unlinkSync","utimesSync","writeFileSync"].map(r=>{let s=r.slice(0,r.length-4);return s in t?[r,(...i)=>(r==="writeFileSync"&&i[0]==="/tmp/out.sql"&&e.push(i[1]),t[s](...i))]:[r,()=>{throw new Error(`${s} not implemented.`)}]}).filter(r=>r!==void 0))}}async function V({pg:t,args:e}){let r=new URL("./pg_dump.wasm",import.meta.url),s=[],i=I(t.Module.FS,s),n=new P({fs:i,args:["pg_dump",...e],env:{PWD:"/"}});n.stdout=h=>{};let f=new TextDecoder,d="";n.stderr=h=>{let o=f.decode(h);o&&(d+=o)},n.sched_yield=()=>{let h="/tmp/pglite/base/.s.PGSQL.5432.in",o="/tmp/pglite/base/.s.PGSQL.5432.out";if(i.analyzePath(h).exists){let c=i.readFileSync(h);if(i.unlinkSync(h),c[0]===0){let y=new Uint8Array([...W,...M,...N]);return i.writeFileSync(o,y),0}let m=t.execProtocolRawSync(c);i.writeFileSync(o,m)}return 0},await i.writeFile("/pg_dump","\0",{mode:18});let l;if(F){let h=await(await import("fs/promises")).readFile(r.toString().slice(7));l=await WebAssembly.instantiate(h,{wasi_snapshot_preview1:n})}else l=await WebAssembly.instantiateStreaming(fetch(r),{wasi_snapshot_preview1:n});let a;return await t.runExclusive(async()=>{a=n.start(l.instance.exports)}),[a,s,d]}async function z({pg:t,args:e,fileName:r="dump.sql"}){let s=(await t.query("SHOW SEARCH_PATH;")).rows[0].search_path,i="/tmp/out.sql",n=["-U","postgres","--inserts","-j","1","-f",i,"postgres"],[f,d,l]=await V({pg:t,args:[...e??[],...n]});if(t.exec(`DEALLOCATE ALL; SET SEARCH_PATH = ${s}`),f!==0)throw new Error(`pg_dump failed with exit code ${f}.
3
- Error message: ${l}`);let a=new File(d,r,{type:"text/plain"});return t.Module.FS.unlink(i),a}function w(t){return t.charCodeAt(0)}function g(t){let e=new ArrayBuffer(4);return new DataView(e).setInt32(0,t,!1),new Uint8Array(e)}function k(t){let e=new TextEncoder().encode(t);return new Uint8Array([...e,0])}var W=new Uint8Array([w("R"),...g(8),...g(0)]),N=new Uint8Array([w("Z"),...g(5),w("I")]),A=k("server_version"),E=k("16.3 (PGlite 0.2.0)"),O=4+A.length+E.length,M=new Uint8Array([w("S"),...g(O),...A,...E]);export{z as pgDump};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import"./chunk-J2EYU3K5.js";import i from"constants";var n=Object.keys(i).filter(t=>t.startsWith("SIG")&&t!=="SIGPROF"&&t!=="SIGKILL");var f=t=>{let r=new Map;for(let s of n){let o=()=>{try{t.kill(s)}catch{}};try{process.on(s,o),r.set(s,o)}catch{}}let e=()=>{for(let[s,o]of r)process.removeListener(s,o)};return t.on("exit",e),e};export{f as proxySignals};
@@ -1,9 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as i,b as g}from"./chunk-6CY7FTXB.js";import{a as c,b as p,e as r}from"./chunk-WAQNVDRS.js";import{d as e,g as l,h as f,i as n,l as d}from"./chunk-IUA2KLPR.js";import{B as s}from"./chunk-C743SY2X.js";import"./chunk-J2EYU3K5.js";var y={...d,force:{default:!1,description:"Stops any running servers before removing them. Default is `false`, which would fail the command if any server is running.",required:!1,type:"boolean"},name:{description:"Name(s)/pattern(s) of the server(s) to remove",required:!0,type:"positional",valueHint:"glob"}},S={description:"Remove servers",name:"rm"},E={args:y,meta:S,run:async a=>{let{debug:m,force:v,name:u}=a.args,C=u.split(","),o=await l.scan({debug:m,globs:C});if(o.length===0)return e.log(`\u26A0\uFE0F No ${r} servers found to remove.
3
- `);if(!v&&o.some(n)){e.log(`\u{1F6AB} Some ${r} servers are currently running:
4
-
5
- ${i(o.filter(n))}
6
-
7
- Use the ${p("--force")} flag to stop and remove them.`),s.exitCode||=1;return}if(e.log(`\u{1F5D1}\uFE0F Removing the following ${r} servers:
8
-
9
- ${i(o)}`),!await g({confirmationText:"i will lose local data",debug:a.args.debug}))return;(await Promise.allSettled(o.map(async t=>{await f(t,m),e.log(`\u{1F9F9} Removed ${r} server ${c(t.name)}.`)}))).some(t=>t.status==="rejected")&&(e.error(`Potentially failed to remove some ${r} servers.`),s.exitCode||=1),e.log("")}};export{E as RemoveCommand};
@@ -1,5 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as l,b as f}from"./chunk-6CY7FTXB.js";import{a as p,e as o}from"./chunk-WAQNVDRS.js";import{d as e,g as i,i as n,j as a,l as m}from"./chunk-IUA2KLPR.js";import"./chunk-C743SY2X.js";import"./chunk-J2EYU3K5.js";var S={...m,name:{description:"Name(s)/pattern(s) of the server(s) to stop",required:!0,type:"positional",valueHint:"glob"}},u={description:"Stop servers",name:"stop"},h={args:S,meta:u,run:async c=>{let{debug:t,name:d}=c.args,g=d.split(","),s=(await i.scan({debug:t,globs:g})).filter(n);if(s.length===0)return e.log(`\u26A0\uFE0F No ${o} servers found to stop.
3
- `);if(e.log(`\u26B0\uFE0F Stopping the following ${o} servers:
4
-
5
- ${l(s)}`),!await f({confirmationText:"i will interrupt sessions",debug:t}))return;(await Promise.allSettled(s.map(async r=>{await a(r,t),e.log(`\u{1F480} Stopped ${o} server ${p(r.name)}.`)}))).some(r=>r.status==="rejected")&&(e.error(`Potentially failed to stop some ${o} servers.`),process.exitCode||=1),e.log("")}};export{h as StopCommand};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a}from"./chunk-MKAOBCJL.js";import"./chunk-VMZVNK7U.js";import"./chunk-J2EYU3K5.js";export{a as Hono};
@@ -1,2 +0,0 @@
1
- import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{a as _}from"./chunk-MKAOBCJL.js";import"./chunk-VMZVNK7U.js";import"./chunk-J2EYU3K5.js";var P=202,i=502,L=400,p=409,t=100,a=201,M=417;var v=403,x=504,F=410,l=505,S=418,c=419,H=507,G=500,Q=411,Y=423,m=420,h=405,g=301,f=302,C=207,y=300,B=511,V=204,q=203,W=406,b=404,w=501,K=304,X=200,j=206,k=402,Z=308,z=412,J=428,$=102,d=407,u=431,s=408,EE=413,TE=414,RE=416,eE=205,rE=303,OE=503,_E=101,NE=307,IE=429,AE=401,UE=422,oE=415,nE=305,N={ACCEPTED:P,BAD_GATEWAY:i,BAD_REQUEST:L,CONFLICT:p,CONTINUE:t,CREATED:a,EXPECTATION_FAILED:M,FORBIDDEN:v,GATEWAY_TIMEOUT:x,GONE:F,HTTP_VERSION_NOT_SUPPORTED:l,IM_A_TEAPOT:S,INSUFFICIENT_SPACE_ON_RESOURCE:c,INSUFFICIENT_STORAGE:H,INTERNAL_SERVER_ERROR:G,LENGTH_REQUIRED:Q,LOCKED:Y,METHOD_FAILURE:m,METHOD_NOT_ALLOWED:h,MOVED_PERMANENTLY:g,MOVED_TEMPORARILY:f,MULTI_STATUS:C,MULTIPLE_CHOICES:y,NETWORK_AUTHENTICATION_REQUIRED:B,NO_CONTENT:V,NON_AUTHORITATIVE_INFORMATION:q,NOT_ACCEPTABLE:W,NOT_FOUND:b,NOT_IMPLEMENTED:w,NOT_MODIFIED:K,OK:X,PARTIAL_CONTENT:j,PAYMENT_REQUIRED:k,PERMANENT_REDIRECT:Z,PRECONDITION_FAILED:z,PRECONDITION_REQUIRED:J,PROCESSING:$,PROXY_AUTHENTICATION_REQUIRED:d,REQUEST_HEADER_FIELDS_TOO_LARGE:u,REQUEST_TIMEOUT:s,REQUEST_TOO_LONG:EE,REQUEST_URI_TOO_LONG:TE,REQUESTED_RANGE_NOT_SATISFIABLE:RE,RESET_CONTENT:eE,SEE_OTHER:rE,SERVICE_UNAVAILABLE:OE,SWITCHING_PROTOCOLS:_E,TEMPORARY_REDIRECT:NE,TOO_MANY_REQUESTS:IE,UNAUTHORIZED:AE,UNPROCESSABLE_ENTITY:UE,UNSUPPORTED_MEDIA_TYPE:oE,USE_PROXY:nE};var I={202:"Accepted",502:"Bad Gateway",400:"Bad Request",409:"Conflict",100:"Continue",201:"Created",417:"Expectation Failed",424:"Failed Dependency",403:"Forbidden",504:"Gateway Timeout",410:"Gone",505:"HTTP Version Not Supported",418:"I'm a teapot",419:"Insufficient Space on Resource",507:"Insufficient Storage",500:"Internal Server Error",411:"Length Required",423:"Locked",420:"Method Failure",405:"Method Not Allowed",301:"Moved Permanently",302:"Moved Temporarily",207:"Multi-Status",300:"Multiple Choices",511:"Network Authentication Required",204:"No Content",203:"Non Authoritative Information",406:"Not Acceptable",404:"Not Found",501:"Not Implemented",304:"Not Modified",200:"OK",206:"Partial Content",402:"Payment Required",308:"Permanent Redirect",412:"Precondition Failed",428:"Precondition Required",102:"Processing",103:"Early Hints",426:"Upgrade Required",407:"Proxy Authentication Required",431:"Request Header Fields Too Large",408:"Request Timeout",413:"Request Entity Too Large",414:"Request-URI Too Long",416:"Requested Range Not Satisfiable",205:"Reset Content",303:"See Other",503:"Service Unavailable",101:"Switching Protocols",307:"Temporary Redirect",429:"Too Many Requests",401:"Unauthorized",451:"Unavailable For Legal Reasons",422:"Unprocessable Entity",415:"Unsupported Media Type",305:"Use Proxy",421:"Misdirected Request"},A={Accepted:202,"Bad Gateway":502,"Bad Request":400,Conflict:409,Continue:100,Created:201,"Expectation Failed":417,"Failed Dependency":424,Forbidden:403,"Gateway Timeout":504,Gone:410,"HTTP Version Not Supported":505,"I'm a teapot":418,"Insufficient Space on Resource":419,"Insufficient Storage":507,"Internal Server Error":500,"Length Required":411,Locked:423,"Method Failure":420,"Method Not Allowed":405,"Moved Permanently":301,"Moved Temporarily":302,"Multi-Status":207,"Multiple Choices":300,"Network Authentication Required":511,"No Content":204,"Non Authoritative Information":203,"Not Acceptable":406,"Not Found":404,"Not Implemented":501,"Not Modified":304,OK:200,"Partial Content":206,"Payment Required":402,"Permanent Redirect":308,"Precondition Failed":412,"Precondition Required":428,Processing:102,"Early Hints":103,"Upgrade Required":426,"Proxy Authentication Required":407,"Request Header Fields Too Large":431,"Request Timeout":408,"Request Entity Too Large":413,"Request-URI Too Long":414,"Requested Range Not Satisfiable":416,"Reset Content":205,"See Other":303,"Service Unavailable":503,"Switching Protocols":101,"Temporary Redirect":307,"Too Many Requests":429,Unauthorized:401,"Unavailable For Legal Reasons":451,"Unprocessable Entity":422,"Unsupported Media Type":415,"Use Proxy":305,"Misdirected Request":421};function DE(E){var T=I[E.toString()];if(!T)throw new Error("Status code does not exist: "+E);return T}function U(E){var T=A[E];if(!T)throw new Error("Reason phrase does not exist: "+E);return T}var o=DE;var e;(function(E){E[E.CONTINUE=100]="CONTINUE",E[E.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",E[E.PROCESSING=102]="PROCESSING",E[E.EARLY_HINTS=103]="EARLY_HINTS",E[E.OK=200]="OK",E[E.CREATED=201]="CREATED",E[E.ACCEPTED=202]="ACCEPTED",E[E.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",E[E.NO_CONTENT=204]="NO_CONTENT",E[E.RESET_CONTENT=205]="RESET_CONTENT",E[E.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",E[E.MULTI_STATUS=207]="MULTI_STATUS",E[E.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",E[E.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",E[E.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",E[E.SEE_OTHER=303]="SEE_OTHER",E[E.NOT_MODIFIED=304]="NOT_MODIFIED",E[E.USE_PROXY=305]="USE_PROXY",E[E.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",E[E.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",E[E.BAD_REQUEST=400]="BAD_REQUEST",E[E.UNAUTHORIZED=401]="UNAUTHORIZED",E[E.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",E[E.FORBIDDEN=403]="FORBIDDEN",E[E.NOT_FOUND=404]="NOT_FOUND",E[E.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",E[E.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",E[E.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",E[E.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",E[E.CONFLICT=409]="CONFLICT",E[E.GONE=410]="GONE",E[E.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",E[E.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",E[E.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",E[E.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",E[E.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",E[E.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",E[E.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",E[E.IM_A_TEAPOT=418]="IM_A_TEAPOT",E[E.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",E[E.METHOD_FAILURE=420]="METHOD_FAILURE",E[E.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",E[E.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",E[E.LOCKED=423]="LOCKED",E[E.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",E[E.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",E[E.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",E[E.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",E[E.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",E[E.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",E[E.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",E[E.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",E[E.BAD_GATEWAY=502]="BAD_GATEWAY",E[E.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",E[E.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",E[E.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",E[E.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",E[E.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(e||(e={}));var r=function(){return r=Object.assign||function(E){for(var T,R=1,D=arguments.length;R<D;R++){T=arguments[R];for(var O in T)Object.prototype.hasOwnProperty.call(T,O)&&(E[O]=T[O])}return E},r.apply(this,arguments)},vE=r(r({},N),{getStatusCode:U,getStatusText:o});var n=new _;n.post("/database/dump",async E=>{let T=E.get("db"),R=E.get("serverState");return await T.dump(R.databaseDumpPath),E.json({dumpPath:R.databaseDumpPath},e.CREATED)});var HE=n.get("/health",E=>E.json({name:E.get("serverState").name}));export{n as utilityRoute};