fix: build

This commit is contained in:
2023-03-14 18:04:29 +01:00
parent 3792a14e90
commit fd740b3091
185 changed files with 21932 additions and 71486 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "@openstapps/backend",
"version": "1.0.0",
"description": "A reference implementation for a StApps backend",
"version": "2.1.0",
"license": "AGPL-3.0-only",
"author": "André Bierlein <andre.mt.bierlein@gmail.com>",
"contributors": [
@@ -18,9 +18,10 @@
"build": "npm run lint && npm run compile",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
"check-configuration": "openstapps-configuration",
"compile": "rimraf lib && tsc && prepend lib/cli.js '#!/usr/bin/env node\n'",
"compile": "rimraf lib && tsc",
"documentation": "typedoc --includeVersion --out docs --readme README.md --listInvalidSymbolLinks --entryPointStrategy expand src && openstapps-core-tools openapi ./node_modules/@openstapps/core/lib ./docs/openapi && openapi build-docs docs/openapi/openapi.json -o docs/openapi/index.html",
"version": "npm run changelog",
"lint": "eslint -c .eslintrc.json --ignore-path .eslintignore --ext .ts src/ test/",
"lint:fix": "eslint --fix -c .eslintrc.json --ignore-path .eslintignore --ext .ts src/ test/",
"prepublishOnly": "npm ci && npm run build",
"preversion": "npm run prepublishOnly",
"push": "git push && git push origin \"v$npm_package_version\"",
@@ -29,14 +30,14 @@
"test": "npm run test-unit && npm run test-integration",
"test-unit": "cross-env NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true STAPPS_LOG_LEVEL=0 nyc mocha --require ts-node/register --exit 'test/**/*.spec.ts'",
"test-integration": "docker-compose -f integration-test.yml pull && docker-compose -f integration-test.yml up --build --abort-on-container-exit --exit-code-from apicli",
"lint": "eslint -c .eslintrc.json --ignore-path .eslintignore --ext .ts src/ test/",
"lint:fix": "eslint --fix -c .eslintrc.json --ignore-path .eslintignore --ext .ts src/ test/"
"test-unit": "env NODE_CONFIG_ENV=elasticsearch ALLOW_NO_TRANSPORT=true STAPPS_LOG_LEVEL=0 nyc mocha --require ts-node/register --exit 'test/**/*.spec.ts'",
"version": "npm run changelog"
},
"dependencies": {
"@elastic/elasticsearch": "8.4.0",
"@openstapps/core": "1.0.1",
"@openstapps/core-tools": "0.34.0",
"@openstapps/logger": "1.1.1",
"@openstapps/core": "workspace:*",
"@openstapps/core-tools": "workspace:*",
"@openstapps/logger": "workspace:*",
"@redocly/cli": "1.0.0-beta.125",
"@types/node": "14.18.43",
"config": "3.3.9",
@@ -44,7 +45,7 @@
"express": "4.18.2",
"express-prom-bundle": "6.6.0",
"express-promise-router": "4.1.1",
"got": "11.8.6",
"got": "12.6.0",
"moment": "2.29.4",
"morgan": "1.10.0",
"nock": "13.3.1",
@@ -57,9 +58,9 @@
"uuid": "8.3.2"
},
"devDependencies": {
"@openstapps/configuration": "0.34.0",
"@openstapps/es-mapping-generator": "0.6.0",
"@openstapps/eslint-config": "1.1.0",
"@openstapps/configuration": "workspace:*",
"@openstapps/es-mapping-generator": "workspace:*",
"@openstapps/eslint-config": "workspace:*",
"@testdeck/mocha": "0.3.3",
"@types/chai": "4.3.4",
"@types/chai-as-promised": "7.1.5",
@@ -69,14 +70,15 @@
"@types/geojson": "1.0.6",
"@types/mocha": "10.0.1",
"@types/morgan": "1.9.4",
"@types/node": "18.15.3",
"@types/node-cron": "3.0.7",
"@types/nodemailer": "6.4.7",
"@types/promise-queue": "2.2.0",
"@types/sinon-express-mock": "1.3.9",
"@types/supertest": "2.0.12",
"@types/uuid": "8.3.4",
"@typescript-eslint/eslint-plugin": "5.42.0",
"@typescript-eslint/parser": "5.42.0",
"@typescript-eslint/eslint-plugin": "5.49.0",
"@typescript-eslint/parser": "5.49.0",
"chai": "4.3.7",
"chai-as-promised": "7.1.1",
"conventional-changelog-cli": "2.2.2",
@@ -85,14 +87,13 @@
"eslint-config-prettier": "8.8.0",
"eslint-plugin-jsdoc": "39.9.1",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-unicorn": "43.0.2",
"eslint-plugin-unicorn": "45.0.2",
"get-port": "5.1.1",
"mocha": "10.2.0",
"mocked-env": "1.3.5",
"nyc": "15.1.0",
"prepend-file-cli": "1.0.6",
"prettier": "2.8.8",
"rimraf": "3.0.2",
"rimraf": "4.4.0",
"sinon": "14.0.2",
"sinon-express-mock": "2.2.1",
"supertest": "6.3.3",

View File

@@ -1,3 +1,5 @@
#!/usr/bin/env node
/*
* Copyright (C) 2019 StApps
* This program is free software: you can redistribute it and/or modify
@@ -68,16 +70,19 @@ async function onError(error: {code: string; syscall: string}) {
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
case 'EACCES': {
await Logger.error(`${bind} requires elevated privileges`);
process.exit(1);
break;
case 'EADDRINUSE':
}
case 'EADDRINUSE': {
await Logger.error(`${bind} is already in use`);
process.exit(1);
break;
default:
}
default: {
throw error;
}
}
}
@@ -87,11 +92,11 @@ async function onError(error: {code: string; syscall: string}) {
function onListening() {
const addr = server.address();
if (addr !== null) {
if (addr === null) {
void Logger.error(`Failed to start binding`);
} else {
const bind = typeof addr === 'string' ? `pipe ${addr}` : `port ${addr.port}`;
Logger.ok(`Listening on ${bind}`);
} else {
void Logger.error(`Failed to start binding`);
}
}

View File

@@ -83,18 +83,18 @@ export class MailQueue {
throw new Error('Failed to initialize the SMTP transport for the mail queue');
}
if (!this.transport.isVerified()) {
this.verificationCounter++;
setTimeout(() => {
Logger.warn('Transport not verified yet. Trying to send mails here...');
this.checkForVerification();
}, MailQueue.VERIFICATION_TIMEOUT);
} else {
if (this.transport.isVerified()) {
Logger.ok('Transport for mail queue was verified. We can send mails now');
// if the transport finally was verified send all our mails from the dry queue
for (const mail of this.dryQueue) {
void this.addToQueue(mail);
}
} else {
this.verificationCounter++;
setTimeout(() => {
Logger.warn('Transport not verified yet. Trying to send mails here...');
this.checkForVerification();
}, MailQueue.VERIFICATION_TIMEOUT);
}
}
@@ -104,12 +104,12 @@ export class MailQueue {
* @param mail Information required for sending a mail
*/
public async push(mail: MailOptions) {
if (!this.transport.isVerified()) {
if (this.transport.isVerified()) {
await this.addToQueue(mail);
} else {
// the transport has verification, but is not verified yet
// push to a dry queue which gets pushed to the real queue when the transport is verified
this.dryQueue.push(mail);
} else {
await this.addToQueue(mail);
}
}
}

View File

@@ -47,10 +47,12 @@ export async function pluginRegisterHandler(
_app: Express.Application,
): Promise<SCPluginRegisterResponse> {
switch (request.action) {
case 'add':
case 'add': {
return addPlugin(request.plugin);
case 'remove':
}
case 'remove': {
return removePlugin(request.route);
}
}
}

View File

@@ -114,17 +114,21 @@ export async function setUp(
// make a schedule for each trigger
for (const trigger of watcher.triggers) {
switch (trigger.executionTime) {
case 'hourly':
case 'hourly': {
trigger.executionTime = '5 * * * *';
break;
case 'daily':
}
case 'daily': {
trigger.executionTime = '5 0 * * *';
break;
case 'weekly':
}
case 'weekly': {
trigger.executionTime = '5 0 * * 0';
break;
case 'monthly':
}
case 'monthly': {
trigger.executionTime = '5 0 1 * *';
}
}
cron.schedule(trigger.executionTime, async () => {

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,34 @@
{
"name": "@openstapps/proxy",
"version": "1.5.1",
"description": "NGINX proxy that is dynamically configured by a Node.js script",
"version": "2.1.0",
"license": "AGPL-3.0-only",
"repository": "git@gitlab.com:openstapps/proxy.git",
"author": "Anselm Rochus Stordeur <anselmstordeur@gmail.com>",
"contributors": [
"André Bierlein <andre.mt.bierlein@gmail.com>",
"Benjamin Joeckel",
"Jovan Krunic <jovan.krunic@gmail.com>",
"Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
"Michel Jonathan Schmitz <michel.schmitz_1992@hotmail.com>",
"Rainer Killinger <mail-openstapps@killinger.co>"
],
"main": "./lib/cli.js",
"scripts": {
"build": "npm run lint && npm run compile",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md && git commit -m 'docs: update changelog'",
"check-configuration": "openstapps-configuration",
"compile": "rimraf lib && tsc",
"documentation": "typedoc --includeVersion --out docs --readme README.md --entryPointStrategy expand src",
"lint": "eslint --ext .ts src/",
"postversion": "npm run changelog",
"prepublishOnly": "npm ci && npm run build",
"preversion": "npm run prepublishOnly",
"push": "git push && git push origin \"v$npm_package_version\"",
"test": "nyc mocha --require ts-node/register 'test/**/*.spec.ts'"
},
"dependencies": {
"@openstapps/logger": "1.1.1",
"@openstapps/logger": "workspace:*",
"@types/config": "3.3.0",
"@types/dockerode": "3.3.17",
"@types/node": "14.18.36",
@@ -17,66 +41,37 @@
"semver": "7.3.8"
},
"devDependencies": {
"@openstapps/configuration": "0.34.0",
"@openstapps/eslint-config": "1.1.0",
"@openstapps/configuration": "workspace:*",
"@openstapps/eslint-config": "workspace:*",
"@testdeck/mocha": "0.3.3",
"@types/chai": "4.3.5",
"@types/chai-spies": "1.0.3",
"@types/config": "3.3.0",
"@types/dockerode": "3.3.14",
"@types/mustache": "4.2.2",
"@types/node": "18.15.3",
"@types/proxyquire": "1.3.28",
"@typescript-eslint/eslint-plugin": "5.42.1",
"@typescript-eslint/parser": "5.42.1",
"@types/semver": "7.3.13",
"@types/sha1": "1.1.3",
"@typescript-eslint/eslint-plugin": "5.49.0",
"@typescript-eslint/parser": "5.49.0",
"chai": "4.3.7",
"chai-spies": "1.0.0",
"conventional-changelog-cli": "2.2.2",
"eslint": "8.31.0",
"eslint": "8.33.0",
"eslint-config-prettier": "8.6.0",
"eslint-plugin-jsdoc": "39.6.4",
"eslint-plugin-jsdoc": "39.7.4",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-unicorn": "44.0.2",
"eslint-plugin-unicorn": "45.0.2",
"mocha": "10.2.0",
"nyc": "15.1.0",
"prepend-file-cli": "1.0.6",
"prettier": "2.8.2",
"prettier": "2.8.3",
"proxyquire": "2.1.3",
"rimraf": "3.0.2",
"ts-node": "10.9.1",
"typedoc": "0.22.18",
"typescript": "4.4.4"
},
"scripts": {
"build": "npm run lint && npm run compile",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md && git commit -m 'docs: update changelog'",
"check-configuration": "openstapps-configuration",
"compile": "rimraf lib && tsc && prepend lib/cli.js '#!/usr/bin/env node\n'",
"documentation": "typedoc --includeVersion --out docs --readme README.md --entryPointStrategy expand src",
"lint": "eslint --ext .ts src/",
"postversion": "npm run changelog",
"prepublishOnly": "npm ci && npm run build",
"preversion": "npm run prepublishOnly",
"push": "git push && git push origin \"v$npm_package_version\"",
"test": "nyc mocha --require ts-node/register 'test/**/*.spec.ts'"
},
"repository": {
"type": "git",
"url": "git@gitlab.com:openstapps/proxy.git"
},
"author": "Anselm Rochus Stordeur <anselmstordeur@gmail.com>",
"contributors": [
"André Bierlein <andre.mt.bierlein@gmail.com>",
"Benjamin Joeckel",
"Jovan Krunic <jovan.krunic@gmail.com>",
"Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
"Michel Jonathan Schmitz <michel.schmitz_1992@hotmail.com>",
"Rainer Killinger <mail-openstapps@killinger.co>"
],
"license": "AGPL-3.0-only",
"openstappsConfiguration": {
"forPackaging": false,
"ignoreCiEntries": [
"package"
]
},
"nyc": {
"all": true,
"branches": 95,
@@ -99,5 +94,11 @@
"text-summary"
],
"statements": 95
},
"openstappsConfiguration": {
"forPackaging": false,
"ignoreCiEntries": [
"package"
]
}
}

View File

@@ -1,3 +1,5 @@
#!/usr/bin/env node
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify

View File

@@ -192,7 +192,6 @@ export async function generateUpstreamMap(
})
.join('\n');
// eslint-disable-next-line prettier/prettier
result += '\n\}';
if (!foundMatchingContainer) {