From 586c667eff830d7f8629995266d9f0b5e17986f3 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 24 Feb 2023 22:30:17 +0000 Subject: [PATCH] chore(release): 2.3.2 [skip ci] ## [2.3.2](https://github.com/ClearC2/headlamp/compare/v2.3.1...v2.3.2) (2023-02-24) ### Bug Fixes * make it faster ([417cedf](https://github.com/ClearC2/headlamp/commit/417cedf96adf9ac557e82aec0356c556dba49bd7)) --- CHANGELOG.md | 7 +++++++ lib/api-route-provider.js | 12 ++++++------ package.json | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d01ab6d..bdef898 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [2.3.2](https://github.com/ClearC2/headlamp/compare/v2.3.1...v2.3.2) (2023-02-24) + + +### Bug Fixes + +* make it faster ([417cedf](https://github.com/ClearC2/headlamp/commit/417cedf96adf9ac557e82aec0356c556dba49bd7)) + ## [2.3.1](https://github.com/ClearC2/headlamp/compare/v2.3.0...v2.3.1) (2023-02-24) diff --git a/lib/api-route-provider.js b/lib/api-route-provider.js index c45d271..3d04e53 100644 --- a/lib/api-route-provider.js +++ b/lib/api-route-provider.js @@ -80,9 +80,10 @@ function _default(app) { }); var responseStore = createActivationStore(); var customResponseStore = createCustomResponseStore(); + var fileRoutes = getFileRoutes(options); function getAllRouteResponses(routeId) { - var fileRoute = getFileRoutes(options).find(function (r) { + var fileRoute = fileRoutes.find(function (r) { return r.id === routeId; }); var fileResponses = getRouteResponses(options, fileRoute); @@ -91,7 +92,7 @@ function _default(app) { } // create routes from files - getFileRoutes(options).forEach(function (route) { + fileRoutes.forEach(function (route) { // create express route var appRoute = app.route(route.path); // add methods to route @@ -129,7 +130,6 @@ function _default(app) { warnDuplicateRoutes(app); app.get('/_api', function (req, res) { - var fileRoutes = getFileRoutes(options); var routes = getAPIRoutes(app).map(function (r) { // attempt to find route file for route var routeFile = fileRoutes.find(function (route) { @@ -336,7 +336,7 @@ function _default(app) { }); app.get('/_route/:routeId/responses', function (req, res) { var routeId = req.params.routeId; - var fileRoute = getFileRoutes(options).find(function (r) { + var fileRoute = fileRoutes.find(function (r) { return r.id === routeId; }) || {}; var responses = getAllRouteResponses(routeId); @@ -350,7 +350,7 @@ function _default(app) { var _req$params = req.params, routeId = _req$params.routeId, respId = _req$params.respId; - var fileRoute = getFileRoutes(options).find(function (r) { + var fileRoute = fileRoutes.find(function (r) { return r.id === routeId; }); var responses = getAllRouteResponses(routeId); @@ -366,7 +366,7 @@ function _default(app) { }); app.get('/_route/:routeId/responses/deactivate', function (req, res) { var routeId = req.params.routeId; - var fileRoute = getFileRoutes(options).find(function (r) { + var fileRoute = fileRoutes.find(function (r) { return r.id === routeId; }); responseStore.setActiveResponse(routeId, null); diff --git a/package.json b/package.json index dcaaec7..0038271 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@clearc2/headlamp", - "version": "2.3.1", + "version": "2.3.2", "description": "Express API documenter", "main": "lib/index.js", "publishConfig": {