mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-22 17:42:57 +00:00
build: update dependencies
Additionally adjust the code after the latest rebase.
This commit is contained in:
627
package-lock.json
generated
627
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
62
package.json
62
package.json
@@ -25,24 +25,24 @@
|
|||||||
"test": "ng test"
|
"test": "ng test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/common": "7.2.7",
|
"@angular/common": "7.2.12",
|
||||||
"@angular/core": "7.2.7",
|
"@angular/core": "7.2.12",
|
||||||
"@angular/forms": "7.2.7",
|
"@angular/forms": "7.2.12",
|
||||||
"@angular/http": "7.2.7",
|
"@angular/http": "7.2.12",
|
||||||
"@angular/platform-browser": "7.2.7",
|
"@angular/platform-browser": "7.2.12",
|
||||||
"@angular/platform-browser-dynamic": "7.2.7",
|
"@angular/platform-browser-dynamic": "7.2.12",
|
||||||
"@angular/router": "7.2.7",
|
"@angular/router": "7.2.12",
|
||||||
"@ionic-native/core": "5.2.0",
|
"@ionic-native/core": "5.4.0",
|
||||||
"@ionic-native/geolocation": "5.2.0",
|
"@ionic-native/geolocation": "5.4.0",
|
||||||
"@ionic-native/splash-screen": "5.2.0",
|
"@ionic-native/splash-screen": "5.4.0",
|
||||||
"@ionic-native/status-bar": "5.2.0",
|
"@ionic-native/status-bar": "5.4.0",
|
||||||
"@ionic/angular": "4.0.2",
|
"@ionic/angular": "4.2.0",
|
||||||
"@ionic/storage": "2.2.0",
|
"@ionic/storage": "2.2.0",
|
||||||
"@ngx-translate/core": "11.0.1",
|
"@ngx-translate/core": "11.0.1",
|
||||||
"@ngx-translate/http-loader": "4.0.0",
|
"@ngx-translate/http-loader": "4.0.0",
|
||||||
"@openstapps/api": "0.4.1",
|
"@openstapps/api": "0.6.0",
|
||||||
"@openstapps/configuration": "0.7.0",
|
"@openstapps/configuration": "0.8.0",
|
||||||
"@openstapps/core": "0.12.0",
|
"@openstapps/core": "0.15.0",
|
||||||
"@openstapps/logger": "0.0.5",
|
"@openstapps/logger": "0.0.5",
|
||||||
"cordova-android": "8.0.0",
|
"cordova-android": "8.0.0",
|
||||||
"cordova-browser": "6.0.0",
|
"cordova-browser": "6.0.0",
|
||||||
@@ -50,31 +50,31 @@
|
|||||||
"cordova-plugin-device": "2.0.2",
|
"cordova-plugin-device": "2.0.2",
|
||||||
"cordova-plugin-geolocation": "4.0.1",
|
"cordova-plugin-geolocation": "4.0.1",
|
||||||
"cordova-plugin-ionic-keyboard": "2.1.3",
|
"cordova-plugin-ionic-keyboard": "2.1.3",
|
||||||
"cordova-plugin-ionic-webview": "4.0.0",
|
"cordova-plugin-ionic-webview": "4.0.1",
|
||||||
"cordova-plugin-splashscreen": "5.0.2",
|
"cordova-plugin-splashscreen": "5.0.2",
|
||||||
"cordova-plugin-whitelist": "1.3.3",
|
"cordova-plugin-whitelist": "1.3.3",
|
||||||
"core-js": "2.6.5",
|
"core-js": "2.6.5",
|
||||||
"rxjs": "6.4.0",
|
"rxjs": "6.4.0",
|
||||||
"zone.js": "0.8.29"
|
"zone.js": "0.9.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/architect": "0.13.4",
|
"@angular-devkit/architect": "0.13.8",
|
||||||
"@angular-devkit/build-angular": "0.13.4",
|
"@angular-devkit/build-angular": "0.13.8",
|
||||||
"@angular-devkit/core": "7.3.4",
|
"@angular-devkit/core": "7.3.8",
|
||||||
"@angular-devkit/schematics": "7.3.4",
|
"@angular-devkit/schematics": "7.3.8",
|
||||||
"@angular/cli": "7.3.4",
|
"@angular/cli": "7.3.8",
|
||||||
"@angular/compiler": "7.2.7",
|
"@angular/compiler": "7.2.12",
|
||||||
"@angular/compiler-cli": "7.2.7",
|
"@angular/compiler-cli": "7.2.12",
|
||||||
"@angular/language-service": "7.2.7",
|
"@angular/language-service": "7.2.12",
|
||||||
"@compodoc/compodoc": "1.1.9",
|
"@compodoc/compodoc": "1.1.9",
|
||||||
"@ionic/ng-toolkit": "1.1.0",
|
"@ionic/ng-toolkit": "1.1.0",
|
||||||
"@ionic/schematics-angular": "1.0.7",
|
"@ionic/schematics-angular": "1.0.7",
|
||||||
"@types/jasmine": "3.3.9",
|
"@types/jasmine": "3.3.12",
|
||||||
"@types/jasminewd2": "2.0.6",
|
"@types/jasminewd2": "2.0.6",
|
||||||
"@types/node": "11.10.4",
|
"@types/node": "11.13.2",
|
||||||
"codelyzer": "4.5.0",
|
"codelyzer": "5.0.0",
|
||||||
"is-docker": "1.1.0",
|
"is-docker": "1.1.0",
|
||||||
"jasmine-core": "3.3.0",
|
"jasmine-core": "3.4.0",
|
||||||
"jasmine-spec-reporter": "4.2.1",
|
"jasmine-spec-reporter": "4.2.1",
|
||||||
"karma": "4.0.1",
|
"karma": "4.0.1",
|
||||||
"karma-chrome-launcher": "2.2.0",
|
"karma-chrome-launcher": "2.2.0",
|
||||||
@@ -84,8 +84,8 @@
|
|||||||
"karma-mocha-reporter": "2.2.5",
|
"karma-mocha-reporter": "2.2.5",
|
||||||
"protractor": "5.4.2",
|
"protractor": "5.4.2",
|
||||||
"surge": "0.20.3",
|
"surge": "0.20.3",
|
||||||
"ts-node": "8.0.2",
|
"ts-node": "8.0.3",
|
||||||
"tslint": "5.13.1",
|
"tslint": "5.15.0",
|
||||||
"typescript": "3.2.4"
|
"typescript": "3.2.4"
|
||||||
},
|
},
|
||||||
"cordova": {
|
"cordova": {
|
||||||
|
|||||||
@@ -15,90 +15,151 @@
|
|||||||
import {HTTP_INTERCEPTORS, HttpClient,
|
import {HTTP_INTERCEPTORS, HttpClient,
|
||||||
HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse} from '@angular/common/http';
|
HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse} from '@angular/common/http';
|
||||||
import {Injectable} from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import {Observable} from 'rxjs';
|
import {SCIndexResponse, SCThingType} from '@openstapps/core';
|
||||||
// import {SCThing} from '@openstapps/core';
|
import {Observable, of} from 'rxjs';
|
||||||
// import {Observable, of} from 'rxjs';
|
|
||||||
import {map} from 'rxjs/operators';
|
import {map} from 'rxjs/operators';
|
||||||
import {SampleThings} from './data/sample-things';
|
import {SampleThings} from './data/sample-things';
|
||||||
|
|
||||||
|
const sampleIndexResponse: SCIndexResponse = {
|
||||||
|
app: {
|
||||||
|
campusPolygon: {
|
||||||
|
coordinates: [
|
||||||
|
[
|
||||||
|
[
|
||||||
|
13.31916332244873,
|
||||||
|
52.50796756998264,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
13.336544036865234,
|
||||||
|
52.50796756998264,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
13.336544036865234,
|
||||||
|
52.51726547416385,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
13.31916332244873,
|
||||||
|
52.51726547416385,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
13.31916332244873,
|
||||||
|
52.50796756998264,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
type: 'Polygon',
|
||||||
|
},
|
||||||
|
features: {
|
||||||
|
widgets: true,
|
||||||
|
},
|
||||||
|
menus: [],
|
||||||
|
name: 'StApps - Technische Universität Berlin',
|
||||||
|
privacyPolicyUrl: 'https://stappsbe01.innocampus.tu-berlin.de/_static/privacy.md',
|
||||||
|
settings: [],
|
||||||
|
},
|
||||||
|
backend: {
|
||||||
|
SCVersion: '1.0.0',
|
||||||
|
hiddenTypes: [
|
||||||
|
SCThingType.DateSeries,
|
||||||
|
SCThingType.Diff,
|
||||||
|
SCThingType.Floor,
|
||||||
|
],
|
||||||
|
maxMultiSearchRouteQueries: 5,
|
||||||
|
maxRequestBodySize: 512 * 1024,
|
||||||
|
name: 'Technische Universität Berlin',
|
||||||
|
namespace: '909a8cbc-8520-456c-b474-ef1525f14209',
|
||||||
|
sortableFields: [
|
||||||
|
{
|
||||||
|
fieldName: 'name',
|
||||||
|
sortTypes: ['ducet'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'type',
|
||||||
|
sortTypes: ['ducet'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'categories',
|
||||||
|
onlyOnTypes: [
|
||||||
|
SCThingType.AcademicEvent,
|
||||||
|
SCThingType.Building,
|
||||||
|
SCThingType.Catalog,
|
||||||
|
SCThingType.Dish,
|
||||||
|
SCThingType.PointOfInterest,
|
||||||
|
SCThingType.Room,
|
||||||
|
],
|
||||||
|
sortTypes: ['ducet'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'geo.point.coordinates',
|
||||||
|
onlyOnTypes: [
|
||||||
|
SCThingType.Building,
|
||||||
|
SCThingType.PointOfInterest,
|
||||||
|
SCThingType.Room,
|
||||||
|
],
|
||||||
|
sortTypes: ['distance'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'geo.point.coordinates',
|
||||||
|
onlyOnTypes: [
|
||||||
|
SCThingType.Building,
|
||||||
|
SCThingType.PointOfInterest,
|
||||||
|
SCThingType.Room,
|
||||||
|
],
|
||||||
|
sortTypes: ['distance'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'inPlace.geo.point.coordinates',
|
||||||
|
onlyOnTypes: [
|
||||||
|
SCThingType.DateSeries,
|
||||||
|
SCThingType.Dish,
|
||||||
|
SCThingType.Floor,
|
||||||
|
SCThingType.Organization,
|
||||||
|
SCThingType.PointOfInterest,
|
||||||
|
SCThingType.Room,
|
||||||
|
SCThingType.Ticket,
|
||||||
|
],
|
||||||
|
sortTypes: ['distance'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldName: 'offers',
|
||||||
|
onlyOnTypes: [
|
||||||
|
SCThingType.Dish,
|
||||||
|
],
|
||||||
|
sortTypes: ['price'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FakeBackendInterceptor implements HttpInterceptor {
|
export class FakeBackendInterceptor implements HttpInterceptor {
|
||||||
sampleFetcher: SampleThings;
|
sampleFetcher: SampleThings;
|
||||||
// http: HttpClient;
|
|
||||||
// tslint:disable-next-line:no-empty
|
|
||||||
constructor(http: HttpClient) {
|
constructor(http: HttpClient) {
|
||||||
this.sampleFetcher = new SampleThings(http);
|
this.sampleFetcher = new SampleThings(http);
|
||||||
// this.http = http;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
|
||||||
// let data: SCThing[] = [];
|
|
||||||
// // fake responses for search requests for easier (backendless) development process
|
|
||||||
// if (request.url.endsWith('/search') && request.method === 'POST') {
|
|
||||||
// if (typeof request.body.filter !== 'undefined' && typeof request.body.filter.arguments !== 'undefined') {
|
|
||||||
// if (request.body.filter.arguments.field === 'uid') {
|
|
||||||
// // provide items with given uid for search requests requesting single items (detail view)
|
|
||||||
// data = getSampleThings(request.body.filter.arguments.value);
|
|
||||||
// return this.sampleFetcher.getSampleThings().pipe(map((sampleData: any) => {
|
|
||||||
// return new HttpResponse({status: 200, body: {data: [sampleData.instance]}});
|
|
||||||
// // return new HttpResponse({status: 200, body: {data: [sampleData.instance]}});
|
|
||||||
// }),
|
|
||||||
// // data = getSampleThings();
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// // if filter and arguments are not set, then provide all sample items (things)
|
|
||||||
// data = getSampleThings();
|
|
||||||
// // fake a response of the backend with previously defined data
|
|
||||||
// return of(new HttpResponse({status: 200, body: {data: data}}));
|
|
||||||
// }
|
|
||||||
// // fake a response of the backend with previously defined data
|
|
||||||
// // return of(new HttpResponse({status: 200, body: {data: data}}));
|
|
||||||
// return next.handle(request);
|
|
||||||
// } else {
|
|
||||||
// // for all other requests, forward the requests to actually requested URL (backend)
|
|
||||||
// return next.handle(request);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
// intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
|
||||||
// // let data: SCThing[] = [];
|
|
||||||
// // fake responses for search requests for easier (backendless) development process
|
|
||||||
// if (request.url.endsWith('/search') && request.method === 'POST') {
|
|
||||||
// return this.sampleFetcher.getSampleThings().pipe(map((sampleData: any) => {
|
|
||||||
// return new HttpResponse({status: 200, body: {data: sampleData}});
|
|
||||||
// // return new HttpResponse({status: 200, body: {data: [sampleData.instance]}});
|
|
||||||
// }));
|
|
||||||
// // return of(new HttpResponse({status: 200, body: {data: data}}));
|
|
||||||
// } else {
|
|
||||||
// // for all other requests, forward the requests to actually requested URL (backend)
|
|
||||||
// return next.handle(request);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||||
// let data: SCThing[] = [];
|
if (request.method === 'POST') {
|
||||||
// fake responses for search requests for easier (backendless) development process
|
if (request.url.endsWith('/') && request.method === 'POST') {
|
||||||
if (request.url.endsWith('/search') && request.method === 'POST') {
|
// respond with expected (faked) index response
|
||||||
|
return of(new HttpResponse({status: 200, body: sampleIndexResponse}));
|
||||||
|
// respond with a search response with sample data
|
||||||
|
} else if (request.url.endsWith('/search')) {
|
||||||
if (typeof request.body.filter !== 'undefined' && typeof request.body.filter.arguments !== 'undefined') {
|
if (typeof request.body.filter !== 'undefined' && typeof request.body.filter.arguments !== 'undefined') {
|
||||||
if (request.body.filter.arguments.field === 'uid') {
|
if (request.body.filter.arguments.field === 'uid') {
|
||||||
return this.sampleFetcher.getSampleThing(request.body.filter.arguments.value).pipe(map((sampleData: any) => {
|
return this.sampleFetcher.getSampleThing(request.body.filter.arguments.value)
|
||||||
|
.pipe(map((sampleData: any) => {
|
||||||
return new HttpResponse({status: 200, body: {data: sampleData}});
|
return new HttpResponse({status: 200, body: {data: sampleData}});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.sampleFetcher.getSampleThings().pipe(map((sampleData: any) => {
|
return this.sampleFetcher.getSampleThings().pipe(map((sampleData: any) => {
|
||||||
return new HttpResponse({status: 200, body: {data: sampleData}});
|
return new HttpResponse({status: 200, body: {data: sampleData}});
|
||||||
// return new HttpResponse({status: 200, body: {data: [sampleData.instance]}});
|
|
||||||
}));
|
}));
|
||||||
// return of(new HttpResponse({status: 200, body: {data: data}}));
|
|
||||||
} else {
|
|
||||||
// for all other requests, forward the requests to actually requested URL (backend)
|
|
||||||
return next.handle(request);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return next.handle(request);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fakeBackendProvider = {
|
export const fakeBackendProvider = {
|
||||||
|
|||||||
@@ -1,140 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018, 2019 StApps
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
|
||||||
* Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with
|
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
import {HttpEvent,
|
|
||||||
HttpHandler, HttpInterceptor, HttpRequest, HttpResponse} from '@angular/common/http';
|
|
||||||
import {Injectable} from '@angular/core';
|
|
||||||
import {SCIndexResponse} from '@openstapps/core';
|
|
||||||
import {Observable, of} from 'rxjs';
|
|
||||||
|
|
||||||
const sampleIndexResponse: SCIndexResponse = {
|
|
||||||
app: {
|
|
||||||
campusPolygon: {
|
|
||||||
coordinates: [
|
|
||||||
[
|
|
||||||
[
|
|
||||||
13.31916332244873,
|
|
||||||
52.50796756998264,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
13.336544036865234,
|
|
||||||
52.50796756998264,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
13.336544036865234,
|
|
||||||
52.51726547416385,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
13.31916332244873,
|
|
||||||
52.51726547416385,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
13.31916332244873,
|
|
||||||
52.50796756998264,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
type: 'Polygon',
|
|
||||||
},
|
|
||||||
features: {
|
|
||||||
widgets: true,
|
|
||||||
},
|
|
||||||
menus: [],
|
|
||||||
name: 'StApps - Technische Universität Berlin',
|
|
||||||
privacyPolicyUrl: 'https://stappsbe01.innocampus.tu-berlin.de/_static/privacy.md',
|
|
||||||
settings: [],
|
|
||||||
},
|
|
||||||
backend: {
|
|
||||||
SCVersion: '1.0.0',
|
|
||||||
hiddenTypes: [
|
|
||||||
'date series',
|
|
||||||
'diff',
|
|
||||||
'floor',
|
|
||||||
],
|
|
||||||
name: 'Technische Universität Berlin',
|
|
||||||
namespace: '909a8cbc-8520-456c-b474-ef1525f14209',
|
|
||||||
sortableFields: [
|
|
||||||
{
|
|
||||||
fieldName: 'name',
|
|
||||||
sortTypes: ['ducet'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'type',
|
|
||||||
sortTypes: ['ducet'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'categories',
|
|
||||||
onlyOnTypes: [
|
|
||||||
'academic event',
|
|
||||||
'building',
|
|
||||||
'catalog',
|
|
||||||
'dish',
|
|
||||||
'point of interest',
|
|
||||||
'room',
|
|
||||||
],
|
|
||||||
sortTypes: ['ducet'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'geo.point.coordinates',
|
|
||||||
onlyOnTypes: [
|
|
||||||
'building',
|
|
||||||
'point of interest',
|
|
||||||
'room',
|
|
||||||
],
|
|
||||||
sortTypes: ['distance'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'geo.point.coordinates',
|
|
||||||
onlyOnTypes: [
|
|
||||||
'building',
|
|
||||||
'point of interest',
|
|
||||||
'room',
|
|
||||||
],
|
|
||||||
sortTypes: ['distance'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'inPlace.geo.point.coordinates',
|
|
||||||
onlyOnTypes: [
|
|
||||||
'date series',
|
|
||||||
'dish',
|
|
||||||
'floor',
|
|
||||||
'organization',
|
|
||||||
'point of interest',
|
|
||||||
'room',
|
|
||||||
'ticket',
|
|
||||||
],
|
|
||||||
sortTypes: ['distance'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
fieldName: 'offers',
|
|
||||||
onlyOnTypes: [
|
|
||||||
'dish',
|
|
||||||
],
|
|
||||||
sortTypes: ['price'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class FakeBackendInterceptor implements HttpInterceptor {
|
|
||||||
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
|
||||||
if (request.url.endsWith('/') && request.method === 'POST') {
|
|
||||||
// respond 200 OK
|
|
||||||
return of(new HttpResponse({status: 200, body: sampleIndexResponse}));
|
|
||||||
} else {
|
|
||||||
return next.handle(request);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,8 +13,8 @@
|
|||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import {TestBed} from '@angular/core/testing';
|
import {TestBed} from '@angular/core/testing';
|
||||||
import {SCIndexResponse} from '@openstapps/core';
|
import {SCIndexResponse, SCThingOriginType, SCThingType} from '@openstapps/core';
|
||||||
import {StAppsWebHttpClient} from '../data/data.provider';
|
import {StAppsWebHttpClient} from '../data/stapps-web-http-client.provider';
|
||||||
import {StorageProvider} from '../storage/storage.provider';
|
import {StorageProvider} from '../storage/storage.provider';
|
||||||
import {ConfigProvider, STORAGE_KEY_CONFIG} from './config.provider';
|
import {ConfigProvider, STORAGE_KEY_CONFIG} from './config.provider';
|
||||||
import {
|
import {
|
||||||
@@ -50,7 +50,7 @@ describe('ConfigProvider', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should fetch app configuration', async () => {
|
it('should fetch app configuration', async () => {
|
||||||
spyOn(configProvider.client, 'handshake').and.returnValue(sampleIndexResponse);
|
spyOn(configProvider.client, 'handshake').and.returnValue(Promise.resolve(sampleIndexResponse));
|
||||||
const result = await configProvider.fetch();
|
const result = await configProvider.fetch();
|
||||||
expect(result).toEqual(sampleIndexResponse);
|
expect(result).toEqual(sampleIndexResponse);
|
||||||
});
|
});
|
||||||
@@ -67,8 +67,8 @@ describe('ConfigProvider', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should init from remote and saved config not available', async () => {
|
it('should init from remote and saved config not available', async () => {
|
||||||
storageProviderSpy.has.and.returnValue(false);
|
storageProviderSpy.has.and.returnValue(Promise.resolve(false));
|
||||||
spyOn(configProvider.client, 'handshake').and.returnValue(sampleIndexResponse);
|
spyOn(configProvider.client, 'handshake').and.returnValue(Promise.resolve(sampleIndexResponse));
|
||||||
try {
|
try {
|
||||||
await configProvider.init();
|
await configProvider.init();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -82,8 +82,8 @@ describe('ConfigProvider', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should init from storage with remote fails', async () => {
|
it('should init from storage with remote fails', async () => {
|
||||||
storageProviderSpy.has.and.returnValue(true);
|
storageProviderSpy.has.and.returnValue(Promise.resolve(true));
|
||||||
storageProviderSpy.get.and.returnValue(sampleIndexResponse);
|
storageProviderSpy.get.and.returnValue(Promise.resolve(sampleIndexResponse));
|
||||||
spyOn(configProvider.client, 'handshake').and.throwError('');
|
spyOn(configProvider.client, 'handshake').and.throwError('');
|
||||||
let error = new Error('');
|
let error = new Error('');
|
||||||
try {
|
try {
|
||||||
@@ -99,7 +99,7 @@ describe('ConfigProvider', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error on failed initialisation', async () => {
|
it('should throw error on failed initialisation', async () => {
|
||||||
storageProviderSpy.has.and.returnValue(false);
|
storageProviderSpy.has.and.returnValue(Promise.resolve(false));
|
||||||
spyOn(configProvider.client, 'handshake').and.throwError('');
|
spyOn(configProvider.client, 'handshake').and.throwError('');
|
||||||
let error = null;
|
let error = null;
|
||||||
try {
|
try {
|
||||||
@@ -111,11 +111,11 @@ describe('ConfigProvider', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error on wrong config version in storage', async () => {
|
it('should throw error on wrong config version in storage', async () => {
|
||||||
storageProviderSpy.has.and.returnValue(true);
|
storageProviderSpy.has.and.returnValue(Promise.resolve(true));
|
||||||
const wrongConfig = JSON.parse(JSON.stringify(sampleIndexResponse));
|
const wrongConfig = JSON.parse(JSON.stringify(sampleIndexResponse));
|
||||||
wrongConfig.backend.SCVersion = '0.1.0';
|
wrongConfig.backend.SCVersion = '0.1.0';
|
||||||
storageProviderSpy.get.and.returnValue(wrongConfig);
|
storageProviderSpy.get.and.returnValue(wrongConfig);
|
||||||
spyOn(configProvider.client, 'handshake').and.returnValue(sampleIndexResponse);
|
spyOn(configProvider.client, 'handshake').and.returnValue(Promise.resolve(sampleIndexResponse));
|
||||||
let error = null;
|
let error = null;
|
||||||
try {
|
try {
|
||||||
await configProvider.init();
|
await configProvider.init();
|
||||||
@@ -126,7 +126,7 @@ describe('ConfigProvider', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should throw error on saved app configuration not available', async () => {
|
it('should throw error on saved app configuration not available', async () => {
|
||||||
storageProviderSpy.has.and.returnValue(false);
|
storageProviderSpy.has.and.returnValue(Promise.resolve(false));
|
||||||
let error = new Error('');
|
let error = new Error('');
|
||||||
try {
|
try {
|
||||||
await configProvider.loadLocal();
|
await configProvider.loadLocal();
|
||||||
@@ -147,16 +147,16 @@ describe('ConfigProvider', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return app configuration value', async () => {
|
it('should return app configuration value', async () => {
|
||||||
storageProviderSpy.has.and.returnValue(true);
|
storageProviderSpy.has.and.returnValue(Promise.resolve(true));
|
||||||
storageProviderSpy.get.and.returnValue(sampleIndexResponse);
|
storageProviderSpy.get.and.returnValue(Promise.resolve(sampleIndexResponse));
|
||||||
spyOn(configProvider.client, 'handshake').and.returnValue(sampleIndexResponse);
|
spyOn(configProvider.client, 'handshake').and.returnValue(Promise.resolve(sampleIndexResponse));
|
||||||
await configProvider.init();
|
await configProvider.init();
|
||||||
expect(await configProvider.getValue('name')).toEqual(sampleIndexResponse.app.name);
|
expect(await configProvider.getValue('name')).toEqual(sampleIndexResponse.app.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return app configuration value if only saved config is available and fetch fails', async () => {
|
it('should return app configuration value if only saved config is available and fetch fails', async () => {
|
||||||
storageProviderSpy.has.and.returnValue(true);
|
storageProviderSpy.has.and.returnValue(Promise.resolve(true));
|
||||||
storageProviderSpy.get.and.returnValue(sampleIndexResponse);
|
storageProviderSpy.get.and.returnValue(Promise.resolve(sampleIndexResponse));
|
||||||
spyOn(configProvider.client, 'handshake').and.throwError('');
|
spyOn(configProvider.client, 'handshake').and.throwError('');
|
||||||
expect(await configProvider.getValue('name')).toEqual(sampleIndexResponse.app.name);
|
expect(await configProvider.getValue('name')).toEqual(sampleIndexResponse.app.name);
|
||||||
});
|
});
|
||||||
@@ -216,6 +216,7 @@ const sampleIndexResponse: SCIndexResponse = {
|
|||||||
origin: {
|
origin: {
|
||||||
indexed: '2018-09-11T12:30:00Z',
|
indexed: '2018-09-11T12:30:00Z',
|
||||||
name: 'Dummy',
|
name: 'Dummy',
|
||||||
|
type: SCThingOriginType.Remote,
|
||||||
},
|
},
|
||||||
translations: {
|
translations: {
|
||||||
de: {
|
de: {
|
||||||
@@ -227,7 +228,7 @@ const sampleIndexResponse: SCIndexResponse = {
|
|||||||
name: 'Username',
|
name: 'Username',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
type: 'setting',
|
type: SCThingType.Setting,
|
||||||
uid: '',
|
uid: '',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -235,10 +236,12 @@ const sampleIndexResponse: SCIndexResponse = {
|
|||||||
backend: {
|
backend: {
|
||||||
SCVersion: '1.0.0',
|
SCVersion: '1.0.0',
|
||||||
hiddenTypes: [
|
hiddenTypes: [
|
||||||
'date series',
|
SCThingType.DateSeries,
|
||||||
'diff',
|
SCThingType.Diff,
|
||||||
'floor',
|
SCThingType.Floor,
|
||||||
],
|
],
|
||||||
|
maxMultiSearchRouteQueries: 5,
|
||||||
|
maxRequestBodySize: 512 * 1024,
|
||||||
name: 'Technische Universität Berlin',
|
name: 'Technische Universität Berlin',
|
||||||
namespace: '909a8cbc-8520-456c-b474-ef1525f14209',
|
namespace: '909a8cbc-8520-456c-b474-ef1525f14209',
|
||||||
sortableFields: [
|
sortableFields: [
|
||||||
@@ -253,50 +256,50 @@ const sampleIndexResponse: SCIndexResponse = {
|
|||||||
{
|
{
|
||||||
fieldName: 'categories',
|
fieldName: 'categories',
|
||||||
onlyOnTypes: [
|
onlyOnTypes: [
|
||||||
'academic event',
|
SCThingType.AcademicEvent,
|
||||||
'building',
|
SCThingType.Building,
|
||||||
'catalog',
|
SCThingType.Catalog,
|
||||||
'dish',
|
SCThingType.Dish,
|
||||||
'point of interest',
|
SCThingType.PointOfInterest,
|
||||||
'room',
|
SCThingType.Room,
|
||||||
],
|
],
|
||||||
sortTypes: ['ducet'],
|
sortTypes: ['ducet'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'geo.point.coordinates',
|
fieldName: 'geo.point.coordinates',
|
||||||
onlyOnTypes: [
|
onlyOnTypes: [
|
||||||
'building',
|
SCThingType.Building,
|
||||||
'point of interest',
|
SCThingType.PointOfInterest,
|
||||||
'room',
|
SCThingType.Room,
|
||||||
],
|
],
|
||||||
sortTypes: ['distance'],
|
sortTypes: ['distance'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'geo.point.coordinates',
|
fieldName: 'geo.point.coordinates',
|
||||||
onlyOnTypes: [
|
onlyOnTypes: [
|
||||||
'building',
|
SCThingType.Building,
|
||||||
'point of interest',
|
SCThingType.PointOfInterest,
|
||||||
'room',
|
SCThingType.Room,
|
||||||
],
|
],
|
||||||
sortTypes: ['distance'],
|
sortTypes: ['distance'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'inPlace.geo.point.coordinates',
|
fieldName: 'inPlace.geo.point.coordinates',
|
||||||
onlyOnTypes: [
|
onlyOnTypes: [
|
||||||
'date series',
|
SCThingType.DateSeries,
|
||||||
'dish',
|
SCThingType.Dish,
|
||||||
'floor',
|
SCThingType.Floor,
|
||||||
'organization',
|
SCThingType.Organization,
|
||||||
'point of interest',
|
SCThingType.PointOfInterest,
|
||||||
'room',
|
SCThingType.Room,
|
||||||
'ticket',
|
SCThingType.Ticket,
|
||||||
],
|
],
|
||||||
sortTypes: ['distance'],
|
sortTypes: ['distance'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'offers',
|
fieldName: 'offers',
|
||||||
onlyOnTypes: [
|
onlyOnTypes: [
|
||||||
'dish',
|
SCThingType.Dish,
|
||||||
],
|
],
|
||||||
sortTypes: ['price'],
|
sortTypes: ['price'],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import {Client} from '@openstapps/api/lib/client';
|
|||||||
import {SCAppConfiguration, SCIndexResponse} from '@openstapps/core';
|
import {SCAppConfiguration, SCIndexResponse} from '@openstapps/core';
|
||||||
import {Logger} from '@openstapps/logger';
|
import {Logger} from '@openstapps/logger';
|
||||||
import {environment} from '../../../environments/environment';
|
import {environment} from '../../../environments/environment';
|
||||||
import {StAppsWebHttpClient} from '../data/data.provider';
|
import {StAppsWebHttpClient} from '../data/stapps-web-http-client.provider';
|
||||||
import {StorageProvider} from '../storage/storage.provider';
|
import {StorageProvider} from '../storage/storage.provider';
|
||||||
import {
|
import {
|
||||||
ConfigFetchError,
|
ConfigFetchError,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AppError} from '../_helpers/errors';
|
import {AppError} from './../../_helpers/errors';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error that is thrown when fetching from backend fails
|
* Error that is thrown when fetching from backend fails
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ describe('DataProvider', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should provide backend data items using search query', async () => {
|
it('should provide backend data items using search query', async () => {
|
||||||
spyOn(Client.prototype, 'search').and.callFake(() => {
|
spyOn(Client.prototype as any, 'search').and.callFake(() => {
|
||||||
return {
|
return {
|
||||||
then: (callback: any) => {
|
then: (callback: any) => {
|
||||||
return callback(sampleResponse);
|
return callback(sampleResponse);
|
||||||
@@ -98,7 +98,7 @@ describe('DataProvider', () => {
|
|||||||
|
|
||||||
it('should put an data item into the local database (storage)', async () => {
|
it('should put an data item into the local database (storage)', async () => {
|
||||||
let providedThing: SCSaveableThing<SCThing>;
|
let providedThing: SCSaveableThing<SCThing>;
|
||||||
spyOn(storageProvider, 'put').and.callFake((_id: any, thing: any) => {
|
spyOn(storageProvider, 'put' as any).and.callFake((_id: any, thing: any) => {
|
||||||
providedThing = thing;
|
providedThing = thing;
|
||||||
providedThing.origin.created = sampleSavable.origin.created;
|
providedThing.origin.created = sampleSavable.origin.created;
|
||||||
});
|
});
|
||||||
@@ -131,7 +131,7 @@ describe('DataProvider', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should provide single data from the backend', async () => {
|
it('should provide single data from the backend', async () => {
|
||||||
spyOn(Client.prototype, 'getThing').and.callFake(() => {
|
spyOn(Client.prototype, 'getThing' as any).and.callFake(() => {
|
||||||
return {
|
return {
|
||||||
then: (callback: any) => {
|
then: (callback: any) => {
|
||||||
return callback(sampleThing);
|
return callback(sampleThing);
|
||||||
@@ -145,14 +145,14 @@ describe('DataProvider', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should get an item from both local and remote database', async () => {
|
it('should get an item from both local and remote database', async () => {
|
||||||
spyOn(Client.prototype, 'getThing').and.callFake(() => {
|
spyOn(Client.prototype, 'getThing' as any).and.callFake(() => {
|
||||||
return {
|
return {
|
||||||
then: (callback: any) => {
|
then: (callback: any) => {
|
||||||
return callback(sampleThing);
|
return callback(sampleThing);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
spyOn(storageProvider, 'get').and.callFake(() => {
|
spyOn(storageProvider, 'get' as any).and.callFake(() => {
|
||||||
return {
|
return {
|
||||||
then: (callback: any) => {
|
then: (callback: any) => {
|
||||||
return callback(sampleSavable);
|
return callback(sampleSavable);
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ describe('DataDetailComponent', () => {
|
|||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
dataProvider = TestBed.get(DataProvider);
|
dataProvider = TestBed.get(DataProvider);
|
||||||
refresher = jasmine.createSpyObj('refresher', ['complete']);
|
refresher = jasmine.createSpyObj('refresher', ['complete']);
|
||||||
spyOn(dataProvider, 'get').and.returnValue(Promise.resolve(sampleThing));
|
spyOn(dataProvider, 'get' as any).and.returnValue(Promise.resolve(sampleThing));
|
||||||
spyOn(DataDetailComponent.prototype, 'getItem').and.callThrough();
|
spyOn(DataDetailComponent.prototype, 'getItem').and.callThrough();
|
||||||
fixture = await TestBed.createComponent(DataDetailComponent);
|
fixture = await TestBed.createComponent(DataDetailComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
|
|||||||
Reference in New Issue
Block a user