@moonpay/cli 1.93.1 → 1.94.0
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/README.md +1 -1
- package/dist/chunk-ASX4QOOO.js +59 -0
- package/dist/{chunk-HEJI3KC5.js → chunk-IMO5DCSV.js} +1 -1
- package/dist/{chunk-JYEDCTBB.js → chunk-KRQCV4TX.js} +2 -2
- package/dist/{chunk-XCYYHA62.js → chunk-PBYMECGX.js} +1 -1
- package/dist/{chunk-5ZGKR6EP.js → chunk-TUVJJ2VS.js} +1 -1
- package/dist/{client-DJSULCSX.js → client-3K4S6DSS.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/{ledger-OH36GMYI.js → ledger-NFPL5TMX.js} +2 -2
- package/dist/{mcp-ADDZF3OB.js → mcp-WQS6JJEH.js} +1 -1
- package/dist/serve-P73BC6CG.js +6 -0
- package/dist/{store-XHPF3QL2.js → store-EPDZQ6PU.js} +1 -1
- package/package.json +1 -1
- package/skills/moonpay-block-explorer/SKILL.md +1 -1
- package/skills/moonpay-buy-crypto/SKILL.md +30 -10
- package/skills/moonpay-fund-polymarket/SKILL.md +1 -1
- package/skills/moonpay-missions/SKILL.md +1 -1
- package/dist/chunk-TD26ORN4.js +0 -59
- package/dist/serve-OW6YKTV2.js +0 -5
package/dist/serve-OW6YKTV2.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import{b as S,c as g,d as v}from"./chunk-5ZGKR6EP.js";import"./chunk-TD26ORN4.js";import"./chunk-XCYYHA62.js";import"./chunk-JYEDCTBB.js";import{e as d,g as b,h,p as T}from"./chunk-HEJI3KC5.js";import"./chunk-LMDE72OE.js";b();import{createServer as y}from"http";import{writeFileSync as E,unlinkSync as O,readFileSync as k,existsSync as M}from"fs";import{join as P}from"path";import{homedir as R}from"os";T();var m="127.0.0.1",A=8787,f=P(R(),".config","moonpay","serve.json");function x(o){h(),E(f,JSON.stringify(o,null,2)+`
|
|
3
|
-
`,{encoding:"utf-8",mode:384})}function I(){try{M(f)&&O(f)}catch{}}function D(){try{return JSON.parse(k(f,"utf-8"))}catch{return null}}async function N(o){let t=[];for await(let s of o)t.push(typeof s=="string"?Buffer.from(s):s);if(t.length===0)return{};let r=Buffer.concat(t).toString("utf-8").trim();return r?JSON.parse(r):{}}function u(o,t,r){let s=JSON.stringify(r);o.writeHead(t,{"Content-Type":"application/json; charset=utf-8","Content-Length":Buffer.byteLength(s)}),o.end(s)}async function $(o,t,r=500){let s=new AbortController,p=setTimeout(()=>s.abort(),r);try{let c=await fetch(`http://${o}:${t}/health`,{signal:s.signal});if(!c.ok)return null;let a=await c.json();return a.ok?{pid:typeof a.pid=="number"?a.pid:-1,host:o,port:t,startedAt:typeof a.startedAt=="string"?a.startedAt:"",version:typeof a.version=="string"?a.version:""}:null}catch{return null}finally{clearTimeout(p)}}async function w(o,t,r){let s=o.headers.host??`${m}`,p=new URL(o.url||"/",`http://${s}`),c=(o.method||"GET").toUpperCase();if(c==="GET"&&p.pathname==="/health"){u(t,200,{ok:!0,version:d,pid:process.pid,startedAt:r});return}let a=p.pathname.match(/^\/api\/tools\/([a-z0-9_]+)$/i);if(c==="POST"&&a){let i=a[1];if(!S(i)){u(t,404,{error:`Unknown tool: ${i}`,tool:i});return}let n={};try{let e=await N(o);if(e&&typeof e=="object"&&!Array.isArray(e))n=e;else if(e!=null){u(t,400,{error:"Body must be a JSON object"});return}}catch{u(t,400,{error:"Invalid JSON body"});return}try{let e=await v(i,n);u(t,200,e);return}catch(e){if(e instanceof g){u(t,404,{error:e.message,tool:i});return}let l=e instanceof Error?e.message:String(e);u(t,500,{error:l,tool:i});return}}u(t,404,{error:"Not found",hint:"GET /health or POST /api/tools/:tool"})}async function F(o={}){let t=o.host??m,r=o.port??A,s=o.idempotent!==!1;if(t!=="127.0.0.1"&&t!=="localhost"&&t!=="::1")throw new Error(`mp serve refuses non-loopback host '${t}' \u2014 bind 127.0.0.1 only`);if(s){let n=await $(t,r);if(n)return process.stdout.write(JSON.stringify({ok:!0,alreadyRunning:!0,host:t,port:r,pid:n.pid,version:n.version},null,2)+`
|
|
4
|
-
`),{host:t,port:r}}let p=new Date().toISOString(),c=y((n,e)=>{w(n,e,p).catch(l=>{u(e,500,{error:l instanceof Error?l.message:String(l)})})});await new Promise((n,e)=>{c.once("error",e),c.listen(r,t,()=>n())});let a={pid:process.pid,host:t,port:r,startedAt:p,version:d};x(a);let i=()=>{I(),c.close(()=>process.exit(0))};return process.once("SIGINT",i),process.once("SIGTERM",i),process.stdout.write(JSON.stringify({ok:!0,alreadyRunning:!1,host:t,port:r,pid:process.pid,version:d,endpoints:{health:`http://${t}:${r}/health`,tools:`http://${t}:${r}/api/tools/:tool`}},null,2)+`
|
|
5
|
-
`),await new Promise(()=>{}),{host:t,port:r}}async function G(o={}){let t=o.host??m,r=o.port??0,s=new Date().toISOString(),p=y((i,n)=>{w(i,n,s).catch(e=>{u(n,500,{error:e instanceof Error?e.message:String(e)})})});await new Promise((i,n)=>{p.once("error",n),p.listen(r,t,()=>i())});let c=p.address(),a=c&&typeof c=="object"?c.port:r;return{host:t,port:a,close:()=>new Promise((i,n)=>{p.close(e=>e?n(e):i())})}}export{m as DEFAULT_SERVE_HOST,A as DEFAULT_SERVE_PORT,$ as probeServeHealth,D as readServeMeta,F as startServe,G as startServeForTests};
|