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