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:
fail-fast: true
matrix:
slug:
slug:
[
balena_os/aarch64-supervisor,
balena_os/amd64-supervisor,
@ -65,5 +65,3 @@ jobs:
environment: balena-staging.com
versionbot: false # ignore versionbot branch since the flowzone source is already versioned
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
###################################################
FROM balenalib/${ARCH}-alpine-node:14-run as build-base
FROM balenalib/${ARCH}-alpine-node:16-run as build-base
ARG PREFIX
# Sanity check to prevent a prefix for a non-official docker image being

View File

@ -1,5 +1,7 @@
#!/bin/sh
set -ex
DEBIAN=libdbus-1-dev
OSX=dbus
@ -15,8 +17,8 @@ elif command -v brew > /dev/null; then
else
echo "Neither 'brew' nor 'apt' are available to this system.
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
available to your system and run 'npm ci --ignore-scripts' to continue."
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",
"sync": "ts-node --files sync/sync.ts",
"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,
"dependencies": {
@ -36,8 +37,8 @@
"systeminformation": "^5.6.10"
},
"engines": {
"node": "^14.20.0",
"npm": "^6.14.4"
"node": "^16.17.0",
"npm": "^8.15.0"
},
"devDependencies": {
"@balena/contrato": "^0.6.0",
@ -53,13 +54,13 @@
"@types/dbus": "^1.0.0",
"@types/dockerode": "^2.5.34",
"@types/event-stream": "^3.3.34",
"@types/express": "^4.17.3",
"@types/express": "^4.17.14",
"@types/lodash": "^4.14.159",
"@types/memoizee": "^0.4.4",
"@types/mocha": "^8.2.2",
"@types/mock-fs": "^4.13.0",
"@types/morgan": "^1.9.0",
"@types/node": "^14.18.28",
"@types/node": "^16.11.59",
"@types/request": "^2.48.5",
"@types/rewire": "^2.5.28",
"@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 {
// Check query for key
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;
}
@ -172,7 +177,7 @@ function getApiKeyFromRequest(req: express.Request): string | undefined {
// Check header for key
if (!authHeader) {
return undefined;
return;
}
// 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) => {
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;
return api.balenaBackend!.getDeviceHandler(req, res, _.noop);
});