Comparing version 1.2.0-exp.19 to 1.2.0-exp.20
@@ -1,2 +0,2 @@ | ||
"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("http"),u=require("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)}}) | ||
"use strict";var d=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var m=(e,r)=>{for(var t in r)d(e,t,{get:r[t],enumerable:!0})},g=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of h(r))!b.call(e,n)&&n!==t&&d(e,n,{get:()=>r[n],enumerable:!(o=y(r,n))||o.enumerable});return e};var p=e=>g(d({},"__esModule",{value:!0}),e);var k={};m(k,{ElysiaNodeContext:()=>a,NodeAdapter:()=>E,nodeRequestToWebstand:()=>c});module.exports=p(k);var i=require("http"),u=require("stream"),s=require("./handler"),f=require("../../utils");const a=Symbol("ElysiaNodeContext"),x=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,r)=>{let t;return new Request(x(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(t)return t;const o=r??new AbortController;return t=o.signal,e.once("close",()=>{o.abort()}),t}})},E={name:"node",handler:{mapResponse:s.mapResponse,mapEarlyResponse:s.mapEarlyResponse,mapCompactResponse:s.mapCompactResponse,createStaticHandler:(e,r,t)=>(0,s.mapResponse)(e,{status:200,headers:t??{}})},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 | ||
@@ -21,22 +21,22 @@ `,inject:{ElysiaNodeContext:a,nodeRequestToWebstand:c},parser:{declare:`const req=c[ElysiaNodeContext].req | ||
`},formData(){return` | ||
`}}},composeGeneralHandler:{parameters:"r,res",inject:{nodeRequestToWebstand:c,ElysiaNodeContext:a},createContext:e=>{let t="",r=`const qi=r.url.indexOf('?') | ||
`}}},composeGeneralHandler:{parameters:"r,res",inject:{nodeRequestToWebstand:c,ElysiaNodeContext:a},createContext:e=>{let r="",t=`const qi=r.url.indexOf('?') | ||
let p=r.url | ||
if(qi!==-1)p=r.url.substring(0,qi) | ||
`;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 | ||
const c={`,e.inference.request&&(r+=`get request(){if(_request)return _request | ||
return _request = nodeRequestToWebstand(r)},`),r+="store,qi,path:p,url:r.url,redirect,error,",r+="[ElysiaNodeContext]:{req:r,res},",r+="set:{headers:",r+=Object.keys(s??{}).length?"Object.assign({}, app.setHeaders)":"{}",r+=",status:200}",n&&(r+=",[ELYSIA_REQUEST_ID]:id"),r+=t,r+=`} | ||
`,r},websocket(){return` | ||
`},error404(e,t){let r="if(route===null){";return t?r+=`return app.handleError(c,notFound,false,${this.parameters})`:r+=`if(c.set.status===200)c.set.status=404 | ||
`;const o=e.setHeaders;for(const l of Object.keys(e.singleton.decorator))r+=`,${l}: app.singleton.decorator.${l}`;const n=e.event.trace.length>0;return n&&(t+=`const id=randomId() | ||
`),t+=`let _request | ||
const c={`,e.inference.request&&(t+=`get request(){if(_request)return _request | ||
return _request = nodeRequestToWebstand(r)},`),t+="store,qi,path:p,url:r.url,redirect,error,",t+="[ElysiaNodeContext]:{req:r,res},",t+="set:{headers:",t+=Object.keys(o??{}).length?"Object.assign({}, app.setHeaders)":"{}",t+=",status:200}",n&&(t+=",[ELYSIA_REQUEST_ID]:id"),t+=r,t+=`} | ||
`,t},websocket(){return` | ||
`},error404(e,r){let t="if(route===null){";return r?t+=`return app.handleError(c,notFound,false,${this.parameters})`:t+=`if(c.set.status===200)c.set.status=404 | ||
res.writeHead(c.set.status, c.set.headers) | ||
res.end(error404Message) | ||
return [error404Message, c.set]`,r+="}",{declare:t?"":`const error404Message=notFound.message.toString() | ||
`,code:r}}},composeError:{declare:` | ||
return [error404Message, c.set]`,t+="}",{declare:r?"":`const error404Message=notFound.message.toString() | ||
`,code:t}}},composeError:{declare:` | ||
const res = context[ElysiaNodeContext].res | ||
`,inject:{ElysiaNodeContext:a},mapResponseContext:",res",validationError:`c.set.headers['content-type'] = 'application/json;charset=utf-8' | ||
res.writeHead(c.set.status, c.set.headers) | ||
res.end(error404Message) | ||
return [error.message, c.set]`,unknownError:`c.set.status = error.status | ||
res.writeHead(c.set.status, c.set.headers) | ||
`,inject:{ElysiaNodeContext:a},mapResponseContext:",res",validationError:`context.set.headers['content-type'] = 'application/json;charset=utf-8' | ||
res.writeHead(context.set.status, context.set.headers) | ||
res.end(error.message) | ||
return [error.message, c.set]`},listen(e){return(t,r)=>{if(e.compile(),typeof t=="string"){if(!(0,f.isNumericString)(t))throw new Error("Port must be a numeric value");t=parseInt(t)}const s=(0,i.createServer)(e._handle).listen(t,()=>{r&&r()});for(let n=0;n<e.event.start.length;n++)e.event.start[n].fn(this);process.on("beforeExit",()=>{s.close();for(let n=0;n<e.event.stop.length;n++)e.event.stop[n].fn(this)})}}};0&&(module.exports={ElysiaNodeContext,NodeAdapter,nodeRequestToWebstand}); | ||
return [error.message, context.set]`,unknownError:`c.set.status = error.status | ||
res.writeHead(context.set.status, context.set.headers) | ||
res.end(error.message) | ||
return [error.message, context.set]`},listen(e){return(r,t)=>{if(e.compile(),typeof r=="string"){if(!(0,f.isNumericString)(r))throw new Error("Port must be a numeric value");r=parseInt(r)}const o=(0,i.createServer)(e._handle).listen(r,()=>{t&&t()});for(let n=0;n<e.event.start.length;n++)e.event.start[n].fn(this);process.on("beforeExit",()=>{o.close();for(let n=0;n<e.event.stop.length;n++)e.event.stop[n].fn(this)})}}};0&&(module.exports={ElysiaNodeContext,NodeAdapter,nodeRequestToWebstand}); |
{ | ||
"name": "elysia", | ||
"description": "Ergonomic Framework for Human", | ||
"version": "1.2.0-exp.19", | ||
"version": "1.2.0-exp.20", | ||
"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
1434178