@equinor/fusion-framework-module-app 6.1.8 → 6.1.9
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 +7 -0
- package/dist/esm/AppClient.Selectors.js +3 -12
- package/dist/esm/AppClient.Selectors.js.map +1 -1
- package/dist/esm/AppClient.js +38 -66
- package/dist/esm/AppClient.js.map +1 -1
- package/dist/esm/AppConfig.js +11 -21
- package/dist/esm/AppConfig.js.map +1 -1
- package/dist/esm/AppConfigurator.js +18 -32
- package/dist/esm/AppConfigurator.js.map +1 -1
- package/dist/esm/AppModuleProvider.js +24 -38
- package/dist/esm/AppModuleProvider.js.map +1 -1
- package/dist/esm/app/App.js +217 -238
- package/dist/esm/app/App.js.map +1 -1
- package/dist/esm/app/create-reducer.js +2 -3
- package/dist/esm/app/create-reducer.js.map +1 -1
- package/dist/esm/app/flows.js +1 -2
- package/dist/esm/app/flows.js.map +1 -1
- package/dist/esm/enable-app-module.js +2 -11
- package/dist/esm/enable-app-module.js.map +1 -1
- package/dist/esm/errors.js +4 -0
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/module.js +4 -13
- package/dist/esm/module.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +6 -6
- package/src/version.ts +1 -1
- package/tsconfig.json +4 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { jsonSelector, } from '@equinor/fusion-framework-module-http/selectors';
|
|
11
2
|
import { AppConfig } from './AppConfig';
|
|
12
3
|
import { ApiAppConfigSchema } from './schemas';
|
|
@@ -18,11 +9,11 @@ import { ApiAppConfigSchema } from './schemas';
|
|
|
18
9
|
*
|
|
19
10
|
* @throws Will throw an error if the response cannot be parsed or does not conform to the expected schema.
|
|
20
11
|
*/
|
|
21
|
-
export const AppConfigSelector = (response) =>
|
|
12
|
+
export const AppConfigSelector = async (response) => {
|
|
22
13
|
// Select the JSON data from the response
|
|
23
|
-
const raw =
|
|
14
|
+
const raw = await jsonSelector(response);
|
|
24
15
|
// Parse the JSON data using the API application configuration schema
|
|
25
16
|
const data = ApiAppConfigSchema.parse(raw);
|
|
26
17
|
return new AppConfig(data);
|
|
27
|
-
}
|
|
18
|
+
};
|
|
28
19
|
//# sourceMappingURL=AppClient.Selectors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppClient.Selectors.js","sourceRoot":"","sources":["../../src/AppClient.Selectors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppClient.Selectors.js","sourceRoot":"","sources":["../../src/AppClient.Selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,GAEb,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAgC,KAAK,EAAE,QAAQ,EAAE,EAAE;IAC/E,yCAAyC;IACzC,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,CAAC;IAEzC,qEAAqE;IACrE,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE3C,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC,CAAC"}
|
package/dist/esm/AppClient.js
CHANGED
|
@@ -1,35 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
11
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
14
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
15
|
-
};
|
|
16
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
17
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
18
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
19
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
20
|
-
};
|
|
21
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
22
|
-
var t = {};
|
|
23
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
24
|
-
t[p] = s[p];
|
|
25
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
26
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
27
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
28
|
-
t[p[i]] = s[p[i]];
|
|
29
|
-
}
|
|
30
|
-
return t;
|
|
31
|
-
};
|
|
32
|
-
var _AppClient_manifest, _AppClient_manifests, _AppClient_config, _AppClient_settings, _AppClient_client;
|
|
33
1
|
import { catchError, map, tap } from 'rxjs';
|
|
34
2
|
import { Query } from '@equinor/fusion-query';
|
|
35
3
|
import { queryValue } from '@equinor/fusion-query/operators';
|
|
@@ -44,8 +12,9 @@ import { AppConfigSelector } from './AppClient.Selectors';
|
|
|
44
12
|
* @returns An object conforming to the AppManifest interface.
|
|
45
13
|
*/
|
|
46
14
|
const ApplicationSchema = ApiApplicationSchema.transform((x) => {
|
|
47
|
-
const { category
|
|
48
|
-
return
|
|
15
|
+
const { category, ...props } = x;
|
|
16
|
+
return {
|
|
17
|
+
...props,
|
|
49
18
|
// TODO: remove deprecated appKey
|
|
50
19
|
get key() {
|
|
51
20
|
return props.appKey;
|
|
@@ -53,57 +22,60 @@ const ApplicationSchema = ApiApplicationSchema.transform((x) => {
|
|
|
53
22
|
// TODO: remove deprecated name
|
|
54
23
|
get name() {
|
|
55
24
|
return props.displayName;
|
|
56
|
-
},
|
|
25
|
+
},
|
|
26
|
+
categoryId: category?.id,
|
|
27
|
+
category,
|
|
28
|
+
};
|
|
57
29
|
});
|
|
58
30
|
/**
|
|
59
31
|
* The `AppClient` class implements the `IAppClient` interface and provides methods to query
|
|
60
32
|
* application manifests and configurations from a backend service.
|
|
61
33
|
*/
|
|
62
34
|
export class AppClient {
|
|
35
|
+
#manifest;
|
|
36
|
+
#manifests;
|
|
37
|
+
#config;
|
|
38
|
+
#settings;
|
|
39
|
+
#client;
|
|
63
40
|
constructor(client) {
|
|
64
|
-
|
|
65
|
-
_AppClient_manifests.set(this, void 0);
|
|
66
|
-
_AppClient_config.set(this, void 0);
|
|
67
|
-
_AppClient_settings.set(this, void 0);
|
|
68
|
-
_AppClient_client.set(this, void 0);
|
|
69
|
-
__classPrivateFieldSet(this, _AppClient_client, client, "f");
|
|
41
|
+
this.#client = client;
|
|
70
42
|
const expire = 1 * 60 * 1000;
|
|
71
|
-
|
|
43
|
+
this.#manifest = new Query({
|
|
72
44
|
client: {
|
|
73
45
|
fn: ({ appKey }) => {
|
|
74
46
|
return client.json(`/persons/me/apps/${appKey}`, {
|
|
75
47
|
headers: {
|
|
76
48
|
'Api-Version': '1.0',
|
|
77
49
|
},
|
|
78
|
-
selector: (res) =>
|
|
50
|
+
selector: async (res) => ApplicationSchema.parse(await jsonSelector(res)),
|
|
79
51
|
});
|
|
80
52
|
},
|
|
81
53
|
},
|
|
82
54
|
queueOperator: 'merge',
|
|
83
55
|
key: ({ appKey }) => appKey,
|
|
84
56
|
expire,
|
|
85
|
-
})
|
|
86
|
-
|
|
57
|
+
});
|
|
58
|
+
this.#manifests = new Query({
|
|
87
59
|
client: {
|
|
88
60
|
fn: (filter) => {
|
|
89
|
-
const path =
|
|
61
|
+
const path = filter?.filterByCurrentUser
|
|
90
62
|
? '/persons/me/apps'
|
|
91
63
|
: '/apps?=$expand=category,admins,owners,keywords';
|
|
92
64
|
return client.json(path, {
|
|
93
65
|
headers: {
|
|
94
66
|
'Api-Version': '1.0',
|
|
95
67
|
},
|
|
96
|
-
selector: (res) =>
|
|
97
|
-
const response = (
|
|
68
|
+
selector: async (res) => {
|
|
69
|
+
const response = (await jsonSelector(res));
|
|
98
70
|
return ApplicationSchema.array().parse(response.value);
|
|
99
|
-
}
|
|
71
|
+
},
|
|
100
72
|
});
|
|
101
73
|
},
|
|
102
74
|
},
|
|
103
|
-
key: (filter) => (
|
|
75
|
+
key: (filter) => (filter?.filterByCurrentUser ? 'currentUser' : 'all'),
|
|
104
76
|
expire,
|
|
105
|
-
})
|
|
106
|
-
|
|
77
|
+
});
|
|
78
|
+
this.#config = new Query({
|
|
107
79
|
client: {
|
|
108
80
|
fn: ({ appKey, tag = 'latest' }) => {
|
|
109
81
|
return client.json(`/apps/${appKey}/builds/${tag}/config`, {
|
|
@@ -117,8 +89,8 @@ export class AppClient {
|
|
|
117
89
|
queueOperator: 'merge',
|
|
118
90
|
key: (args) => JSON.stringify(args),
|
|
119
91
|
expire,
|
|
120
|
-
})
|
|
121
|
-
|
|
92
|
+
});
|
|
93
|
+
this.#settings = new Query({
|
|
122
94
|
client: {
|
|
123
95
|
fn: ({ appKey }) => {
|
|
124
96
|
return client.json(`/persons/me/apps/${appKey}/settings`, {
|
|
@@ -130,10 +102,10 @@ export class AppClient {
|
|
|
130
102
|
},
|
|
131
103
|
key: (args) => args.appKey,
|
|
132
104
|
expire,
|
|
133
|
-
})
|
|
105
|
+
});
|
|
134
106
|
}
|
|
135
107
|
getAppManifest(args) {
|
|
136
|
-
return
|
|
108
|
+
return this.#manifest.query(args).pipe(queryValue, catchError((err) => {
|
|
137
109
|
/** extract cause, since error will be a `QueryError` */
|
|
138
110
|
const { cause } = err;
|
|
139
111
|
if (cause instanceof AppManifestError) {
|
|
@@ -146,10 +118,10 @@ export class AppClient {
|
|
|
146
118
|
}));
|
|
147
119
|
}
|
|
148
120
|
getAppManifests(args) {
|
|
149
|
-
return
|
|
121
|
+
return this.#manifests.query(args).pipe(queryValue);
|
|
150
122
|
}
|
|
151
123
|
getAppConfig(args) {
|
|
152
|
-
return
|
|
124
|
+
return this.#config.query(args).pipe(map((res) => res.value), catchError((err) => {
|
|
153
125
|
/** extract cause, since error will be a `QueryError` */
|
|
154
126
|
const { cause } = err;
|
|
155
127
|
if (cause instanceof AppConfigError) {
|
|
@@ -162,7 +134,7 @@ export class AppClient {
|
|
|
162
134
|
}));
|
|
163
135
|
}
|
|
164
136
|
getAppSettings(args) {
|
|
165
|
-
return
|
|
137
|
+
return this.#settings.query(args).pipe(queryValue, catchError((err) => {
|
|
166
138
|
/** extract cause, since error will be a `QueryError` */
|
|
167
139
|
const { cause } = err;
|
|
168
140
|
if (cause instanceof AppSettingsError) {
|
|
@@ -176,7 +148,7 @@ export class AppClient {
|
|
|
176
148
|
}
|
|
177
149
|
updateAppSettings(args) {
|
|
178
150
|
const { appKey, settings } = args;
|
|
179
|
-
return (
|
|
151
|
+
return (this.#client
|
|
180
152
|
// execute PUT request to update settings
|
|
181
153
|
.json$(`/persons/me/apps/${appKey}/settings`, {
|
|
182
154
|
method: 'PUT',
|
|
@@ -187,18 +159,18 @@ export class AppClient {
|
|
|
187
159
|
})
|
|
188
160
|
.pipe(tap((value) => {
|
|
189
161
|
// update cache with new settings
|
|
190
|
-
|
|
162
|
+
this.#settings.mutate({ appKey }, {
|
|
191
163
|
value,
|
|
192
164
|
updated: Date.now(),
|
|
193
165
|
});
|
|
194
166
|
})));
|
|
195
167
|
}
|
|
196
|
-
[
|
|
168
|
+
[Symbol.dispose]() {
|
|
197
169
|
console.warn('AppClient disposed');
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
170
|
+
this.#manifest.complete();
|
|
171
|
+
this.#manifests.complete();
|
|
172
|
+
this.#config.complete();
|
|
173
|
+
this.#settings.complete();
|
|
202
174
|
}
|
|
203
175
|
}
|
|
204
176
|
export default AppClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppClient.js","sourceRoot":"","sources":["../../src/AppClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppClient.js","sourceRoot":"","sources":["../../src/AppClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAyC,GAAG,EAAE,MAAM,MAAM,CAAC;AAEnF,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,E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AAC,SAAS,EAAE,yBAAyB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9E,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,IAA+C;QAC/D,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAClC,OAAO,CACL,IAAI,CAAC,OAAO;YACV,yCAAyC;aACxC,KAAK,CAAc,oBAAoB,MAAM,WAAW,EAAE;YACzD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,aAAa,EAAE,KAAK;aACrB;SACF,CAAC;aACD,IAAI,CACH,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACZ,iCAAiC;YACjC,IAAI,CAAC,SAAS,CAAC,MAAM,CACnB,EAAE,MAAM,EAAE,EACV;gBACE,KAAK;gBACL,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE;aACpB,CACF,CAAC;QACJ,CAAC,CAAC,CACH,CACJ,CAAC;IACJ,CAAC;IAED,CAAC,MAAM,CAAC,OAAO,CAAC;QACd,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACnC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;QAC1B,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;QAC3B,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IAC5B,CAAC;CACF;AAED,eAAe,SAAS,CAAC"}
|
package/dist/esm/AppConfig.js
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
-
};
|
|
12
|
-
var _AppConfig_endpoints;
|
|
13
1
|
// todo: move to utils
|
|
14
2
|
const deepFreeze = (obj) => {
|
|
15
3
|
for (const property of Object.keys(obj)) {
|
|
@@ -52,6 +40,12 @@ const deepFreeze = (obj) => {
|
|
|
52
40
|
* @param {string} key - The key of the endpoint to retrieve.
|
|
53
41
|
*/
|
|
54
42
|
export class AppConfig {
|
|
43
|
+
#endpoints;
|
|
44
|
+
/**
|
|
45
|
+
* The environment configuration for the application.
|
|
46
|
+
* This property is read-only and is of type `TEnvironment`.
|
|
47
|
+
*/
|
|
48
|
+
environment;
|
|
55
49
|
/**
|
|
56
50
|
* @deprecated Use `getEndpoint` instead.
|
|
57
51
|
*
|
|
@@ -62,18 +56,15 @@ export class AppConfig {
|
|
|
62
56
|
*/
|
|
63
57
|
get endpoints() {
|
|
64
58
|
console.warn('endpoints is deprecated, use getEndpoint instead');
|
|
65
|
-
return new Proxy(
|
|
59
|
+
return new Proxy(this.#endpoints, {
|
|
66
60
|
get(target, prop) {
|
|
67
|
-
|
|
68
|
-
return (_a = target[prop]) === null || _a === void 0 ? void 0 : _a.url;
|
|
61
|
+
return target[prop]?.url;
|
|
69
62
|
},
|
|
70
63
|
});
|
|
71
64
|
}
|
|
72
65
|
constructor(config) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this.environment = deepFreeze((_a = config.environment) !== null && _a !== void 0 ? _a : {});
|
|
76
|
-
__classPrivateFieldSet(this, _AppConfig_endpoints, (_b = config.endpoints) !== null && _b !== void 0 ? _b : {}, "f");
|
|
66
|
+
this.environment = deepFreeze(config.environment ?? {});
|
|
67
|
+
this.#endpoints = config.endpoints ?? {};
|
|
77
68
|
}
|
|
78
69
|
/**
|
|
79
70
|
* Retrieves the configuration endpoint associated with the given key.
|
|
@@ -82,8 +73,7 @@ export class AppConfig {
|
|
|
82
73
|
* @returns The configuration endpoint if found, otherwise `undefined`.
|
|
83
74
|
*/
|
|
84
75
|
getEndpoint(key) {
|
|
85
|
-
return
|
|
76
|
+
return this.#endpoints[key];
|
|
86
77
|
}
|
|
87
78
|
}
|
|
88
|
-
_AppConfig_endpoints = new WeakMap();
|
|
89
79
|
//# sourceMappingURL=AppConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppConfig.js","sourceRoot":"","sources":["../../src/AppConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppConfig.js","sourceRoot":"","sources":["../../src/AppConfig.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,MAAM,UAAU,GAAG,CAAoC,GAAM,EAAK,EAAE;IAClE,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACxC,IACE,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,QAAQ;YACjC,GAAG,CAAC,QAAQ,CAAC,KAAK,IAAI;YACtB,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAC/B,CAAC;YACD,UAAU,CAAC,GAAG,CAAC,QAAQ,CAA4B,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC;AASF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,SAAS;IACpB,UAAU,CAAiC;IAE3C;;;OAGG;IACa,WAAW,CAAe;IAE1C;;;;;;;OAOG;IACH,IAAW,SAAS;QAClB,OAAO,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;QACjE,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE;YAChC,GAAG,CAAC,MAAM,EAAE,IAAI;gBACd,OAAO,MAAM,CAAC,IAAc,CAAC,EAAE,GAAG,CAAC;YACrC,CAAC;SACF,CAAsC,CAAC;IAC1C,CAAC;IAED,YAAY,MAGX;QACC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,CAAiB,CAAC;QACxE,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,GAAW;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -1,38 +1,24 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { BaseConfigBuilder, } from '@equinor/fusion-framework-module';
|
|
11
2
|
import { moduleKey } from './module';
|
|
12
3
|
import AppClient from './AppClient';
|
|
13
4
|
export class AppConfigurator extends BaseConfigBuilder {
|
|
14
|
-
|
|
15
|
-
super(...arguments);
|
|
16
|
-
this.defaultExpireTime = 1 * 60 * 1000;
|
|
17
|
-
}
|
|
5
|
+
defaultExpireTime = 1 * 60 * 1000;
|
|
18
6
|
/**
|
|
19
7
|
* WARNING: this function will be remove in future
|
|
20
8
|
*/
|
|
21
|
-
_createHttpClient(init) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
});
|
|
9
|
+
async _createHttpClient(init) {
|
|
10
|
+
const http = await init.requireInstance('http');
|
|
11
|
+
/** check if the http provider has configure a client */
|
|
12
|
+
if (http.hasClient(moduleKey)) {
|
|
13
|
+
return http.createClient(moduleKey);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
/** load service discovery module */
|
|
17
|
+
const serviceDiscovery = await init.requireInstance('serviceDiscovery');
|
|
18
|
+
// TODO - remove when refactor portal service!
|
|
19
|
+
/** resolve and create a client from discovery */
|
|
20
|
+
return await serviceDiscovery.createClient('apps');
|
|
21
|
+
}
|
|
36
22
|
}
|
|
37
23
|
setClient(client_or_cb) {
|
|
38
24
|
const cb = typeof client_or_cb === 'object' ? () => client_or_cb : client_or_cb;
|
|
@@ -40,16 +26,16 @@ export class AppConfigurator extends BaseConfigBuilder {
|
|
|
40
26
|
}
|
|
41
27
|
// TODO - explain why, used in import of resources aka proxy url
|
|
42
28
|
setAssetUri(base_or_cb) {
|
|
43
|
-
const cb = typeof base_or_cb === 'string' ? () =>
|
|
29
|
+
const cb = typeof base_or_cb === 'string' ? async () => base_or_cb : base_or_cb;
|
|
44
30
|
this._set('assetUri', cb);
|
|
45
31
|
}
|
|
46
32
|
_createConfig(init, initial) {
|
|
47
33
|
if (!this._has('client')) {
|
|
48
|
-
this.setClient(() =>
|
|
49
|
-
const httpClient =
|
|
34
|
+
this.setClient(async () => {
|
|
35
|
+
const httpClient = await this._createHttpClient(init);
|
|
50
36
|
const appClient = new AppClient(httpClient);
|
|
51
37
|
return appClient;
|
|
52
|
-
})
|
|
38
|
+
});
|
|
53
39
|
}
|
|
54
40
|
if (!this._has('assetUri')) {
|
|
55
41
|
this.setAssetUri('/apps-proxy');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppConfigurator.js","sourceRoot":"","sources":["../../src/AppConfigurator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppConfigurator.js","sourceRoot":"","sources":["../../src/AppConfigurator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,GAGlB,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,SAA8B,MAAM,aAAa,CAAC;AAiBzD,MAAM,OAAO,eACX,SAAQ,iBAAkC;IAG1C,iBAAiB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;IAElC;;OAEG;IACO,KAAK,CAAC,iBAAiB,CAC/B,IAAmF;QAEnF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAChD,wDAAwD;QACxD,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QACtC,CAAC;aAAM,CAAC;YACN,oCAAoC;YACpC,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;YAExE,8CAA8C;YAC9C,iDAAiD;YACjD,OAAO,MAAM,gBAAgB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAEM,SAAS,CACd,YAEoD;QAEpD,MAAM,EAAE,GAAG,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC;QAChF,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC1B,CAAC;IAED,gEAAgE;IACzD,WAAW,CAAC,UAAkD;QACnE,MAAM,EAAE,GAAG,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;QAChF,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAC5B,CAAC;IAES,aAAa,CACrB,IAAmF,EACnF,OAAkC;QAElC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE;gBACxB,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;gBACtD,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,UAAU,CAAC,CAAC;gBAC5C,OAAO,SAAS,CAAC;YACnB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC3B,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;CACF"}
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
-
};
|
|
12
|
-
var _AppModuleProvider_appClient, _AppModuleProvider_appBaseUri, _AppModuleProvider_current$, _AppModuleProvider_subscription, _AppModuleProvider_event;
|
|
13
1
|
import { BehaviorSubject, distinctUntilChanged, from, map, pairwise, Subscription, takeWhile, } from 'rxjs';
|
|
14
2
|
import { App, filterEmpty } from './app/App';
|
|
15
3
|
import { SemanticVersion } from '@equinor/fusion-framework-module';
|
|
@@ -18,6 +6,11 @@ export class AppModuleProvider {
|
|
|
18
6
|
static compareAppManifest(a, b) {
|
|
19
7
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
20
8
|
}
|
|
9
|
+
#appClient;
|
|
10
|
+
#appBaseUri;
|
|
11
|
+
#current$;
|
|
12
|
+
#subscription = new Subscription();
|
|
13
|
+
#event;
|
|
21
14
|
/**
|
|
22
15
|
* Get module version
|
|
23
16
|
*/
|
|
@@ -32,10 +25,10 @@ export class AppModuleProvider {
|
|
|
32
25
|
* - undefined if application never set
|
|
33
26
|
*/
|
|
34
27
|
get current() {
|
|
35
|
-
return
|
|
28
|
+
return this.#current$.value;
|
|
36
29
|
}
|
|
37
30
|
get current$() {
|
|
38
|
-
return
|
|
31
|
+
return this.#current$.pipe(distinctUntilChanged((prev, next) => {
|
|
39
32
|
if (prev && next) {
|
|
40
33
|
return prev.appKey === next.appKey;
|
|
41
34
|
}
|
|
@@ -43,26 +36,20 @@ export class AppModuleProvider {
|
|
|
43
36
|
}));
|
|
44
37
|
}
|
|
45
38
|
constructor(args) {
|
|
46
|
-
var _a;
|
|
47
|
-
_AppModuleProvider_appClient.set(this, void 0);
|
|
48
|
-
_AppModuleProvider_appBaseUri.set(this, void 0);
|
|
49
|
-
_AppModuleProvider_current$.set(this, void 0);
|
|
50
|
-
_AppModuleProvider_subscription.set(this, new Subscription());
|
|
51
|
-
_AppModuleProvider_event.set(this, void 0);
|
|
52
39
|
const { event, config } = args;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
40
|
+
this.#appClient = config.client;
|
|
41
|
+
this.#event = event;
|
|
42
|
+
this.#current$ = new BehaviorSubject(undefined);
|
|
43
|
+
this.#appBaseUri = config.assetUri ?? '';
|
|
44
|
+
this.#subscription.add(this.current$
|
|
58
45
|
.pipe(pairwise(), takeWhile(() => !!event))
|
|
59
46
|
.subscribe(([previous, next]) => {
|
|
60
|
-
event
|
|
47
|
+
event?.dispatchEvent('onCurrentAppChanged', {
|
|
61
48
|
source: this,
|
|
62
49
|
detail: { previous, next },
|
|
63
50
|
});
|
|
64
51
|
}));
|
|
65
|
-
|
|
52
|
+
this.#subscription.add(this.#current$
|
|
66
53
|
.pipe(pairwise(), map(([previous]) => previous), filterEmpty())
|
|
67
54
|
.subscribe((app) => app.dispose()));
|
|
68
55
|
}
|
|
@@ -71,10 +58,10 @@ export class AppModuleProvider {
|
|
|
71
58
|
* @param appKey - application key
|
|
72
59
|
*/
|
|
73
60
|
getAppManifest(appKey) {
|
|
74
|
-
return from(
|
|
61
|
+
return from(this.#appClient.getAppManifest({ appKey }));
|
|
75
62
|
}
|
|
76
63
|
getAppManifests(filter) {
|
|
77
|
-
return from(
|
|
64
|
+
return from(this.#appClient.getAppManifests(filter));
|
|
78
65
|
}
|
|
79
66
|
/**
|
|
80
67
|
* fetch all applications
|
|
@@ -88,14 +75,14 @@ export class AppModuleProvider {
|
|
|
88
75
|
* @param appKey - application key
|
|
89
76
|
*/
|
|
90
77
|
getAppConfig(appKey, tag) {
|
|
91
|
-
return from(
|
|
78
|
+
return from(this.#appClient.getAppConfig({ appKey, tag }));
|
|
92
79
|
}
|
|
93
80
|
/**
|
|
94
81
|
* fetch user settings for an application
|
|
95
82
|
* @param appKey - application key
|
|
96
83
|
*/
|
|
97
84
|
getAppSettings(appKey) {
|
|
98
|
-
return from(
|
|
85
|
+
return from(this.#appClient.getAppSettings({ appKey }));
|
|
99
86
|
}
|
|
100
87
|
/**
|
|
101
88
|
* Put user settings for an application
|
|
@@ -103,7 +90,7 @@ export class AppModuleProvider {
|
|
|
103
90
|
* @param settings - The settings to add save
|
|
104
91
|
*/
|
|
105
92
|
updateAppSettings(appKey, settings) {
|
|
106
|
-
return from(
|
|
93
|
+
return from(this.#appClient.updateAppSettings({ appKey, settings }));
|
|
107
94
|
}
|
|
108
95
|
/**
|
|
109
96
|
* set the current application, will internally resolve manifest
|
|
@@ -111,13 +98,13 @@ export class AppModuleProvider {
|
|
|
111
98
|
*/
|
|
112
99
|
setCurrentApp(appKeyOrApp) {
|
|
113
100
|
const app = typeof appKeyOrApp === 'string' ? this.createApp({ appKey: appKeyOrApp }) : appKeyOrApp;
|
|
114
|
-
|
|
101
|
+
this.#current$.next(app);
|
|
115
102
|
}
|
|
116
103
|
clearCurrentApp() {
|
|
117
|
-
|
|
104
|
+
this.#current$.next(null);
|
|
118
105
|
}
|
|
119
106
|
get assetUri() {
|
|
120
|
-
return
|
|
107
|
+
return this.#appBaseUri;
|
|
121
108
|
}
|
|
122
109
|
/**
|
|
123
110
|
* This should not be used, only for legacy creation backdoor
|
|
@@ -125,12 +112,11 @@ export class AppModuleProvider {
|
|
|
125
112
|
*/
|
|
126
113
|
createApp(value) {
|
|
127
114
|
console.warn();
|
|
128
|
-
return new App(value, { provider: this, event:
|
|
115
|
+
return new App(value, { provider: this, event: this.#event });
|
|
129
116
|
}
|
|
130
117
|
dispose() {
|
|
131
|
-
|
|
118
|
+
this.#subscription.unsubscribe();
|
|
132
119
|
}
|
|
133
120
|
}
|
|
134
|
-
_AppModuleProvider_appClient = new WeakMap(), _AppModuleProvider_appBaseUri = new WeakMap(), _AppModuleProvider_current$ = new WeakMap(), _AppModuleProvider_subscription = new WeakMap(), _AppModuleProvider_event = new WeakMap();
|
|
135
121
|
export default AppModuleProvider;
|
|
136
122
|
//# sourceMappingURL=AppModuleProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppModuleProvider.js","sourceRoot":"","sources":["../../src/AppModuleProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppModuleProvider.js","sourceRoot":"","sources":["../../src/AppModuleProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,IAAI,EACJ,GAAG,EAEH,QAAQ,EACR,YAAY,EACZ,SAAS,GACV,MAAM,MAAM,CAAC;AAOd,OAAO,EAAE,GAAG,EAAE,WAAW,EAAa,MAAM,WAAW,CAAC;AAIxD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,OAAO,iBAAiB;IAC5B,MAAM,CAAC,kBAAkB,CAAwB,CAAK,EAAE,CAAK;QAC3D,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,UAAU,CAAa;IAEvB,WAAW,CAAS;IAEpB,SAAS,CAAqC;IAE9C,aAAa,GAAG,IAAI,YAAY,EAAE,CAAC;IAEnC,MAAM,CAA2B;IAEjC;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;IAC9B,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI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