@qelos/plugin-play 3.0.1 → 3.0.2
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/create-cert.js +1 -1
- package/package.json +1 -1
- package/src/endpoints.ts +1 -1
- package/src/micro-frontends.ts +48 -5
package/create-cert.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const {execSync} = require('child_process');
|
|
2
2
|
|
|
3
|
-
execSync(`cd cert && docker run -v $
|
|
3
|
+
execSync(`cd cert && docker run -v ${process.cwd()}:/certs \\
|
|
4
4
|
-e SSL_SUBJECT=${process.env.HOSTNAME || '0.0.0.0'} stakater/ssl-certs-generator:1.0`, {stdio: 'inherit'});
|
|
5
5
|
|
|
6
6
|
console.log('done.');
|
package/package.json
CHANGED
package/src/endpoints.ts
CHANGED
package/src/micro-frontends.ts
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
import manifest, {NavBarGroup} from './manifest';
|
|
2
|
+
import {addProxyEndpoint, QelosRouteParams} from './endpoints';
|
|
2
3
|
|
|
3
|
-
export interface
|
|
4
|
+
export interface IframeMicroFrontend extends GlobalMicroFrontend {
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface PreDesignedMicroFrontendOptions
|
|
9
|
+
extends Pick<QelosRouteParams, 'verifyToken'>,
|
|
10
|
+
Partial<Pick<QelosRouteParams, 'handler'>>,
|
|
11
|
+
GlobalMicroFrontend {
|
|
12
|
+
use: string;
|
|
13
|
+
fetchUrl?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface PreDesignedMicroFrontend extends Omit<PreDesignedMicroFrontendOptions, 'handler' | 'verifyToken'> {
|
|
17
|
+
fetchUrl: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface GlobalMicroFrontend {
|
|
4
21
|
name: string;
|
|
5
22
|
description: string;
|
|
6
|
-
url: string;
|
|
7
23
|
roles?: string[],
|
|
8
24
|
route?: {
|
|
9
25
|
name: string;
|
|
@@ -24,11 +40,38 @@ export interface MicroFrontend {
|
|
|
24
40
|
}
|
|
25
41
|
}
|
|
26
42
|
|
|
27
|
-
export
|
|
28
|
-
|
|
43
|
+
export type MicroFrontendOptions = IframeMicroFrontend | PreDesignedMicroFrontendOptions
|
|
44
|
+
export type MicroFrontend = IframeMicroFrontend | PreDesignedMicroFrontend
|
|
45
|
+
|
|
46
|
+
export function addMicroFrontend(mfe: MicroFrontendOptions) {
|
|
47
|
+
mfe = {...mfe}
|
|
48
|
+
let manifestMfe: MicroFrontend;
|
|
49
|
+
if ('use' in mfe) {
|
|
50
|
+
const verifyToken = mfe.verifyToken || true;
|
|
51
|
+
delete mfe.verifyToken;
|
|
52
|
+
|
|
53
|
+
if ('handler' in mfe) {
|
|
54
|
+
const fetchUrl = mfe.fetchUrl || btoa(mfe.name);
|
|
55
|
+
const handler = mfe.handler;
|
|
56
|
+
delete mfe.handler;
|
|
57
|
+
addProxyEndpoint(fetchUrl, {
|
|
58
|
+
handler,
|
|
59
|
+
verifyToken,
|
|
60
|
+
});
|
|
61
|
+
manifestMfe = {
|
|
62
|
+
...mfe as PreDesignedMicroFrontend,
|
|
63
|
+
fetchUrl
|
|
64
|
+
}
|
|
65
|
+
} else if ('fetchUrl' in mfe) {
|
|
66
|
+
manifestMfe = mfe as PreDesignedMicroFrontend;
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
manifestMfe = mfe;
|
|
70
|
+
}
|
|
71
|
+
manifest.microFrontends.push(manifestMfe);
|
|
29
72
|
}
|
|
30
73
|
|
|
31
|
-
export function addGroupedMicroFrontends(group: NavBarGroup, mfeArray:
|
|
74
|
+
export function addGroupedMicroFrontends(group: NavBarGroup, mfeArray: MicroFrontendOptions[]) {
|
|
32
75
|
manifest.navBarGroups.push(group);
|
|
33
76
|
mfeArray.forEach(mfe => {
|
|
34
77
|
addMicroFrontend({...mfe, route: {...mfe.route, group: group.key}})
|