diff --git a/src/app/_helpers/fake-backend.interceptor.ts b/src/app/_helpers/fake-backend.interceptor.ts
index ec12ab9e..9b4a4727 100644
--- a/src/app/_helpers/fake-backend.interceptor.ts
+++ b/src/app/_helpers/fake-backend.interceptor.ts
@@ -13,18 +13,19 @@
* this program. If not, see .
*/
import {
- HTTP_INTERCEPTORS,
HttpClient,
HttpEvent,
HttpHandler,
HttpInterceptor,
HttpRequest,
HttpResponse,
+ HTTP_INTERCEPTORS,
} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {SCIndexResponse, SCSettingInputType, SCThingOriginType, SCThingType} from '@openstapps/core';
import {Observable, of} from 'rxjs';
import {delay, map} from 'rxjs/operators';
+import {dependencies} from '../../../package.json';
import {facetsMock} from './data/sample-facets';
import {SampleThings} from './data/sample-things';
@@ -268,7 +269,7 @@ export const sampleIndexResponse: SCIndexResponse = {
],
},
backend: {
- SCVersion: '2.0.0',
+ SCVersion: dependencies['@openstapps/core'],
externalRequestTimeout: 5000,
hiddenTypes: [
SCThingType.DateSeries,
diff --git a/src/app/modules/config/config.provider.spec.ts b/src/app/modules/config/config.provider.spec.ts
index f59dca5b..972a291b 100644
--- a/src/app/modules/config/config.provider.spec.ts
+++ b/src/app/modules/config/config.provider.spec.ts
@@ -19,6 +19,7 @@ import {StorageProvider} from '../storage/storage.provider';
import {ConfigProvider, STORAGE_KEY_CONFIG} from './config.provider';
import {ConfigFetchError, ConfigInitError, SavedConfigNotAvailable, WrongConfigVersionInStorage,} from './errors';
import {NGXLogger} from "ngx-logger";
+import {dependencies} from '../../../../package.json';
describe('ConfigProvider', () => {
let configProvider: ConfigProvider;
@@ -122,7 +123,7 @@ describe('ConfigProvider', () => {
} catch (err) {
error = err;
}
- expect(error).toEqual(new WrongConfigVersionInStorage('2.0.0', '0.1.0'));
+ expect(error).toEqual(new WrongConfigVersionInStorage(scVersion, '0.1.0'));
});
it('should throw error on saved app configuration not available', async () => {
@@ -162,6 +163,8 @@ describe('ConfigProvider', () => {
});
});
+const scVersion = dependencies["@openstapps/core"];
+
const sampleIndexResponse: SCIndexResponse = {
app: {
campusPolygon: {
@@ -230,7 +233,7 @@ const sampleIndexResponse: SCIndexResponse = {
],
},
backend: {
- SCVersion: '2.0.0',
+ SCVersion: scVersion,
externalRequestTimeout: 5000,
hiddenTypes: [
SCThingType.DateSeries,
diff --git a/src/app/modules/config/config.provider.ts b/src/app/modules/config/config.provider.ts
index fe32ecd3..8304ef8f 100644
--- a/src/app/modules/config/config.provider.ts
+++ b/src/app/modules/config/config.provider.ts
@@ -16,6 +16,7 @@ import {Injectable} from '@angular/core';
import {Client} from '@openstapps/api/lib/client';
import {SCAppConfiguration, SCIndexResponse} from '@openstapps/core';
import {NGXLogger} from 'ngx-logger';
+import {dependencies} from '../../../../package.json';
import {environment} from '../../../environments/environment';
import {StAppsWebHttpClient} from '../data/stapps-web-http-client.provider';
import {StorageProvider} from '../storage/storage.provider';
@@ -52,6 +53,11 @@ export class ConfigProvider {
*/
initialised = false;
+ /**
+ * Version of the @openstapps/core package that app is using
+ */
+ scVersion = dependencies['@openstapps/core'];
+
/**
* Constructor, initialise api client
*
@@ -70,7 +76,7 @@ export class ConfigProvider {
*/
async fetch(): Promise {
try {
- return await this.client.handshake(environment.backend_version);
+ return await this.client.handshake(this.scVersion);
} catch (error) {
throw new ConfigFetchError();
}
@@ -113,8 +119,8 @@ export class ConfigProvider {
this.config = await this.loadLocal();
this.initialised = true;
this.logger.log(`initialised configuration from storage`);
- if (this.config.backend.SCVersion !== environment.backend_version) {
- loadError = new WrongConfigVersionInStorage(environment.backend_version, this.config.backend.SCVersion);
+ if (this.config.backend.SCVersion !== this.scVersion) {
+ loadError = new WrongConfigVersionInStorage(this.scVersion, this.config.backend.SCVersion);
this.logger.warn(loadError);
}
} catch (error) {
diff --git a/tsconfig.json b/tsconfig.json
index 793a1fbc..c34ed503 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -6,6 +6,7 @@
"declaration": false,
"emitDecoratorMetadata": true,
"strictPropertyInitialization": false,
+ "resolveJsonModule": true,
"lib": [
"es2017",
"dom"