aws-lambda-helper
Advanced tools
Comparing version 2.12.0 to 2.13.0
@@ -1,1 +0,1 @@ | ||
{"/Users/Admin/work/aws-lambda-helper/lib/index.js":{"path":"/Users/Admin/work/aws-lambda-helper/lib/index.js","s":{"1":1,"2":1,"3":5,"4":5,"5":2,"6":2,"7":2,"8":2,"9":3,"10":2,"11":2,"12":2,"13":2,"14":1,"15":1,"16":3,"17":3,"18":3,"19":3,"20":3,"21":1,"22":3,"23":1,"24":2,"25":1,"26":1,"27":1,"28":1,"29":2,"30":1,"31":1,"32":1,"33":1,"34":1,"35":1,"36":1,"37":1},"b":{"1":[2,3],"2":[2,1],"3":[3,1],"4":[1,2],"5":[3,3],"6":[2,2],"7":[1,1],"8":[2,1],"9":[1,1],"10":[1,1],"11":[1,1]},"f":{"1":5,"2":3,"3":3,"4":2},"fnMap":{"1":{"name":"extractParams","line":5,"loc":{"start":{"line":5,"column":0},"end":{"line":5,"column":44}}},"2":{"name":"AwsHelper","line":28,"loc":{"start":{"line":28,"column":0},"end":{"line":28,"column":42}}},"3":{"name":"getEnvironment","line":36,"loc":{"start":{"line":36,"column":0},"end":{"line":36,"column":34}}},"4":{"name":"(anonymous_4)","line":48,"loc":{"start":{"line":48,"column":16},"end":{"line":48,"column":38}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":11}},"2":{"start":{"line":5,"column":0},"end":{"line":25,"column":1}},"3":{"start":{"line":7,"column":2},"end":{"line":7,"column":62}},"4":{"start":{"line":10,"column":2},"end":{"line":15,"column":3}},"5":{"start":{"line":11,"column":4},"end":{"line":11,"column":42}},"6":{"start":{"line":12,"column":4},"end":{"line":12,"column":43}},"7":{"start":{"line":13,"column":4},"end":{"line":13,"column":26}},"8":{"start":{"line":14,"column":4},"end":{"line":14,"column":13}},"9":{"start":{"line":17,"column":2},"end":{"line":22,"column":3}},"10":{"start":{"line":18,"column":4},"end":{"line":18,"column":42}},"11":{"start":{"line":19,"column":4},"end":{"line":19,"column":43}},"12":{"start":{"line":20,"column":4},"end":{"line":20,"column":51}},"13":{"start":{"line":21,"column":4},"end":{"line":21,"column":13}},"14":{"start":{"line":24,"column":2},"end":{"line":24,"column":81}},"15":{"start":{"line":28,"column":0},"end":{"line":34,"column":1}},"16":{"start":{"line":29,"column":2},"end":{"line":29,"column":15}},"17":{"start":{"line":30,"column":2},"end":{"line":30,"column":23}},"18":{"start":{"line":31,"column":2},"end":{"line":31,"column":27}},"19":{"start":{"line":32,"column":2},"end":{"line":32,"column":44}},"20":{"start":{"line":33,"column":2},"end":{"line":33,"column":11}},"21":{"start":{"line":36,"column":0},"end":{"line":42,"column":1}},"22":{"start":{"line":37,"column":2},"end":{"line":39,"column":3}},"23":{"start":{"line":38,"column":4},"end":{"line":38,"column":16}},"24":{"start":{"line":40,"column":2},"end":{"line":40,"column":67}},"25":{"start":{"line":41,"column":2},"end":{"line":41,"column":13}},"26":{"start":{"line":44,"column":0},"end":{"line":44,"column":29}},"27":{"start":{"line":46,"column":0},"end":{"line":46,"column":16}},"28":{"start":{"line":48,"column":0},"end":{"line":62,"column":2}},"29":{"start":{"line":49,"column":2},"end":{"line":51,"column":3}},"30":{"start":{"line":50,"column":4},"end":{"line":50,"column":55}},"31":{"start":{"line":52,"column":2},"end":{"line":52,"column":31}},"32":{"start":{"line":53,"column":2},"end":{"line":53,"column":32}},"33":{"start":{"line":54,"column":2},"end":{"line":60,"column":4}},"34":{"start":{"line":61,"column":2},"end":{"line":61,"column":30}},"35":{"start":{"line":63,"column":0},"end":{"line":63,"column":27}},"36":{"start":{"line":64,"column":0},"end":{"line":64,"column":31}},"37":{"start":{"line":65,"column":0},"end":{"line":65,"column":47}}},"branchMap":{"1":{"line":10,"type":"if","locations":[{"start":{"line":10,"column":2},"end":{"line":10,"column":2}},{"start":{"line":10,"column":2},"end":{"line":10,"column":2}}]},"2":{"line":17,"type":"if","locations":[{"start":{"line":17,"column":2},"end":{"line":17,"column":2}},{"start":{"line":17,"column":2},"end":{"line":17,"column":2}}]},"3":{"line":31,"type":"binary-expr","locations":[{"start":{"line":31,"column":14},"end":{"line":31,"column":20}},{"start":{"line":31,"column":24},"end":{"line":31,"column":26}}]},"4":{"line":37,"type":"if","locations":[{"start":{"line":37,"column":2},"end":{"line":37,"column":2}},{"start":{"line":37,"column":2},"end":{"line":37,"column":2}}]},"5":{"line":37,"type":"binary-expr","locations":[{"start":{"line":37,"column":6},"end":{"line":37,"column":14}},{"start":{"line":37,"column":18},"end":{"line":37,"column":45}}]},"6":{"line":40,"type":"binary-expr","locations":[{"start":{"line":40,"column":12},"end":{"line":40,"column":17}},{"start":{"line":40,"column":21},"end":{"line":40,"column":66}}]},"7":{"line":49,"type":"if","locations":[{"start":{"line":49,"column":2},"end":{"line":49,"column":2}},{"start":{"line":49,"column":2},"end":{"line":49,"column":2}}]},"8":{"line":49,"type":"binary-expr","locations":[{"start":{"line":49,"column":6},"end":{"line":49,"column":13}},{"start":{"line":49,"column":17},"end":{"line":49,"column":37}}]},"9":{"line":56,"type":"binary-expr","locations":[{"start":{"line":56,"column":20},"end":{"line":56,"column":50}},{"start":{"line":56,"column":54},"end":{"line":56,"column":71}}]},"10":{"line":58,"type":"binary-expr","locations":[{"start":{"line":58,"column":15},"end":{"line":58,"column":31}},{"start":{"line":58,"column":35},"end":{"line":58,"column":44}}]},"11":{"line":59,"type":"binary-expr","locations":[{"start":{"line":59,"column":13},"end":{"line":59,"column":43}},{"start":{"line":59,"column":47},"end":{"line":59,"column":53}}]}}}} | ||
{"/Users/Admin/work/aws-lambda-helper/lib/index.js":{"path":"/Users/Admin/work/aws-lambda-helper/lib/index.js","s":{"1":1,"2":1,"3":1,"4":1,"5":29,"6":29,"7":29,"8":29,"9":29,"10":29,"11":28,"12":28,"13":28,"14":1,"15":31,"16":1,"17":30,"18":30,"19":4,"20":4,"21":4,"22":4,"23":4,"24":26,"25":24,"26":24,"27":24,"28":24,"29":2,"30":1,"31":42,"32":42,"33":42,"34":8,"35":34,"36":3,"37":3,"38":3,"39":2,"40":32,"41":3,"42":3,"43":3,"44":2,"45":2,"46":2,"47":2,"48":30,"49":1,"50":2,"51":1,"52":6,"53":1,"54":5,"55":4,"56":5,"57":5,"58":1,"59":5,"60":5,"61":5,"62":5,"63":1,"64":4,"65":4,"66":1,"67":3,"68":1,"69":6,"70":1,"71":4,"72":1,"73":3,"74":1,"75":3,"76":3,"77":3,"78":3,"79":1,"80":1,"81":1,"82":1,"83":1,"84":1,"85":3,"86":1,"87":4,"88":1,"89":2,"90":2,"91":2,"92":1,"93":1,"94":1,"95":1,"96":1,"97":1,"98":1,"99":1,"100":1,"101":2,"102":2,"103":1,"104":1,"105":5,"106":1,"107":2,"108":1,"109":1,"110":1,"111":2,"112":1,"113":34,"114":34,"115":34,"116":34,"117":34,"118":1,"119":0,"120":0,"121":0,"122":0,"123":0,"124":1,"125":1,"126":1,"127":6,"128":1,"129":6,"130":6,"131":5,"132":5,"133":5,"134":2,"135":5,"136":2,"137":3,"138":6,"139":1,"140":1,"141":1,"142":6,"143":3,"144":6,"145":1,"146":1,"147":3,"148":3,"149":1,"150":1,"151":1,"152":1,"153":2,"154":2,"155":2,"156":4,"157":4,"158":4,"159":4,"160":4,"161":4,"162":2,"163":1,"164":1,"165":1,"166":1,"167":1,"168":1,"169":1},"b":{"1":[1,30],"2":[4,26],"3":[24,2],"4":[42,29],"5":[8,34],"6":[3,31],"7":[34,5,5],"8":[2,1],"9":[3,3],"10":[3,29],"11":[32,3],"12":[2,1],"13":[3,2],"14":[1,5],"15":[6,5],"16":[4,1],"17":[1,4],"18":[5,5],"19":[5,5],"20":[5,5],"21":[1,4],"22":[1,3],"23":[6,2],"24":[1,3],"25":[4,3],"26":[1,2],"27":[3,3],"28":[1,2],"29":[4,1],"30":[5,1],"31":[1,1],"32":[34,29],"33":[34,0],"34":[34,22,0],"35":[34,34,34],"36":[34,24],"37":[33,1],"38":[0,0],"39":[1,5],"40":[6,1],"41":[6,3],"42":[2,3],"43":[3,3],"44":[2,2]},"f":{"1":29,"2":31,"3":42,"4":2,"5":2,"6":6,"7":5,"8":6,"9":4,"10":4,"11":2,"12":1,"13":1,"14":2,"15":5,"16":2,"17":2,"18":34,"19":0,"20":6,"21":6,"22":5,"23":2,"24":5,"25":1,"26":3,"27":2,"28":4,"29":4,"30":1,"31":1},"fnMap":{"1":{"name":"init","line":23,"loc":{"start":{"line":23,"column":0},"end":{"line":23,"column":31}}},"2":{"name":"(anonymous_2)","line":35,"loc":{"start":{"line":35,"column":37},"end":{"line":35,"column":67}}},"3":{"name":"(anonymous_3)","line":59,"loc":{"start":{"line":59,"column":29},"end":{"line":59,"column":41}}},"4":{"name":"(anonymous_4)","line":83,"loc":{"start":{"line":83,"column":29},"end":{"line":83,"column":44}}},"5":{"name":"(anonymous_5)","line":96,"loc":{"start":{"line":96,"column":27},"end":{"line":96,"column":46}}},"6":{"name":"(anonymous_6)","line":105,"loc":{"start":{"line":105,"column":26},"end":{"line":105,"column":48}}},"7":{"name":"(anonymous_7)","line":143,"loc":{"start":{"line":143,"column":37},"end":{"line":143,"column":58}}},"8":{"name":"(anonymous_8)","line":151,"loc":{"start":{"line":151,"column":30},"end":{"line":151,"column":42}}},"9":{"name":"(anonymous_9)","line":161,"loc":{"start":{"line":161,"column":24},"end":{"line":161,"column":46}}},"10":{"name":"(anonymous_10)","line":198,"loc":{"start":{"line":198,"column":27},"end":{"line":198,"column":39}}},"11":{"name":"(anonymous_11)","line":207,"loc":{"start":{"line":207,"column":29},"end":{"line":207,"column":51}}},"12":{"name":"(anonymous_12)","line":218,"loc":{"start":{"line":218,"column":27},"end":{"line":218,"column":49}}},"13":{"name":"(anonymous_13)","line":227,"loc":{"start":{"line":227,"column":34},"end":{"line":227,"column":56}}},"14":{"name":"(anonymous_14)","line":231,"loc":{"start":{"line":231,"column":34},"end":{"line":231,"column":51}}},"15":{"name":"(anonymous_15)","line":239,"loc":{"start":{"line":239,"column":32},"end":{"line":239,"column":44}}},"16":{"name":"(anonymous_16)","line":254,"loc":{"start":{"line":254,"column":24},"end":{"line":254,"column":55}}},"17":{"name":"clone","line":259,"loc":{"start":{"line":259,"column":0},"end":{"line":259,"column":21}}},"18":{"name":"(anonymous_18)","line":263,"loc":{"start":{"line":263,"column":19},"end":{"line":263,"column":35}}},"19":{"name":"(anonymous_19)","line":282,"loc":{"start":{"line":282,"column":32},"end":{"line":282,"column":47}},"skip":true},"20":{"name":"proto","line":294,"loc":{"start":{"line":294,"column":0},"end":{"line":294,"column":25}}},"21":{"name":"httpRequest","line":307,"loc":{"start":{"line":307,"column":0},"end":{"line":307,"column":41}}},"22":{"name":"(anonymous_22)","line":309,"loc":{"start":{"line":309,"column":44},"end":{"line":309,"column":59}}},"23":{"name":"(anonymous_23)","line":312,"loc":{"start":{"line":312,"column":19},"end":{"line":312,"column":36}}},"24":{"name":"(anonymous_24)","line":314,"loc":{"start":{"line":314,"column":17},"end":{"line":314,"column":29}}},"25":{"name":"(anonymous_25)","line":322,"loc":{"start":{"line":322,"column":18},"end":{"line":322,"column":31}}},"26":{"name":"pushToSocketServer","line":348,"loc":{"start":{"line":348,"column":0},"end":{"line":348,"column":47}}},"27":{"name":"saveRecordToS3","line":369,"loc":{"start":{"line":369,"column":0},"end":{"line":369,"column":43}}},"28":{"name":"(anonymous_28)","line":372,"loc":{"start":{"line":372,"column":23},"end":{"line":372,"column":39}}},"29":{"name":"(anonymous_29)","line":383,"loc":{"start":{"line":383,"column":34},"end":{"line":383,"column":55}}},"30":{"name":"(anonymous_30)","line":402,"loc":{"start":{"line":402,"column":31},"end":{"line":402,"column":59}}},"31":{"name":"(anonymous_31)","line":404,"loc":{"start":{"line":404,"column":29},"end":{"line":404,"column":50}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":29}},"2":{"start":{"line":4,"column":0},"end":{"line":4,"column":31}},"3":{"start":{"line":6,"column":0},"end":{"line":20,"column":2}},"4":{"start":{"line":23,"column":0},"end":{"line":33,"column":1}},"5":{"start":{"line":24,"column":2},"end":{"line":24,"column":31}},"6":{"start":{"line":25,"column":2},"end":{"line":25,"column":27}},"7":{"start":{"line":26,"column":2},"end":{"line":26,"column":27}},"8":{"start":{"line":27,"column":2},"end":{"line":27,"column":24}},"9":{"start":{"line":28,"column":2},"end":{"line":28,"column":29}},"10":{"start":{"line":29,"column":2},"end":{"line":29,"column":65}},"11":{"start":{"line":30,"column":2},"end":{"line":30,"column":50}},"12":{"start":{"line":31,"column":2},"end":{"line":31,"column":37}},"13":{"start":{"line":32,"column":2},"end":{"line":32,"column":19}},"14":{"start":{"line":35,"column":0},"end":{"line":54,"column":2}},"15":{"start":{"line":36,"column":2},"end":{"line":36,"column":109}},"16":{"start":{"line":36,"column":27},"end":{"line":36,"column":109}},"17":{"start":{"line":37,"column":2},"end":{"line":37,"column":62}},"18":{"start":{"line":39,"column":2},"end":{"line":45,"column":3}},"19":{"start":{"line":40,"column":4},"end":{"line":40,"column":50}},"20":{"start":{"line":41,"column":4},"end":{"line":41,"column":51}},"21":{"start":{"line":42,"column":4},"end":{"line":42,"column":34}},"22":{"start":{"line":43,"column":4},"end":{"line":43,"column":25}},"23":{"start":{"line":44,"column":4},"end":{"line":44,"column":21}},"24":{"start":{"line":47,"column":2},"end":{"line":52,"column":3}},"25":{"start":{"line":48,"column":4},"end":{"line":48,"column":50}},"26":{"start":{"line":49,"column":4},"end":{"line":49,"column":51}},"27":{"start":{"line":50,"column":4},"end":{"line":50,"column":67}},"28":{"start":{"line":51,"column":4},"end":{"line":51,"column":21}},"29":{"start":{"line":53,"column":2},"end":{"line":53,"column":81}},"30":{"start":{"line":59,"column":0},"end":{"line":92,"column":2}},"31":{"start":{"line":60,"column":2},"end":{"line":60,"column":37}},"32":{"start":{"line":63,"column":2},"end":{"line":63,"column":30}},"33":{"start":{"line":64,"column":2},"end":{"line":66,"column":3}},"34":{"start":{"line":65,"column":4},"end":{"line":65,"column":19}},"35":{"start":{"line":68,"column":2},"end":{"line":76,"column":3}},"36":{"start":{"line":69,"column":4},"end":{"line":75,"column":5}},"37":{"start":{"line":70,"column":6},"end":{"line":70,"column":57}},"38":{"start":{"line":71,"column":6},"end":{"line":73,"column":7}},"39":{"start":{"line":72,"column":8},"end":{"line":72,"column":27}},"40":{"start":{"line":78,"column":2},"end":{"line":88,"column":3}},"41":{"start":{"line":79,"column":4},"end":{"line":79,"column":34}},"42":{"start":{"line":80,"column":4},"end":{"line":80,"column":45}},"43":{"start":{"line":81,"column":4},"end":{"line":87,"column":5}},"44":{"start":{"line":82,"column":6},"end":{"line":82,"column":19}},"45":{"start":{"line":83,"column":6},"end":{"line":85,"column":9}},"46":{"start":{"line":84,"column":8},"end":{"line":84,"column":40}},"47":{"start":{"line":86,"column":6},"end":{"line":86,"column":21}},"48":{"start":{"line":91,"column":2},"end":{"line":91,"column":12}},"49":{"start":{"line":96,"column":0},"end":{"line":98,"column":2}},"50":{"start":{"line":97,"column":2},"end":{"line":97,"column":27}},"51":{"start":{"line":105,"column":0},"end":{"line":149,"column":2}},"52":{"start":{"line":106,"column":2},"end":{"line":108,"column":3}},"53":{"start":{"line":107,"column":4},"end":{"line":107,"column":55}},"54":{"start":{"line":111,"column":2},"end":{"line":113,"column":3}},"55":{"start":{"line":112,"column":4},"end":{"line":112,"column":72}},"56":{"start":{"line":128,"column":2},"end":{"line":128,"column":45}},"57":{"start":{"line":129,"column":2},"end":{"line":131,"column":3}},"58":{"start":{"line":130,"column":4},"end":{"line":130,"column":37}},"59":{"start":{"line":133,"column":2},"end":{"line":133,"column":32}},"60":{"start":{"line":135,"column":2},"end":{"line":141,"column":4}},"61":{"start":{"line":143,"column":2},"end":{"line":148,"column":5}},"62":{"start":{"line":144,"column":4},"end":{"line":144,"column":28}},"63":{"start":{"line":144,"column":13},"end":{"line":144,"column":28}},"64":{"start":{"line":145,"column":4},"end":{"line":145,"column":43}},"65":{"start":{"line":146,"column":4},"end":{"line":146,"column":49}},"66":{"start":{"line":146,"column":30},"end":{"line":146,"column":49}},"67":{"start":{"line":147,"column":4},"end":{"line":147,"column":29}},"68":{"start":{"line":151,"column":0},"end":{"line":153,"column":2}},"69":{"start":{"line":152,"column":2},"end":{"line":152,"column":71}},"70":{"start":{"line":161,"column":0},"end":{"line":196,"column":2}},"71":{"start":{"line":162,"column":2},"end":{"line":164,"column":3}},"72":{"start":{"line":163,"column":4},"end":{"line":163,"column":51}},"73":{"start":{"line":167,"column":2},"end":{"line":169,"column":3}},"74":{"start":{"line":168,"column":4},"end":{"line":168,"column":128}},"75":{"start":{"line":171,"column":2},"end":{"line":171,"column":29}},"76":{"start":{"line":173,"column":2},"end":{"line":173,"column":45}},"77":{"start":{"line":175,"column":2},"end":{"line":179,"column":4}},"78":{"start":{"line":181,"column":2},"end":{"line":193,"column":3}},"79":{"start":{"line":182,"column":4},"end":{"line":182,"column":16}},"80":{"start":{"line":184,"column":4},"end":{"line":192,"column":5}},"81":{"start":{"line":185,"column":6},"end":{"line":185,"column":51}},"82":{"start":{"line":186,"column":6},"end":{"line":186,"column":36}},"83":{"start":{"line":187,"column":6},"end":{"line":187,"column":32}},"84":{"start":{"line":188,"column":6},"end":{"line":190,"column":9}},"85":{"start":{"line":195,"column":2},"end":{"line":195,"column":39}},"86":{"start":{"line":198,"column":0},"end":{"line":200,"column":2}},"87":{"start":{"line":199,"column":2},"end":{"line":199,"column":62}},"88":{"start":{"line":207,"column":0},"end":{"line":216,"column":2}},"89":{"start":{"line":208,"column":2},"end":{"line":208,"column":34}},"90":{"start":{"line":210,"column":2},"end":{"line":213,"column":4}},"91":{"start":{"line":215,"column":2},"end":{"line":215,"column":44}},"92":{"start":{"line":218,"column":0},"end":{"line":225,"column":2}},"93":{"start":{"line":219,"column":2},"end":{"line":219,"column":34}},"94":{"start":{"line":221,"column":2},"end":{"line":221,"column":24}},"95":{"start":{"line":222,"column":2},"end":{"line":222,"column":55}},"96":{"start":{"line":224,"column":2},"end":{"line":224,"column":42}},"97":{"start":{"line":227,"column":0},"end":{"line":237,"column":2}},"98":{"start":{"line":228,"column":2},"end":{"line":228,"column":34}},"99":{"start":{"line":230,"column":2},"end":{"line":230,"column":24}},"100":{"start":{"line":231,"column":2},"end":{"line":234,"column":5}},"101":{"start":{"line":232,"column":4},"end":{"line":232,"column":72}},"102":{"start":{"line":233,"column":4},"end":{"line":233,"column":33}},"103":{"start":{"line":236,"column":2},"end":{"line":236,"column":49}},"104":{"start":{"line":239,"column":0},"end":{"line":241,"column":2}},"105":{"start":{"line":240,"column":2},"end":{"line":240,"column":77}},"106":{"start":{"line":254,"column":0},"end":{"line":257,"column":2}},"107":{"start":{"line":255,"column":2},"end":{"line":255,"column":19}},"108":{"start":{"line":255,"column":12},"end":{"line":255,"column":19}},"109":{"start":{"line":256,"column":2},"end":{"line":256,"column":27}},"110":{"start":{"line":259,"column":0},"end":{"line":261,"column":1}},"111":{"start":{"line":260,"column":2},"end":{"line":260,"column":41}},"112":{"start":{"line":263,"column":0},"end":{"line":279,"column":2}},"113":{"start":{"line":264,"column":2},"end":{"line":264,"column":20}},"114":{"start":{"line":266,"column":2},"end":{"line":266,"column":41},"skip":true},"115":{"start":{"line":267,"column":2},"end":{"line":267,"column":45}},"116":{"start":{"line":269,"column":2},"end":{"line":277,"column":5},"skip":true},"117":{"start":{"line":278,"column":2},"end":{"line":278,"column":13}},"118":{"start":{"line":282,"column":0},"end":{"line":289,"column":3},"skip":true},"119":{"start":{"line":283,"column":2},"end":{"line":283,"column":26},"skip":true},"120":{"start":{"line":284,"column":2},"end":{"line":286,"column":3},"skip":true},"121":{"start":{"line":285,"column":4},"end":{"line":285,"column":40},"skip":true},"122":{"start":{"line":287,"column":2},"end":{"line":287,"column":64},"skip":true},"123":{"start":{"line":288,"column":2},"end":{"line":288,"column":12},"skip":true},"124":{"start":{"line":291,"column":0},"end":{"line":291,"column":29}},"125":{"start":{"line":292,"column":0},"end":{"line":292,"column":27}},"126":{"start":{"line":294,"column":0},"end":{"line":296,"column":1}},"127":{"start":{"line":295,"column":2},"end":{"line":295,"column":63}},"128":{"start":{"line":307,"column":0},"end":{"line":332,"column":1}},"129":{"start":{"line":308,"column":2},"end":{"line":308,"column":76}},"130":{"start":{"line":309,"column":2},"end":{"line":321,"column":5}},"131":{"start":{"line":310,"column":4},"end":{"line":310,"column":28}},"132":{"start":{"line":311,"column":4},"end":{"line":311,"column":20}},"133":{"start":{"line":312,"column":4},"end":{"line":320,"column":7}},"134":{"start":{"line":313,"column":6},"end":{"line":313,"column":22}},"135":{"start":{"line":315,"column":6},"end":{"line":319,"column":7}},"136":{"start":{"line":316,"column":8},"end":{"line":316,"column":50}},"137":{"start":{"line":318,"column":8},"end":{"line":318,"column":46}},"138":{"start":{"line":322,"column":2},"end":{"line":326,"column":5}},"139":{"start":{"line":323,"column":4},"end":{"line":323,"column":55}},"140":{"start":{"line":324,"column":4},"end":{"line":324,"column":70}},"141":{"start":{"line":325,"column":4},"end":{"line":325,"column":23}},"142":{"start":{"line":328,"column":2},"end":{"line":330,"column":3}},"143":{"start":{"line":329,"column":4},"end":{"line":329,"column":44}},"144":{"start":{"line":331,"column":2},"end":{"line":331,"column":12}},"145":{"start":{"line":333,"column":0},"end":{"line":333,"column":36}},"146":{"start":{"line":348,"column":0},"end":{"line":360,"column":1}},"147":{"start":{"line":349,"column":2},"end":{"line":357,"column":4}},"148":{"start":{"line":359,"column":2},"end":{"line":359,"column":33}},"149":{"start":{"line":361,"column":0},"end":{"line":361,"column":50}},"150":{"start":{"line":363,"column":0},"end":{"line":363,"column":31}},"151":{"start":{"line":364,"column":0},"end":{"line":364,"column":91}},"152":{"start":{"line":369,"column":0},"end":{"line":390,"column":1}},"153":{"start":{"line":370,"column":2},"end":{"line":370,"column":38}},"154":{"start":{"line":371,"column":2},"end":{"line":371,"column":28}},"155":{"start":{"line":372,"column":2},"end":{"line":389,"column":5}},"156":{"start":{"line":373,"column":4},"end":{"line":373,"column":77}},"157":{"start":{"line":374,"column":4},"end":{"line":374,"column":28}},"158":{"start":{"line":375,"column":4},"end":{"line":381,"column":6}},"159":{"start":{"line":383,"column":4},"end":{"line":388,"column":7}},"160":{"start":{"line":384,"column":6},"end":{"line":384,"column":19}},"161":{"start":{"line":385,"column":6},"end":{"line":387,"column":7}},"162":{"start":{"line":386,"column":8},"end":{"line":386,"column":35}},"163":{"start":{"line":391,"column":0},"end":{"line":391,"column":42}},"164":{"start":{"line":402,"column":0},"end":{"line":408,"column":2}},"165":{"start":{"line":404,"column":2},"end":{"line":407,"column":5}},"166":{"start":{"line":405,"column":4},"end":{"line":405,"column":17}},"167":{"start":{"line":406,"column":4},"end":{"line":406,"column":44}},"168":{"start":{"line":409,"column":0},"end":{"line":409,"column":27}},"169":{"start":{"line":410,"column":0},"end":{"line":410,"column":57}}},"branchMap":{"1":{"line":36,"type":"if","locations":[{"start":{"line":36,"column":2},"end":{"line":36,"column":2}},{"start":{"line":36,"column":2},"end":{"line":36,"column":2}}]},"2":{"line":39,"type":"if","locations":[{"start":{"line":39,"column":2},"end":{"line":39,"column":2}},{"start":{"line":39,"column":2},"end":{"line":39,"column":2}}]},"3":{"line":47,"type":"if","locations":[{"start":{"line":47,"column":2},"end":{"line":47,"column":2}},{"start":{"line":47,"column":2},"end":{"line":47,"column":2}}]},"4":{"line":60,"type":"binary-expr","locations":[{"start":{"line":60,"column":14},"end":{"line":60,"column":30}},{"start":{"line":60,"column":34},"end":{"line":60,"column":36}}]},"5":{"line":64,"type":"if","locations":[{"start":{"line":64,"column":2},"end":{"line":64,"column":2}},{"start":{"line":64,"column":2},"end":{"line":64,"column":2}}]},"6":{"line":68,"type":"if","locations":[{"start":{"line":68,"column":2},"end":{"line":68,"column":2}},{"start":{"line":68,"column":2},"end":{"line":68,"column":2}}]},"7":{"line":68,"type":"binary-expr","locations":[{"start":{"line":68,"column":6},"end":{"line":68,"column":19}},{"start":{"line":68,"column":23},"end":{"line":68,"column":39}},{"start":{"line":68,"column":43},"end":{"line":68,"column":71}}]},"8":{"line":71,"type":"if","locations":[{"start":{"line":71,"column":6},"end":{"line":71,"column":6}},{"start":{"line":71,"column":6},"end":{"line":71,"column":6}}]},"9":{"line":71,"type":"binary-expr","locations":[{"start":{"line":71,"column":10},"end":{"line":71,"column":13}},{"start":{"line":71,"column":17},"end":{"line":71,"column":28}}]},"10":{"line":78,"type":"if","locations":[{"start":{"line":78,"column":2},"end":{"line":78,"column":2}},{"start":{"line":78,"column":2},"end":{"line":78,"column":2}}]},"11":{"line":78,"type":"binary-expr","locations":[{"start":{"line":78,"column":6},"end":{"line":78,"column":19}},{"start":{"line":78,"column":23},"end":{"line":78,"column":39}}]},"12":{"line":81,"type":"if","locations":[{"start":{"line":81,"column":4},"end":{"line":81,"column":4}},{"start":{"line":81,"column":4},"end":{"line":81,"column":4}}]},"13":{"line":81,"type":"binary-expr","locations":[{"start":{"line":81,"column":8},"end":{"line":81,"column":13}},{"start":{"line":81,"column":17},"end":{"line":81,"column":46}}]},"14":{"line":106,"type":"if","locations":[{"start":{"line":106,"column":2},"end":{"line":106,"column":2}},{"start":{"line":106,"column":2},"end":{"line":106,"column":2}}]},"15":{"line":106,"type":"binary-expr","locations":[{"start":{"line":106,"column":6},"end":{"line":106,"column":13}},{"start":{"line":106,"column":17},"end":{"line":106,"column":37}}]},"16":{"line":111,"type":"if","locations":[{"start":{"line":111,"column":2},"end":{"line":111,"column":2}},{"start":{"line":111,"column":2},"end":{"line":111,"column":2}}]},"17":{"line":129,"type":"if","locations":[{"start":{"line":129,"column":2},"end":{"line":129,"column":2}},{"start":{"line":129,"column":2},"end":{"line":129,"column":2}}]},"18":{"line":137,"type":"binary-expr","locations":[{"start":{"line":137,"column":20},"end":{"line":137,"column":41}},{"start":{"line":137,"column":45},"end":{"line":137,"column":62}}]},"19":{"line":139,"type":"binary-expr","locations":[{"start":{"line":139,"column":15},"end":{"line":139,"column":31}},{"start":{"line":139,"column":35},"end":{"line":139,"column":52}}]},"20":{"line":140,"type":"binary-expr","locations":[{"start":{"line":140,"column":13},"end":{"line":140,"column":27}},{"start":{"line":140,"column":31},"end":{"line":140,"column":37}}]},"21":{"line":144,"type":"if","locations":[{"start":{"line":144,"column":4},"end":{"line":144,"column":4}},{"start":{"line":144,"column":4},"end":{"line":144,"column":4}}]},"22":{"line":146,"type":"if","locations":[{"start":{"line":146,"column":4},"end":{"line":146,"column":4}},{"start":{"line":146,"column":4},"end":{"line":146,"column":4}}]},"23":{"line":152,"type":"binary-expr","locations":[{"start":{"line":152,"column":22},"end":{"line":152,"column":39}},{"start":{"line":152,"column":43},"end":{"line":152,"column":70}}]},"24":{"line":162,"type":"if","locations":[{"start":{"line":162,"column":2},"end":{"line":162,"column":2}},{"start":{"line":162,"column":2},"end":{"line":162,"column":2}}]},"25":{"line":162,"type":"binary-expr","locations":[{"start":{"line":162,"column":6},"end":{"line":162,"column":13}},{"start":{"line":162,"column":17},"end":{"line":162,"column":33}}]},"26":{"line":167,"type":"if","locations":[{"start":{"line":167,"column":2},"end":{"line":167,"column":2}},{"start":{"line":167,"column":2},"end":{"line":167,"column":2}}]},"27":{"line":177,"type":"binary-expr","locations":[{"start":{"line":177,"column":22},"end":{"line":177,"column":45}},{"start":{"line":177,"column":49},"end":{"line":177,"column":55}}]},"28":{"line":181,"type":"if","locations":[{"start":{"line":181,"column":2},"end":{"line":181,"column":2}},{"start":{"line":181,"column":2},"end":{"line":181,"column":2}}]},"29":{"line":199,"type":"binary-expr","locations":[{"start":{"line":199,"column":19},"end":{"line":199,"column":33}},{"start":{"line":199,"column":37},"end":{"line":199,"column":61}}]},"30":{"line":240,"type":"binary-expr","locations":[{"start":{"line":240,"column":24},"end":{"line":240,"column":43}},{"start":{"line":240,"column":47},"end":{"line":240,"column":76}}]},"31":{"line":255,"type":"if","locations":[{"start":{"line":255,"column":2},"end":{"line":255,"column":2}},{"start":{"line":255,"column":2},"end":{"line":255,"column":2}}]},"32":{"line":264,"type":"binary-expr","locations":[{"start":{"line":264,"column":9},"end":{"line":264,"column":13}},{"start":{"line":264,"column":17},"end":{"line":264,"column":19}}]},"33":{"line":266,"type":"binary-expr","locations":[{"start":{"line":266,"column":16},"end":{"line":266,"column":34},"skip":true},{"start":{"line":266,"column":38},"end":{"line":266,"column":40},"skip":true}]},"34":{"line":270,"type":"binary-expr","locations":[{"start":{"line":270,"column":10},"end":{"line":270,"column":30},"skip":true},{"start":{"line":270,"column":34},"end":{"line":270,"column":60},"skip":true},{"start":{"line":270,"column":64},"end":{"line":270,"column":73},"skip":true}]},"35":{"line":271,"type":"binary-expr","locations":[{"start":{"line":271,"column":11},"end":{"line":271,"column":39},"skip":true},{"start":{"line":271,"column":43},"end":{"line":271,"column":64},"skip":true},{"start":{"line":271,"column":68},"end":{"line":271,"column":74},"skip":true}]},"36":{"line":274,"type":"binary-expr","locations":[{"start":{"line":274,"column":20},"end":{"line":274,"column":47},"skip":true},{"start":{"line":274,"column":51},"end":{"line":274,"column":53},"skip":true}]},"37":{"line":275,"type":"cond-expr","locations":[{"start":{"line":275,"column":32},"end":{"line":275,"column":36},"skip":true},{"start":{"line":275,"column":39},"end":{"line":275,"column":45},"skip":true}]},"38":{"line":284,"type":"if","locations":[{"start":{"line":284,"column":2},"end":{"line":284,"column":2},"skip":true},{"start":{"line":284,"column":2},"end":{"line":284,"column":2},"skip":true}]},"39":{"line":295,"type":"cond-expr","locations":[{"start":{"line":295,"column":50},"end":{"line":295,"column":55}},{"start":{"line":295,"column":58},"end":{"line":295,"column":62}}]},"40":{"line":295,"type":"binary-expr","locations":[{"start":{"line":295,"column":10},"end":{"line":295,"column":22}},{"start":{"line":295,"column":26},"end":{"line":295,"column":46}}]},"41":{"line":308,"type":"binary-expr","locations":[{"start":{"line":308,"column":20},"end":{"line":308,"column":35}},{"start":{"line":308,"column":39},"end":{"line":308,"column":75}}]},"42":{"line":315,"type":"if","locations":[{"start":{"line":315,"column":6},"end":{"line":315,"column":6}},{"start":{"line":315,"column":6},"end":{"line":315,"column":6}}]},"43":{"line":328,"type":"if","locations":[{"start":{"line":328,"column":2},"end":{"line":328,"column":2}},{"start":{"line":328,"column":2},"end":{"line":328,"column":2}}]},"44":{"line":385,"type":"if","locations":[{"start":{"line":385,"column":6},"end":{"line":385,"column":6}},{"start":{"line":385,"column":6},"end":{"line":385,"column":6}}]}}}} |
110
lib/index.js
@@ -265,5 +265,6 @@ 'use strict'; | ||
tags = tags || []; | ||
/* istanbul ignore next */ | ||
var context = AwsHelper._context || {}; | ||
var headers = AwsHelper._getEventHeaders(); | ||
/* istanbul ignore next */ | ||
var log = bunyan.createLogger({ | ||
@@ -291,3 +292,110 @@ name: context.functionName || context.invokedFunctionArn || 'unknown', | ||
var https = require('https'); // we can get rid of this once the WebSocket | ||
var http = require('http'); // server is upgraded to httpS ... | ||
// decide which http protocol to use based on port number: | ||
function proto (options) { | ||
return (options.port && options.port === 443) ? https : http; | ||
} | ||
/** | ||
* simple_http_request is a bare-bones http request using node.js core http | ||
* see: https://nodejs.org/api/http.html#http_http_request_options_callback | ||
* the NPM request module is 3.6 Megabytes and offers v. little benefit ... | ||
* This code achieves the same in less than 1kb. less code = faster response. | ||
* @param {Object} options - the standard http options (host, path, query, etc) | ||
* @param {Function} callback - a standard callback with error & response args | ||
* response is a JSON Object unless there is an error. | ||
* Note: AwsHelper.Logger MUST be Initialised before calling httpRequest | ||
*/ | ||
function httpRequest (options, callback) { | ||
options.headers = options.headers || {'Content-Type': 'application/json'}; | ||
var req = proto(options).request(options, function (res) { | ||
res.setEncoding('utf8'); | ||
var resStr = ''; | ||
res.on('data', function (chunk) { | ||
resStr += chunk; | ||
}).on('end', function () { | ||
if (resStr.length > 0) { | ||
return callback(null, JSON.parse(resStr)); // return response as object | ||
} else { | ||
return callback(null, res.statusCode); | ||
} | ||
}); | ||
}); | ||
req.on('error', function (e) { | ||
var req = 'https://' + options.host + options.path; | ||
AwsHelper.log.error({err: e, url: req}, 'API/HTTP Request Error'); | ||
return callback(e); | ||
}); | ||
// write to request body if passed to options | ||
if (options.body) { | ||
req.write(JSON.stringify(options.body)); | ||
} | ||
req.end(); // always end the request | ||
} | ||
AwsHelper.httpRequest = httpRequest; // export for testing | ||
/** | ||
* pushToSocketServer sends an HTTP request to the WebSocket Server | ||
* with all the information required to forward a search result item | ||
* on to the Client that requested the search. | ||
* @param {String} params - the object containing all the body to send (see below) | ||
params = { // see: https://github.com/numo-labs/aws-lambda-helper/issues/40 | ||
id: clientId, | ||
searchId: searchId, | ||
userId: userId, | ||
items: Array.isArray(json) ? json : [json] // always send an array of items | ||
} | ||
* @param {Function} callback - callaback executed with (err, data) | ||
*/ | ||
function pushToSocketServer (params, callback) { | ||
var options = { | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
'host': process.env.WEBSOCKET_SERVER_URL, | ||
'path': '/data', | ||
'method': 'POST', | ||
body: params | ||
}; | ||
httpRequest(options, callback); | ||
} | ||
AwsHelper.pushToSocketServer = pushToSocketServer; // export for testing | ||
var resultBucket = new AWS.S3({params: {Bucket: process.env.AWS_S3_SEARCH_RESULT_BUCKET}}); | ||
/** | ||
* saveRecordToS3 | ||
* @param {Object} params - the object we want to store (see below for format) | ||
*/ | ||
function saveRecordToS3 (params, callback) { | ||
var filepath = params.userId + '/' + params.sessionId + '/' + params.id + '.json'; | ||
var env = AwsHelper.env; // remember to Initialise this! | ||
var s3params = { | ||
Bucket: process.env.AWS_S3_SEARCH_RESULT_BUCKET, | ||
Key: env + '/' + filepath, | ||
Body: JSON.stringify(params), | ||
ContentType: 'application/json', | ||
ACL: 'public-read' | ||
}; | ||
return resultBucket.upload(s3params, callback); | ||
} | ||
AwsHelper.saveRecordToS3 = saveRecordToS3; // export for testing | ||
/** | ||
params = { // see: https://github.com/numo-labs/aws-lambda-helper/issues/40 | ||
id: clientId, | ||
searchId: searchId, | ||
userId: userId, | ||
items: Array.isArray(json) ? json : [json] // always send an array of items | ||
} | ||
*/ | ||
var assert = require('assert'); | ||
AwsHelper.pushResultToClient = function (params, callback) { | ||
// push to WebSocket Server | ||
pushToSocketServer(params, function (err, data) { | ||
assert(!err); | ||
return saveRecordToS3(params, callback); // push to S3 | ||
}); | ||
}; | ||
module.exports = AwsHelper; | ||
module.exports.getEnvironment = AwsHelper.getEnvironment; |
{ | ||
"name": "aws-lambda-helper", | ||
"version": "2.12.0", | ||
"version": "2.13.0", | ||
"description": "Collection of helper methods for lambda", | ||
@@ -19,9 +19,13 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"aws-sdk": "^2.2.40", | ||
"aws-sdk": "^2.3.14", | ||
"engine.io": "^1.6.9", | ||
"engine.io-client": "^1.6.9", | ||
"env2": "^2.1.0", | ||
"eslint": "^1.10.3", | ||
"eslint-config-semistandard": "^5.0.0", | ||
"intercept-stdout": "^0.1.2", | ||
"istanbul": "^0.4.2", | ||
"istanbul": "^0.4.3", | ||
"mocha": "^2.4.5", | ||
"simple-mock": "^0.6.0" | ||
"primus": "^5.2.1", | ||
"simple-mock": "^0.7.0" | ||
}, | ||
@@ -28,0 +32,0 @@ "dependencies": { |
@@ -6,2 +6,4 @@ # aws-lambda-helper | ||
[![codecov.io](https://codecov.io/github/numo-labs/aws-lambda-helper/coverage.svg?branch=master)](https://codecov.io/github/numo-labs/aws-lambda-helper?branch=master) | ||
[![Dependency Status](https://david-dm.org/numo-labs/aws-lambda-helper.svg)](https://david-dm.org/numo-labs/aws-lambda-helper) | ||
[![devDependency Status](https://david-dm.org/numo-labs/aws-lambda-helper/dev-status.svg)](https://david-dm.org/numo-labs/aws-lambda-helper#info=devDependencies) | ||
@@ -54,6 +56,6 @@ ## Installation | ||
This function will intercept the error if exists and then will call 'context.fail'. | ||
The purpose of this function is to avoid the need of checking for errors so that in callback you could just focus on the succesfull procedure. | ||
This function will intercept the error if exists and then will call 'context.fail'. | ||
The purpose of this function is to avoid the need of checking for errors so that in callback you could just focus on the succesfull procedure. | ||
It can be used as follows: | ||
It can be used as follows: | ||
```js | ||
@@ -65,3 +67,3 @@ | ||
}); | ||
``` | ||
@@ -105,1 +107,26 @@ | ||
``` | ||
### Pushing Data Back to Client(s) Via WebSocket Server | ||
```js | ||
var params = { | ||
id: sessionId, // the id provided by the WebSocket Server | ||
searchId: 12345, // the id of this particular search request | ||
userId: 'UniqueFingerprint', // the super long string that uniquely identifies a client | ||
items: [ | ||
// your list of one or more tiles or packages go here | ||
] | ||
}; | ||
AwsHelper.pushResultToClient(params, function (err, res) { | ||
console.log(err, res); // do what ever you want after the result is pushed | ||
}); | ||
``` | ||
#### Environment Variables | ||
You will require an Environment Variable for the `WEBSOCKET_SERVER_URL` | ||
and `AWS_S3_SEARCH_RESULT_BUCKET` | ||
(*see below for complete list of required Environment Variables*) | ||
> if you get stuck get the Environment Variables from CodeShip: | ||
> https://codeship.com/projects/143221/configure_environment |
@@ -154,1 +154,17 @@ 'use strict'; | ||
}); | ||
// test error branch in AwsHelper.Lambda.invoke | ||
describe('AwsHelper.Lambda Real', function () { | ||
it('Invoke with invalid params.FunctionName', function (done) { | ||
// Create a awsHelper with a good context | ||
var context = { | ||
'invokedFunctionArn': 'arn:aws:lambda:eu-west-1:123456789:function:aws-canary-lambda:prod' | ||
}; | ||
AwsHelper.init(context); | ||
var params = {FunctionName: 'DummyFunc'}; | ||
AwsHelper.Lambda.invoke(params, function (err) { | ||
assert(err); | ||
done(); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
192764
31
1540
129
11
6
2