refactor: update all

This commit is contained in:
openstappsbot
2021-04-20 07:11:37 +00:00
committed by Rainer Killinger
parent df69bfd95f
commit 7424ad9831
5 changed files with 463 additions and 756 deletions

1167
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -33,30 +33,30 @@
}, },
"dependencies": { "dependencies": {
"@elastic/elasticsearch": "5.6.22", "@elastic/elasticsearch": "5.6.22",
"@openstapps/core": "0.44.0", "@openstapps/core": "0.45.0",
"@openstapps/core-tools": "0.18.0", "@openstapps/core-tools": "0.20.0",
"@openstapps/logger": "0.5.0", "@openstapps/logger": "0.5.0",
"@types/node": "14.14.37", "@types/node": "14.14.41",
"commander": "2.20.3", "commander": "7.2.0",
"config": "3.3.6", "config": "3.3.6",
"cors": "2.8.5", "cors": "2.8.5",
"express": "4.17.1", "express": "4.17.1",
"express-promise-router": "3.0.3", "express-promise-router": "4.1.0",
"fs-extra": "8.1.0", "fs-extra": "9.1.0",
"got": "9.6.0", "got": "11.8.2",
"moment": "2.29.1", "moment": "2.29.1",
"morgan": "1.10.0", "morgan": "1.10.0",
"nock": "13.0.11", "nock": "13.0.11",
"node-cache": "4.2.1", "node-cache": "5.1.2",
"node-cron": "2.0.3", "node-cron": "3.0.0",
"nodemailer": "6.5.0", "nodemailer": "6.5.0",
"promise-queue": "2.2.5", "promise-queue": "2.2.5",
"sanitize-filename": "1.6.3", "sanitize-filename": "1.6.3",
"ts-node": "8.10.2", "ts-node": "9.1.1",
"uuid": "3.4.0" "uuid": "8.3.2"
}, },
"devDependencies": { "devDependencies": {
"@openstapps/configuration": "0.26.0", "@openstapps/configuration": "0.27.0",
"@testdeck/mocha": "0.1.2", "@testdeck/mocha": "0.1.2",
"@types/chai": "4.2.16", "@types/chai": "4.2.16",
"@types/chai-as-promised": "7.1.3", "@types/chai-as-promised": "7.1.3",
@@ -64,28 +64,25 @@
"@types/cors": "2.8.10", "@types/cors": "2.8.10",
"@types/elasticsearch": "5.0.37", "@types/elasticsearch": "5.0.37",
"@types/express": "4.17.11", "@types/express": "4.17.11",
"@types/fs-extra": "7.0.0", "@types/fs-extra": "9.0.11",
"@types/got": "9.6.11",
"@types/mocha": "8.2.2", "@types/mocha": "8.2.2",
"@types/morgan": "1.9.2", "@types/morgan": "1.9.2",
"@types/nock": "10.0.3",
"@types/node-cache": "4.1.3",
"@types/node-cron": "2.0.3", "@types/node-cron": "2.0.3",
"@types/nodemailer": "6.4.1", "@types/nodemailer": "6.4.1",
"@types/promise-queue": "2.2.0", "@types/promise-queue": "2.2.0",
"@types/sinon-express-mock": "1.3.9", "@types/sinon-express-mock": "1.3.9",
"@types/supertest": "2.0.11", "@types/supertest": "2.0.11",
"@types/uuid": "3.4.9", "@types/uuid": "8.3.0",
"chai": "4.3.4", "chai": "4.3.4",
"chai-as-promised": "7.1.1", "chai-as-promised": "7.1.1",
"conventional-changelog-cli": "2.1.1", "conventional-changelog-cli": "2.1.1",
"get-port": "5.1.1", "get-port": "5.1.1",
"mocha": "8.3.2", "mocha": "8.3.2",
"mocked-env": "1.3.2", "mocked-env": "1.3.4",
"nyc": "15.1.0", "nyc": "15.1.0",
"prepend-file-cli": "1.0.6", "prepend-file-cli": "1.0.6",
"rimraf": "2.7.1", "rimraf": "3.0.2",
"sinon": "9.2.4", "sinon": "10.0.0",
"sinon-express-mock": "2.2.1", "sinon-express-mock": "2.2.1",
"supertest": "6.1.3", "supertest": "6.1.3",
"tslint": "6.1.3", "tslint": "6.1.3",

View File

@@ -41,13 +41,12 @@ export async function virtualPluginRoute(req: Request, plugin: SCPluginMetaData)
const pluginResponse = await got.post( const pluginResponse = await got.post(
plugin.route, plugin.route,
{ {
baseUrl: plugin.address, prefixUrl: plugin.address,
body: req.body, json: req.body,
json: true,
timeout: configFile.backend.externalRequestTimeout, timeout: configFile.backend.externalRequestTimeout,
}, },
); );
responseBody = pluginResponse.body; responseBody = JSON.parse(pluginResponse.body);
const responseValidation = validator.validate(responseBody, plugin.responseSchema); const responseValidation = validator.validate(responseBody, plugin.responseSchema);
if (responseValidation.errors.length > 0) { if (responseValidation.errors.length > 0) {
throw new SCValidationErrorResponse(responseValidation.errors, isTestEnvironment); throw new SCValidationErrorResponse(responseValidation.errors, isTestEnvironment);

View File

@@ -132,7 +132,7 @@ export class BulkStorage {
Logger.info('Bulk expires in ', expirationInSeconds, 'seconds'); Logger.info('Bulk expires in ', expirationInSeconds, 'seconds');
// save the item in the cache with it's expected expiration // save the item in the cache with it's expected expiration
await promisify<string, Bulk, number>(this.cache.set)(bulk.uid, bulk, expirationInSeconds); await promisify<string, Bulk, number, boolean>(this.cache.set)(bulk.uid, bulk, expirationInSeconds);
return bulk; return bulk;
} }

View File

@@ -21,7 +21,7 @@ import {
import {expect, use} from 'chai'; import {expect, use} from 'chai';
import chaiAsPromised from 'chai-as-promised'; import chaiAsPromised from 'chai-as-promised';
import {Request} from 'express'; import {Request} from 'express';
import got from 'got'; import got, { Options } from 'got';
import nock from 'nock'; import nock from 'nock';
import sinon from 'sinon'; import sinon from 'sinon';
import {mockReq} from 'sinon-express-mock'; import {mockReq} from 'sinon-express-mock';
@@ -80,8 +80,8 @@ describe('Virtual plugin routes', async function () {
await virtualPluginRoute(req, plugin); await virtualPluginRoute(req, plugin);
expect(gotStub.args[0][0]).to.equal(plugin.route); expect(gotStub.args[0][0]).to.equal(plugin.route);
expect(gotStub.args[0][1].baseUrl).to.equal(plugin.address); expect(((gotStub.args[0] as any)[1] as Options).prefixUrl).to.equal(plugin.address);
expect(gotStub.args[0][1].body).to.equal(req.body); expect(((gotStub.args[0] as any)[1] as Options).body).to.equal(req.body);
}); });
it('should provide data from the plugin when its route is called', async function () { it('should provide data from the plugin when its route is called', async function () {