mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-19 08:02:55 +00:00
refactor: update all
This commit is contained in:
committed by
Rainer Killinger
parent
8cb4ee12a6
commit
26c14fa7e9
867
package-lock.json
generated
867
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@@ -16,7 +16,7 @@
|
||||
},
|
||||
"description": "Node.js library to interact with the StApps backend service",
|
||||
"dependencies": {
|
||||
"@krlwlfrt/async-pool": "0.5.0",
|
||||
"@krlwlfrt/async-pool": "0.7.0",
|
||||
"@openstapps/core": "0.52.0",
|
||||
"@openstapps/core-tools": "0.25.0",
|
||||
"@openstapps/logger": "0.7.0",
|
||||
@@ -29,7 +29,7 @@
|
||||
"@types/wait-on": "5.3.1",
|
||||
"body-parser": "1.19.0",
|
||||
"cli-progress": "3.9.1",
|
||||
"commander": "7.2.0",
|
||||
"commander": "8.2.0",
|
||||
"express": "4.17.1",
|
||||
"fast-clone": "1.5.13",
|
||||
"got": "11.8.2",
|
||||
@@ -38,7 +38,7 @@
|
||||
"morgan": "1.10.0",
|
||||
"traverse": "0.6.6",
|
||||
"uuid": "8.3.2",
|
||||
"wait-on": "5.3.0"
|
||||
"wait-on": "6.0.0"
|
||||
},
|
||||
"license": "GPL-3.0-only",
|
||||
"devDependencies": {
|
||||
@@ -48,18 +48,18 @@
|
||||
"@types/chai-as-promised": "7.1.4",
|
||||
"@types/chai-spies": "1.0.3",
|
||||
"@types/fs-extra": "9.0.13",
|
||||
"@types/mocha": "8.2.3",
|
||||
"@types/mocha": "9.0.0",
|
||||
"chai": "4.3.4",
|
||||
"chai-as-promised": "7.1.1",
|
||||
"chai-spies": "1.0.0",
|
||||
"conventional-changelog-cli": "2.1.1",
|
||||
"fs-extra": "9.1.0",
|
||||
"mocha": "8.4.0",
|
||||
"fs-extra": "10.0.0",
|
||||
"mocha": "9.1.2",
|
||||
"nock": "13.1.3",
|
||||
"nyc": "15.1.0",
|
||||
"prepend-file-cli": "1.0.6",
|
||||
"rimraf": "3.0.2",
|
||||
"ts-node": "9.1.1",
|
||||
"ts-node": "10.2.1",
|
||||
"tslint": "6.1.3",
|
||||
"typedoc": "0.22.5",
|
||||
"typescript": "3.9.10"
|
||||
|
||||
17
src/e2e.ts
17
src/e2e.ts
@@ -103,15 +103,14 @@ function compareItems() {
|
||||
* Function to add all the SCThings that getItemsFromSamples() returns to the backend
|
||||
*/
|
||||
async function indexSamples(api: ConnectorClient, options: E2EOptions): Promise<void> {
|
||||
|
||||
const items = await getItemsFromSamples(options.samplesLocation);
|
||||
|
||||
if (items.length === 0) {
|
||||
throw new Error('Could not index samples. None were retrieved from the file system.');
|
||||
}
|
||||
|
||||
try {
|
||||
// sort items by type
|
||||
const items = await getItemsFromSamples(options.samplesLocation);
|
||||
|
||||
if (items.length === 0) {
|
||||
throw new Error('Could not index samples. None were retrieved from the file system.');
|
||||
}
|
||||
|
||||
// sort items by type
|
||||
const itemMap: Map<SCThingType, SCThings[]> = new Map();
|
||||
for (const item of items) {
|
||||
if (!itemMap.has(item.type)) {
|
||||
@@ -155,7 +154,7 @@ export async function getItemsFromSamples<T extends SCThings>(samplesDirectory:
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
return error;
|
||||
throw error;
|
||||
}
|
||||
|
||||
return things;
|
||||
|
||||
@@ -73,11 +73,13 @@ export class HttpClient {
|
||||
try {
|
||||
response = await got(requestConfig.url.toString(), params);
|
||||
} catch (err) {
|
||||
if (typeof err.response === 'undefined') {
|
||||
// tslint:disable-next-line: no-any
|
||||
if (typeof (err as any).response === 'undefined') {
|
||||
throw err;
|
||||
}
|
||||
// if there is a response (e.g. response with statusCode 404 etc.) provide it
|
||||
response = err.response;
|
||||
// tslint:disable-next-line: no-any
|
||||
response = (err as any).response as Response<TYPE_OF_BODY>;
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
@@ -208,7 +208,7 @@ export abstract class Plugin {
|
||||
* @param req An express Request from the backend
|
||||
* @param res An express Response to the backend for you to send back data
|
||||
*/
|
||||
protected abstract async onRouteInvoke(req: express.Request, res: express.Response): Promise<void>;
|
||||
protected abstract onRouteInvoke(req: express.Request, res: express.Response): Promise<void>;
|
||||
|
||||
/**
|
||||
* Closes the server
|
||||
@@ -222,9 +222,9 @@ export abstract class Plugin {
|
||||
/* istanbul ignore next */
|
||||
if (typeof err !== 'undefined') {
|
||||
/* istanbul ignore next */
|
||||
return reject(err);
|
||||
reject(err);
|
||||
}
|
||||
resolve();
|
||||
resolve(undefined);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
SCBulkRoute,
|
||||
SCSearchResponse,
|
||||
SCSearchRoute,
|
||||
SCThing,
|
||||
SCThings,
|
||||
} from '@openstapps/core';
|
||||
import chai from 'chai';
|
||||
@@ -66,18 +65,12 @@ export class E2EConnectorSpec {
|
||||
async getCoreTestSamples() {
|
||||
const items = await getItemsFromSamples('./node_modules/@openstapps/core/test/resources');
|
||||
// tslint:disable-next-line: no-unused-expression
|
||||
chai.expect(items).to.not.be.a.instanceof(Error);
|
||||
// tslint:disable-next-line: no-unused-expression
|
||||
chai.expect(items).to.not.be.empty;
|
||||
}
|
||||
|
||||
@test
|
||||
async getCoreTestSamplesShouldFail() {
|
||||
return getItemsFromSamples('./nonexistantdirectory')
|
||||
.then(<T extends SCThing>(items: T[]) => {
|
||||
// tslint:disable-next-line: no-unused-expression
|
||||
chai.expect(items).to.be.a.instanceof(Error);
|
||||
});
|
||||
await chai.expect(getItemsFromSamples('./nonexistantdirectory')).to.be.rejectedWith(Error);
|
||||
}
|
||||
|
||||
@test
|
||||
|
||||
Reference in New Issue
Block a user