Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
3acbea6
(IOT-1499) Added enrichment of lorawan devices if needed in payload d…
fcv-iteratorIt Sep 28, 2023
6e22d91
Changed vm package to isolated-vm (#221)
fcv-iteratorIt Dec 1, 2023
ccec407
Updated all vulnerable packages (#222)
fcv-iteratorIt Dec 1, 2023
0b321dc
Fixed kombit signout flow (#226)
fcv-iteratorIt Dec 4, 2023
f2cfb99
Added datatarget name and id to error message when failing (#223)
fcv-iteratorIt Dec 4, 2023
e8e0307
Changed validation types for gatewayId (#224)
fcv-iteratorIt Dec 4, 2023
9df686f
IOT-1486: Added email in use error text to updating user (#225)
fcv-iteratorIt Dec 4, 2023
85c6599
Changed logic of getOrgAdminEmails to always add global admin emails …
fcv-iteratorIt Dec 4, 2023
330e74e
Added better validation of IotDeviceType (#228)
fcv-iteratorIt Dec 4, 2023
b1ce226
IOT-1403: Enabled the new sortings for application table (#229)
fcv-iteratorIt Dec 4, 2023
b690c77
Extended iot-device table with chirpstack fields (#230)
fcv-iteratorIt Dec 4, 2023
d331f7b
IOT 1276: Changed gateways to exist in the local database (#231)
fcv-iteratorIt Dec 4, 2023
e28031b
Chirpstack update from V3 to V4 (#232)
augusthjerrild Dec 15, 2023
070e174
IOT-1420: Api-key auth in swagger ui (#233)
fcv-iteratorIt Dec 15, 2023
d7c140b
Fixed missed controllers
fcv-iteratorIt Dec 15, 2023
783ec99
IOT-1276: Implemented sorting for gateway table (#234)
fcv-iteratorIt Dec 18, 2023
95f031e
Minor fixes for the chirpstack V4 update. (#235)
augusthjerrild Jan 10, 2024
b949146
Feature/feedback changes (#236)
augusthjerrild Jan 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/on-push-pr.action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/setup-node@v3
name: Set NodeJS version
with:
node-version: 14
node-version: 16
- name: Install packages
run: "npm ci"
- name: Build source
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
trailingComma: "es5",
tabWidth: 4,
printWidth: 90,
printWidth: 120,
semi: true,
singleQuote: false,
useTabs: false,
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# from: https://github.com/Saluki/nestjs-template
FROM node:12-alpine as builder
FROM node:16-alpine as builder

ENV NODE_ENV build

Expand Down
26,387 changes: 8,614 additions & 17,773 deletions package-lock.json

Large diffs are not rendered by default.

39 changes: 25 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"typeorm-e2e": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config ./ormconfig-e2e.json"
},
"dependencies": {
"@nestjs/axios": "^2.0.0",
"@nestjs/axios": "^3.0.0",
"@chirpstack/chirpstack-api": "4.6.0",
"@grpc/grpc-js": "^1.9.13",
"@nestjs/common": "^9.1.2",
"@nestjs/config": "^2.2.0",
"@nestjs/core": "^9.1.2",
Expand All @@ -41,15 +43,15 @@
"@nestjs/swagger": "^6.1.2",
"@nestjs/typeorm": "^9.0.1",
"@types/bcryptjs": "^2.4.2",
"@types/geojson": "^7946.0.7",
"@types/geojson": "^7946.0.13",
"@types/kafkajs": "^1.9.0",
"@types/passport-saml": "^1.1.3",
"@types/pem": "^1.9.6",
"@types/uuid": "^8.3.0",
"@types/ws": "^8.5.3",
"@types/xml2js": "^0.4.7",
"@types/xml2js": "^0.4.14",
"ajv": "^6.12.6",
"axios": "^1.3.3",
"axios": "^1.6.1",
"axios-cache-adapter": "^2.7.3",
"bcryptjs": "^2.4.3",
"bluebird": "^3.7.2",
Expand All @@ -58,7 +60,8 @@
"class-validator": "^0.14.0",
"compression": "^1.7.4",
"cookie-parser": "^1.4.5",
"crypto-js": "^4.1.1",
"crypto-js": "^4.2.0",
"isolated-vm": "^4.6.0",
"kafkajs": "^2.2.4",
"lodash": "^4.17.20",
"mqtt": "^4.3.7",
Expand All @@ -71,18 +74,17 @@
"passport-saml": "^3.2.4",
"pem": "^1.14.7",
"pg": "^8.5.1",
"protobufjs": "^6.11.3",
"protobufjs": "^6.11.4",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.5.7",
"swagger-ui-express": "^4.1.5",
"typeorm": "^0.3.10",
"uuid": "^8.3.2",
"vm2": "^3.9.18",
"wait-for-expect": "^3.0.2"
},
"devDependencies": {
"@nestjs/cli": "^9.1.4",
"@nestjs/cli": "^9.3.0",
"@nestjs/testing": "^9.1.2",
"@types/bcryptjs": "^2.4.2",
"@types/bluebird": "^3.5.33",
Expand All @@ -92,7 +94,7 @@
"@types/cron": "^1.7.2",
"@types/crypto-js": "^4.1.1",
"@types/express": "^4.17.9",
"@types/geojson": "^7946.0.7",
"@types/geojson": "^7946.0.13",
"@types/kafkajs": "^1.9.0",
"@types/lodash": "^4.14.165",
"@types/node": "^14.14.14",
Expand All @@ -104,16 +106,25 @@
"@types/uuid": "^8.3.0",
"@types/validator": "^13.7.1",
"@types/ws": "^8.5.3",
"@types/xml2js": "^0.4.7",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"@types/xml2js": "^0.4.14",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"eslint": "^8.24.0",
"eslint-config-prettier": "^7.0.0",
"jest": "26.6.3",
"jest": "^29.7.0",
"prettier": "^2.2.1",
"supertest": "^6.0.1",
"ts-jest": "^26.4.4",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^4.8.3"
},
"overrides": {
"@babel/traverse": "^7.23.2",
"webpack": "^5.89.0",
"axios": "^1.6.1",
"xml2js": "^0.6.2",
"jsonwebtoken": "^9.0.0",
"debug": "^4.3.4",
"y18n": "6.0.0-alpha.0"
}
}
18 changes: 11 additions & 7 deletions resources/chirpstack-state.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ package gw;

// ConnState contains the connection state of a gateway.
message ConnState {
// Gateway ID.
bytes gateway_id = 1 [json_name = "gatewayID"];
// Gateway ID.
// Deprecated: use gateway_id.
bytes gateway_id_legacy = 1;

enum State {
OFFLINE = 0;
ONLINE = 1;
}
// Gateway ID.
string gateway_id = 3;

State state = 2;
enum State {
OFFLINE = 0;
ONLINE = 1;
}

State state = 2;
}
6 changes: 6 additions & 0 deletions src/auth/swagger-auth-decorator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { applyDecorators } from "@nestjs/common";
import { ApiBearerAuth, ApiSecurity } from "@nestjs/swagger";

export function ApiAuth() {
return applyDecorators(ApiBearerAuth(), ApiSecurity("X-API-KEY"));
}
24 changes: 9 additions & 15 deletions src/config/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,23 @@ export default (): any => {
expiresIn: process.env.JWT_EXPIRESIN || "9h",
},
backend: {
baseurl:
process.env.BACKEND_BASEURL || "https://test-os2iot-backend.os2iot.dk",
deviceStatsIntervalInDays:
parseInt(process.env.DEVICE_STATS_INTERVAL_IN_DAYS, 10) || 29,
baseurl: process.env.BACKEND_BASEURL || "https://localhost:3000",
deviceStatsIntervalInDays: parseInt(process.env.DEVICE_STATS_INTERVAL_IN_DAYS, 10) || 29,
},
kombit: {
entryPoint:
process.env.KOMBIT_ENTRYPOINT ||
"https://adgangsstyring.eksterntest-stoettesystemerne.dk/runtime/saml2/issue.idp",
"https://adgangsstyring.eksterntest-stoettesystemerne.dk/runtime/saml2/issue.idp",
certificatePublicKey: process.env.KOMBIT_CERTIFICATEPUBLICKEY || "INSERT_KOMBIT_CERT", // Public certificate from Kombit Test server
certificatePrivateKey: process.env.KOMBIT_CERTIFICATEPRIVATEKEY || null,
roleUri:
process.env.KOMBIT_ROLE_NAME ||
"http://os2iot.dk/roles/usersystemrole/adgang/",
roleUri: process.env.KOMBIT_ROLE_NAME || "http://os2iot.dk/roles/usersystemrole/adgang/",
},
chirpstack: {
jwtsecret: process.env.CHIRPSTACK_JWTSECRET || "verysecret",
apikey: process.env.CHIRPSTACK_API_KEY || "apikey",
hostname: process.env.CHIRPSTACK_HOSTNAME || "localhost",
port: process.env.CHIRPSTACK_PORT || 8080,
},
logLevels: process.env.LOG_LEVEL
? GetLogLevels(process.env.LOG_LEVEL)
: GetLogLevels("debug"),
logLevels: process.env.LOG_LEVEL ? GetLogLevels(process.env.LOG_LEVEL) : GetLogLevels("debug"),
email: {
host: process.env.EMAIL_HOST || "smtp.ethereal.email",
port: process.env.EMAIL_PORT || 587,
Expand All @@ -45,9 +41,7 @@ export default (): any => {
* Can be formatted to show a user-friendly name before the e-mail.
* E.g. "OS2iot <[email protected]>"
*/
from: process.env.EMAIL_FROM
? formatEmail(process.env.EMAIL_FROM)
: "OS2iot [email protected]",
from: process.env.EMAIL_FROM ? formatEmail(process.env.EMAIL_FROM) : "OS2iot [email protected]",
},
frontend: {
baseurl: process.env.FRONTEND_BASEURL || "http://localhost:8081",
Expand Down
Loading