@equinor/fusion-framework-module-app 8.0.2 → 8.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/esm/AppClient.js +75 -8
- package/dist/esm/AppClient.js.map +1 -1
- package/dist/esm/AppConfig.js +9 -1
- package/dist/esm/AppConfig.js.map +1 -1
- package/dist/esm/{AppClient.Selectors.js → AppConfigSelector.js} +1 -1
- package/dist/esm/AppConfigSelector.js.map +1 -0
- package/dist/esm/AppConfigurator.js +28 -2
- package/dist/esm/AppConfigurator.js.map +1 -1
- package/dist/esm/AppModuleProvider.js +16 -0
- package/dist/esm/AppModuleProvider.js.map +1 -1
- package/dist/esm/app/App.js +82 -24
- package/dist/esm/app/App.js.map +1 -1
- package/dist/esm/app/actions.js +2 -2
- package/dist/esm/app/actions.js.map +1 -1
- package/dist/esm/app/create-reducer.js +2 -1
- package/dist/esm/app/create-reducer.js.map +1 -1
- package/dist/esm/app/filter-empty.js +11 -0
- package/dist/esm/app/filter-empty.js.map +1 -0
- package/dist/esm/app/flows/handle-fetch-config.js +30 -0
- package/dist/esm/app/flows/handle-fetch-config.js.map +1 -0
- package/dist/esm/app/flows/handle-fetch-manifest.js +30 -0
- package/dist/esm/app/flows/handle-fetch-manifest.js.map +1 -0
- package/dist/esm/app/flows/handle-fetch-settings.js +30 -0
- package/dist/esm/app/flows/handle-fetch-settings.js.map +1 -0
- package/dist/esm/app/flows/handle-import-application.js +23 -0
- package/dist/esm/app/flows/handle-import-application.js.map +1 -0
- package/dist/esm/app/flows/handle-update-settings.js +22 -0
- package/dist/esm/app/flows/handle-update-settings.js.map +1 -0
- package/dist/esm/app/flows/index.js +6 -0
- package/dist/esm/app/flows/index.js.map +1 -0
- package/dist/esm/enable-app-module.js +2 -1
- package/dist/esm/enable-app-module.js.map +1 -1
- package/dist/esm/errors/AppBuildError.js +35 -0
- package/dist/esm/errors/AppBuildError.js.map +1 -0
- package/dist/esm/errors/AppConfigError.js +35 -0
- package/dist/esm/errors/AppConfigError.js.map +1 -0
- package/dist/esm/errors/AppManifestError.js +35 -0
- package/dist/esm/errors/AppManifestError.js.map +1 -0
- package/dist/esm/errors/AppScriptModuleError.js +17 -0
- package/dist/esm/errors/AppScriptModuleError.js.map +1 -0
- package/dist/esm/errors/AppSettingsError.js +35 -0
- package/dist/esm/errors/AppSettingsError.js.map +1 -0
- package/dist/esm/errors/app-error-type.js +2 -0
- package/dist/esm/errors/app-error-type.js.map +1 -0
- package/dist/esm/errors.js +5 -148
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/module.js +2 -0
- package/dist/esm/module.js.map +1 -1
- package/dist/esm/schemas.js +4 -0
- package/dist/esm/schemas.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/AppClient.d.ts +42 -0
- package/dist/types/AppConfig.d.ts +7 -1
- package/dist/types/AppConfigurator.d.ts +25 -0
- package/dist/types/AppModuleProvider.d.ts +10 -0
- package/dist/types/app/App.d.ts +49 -8
- package/dist/types/app/create-reducer.d.ts +55 -55
- package/dist/types/app/filter-empty.d.ts +8 -0
- package/dist/types/app/flows/handle-fetch-config.d.ts +12 -0
- package/dist/types/app/flows/handle-fetch-manifest.d.ts +12 -0
- package/dist/types/app/flows/handle-fetch-settings.d.ts +12 -0
- package/dist/types/app/flows/handle-import-application.d.ts +10 -0
- package/dist/types/app/flows/handle-update-settings.d.ts +12 -0
- package/dist/types/app/flows/index.d.ts +5 -0
- package/dist/types/errors/AppBuildError.d.ts +21 -0
- package/dist/types/errors/AppConfigError.d.ts +21 -0
- package/dist/types/errors/AppManifestError.d.ts +21 -0
- package/dist/types/errors/AppScriptModuleError.d.ts +14 -0
- package/dist/types/errors/AppSettingsError.d.ts +21 -0
- package/dist/types/errors/app-error-type.d.ts +9 -0
- package/dist/types/errors.d.ts +6 -103
- package/dist/types/version.d.ts +1 -1
- package/package.json +9 -9
- package/src/AppClient.ts +65 -4
- package/src/AppConfig.ts +9 -1
- package/src/AppConfigurator.ts +28 -4
- package/src/AppModuleProvider.ts +16 -0
- package/src/app/App.ts +88 -31
- package/src/app/actions.ts +2 -2
- package/src/app/create-reducer.ts +2 -1
- package/src/app/filter-empty.ts +11 -0
- package/src/app/flows/handle-fetch-config.ts +48 -0
- package/src/app/flows/handle-fetch-manifest.ts +53 -0
- package/src/app/flows/handle-fetch-settings.ts +50 -0
- package/src/app/flows/handle-import-application.ts +37 -0
- package/src/app/flows/handle-update-settings.ts +39 -0
- package/src/app/flows/index.ts +5 -0
- package/src/app/types.ts +2 -2
- package/src/enable-app-module.ts +2 -1
- package/src/errors/AppBuildError.ts +47 -0
- package/src/errors/AppConfigError.ts +47 -0
- package/src/errors/AppManifestError.ts +47 -0
- package/src/errors/AppScriptModuleError.ts +20 -0
- package/src/errors/AppSettingsError.ts +47 -0
- package/src/errors/app-error-type.ts +9 -0
- package/src/errors.ts +6 -208
- package/src/module.ts +2 -0
- package/src/schemas.ts +4 -0
- package/src/types.ts +1 -1
- package/src/version.ts +1 -1
- package/dist/esm/AppClient.Selectors.js.map +0 -1
- package/dist/esm/app/flows.js +0 -120
- package/dist/esm/app/flows.js.map +0 -1
- package/dist/types/app/flows.d.ts +0 -41
- package/src/app/flows.ts +0 -189
- /package/dist/types/{AppClient.Selectors.d.ts → AppConfigSelector.d.ts} +0 -0
- /package/src/{AppClient.Selectors.ts → AppConfigSelector.ts} +0 -0
|
@@ -93,29 +93,71 @@ export interface IAppClient extends Disposable {
|
|
|
93
93
|
*/
|
|
94
94
|
export declare class AppClient implements IAppClient {
|
|
95
95
|
#private;
|
|
96
|
+
/**
|
|
97
|
+
* Creates a new {@link AppClient} backed by the given HTTP client.
|
|
98
|
+
* @param client - The HTTP client used to communicate with the Fusion app service API.
|
|
99
|
+
*/
|
|
96
100
|
constructor(client: IHttpClient);
|
|
101
|
+
/**
|
|
102
|
+
* Fetches the build metadata for an application.
|
|
103
|
+
* @param args - Object containing the `appKey` and an optional version `tag`.
|
|
104
|
+
* @returns An observable that emits the resolved {@link AppBuildManifest}.
|
|
105
|
+
* @throws {AppBuildError} When the build metadata cannot be loaded.
|
|
106
|
+
*/
|
|
97
107
|
getAppBuild(args: {
|
|
98
108
|
appKey: string;
|
|
99
109
|
tag?: string;
|
|
100
110
|
}): Observable<AppBuildManifest>;
|
|
111
|
+
/**
|
|
112
|
+
* Fetches the manifest for a single application.
|
|
113
|
+
* @param args - Object containing the `appKey` and an optional version `tag`.
|
|
114
|
+
* @returns An observable that emits the resolved {@link AppManifest}.
|
|
115
|
+
* @throws {AppManifestError} When the manifest cannot be loaded.
|
|
116
|
+
*/
|
|
101
117
|
getAppManifest(args: {
|
|
102
118
|
appKey: string;
|
|
103
119
|
tag?: string;
|
|
104
120
|
}): Observable<AppManifest>;
|
|
121
|
+
/**
|
|
122
|
+
* Fetches manifests for all registered applications.
|
|
123
|
+
* @param args - Optional filter; set `filterByCurrentUser` to `true` to return only apps the authenticated user has access to.
|
|
124
|
+
* @returns An observable that emits an array of {@link AppManifest} objects.
|
|
125
|
+
*/
|
|
105
126
|
getAppManifests(args: {
|
|
106
127
|
filterByCurrentUser?: boolean;
|
|
107
128
|
} | undefined): Observable<AppManifest[]>;
|
|
129
|
+
/**
|
|
130
|
+
* Fetches the runtime configuration for an application.
|
|
131
|
+
* @template TType - Shape of the `environment` record in the returned config.
|
|
132
|
+
* @param args - Object containing the `appKey` and an optional version `tag`.
|
|
133
|
+
* @returns An observable that emits the resolved {@link AppConfig}.
|
|
134
|
+
* @throws {AppConfigError} When the configuration cannot be loaded.
|
|
135
|
+
*/
|
|
108
136
|
getAppConfig<TType extends ConfigEnvironment = ConfigEnvironment>(args: {
|
|
109
137
|
appKey: string;
|
|
110
138
|
tag?: string;
|
|
111
139
|
}): Observable<AppConfig<TType>>;
|
|
140
|
+
/**
|
|
141
|
+
* Fetches per-user settings for an application.
|
|
142
|
+
* @param args - Object containing the `appKey`.
|
|
143
|
+
* @returns An observable that emits the {@link AppSettings} record.
|
|
144
|
+
* @throws {AppSettingsError} When settings cannot be loaded.
|
|
145
|
+
*/
|
|
112
146
|
getAppSettings(args: {
|
|
113
147
|
appKey: string;
|
|
114
148
|
}): Observable<AppSettings>;
|
|
149
|
+
/**
|
|
150
|
+
* Persists updated per-user settings for an application via PUT.
|
|
151
|
+
* @param args - Object containing the `appKey` and the `settings` payload to save.
|
|
152
|
+
* @returns An observable that emits the persisted {@link AppSettings}.
|
|
153
|
+
*/
|
|
115
154
|
updateAppSettings(args: {
|
|
116
155
|
appKey: string;
|
|
117
156
|
settings: AppSettings;
|
|
118
157
|
}): Observable<AppSettings>;
|
|
158
|
+
/**
|
|
159
|
+
* Disposes of the client, completing all internal query streams.
|
|
160
|
+
*/
|
|
119
161
|
[Symbol.dispose](): void;
|
|
120
162
|
}
|
|
121
163
|
export default AppClient;
|
|
@@ -35,12 +35,18 @@ export declare class AppConfig<TEnvironment extends ConfigEnvironment = ConfigEn
|
|
|
35
35
|
#private;
|
|
36
36
|
/**
|
|
37
37
|
* The environment configuration for the application.
|
|
38
|
+
* @returns The frozen environment configuration.
|
|
38
39
|
*/
|
|
39
40
|
get environment(): TEnvironment;
|
|
40
41
|
/**
|
|
41
|
-
* The configuration endpoints for the application
|
|
42
|
+
* The configuration endpoints for the application.
|
|
43
|
+
* @returns The frozen map of configuration endpoints.
|
|
42
44
|
*/
|
|
43
45
|
get endpoints(): Record<string, ConfigEndPoint>;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new {@link AppConfig}, deep-freezing the provided environment and endpoints.
|
|
48
|
+
* @param config - The environment and endpoints to initialize the configuration with.
|
|
49
|
+
*/
|
|
44
50
|
constructor(config: {
|
|
45
51
|
environment?: TEnvironment | null;
|
|
46
52
|
endpoints?: Record<string, ConfigEndPoint>;
|
|
@@ -45,10 +45,35 @@ export interface IAppConfigurator {
|
|
|
45
45
|
export declare class AppConfigurator extends BaseConfigBuilder<AppModuleConfig> implements IAppConfigurator {
|
|
46
46
|
defaultExpireTime: number;
|
|
47
47
|
/**
|
|
48
|
+
* Creates the default HTTP client for the app service, preferring a pre-configured
|
|
49
|
+
* client from the http module and falling back to service discovery.
|
|
50
|
+
*
|
|
48
51
|
* WARNING: this function will be remove in future
|
|
52
|
+
*
|
|
53
|
+
* @param init - Module initializer args providing access to the http and service discovery modules.
|
|
54
|
+
* @returns A promise resolving to the {@link IHttpClient} used to communicate with the app service.
|
|
49
55
|
*/
|
|
50
56
|
protected _createHttpClient(init: ModuleInitializerArgs<IAppConfigurator, [HttpModule, ServiceDiscoveryModule]>): Promise<IHttpClient>;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the app service client used to fetch manifests, configs, and settings.
|
|
59
|
+
* @param client_or_cb - A promise resolving to an {@link IAppClient}, or a callback
|
|
60
|
+
* that receives module initializer args and returns one.
|
|
61
|
+
*/
|
|
51
62
|
setClient(client_or_cb: Promise<AppModuleConfig['client']> | ConfigBuilderCallback<AppModuleConfig['client']>): void;
|
|
63
|
+
/**
|
|
64
|
+
* Sets the base URI used to proxy-load application script bundles.
|
|
65
|
+
*
|
|
66
|
+
* TODO(#5132) - explain why, used in import of resources aka proxy url
|
|
67
|
+
*
|
|
68
|
+
* @param base_or_cb - A static URI string or a callback returning one.
|
|
69
|
+
*/
|
|
52
70
|
setAssetUri(base_or_cb: string | ConfigBuilderCallback<string>): void;
|
|
71
|
+
/**
|
|
72
|
+
* Builds the resolved {@link AppModuleConfig}, applying default client and asset URI
|
|
73
|
+
* when they haven't been explicitly configured.
|
|
74
|
+
* @param init - Module initializer args used to build the default client.
|
|
75
|
+
* @param initial - Optional initial partial configuration.
|
|
76
|
+
* @returns The resolved module config.
|
|
77
|
+
*/
|
|
53
78
|
protected _createConfig(init: ModuleInitializerArgs<IAppConfigurator, [HttpModule, ServiceDiscoveryModule]>, initial?: Partial<AppModuleConfig>): import("rxjs").ObservableInput<AppModuleConfig>;
|
|
54
79
|
}
|
|
@@ -24,6 +24,7 @@ export declare class AppModuleProvider {
|
|
|
24
24
|
/**
|
|
25
25
|
* Shallow-compares two app manifests by JSON serialization.
|
|
26
26
|
*
|
|
27
|
+
* @template T - The manifest type being compared.
|
|
27
28
|
* @param a - First manifest to compare.
|
|
28
29
|
* @param b - Second manifest to compare.
|
|
29
30
|
* @returns `true` if the serialized manifests are identical.
|
|
@@ -31,6 +32,7 @@ export declare class AppModuleProvider {
|
|
|
31
32
|
static compareAppManifest<T extends AppManifest>(a?: T, b?: T): boolean;
|
|
32
33
|
/**
|
|
33
34
|
* Get module version
|
|
35
|
+
* @returns The module's semantic version.
|
|
34
36
|
*/
|
|
35
37
|
get version(): SemanticVersion;
|
|
36
38
|
/**
|
|
@@ -39,6 +41,8 @@ export declare class AppModuleProvider {
|
|
|
39
41
|
* - `undefined` – no application has been set yet.
|
|
40
42
|
* - `null` – the current application was explicitly cleared.
|
|
41
43
|
* - `App` – an active application instance.
|
|
44
|
+
*
|
|
45
|
+
* @returns The current active application, `null` if cleared, or `undefined` if never set.
|
|
42
46
|
*/
|
|
43
47
|
get current(): CurrentApp | null | undefined;
|
|
44
48
|
/**
|
|
@@ -46,6 +50,8 @@ export declare class AppModuleProvider {
|
|
|
46
50
|
*
|
|
47
51
|
* Emits are deduplicated by `appKey`; re-setting the same app does not trigger
|
|
48
52
|
* a new emission.
|
|
53
|
+
*
|
|
54
|
+
* @returns An observable of the current active application.
|
|
49
55
|
*/
|
|
50
56
|
get current$(): Observable<CurrentApp | null>;
|
|
51
57
|
/**
|
|
@@ -79,6 +85,7 @@ export declare class AppModuleProvider {
|
|
|
79
85
|
/**
|
|
80
86
|
* fetch all applications
|
|
81
87
|
* @deprecated use `getAppManifests` instead
|
|
88
|
+
* @returns An observable that emits an array of {@link AppManifest} objects.
|
|
82
89
|
*/
|
|
83
90
|
getAllAppManifests(): Observable<AppManifest[]>;
|
|
84
91
|
/**
|
|
@@ -121,11 +128,14 @@ export declare class AppModuleProvider {
|
|
|
121
128
|
clearCurrentApp(): void;
|
|
122
129
|
/**
|
|
123
130
|
* Base URI used for proxying application script imports.
|
|
131
|
+
* @returns The configured asset base URI.
|
|
124
132
|
*/
|
|
125
133
|
get assetUri(): string;
|
|
126
134
|
/**
|
|
127
135
|
* This should not be used, only for legacy creation backdoor
|
|
128
136
|
* @deprecated
|
|
137
|
+
* @param value - The initial app bundle state to construct the app from.
|
|
138
|
+
* @returns The newly created {@link App} instance.
|
|
129
139
|
*/
|
|
130
140
|
createApp(value: AppBundleStateInitial): App;
|
|
131
141
|
/**
|
package/dist/types/app/App.d.ts
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import type { AppModulesInstance, AppScriptModule, AppManifest, AppConfig, AppSettings, ConfigEnvironment } from '../types';
|
|
2
2
|
import { Observable } from '@equinor/fusion-observable';
|
|
3
3
|
import type { AppModuleProvider } from '../AppModuleProvider';
|
|
4
|
-
import { type OperatorFunction } from 'rxjs';
|
|
5
4
|
import type { EventModule } from '@equinor/fusion-framework-module-event';
|
|
6
5
|
import type { AnyModule, ModuleType } from '@equinor/fusion-framework-module';
|
|
7
6
|
import type { AppBundleState, AppBundleStateInitial } from './types';
|
|
8
7
|
import './events';
|
|
9
|
-
|
|
10
|
-
* RxJS operator that filters out `null` and `undefined` emissions.
|
|
11
|
-
*
|
|
12
|
-
* @template T - The non-nullable value type.
|
|
13
|
-
* @returns An operator that only passes through non-nullable values.
|
|
14
|
-
*/
|
|
15
|
-
export declare function filterEmpty<T>(): OperatorFunction<T | null | undefined, T>;
|
|
8
|
+
export { filterEmpty } from './filter-empty';
|
|
16
9
|
/**
|
|
17
10
|
* Public interface for a single loaded Fusion application.
|
|
18
11
|
*
|
|
@@ -208,45 +201,93 @@ export type AppInitializeResult = {
|
|
|
208
201
|
* manifest fetching, config loading, settings management, and script import. Dispatches
|
|
209
202
|
* lifecycle events through the {@link EventModule} when available.
|
|
210
203
|
*
|
|
204
|
+
* TODO(#5130): streams should be made distinct until changed from state.
|
|
205
|
+
*
|
|
211
206
|
* @template TEnv - Shape of the environment configuration record.
|
|
212
207
|
* @template TModules - Additional framework modules the app depends on.
|
|
213
208
|
*/
|
|
214
209
|
export declare class App<TEnv extends ConfigEnvironment = ConfigEnvironment, TModules extends Array<AnyModule> | unknown = unknown> implements IApp<TEnv, TModules> {
|
|
215
210
|
#private;
|
|
211
|
+
/** @inheritdoc */
|
|
216
212
|
get manifest$(): Observable<AppManifest>;
|
|
213
|
+
/** @inheritdoc */
|
|
217
214
|
get config$(): Observable<AppConfig<TEnv>>;
|
|
215
|
+
/** @inheritdoc */
|
|
218
216
|
get modules$(): Observable<AppScriptModule>;
|
|
217
|
+
/** @inheritdoc */
|
|
219
218
|
get instance$(): Observable<AppModulesInstance<TModules>>;
|
|
219
|
+
/** @inheritdoc */
|
|
220
220
|
get settings$(): Observable<AppSettings>;
|
|
221
|
+
/** @inheritdoc */
|
|
221
222
|
get status$(): Observable<AppBundleState['status']>;
|
|
223
|
+
/** @inheritdoc */
|
|
222
224
|
get state(): Readonly<AppBundleState>;
|
|
225
|
+
/** @inheritdoc */
|
|
223
226
|
get appKey(): string;
|
|
227
|
+
/**
|
|
228
|
+
* The tag (version) this app instance was loaded with, if any.
|
|
229
|
+
* @returns The tag string, or `undefined` if none was specified.
|
|
230
|
+
*/
|
|
224
231
|
get tag(): string | undefined;
|
|
232
|
+
/** @inheritdoc */
|
|
225
233
|
get manifest(): Readonly<AppManifest> | undefined;
|
|
234
|
+
/** @inheritdoc */
|
|
226
235
|
get manifestAsync(): Promise<Readonly<AppManifest>>;
|
|
236
|
+
/** @inheritdoc */
|
|
227
237
|
get config(): AppConfig<TEnv> | undefined;
|
|
238
|
+
/**
|
|
239
|
+
* Retrieves the configuration asynchronously.
|
|
240
|
+
* @returns A promise that resolves to the {@link AppConfig}.
|
|
241
|
+
*/
|
|
228
242
|
get configAsync(): Promise<AppConfig<TEnv>>;
|
|
243
|
+
/** @inheritdoc */
|
|
229
244
|
get instance(): AppModulesInstance<TModules> | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* Creates a new {@link App} instance and starts its internal state machine.
|
|
247
|
+
* @param value - Initial app bundle state (appKey, tag, and any pre-loaded data).
|
|
248
|
+
* @param args - The owning {@link AppModuleProvider} and an optional event module for lifecycle events.
|
|
249
|
+
*/
|
|
230
250
|
constructor(value: AppBundleStateInitial, args: {
|
|
231
251
|
provider: AppModuleProvider;
|
|
232
252
|
event?: ModuleType<EventModule>;
|
|
233
253
|
});
|
|
254
|
+
/** @inheritdoc */
|
|
234
255
|
initialize(): Observable<AppInitializeResult>;
|
|
256
|
+
/** @inheritdoc */
|
|
235
257
|
loadConfig(): void;
|
|
258
|
+
/** @inheritdoc */
|
|
236
259
|
loadManifest(update?: boolean): void;
|
|
260
|
+
/**
|
|
261
|
+
* Replaces or merges the current manifest with a new one.
|
|
262
|
+
* @param manifest - The manifest to apply.
|
|
263
|
+
* @param replace - When `false` (default), merges into the existing manifest; when omitted, behaves the same.
|
|
264
|
+
*/
|
|
237
265
|
updateManifest(manifest: AppManifest, replace?: false): void;
|
|
266
|
+
/** @inheritdoc */
|
|
238
267
|
loadAppModule(allow_cache?: boolean): Promise<void>;
|
|
268
|
+
/** @inheritdoc */
|
|
239
269
|
getConfig(force_refresh?: boolean): Observable<AppConfig>;
|
|
270
|
+
/** @inheritdoc */
|
|
240
271
|
getConfigAsync(allow_cache?: boolean): Promise<AppConfig>;
|
|
272
|
+
/** @inheritdoc */
|
|
241
273
|
getSettings<T extends AppSettings>(force_refresh?: boolean): Observable<T>;
|
|
274
|
+
/** @inheritdoc */
|
|
242
275
|
getSettingsAsync<T extends AppSettings>(allow_cache?: boolean): Promise<T>;
|
|
276
|
+
/** @inheritdoc */
|
|
243
277
|
updateSettings<T extends AppSettings>(settings: T): Observable<T>;
|
|
278
|
+
/** @inheritdoc */
|
|
244
279
|
updateSettingsAsync<T extends AppSettings>(settings: T): Promise<T>;
|
|
280
|
+
/** @inheritdoc */
|
|
245
281
|
updateSetting<T extends AppSettings, P extends keyof T>(property: P, value: T[P]): Observable<T[P]>;
|
|
282
|
+
/** @inheritdoc */
|
|
246
283
|
updateSettingAsync<T extends AppSettings, P extends keyof T>(property: P, value: T[P]): Promise<T[P]>;
|
|
284
|
+
/** @inheritdoc */
|
|
247
285
|
getManifest(force_refresh?: boolean): Observable<AppManifest>;
|
|
286
|
+
/** @inheritdoc */
|
|
248
287
|
getManifestAsync(allow_cache?: boolean): Promise<AppManifest>;
|
|
288
|
+
/** @inheritdoc */
|
|
249
289
|
getAppModule(force_refresh?: boolean): Observable<AppScriptModule>;
|
|
290
|
+
/** @inheritdoc */
|
|
250
291
|
getAppModuleAsync(allow_cache?: boolean): Promise<AppScriptModule>;
|
|
251
292
|
dispose: VoidFunction;
|
|
252
293
|
}
|
|
@@ -8,84 +8,84 @@ import type { AppBundleState, AppBundleStateInitial } from './types';
|
|
|
8
8
|
* @param value - Initial state values (appKey, tag, and any pre-loaded data).
|
|
9
9
|
* @returns A reducer function compatible with {@link FlowSubject}.
|
|
10
10
|
*/
|
|
11
|
-
export declare const createReducer: (value: AppBundleStateInitial) => import("@equinor/fusion-observable").ReducerWithInitialState<AppBundleState,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}, never> | import("@equinor/fusion-observable").PayloadAction<{
|
|
15
|
-
key: string;
|
|
16
|
-
tag: string | undefined;
|
|
17
|
-
}, "fetch_manifest::request", {
|
|
18
|
-
update: boolean | undefined;
|
|
19
|
-
}, never> | {
|
|
20
|
-
payload: import("..").AppConfig<import("../AppConfig").ConfigEnvironment>;
|
|
21
|
-
type: "set_config";
|
|
22
|
-
} | {
|
|
23
|
-
payload: import("..").AppManifest;
|
|
24
|
-
type: "fetch_config::request";
|
|
25
|
-
} | {
|
|
26
|
-
payload: import("..").AppSettings | undefined;
|
|
27
|
-
type: "set_settings";
|
|
11
|
+
export declare const createReducer: (value: AppBundleStateInitial) => import("@equinor/fusion-observable").ReducerWithInitialState<AppBundleState, {
|
|
12
|
+
payload: any;
|
|
13
|
+
type: "set_module";
|
|
28
14
|
} | {
|
|
29
|
-
payload:
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
type: "fetch_settings::request";
|
|
15
|
+
payload: unknown;
|
|
16
|
+
type: "fetch_config::failure";
|
|
33
17
|
} | {
|
|
34
|
-
payload:
|
|
35
|
-
|
|
36
|
-
settings: import("..").AppSettings;
|
|
37
|
-
};
|
|
38
|
-
type: "update_settings::request";
|
|
18
|
+
payload: unknown;
|
|
19
|
+
type: "fetch_manifest::failure";
|
|
39
20
|
} | {
|
|
40
|
-
payload:
|
|
41
|
-
type: "
|
|
21
|
+
payload: unknown;
|
|
22
|
+
type: "fetch_settings::failure";
|
|
42
23
|
} | {
|
|
43
|
-
payload:
|
|
44
|
-
type: "
|
|
24
|
+
payload: unknown;
|
|
25
|
+
type: "import_app::failure";
|
|
45
26
|
} | {
|
|
46
|
-
payload:
|
|
47
|
-
type: "
|
|
27
|
+
payload: unknown;
|
|
28
|
+
type: "initialize_app::failure";
|
|
48
29
|
} | {
|
|
49
|
-
payload:
|
|
50
|
-
type: "
|
|
30
|
+
payload: unknown;
|
|
31
|
+
type: "update_settings::failure";
|
|
51
32
|
} | {
|
|
52
33
|
payload: null;
|
|
53
34
|
type: "initialize_app::request";
|
|
54
35
|
} | {
|
|
55
|
-
payload:
|
|
56
|
-
type: "
|
|
36
|
+
payload: null;
|
|
37
|
+
type: "initialize_app::success";
|
|
57
38
|
} | {
|
|
58
|
-
payload:
|
|
59
|
-
type: "
|
|
39
|
+
payload: string;
|
|
40
|
+
type: "import_app::request";
|
|
41
|
+
} | {
|
|
42
|
+
payload: string;
|
|
43
|
+
type: "update_settings::abort";
|
|
60
44
|
} | {
|
|
61
45
|
payload: import("..").AppConfig<import("../AppConfig").ConfigEnvironment>;
|
|
62
46
|
type: "fetch_config::success";
|
|
63
47
|
} | {
|
|
64
|
-
payload:
|
|
65
|
-
type: "
|
|
48
|
+
payload: import("..").AppConfig<import("../AppConfig").ConfigEnvironment>;
|
|
49
|
+
type: "set_config";
|
|
50
|
+
} | {
|
|
51
|
+
payload: import("..").AppManifest;
|
|
52
|
+
type: "fetch_config::request";
|
|
53
|
+
} | {
|
|
54
|
+
payload: import("..").AppManifest;
|
|
55
|
+
type: "fetch_manifest::success";
|
|
56
|
+
} | {
|
|
57
|
+
payload: import("..").AppScriptModule;
|
|
58
|
+
type: "import_app::success";
|
|
66
59
|
} | {
|
|
67
60
|
payload: import("..").AppSettings;
|
|
68
61
|
type: "fetch_settings::success";
|
|
69
|
-
} | {
|
|
70
|
-
payload: unknown;
|
|
71
|
-
type: "fetch_settings::failure";
|
|
72
62
|
} | {
|
|
73
63
|
payload: import("..").AppSettings;
|
|
74
64
|
type: "update_settings::success";
|
|
75
65
|
} | {
|
|
76
|
-
payload:
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
type: "import_app::success";
|
|
66
|
+
payload: {
|
|
67
|
+
appKey: string;
|
|
68
|
+
};
|
|
69
|
+
type: "fetch_settings::request";
|
|
81
70
|
} | {
|
|
82
|
-
payload:
|
|
83
|
-
|
|
71
|
+
payload: {
|
|
72
|
+
appKey: string;
|
|
73
|
+
settings: import("..").AppSettings;
|
|
74
|
+
};
|
|
75
|
+
type: "update_settings::request";
|
|
84
76
|
} | {
|
|
85
|
-
payload:
|
|
86
|
-
type: "
|
|
77
|
+
payload: import("..").AppSettings | undefined;
|
|
78
|
+
type: "set_settings";
|
|
87
79
|
} | {
|
|
88
|
-
payload:
|
|
89
|
-
type: "
|
|
90
|
-
}
|
|
80
|
+
payload: import("..").AppModulesInstance;
|
|
81
|
+
type: "set_instance";
|
|
82
|
+
} | import("@equinor/fusion-observable").PayloadAction<import("..").AppManifest, "set_manifest", {
|
|
83
|
+
created: number;
|
|
84
|
+
update: boolean | undefined;
|
|
85
|
+
}, never> | import("@equinor/fusion-observable").PayloadAction<{
|
|
86
|
+
key: string;
|
|
87
|
+
tag: string | undefined;
|
|
88
|
+
}, "fetch_manifest::request", {
|
|
89
|
+
update: boolean | undefined;
|
|
90
|
+
}, never>>;
|
|
91
91
|
export default createReducer;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type OperatorFunction } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* RxJS operator that filters out `null` and `undefined` emissions.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The non-nullable value type.
|
|
6
|
+
* @returns An operator that only passes through non-nullable values.
|
|
7
|
+
*/
|
|
8
|
+
export declare function filterEmpty<T>(): OperatorFunction<T | null | undefined, T>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Flow } from '@equinor/fusion-observable';
|
|
2
|
+
import type { AppModuleProvider } from '../../AppModuleProvider';
|
|
3
|
+
import type { Actions } from '../actions';
|
|
4
|
+
import type { AppBundleState } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Handles the fetch config action by fetching the app configuration from the provider,
|
|
7
|
+
* filtering out null values, and dispatching success or failure actions accordingly.
|
|
8
|
+
*
|
|
9
|
+
* @param provider The AppModuleProvider used to fetch the app configuration.
|
|
10
|
+
* @returns A Flow function that takes an Observable of actions and returns an Observable of actions.
|
|
11
|
+
*/
|
|
12
|
+
export declare const handleFetchConfig: (provider: AppModuleProvider) => Flow<Actions, AppBundleState>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Flow } from '@equinor/fusion-observable';
|
|
2
|
+
import type { AppModuleProvider } from '../../AppModuleProvider';
|
|
3
|
+
import type { Actions } from '../actions';
|
|
4
|
+
import type { AppBundleState } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Handles the fetch manifest action by fetching the app manifest from the provider,
|
|
7
|
+
* dispatching success or failure actions based on the result.
|
|
8
|
+
*
|
|
9
|
+
* @param provider The AppModuleProvider used to fetch the app manifest.
|
|
10
|
+
* @returns A Flow function that takes an Observable of actions and returns an Observable of actions.
|
|
11
|
+
*/
|
|
12
|
+
export declare const handleFetchManifest: (provider: AppModuleProvider) => Flow<Actions, AppBundleState>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Flow } from '@equinor/fusion-observable';
|
|
2
|
+
import type { AppModuleProvider } from '../../AppModuleProvider';
|
|
3
|
+
import type { Actions } from '../actions';
|
|
4
|
+
import type { AppBundleState } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Handles the fetch settings action by fetching the app settings from the provider,
|
|
7
|
+
* filtering out null values, and dispatching success or failure actions accordingly.
|
|
8
|
+
*
|
|
9
|
+
* @param provider The AppModuleProvider used to fetch the app settings.
|
|
10
|
+
* @returns A Flow function that takes an Observable of actions and returns an Observable of actions.
|
|
11
|
+
*/
|
|
12
|
+
export declare const handleFetchSettings: (provider: AppModuleProvider) => Flow<Actions, AppBundleState>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Flow } from '@equinor/fusion-observable';
|
|
2
|
+
import type { AppModuleProvider } from '../../AppModuleProvider';
|
|
3
|
+
import type { Actions } from '../actions';
|
|
4
|
+
import type { AppBundleState } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Handles the import application flow.
|
|
7
|
+
* @param provider The AppModuleProvider used to resolve the application asset URI.
|
|
8
|
+
* @returns A flow that takes in actions and returns an observable of AppBundleState.
|
|
9
|
+
*/
|
|
10
|
+
export declare const handleImportApplication: (provider: AppModuleProvider) => Flow<Actions, AppBundleState>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Flow } from '@equinor/fusion-observable';
|
|
2
|
+
import type { AppModuleProvider } from '../../AppModuleProvider';
|
|
3
|
+
import type { Actions } from '../actions';
|
|
4
|
+
import type { AppBundleState } from '../types';
|
|
5
|
+
/**
|
|
6
|
+
* Handles the set settings action by setting the app settings from the provider,
|
|
7
|
+
* filtering out null values, and dispatching success or failure actions accordingly.
|
|
8
|
+
*
|
|
9
|
+
* @param provider The AppModuleProvider used to fetch the app settings.
|
|
10
|
+
* @returns A Flow function that takes an Observable of actions and returns an Observable of actions.
|
|
11
|
+
*/
|
|
12
|
+
export declare const handleUpdateSettings: (provider: AppModuleProvider) => Flow<Actions, AppBundleState>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { handleFetchManifest } from './handle-fetch-manifest';
|
|
2
|
+
export { handleFetchConfig } from './handle-fetch-config';
|
|
3
|
+
export { handleFetchSettings } from './handle-fetch-settings';
|
|
4
|
+
export { handleUpdateSettings } from './handle-update-settings';
|
|
5
|
+
export { handleImportApplication } from './handle-import-application';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AppErrorType } from './app-error-type';
|
|
2
|
+
/**
|
|
3
|
+
* Represents an error that occurs in the application build.
|
|
4
|
+
*/
|
|
5
|
+
export declare class AppBuildError extends Error {
|
|
6
|
+
readonly type: AppErrorType;
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance of `AppBuildError` based on the HTTP response status.
|
|
9
|
+
* @param response The HTTP response.
|
|
10
|
+
* @param options Additional error options.
|
|
11
|
+
* @returns An instance of `AppBuildError` based on the HTTP response status.
|
|
12
|
+
*/
|
|
13
|
+
static fromHttpResponse(response: Response, options?: ErrorOptions): AppBuildError;
|
|
14
|
+
/**
|
|
15
|
+
* Creates an instance of `AppBuildError`.
|
|
16
|
+
* @param type The type of the application error.
|
|
17
|
+
* @param message The error message.
|
|
18
|
+
* @param options Additional error options.
|
|
19
|
+
*/
|
|
20
|
+
constructor(type: AppErrorType, message?: string, options?: ErrorOptions);
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AppErrorType } from './app-error-type';
|
|
2
|
+
/**
|
|
3
|
+
* Represents an error that occurs in the application configuration.
|
|
4
|
+
*/
|
|
5
|
+
export declare class AppConfigError extends Error {
|
|
6
|
+
readonly type: AppErrorType;
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance of `AppConfigError` based on the HTTP response status.
|
|
9
|
+
* @param response The HTTP response.
|
|
10
|
+
* @param options Additional error options.
|
|
11
|
+
* @returns An instance of `AppConfigError` based on the HTTP response status.
|
|
12
|
+
*/
|
|
13
|
+
static fromHttpResponse(response: Response, options?: ErrorOptions): AppConfigError;
|
|
14
|
+
/**
|
|
15
|
+
* Creates an instance of `AppConfigError`.
|
|
16
|
+
* @param type The type of the application error.
|
|
17
|
+
* @param message The error message.
|
|
18
|
+
* @param options Additional error options.
|
|
19
|
+
*/
|
|
20
|
+
constructor(type: AppErrorType, message?: string, options?: ErrorOptions);
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AppErrorType } from './app-error-type';
|
|
2
|
+
/**
|
|
3
|
+
* Represents an error that occurs when loading an application manifest.
|
|
4
|
+
*/
|
|
5
|
+
export declare class AppManifestError extends Error {
|
|
6
|
+
readonly type: AppErrorType;
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance of AppManifestError based on the HTTP response status.
|
|
9
|
+
* @param response The HTTP response.
|
|
10
|
+
* @param options Optional error options.
|
|
11
|
+
* @returns An instance of AppManifestError.
|
|
12
|
+
*/
|
|
13
|
+
static fromHttpResponse(response: Response, options?: ErrorOptions): AppManifestError;
|
|
14
|
+
/**
|
|
15
|
+
* Creates an instance of AppManifestError.
|
|
16
|
+
* @param type The type of the error.
|
|
17
|
+
* @param message The error message.
|
|
18
|
+
* @param options Optional error options.
|
|
19
|
+
*/
|
|
20
|
+
constructor(type: AppErrorType, message?: string, options?: ErrorOptions);
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AppErrorType } from './app-error-type';
|
|
2
|
+
/**
|
|
3
|
+
* Represents an error that occurs when loading the application script.
|
|
4
|
+
*/
|
|
5
|
+
export declare class AppScriptModuleError extends Error {
|
|
6
|
+
readonly type: AppErrorType;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new instance of the AppScriptModuleError class.
|
|
9
|
+
* @param type The type of the error.
|
|
10
|
+
* @param message The error message.
|
|
11
|
+
* @param options Additional options for the error.
|
|
12
|
+
*/
|
|
13
|
+
constructor(type: AppErrorType, message?: string, options?: ErrorOptions);
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AppErrorType } from './app-error-type';
|
|
2
|
+
/**
|
|
3
|
+
* Represents an error that occurs while fetching application settings.
|
|
4
|
+
*/
|
|
5
|
+
export declare class AppSettingsError extends Error {
|
|
6
|
+
readonly type: AppErrorType;
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance of `AppSettingsError` based on the HTTP response status.
|
|
9
|
+
* @param response The HTTP response.
|
|
10
|
+
* @param options Additional error options.
|
|
11
|
+
* @returns An instance of `AppSettingsError` based on the HTTP response status.
|
|
12
|
+
*/
|
|
13
|
+
static fromHttpResponse(response: Response, options?: ErrorOptions): AppSettingsError;
|
|
14
|
+
/**
|
|
15
|
+
* Creates an instance of `AppSettingsError`.
|
|
16
|
+
* @param type The type of the application error.
|
|
17
|
+
* @param message The error message.
|
|
18
|
+
* @param options Additional error options.
|
|
19
|
+
*/
|
|
20
|
+
constructor(type: AppErrorType, message?: string, options?: ErrorOptions);
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discriminant for application-related errors.
|
|
3
|
+
*
|
|
4
|
+
* - `'not_found'` – The requested resource does not exist (HTTP 404).
|
|
5
|
+
* - `'unauthorized'` – The request lacks valid credentials (HTTP 401).
|
|
6
|
+
* - `'deleted'` – The resource has been removed (HTTP 410).
|
|
7
|
+
* - `'unknown'` – An unexpected failure occurred.
|
|
8
|
+
*/
|
|
9
|
+
export type AppErrorType = 'not_found' | 'unauthorized' | 'unknown' | 'deleted';
|