@equinor/fusion-framework-module-app
Advanced tools
Comparing version 5.3.12-alpha-2e0570c4bda6180049fc0620aa03048d737e5831 to 6.0.0-alpha-52e7df9067d9a1af015e2e6f0af2a5bcfb49f521
# Change Log | ||
## 5.3.12-alpha-2e0570c4bda6180049fc0620aa03048d737e5831 | ||
## 6.0.0-alpha-52e7df9067d9a1af015e2e6f0af2a5bcfb49f521 | ||
### Patch Changes | ||
### Major Changes | ||
- [#2178](https://github.com/equinor/fusion-framework/pull/2178) [`20bf065`](https://github.com/equinor/fusion-framework/commit/20bf0650f0d578683f2310b6d96c4ce0be96b7db) Thanks [@eikeland](https://github.com/eikeland)! - TODO: write a proper changeset | ||
- [#2178](https://github.com/equinor/fusion-framework/pull/2178) [`dbdccb0`](https://github.com/equinor/fusion-framework/commit/dbdccb0c8878b59a6f5f2d404b3daf8f2b138ea6) Thanks [@eikeland](https://github.com/eikeland)! - Adjusted module to the new app service API. | ||
> [!WARNING] | ||
> This will introduce breaking changes to the configuration of `AppConfigurator.client`. | ||
**Added** | ||
- Introduced `AppClient` class to handle application manifest and configuration queries. | ||
- Added `zod` to validate the application manifest. | ||
**Changed** | ||
- Updated `AppModuleProvider` to use `AppClient` for fetching application manifests and configurations. | ||
- Modified `AppConfigurator` to utilize `AppClient` for client configuration. | ||
**Migration** | ||
before: | ||
```ts | ||
configurator.setClient({ | ||
getAppManifest: { | ||
client: { | ||
fn: ({ appKey }) => httpClient.json$<ApiApp>(`/apps/${appKey}`), | ||
}, | ||
key: ({ appKey }) => appKey, | ||
}, | ||
getAppManifests: { | ||
client: { | ||
fn: () => httpClient.json$<ApiApp[]>(`/apps`), | ||
}, | ||
key: () => `all-apps`, | ||
}, | ||
getAppConfig: { | ||
client: { | ||
fn: ({ appKey }) => httpClient.json$<ApiApp>(`/apps/${appKey}/config`), | ||
}, | ||
key: ({ appKey }) => appKey, | ||
}, | ||
}); | ||
``` | ||
after: | ||
```ts | ||
import { AppClient } from `@equinor/fusion-framework-module-app`; | ||
configurator.setClient(new AppClient()); | ||
``` | ||
custom client implementation: | ||
```ts | ||
import { AppClient } from `@equinor/fusion-framework-module-app`; | ||
class CustomAppClient implements IAppClient { ... } | ||
configurator.setClient(new CustomAppClient()); | ||
``` | ||
## 5.3.11 | ||
@@ -10,0 +65,0 @@ |
@@ -149,8 +149,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return __awaiter(this, arguments, void 0, function* (allow_cache = true) { | ||
var _a; | ||
const manifest = yield this.getManifestAsync(allow_cache); | ||
if (manifest.build.entryPoint) { | ||
if ((_a = manifest.build) === null || _a === void 0 ? void 0 : _a.entryPoint) { | ||
__classPrivateFieldGet(this, _App_state, "f").next(actions.importApp(manifest.build.entryPoint)); | ||
} | ||
else { | ||
console.log(`The ${manifest.key} is missing entryPoint, please upload a build for the app before continuing`); | ||
console.log(`The ${manifest.appKey} is missing entryPoint, please upload a build for the app before continuing`); | ||
} | ||
@@ -278,6 +279,6 @@ }); | ||
this.getManifest().subscribe((manifest) => { | ||
var _a; | ||
if (manifest.build.entryPoint) { | ||
var _a, _b; | ||
if ((_a = manifest.build) === null || _a === void 0 ? void 0 : _a.entryPoint) { | ||
// TODO - this should come from backend | ||
const assetPath = (_a = manifest.build.assetPath) !== null && _a !== void 0 ? _a : [manifest.key, manifest.build.version].join('@'); | ||
const assetPath = (_b = manifest.build.assetPath) !== null && _b !== void 0 ? _b : [manifest.appKey, manifest.build.version].join('@'); | ||
// dispatch import_app action to load the application script | ||
@@ -287,3 +288,3 @@ __classPrivateFieldGet(this, _App_state, "f").next(actions.importApp([assetPath, manifest.build.entryPoint].join('/'))); | ||
else { | ||
console.error(`The ${manifest.key} app is missing a entry in the manifest, upload a build for your app before continuing`); | ||
console.error(`The ${manifest.appKey} app is missing a entry in the manifest, upload a build for your app before continuing`); | ||
} | ||
@@ -290,0 +291,0 @@ })); |
@@ -42,5 +42,6 @@ import { from, of, concat } from 'rxjs'; | ||
switchMap(({ payload }) => { | ||
var _a; | ||
// TODO - use the configUrl directly from the manifest | ||
// fetch config from provider | ||
const subject = from(provider.getAppConfig(payload.key, payload.version)).pipe( | ||
const subject = from(provider.getAppConfig(payload.appKey, (_a = payload.build) === null || _a === void 0 ? void 0 : _a.version)).pipe( | ||
// filter out null values | ||
@@ -47,0 +48,0 @@ filter((x) => !!x), |
@@ -12,4 +12,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { moduleKey } from './module'; | ||
import { ApplicationManifest } from './ApplicationManifest'; | ||
import { map } from 'rxjs/operators'; | ||
import AppClient from './AppClient'; | ||
export class AppConfigurator extends BaseConfigBuilder { | ||
@@ -52,51 +51,4 @@ constructor() { | ||
const httpClient = yield this._createHttpClient(init); | ||
return { | ||
getAppManifest: { | ||
client: { | ||
fn: ({ appKey }) => httpClient | ||
.json$(`/apps/${appKey}`, { | ||
headers: { | ||
'Api-Version': '1.0', | ||
}, | ||
}) | ||
.pipe(map((apiApp) => new ApplicationManifest(apiApp))), | ||
}, | ||
key: ({ appKey }) => appKey, | ||
expire: this.defaultExpireTime, | ||
}, | ||
getAppManifests: { | ||
client: { | ||
// TODO: add to config if use me or not | ||
fn: (filter) => { | ||
const path = (filter === null || filter === void 0 ? void 0 : filter.filterByCurrentUser) | ||
? '/persons/me/apps' | ||
: '/apps'; | ||
return httpClient | ||
.json$(path, { | ||
headers: { | ||
'Api-Version': '1.0', | ||
}, | ||
}) | ||
.pipe(map((x) => { | ||
const apps = x.value.map((apiApp) => new ApplicationManifest(apiApp)); | ||
return apps; | ||
})); | ||
}, | ||
}, | ||
// TODO - might cast to checksum | ||
key: (filter) => (filter ? JSON.stringify(filter) : 'all'), | ||
expire: this.defaultExpireTime, | ||
}, | ||
getAppConfig: { | ||
client: { | ||
fn: ({ appKey, tag = 'latest' }) => httpClient.json$(`/apps/${appKey}/builds/${tag}/config`, { | ||
headers: { | ||
'Api-Version': '1.0', | ||
}, | ||
}), | ||
}, | ||
key: (args) => JSON.stringify(args), | ||
expire: this.defaultExpireTime, | ||
}, | ||
}; | ||
const appClient = new AppClient(httpClient); | ||
return appClient; | ||
})); | ||
@@ -103,0 +55,0 @@ } |
@@ -12,8 +12,5 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
}; | ||
var _AppModuleProvider_appsClient, _AppModuleProvider_configClient, _AppModuleProvider_appBaseUri, _AppModuleProvider_current$, _AppModuleProvider_subscription, _AppModuleProvider_event; | ||
import { BehaviorSubject, catchError, distinctUntilChanged, map, pairwise, Subscription, takeWhile, } from 'rxjs'; | ||
import { HttpResponseError } from '@equinor/fusion-framework-module-http'; | ||
import { Query } from '@equinor/fusion-query'; | ||
var _AppModuleProvider_appClient, _AppModuleProvider_appBaseUri, _AppModuleProvider_current$, _AppModuleProvider_subscription, _AppModuleProvider_event; | ||
import { BehaviorSubject, distinctUntilChanged, from, map, pairwise, Subscription, takeWhile, } from 'rxjs'; | ||
import { App, filterEmpty } from './app/App'; | ||
import { AppConfigError, AppManifestError } from './errors'; | ||
export class AppModuleProvider { | ||
@@ -43,5 +40,3 @@ static compareAppManifest(a, b) { | ||
var _a; | ||
_AppModuleProvider_appsClient.set(this, void 0); | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
_AppModuleProvider_configClient.set(this, void 0); | ||
_AppModuleProvider_appClient.set(this, void 0); | ||
_AppModuleProvider_appBaseUri.set(this, void 0); | ||
@@ -52,11 +47,6 @@ _AppModuleProvider_current$.set(this, void 0); | ||
const { event, config } = args; | ||
__classPrivateFieldSet(this, _AppModuleProvider_appClient, config.client, "f"); | ||
__classPrivateFieldSet(this, _AppModuleProvider_event, event, "f"); | ||
__classPrivateFieldSet(this, _AppModuleProvider_current$, new BehaviorSubject(undefined), "f"); | ||
this.appClient = new Query(config.client.getAppManifest); | ||
__classPrivateFieldSet(this, _AppModuleProvider_appsClient, new Query(config.client.getAppManifests), "f"); | ||
__classPrivateFieldSet(this, _AppModuleProvider_configClient, new Query(config.client.getAppConfig), "f"); | ||
__classPrivateFieldSet(this, _AppModuleProvider_appBaseUri, (_a = config.baseUri) !== null && _a !== void 0 ? _a : '', "f"); | ||
__classPrivateFieldGet(this, _AppModuleProvider_subscription, "f").add(() => this.appClient.complete()); | ||
__classPrivateFieldGet(this, _AppModuleProvider_subscription, "f").add(() => __classPrivateFieldGet(this, _AppModuleProvider_appsClient, "f").complete()); | ||
__classPrivateFieldGet(this, _AppModuleProvider_subscription, "f").add(() => __classPrivateFieldGet(this, _AppModuleProvider_configClient, "f").complete()); | ||
__classPrivateFieldGet(this, _AppModuleProvider_subscription, "f").add(this.current$ | ||
@@ -79,16 +69,6 @@ .pipe(pairwise(), takeWhile(() => !!event)) | ||
getAppManifest(appKey) { | ||
return Query.extractQueryValue(this.appClient.query({ appKey }).pipe(catchError((err) => { | ||
/** extract cause, since error will be a `QueryError` */ | ||
const { cause } = err; | ||
if (cause instanceof AppManifestError) { | ||
throw cause; | ||
} | ||
if (cause instanceof HttpResponseError) { | ||
throw AppManifestError.fromHttpResponse(cause.response, { cause }); | ||
} | ||
throw new AppManifestError('unknown', 'failed to load manifest', { cause }); | ||
}))); | ||
return from(__classPrivateFieldGet(this, _AppModuleProvider_appClient, "f").getAppManifest({ appKey })); | ||
} | ||
getAppManifests(filter) { | ||
return Query.extractQueryValue(__classPrivateFieldGet(this, _AppModuleProvider_appsClient, "f").query(filter)); | ||
return from(__classPrivateFieldGet(this, _AppModuleProvider_appClient, "f").getAppManifests(filter)); | ||
} | ||
@@ -107,13 +87,3 @@ /** | ||
getAppConfig(appKey, tag) { | ||
return Query.extractQueryValue(__classPrivateFieldGet(this, _AppModuleProvider_configClient, "f").query({ appKey, tag }).pipe(catchError((err) => { | ||
/** extract cause, since error will be a `QueryError` */ | ||
const { cause } = err; | ||
if (cause instanceof AppConfigError) { | ||
throw cause; | ||
} | ||
if (cause instanceof HttpResponseError) { | ||
throw AppConfigError.fromHttpResponse(cause.response, { cause }); | ||
} | ||
throw new AppConfigError('unknown', 'failed to load config', { cause }); | ||
}))); | ||
return from(__classPrivateFieldGet(this, _AppModuleProvider_appClient, "f").getAppConfig({ appKey, tag })); | ||
} | ||
@@ -146,4 +116,4 @@ /** | ||
} | ||
_AppModuleProvider_appsClient = new WeakMap(), _AppModuleProvider_configClient = new WeakMap(), _AppModuleProvider_appBaseUri = new WeakMap(), _AppModuleProvider_current$ = new WeakMap(), _AppModuleProvider_subscription = new WeakMap(), _AppModuleProvider_event = new WeakMap(); | ||
_AppModuleProvider_appClient = new WeakMap(), _AppModuleProvider_appBaseUri = new WeakMap(), _AppModuleProvider_current$ = new WeakMap(), _AppModuleProvider_subscription = new WeakMap(), _AppModuleProvider_event = new WeakMap(); | ||
export default AppModuleProvider; | ||
//# sourceMappingURL=AppModuleProvider.js.map |
export { AppConfigurator, } from './AppConfigurator'; | ||
export { AppClient } from './AppClient'; | ||
export { AppModuleProvider } from './AppModuleProvider'; | ||
export { ApplicationManifest } from './ApplicationManifest'; | ||
export * from './events'; | ||
@@ -5,0 +5,0 @@ export * from './types'; |
export {}; | ||
// export type ApiAppVersionConfig = { | ||
// environment: string; | ||
// endpoints: Record< | ||
// string, | ||
// { | ||
// url: string; | ||
// scopes: string[]; | ||
// } | ||
// >; | ||
// }; | ||
// export type ApiApp = { | ||
// appKey: string; | ||
// displayName?: string; | ||
// description?: string; | ||
// type?: AppType; | ||
// isPinned?: boolean; | ||
// templateSource?: string; | ||
// category?: AppCategory; | ||
// visualization: { | ||
// color: string; | ||
// icon: string; | ||
// sortOrder: number; | ||
// }; | ||
// keywords: string[]; | ||
// admins: AppOwnerOrAdmin[]; | ||
// owners: AppOwnerOrAdmin[]; | ||
// build: AppBuild<AzureUniqueId>; | ||
// }; | ||
//# sourceMappingURL=types.js.map |
import { ActionInstanceMap, ActionTypes } from '@equinor/fusion-observable'; | ||
import type { AppConfig, AppManifest, AppModulesInstance, AppScriptModule } from '../types'; | ||
import { ApplicationManifest } from '../ApplicationManifest'; | ||
declare const createActions: () => { | ||
/** Manifest loading */ | ||
setManifest: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: ApplicationManifest, update?: boolean | undefined], ApplicationManifest, "set_manifest", never, { | ||
setManifest: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: AppManifest, update?: boolean | undefined], AppManifest, "set_manifest", never, { | ||
created: number; | ||
@@ -13,3 +12,3 @@ update: boolean | undefined; | ||
}> & { | ||
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: ApplicationManifest], ApplicationManifest, "fetch_manifest::success", never, never>; | ||
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: AppManifest], AppManifest, "fetch_manifest::success", never, never>; | ||
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "fetch_manifest::failure", never, never>; | ||
@@ -37,3 +36,3 @@ }; | ||
/** Manifest loading */ | ||
setManifest: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: ApplicationManifest, update?: boolean | undefined], ApplicationManifest, "set_manifest", never, { | ||
setManifest: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: AppManifest, update?: boolean | undefined], AppManifest, "set_manifest", never, { | ||
created: number; | ||
@@ -45,3 +44,3 @@ update: boolean | undefined; | ||
}> & { | ||
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: ApplicationManifest], ApplicationManifest, "fetch_manifest::success", never, never>; | ||
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: AppManifest], AppManifest, "fetch_manifest::success", never, never>; | ||
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "fetch_manifest::failure", never, never>; | ||
@@ -48,0 +47,0 @@ }; |
@@ -8,4 +8,4 @@ import type { AppConfig, AppModulesInstance, AppScriptModule } from '../types'; | ||
import { AppBundleState, AppBundleStateInitial } from './types'; | ||
import { AppManifest } from '../types'; | ||
import './events'; | ||
import { ApplicationManifest } from '../ApplicationManifest'; | ||
export declare function filterEmpty<T>(): OperatorFunction<T | null | undefined, T>; | ||
@@ -22,3 +22,3 @@ /** | ||
*/ | ||
get manifest$(): Observable<ApplicationManifest>; | ||
get manifest$(): Observable<AppManifest>; | ||
/** | ||
@@ -53,3 +53,3 @@ * Observable that emits the configuration of the app. | ||
*/ | ||
get manifest(): Readonly<ApplicationManifest> | undefined; | ||
get manifest(): Readonly<AppManifest> | undefined; | ||
/** | ||
@@ -59,3 +59,3 @@ * Retrieves the manifest asynchronously. | ||
*/ | ||
get manifestAsync(): Promise<Readonly<ApplicationManifest>>; | ||
get manifestAsync(): Promise<Readonly<AppManifest>>; | ||
/** | ||
@@ -87,3 +87,3 @@ * Gets the configuration of the app. | ||
initialize(): Observable<{ | ||
manifest: ApplicationManifest; | ||
manifest: AppManifest; | ||
script: AppScriptModule; | ||
@@ -122,3 +122,3 @@ config: AppConfig; | ||
*/ | ||
getManifest(force_refresh?: boolean): Observable<ApplicationManifest>; | ||
getManifest(force_refresh?: boolean): Observable<AppManifest>; | ||
/** | ||
@@ -129,3 +129,3 @@ * Retrieves the app manifest asynchronously. | ||
*/ | ||
getManifestAsync(allow_cache?: boolean): Promise<ApplicationManifest>; | ||
getManifestAsync(allow_cache?: boolean): Promise<AppManifest>; | ||
/** | ||
@@ -146,3 +146,3 @@ * Gets the app module. | ||
#private; | ||
get manifest$(): Observable<ApplicationManifest>; | ||
get manifest$(): Observable<AppManifest>; | ||
get config$(): Observable<AppConfig<TEnv>>; | ||
@@ -153,4 +153,4 @@ get modules$(): Observable<AppScriptModule>; | ||
get appKey(): string; | ||
get manifest(): Readonly<ApplicationManifest> | undefined; | ||
get manifestAsync(): Promise<Readonly<ApplicationManifest>>; | ||
get manifest(): Readonly<AppManifest> | undefined; | ||
get manifestAsync(): Promise<Readonly<AppManifest>>; | ||
get config(): Readonly<AppConfig<TEnv>> | undefined; | ||
@@ -164,3 +164,3 @@ get configAsync(): Promise<Readonly<AppConfig<TEnv>>>; | ||
initialize(): Observable<{ | ||
manifest: ApplicationManifest; | ||
manifest: AppManifest; | ||
script: AppScriptModule; | ||
@@ -171,8 +171,8 @@ config: AppConfig; | ||
loadManifest(update?: boolean): void; | ||
updateManifest(manifest: ApplicationManifest, replace?: false): void; | ||
updateManifest(manifest: AppManifest, replace?: false): void; | ||
loadAppModule(allow_cache?: boolean): Promise<void>; | ||
getConfig(force_refresh?: boolean): Observable<AppConfig>; | ||
getConfigAsync(allow_cache?: boolean): Promise<AppConfig>; | ||
getManifest(force_refresh?: boolean): Observable<ApplicationManifest>; | ||
getManifestAsync(allow_cache?: boolean): Promise<ApplicationManifest>; | ||
getManifest(force_refresh?: boolean): Observable<AppManifest>; | ||
getManifestAsync(allow_cache?: boolean): Promise<AppManifest>; | ||
getAppModule(force_refresh?: boolean): Observable<AppScriptModule>; | ||
@@ -179,0 +179,0 @@ getAppModuleAsync(allow_cache?: boolean): Promise<AppScriptModule>; |
import { AppBundleState, AppBundleStateInitial } from './types'; | ||
export declare const createReducer: (value: AppBundleStateInitial) => import("@equinor/fusion-observable").ReducerWithInitialState<AppBundleState, import("@equinor/fusion-observable").PayloadAction<import("..").ApplicationManifest, "set_manifest", { | ||
export declare const createReducer: (value: AppBundleStateInitial) => import("@equinor/fusion-observable").ReducerWithInitialState<AppBundleState, import("@equinor/fusion-observable").PayloadAction<import("..").AppManifest, "set_manifest", { | ||
created: number; | ||
@@ -26,3 +26,3 @@ update: boolean | undefined; | ||
} | { | ||
payload: import("..").ApplicationManifest; | ||
payload: import("..").AppManifest; | ||
type: "fetch_manifest::success"; | ||
@@ -29,0 +29,0 @@ } | { |
@@ -1,7 +0,6 @@ | ||
import type { AppConfig, AppModulesInstance, AppScriptModule } from '../types'; | ||
import { ApplicationManifest } from '../ApplicationManifest'; | ||
import type { AppManifest, AppConfig, AppModulesInstance, AppScriptModule } from '../types'; | ||
export type AppBundleState<TConfig = any, TModules = any> = { | ||
appKey: string; | ||
status: Set<string>; | ||
manifest?: ApplicationManifest; | ||
manifest?: AppManifest; | ||
config?: AppConfig<TConfig>; | ||
@@ -8,0 +7,0 @@ modules?: AppScriptModule; |
import { BaseConfigBuilder, ConfigBuilderCallback, type ModuleInitializerArgs } from '@equinor/fusion-framework-module'; | ||
import type { HttpModule, IHttpClient } from '@equinor/fusion-framework-module-http'; | ||
import type { ServiceDiscoveryModule } from '@equinor/fusion-framework-module-service-discovery'; | ||
import type { QueryCtorOptions } from '@equinor/fusion-query'; | ||
import type { AppConfig } from './types'; | ||
import { ApplicationManifest } from './ApplicationManifest'; | ||
import { IAppClient } from './AppClient'; | ||
export interface AppModuleConfig { | ||
client: { | ||
getAppManifest: QueryCtorOptions<ApplicationManifest, { | ||
appKey: string; | ||
}>; | ||
getAppManifests: QueryCtorOptions<ApplicationManifest[], { | ||
filterByCurrentUser?: boolean; | ||
} | undefined>; | ||
getAppConfig: QueryCtorOptions<AppConfig, { | ||
appKey: string; | ||
tag?: string; | ||
}>; | ||
}; | ||
client: IAppClient; | ||
baseUri?: string; | ||
@@ -21,0 +8,0 @@ } |
import { Observable } from 'rxjs'; | ||
import { ModuleType } from '@equinor/fusion-framework-module'; | ||
import { EventModule } from '@equinor/fusion-framework-module-event'; | ||
import { Query } from '@equinor/fusion-query'; | ||
import type { AppConfig, CurrentApp } from './types'; | ||
import { ApplicationManifest } from './ApplicationManifest'; | ||
import type { AppConfig, AppManifest, CurrentApp } from './types'; | ||
import { App, IApp } from './app/App'; | ||
@@ -12,6 +10,3 @@ import { AppModuleConfig } from './AppConfigurator'; | ||
#private; | ||
static compareAppManifest<T extends ApplicationManifest>(a?: T, b?: T): boolean; | ||
appClient: Query<ApplicationManifest, { | ||
appKey: string; | ||
}>; | ||
static compareAppManifest<T extends AppManifest>(a?: T, b?: T): boolean; | ||
/** | ||
@@ -34,6 +29,6 @@ * fetch an application by key | ||
*/ | ||
getAppManifest(appKey: string): Observable<ApplicationManifest>; | ||
getAppManifest(appKey: string): Observable<AppManifest>; | ||
getAppManifests(filter?: { | ||
filterByCurrentUser: boolean; | ||
}): Observable<ApplicationManifest[]>; | ||
}): Observable<AppManifest[]>; | ||
/** | ||
@@ -43,3 +38,3 @@ * fetch all applications | ||
*/ | ||
getAllAppManifests(): Observable<ApplicationManifest[]>; | ||
getAllAppManifests(): Observable<AppManifest[]>; | ||
/** | ||
@@ -46,0 +41,0 @@ * fetch configuration for an application |
@@ -1,5 +0,5 @@ | ||
export { AppModuleConfig, AppConfigurator, IAppConfigurator, AppModuleConfig as IAppModuleConfig, } from './AppConfigurator'; | ||
export { AppModuleConfig, AppConfigurator, IAppConfigurator, type AppModuleConfig as IAppModuleConfig, } from './AppConfigurator'; | ||
export { AppClient, type IAppClient } from './AppClient'; | ||
export { AppModuleProvider } from './AppModuleProvider'; | ||
export { IApp } from './app/App'; | ||
export { ApplicationManifest } from './ApplicationManifest'; | ||
export * from './events'; | ||
@@ -6,0 +6,0 @@ export * from './types'; |
@@ -7,7 +7,6 @@ import { AnyModule, CombinedModules, ModulesInstance } from '@equinor/fusion-framework-module'; | ||
import IApp from './app'; | ||
import { ApplicationManifest } from './ApplicationManifest'; | ||
type Fusion = any; | ||
export type AppEnv<TConfig = unknown, TProps = unknown> = { | ||
basename?: string; | ||
manifest?: ApplicationManifest; | ||
manifest?: AppManifest; | ||
config?: AppConfig<TConfig>; | ||
@@ -19,30 +18,17 @@ props?: TProps; | ||
export type CurrentApp<TModules extends Array<AnyModule> = [], TEnv = any> = IApp<TEnv, TModules> | null | undefined; | ||
export type AppAuth = { | ||
clientId: string; | ||
resources: string[]; | ||
}; | ||
type AppCategory = { | ||
export type AppAdmin = { | ||
id: string; | ||
name?: string | null; | ||
displayName?: string | null; | ||
color?: string | null; | ||
defaultIcon?: string | null; | ||
sortOrder: number; | ||
azureUniqueId?: string; | ||
displayName?: string; | ||
mail?: string; | ||
upn?: string; | ||
accountType?: string; | ||
accountClassification?: string; | ||
}; | ||
type AppVisualization = { | ||
color?: string | null; | ||
icon?: string | null; | ||
sortOrder: number; | ||
}; | ||
export type AzureId = { | ||
azureId: string; | ||
}; | ||
export type AzureUniqueId = { | ||
azureUniqueId: string; | ||
}; | ||
export type AppBuild<TUploaderId = AzureId | AzureUniqueId> = { | ||
export type AppOwner = AppAdmin; | ||
export type AppBuildManifest = { | ||
version?: string; | ||
entryPoint?: string; | ||
tags?: string[]; | ||
tag?: string; | ||
tag?: 'latest' | 'preview'; | ||
assetPath?: string; | ||
@@ -54,3 +40,5 @@ configUrl?: string; | ||
projectPage?: string; | ||
annotations?: Record<string, string>; | ||
uploadedBy?: { | ||
azureUniqueId: string; | ||
displayName?: string; | ||
@@ -61,38 +49,24 @@ mail?: string; | ||
accountClassification?: string; | ||
} & TUploaderId; | ||
}; | ||
}; | ||
export type AppOwnerOrAdmin = { | ||
id: string; | ||
azureId?: string; | ||
azureUniqueId?: string; | ||
displayName?: string; | ||
mail?: string; | ||
upn?: string; | ||
accountType?: string; | ||
accountClassification?: string; | ||
}; | ||
export interface AppManifest { | ||
key: string; | ||
/** @deprecated will be removed, use appKey */ | ||
key?: string; | ||
appKey: string; | ||
/** @deprecated will be removed, use displayName */ | ||
name?: string; | ||
entry?: string; | ||
version?: string; | ||
shortName?: string; | ||
displayName?: string; | ||
description?: string; | ||
keywords?: string[]; | ||
type?: AppType; | ||
isPinned?: boolean; | ||
tags?: string[]; | ||
tag?: string; | ||
auth?: AppOwnerOrAdmin[]; | ||
icon?: string; | ||
order?: number; | ||
publishedDate?: string; | ||
accentColor?: string; | ||
categoryId?: string; | ||
category?: AppCategory; | ||
hide?: boolean; | ||
visualization?: AppVisualization; | ||
admins?: AppOwnerOrAdmin[]; | ||
owners?: AppOwnerOrAdmin[]; | ||
build?: AppBuild<AzureId>; | ||
visualization?: { | ||
color?: string; | ||
icon?: string; | ||
sortOrder: number; | ||
}; | ||
keywords?: string[]; | ||
admins?: AppAdmin[]; | ||
owners?: AppOwner[]; | ||
build?: AppBuildManifest; | ||
} | ||
@@ -112,3 +86,3 @@ export type Endpoint = { | ||
export type AppBundle<TEnvironment = unknown, TModule = unknown> = { | ||
manifest: ApplicationManifest; | ||
manifest: AppManifest; | ||
config: AppConfig<TEnvironment>; | ||
@@ -131,27 +105,2 @@ module: TModule; | ||
export type AppModulesInstance<TModules extends Array<AnyModule> | unknown = unknown> = ModulesInstance<AppModules<TModules>>; | ||
export type ApiAppVersionConfig = { | ||
environment: string; | ||
endpoints: Record<string, { | ||
url: string; | ||
scopes: string[]; | ||
}>; | ||
}; | ||
export type ApiApp = { | ||
appKey: string; | ||
displayName?: string; | ||
description?: string; | ||
type?: AppType; | ||
isPinned?: boolean; | ||
templateSource?: string; | ||
category?: AppCategory; | ||
visualization: { | ||
color: string; | ||
icon: string; | ||
sortOrder: number; | ||
}; | ||
keywords: string[]; | ||
admins: AppOwnerOrAdmin[]; | ||
owners: AppOwnerOrAdmin[]; | ||
build: AppBuild<AzureUniqueId>; | ||
}; | ||
export {}; |
{ | ||
"name": "@equinor/fusion-framework-module-app", | ||
"version": "5.3.12-alpha-2e0570c4bda6180049fc0620aa03048d737e5831", | ||
"version": "6.0.0-alpha-52e7df9067d9a1af015e2e6f0af2a5bcfb49f521", | ||
"description": "", | ||
@@ -21,2 +21,5 @@ "main": "dist/esm/index.js", | ||
"import": "./dist/esm/app/*.js" | ||
}, | ||
"./application.schema.js": { | ||
"import": "./dist/esm/application.schema.js" | ||
} | ||
@@ -52,2 +55,3 @@ }, | ||
"rxjs": "^7.8.1", | ||
"zod": "^3.23.8", | ||
"@equinor/fusion-observable": "^8.4.1", | ||
@@ -58,7 +62,7 @@ "@equinor/fusion-query": "^5.1.3" | ||
"typescript": "^5.5.4", | ||
"@equinor/fusion-framework-module": "^4.3.5-alpha-2e0570c4bda6180049fc0620aa03048d737e5831", | ||
"@equinor/fusion-framework-module-event": "^4.2.4-alpha-2e0570c4bda6180049fc0620aa03048d737e5831", | ||
"@equinor/fusion-framework-module-http": "^6.1.0-alpha-2e0570c4bda6180049fc0620aa03048d737e5831", | ||
"@equinor/fusion-framework-module-service-discovery": "^8.0.0-alpha-2e0570c4bda6180049fc0620aa03048d737e5831", | ||
"@equinor/fusion-framework-module-msal": "^3.1.5-alpha-2e0570c4bda6180049fc0620aa03048d737e5831" | ||
"@equinor/fusion-framework-module": "^4.3.5-alpha-52e7df9067d9a1af015e2e6f0af2a5bcfb49f521", | ||
"@equinor/fusion-framework-module-event": "^4.2.4-alpha-52e7df9067d9a1af015e2e6f0af2a5bcfb49f521", | ||
"@equinor/fusion-framework-module-http": "^6.1.0-alpha-52e7df9067d9a1af015e2e6f0af2a5bcfb49f521", | ||
"@equinor/fusion-framework-module-msal": "^3.1.5-alpha-52e7df9067d9a1af015e2e6f0af2a5bcfb49f521", | ||
"@equinor/fusion-framework-module-service-discovery": "^8.0.0-alpha-52e7df9067d9a1af015e2e6f0af2a5bcfb49f521" | ||
}, | ||
@@ -65,0 +69,0 @@ "scripts": { |
@@ -8,17 +8,13 @@ import { | ||
import type { AppConfig, AppManifest, AppModulesInstance, AppScriptModule } from '../types'; | ||
import { ApplicationManifest } from '../ApplicationManifest'; | ||
const createActions = () => ({ | ||
/** Manifest loading */ | ||
setManifest: createAction( | ||
'set_manifest', | ||
(manifest: ApplicationManifest, update?: boolean) => ({ | ||
payload: manifest, | ||
meta: { | ||
// TODO when updating | ||
created: Date.now(), | ||
update, | ||
}, | ||
}), | ||
), | ||
setManifest: createAction('set_manifest', (manifest: AppManifest, update?: boolean) => ({ | ||
payload: manifest, | ||
meta: { | ||
// TODO when updating | ||
created: Date.now(), | ||
update, | ||
}, | ||
})), | ||
@@ -28,3 +24,3 @@ fetchManifest: createAsyncAction( | ||
(key: string, update?: boolean) => ({ payload: key, meta: { update } }), | ||
(manifest: ApplicationManifest) => ({ payload: manifest }), | ||
(manifest: AppManifest) => ({ payload: manifest }), | ||
(error: unknown) => ({ payload: error }), | ||
@@ -31,0 +27,0 @@ ), |
@@ -20,5 +20,5 @@ import type { AppConfig, AppModulesInstance, AppScriptModule } from '../types'; | ||
import { AppBundleState, AppBundleStateInitial } from './types'; | ||
import { AppManifest } from '../types'; | ||
import './events'; | ||
import { ApplicationManifest } from '../ApplicationManifest'; | ||
@@ -41,3 +41,3 @@ // TODO - move globally | ||
*/ | ||
get manifest$(): Observable<ApplicationManifest>; | ||
get manifest$(): Observable<AppManifest>; | ||
@@ -78,3 +78,3 @@ /** | ||
*/ | ||
get manifest(): Readonly<ApplicationManifest> | undefined; | ||
get manifest(): Readonly<AppManifest> | undefined; | ||
@@ -85,3 +85,3 @@ /** | ||
*/ | ||
get manifestAsync(): Promise<Readonly<ApplicationManifest>>; | ||
get manifestAsync(): Promise<Readonly<AppManifest>>; | ||
@@ -116,3 +116,3 @@ /** | ||
initialize(): Observable<{ | ||
manifest: ApplicationManifest; | ||
manifest: AppManifest; | ||
script: AppScriptModule; | ||
@@ -157,3 +157,3 @@ config: AppConfig; | ||
*/ | ||
getManifest(force_refresh?: boolean): Observable<ApplicationManifest>; | ||
getManifest(force_refresh?: boolean): Observable<AppManifest>; | ||
@@ -165,3 +165,3 @@ /** | ||
*/ | ||
getManifestAsync(allow_cache?: boolean): Promise<ApplicationManifest>; | ||
getManifestAsync(allow_cache?: boolean): Promise<AppManifest>; | ||
@@ -192,3 +192,3 @@ /** | ||
get manifest$(): Observable<ApplicationManifest> { | ||
get manifest$(): Observable<AppManifest> { | ||
return this.#state.pipe( | ||
@@ -232,7 +232,7 @@ map(({ manifest }) => manifest), | ||
get manifest(): Readonly<ApplicationManifest> | undefined { | ||
get manifest(): Readonly<AppManifest> | undefined { | ||
return this.state.manifest; | ||
} | ||
get manifestAsync(): Promise<Readonly<ApplicationManifest>> { | ||
get manifestAsync(): Promise<Readonly<AppManifest>> { | ||
return firstValueFrom(this.manifest$); | ||
@@ -416,3 +416,3 @@ } | ||
public initialize(): Observable<{ | ||
manifest: ApplicationManifest; | ||
manifest: AppManifest; | ||
script: AppScriptModule; | ||
@@ -465,3 +465,3 @@ config: AppConfig; | ||
public updateManifest(manifest: ApplicationManifest, replace?: false) { | ||
public updateManifest(manifest: AppManifest, replace?: false) { | ||
this.#state.next(actions.setManifest(manifest, !replace)); | ||
@@ -472,7 +472,7 @@ } | ||
const manifest = await this.getManifestAsync(allow_cache); | ||
if (manifest.build.entryPoint) { | ||
if (manifest.build?.entryPoint) { | ||
this.#state.next(actions.importApp(manifest.build.entryPoint)); | ||
} else { | ||
console.log( | ||
`The ${manifest.key} is missing entryPoint, please upload a build for the app before continuing`, | ||
`The ${manifest.appKey} is missing entryPoint, please upload a build for the app before continuing`, | ||
); | ||
@@ -534,3 +534,3 @@ } | ||
public getManifest(force_refresh = false): Observable<ApplicationManifest> { | ||
public getManifest(force_refresh = false): Observable<AppManifest> { | ||
return new Observable((subscriber) => { | ||
@@ -579,3 +579,3 @@ if (this.#state.value.manifest) { | ||
public getManifestAsync(allow_cache = true): Promise<ApplicationManifest> { | ||
public getManifestAsync(allow_cache = true): Promise<AppManifest> { | ||
// when allow_cache is true, use first emitted value, otherwise use last emitted value | ||
@@ -632,7 +632,7 @@ const operator = allow_cache ? firstValueFrom : lastValueFrom; | ||
this.getManifest().subscribe((manifest) => { | ||
if (manifest.build.entryPoint) { | ||
if (manifest.build?.entryPoint) { | ||
// TODO - this should come from backend | ||
const assetPath = | ||
manifest.build.assetPath ?? | ||
[manifest.key, manifest.build.version].join('@'); | ||
[manifest.appKey, manifest.build.version].join('@'); | ||
// dispatch import_app action to load the application script | ||
@@ -644,3 +644,3 @@ this.#state.next( | ||
console.error( | ||
`The ${manifest.key} app is missing a entry in the manifest, upload a build for your app before continuing`, | ||
`The ${manifest.appKey} app is missing a entry in the manifest, upload a build for your app before continuing`, | ||
); | ||
@@ -647,0 +647,0 @@ } |
@@ -72,3 +72,5 @@ import { from, of, concat } from 'rxjs'; | ||
// fetch config from provider | ||
const subject = from(provider.getAppConfig(payload.key, payload.version)).pipe( | ||
const subject = from( | ||
provider.getAppConfig(payload.appKey, payload.build?.version), | ||
).pipe( | ||
// filter out null values | ||
@@ -75,0 +77,0 @@ filter((x) => !!x), |
@@ -1,3 +0,2 @@ | ||
import type { AppConfig, AppModulesInstance, AppScriptModule } from '../types'; | ||
import { ApplicationManifest } from '../ApplicationManifest'; | ||
import type { AppManifest, AppConfig, AppModulesInstance, AppScriptModule } from '../types'; | ||
@@ -8,3 +7,3 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
status: Set<string>; | ||
manifest?: ApplicationManifest; | ||
manifest?: AppManifest; | ||
config?: AppConfig<TConfig>; | ||
@@ -11,0 +10,0 @@ modules?: AppScriptModule; |
@@ -8,19 +8,9 @@ import { | ||
import type { ServiceDiscoveryModule } from '@equinor/fusion-framework-module-service-discovery'; | ||
import type { QueryCtorOptions } from '@equinor/fusion-query'; | ||
import { moduleKey } from './module'; | ||
import type { AppConfig, ApiApp, ApiAppVersionConfig } from './types'; | ||
import { ApplicationManifest } from './ApplicationManifest'; | ||
import { map } from 'rxjs/operators'; | ||
import AppClient, { IAppClient } from './AppClient'; | ||
export interface AppModuleConfig { | ||
client: { | ||
getAppManifest: QueryCtorOptions<ApplicationManifest, { appKey: string }>; | ||
getAppManifests: QueryCtorOptions< | ||
ApplicationManifest[], | ||
{ filterByCurrentUser?: boolean } | undefined | ||
>; | ||
getAppConfig: QueryCtorOptions<AppConfig, { appKey: string; tag?: string }>; | ||
}; | ||
client: IAppClient; | ||
baseUri?: string; | ||
@@ -86,60 +76,4 @@ } | ||
const httpClient = await this._createHttpClient(init); | ||
return { | ||
getAppManifest: { | ||
client: { | ||
fn: ({ appKey }) => | ||
httpClient | ||
.json$<ApiApp>(`/apps/${appKey}`, { | ||
headers: { | ||
'Api-Version': '1.0', | ||
}, | ||
}) | ||
.pipe(map((apiApp) => new ApplicationManifest(apiApp))), | ||
}, | ||
key: ({ appKey }) => appKey, | ||
expire: this.defaultExpireTime, | ||
}, | ||
getAppManifests: { | ||
client: { | ||
// TODO: add to config if use me or not | ||
fn: (filter) => { | ||
const path = filter?.filterByCurrentUser | ||
? '/persons/me/apps' | ||
: '/apps'; | ||
return httpClient | ||
.json$<{ value: ApiApp[] }>(path, { | ||
headers: { | ||
'Api-Version': '1.0', | ||
}, | ||
}) | ||
.pipe( | ||
map((x) => { | ||
const apps = x.value.map( | ||
(apiApp) => new ApplicationManifest(apiApp), | ||
); | ||
return apps; | ||
}), | ||
); | ||
}, | ||
}, | ||
// TODO - might cast to checksum | ||
key: (filter) => (filter ? JSON.stringify(filter) : 'all'), | ||
expire: this.defaultExpireTime, | ||
}, | ||
getAppConfig: { | ||
client: { | ||
fn: ({ appKey, tag = 'latest' }) => | ||
httpClient.json$<ApiAppVersionConfig>( | ||
`/apps/${appKey}/builds/${tag}/config`, | ||
{ | ||
headers: { | ||
'Api-Version': '1.0', | ||
}, | ||
}, | ||
), | ||
}, | ||
key: (args) => JSON.stringify(args), | ||
expire: this.defaultExpireTime, | ||
}, | ||
}; | ||
const appClient = new AppClient(httpClient); | ||
return appClient; | ||
}); | ||
@@ -146,0 +80,0 @@ } |
import { | ||
BehaviorSubject, | ||
catchError, | ||
distinctUntilChanged, | ||
from, | ||
map, | ||
@@ -13,24 +13,17 @@ Observable, | ||
import { ModuleType } from '@equinor/fusion-framework-module'; | ||
import { HttpResponseError } from '@equinor/fusion-framework-module-http'; | ||
import { EventModule } from '@equinor/fusion-framework-module-event'; | ||
import { Query } from '@equinor/fusion-query'; | ||
import type { AppConfig, AppManifest, CurrentApp } from './types'; | ||
import type { AppConfig, CurrentApp } from './types'; | ||
import { ApplicationManifest } from './ApplicationManifest'; | ||
import { App, filterEmpty, IApp } from './app/App'; | ||
import { AppModuleConfig } from './AppConfigurator'; | ||
import { AppConfigError, AppManifestError } from './errors'; | ||
import { AppBundleStateInitial } from './app/types'; | ||
import { IAppClient } from './AppClient'; | ||
export class AppModuleProvider { | ||
static compareAppManifest<T extends ApplicationManifest>(a?: T, b?: T): boolean { | ||
static compareAppManifest<T extends AppManifest>(a?: T, b?: T): boolean { | ||
return JSON.stringify(a) === JSON.stringify(b); | ||
} | ||
public appClient: Query<ApplicationManifest, { appKey: string }>; | ||
#appsClient: Query<ApplicationManifest[], { filterByCurrentUser?: boolean } | undefined>; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
#configClient: Query<AppConfig<any>, { appKey: string; tag?: string }>; | ||
#appClient: IAppClient; | ||
@@ -70,2 +63,3 @@ #appBaseUri: string; | ||
this.#appClient = config.client; | ||
this.#event = event; | ||
@@ -75,11 +69,4 @@ | ||
this.appClient = new Query(config.client.getAppManifest); | ||
this.#appsClient = new Query(config.client.getAppManifests); | ||
this.#configClient = new Query(config.client.getAppConfig); | ||
this.#appBaseUri = config.baseUri ?? ''; | ||
this.#subscription.add(() => this.appClient.complete()); | ||
this.#subscription.add(() => this.#appsClient.complete()); | ||
this.#subscription.add(() => this.#configClient.complete()); | ||
this.#subscription.add( | ||
@@ -114,24 +101,8 @@ this.current$ | ||
*/ | ||
public getAppManifest(appKey: string): Observable<ApplicationManifest> { | ||
return Query.extractQueryValue( | ||
this.appClient.query({ appKey }).pipe( | ||
catchError((err) => { | ||
/** extract cause, since error will be a `QueryError` */ | ||
const { cause } = err; | ||
if (cause instanceof AppManifestError) { | ||
throw cause; | ||
} | ||
if (cause instanceof HttpResponseError) { | ||
throw AppManifestError.fromHttpResponse(cause.response, { cause }); | ||
} | ||
throw new AppManifestError('unknown', 'failed to load manifest', { cause }); | ||
}), | ||
), | ||
); | ||
public getAppManifest(appKey: string): Observable<AppManifest> { | ||
return from(this.#appClient.getAppManifest({ appKey })); | ||
} | ||
public getAppManifests(filter?: { | ||
filterByCurrentUser: boolean; | ||
}): Observable<ApplicationManifest[]> { | ||
return Query.extractQueryValue(this.#appsClient.query(filter)); | ||
public getAppManifests(filter?: { filterByCurrentUser: boolean }): Observable<AppManifest[]> { | ||
return from(this.#appClient.getAppManifests(filter)); | ||
} | ||
@@ -143,3 +114,3 @@ | ||
*/ | ||
public getAllAppManifests(): Observable<ApplicationManifest[]> { | ||
public getAllAppManifests(): Observable<AppManifest[]> { | ||
return this.getAppManifests(); | ||
@@ -156,17 +127,3 @@ } | ||
): Observable<AppConfig<TType>> { | ||
return Query.extractQueryValue( | ||
this.#configClient.query({ appKey, tag }).pipe( | ||
catchError((err) => { | ||
/** extract cause, since error will be a `QueryError` */ | ||
const { cause } = err; | ||
if (cause instanceof AppConfigError) { | ||
throw cause; | ||
} | ||
if (cause instanceof HttpResponseError) { | ||
throw AppConfigError.fromHttpResponse(cause.response, { cause }); | ||
} | ||
throw new AppConfigError('unknown', 'failed to load config', { cause }); | ||
}), | ||
), | ||
); | ||
return from(this.#appClient.getAppConfig<TType>({ appKey, tag })); | ||
} | ||
@@ -173,0 +130,0 @@ |
@@ -5,4 +5,7 @@ export { | ||
IAppConfigurator, | ||
AppModuleConfig as IAppModuleConfig, | ||
type AppModuleConfig as IAppModuleConfig, | ||
} from './AppConfigurator'; | ||
export { AppClient, type IAppClient } from './AppClient'; | ||
export { AppModuleProvider } from './AppModuleProvider'; | ||
@@ -12,4 +15,2 @@ | ||
export { ApplicationManifest } from './ApplicationManifest'; | ||
export * from './events'; | ||
@@ -16,0 +17,0 @@ export * from './types'; |
142
src/types.ts
@@ -7,3 +7,2 @@ import { AnyModule, CombinedModules, ModulesInstance } from '@equinor/fusion-framework-module'; | ||
import IApp from './app'; | ||
import { ApplicationManifest } from './ApplicationManifest'; | ||
@@ -16,3 +15,3 @@ // TODO | ||
basename?: string; | ||
manifest?: ApplicationManifest; | ||
manifest?: AppManifest; | ||
config?: AppConfig<TConfig>; | ||
@@ -33,33 +32,19 @@ props?: TProps; | ||
export type AppAuth = { | ||
clientId: string; | ||
resources: string[]; | ||
}; | ||
type AppCategory = { | ||
export type AppAdmin = { | ||
id: string; | ||
name?: string | null; | ||
displayName?: string | null; | ||
color?: string | null; | ||
defaultIcon?: string | null; | ||
sortOrder: number; | ||
azureUniqueId?: string; | ||
displayName?: string; | ||
mail?: string; | ||
upn?: string; | ||
accountType?: string; | ||
accountClassification?: string; | ||
}; | ||
type AppVisualization = { | ||
color?: string | null; | ||
icon?: string | null; | ||
sortOrder: number; | ||
}; | ||
export type AppOwner = AppAdmin; | ||
export type AzureId = { | ||
azureId: string; | ||
}; | ||
export type AzureUniqueId = { | ||
azureUniqueId: string; | ||
}; | ||
export type AppBuild<TUploaderId = AzureId | AzureUniqueId> = { | ||
export type AppBuildManifest = { | ||
version?: string; | ||
entryPoint?: string; | ||
tags?: string[]; | ||
tag?: string; | ||
tag?: 'latest' | 'preview'; | ||
assetPath?: string; | ||
@@ -71,3 +56,5 @@ configUrl?: string; | ||
projectPage?: string; | ||
annotations?: Record<string, string>; | ||
uploadedBy?: { | ||
azureUniqueId: string; | ||
displayName?: string; | ||
@@ -78,40 +65,25 @@ mail?: string; | ||
accountClassification?: string; | ||
} & TUploaderId; | ||
}; | ||
}; | ||
export type AppOwnerOrAdmin = { | ||
id: string; | ||
azureId?: string; | ||
azureUniqueId?: string; | ||
displayName?: string; | ||
mail?: string; | ||
upn?: string; | ||
accountType?: string; | ||
accountClassification?: string; | ||
}; | ||
export interface AppManifest { | ||
key: string; | ||
/** @deprecated will be removed, use appKey */ | ||
key?: string; | ||
appKey: string; | ||
/** @deprecated will be removed, use displayName */ | ||
name?: string; | ||
entry?: string; | ||
version?: string; | ||
shortName?: string; | ||
displayName?: string; | ||
description?: string; | ||
keywords?: string[]; | ||
type?: AppType; | ||
isPinned?: boolean; | ||
tags?: string[]; | ||
tag?: string; | ||
auth?: AppOwnerOrAdmin[]; | ||
icon?: string; | ||
order?: number; | ||
publishedDate?: string; | ||
accentColor?: string; | ||
categoryId?: string; | ||
category?: AppCategory; | ||
hide?: boolean; | ||
visualization?: AppVisualization; | ||
admins?: AppOwnerOrAdmin[]; | ||
owners?: AppOwnerOrAdmin[]; | ||
build?: AppBuild<AzureId>; | ||
visualization?: { | ||
color?: string; | ||
icon?: string; | ||
sortOrder: number; | ||
}; | ||
keywords?: string[]; | ||
admins?: AppAdmin[]; | ||
owners?: AppOwner[]; | ||
build?: AppBuildManifest; | ||
} | ||
@@ -131,3 +103,3 @@ | ||
export type AppBundle<TEnvironment = unknown, TModule = unknown> = { | ||
manifest: ApplicationManifest; | ||
manifest: AppManifest; | ||
config: AppConfig<TEnvironment>; | ||
@@ -155,30 +127,30 @@ module: TModule; | ||
export type ApiAppVersionConfig = { | ||
environment: string; | ||
endpoints: Record< | ||
string, | ||
{ | ||
url: string; | ||
scopes: string[]; | ||
} | ||
>; | ||
}; | ||
// export type ApiAppVersionConfig = { | ||
// environment: string; | ||
// endpoints: Record< | ||
// string, | ||
// { | ||
// url: string; | ||
// scopes: string[]; | ||
// } | ||
// >; | ||
// }; | ||
export type ApiApp = { | ||
appKey: string; | ||
displayName?: string; | ||
description?: string; | ||
type?: AppType; | ||
isPinned?: boolean; | ||
templateSource?: string; | ||
category?: AppCategory; | ||
visualization: { | ||
color: string; | ||
icon: string; | ||
sortOrder: number; | ||
}; | ||
keywords: string[]; | ||
admins: AppOwnerOrAdmin[]; | ||
owners: AppOwnerOrAdmin[]; | ||
build: AppBuild<AzureUniqueId>; | ||
}; | ||
// export type ApiApp = { | ||
// appKey: string; | ||
// displayName?: string; | ||
// description?: string; | ||
// type?: AppType; | ||
// isPinned?: boolean; | ||
// templateSource?: string; | ||
// category?: AppCategory; | ||
// visualization: { | ||
// color: string; | ||
// icon: string; | ||
// sortOrder: number; | ||
// }; | ||
// keywords: string[]; | ||
// admins: AppOwnerOrAdmin[]; | ||
// owners: AppOwnerOrAdmin[]; | ||
// build: AppBuild<AzureUniqueId>; | ||
// }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
383504
82
4212
5
+ Addedzod@^3.23.8
+ Addedzod@3.24.1(transitive)