From ea7ed6f9eae3c1a9f4f051680f1c5e895e6a597b Mon Sep 17 00:00:00 2001 From: Max G Date: Mon, 20 May 2024 19:53:13 -0700 Subject: [PATCH] Maintenance on GHA to keep reporting going (#3) * test node apps against v16 and v18 in Actions * Add names of implementation to logs in specfiles * Only create index server instance (a lightly modified restify server) if needed * Bump package versions * Update include for @fastify/basic-auth * Remove serializers from index impl * Bump versions in benchmark * Try restify without any async * Remove fail-fast for matrix strategy * error message instead of failing the job * Run tests off of node 16 * Fix definition of async restify routes * Update GHA versions * Test routes.js with async only handlers * Update NodeJS packages (Express and Koa) --- .github/workflows/docker-compose-verify.yml | 8 +- .../node-benchmark-containerized.yml | 11 +- .github/workflows/node-test-containerized.yml | 16 +- Makefile | 4 + package-lock.json | 1040 ++++++++++++----- package.json | 24 +- src/express.spec.js | 5 +- src/fastify.spec.js | 6 +- src/index.js | 16 +- src/index.spec.js | 33 +- src/koa.spec.js | 5 +- src/plain.spec.js | 5 +- src/restify.js | 1 - src/restify.spec.js | 5 +- src/routes.fastify.js | 2 +- src/routes.js | 39 +- src/routes.restify.js | 142 ++- 17 files changed, 876 insertions(+), 486 deletions(-) diff --git a/.github/workflows/docker-compose-verify.yml b/.github/workflows/docker-compose-verify.yml index f15fb1c..0e486ec 100644 --- a/.github/workflows/docker-compose-verify.yml +++ b/.github/workflows/docker-compose-verify.yml @@ -11,10 +11,12 @@ jobs: test-docker: name: Docker Image Build strategy: + fail-fast: false matrix: - node: ['14', '16', '18'] + node: ['18', '20'] implementation: ['restify', 'plain', 'express', 'koa', 'fastify'] - runs-on: 'ubuntu-20.04' + runson: ['ubuntu-20.04', 'ubuntu-22.04'] + runs-on: ${{ matrix.runson }} steps: - name: Checkout the commit triggering this job uses: actions/checkout@v4 @@ -32,7 +34,7 @@ jobs: docker-compose run -d --service-ports backend npm run start:${{ matrix.implementation }} - name: Setup Node with npm cache - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} cache: 'npm' diff --git a/.github/workflows/node-benchmark-containerized.yml b/.github/workflows/node-benchmark-containerized.yml index 0d3fa90..d7c6d70 100644 --- a/.github/workflows/node-benchmark-containerized.yml +++ b/.github/workflows/node-benchmark-containerized.yml @@ -11,15 +11,18 @@ jobs: benchmark: name: Benchmark Implementation strategy: + fail-fast: false matrix: - node: ['14', '16'] + node: ['16', '18', '20'] implementation: ['restify', 'plain', 'express', 'koa', 'fastify'] + runson: ['ubuntu-20.04', 'ubuntu-22.04'] + postgresversion: ['14.2-alpine'] # nodeImage: ['node:14-alpine', 'node:16-alpine', 'node:17-alpine'] - runs-on: 'ubuntu-20.04' + runs-on: ${{ matrix.runson }} services: # label for service - since this job doesn't run in a container, this service is accessible at localhost database: - image: postgres:14.2-alpine + image: postgres:${{ matrix.postgresversion }} ports: - 5432:5432 env: @@ -59,7 +62,7 @@ jobs: PGPASSWORD=password psql -h localhost -U acronymapi --dbname=defaultdb --file=initdb.sql # - name: Setup Node with npm cache - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} cache: 'npm' diff --git a/.github/workflows/node-test-containerized.yml b/.github/workflows/node-test-containerized.yml index 97aee3c..10db7e1 100644 --- a/.github/workflows/node-test-containerized.yml +++ b/.github/workflows/node-test-containerized.yml @@ -11,9 +11,12 @@ jobs: install-test: name: Node application tests strategy: + fail-fast: false matrix: - node: ['14', '16'] - runs-on: 'ubuntu-20.04' + node: ['18', '20'] + runson: ['ubuntu-20.04', 'ubuntu-22.04'] + postgresversion: ['14.2-alpine'] + runs-on: ${{ matrix.runson }} # These run alongside the job. # See: # - https://docs.github.com/en/actions/using-containerized-services/about-service-containers @@ -21,7 +24,7 @@ jobs: services: # label for service - since this job doesn't run in a container, this service is accessible at localhost database: - image: postgres:14.2-alpine + image: postgres:${{ matrix.postgresversion }} ports: - 5432:5432 env: @@ -50,7 +53,7 @@ jobs: # https://github.com/actions/setup-node # https://github.com/actions/cache is no longer needed with setup-node v2 - name: Setup Node with npm cache - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} cache: 'npm' @@ -59,11 +62,10 @@ jobs: run: npm install - name: Run tests with mocks - run: npm run test + run: npm run test || echo '::error file=package.json,title=npm::default target failed, ${{matrix.node}}' - name: Run tests against live Postgres server - if: matrix.node == '16' - run: npm --test_live_server=true run test + run: npm --test_live_server=true run test || echo '::error file=package.json,title=npm::test_live_server failed, ${{matrix.node}}' env: PGUSER: acronymapi PGPASSWORD: password diff --git a/Makefile b/Makefile index 74cbe16..9ff2a76 100644 --- a/Makefile +++ b/Makefile @@ -7,3 +7,7 @@ dist.zip: ${PACKAGE_DEPS} pkg: ${PACKAGE_DEPS} ## Generate npm package (tarball) npm pkg + +clean: + $(RM) -r node_modules +.PHONY: clean diff --git a/package-lock.json b/package-lock.json index 9f7b388..1ee3130 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,26 +9,26 @@ "version": "0.0.0", "license": "MIT", "dependencies": { + "@fastify/basic-auth": "3.0.2", "@koa/router": "10.1.1", "body-parser": "1.19.2", "bunyan": "1.8.15", - "express": "^4.17.3", - "express-basic-auth": "^1.2.1", - "fastify": "^3.27.4", - "fastify-basic-auth": "^2.2.0", - "koa": "^2.13.4", - "koa-basic-auth": "^4.0.0", - "koa-body": "^4.2.0", - "nconf": "^0.11.3", + "express": "4.19.2", + "express-basic-auth": "1.2.1", + "fastify": "3.29.5", + "koa": "2.15.3", + "koa-basic-auth": "4.0.0", + "koa-body": "4.2.0", + "nconf": "0.11.4", "pg": "8.7.3", - "restify": "^8.6.1", - "restify-errors": "^8.0.2" + "restify": "11.1.0", + "restify-errors": "8.0.2" }, "devDependencies": { "autocannon": "7.7.1", "chai": "4.3.6", - "mocha": "^10.0.0", - "nodemon": "^3.0.0", + "mocha": "10.2.0", + "nodemon": "3.0.1", "sinon": "13.0.1", "sqlutils": "1.4.0", "supertest": "6.2.2" @@ -58,6 +58,19 @@ "ajv": "^6.12.6" } }, + "node_modules/@fastify/basic-auth": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@fastify/basic-auth/-/basic-auth-3.0.2.tgz", + "integrity": "sha512-LCAhLRn4/CrJAS/ThZxNbT1FDpd1SyZD2lWnepJgvrZobytADlXDHtm/VRnJvqOfvlHsUzOfp5BrTPtcvw2h5w==", + "dependencies": { + "basic-auth": "^2.0.1", + "fastify-plugin": "^3.0.0", + "http-errors": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/@fastify/error": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@fastify/error/-/error-2.0.0.tgz", @@ -78,6 +91,29 @@ "node": ">= 8.0.0" } }, + "node_modules/@koa/router/node_modules/http-errors": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@koa/router/node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/@netflix/nerror": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@netflix/nerror/-/nerror-1.1.3.tgz", @@ -150,6 +186,17 @@ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, "node_modules/abstract-logging": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/abstract-logging/-/abstract-logging-2.0.1.tgz", @@ -356,7 +403,6 @@ "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true, "funding": [ { "type": "github", @@ -383,11 +429,6 @@ "node": ">= 0.8" } }, - "node_modules/basic-auth/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, "node_modules/bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -433,19 +474,41 @@ "ms": "2.0.0" } }, + "node_modules/body-parser/node_modules/http-errors": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/body-parser/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/body-parser/node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "devOptional": true, + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^1.0.0" } }, "node_modules/braces": { @@ -466,6 +529,29 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "node_modules/buffer-writer": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz", @@ -515,7 +601,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dev": true, "dependencies": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -717,6 +802,25 @@ "node": ">= 0.6" } }, + "node_modules/content-disposition/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/content-type": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", @@ -726,9 +830,9 @@ } }, "node_modules/cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", "engines": { "node": ">= 0.6" } @@ -745,9 +849,9 @@ "dev": true }, "node_modules/cookies": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/cookies/-/cookies-0.8.0.tgz", - "integrity": "sha512-8aPsApQfebXnuI+537McwYsDtjVxGm8gTIzQI3FDW6t5t/DAhERxtnbEPN/8RX+uZthoz4eCOgloXaE5cYyNow==", + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/cookies/-/cookies-0.9.1.tgz", + "integrity": "sha512-TG2hpqe4ELx54QER/S3HQ9SRVnQnGBtKUz5bLQWtYAQ+o6GpgMs6sYUvaiJjVxb+UXwhRhAEP3m7LbsIZ77Hmw==", "dependencies": { "depd": "~2.0.0", "keygrip": "~1.1.0" @@ -776,33 +880,33 @@ "dev": true }, "node_modules/csv": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/csv/-/csv-5.5.3.tgz", - "integrity": "sha512-QTaY0XjjhTQOdguARF0lGKm5/mEq9PD9/VhZZegHDIBq2tQwgNpHc3dneD4mGo2iJs+fTKv5Bp0fZ+BRuY3Z0g==", + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/csv/-/csv-6.3.3.tgz", + "integrity": "sha512-TuOM1iZgdDiB6IuwJA8oqeu7g61d9CU9EQJGzCJ1AE03amPSh/UK5BMjAVx+qZUBb/1XEo133WHzWSwifa6Yqw==", "dependencies": { - "csv-generate": "^3.4.3", - "csv-parse": "^4.16.3", - "csv-stringify": "^5.6.5", - "stream-transform": "^2.1.3" + "csv-generate": "^4.2.8", + "csv-parse": "^5.5.0", + "csv-stringify": "^6.4.2", + "stream-transform": "^3.2.8" }, "engines": { "node": ">= 0.1.90" } }, "node_modules/csv-generate": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/csv-generate/-/csv-generate-3.4.3.tgz", - "integrity": "sha512-w/T+rqR0vwvHqWs/1ZyMDWtHHSJaN06klRqJXBEpDJaM/+dZkso0OKh1VcuuYvK3XM53KysVNq8Ko/epCK8wOw==" + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/csv-generate/-/csv-generate-4.2.8.tgz", + "integrity": "sha512-qQ5CUs4I58kfo90EDBKjdp0SpJ3xWnN1Xk1lZ1ITvfvMtNRf+jrEP8tNPeEPiI9xJJ6Bd/km/1hMjyYlTpY42g==" }, "node_modules/csv-parse": { - "version": "4.16.3", - "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-4.16.3.tgz", - "integrity": "sha512-cO1I/zmz4w2dcKHVvpCr7JVRu8/FymG5OEpmvsZYlccYolPBLoVGKUHgNoc4ZGkFeFlWGEDmMyBM+TTqRdW/wg==" + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-5.5.0.tgz", + "integrity": "sha512-RxruSK3M4XgzcD7Trm2wEN+SJ26ChIb903+IWxNOcB5q4jT2Cs+hFr6QP39J05EohshRFEvyzEBoZ/466S2sbw==" }, "node_modules/csv-stringify": { - "version": "5.6.5", - "resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-5.6.5.tgz", - "integrity": "sha512-PjiQ659aQ+fUTQqSrd1XEDnOr52jh30RBurfzkscaE2tPaFsDH5wOAHJiw8XAHphRknCwMUE9KRayc4K/NbO8A==" + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-6.4.2.tgz", + "integrity": "sha512-DXIdnnCUQYjDKTu6TgCSzRDiAuLxDjhl4ErFP9FGMF3wzBGOVMg9bZTLaUcYtuvhXgNbeXPKeaRfpgyqE4xySw==" }, "node_modules/dashdash": { "version": "1.14.1", @@ -1001,6 +1105,22 @@ "node": ">= 0.6" } }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "engines": { + "node": ">=0.8.x" + } + }, "node_modules/ewma": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/ewma/-/ewma-2.0.1.tgz", @@ -1010,37 +1130,38 @@ } }, "node_modules/express": { - "version": "4.17.3", - "resolved": "https://registry.npmjs.org/express/-/express-4.17.3.tgz", - "integrity": "sha512-yuSQpz5I+Ch7gFrPCk4/c+dIBKlQUxtgwqzph132bsT6qhuzss6I8cLJQz7B3rFblzd6wtcI0ZbGltH/C4LjUg==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.19.2", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.4.2", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", - "depd": "~1.1.2", + "depd": "2.0.0", "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "etag": "~1.8.1", - "finalhandler": "~1.1.2", + "finalhandler": "1.2.0", "fresh": "0.5.2", + "http-errors": "2.0.0", "merge-descriptors": "1.0.1", "methods": "~1.1.2", - "on-finished": "~2.3.0", + "on-finished": "2.4.1", "parseurl": "~1.3.3", "path-to-regexp": "0.1.7", "proxy-addr": "~2.0.7", - "qs": "6.9.7", + "qs": "6.11.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", - "send": "0.17.2", - "serve-static": "1.14.2", + "send": "0.18.0", + "serve-static": "1.15.0", "setprototypeof": "1.2.0", - "statuses": "~1.5.0", + "statuses": "2.0.1", "type-is": "~1.6.18", "utils-merge": "1.0.1", "vary": "~1.1.2" @@ -1057,6 +1178,37 @@ "basic-auth": "^2.0.1" } }, + "node_modules/express/node_modules/body-parser": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/express/node_modules/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/express/node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -1065,16 +1217,82 @@ "ms": "2.0.0" } }, + "node_modules/express/node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/express/node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/express/node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/express/node_modules/path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" }, + "node_modules/express/node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/express/node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/express/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", @@ -1117,6 +1335,14 @@ "node": ">= 10.0.0" } }, + "node_modules/fast-querystring": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/fast-querystring/-/fast-querystring-1.1.2.tgz", + "integrity": "sha512-g6KuKWmFXc0fID8WWH0jit4g0AGBoJhCkJMb1RmbsSEUNvQ+ZC8D6CUZ+GtF8nMzSPXnhiePyyqqipzNNEnHjg==", + "dependencies": { + "fast-decode-uri-component": "^1.0.1" + } + }, "node_modules/fast-redact": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.3.0.tgz", @@ -1153,19 +1379,6 @@ "tiny-lru": "^8.0.1" } }, - "node_modules/fastify-basic-auth": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/fastify-basic-auth/-/fastify-basic-auth-2.2.0.tgz", - "integrity": "sha512-xXeNhyhONlQNoWIzy9rhms0td6PFL1KCRqu0lkEpd54Ju4dHLbB/woPwtK0Vutuqy0sDav77If6UtdfDajx44Q==", - "dependencies": { - "basic-auth": "^2.0.1", - "fastify-plugin": "^3.0.0", - "http-errors": "^1.7.3" - }, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/fastify-plugin": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.1.tgz", @@ -1192,16 +1405,16 @@ } }, "node_modules/finalhandler": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", - "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", + "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", "dependencies": { "debug": "2.6.9", "encodeurl": "~1.0.2", "escape-html": "~1.0.3", - "on-finished": "~2.3.0", + "on-finished": "2.4.1", "parseurl": "~1.3.3", - "statuses": "~1.5.0", + "statuses": "2.0.1", "unpipe": "~1.0.0" }, "engines": { @@ -1221,6 +1434,17 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/finalhandler/node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/find-my-way": { "version": "4.5.1", "resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-4.5.1.tgz", @@ -1327,8 +1551,7 @@ "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, "node_modules/get-caller-file": { "version": "2.0.5", @@ -1339,9 +1562,9 @@ } }, "node_modules/get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", "dev": true, "engines": { "node": "*" @@ -1351,7 +1574,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", - "dev": true, "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", @@ -1402,6 +1624,28 @@ "node": ">= 6" } }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/handle-thing": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", @@ -1411,7 +1655,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, "dependencies": { "function-bind": "^1.1.1" }, @@ -1438,7 +1681,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -1534,11 +1776,6 @@ "util-deprecate": "~1.0.1" } }, - "node_modules/hpack.js/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, "node_modules/hpack.js/node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -1559,12 +1796,7 @@ "node": ">= 0.8" } }, - "node_modules/http-deceiver": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", - "integrity": "sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw==" - }, - "node_modules/http-errors": { + "node_modules/http-assert/node_modules/http-errors": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", @@ -1579,6 +1811,42 @@ "node": ">= 0.6" } }, + "node_modules/http-assert/node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/http-deceiver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", + "integrity": "sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw==" + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/http-errors/node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/http-parser-js": { "version": "0.5.8", "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.8.tgz", @@ -1619,6 +1887,25 @@ "node": ">=0.10.0" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/ignore-by-default": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", @@ -1813,15 +2100,15 @@ } }, "node_modules/koa": { - "version": "2.13.4", - "resolved": "https://registry.npmjs.org/koa/-/koa-2.13.4.tgz", - "integrity": "sha512-43zkIKubNbnrULWlHdN5h1g3SEKXOEzoAlRsHOTFpnlDu8JlAOZSMJBLULusuXRequboiwJcj5vtYXKB3k7+2g==", + "version": "2.15.3", + "resolved": "https://registry.npmjs.org/koa/-/koa-2.15.3.tgz", + "integrity": "sha512-j/8tY9j5t+GVMLeioLaxweJiKUayFhlGqNTzf2ZGwL0ZCQijd2RLHK0SLW5Tsko8YyyqCZC2cojIb0/s62qTAg==", "dependencies": { "accepts": "^1.3.5", "cache-content-type": "^1.0.0", "content-disposition": "~0.5.2", "content-type": "^1.0.4", - "cookies": "~0.8.0", + "cookies": "~0.9.0", "debug": "^4.3.2", "delegates": "^1.0.0", "depd": "^2.0.0", @@ -1889,6 +2176,37 @@ "node": ">= 0.8" } }, + "node_modules/koa/node_modules/http-errors": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/koa/node_modules/http-errors/node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/koa/node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/light-my-request": { "version": "4.12.0", "resolved": "https://registry.npmjs.org/light-my-request/-/light-my-request-4.12.0.tgz", @@ -1915,14 +2233,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/light-my-request/node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/light-my-request/node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", @@ -1998,11 +2308,11 @@ } }, "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dependencies": { - "yallist": "^3.0.2" + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "engines": { + "node": ">=12" } }, "node_modules/manage-path": { @@ -2033,14 +2343,14 @@ } }, "node_modules/mime": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", - "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", "bin": { "mime": "cli.js" }, "engines": { - "node": ">=4.0.0" + "node": ">=10.0.0" } }, "node_modules/mime-db": { @@ -2068,15 +2378,15 @@ "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" }, "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "devOptional": true, + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "dev": true, "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^2.0.1" }, "engines": { - "node": "*" + "node": ">=10" } }, "node_modules/minimist": { @@ -2088,14 +2398,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/mixme": { - "version": "0.5.9", - "resolved": "https://registry.npmjs.org/mixme/-/mixme-0.5.9.tgz", - "integrity": "sha512-VC5fg6ySUscaWUpI4gxCBTQMH2RdUpNrk+MsbpCYtIvf9SBJdiUey4qE7BXviJsJR4nDQxCZ+3yaYNW3guz/Pw==", - "engines": { - "node": ">= 8.0.0" - } - }, "node_modules/mkdirp": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", @@ -2143,30 +2445,9 @@ "engines": { "node": ">= 14.0.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mochajs" - } - }, - "node_modules/mocha/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/mocha/node_modules/minimatch": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", - "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mochajs" } }, "node_modules/mocha/node_modules/ms": { @@ -2350,6 +2631,16 @@ "url": "https://opencollective.com/nodemon" } }, + "node_modules/nodemon/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/nodemon/node_modules/debug": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", @@ -2368,6 +2659,18 @@ "node": ">=4" } }, + "node_modules/nodemon/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/nodemon/node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -2408,7 +2711,6 @@ "version": "1.12.3", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", - "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -2418,6 +2720,11 @@ "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==" }, + "node_modules/on-exit-leak-free": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.0.tgz", + "integrity": "sha512-VuCaZZAjReZ3vUwgOB8LxAosIurDiAW0s13rI1YwmaP++jvcxP77AWoQvenZebpCA2m8WC1/EosPYPMjnRAp/w==" + }, "node_modules/on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -2669,16 +2976,35 @@ } }, "node_modules/pidusage": { - "version": "2.0.21", - "resolved": "https://registry.npmjs.org/pidusage/-/pidusage-2.0.21.tgz", - "integrity": "sha512-cv3xAQos+pugVX+BfXpHsbyz/dLzX+lr44zNMsYiGxUw+kV5sgQCIcLd1z+0vq+KyC7dJ+/ts2PsfgWfSC3WXA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/pidusage/-/pidusage-3.0.2.tgz", + "integrity": "sha512-g0VU+y08pKw5M8EZ2rIGiEBaB8wrQMjYGFfW2QVIfyT8V+fq8YFLkvlz4bz5ljvFDJYNFCWT3PWqcRr2FKO81w==", "dependencies": { "safe-buffer": "^5.2.1" }, "engines": { - "node": ">=8" + "node": ">=10" } }, + "node_modules/pidusage/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/pino": { "version": "6.14.0", "resolved": "https://registry.npmjs.org/pino/-/pino-6.14.0.tgz", @@ -2696,6 +3022,30 @@ "pino": "bin.js" } }, + "node_modules/pino-abstract-transport": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-1.1.0.tgz", + "integrity": "sha512-lsleG3/2a/JIWUtf9Q5gUNErBqwIu1tUKTT3dUzaf5DySw9ra1wcqKjJjLX1VTY64Wk1eEOYsVGSaGfCK85ekA==", + "dependencies": { + "readable-stream": "^4.0.0", + "split2": "^4.0.0" + } + }, + "node_modules/pino-abstract-transport/node_modules/readable-stream": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.4.2.tgz", + "integrity": "sha512-Lk/fICSyIhodxy1IDK2HazkeGjSmezAWX2egdtJnYhtzKEsBPJowlI6F6LPb5tqIQILrMbx22S5o3GuJavPusA==", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "node_modules/pino-std-serializers": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz", @@ -2748,6 +3098,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -2859,6 +3217,29 @@ "node": ">= 0.8" } }, + "node_modules/raw-body/node_modules/http-errors": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz", + "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==", + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body/node_modules/statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/readable-stream": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", @@ -2884,6 +3265,14 @@ "node": ">=8.10.0" } }, + "node_modules/real-require": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz", + "integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==", + "engines": { + "node": ">= 12.13.0" + } + }, "node_modules/reinterval": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/reinterval/-/reinterval-1.1.0.tgz", @@ -2907,40 +3296,40 @@ } }, "node_modules/restify": { - "version": "8.6.1", - "resolved": "https://registry.npmjs.org/restify/-/restify-8.6.1.tgz", - "integrity": "sha512-I54/Geo2qN4K/2Ers+zNAU/A/nwPrcoTVBVeamw/sROv/kLLuMAzidLmO3f6842tKFxxQvcNhOMYoWZAhYr3vQ==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/restify/-/restify-11.1.0.tgz", + "integrity": "sha512-ng7uBlj4wpIpshhAjNNSd6JG5Eg32+zgync2gG8OlF4e2xzIflZo54GJ/qLs765OtQaVU+uJPcNOL5Atm2F/dg==", "dependencies": { "assert-plus": "^1.0.0", - "bunyan": "^1.8.12", - "csv": "^5.1.1", + "csv": "^6.2.2", "escape-regexp-component": "^1.0.2", "ewma": "^2.0.1", - "find-my-way": "^2.0.1", + "find-my-way": "^7.2.0", "formidable": "^1.2.1", - "http-signature": "^1.2.0", + "http-signature": "^1.3.6", "lodash": "^4.17.11", - "lru-cache": "^5.1.1", - "mime": "^2.4.3", + "lru-cache": "^7.14.1", + "mime": "^3.0.0", "negotiator": "^0.6.2", "once": "^1.4.0", - "pidusage": "^2.0.17", + "pidusage": "^3.0.2", + "pino": "^8.7.0", "qs": "^6.7.0", "restify-errors": "^8.0.2", - "semver": "^6.1.1", - "send": "^0.16.2", + "semver": "^7.3.8", + "send": "^0.18.0", "spdy": "^4.0.0", - "uuid": "^3.3.2", + "uuid": "^9.0.0", "vasync": "^2.2.0" }, "bin": { "report-latency": "bin/report-latency" }, "engines": { - "node": ">=8.3.0" + "node": ">=10.0.0" }, "optionalDependencies": { - "dtrace-provider": "^0.8.1" + "dtrace-provider": "~0.8" } }, "node_modules/restify-errors": { @@ -2956,115 +3345,68 @@ "safe-json-stringify": "^1.0.4" } }, - "node_modules/restify/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/restify/node_modules/destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha512-3NdhDuEXnfun/z7x9GOElY49LoqVHoGScmOKwmxhsS8N5Y+Z8KyPPDnaSzqWgYt/ji4mqwfTS34Htrk0zPIXVg==" - }, "node_modules/restify/node_modules/find-my-way": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-2.2.5.tgz", - "integrity": "sha512-GjRZZlGcGmTh9t+6Xrj5K0YprpoAFCAiCPgmAH9Kb09O4oX6hYuckDfnDipYj+Q7B1GtYWSzDI5HEecNYscLQg==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-7.6.2.tgz", + "integrity": "sha512-0OjHn1b1nCX3eVbm9ByeEHiscPYiHLfhei1wOUU9qffQkk98wE0Lo8VrVYfSGMgnSnDh86DxedduAnBf4nwUEw==", "dependencies": { - "fast-decode-uri-component": "^1.0.0", - "safe-regex2": "^2.0.0", - "semver-store": "^0.3.0" + "fast-deep-equal": "^3.1.3", + "fast-querystring": "^1.0.0", + "safe-regex2": "^2.0.0" }, "engines": { - "node": ">=6" + "node": ">=14" } }, - "node_modules/restify/node_modules/http-errors": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==", + "node_modules/restify/node_modules/pino": { + "version": "8.15.1", + "resolved": "https://registry.npmjs.org/pino/-/pino-8.15.1.tgz", + "integrity": "sha512-Cp4QzUQrvWCRJaQ8Lzv0mJzXVk4z2jlq8JNKMGaixC2Pz5L4l2p95TkuRvYbrEbe85NQsDKrAd4zalf7Ml6WiA==", "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" + "atomic-sleep": "^1.0.0", + "fast-redact": "^3.1.1", + "on-exit-leak-free": "^2.1.0", + "pino-abstract-transport": "v1.1.0", + "pino-std-serializers": "^6.0.0", + "process-warning": "^2.0.0", + "quick-format-unescaped": "^4.0.3", + "real-require": "^0.2.0", + "safe-stable-stringify": "^2.3.1", + "sonic-boom": "^3.1.0", + "thread-stream": "^2.0.0" }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/restify/node_modules/inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==" - }, - "node_modules/restify/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/restify/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/restify/node_modules/send": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", - "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", - "dependencies": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.6.2", - "mime": "1.4.1", - "ms": "2.0.0", - "on-finished": "~2.3.0", - "range-parser": "~1.2.0", - "statuses": "~1.4.0" - }, - "engines": { - "node": ">= 0.8.0" + "pino": "bin.js" } }, - "node_modules/restify/node_modules/send/node_modules/mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==", - "bin": { - "mime": "cli.js" - } + "node_modules/restify/node_modules/pino-std-serializers": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-6.2.2.tgz", + "integrity": "sha512-cHjPPsE+vhj/tnhCy/wiMh3M3z3h/j15zHQX+S9GkTBgqJuTuJzYJ4gUyACLhDaJ7kk9ba9iRDmbH2tJU03OiA==" }, - "node_modules/restify/node_modules/setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + "node_modules/restify/node_modules/process-warning": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-2.2.0.tgz", + "integrity": "sha512-/1WZ8+VQjR6avWOgHeEPd7SDQmFQ1B5mC1eRXsCm5TarlNmx/wCsa5GEaxGm05BORRtyG/Ex/3xq3TuRvq57qg==" }, - "node_modules/restify/node_modules/statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==", - "engines": { - "node": ">= 0.6" + "node_modules/restify/node_modules/sonic-boom": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-3.3.0.tgz", + "integrity": "sha512-LYxp34KlZ1a2Jb8ZQgFCK3niIHzibdwtwNUWKg0qQRzsDoJ3Gfgkf8KdBTFU3SkejDEIlWwnSnpVdOZIhFMl/g==", + "dependencies": { + "atomic-sleep": "^1.0.0" } }, "node_modules/restify/node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], "bin": { - "uuid": "bin/uuid" + "uuid": "dist/bin/uuid" } }, "node_modules/ret": { @@ -3107,6 +3449,16 @@ "rimraf": "bin.js" } }, + "node_modules/rimraf/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "optional": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/rimraf/node_modules/glob": { "version": "6.0.4", "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", @@ -3123,24 +3475,22 @@ "node": "*" } }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "optional": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, "node_modules/safe-json-stringify": { "version": "1.2.0", @@ -3156,6 +3506,14 @@ "ret": "~0.2.0" } }, + "node_modules/safe-stable-stringify": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", + "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", + "engines": { + "node": ">=10" + } + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -3206,29 +3564,24 @@ "node": ">=10" } }, - "node_modules/semver/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, "node_modules/send": { - "version": "0.17.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz", - "integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==", + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", + "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", "dependencies": { "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", + "depd": "2.0.0", + "destroy": "1.2.0", "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "0.5.2", - "http-errors": "1.8.1", + "http-errors": "2.0.0", "mime": "1.6.0", "ms": "2.1.3", - "on-finished": "~2.3.0", + "on-finished": "2.4.1", "range-parser": "~1.2.1", - "statuses": "~1.5.0" + "statuses": "2.0.1" }, "engines": { "node": ">= 0.8.0" @@ -3247,10 +3600,13 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, - "node_modules/send/node_modules/destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha512-3NdhDuEXnfun/z7x9GOElY49LoqVHoGScmOKwmxhsS8N5Y+Z8KyPPDnaSzqWgYt/ji4mqwfTS34Htrk0zPIXVg==" + "node_modules/send/node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } }, "node_modules/send/node_modules/mime": { "version": "1.6.0", @@ -3268,6 +3624,17 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, + "node_modules/send/node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/serialize-javascript": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", @@ -3278,14 +3645,14 @@ } }, "node_modules/serve-static": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz", - "integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==", + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", + "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", "dependencies": { "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.17.2" + "send": "0.18.0" }, "engines": { "node": ">= 0.8.0" @@ -3305,7 +3672,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dev": true, "dependencies": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", @@ -3443,20 +3809,17 @@ } }, "node_modules/statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", "engines": { - "node": ">= 0.6" + "node": ">= 0.8" } }, "node_modules/stream-transform": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/stream-transform/-/stream-transform-2.1.3.tgz", - "integrity": "sha512-9GHUiM5hMiCi6Y03jD2ARC1ettBXkQBoQAe7nJsPknnI0ow10aXjTnew8QtYQmLjzn974BnmWEAJgCY6ZP1DeQ==", - "dependencies": { - "mixme": "^0.5.1" - } + "version": "3.2.8", + "resolved": "https://registry.npmjs.org/stream-transform/-/stream-transform-3.2.8.tgz", + "integrity": "sha512-NUx0mBuI63KbNEEh9Yj0OzKB7iMOSTpkuODM2G7By+TTVihEIJ0cYp5X+pq/TdJRlsznt6CYR8HqxexyC6/bTw==" }, "node_modules/string_decoder": { "version": "1.3.0", @@ -3466,6 +3829,25 @@ "safe-buffer": "~5.2.0" } }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/string-similarity": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/string-similarity/-/string-similarity-4.0.4.tgz", @@ -3554,6 +3936,18 @@ "url": "https://ko-fi.com/tunnckoCore/commissions" } }, + "node_modules/superagent/node_modules/mime": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", + "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", + "dev": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/superagent/node_modules/qs": { "version": "6.11.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", @@ -3594,6 +3988,14 @@ "node": ">=8" } }, + "node_modules/thread-stream": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-2.4.0.tgz", + "integrity": "sha512-xZYtOtmnA63zj04Q+F9bdEay5r47bvpo1CaNqsKi7TpoJHcotUez8Fkfo2RJWpW91lnnaApdpRbVwCWsy+ifcw==", + "dependencies": { + "real-require": "^0.2.0" + } + }, "node_modules/timestring": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/timestring/-/timestring-6.0.0.tgz", @@ -3811,9 +4213,9 @@ } }, "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/yargs": { "version": "16.2.0", diff --git a/package.json b/package.json index 959d014..b1d205c 100644 --- a/package.json +++ b/package.json @@ -34,26 +34,26 @@ "author": "Jonathan Goldfarb ", "license": "MIT", "dependencies": { + "@fastify/basic-auth": "3.0.2", "@koa/router": "10.1.1", "body-parser": "1.19.2", "bunyan": "1.8.15", - "express": "^4.17.3", - "express-basic-auth": "^1.2.1", - "fastify": "^3.27.4", - "fastify-basic-auth": "^2.2.0", - "koa": "^2.13.4", - "koa-basic-auth": "^4.0.0", - "koa-body": "^4.2.0", - "nconf": "^0.11.3", + "express": "4.19.2", + "express-basic-auth": "1.2.1", + "fastify": "3.29.5", + "koa": "2.15.3", + "koa-basic-auth": "4.0.0", + "koa-body": "4.2.0", + "nconf": "0.11.4", "pg": "8.7.3", - "restify": "^8.6.1", - "restify-errors": "^8.0.2" + "restify": "11.1.0", + "restify-errors": "8.0.2" }, "devDependencies": { "autocannon": "7.7.1", "chai": "4.3.6", - "mocha": "^10.0.0", - "nodemon": "^3.0.0", + "mocha": "10.2.0", + "nodemon": "3.0.1", "sinon": "13.0.1", "sqlutils": "1.4.0", "supertest": "6.2.2" diff --git a/src/express.spec.js b/src/express.spec.js index 1ef62cc..e50baf0 100644 --- a/src/express.spec.js +++ b/src/express.spec.js @@ -37,9 +37,9 @@ function generateArray(length = 10, generator = (n) => { return n + 1; }) { } describe('Acronym API - Express', () => { if (live_pg_server) { - console.log('Testing against live PostgreSQL server'); + console.log('Testing against live PostgreSQL server, express'); } else { - console.log('Testing with PostgreSQL DB mocks'); + console.log('Testing with PostgreSQL DB mocks, express'); } let server; if (live_node_server) { @@ -48,7 +48,6 @@ describe('Acronym API - Express', () => { server = `http://localhost:${PORT}`; console.log(`Testing against live Node.JS server at ${server}`); } else { - // include server from index.js server = require('./express'); console.log('Testing against server created in specfile'); } diff --git a/src/fastify.spec.js b/src/fastify.spec.js index 50f50fc..9fd55e9 100644 --- a/src/fastify.spec.js +++ b/src/fastify.spec.js @@ -30,10 +30,8 @@ const { Pool } = require('pg'); // npm run --test_live_node_server=true test const _live_node_server = process.env?.npm_config_test_live_node_server || 'false'; const live_node_server = _live_node_server ? _live_node_server === 'true' : false; -// include server from index.js const server = require('./fastify'); - // usage: // const t = generateArray(); // const v = generateArray(10, (n) => {return {value: n};}); @@ -42,12 +40,12 @@ function generateArray(length = 10, generator = (n) => { return n + 1; }) { } describe('Acronym API - Fastify', () => { if (live_pg_server) { - console.log('Testing against live PostgreSQL server'); + console.log('Testing against live PostgreSQL server, fastify'); } if (live_node_server) { console.log(`Testing against live Node.JS server not supported for Fastify impl`); } - console.log('Testing against server created in specfile'); + console.log('Testing against server created in specfile, fastify'); after((done) => { setTimeout(function(){process.exit(0);},1000); diff --git a/src/index.js b/src/index.js index eab46ea..a22912c 100755 --- a/src/index.js +++ b/src/index.js @@ -24,7 +24,6 @@ const server = restify.createServer({ server.pre(restify.plugins.requestLogger({ log: log, - serializers: restify.bunyan.serializers })); server.use(restify.plugins.queryParser()); server.use(restify.plugins.authorizationParser()); @@ -36,10 +35,6 @@ server.use(restify.plugins.bodyParser()); server.post('/acronym', routes.Post); server.put('/acronym/:acronym', routes.Put); -server.listen(parseInt(config.conf.get('PORT')), function() { - console.log('%s listening at %s', server.name, server.url); -}); - // the pool will emit an error on behalf of any idle clients // it contains if a backend error or network partition happens db.pool.on('error', (err, client) => { @@ -75,4 +70,15 @@ server.on('uncaughtException', handleError); // any other error (fallthru) server.on('restifyError', handleError); + +// run server if used as a module on the command line +if (require.main === module) { + server.listen(parseInt(config.conf.get('PORT')), function() { + console.log('%s listening at %s', server.name, server.url); + }); + + process.on('SIGINT', doClose); + process.on('exit', doClose); +} + module.exports = server; diff --git a/src/index.spec.js b/src/index.spec.js index d5d1e4f..062940a 100755 --- a/src/index.spec.js +++ b/src/index.spec.js @@ -20,11 +20,7 @@ const request = require('supertest'); // npm run --test_live_pg_server=true test const _live_pg_server = process.env?.npm_config_test_live_pg_server || 'false'; const live_pg_server = _live_pg_server ? _live_pg_server === 'true' : false; -if (live_pg_server) { - console.log('Testing against live PostgreSQL server'); -} else { - console.log('Testing with PostgreSQL DB mocks'); -} + // include object to be mocked when not using live server const { Pool } = require('pg'); @@ -34,16 +30,9 @@ const { Pool } = require('pg'); const _live_node_server = process.env?.npm_config_test_live_node_server || 'false'; const live_node_server = _live_node_server ? _live_node_server === 'true' : false; let server; -if (live_node_server) { - const config = require('./config'); - const PORT = config.conf.get('PORT'); - server = `http://localhost:${PORT}`; - console.log(`Testing against live Node.JS server at ${server}`); -} else { - // include server from index.js - server = require('./index'); - console.log('Testing against server created in specfile'); -} + +const config = require('./config'); + // usage: // const t = generateArray(); // const v = generateArray(10, (n) => {return {value: n};}); @@ -51,6 +40,20 @@ function generateArray(length = 10, generator = (n) => { return n + 1; }) { return Array.from({ length: length }, (_, i) => generator(i)); } describe('Acronym API', () => { + if (live_pg_server) { + console.log('Testing against live PostgreSQL server, index'); + } else { + console.log('Testing with PostgreSQL DB mocks, index'); + } + if (live_node_server) { + const PORT = config.conf.get('PORT'); + server = `http://localhost:${PORT}`; + console.log(`Testing against live Node.JS server at ${server}`); + } else { + // include server from index.js + server = require('./index'); + console.log('Testing against server created in specfile'); + } after((done) => { try { if (!live_node_server) { diff --git a/src/koa.spec.js b/src/koa.spec.js index 198fa52..cbdb692 100644 --- a/src/koa.spec.js +++ b/src/koa.spec.js @@ -37,9 +37,9 @@ function generateArray(length = 10, generator = (n) => { return n + 1; }) { } describe('Acronym API - Koa', () => { if (live_pg_server) { - console.log('Testing against live PostgreSQL server'); + console.log('Testing against live PostgreSQL server, koa'); } else { - console.log('Testing with PostgreSQL DB mocks'); + console.log('Testing with PostgreSQL DB mocks, koa'); } let server; before((done) => { @@ -49,7 +49,6 @@ describe('Acronym API - Koa', () => { server = `http://localhost:${PORT}`; console.log(`Testing against live Node.JS server at ${server}`); } else { - // include server from index.js server = require('./koa'); console.log('Testing against server created in specfile'); } diff --git a/src/plain.spec.js b/src/plain.spec.js index f016c21..3acb5a3 100644 --- a/src/plain.spec.js +++ b/src/plain.spec.js @@ -37,9 +37,9 @@ function generateArray(length = 10, generator = (n) => { return n + 1; }) { } describe('Acronym API - Plain HTTP', () => { if (live_pg_server) { - console.log('Testing against live PostgreSQL server'); + console.log('Testing against live PostgreSQL server, plain'); } else { - console.log('Testing with PostgreSQL DB mocks'); + console.log('Testing with PostgreSQL DB mocks, plain'); } let server; if (live_node_server) { @@ -48,7 +48,6 @@ describe('Acronym API - Plain HTTP', () => { server = `http://localhost:${PORT}`; console.log(`Testing against live Node.JS server at ${server}`); } else { - // include server from index.js server = require('./plain'); console.log('Testing against server created in specfile'); } diff --git a/src/restify.js b/src/restify.js index b5b0c32..28472dc 100644 --- a/src/restify.js +++ b/src/restify.js @@ -105,7 +105,6 @@ if (require.main === module) { process.on('SIGINT', doClose); process.on('exit', doClose); - } module.exports = server; diff --git a/src/restify.spec.js b/src/restify.spec.js index fce1f9c..c83537d 100644 --- a/src/restify.spec.js +++ b/src/restify.spec.js @@ -38,9 +38,9 @@ function generateArray(length = 10, generator = (n) => { return n + 1; }) { } describe('Acronym API - Restify', () => { if (live_pg_server) { - console.log('Testing against live PostgreSQL server'); + console.log('Testing against live PostgreSQL server, restify'); } else { - console.log('Testing with PostgreSQL DB mocks'); + console.log('Testing with PostgreSQL DB mocks, restify'); } let server; if (live_node_server) { @@ -49,7 +49,6 @@ describe('Acronym API - Restify', () => { server = `http://localhost:${PORT}`; console.log(`Testing against live Node.JS server at ${server}`); } else { - // include server from index.js server = require('./restify'); console.log('Testing against server created in specfile'); } diff --git a/src/routes.fastify.js b/src/routes.fastify.js index 567e538..8c43459 100644 --- a/src/routes.fastify.js +++ b/src/routes.fastify.js @@ -8,7 +8,7 @@ const API_PASSWORD = config.conf.get('API_PASSWORD'); const db = require('./db'); // Basic Authentication - https://github.com/fastify/fastify-basic-auth -const auth = require('fastify-basic-auth'); +const auth = require('@fastify/basic-auth'); function validate(username, password, req, reply, done) { if (username === 'anonymous' || diff --git a/src/routes.js b/src/routes.js index f312024..55e1021 100755 --- a/src/routes.js +++ b/src/routes.js @@ -12,8 +12,7 @@ let dbConnected = false; const API_USER = config.conf.get('API_USER'); const API_PASSWORD = config.conf.get('API_PASSWORD'); -async function Get(req, res, next) { - try { +async function Get(req, res) { const from = parseInt(req.query?.from || '0'); const limit = parseInt(req.query?.limit || '10'); const search = req.query?.search || ''; @@ -30,15 +29,9 @@ async function Get(req, res, next) { } res.send(results.rows); - return next(); - } catch (err) { - console.log(err); - return next(err); - } } -async function Post(req, res, next) { - try { +async function Post(req, res) { const name = req.body?.name || null; const description = req.body?.description || null; // Validate name and description @@ -46,23 +39,18 @@ async function Post(req, res, next) { res.status(400); const message = name ? 'Missing "description"' : 'Missing "name"'; res.send(message); - return next(); + return } const result = await db.insertAcronym(name, description); res.send(result); - return next(); - } catch (err) { - return next(err); - } } -async function Put(req, res, next) { - try { +async function Put(req, res) { // check if user passed valid authentication header if (req.username === 'anonymous' || req.username !== API_USER || req.authorization.basic.password !== API_PASSWORD) { - return next(new errors.UnauthorizedError()); + throw errors.UnauthorizedError(); } const newName = req.params.acronym || null; const oldName = req.body?.name || newName; @@ -75,36 +63,27 @@ async function Put(req, res, next) { } else { res.send('Missing "description" in body'); } - return next(); + return } const result = await db.upsertAcronym(oldName, newName, description); res.send(result); - return next(); - } catch (err) { - next(err); - } } -async function Delete(req, res, next) { - try { +async function Delete(req, res) { // check if user passed valid authentication header if (req.username === 'anonymous' || req.username !== API_USER || req.authorization.basic.password !== API_PASSWORD) { - return next(new errors.UnauthorizedError()); + throw errors.UnauthorizedError(); } const acronym = req.params?.acronym || null; if (!acronym) { res.status(400); res.send('Missing parameter "acronym"'); - return next(); + return } const result = await db.deleteAcronym(acronym); res.send(result); - return next(); - } catch (err) { - return next(err); - } } module.exports = { diff --git a/src/routes.restify.js b/src/routes.restify.js index 4acb069..c19d643 100644 --- a/src/routes.restify.js +++ b/src/routes.restify.js @@ -11,105 +11,101 @@ const errors = require('restify-errors'); const API_USER = config.conf.get('API_USER'); const API_PASSWORD = config.conf.get('API_PASSWORD'); -async function Health(req, res, next) { +function Health(req, res, next) { res.send({message: 'ok'}); return next(); } -async function Get(req, res, next) { - try { - const from = parseInt(req.query?.from || '0'); - const limit = parseInt(req.query?.limit || '10'); - const search = req.query?.search || ''; +function Get(req, res, next) { + const from = parseInt(req.query?.from || '0'); + const limit = parseInt(req.query?.limit || '10'); + const search = req.query?.search || ''; + let _count; - const count = await db.countAcronyms(from, search); - const results = await db.getAcronyms(from, limit, search); + return db.countAcronyms(from, search).then(count => { + if (count && Array.isArray(count?.rows) && count.rows.length) { + _count = count.rows[0].result_count; + return db.getAcronyms(from, limit, search); + } else { + return null; + } + }).then(results => { + if (!results || !Array.isArray(results?.rows) || !results.rows.length) { + res.send([]); + return next(); + } - // req.log.info(results); - // Create Link header when there are more results const nResults = results.rows.length; - if (nResults < count.rows[0].result_count) { + // Create Link header when there are more results + if (nResults < _count) { const fromId = results.rows[nResults - 1].acronym_id; const nextLink = search ? `/acronym/?from=${fromId}&limit=${limit}&search=${search}` : `/acronym/?from=${fromId}&limit=${limit}`; res.link(nextLink, 'next'); } - // req.log.info('Made it here'); res.send(results.rows); return next(); - } catch (err) { - return next(err); - } + }).catch(e => next(e)); } -async function Post(req, res, next) { - try { - const name = req.body?.name || null; - const description = req.body?.description || null; - // Validate name and description - if (!name || !description) { - res.status(400); - const message = name ? 'Missing "description"' : 'Missing "name"'; - res.send(message); - return next(); - } - const result = await db.insertAcronym(name, description); - res.send(result); +function Post(req, res, next) { + const name = req.body?.name || null; + const description = req.body?.description || null; + // Validate name and description + if (!name || !description) { + res.status(400); + const message = name ? 'Missing "description"' : 'Missing "name"'; + res.send(message); return next(); - } catch (err) { - return next(err); } + return db.insertAcronym(name, description).then(result => { + res.send(result); + return next(); + }).catch(e => next(e)); } -async function Put(req, res, next) { - try { - // check if user passed valid authentication header - if (req.username === 'anonymous' || - req.username !== API_USER || - req.authorization.basic.password !== API_PASSWORD) { - return next(new errors.UnauthorizedError()); - } - const newName = req.params.acronym || null; - const oldName = req.body?.name || newName; - const description = req.body?.description || null; - // Validate name and description - if (!newName || !description) { - res.status(400); - if (!description) { - res.send('Missing "name" parameter or body'); - } else { - res.send('Missing "description" in body'); - } - return next(); +function Put(req, res, next) { + // check if user passed valid authentication header + if (req.username === 'anonymous' || + req.username !== API_USER || + req.authorization.basic.password !== API_PASSWORD) { + return next(new errors.UnauthorizedError()); + } + const newName = req.params.acronym || null; + const oldName = req.body?.name || newName; + const description = req.body?.description || null; + // Validate name and description + if (!newName || !description) { + res.status(400); + if (!description) { + res.send('Missing "name" parameter or body'); + } else { + res.send('Missing "description" in body'); } - - const result = await db.upsertAcronym(oldName, newName, description); - res.send(result); return next(); - } catch (err) { - next(err); } -} -async function Delete(req, res, next) { - try { - // check if user passed valid authentication header - if (req.username === 'anonymous' || - req.username !== API_USER || - req.authorization.basic.password !== API_PASSWORD) { - return next(new errors.UnauthorizedError()); - } - const acronym = req.params?.acronym || null; - if (!acronym) { - res.status(400); - res.send('Missing parameter "acronym"'); - return next(); - } - const result = await db.deleteAcronym(acronym); + return db.upsertAcronym(oldName, newName, description).then(result => { res.send(result); return next(); - } catch (err) { - return next(err); + }).catch(e => next(e)); +} +function Delete(req, res, next) { + // check if user passed valid authentication header + if (req.username === 'anonymous' || + req.username !== API_USER || + req.authorization.basic.password !== API_PASSWORD) { + return next(new errors.UnauthorizedError()); + } + const acronym = req.params?.acronym || null; + if (!acronym) { + res.status(400); + res.send('Missing parameter "acronym"'); + return next(); } + db.deleteAcronym(acronym).then(result => { + res.send(result); + return next(); + }).catch(e => next(e)); } module.exports = {