diff --git a/packages/app/src/types.ts b/packages/app/src/types.ts index 79492302b7..7d8ec995dc 100644 --- a/packages/app/src/types.ts +++ b/packages/app/src/types.ts @@ -4,16 +4,18 @@ import type { AnyModule } from '@equinor/fusion-framework-module'; import type { AppConfig, - AppManifest, AppModulesInstance, ComponentRenderArgs, } from '@equinor/fusion-framework-module-app'; +import { ApplicationManifest } from '@equinor/fusion-framework-module-app'; + +export { ApplicationManifest } from '@equinor/fusion-framework-module-app'; + import type { IAppConfigurator } from './AppConfigurator'; export type { AppModules, - AppManifest, AppConfig, AppModulesInstance, } from '@equinor/fusion-framework-module-app'; @@ -28,7 +30,7 @@ export type { export type AppEnv = { /** base routing path of the application */ basename?: string; - manifest: AppManifest; + manifest: ApplicationManifest; config?: AppConfig; props?: TProps; }; diff --git a/packages/modules/app/src/AppConfigurator.ts b/packages/modules/app/src/AppConfigurator.ts index ad7c2a8b19..c2e4967f25 100644 --- a/packages/modules/app/src/AppConfigurator.ts +++ b/packages/modules/app/src/AppConfigurator.ts @@ -10,7 +10,7 @@ import type { QueryCtorOptions } from '@equinor/fusion-query'; import { moduleKey } from './module'; import type { AppConfig, ApiApp, ApiAppVersionConfig } from './types'; -import { ApplicationManifest } from './helpers'; +import { ApplicationManifest } from './ApplicationManifest'; import { map } from 'rxjs/operators'; export interface AppModuleConfig { diff --git a/packages/modules/app/src/AppModuleProvider.ts b/packages/modules/app/src/AppModuleProvider.ts index 367cfa46f2..b75b3c6960 100644 --- a/packages/modules/app/src/AppModuleProvider.ts +++ b/packages/modules/app/src/AppModuleProvider.ts @@ -16,7 +16,7 @@ import { EventModule } from '@equinor/fusion-framework-module-event'; import { Query } from '@equinor/fusion-query'; import type { AppConfig, CurrentApp } from './types'; -import { ApplicationManifest } from './helpers'; +import { ApplicationManifest } from './ApplicationManifest'; import { App, filterEmpty, IApp } from './app/App'; import { AppModuleConfig } from './AppConfigurator'; diff --git a/packages/modules/app/src/helpers.ts b/packages/modules/app/src/ApplicationManifest.ts similarity index 95% rename from packages/modules/app/src/helpers.ts rename to packages/modules/app/src/ApplicationManifest.ts index fa1132a381..11720c2a58 100644 --- a/packages/modules/app/src/helpers.ts +++ b/packages/modules/app/src/ApplicationManifest.ts @@ -3,7 +3,7 @@ import type { AppManifest, ApiApp, AppOwnerOrAdmin, AppBuild, AzureId } from './ export class ApplicationManifest implements AppManifest { constructor(protected model: ApiApp) {} - #convertAzureId(user: AppOwnerOrAdmin) { + protected convertAzureId(user: AppOwnerOrAdmin) { const { azureUniqueId: azureId, ...rest } = user; return { azureId, @@ -12,11 +12,11 @@ export class ApplicationManifest implements AppManifest { } get admins() { - return this.model.admins?.map(this.#convertAzureId); + return this.model.admins?.map(this.convertAzureId); } get owners() { - return this.model.owners?.map(this.#convertAzureId); + return this.model.owners?.map(this.convertAzureId); } get key() { diff --git a/packages/modules/app/src/app/App.ts b/packages/modules/app/src/app/App.ts index db66649c90..4eaeeaed1e 100644 --- a/packages/modules/app/src/app/App.ts +++ b/packages/modules/app/src/app/App.ts @@ -18,7 +18,7 @@ import { actions, Actions } from './actions'; import { AppBundleState, AppBundleStateInitial } from './types'; import './events'; -import { ApplicationManifest } from '../helpers'; +import { ApplicationManifest } from '../ApplicationManifest'; // TODO - move globally export function filterEmpty(): OperatorFunction { diff --git a/packages/modules/app/src/app/actions.ts b/packages/modules/app/src/app/actions.ts index 6991959681..f71302b111 100644 --- a/packages/modules/app/src/app/actions.ts +++ b/packages/modules/app/src/app/actions.ts @@ -5,7 +5,7 @@ import { createAsyncAction, } from '@equinor/fusion-observable'; import type { AppConfig, AppModulesInstance, AppScriptModule } from '../types'; -import { ApplicationManifest } from '../helpers'; +import { ApplicationManifest } from '../ApplicationManifest'; const createActions = () => ({ /** Manifest loading */ diff --git a/packages/modules/app/src/app/types.ts b/packages/modules/app/src/app/types.ts index 1dc4f4acf0..2aecdaed6f 100644 --- a/packages/modules/app/src/app/types.ts +++ b/packages/modules/app/src/app/types.ts @@ -1,5 +1,5 @@ import type { AppConfig, AppModulesInstance, AppScriptModule } from '../types'; -import { ApplicationManifest } from '../helpers'; +import { ApplicationManifest } from '../ApplicationManifest'; // eslint-disable-next-line @typescript-eslint/no-explicit-any export type AppBundleState = { diff --git a/packages/modules/app/src/index.ts b/packages/modules/app/src/index.ts index 8b9e2ef088..42e2fb4a5b 100644 --- a/packages/modules/app/src/index.ts +++ b/packages/modules/app/src/index.ts @@ -8,6 +8,8 @@ export { AppModuleProvider } from './AppModuleProvider'; export { IApp } from './app/App'; +export { ApplicationManifest } from './ApplicationManifest'; + export * from './events'; export * from './types'; diff --git a/packages/modules/app/src/types.ts b/packages/modules/app/src/types.ts index e1d7966bc1..5bad81784d 100644 --- a/packages/modules/app/src/types.ts +++ b/packages/modules/app/src/types.ts @@ -4,7 +4,7 @@ import type { HttpModule } from '@equinor/fusion-framework-module-http'; import type { MsalModule } from '@equinor/fusion-framework-module-msal'; import type { ServiceDiscoveryModule } from '@equinor/fusion-framework-module-service-discovery'; import IApp from './app'; -import { ApplicationManifest } from './helpers'; +import { ApplicationManifest } from './ApplicationManifest'; // TODO // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/packages/react/app/src/feature-flag/enable-feature-flag.ts b/packages/react/app/src/feature-flag/enable-feature-flag.ts index e80b4f68cd..ee88bcb3bc 100644 --- a/packages/react/app/src/feature-flag/enable-feature-flag.ts +++ b/packages/react/app/src/feature-flag/enable-feature-flag.ts @@ -65,7 +65,7 @@ export function enableFeatureFlag( enableFeatureFlagging(configurator, async (builder) => { builder.addPlugin( createLocalStoragePlugin(localFlags, { - name: (configurator as AppConfigurator).env?.manifest.key, + name: (configurator as AppConfigurator).env?.manifest.key ?? undefined, }), ); builder.addPlugin(createUrlPlugin(urlFlags)); diff --git a/packages/react/app/src/index.ts b/packages/react/app/src/index.ts index 60439f3889..70c0f4eb7a 100644 --- a/packages/react/app/src/index.ts +++ b/packages/react/app/src/index.ts @@ -4,11 +4,12 @@ export type { AppModuleInitiator, AppModules, AppModulesInstance, - AppManifest, AppRenderFn, IAppConfigurator, } from '@equinor/fusion-framework-app'; +export { ApplicationManifest } from '@equinor/fusion-framework-module-app'; + export { useAppModule } from './useAppModule'; export { useAppModules } from './useAppModules'; export { useAppEnvironmentVariables } from './useAppEnvironmentVariables'; diff --git a/packages/react/legacy-interopt/src/LegacyAppContainer.ts b/packages/react/legacy-interopt/src/LegacyAppContainer.ts index a9106feea1..919c63c284 100644 --- a/packages/react/legacy-interopt/src/LegacyAppContainer.ts +++ b/packages/react/legacy-interopt/src/LegacyAppContainer.ts @@ -7,7 +7,7 @@ import { TelemetryLogger, } from '@equinor/fusion'; -import { AppManifest } from '@equinor/fusion-framework-app'; +import { ApplicationManifest } from '@equinor/fusion-framework-module-app'; import { ActionTypes, createAction, createReducer, FlowSubject } from '@equinor/fusion-observable'; import { original } from 'immer'; @@ -284,11 +284,11 @@ export class LegacyAppContainer extends EventEmitter { async setCurrentAppAsync(appKey: string | null): Promise { if (appKey) { - const manifest = this.get(appKey) as unknown as AppManifest; + const manifest = this.get(appKey); const appProvider = this.#framework.modules.app; const currentApp = appProvider.current; if (currentApp && currentApp.appKey === appKey) { - currentApp.updateManifest(manifest); + currentApp.updateManifest(manifest as unknown as ApplicationManifest); await currentApp.getConfigAsync(); } else { if (currentApp?.appKey !== appKey) { @@ -303,7 +303,7 @@ export class LegacyAppContainer extends EventEmitter { 'these lines should newer been reached', ); } - const newApp = appProvider.createApp({ appKey, manifest }); + const newApp = appProvider.createApp({ appKey }); await newApp.getConfigAsync(); appProvider.setCurrentApp(newApp); }