@h4ad/serverless-adapter
Version:
Run REST APIs and other web applications using your existing Node.js application framework (NestJS, Express, Koa, Hapi, Fastify and many others), on top of AWS, Azure, Digital Ocean and many other clouds.
2 lines • 2.51 kB
JavaScript
import"./chunk-22SSVZU5.mjs";import{A as D,B as _,C as I,a,b as r,c as o,d as p,e as l,f as T,g as h,h as E,i as d,j as c,k as R,l as u,m as S,n as m,o as A,p as w,q as b,r as s,s as C,t as f,u as g,v,w as k,x,y,z as L}from"./chunk-6BLWJRLG.mjs";import{a as t}from"./chunk-QWPVIX2T.mjs";var n=class i{static{t(this,"ServerlessAdapter")}constructor(e){this.app=e}app;binarySettings={contentEncodings:r,contentTypes:o};respondWithErrors=process.env.NODE_ENV==="development";log=s();adapters=[];framework;resolver;handler;static new(e){return new i(e)}setHandler(e){if(this.handler)throw new Error("SERVERLESS_ADAPTER: The handler should not set twice.");return this.handler=e,this}setResolver(e){if(this.resolver)throw new Error("SERVERLESS_ADAPTER: The resolver should not set twice.");return this.resolver=e,this}setFramework(e){if(this.framework)throw new Error("SERVERLESS_ADAPTER: The framework should not set twice.");return this.framework=e,this}setLogger(e){return this.log=e,this}setBinarySettings(e){return this.binarySettings={...this.binarySettings,...e},this}setRespondWithErrors(e){return this.respondWithErrors=e,this}addAdapter(e){return this.adapters.push(e),this}build(){if(!this.resolver)throw new Error("SERVERLESS_ADAPTER: Is required to set a resolver before build.");if(!this.framework)throw new Error("SERVERLESS_ADAPTER: Is required to set a framework before build.");if(!this.handler)throw new Error("SERVERLESS_ADAPTER: Is required to set a handler before build.");if(this.adapters.length===0)throw new Error("SERVERLESS_ADAPTER: Is required to set at least one adapter.");return this.handler.getHandler(this.app,this.framework,this.adapters,this.resolver,this.binarySettings,this.respondWithErrors,this.log)}};export{a as BaseHandler,o as DEFAULT_BINARY_CONTENT_TYPES,r as DEFAULT_BINARY_ENCODINGS,p as EmptyResponse,b as NO_OP,n as ServerlessAdapter,L as ServerlessRequest,_ as ServerlessResponse,I as ServerlessStreamResponse,k as buildStripBasePath,s as createDefaultLogger,m as getContentType,l as getCurrentInvoke,f as getDefaultIfUndefined,h as getEventBodyAsBuffer,E as getFlattenedHeadersMap,c as getFlattenedHeadersMapAndCookies,d as getMultiValueHeadersMap,g as getPathWithQueryStringParams,v as getQueryParamsStringFromRecord,D as getString,w as isBinary,S as isContentEncodingBinary,A as isContentTypeBinary,C as isInternalLogger,x as isStreamEnded,u as keysToLowercase,R as parseHeaders,T as setCurrentInvoke,y as waitForStreamComplete};
//# sourceMappingURL=index.mjs.map