Comparing version 1.2.0-exp.17 to 1.2.0-exp.18
@@ -1,22 +0,25 @@ | ||
"use strict";var d=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var g=(e,t)=>{for(var r in t)d(e,r,{get:t[r],enumerable:!0})},b=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of m(t))!y.call(e,n)&&n!==r&&d(e,n,{get:()=>t[n],enumerable:!(s=h(t,n))||s.enumerable});return e};var p=e=>b(d({},"__esModule",{value:!0}),e);var x={};g(x,{ElysiaNodeContext:()=>a,NodeAdapter:()=>v,nodeRequestToWebstand:()=>l});module.exports=p(x);var i=require("node:http"),u=require("node:stream"),o=require("./handler"),f=require("../../utils");const a=Symbol("ElysiaNodeContext"),E=e=>e.headers.host?`http://${e.headers.host}${e.url}`:e.socket?.localPort?`http://localhost:${e.socket?.localPort}${e.url}`:`http://localhost${e.url}`,l=(e,t)=>{let r;return new Request(E(e),{method:e.method,headers:e.headers,get body(){return e.method==="GET"||e.method==="HEAD"?void 0:u.Readable.toWeb(e)},get signal(){if(r)return r;const s=t??new AbortController;return r=s.signal,e.once("close",()=>{s.abort()}),r}})},v={name:"node",handler:{mapResponse:o.mapResponse,mapEarlyResponse:o.mapEarlyResponse,mapCompactResponse:o.mapCompactResponse,createStaticHandler:(e,t,r)=>(0,o.mapResponse)(e,{status:200,headers:r??{}})},composeHandler:{declare(e){if(e.request)return`Object.defineProperty(c,'request',{get(){return nodeRequestToWebstand(c[ElysiaNodeContext].req)}}) | ||
"use strict";var d=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var m=(e,t)=>{for(var r in t)d(e,r,{get:t[r],enumerable:!0})},g=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of h(t))!b.call(e,n)&&n!==r&&d(e,n,{get:()=>t[n],enumerable:!(s=y(t,n))||s.enumerable});return e};var p=e=>g(d({},"__esModule",{value:!0}),e);var k={};m(k,{ElysiaNodeContext:()=>a,NodeAdapter:()=>x,nodeRequestToWebstand:()=>c});module.exports=p(k);var i=require("node:http"),u=require("node:stream"),o=require("./handler"),f=require("../../utils");const a=Symbol("ElysiaNodeContext"),E=e=>e.headers.host?`http://${e.headers.host}${e.url}`:e.socket?.localPort?`http://localhost:${e.socket?.localPort}${e.url}`:`http://localhost${e.url}`,c=(e,t)=>{let r;return new Request(E(e),{method:e.method,headers:e.headers,get body(){return e.method==="GET"||e.method==="HEAD"?void 0:u.Readable.toWeb(e)},get signal(){if(r)return r;const s=t??new AbortController;return r=s.signal,e.once("close",()=>{s.abort()}),r}})},x={name:"node",handler:{mapResponse:o.mapResponse,mapEarlyResponse:o.mapEarlyResponse,mapCompactResponse:o.mapCompactResponse,createStaticHandler:(e,t,r)=>(0,o.mapResponse)(e,{status:200,headers:r??{}})},composeHandler:{declare(e){if(e.request)return`Object.defineProperty(c,'request',{get(){return nodeRequestToWebstand(c[ElysiaNodeContext].req)}}) | ||
`},mapResponseContext:"c[ElysiaNodeContext].res",headers:`c.headers=c[ElysiaNodeContext].req.headers | ||
`,inject:{ElysiaNodeContext:a,nodeRequestToWebstand:l},parser:{declare:`const req=c[ElysiaNodeContext].req | ||
`,json(){let e=`c.body=await new Promise((resolve)=>{let body | ||
req.on('data',(chunk)=>{ if(body) { body = Buffer.concat([body, chunk]) } else body = chunk }) | ||
req.on('end',()=>{`;return e+=`if(!body?.length) return resolve() | ||
else resolve(JSON.parse(body))`,e+`})}) | ||
`},text(){let e=`c.body=await new Promise((resolve)=>{body='' | ||
req.on('data',(chunk)=>{body+=chunk.toString()}) | ||
req.on('end',()=>{`;return e+=`if(body.length===0) return resolve() | ||
else resolve(body)`,e+`})}) | ||
`},urlencoded(){let e=`c.body=await new Promise((resolve)=>{body='' | ||
req.on('data',(chunk)=>{body+=chunk.toString()}) | ||
req.on('end',()=>{`;return e+=`if(body.length===0) return resolve() | ||
else resolve(parseQuery(body))`,e+`})}) | ||
`,inject:{ElysiaNodeContext:a,nodeRequestToWebstand:c},parser:{declare:`const req=c[ElysiaNodeContext].req | ||
`,json(){let e=`c.body=await new Promise((re)=>{let body | ||
req.on('data',(chunk)=>{if(body) body=Buffer.concat([body,chunk]) | ||
else body=chunk}) | ||
req.on('end',()=>{`;return e+=`if(!body || !body.length)return re() | ||
else re(JSON.parse(body))`,e+`})}) | ||
`},text(){let e=`c.body=await new Promise((re)=>{let body | ||
req.on('data',(chunk)=>{if(body) body=Buffer.concat([body,chunk]) | ||
else body=chunk}) | ||
req.on('end',()=>{`;return e+=`if(!body || !body.length)return re() | ||
else re(body)`,e+`})}) | ||
`},urlencoded(){let e=`c.body=await new Promise((re)=>{let body | ||
req.on('data',(chunk)=>{if(body) body=Buffer.concat([body,chunk]) | ||
else body=chunk}) | ||
req.on('end',()=>{`;return e+=`if(!body || !body.length)return re() | ||
else re(parseQuery(body))`,e+`})}) | ||
`},arrayBuffer(){return` | ||
`},formData(){return` | ||
`}}},composeGeneralHandler:{parameters:"r,res",inject:{nodeRequestToWebstand:l,ElysiaNodeContext:a},createContext:e=>{let t="",r=`const qi=r.url.indexOf('?') | ||
`}}},composeGeneralHandler:{parameters:"r,res",inject:{nodeRequestToWebstand:c,ElysiaNodeContext:a},createContext:e=>{let t="",r=`const qi=r.url.indexOf('?') | ||
let p=r.url | ||
if(qi!==-1)p=r.url.substring(0,qi) | ||
`;const s=e.setHeaders;for(const c of Object.keys(e.singleton.decorator))t+=`,${c}: app.singleton.decorator.${c}`;const n=e.event.trace.length>0;return n&&(r+=`const id=randomId() | ||
`;const s=e.setHeaders;for(const l of Object.keys(e.singleton.decorator))t+=`,${l}: app.singleton.decorator.${l}`;const n=e.event.trace.length>0;return n&&(r+=`const id=randomId() | ||
`),r+=`let _request | ||
@@ -23,0 +26,0 @@ const c={`,e.inference.request&&(r+=`get request(){if(_request)return _request |
{ | ||
"name": "elysia", | ||
"description": "Ergonomic Framework for Human", | ||
"version": "1.2.0-exp.17", | ||
"version": "1.2.0-exp.18", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "saltyAom", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1415105
11831