@equinor/fusion-framework-module-app
Advanced tools
Comparing version
@@ -6,2 +6,8 @@ # Change Log | ||
## [1.3.1](https://github.com/equinor/fusion-framework/compare/@equinor/fusion-framework-module-app@1.3.0...@equinor/fusion-framework-module-app@1.3.1) (2022-11-14) | ||
### Bug Fixes | ||
- **module-app:** throw error when config or app not loading ([e4bd23a](https://github.com/equinor/fusion-framework/commit/e4bd23a4071bd68334aeaed9ed9ea12cac93222c)) | ||
## 1.3.0 (2022-11-14) | ||
@@ -8,0 +14,0 @@ |
@@ -13,3 +13,3 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
var _AppProvider_appClient, _AppProvider_appsClient, _AppProvider_configClient, _AppProvider_current$, _AppProvider_subscription; | ||
import { BehaviorSubject, distinctUntilChanged, filter, firstValueFrom, from, map, merge, Observable, pairwise, scan, Subscription, switchMap, takeWhile, } from 'rxjs'; | ||
import { BehaviorSubject, catchError, distinctUntilChanged, filter, firstValueFrom, from, map, merge, Observable, pairwise, scan, Subscription, switchMap, takeWhile, throwIfEmpty, } from 'rxjs'; | ||
import { Query } from '@equinor/fusion-observable/query'; | ||
@@ -49,3 +49,5 @@ import { compareAppManifest } from './helpers'; | ||
getApp(appKey) { | ||
return Query.extractQueryValue(__classPrivateFieldGet(this, _AppProvider_appClient, "f").query({ appKey })); | ||
return Query.extractQueryValue(__classPrivateFieldGet(this, _AppProvider_appClient, "f").query({ appKey }).pipe(catchError((cause) => { | ||
throw Error('failed to load manifest', { cause }); | ||
}))); | ||
} | ||
@@ -56,3 +58,5 @@ getAllApps() { | ||
getAppConfig(appKey, tag) { | ||
return Query.extractQueryValue(__classPrivateFieldGet(this, _AppProvider_configClient, "f").query({ appKey, tag })); | ||
return Query.extractQueryValue(__classPrivateFieldGet(this, _AppProvider_configClient, "f").query({ appKey, tag }).pipe(catchError((cause) => { | ||
throw Error('failed to load config', { cause }); | ||
}))); | ||
} | ||
@@ -74,3 +78,3 @@ setCurrentApp(appKey) { | ||
const loadConfig$ = this.getAppConfig(appKey).pipe(map((config) => ({ config }))); | ||
return merge(loadApp$, loadConfig$).pipe(scan((acc, next) => Object.assign({}, acc, next), {}), filter((x) => ['manifest', 'module', 'config'].every((key) => !!x[key]))); | ||
return merge(loadApp$, loadConfig$).pipe(scan((acc, next) => Object.assign({}, acc, next), {}), filter((x) => ['manifest', 'module', 'config'].every((key) => !!x[key])), throwIfEmpty(() => 'failed to load application')); | ||
} | ||
@@ -77,0 +81,0 @@ dispose() { |
{ | ||
"name": "@equinor/fusion-framework-module-app", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "", | ||
@@ -26,3 +26,3 @@ "main": "dist/esm/index.js", | ||
"dependencies": { | ||
"@equinor/fusion-observable": "^1.4.0", | ||
"@equinor/fusion-observable": "^1.4.1", | ||
"rxjs": "^7.5.7" | ||
@@ -34,3 +34,3 @@ }, | ||
"@equinor/fusion-framework-module-http": "^2.1.4", | ||
"@equinor/fusion-framework-module-service-discovery": "^3.1.0", | ||
"@equinor/fusion-framework-module-service-discovery": "^3.1.1", | ||
"typescript": "^4.8.4" | ||
@@ -41,3 +41,3 @@ }, | ||
}, | ||
"gitHead": "8034da7d4ca056c44b253c91285e86f7011639ba" | ||
"gitHead": "98a8a5c6f02ac739adda41bb26f43e3255d450bb" | ||
} |
import { | ||
BehaviorSubject, | ||
catchError, | ||
distinctUntilChanged, | ||
@@ -15,2 +16,3 @@ filter, | ||
takeWhile, | ||
throwIfEmpty, | ||
} from 'rxjs'; | ||
@@ -103,3 +105,9 @@ | ||
public getApp(appKey: string): Observable<AppManifest> { | ||
return Query.extractQueryValue(this.#appClient.query({ appKey })); | ||
return Query.extractQueryValue( | ||
this.#appClient.query({ appKey }).pipe( | ||
catchError((cause) => { | ||
throw Error('failed to load manifest', { cause }); | ||
}) | ||
) | ||
); | ||
} | ||
@@ -115,3 +123,9 @@ | ||
): Observable<AppConfig<TType>> { | ||
return Query.extractQueryValue(this.#configClient.query({ appKey, tag })); | ||
return Query.extractQueryValue( | ||
this.#configClient.query({ appKey, tag }).pipe( | ||
catchError((cause) => { | ||
throw Error('failed to load config', { cause }); | ||
}) | ||
) | ||
); | ||
} | ||
@@ -152,3 +166,4 @@ | ||
['manifest', 'module', 'config'].every((key) => !!x[key as keyof AppBundle]) | ||
) | ||
), | ||
throwIfEmpty(() => 'failed to load application') | ||
); | ||
@@ -155,0 +170,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
146521
1.08%636
3.08%