@equinor/fusion-framework-module-app 6.1.17-next.0 → 6.1.18
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 +14 -4
- package/dist/esm/AppClient.js +9 -10
- package/dist/esm/AppClient.js.map +1 -1
- package/dist/esm/AppConfig.js +0 -10
- package/dist/esm/AppConfig.js.map +1 -1
- package/dist/esm/AppConfigurator.js +8 -10
- package/dist/esm/AppConfigurator.js.map +1 -1
- package/dist/esm/app/App.js.map +1 -1
- package/dist/esm/app/index.js.map +1 -1
- package/dist/esm/errors.js +6 -0
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/AppConfig.d.ts +0 -10
- package/dist/types/app/App.d.ts +6 -5
- package/dist/types/app/actions.d.ts +3 -3
- package/dist/types/app/create-reducer.d.ts +1 -1
- package/dist/types/app/index.d.ts +1 -1
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +9 -9
- package/src/AppClient.ts +18 -10
- package/src/AppConfig.ts +0 -10
- package/src/AppConfigurator.ts +10 -9
- package/src/app/App.ts +7 -5
- package/src/app/index.ts +1 -1
- package/src/errors.ts +7 -1
- package/src/version.ts +1 -1
|
@@ -22,16 +22,6 @@ export type ConfigEndPoint = {
|
|
|
22
22
|
*
|
|
23
23
|
* console.log(config.getEndpoint('api')); // { url: 'https://api.example.com' }
|
|
24
24
|
* ```
|
|
25
|
-
*
|
|
26
|
-
* @param {Object} config - The configuration object.
|
|
27
|
-
* @param {TEnvironment} [config.environment] - The environment configuration.
|
|
28
|
-
* @param {Record<string, ConfigEndPoint>} [config.endpoints] - The endpoints configuration.
|
|
29
|
-
*
|
|
30
|
-
* @property {TEnvironment} [environment] - The environment configuration.
|
|
31
|
-
* @property {Record<string, string | undefined>} endpoints - The endpoints configuration (deprecated).
|
|
32
|
-
*
|
|
33
|
-
* @method getEndpoint
|
|
34
|
-
* @param {string} key - The key of the endpoint to retrieve.
|
|
35
25
|
*/
|
|
36
26
|
export declare class AppConfig<TEnvironment extends ConfigEnvironment = ConfigEnvironment> {
|
|
37
27
|
#private;
|
package/dist/types/app/App.d.ts
CHANGED
|
@@ -181,6 +181,11 @@ export interface IApp<TEnv extends ConfigEnvironment = ConfigEnvironment, TModul
|
|
|
181
181
|
*/
|
|
182
182
|
getAppModuleAsync(allow_cache?: boolean): Promise<AppScriptModule>;
|
|
183
183
|
}
|
|
184
|
+
export type AppInitializeResult = {
|
|
185
|
+
manifest: AppManifest;
|
|
186
|
+
script: AppScriptModule;
|
|
187
|
+
config: AppConfig;
|
|
188
|
+
};
|
|
184
189
|
export declare class App<TEnv extends ConfigEnvironment = ConfigEnvironment, TModules extends Array<AnyModule> | unknown = unknown> implements IApp<TEnv, TModules> {
|
|
185
190
|
#private;
|
|
186
191
|
get manifest$(): Observable<AppManifest>;
|
|
@@ -200,11 +205,7 @@ export declare class App<TEnv extends ConfigEnvironment = ConfigEnvironment, TMo
|
|
|
200
205
|
provider: AppModuleProvider;
|
|
201
206
|
event?: ModuleType<EventModule>;
|
|
202
207
|
});
|
|
203
|
-
initialize(): Observable<
|
|
204
|
-
manifest: AppManifest;
|
|
205
|
-
script: AppScriptModule;
|
|
206
|
-
config: AppConfig;
|
|
207
|
-
}>;
|
|
208
|
+
initialize(): Observable<AppInitializeResult>;
|
|
208
209
|
loadConfig(): void;
|
|
209
210
|
loadManifest(update?: boolean): void;
|
|
210
211
|
updateManifest(manifest: AppManifest, replace?: false): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ActionInstanceMap, type ActionTypes } from '@equinor/fusion-observable';
|
|
2
|
-
import type { AppConfig, AppManifest,
|
|
2
|
+
import type { AppConfig, AppManifest, AppScriptModule, AppSettings } from '../types';
|
|
3
3
|
declare const createActions: () => {
|
|
4
4
|
/** Manifest loading */
|
|
5
5
|
setManifest: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[manifest: AppManifest, update?: boolean | undefined], AppManifest, "set_manifest", never, {
|
|
@@ -42,7 +42,7 @@ declare const createActions: () => {
|
|
|
42
42
|
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[module: AppScriptModule], AppScriptModule, "import_app::success", never, never>;
|
|
43
43
|
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "import_app::failure", never, never>;
|
|
44
44
|
};
|
|
45
|
-
setInstance: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[instance:
|
|
45
|
+
setInstance: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[instance: any], any, "set_instance", never, never>;
|
|
46
46
|
initialize: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[], null, "initialize_app::request", never, never> & {
|
|
47
47
|
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[], null, "initialize_app::success", never, never>;
|
|
48
48
|
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "initialize_app::failure", never, never>;
|
|
@@ -90,7 +90,7 @@ export declare const actions: {
|
|
|
90
90
|
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[module: AppScriptModule], AppScriptModule, "import_app::success", never, never>;
|
|
91
91
|
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "import_app::failure", never, never>;
|
|
92
92
|
};
|
|
93
|
-
setInstance: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[instance:
|
|
93
|
+
setInstance: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[instance: any], any, "set_instance", never, never>;
|
|
94
94
|
initialize: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[], null, "initialize_app::request", never, never> & {
|
|
95
95
|
success: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[], null, "initialize_app::success", never, never>;
|
|
96
96
|
failure: import("@equinor/fusion-observable").ActionCreatorWithPreparedPayload<[error: unknown], unknown, "initialize_app::failure", never, never>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { App, IApp } from './App';
|
|
1
|
+
export { App, IApp, type AppInitializeResult } from './App';
|
|
2
2
|
export { default } from './App';
|
package/dist/types/errors.d.ts
CHANGED
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.1.
|
|
1
|
+
export declare const version = "6.1.18";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-module-app",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -60,17 +60,17 @@
|
|
|
60
60
|
"immer": "^9.0.16",
|
|
61
61
|
"rxjs": "^7.8.1",
|
|
62
62
|
"uuid": "^11.0.3",
|
|
63
|
-
"zod": "^3.
|
|
64
|
-
"@equinor/fusion-
|
|
65
|
-
"@equinor/fusion-
|
|
63
|
+
"zod": "^3.25.76",
|
|
64
|
+
"@equinor/fusion-observable": "^8.5.1",
|
|
65
|
+
"@equinor/fusion-query": "^5.2.11"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"typescript": "^5.8.2",
|
|
69
|
-
"@equinor/fusion-framework-module": "^
|
|
70
|
-
"@equinor/fusion-framework-module-
|
|
71
|
-
"@equinor/fusion-framework-module-
|
|
72
|
-
"@equinor/fusion-framework-module-service-discovery": "^8.0.18
|
|
73
|
-
"@equinor/fusion-framework-module-
|
|
69
|
+
"@equinor/fusion-framework-module": "^5.0.0",
|
|
70
|
+
"@equinor/fusion-framework-module-http": "^6.3.4",
|
|
71
|
+
"@equinor/fusion-framework-module-msal": "^4.0.9",
|
|
72
|
+
"@equinor/fusion-framework-module-service-discovery": "^8.0.18",
|
|
73
|
+
"@equinor/fusion-framework-module-event": "^4.3.7"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|
|
76
76
|
"build": "tsc -b"
|
package/src/AppClient.ts
CHANGED
|
@@ -3,7 +3,11 @@ import { catchError, map, type Observable, type ObservableInput, tap } from 'rxj
|
|
|
3
3
|
import { Query } from '@equinor/fusion-query';
|
|
4
4
|
import { queryValue } from '@equinor/fusion-query/operators';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
HttpJsonResponseError,
|
|
8
|
+
HttpResponseError,
|
|
9
|
+
type IHttpClient,
|
|
10
|
+
} from '@equinor/fusion-framework-module-http';
|
|
7
11
|
import { jsonSelector } from '@equinor/fusion-framework-module-http/selectors';
|
|
8
12
|
|
|
9
13
|
import { ApiApplicationSchema } from './schemas';
|
|
@@ -156,14 +160,16 @@ export class AppClient implements IAppClient {
|
|
|
156
160
|
return this.#manifest.query(args).pipe(
|
|
157
161
|
queryValue,
|
|
158
162
|
catchError((err) => {
|
|
159
|
-
|
|
160
|
-
|
|
163
|
+
const cause = err?.cause || err;
|
|
164
|
+
|
|
161
165
|
if (cause instanceof AppManifestError) {
|
|
162
166
|
throw cause;
|
|
163
167
|
}
|
|
164
|
-
|
|
168
|
+
|
|
169
|
+
if (cause instanceof HttpJsonResponseError || cause instanceof HttpResponseError) {
|
|
165
170
|
throw AppManifestError.fromHttpResponse(cause.response, { cause });
|
|
166
171
|
}
|
|
172
|
+
|
|
167
173
|
throw new AppManifestError('unknown', 'failed to load manifest', { cause });
|
|
168
174
|
}),
|
|
169
175
|
);
|
|
@@ -180,12 +186,13 @@ export class AppClient implements IAppClient {
|
|
|
180
186
|
return this.#config.query(args).pipe(
|
|
181
187
|
map((res) => res.value as AppConfig<TType>),
|
|
182
188
|
catchError((err) => {
|
|
183
|
-
/**
|
|
184
|
-
const
|
|
189
|
+
/** handle both direct errors and errors wrapped in a `cause` property */
|
|
190
|
+
const cause = err?.cause || err;
|
|
191
|
+
|
|
185
192
|
if (cause instanceof AppConfigError) {
|
|
186
193
|
throw cause;
|
|
187
194
|
}
|
|
188
|
-
if (cause instanceof HttpResponseError) {
|
|
195
|
+
if (cause instanceof HttpJsonResponseError || cause instanceof HttpResponseError) {
|
|
189
196
|
throw AppConfigError.fromHttpResponse(cause.response, { cause });
|
|
190
197
|
}
|
|
191
198
|
throw new AppConfigError('unknown', 'failed to load config', { cause });
|
|
@@ -197,12 +204,13 @@ export class AppClient implements IAppClient {
|
|
|
197
204
|
return this.#settings.query(args).pipe(
|
|
198
205
|
queryValue,
|
|
199
206
|
catchError((err) => {
|
|
200
|
-
/**
|
|
201
|
-
const
|
|
207
|
+
/** handle both direct errors and errors wrapped in a `cause` property */
|
|
208
|
+
const cause = err?.cause || err;
|
|
209
|
+
|
|
202
210
|
if (cause instanceof AppSettingsError) {
|
|
203
211
|
throw cause;
|
|
204
212
|
}
|
|
205
|
-
if (cause instanceof HttpResponseError) {
|
|
213
|
+
if (cause instanceof HttpJsonResponseError || cause instanceof HttpResponseError) {
|
|
206
214
|
throw AppSettingsError.fromHttpResponse(cause.response, { cause });
|
|
207
215
|
}
|
|
208
216
|
throw new AppSettingsError('unknown', 'failed to load settings', { cause });
|
package/src/AppConfig.ts
CHANGED
|
@@ -38,16 +38,6 @@ export type ConfigEndPoint = {
|
|
|
38
38
|
*
|
|
39
39
|
* console.log(config.getEndpoint('api')); // { url: 'https://api.example.com' }
|
|
40
40
|
* ```
|
|
41
|
-
*
|
|
42
|
-
* @param {Object} config - The configuration object.
|
|
43
|
-
* @param {TEnvironment} [config.environment] - The environment configuration.
|
|
44
|
-
* @param {Record<string, ConfigEndPoint>} [config.endpoints] - The endpoints configuration.
|
|
45
|
-
*
|
|
46
|
-
* @property {TEnvironment} [environment] - The environment configuration.
|
|
47
|
-
* @property {Record<string, string | undefined>} endpoints - The endpoints configuration (deprecated).
|
|
48
|
-
*
|
|
49
|
-
* @method getEndpoint
|
|
50
|
-
* @param {string} key - The key of the endpoint to retrieve.
|
|
51
41
|
*/
|
|
52
42
|
export class AppConfig<TEnvironment extends ConfigEnvironment = ConfigEnvironment> {
|
|
53
43
|
#endpoints: Record<string, ConfigEndPoint>;
|
package/src/AppConfigurator.ts
CHANGED
|
@@ -38,17 +38,18 @@ export class AppConfigurator
|
|
|
38
38
|
init: ModuleInitializerArgs<IAppConfigurator, [HttpModule, ServiceDiscoveryModule]>,
|
|
39
39
|
): Promise<IHttpClient> {
|
|
40
40
|
const http = await init.requireInstance('http');
|
|
41
|
+
const serviceName = 'apps';
|
|
41
42
|
/** check if the http provider has configure a client */
|
|
42
|
-
if (http.hasClient(
|
|
43
|
-
return http.createClient(
|
|
44
|
-
} else {
|
|
45
|
-
/** load service discovery module */
|
|
46
|
-
const serviceDiscovery = await init.requireInstance('serviceDiscovery');
|
|
47
|
-
|
|
48
|
-
// TODO - remove when refactor portal service!
|
|
49
|
-
/** resolve and create a client from discovery */
|
|
50
|
-
return await serviceDiscovery.createClient('apps');
|
|
43
|
+
if (http.hasClient(serviceName)) {
|
|
44
|
+
return http.createClient(serviceName);
|
|
51
45
|
}
|
|
46
|
+
|
|
47
|
+
/** load service discovery module */
|
|
48
|
+
const serviceDiscovery = await init.requireInstance('serviceDiscovery');
|
|
49
|
+
|
|
50
|
+
// TODO - remove when refactor portal service!
|
|
51
|
+
/** resolve and create a client from discovery */
|
|
52
|
+
return await serviceDiscovery.createClient(serviceName);
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
public setClient(
|
package/src/app/App.ts
CHANGED
|
@@ -248,6 +248,12 @@ export interface IApp<
|
|
|
248
248
|
|
|
249
249
|
const fallbackSettings: AppSettings = {};
|
|
250
250
|
|
|
251
|
+
export type AppInitializeResult = {
|
|
252
|
+
manifest: AppManifest;
|
|
253
|
+
script: AppScriptModule;
|
|
254
|
+
config: AppConfig;
|
|
255
|
+
};
|
|
256
|
+
|
|
251
257
|
// TODO make streams distinct until changed from state
|
|
252
258
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
253
259
|
export class App<
|
|
@@ -542,11 +548,7 @@ export class App<
|
|
|
542
548
|
});
|
|
543
549
|
}
|
|
544
550
|
|
|
545
|
-
public initialize(): Observable<{
|
|
546
|
-
manifest: AppManifest;
|
|
547
|
-
script: AppScriptModule;
|
|
548
|
-
config: AppConfig;
|
|
549
|
-
}> {
|
|
551
|
+
public initialize(): Observable<AppInitializeResult> {
|
|
550
552
|
return new Observable((subscriber) => {
|
|
551
553
|
// dispatch initialize action to indicate that the application is initializing
|
|
552
554
|
this.#state.next(actions.initialize());
|
package/src/app/index.ts
CHANGED
package/src/errors.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type AppErrorType = 'not_found' | 'unauthorized' | 'unknown';
|
|
1
|
+
type AppErrorType = 'not_found' | 'unauthorized' | 'unknown' | 'deleted';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents an error that occurs when loading an application manifest.
|
|
@@ -20,6 +20,8 @@ export class AppManifestError extends Error {
|
|
|
20
20
|
);
|
|
21
21
|
case 404:
|
|
22
22
|
return new AppManifestError('not_found', 'application manifest not found', options);
|
|
23
|
+
case 410:
|
|
24
|
+
return new AppManifestError('deleted', 'application manifest deleted', options);
|
|
23
25
|
}
|
|
24
26
|
return new AppManifestError(
|
|
25
27
|
'unknown',
|
|
@@ -63,6 +65,8 @@ export class AppConfigError extends Error {
|
|
|
63
65
|
);
|
|
64
66
|
case 404:
|
|
65
67
|
return new AppConfigError('not_found', 'application config not found', options);
|
|
68
|
+
case 410:
|
|
69
|
+
return new AppConfigError('deleted', 'application config deleted', options);
|
|
66
70
|
}
|
|
67
71
|
return new AppConfigError(
|
|
68
72
|
'unknown',
|
|
@@ -106,6 +110,8 @@ export class AppSettingsError extends Error {
|
|
|
106
110
|
);
|
|
107
111
|
case 404:
|
|
108
112
|
return new AppSettingsError('not_found', 'application not found', options);
|
|
113
|
+
case 410:
|
|
114
|
+
return new AppSettingsError('deleted', 'application settings deleted', options);
|
|
109
115
|
}
|
|
110
116
|
return new AppSettingsError(
|
|
111
117
|
'unknown',
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '6.1.
|
|
2
|
+
export const version = '6.1.18';
|