Update to nodejs 16

Change-type: minor
This commit is contained in:
Pagan Gazzard 2022-09-16 16:59:38 +01:00
parent 7c6eadbb6c
commit 5518eb17bd
8 changed files with 16941 additions and 176 deletions

View File

@ -31,7 +31,7 @@ jobs:
strategy: strategy:
fail-fast: true fail-fast: true
matrix: matrix:
slug: slug:
[ [
balena_os/aarch64-supervisor, balena_os/aarch64-supervisor,
balena_os/amd64-supervisor, balena_os/amd64-supervisor,
@ -65,5 +65,3 @@ jobs:
environment: balena-staging.com environment: balena-staging.com
versionbot: false # ignore versionbot branch since the flowzone source is already versioned versionbot: false # ignore versionbot branch since the flowzone source is already versioned
source: . source: .

1
.npmrc Normal file
View File

@ -0,0 +1 @@
legacy-peer-deps=true

View File

@ -8,7 +8,7 @@ ARG PREFIX=library
################################################### ###################################################
# Build the supervisor dependencies # Build the supervisor dependencies
################################################### ###################################################
FROM balenalib/${ARCH}-alpine-node:14-run as build-base FROM balenalib/${ARCH}-alpine-node:16-run as build-base
ARG PREFIX ARG PREFIX
# Sanity check to prevent a prefix for a non-official docker image being # Sanity check to prevent a prefix for a non-official docker image being

View File

@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
set -ex
DEBIAN=libdbus-1-dev DEBIAN=libdbus-1-dev
OSX=dbus OSX=dbus
@ -15,8 +17,8 @@ elif command -v brew > /dev/null; then
else else
echo "Neither 'brew' nor 'apt' are available to this system. echo "Neither 'brew' nor 'apt' are available to this system.
Please make sure Supervisor development is done on Linux, OSX, or WSL2, Please make sure Supervisor development is done on Linux, OSX, or WSL2,
and that one of the above package managers is installed. If using a and that one of the above package managers is installed. If using a
Linux distro without 'apt', please install the dbus development lib Linux distro without 'apt', please install the dbus development lib
available to your system and run 'npm ci --ignore-scripts' to continue." available to your system and run 'npm ci --ignore-scripts' to continue."
exit 0 exit 0
fi fi

17083
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,8 @@
"release": "tsc --project tsconfig.release.json && mv build/src/* build", "release": "tsc --project tsconfig.release.json && mv build/src/* build",
"sync": "ts-node --files sync/sync.ts", "sync": "ts-node --files sync/sync.ts",
"clean": "rimraf build", "clean": "rimraf build",
"preinstall": "./build-utils/install-dbus.sh || true" "install-native-deps": "./build-utils/install-dbus.sh",
"flowzone-preinstall": "npm run install-native-deps"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
@ -36,8 +37,8 @@
"systeminformation": "^5.6.10" "systeminformation": "^5.6.10"
}, },
"engines": { "engines": {
"node": "^14.20.0", "node": "^16.17.0",
"npm": "^6.14.4" "npm": "^8.15.0"
}, },
"devDependencies": { "devDependencies": {
"@balena/contrato": "^0.6.0", "@balena/contrato": "^0.6.0",
@ -53,13 +54,13 @@
"@types/dbus": "^1.0.0", "@types/dbus": "^1.0.0",
"@types/dockerode": "^2.5.34", "@types/dockerode": "^2.5.34",
"@types/event-stream": "^3.3.34", "@types/event-stream": "^3.3.34",
"@types/express": "^4.17.3", "@types/express": "^4.17.14",
"@types/lodash": "^4.14.159", "@types/lodash": "^4.14.159",
"@types/memoizee": "^0.4.4", "@types/memoizee": "^0.4.4",
"@types/mocha": "^8.2.2", "@types/mocha": "^8.2.2",
"@types/mock-fs": "^4.13.0", "@types/mock-fs": "^4.13.0",
"@types/morgan": "^1.9.0", "@types/morgan": "^1.9.0",
"@types/node": "^14.18.28", "@types/node": "^16.11.59",
"@types/request": "^2.48.5", "@types/request": "^2.48.5",
"@types/rewire": "^2.5.28", "@types/rewire": "^2.5.28",
"@types/rimraf": "^2.0.4", "@types/rimraf": "^2.0.4",

View File

@ -164,6 +164,11 @@ function isEqualScope(a: Scope, b: Scope): boolean {
function getApiKeyFromRequest(req: express.Request): string | undefined { function getApiKeyFromRequest(req: express.Request): string | undefined {
// Check query for key // Check query for key
if (req.query.apikey) { if (req.query.apikey) {
if (typeof req.query.apikey !== 'string') {
// We were passed something as an api key but it wasn't a string
// so ignore it
return;
}
return req.query.apikey; return req.query.apikey;
} }
@ -172,7 +177,7 @@ function getApiKeyFromRequest(req: express.Request): string | undefined {
// Check header for key // Check header for key
if (!authHeader) { if (!authHeader) {
return undefined; return;
} }
// Check authHeader with various schemes // Check authHeader with various schemes

View File

@ -53,7 +53,8 @@ api.get(/\/v6\/device\(uuid=%27([0-9a-f]+)%27\)/, (req, res) =>
); );
api.get(/\/v6\/device/, (req, res) => { api.get(/\/v6\/device/, (req, res) => {
const [, uuid] = /uuid eq '([0-9a-f]+)'/i.exec(req.query['$filter']) ?? []; const [, uuid] =
/uuid eq '([0-9a-f]+)'/i.exec(req.query['$filter'] as string) ?? [];
req.params[0] = uuid; req.params[0] = uuid;
return api.balenaBackend!.getDeviceHandler(req, res, _.noop); return api.balenaBackend!.getDeviceHandler(req, res, _.noop);
}); });