@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 • 936 B
JavaScript
import{a as t}from"../../chunk-QWPVIX2T.mjs";var s=class{static{t(this,"AwsContextResolver")}createResolver({context:e,event:l,log:a,respondWithErrors:c,adapter:u}){if(!e)throw new Error('Could not figure out how to create the resolver because the "context" argument was not sent.');if(!e.succeed)throw new Error(`Could not figure out how to create the resolver because the "context" argument didn't have the "succeed" function.`);if(!e.fail)throw new Error(`Could not figure out how to create the resolver because the "context" argument didn't have the "fail" function.`);let n={succeed:t(r=>e.succeed(r),"succeed"),fail:t(r=>e.fail(r),"fail")};return{run:t(r=>{r().then(o=>n.succeed(o)).catch(o=>{a.error("SERVERLESS_ADAPTER:RESPOND_TO_EVENT_SOURCE_WITH_ERROR",o),u.onErrorWhileForwarding({delegatedResolver:n,error:o,log:a,event:l,respondWithErrors:c})})},"run")}}};export{s as AwsContextResolver};
//# sourceMappingURL=index.mjs.map