serverless-aws-lambda
Version:
AWS Application Load Balancer and API Gateway - Lambda dev tool for Serverless. Allows Express synthax in handlers. Supports packaging, local invoking and offline ALB, APG, S3, SNS, SQS, DynamoDB Stream server mocking.
2 lines (1 loc) • 1.95 kB
JavaScript
;var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols;var i=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable;var p=(e,o,s)=>o in e?l(e,o,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[o]=s,g=(e,o)=>{for(var s in o||(o={}))i.call(o,s)&&p(e,s,o[s]);if(d)for(var s of d(o))m.call(o,s)&&p(e,s,o[s]);return e};var C=(e,o)=>{for(var s in o)l(e,s,{get:o[s],enumerable:!0})},R=(e,o,s,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of b(o))!i.call(e,a)&&a!==s&&l(e,a,{get:()=>o[a],enumerable:!(n=u(o,a))||n.enumerable});return e};var B=e=>R(l({},"__esModule",{value:!0}),e);var I={};C(I,{bodyParser:()=>h,default:()=>E});module.exports=B(I);var T=(e,o)=>{var y;let s=[],n={};e.isBase64Encoded&&(e.body=Buffer.from(e.body,"base64").toString("utf-8"));let a=(y=e.headers)==null?void 0:y["content-type"],f=a==null?void 0:a.split("=")[1];if(f){let r={};e.body.split(f).forEach(t=>{/filename=".+"/g.test(t)?r[t.match(/name=".+";/g)[0].slice(6,-2)]={type:"file",filename:t.match(/filename=".+"/g)[0].slice(10,-1),contentType:t.match(/Content-Type:\s.+/g)[0].slice(14),content:o?Buffer.from(t.slice(t.search(/Content-Type:\s.+/g)+t.match(/Content-Type:\s.+/g)[0].length+4,-4),"binary"):t.slice(t.search(/Content-Type:\s.+/g)+t.match(/Content-Type:\s.+/g)[0].length+4,-4)}:/name=".+"/g.test(t)&&(r[t.match(/name=".+"/g)[0].slice(6,-1)]=t.slice(t.search(/name=".+"/g)+t.match(/name=".+"/g)[0].length+4,-4))});for(let[t,c]of Object.entries(r))typeof c=="string"?n[t]=c:c&&typeof c=="object"&&s.push(g({name:t},c))}else a=="application/x-www-form-urlencoded"&&(e.body.split("&").forEach(r=>{let[t,c]=r.split("=");n[decodeURIComponent(t)]=decodeURIComponent(c)}),e.body=n);return{files:s,body:n}},h=(e,o,s)=>{try{let n=T(e,!0);e.files=n.files,e.body=n.body,e.isBase64Encoded=!1}catch(n){}s()},E=h;0&&(module.exports={bodyParser});