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IAC1B,gBAAgB,QAAQ,EAAS,EAAM,KAAM,EAAK,EAAK,EAAM,WAGnE,EAAM,OAAS,cAAc,UAAU,QAC5C,KAAK,OAAO,QAAQ,EAAM,OAAO,CAAC,EAAK,IAC5B,gBAAgB,QAAQ,EAAS,EAAM,KAAM,EAAK,EAAK,EAAM,WAGnE,EAAM,OAAS,cAAc,UAAU,KAC5C,KAAK,OAAO,KAAK,EAAM,OAAO,CAAC,EAAK,IACzB,gBAAgB,QAAQ,EAAS,EAAM,KAAM,EAAK,EAAK,EAAM,WAIxE,QAAQ,IAAI,oBAChB,IAEJ,KAAK,IAAI,IAAI,KAAK,OACtB,CAQA,MAAA,CAAO,EAAM,GACT,KAAK,KAAO,EACZ,KAAK,IAAI,OAAO,GAAM,KACd,GACA,GACJ,GAER,EAEJ,QAAQ,OAAS","file":"/npm/aws_gw_lambda_simulator@1.3.0/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/aws_gw_lambda_simulator@1.3.0/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\n/*\nCopyright 2018 Triple Take Technologies\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy,\nmodify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\nWARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\nOTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\nfunction __export(m) {\n    for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\n}\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst express = require(\"express\");\nconst cors = require(\"cors\");\nconst bodyParser = require(\"body-parser\");\nconst lambdaFunctions = require(\"./lambdaFunctions\");\nconst lambdaRoute_1 = require(\"./types/lambdaRoute\");\n__export(require(\"./types/lambdaRoute\"));\n/**\n * The server.\n *\n * @class Server\n */\nclass Server {\n    /**\n     * Constructor.\n     *\n     * @class Server\n     * @constructor\n     */\n    constructor() {\n        //create expressjs application\n        this.app = express();\n        this.app.use(bodyParser.json());\n    }\n    /**\n     * Configure the server.  You should only call this once.\n     *\n     * @param {Array<lambdaRoute>} routes The list of routes to host.\n     * @param {*} corsOptions Optional CORS configuration.\n     * @memberof Server\n     */\n    config(routes, corsOptions) {\n        this.router = express.Router();\n        if (corsOptions) {\n            this.app.use(cors(corsOptions));\n        }\n        routes.forEach((route) => {\n            let service = require(route.filepath);\n            // TODO: Is there a way to genericize / simplify this if/else block?\n            /* if (route.verb === HTTP_VERB.ALL) {\n                this.router.all(route.route, (req, res) => {\n                    return lambdaFunctions.Wrapper(service, route.verb, req, res);\n                })\n            }\n            else */\n            if (route.verb === lambdaRoute_1.HTTP_VERB.GET) {\n                this.router.get(route.route, (req, res) => {\n                    return lambdaFunctions.Wrapper(service, route.verb, req, res, route.options);\n                });\n            }\n            else if (route.verb === lambdaRoute_1.HTTP_VERB.POST) {\n                this.router.post(route.route, (req, res) => {\n                    return lambdaFunctions.Wrapper(service, route.verb, req, res, route.options);\n                });\n            }\n            else if (route.verb === lambdaRoute_1.HTTP_VERB.PUT) {\n                this.router.put(route.route, (req, res) => {\n                    return lambdaFunctions.Wrapper(service, route.verb, req, res, route.options);\n                });\n            }\n            else if (route.verb === lambdaRoute_1.HTTP_VERB.DELETE) {\n                this.router.delete(route.route, (req, res) => {\n                    return lambdaFunctions.Wrapper(service, route.verb, req, res, route.options);\n                });\n            }\n            else if (route.verb === lambdaRoute_1.HTTP_VERB.PATCH) {\n                this.router.patch(route.route, (req, res) => {\n                    return lambdaFunctions.Wrapper(service, route.verb, req, res, route.options);\n                });\n            }\n            else if (route.verb === lambdaRoute_1.HTTP_VERB.OPTIONS) {\n                this.router.options(route.route, (req, res) => {\n                    return lambdaFunctions.Wrapper(service, route.verb, req, res, route.options);\n                });\n            }\n            else if (route.verb === lambdaRoute_1.HTTP_VERB.HEAD) {\n                this.router.head(route.route, (req, res) => {\n                    return lambdaFunctions.Wrapper(service, route.verb, req, res, route.options);\n                });\n            }\n            else {\n                console.log('unsupported route');\n            }\n        });\n        this.app.use(this.router);\n    }\n    /**\n     * Begin listening for requests on the specified port.\n     *\n     * @param {number} port The port # to listen on.\n     * @param {() => void} [callback] Optional callback method to be called upon port attachment.\n     * @memberof Server\n     */\n    listen(port, callback) {\n        this.port = port;\n        this.app.listen(port, () => {\n            if (callback) {\n                callback();\n            }\n        });\n    }\n}\nexports.Server = Server;\n"]}