@egen-civitas/esm-embed-host 0.5.0 → 0.6.0
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 +16 -0
- package/README.md +1 -0
- package/dist/host.d.ts +7 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +8 -0
- package/dist/table.d.ts +2 -0
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +4 -0
- package/package.json +3 -3
- package/src/host.ts +11 -0
- package/src/table.ts +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @egen-civitas/esm-embed-host
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8cb58ba: Contrat « page introuvable » : une app embarquée ne rend plus sa propre 404, elle la délègue au Shell.
|
|
8
|
+
|
|
9
|
+
- **protocole** : méthode `navigation.notFound(path?)` (chemin interne ou aucun argument ; tout autre argument est rejeté) dans la capacité `navigation` existante (aucune nouvelle capacité, rétrocompatible).
|
|
10
|
+
- **hôte** : option `onNotFound({ path })` de `createEmbedHost` ; le chemin est normalisé et débarrassé des paramètres sensibles, l'appel est limité en débit comme `report`. Sans callback : accepté, sans effet.
|
|
11
|
+
- **client** : `egen.navigation.notFound(path?)`.
|
|
12
|
+
- **testing** : le simulateur journalise `notFound` dans `calls`.
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [8cb58ba]
|
|
17
|
+
- @egen-civitas/esm-embed-protocol@0.6.0
|
|
18
|
+
|
|
3
19
|
## 0.5.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ host.mount(container); // …; host.destroy() au démontage
|
|
|
30
30
|
|
|
31
31
|
- **Moindre privilège** : la table d'appels de la connexion ne contient que les capacités accordées **et** servies. Une capacité accordée sans fournisseur est refusée (`UNAVAILABLE`).
|
|
32
32
|
- **Règle d'or** : le Core ne relaie ni identité/session, ni droits, ni thème, ni appels API authentifiés (ils viennent de Keycloak, des backends, du service de thèmes). Aucun jeton ne transite.
|
|
33
|
+
- **Page introuvable** : `onNotFound({ path })` est appelé quand l'app signale (`navigation.notFound`) qu'elle ne connaît pas une page. Le Shell affiche **sa** page 404 à la place de l'app ; `path` est normalisé et sans paramètre sensible (`null` = page courante). Sans callback, l'appel est accepté et sans effet.
|
|
33
34
|
- **Droits d'iframe négociés** : le socle (`allow-scripts allow-same-origin allow-forms allow-popups`) s'applique à toute app ; `iframe` (droits effectifs) ne peut que l'étendre (`allow-downloads`, `allow-modals`, `clipboard-*`, `fullscreen`…). L'hôte revalide chaque jeton par liste blanche et pose `sandbox` et `allow`. `allow-same-origin` + `allow-scripts` sur la même origine que le Shell est signalé (bac à sable sans effet).
|
|
34
35
|
- **Voie unique** : le pont 1.1 (`{ egen: 1 }`) est retiré ; ses messages sont ignorés. Une app doit adopter `@egen-civitas/esm-embed-client`.
|
|
35
36
|
- `HostConnection` est indépendante du DOM (testable avec le vrai client, voir `src/__tests__/harness.ts`).
|
package/dist/host.d.ts
CHANGED
|
@@ -23,6 +23,13 @@ export interface EmbedHostOptions {
|
|
|
23
23
|
navigation?: NavigationOptions;
|
|
24
24
|
/** Navigation demandée par l'app vers le Core (défaut : `singleSpaNavigate`). */
|
|
25
25
|
onNavigate?: (to: string) => void;
|
|
26
|
+
/**
|
|
27
|
+
* L'app signale une page introuvable (`navigation.notFound`) : le Shell affiche SA page 404 à la place de l'app.
|
|
28
|
+
* `path` est le chemin de l'app, normalisé et débarrassé des paramètres sensibles (`null` : la page courante de l'app).
|
|
29
|
+
*/
|
|
30
|
+
onNotFound?: (info: {
|
|
31
|
+
path: string | null;
|
|
32
|
+
}) => void;
|
|
26
33
|
limits?: Partial<Limits>;
|
|
27
34
|
hostVersion?: string;
|
|
28
35
|
window?: Window;
|
package/dist/host.d.ts.map
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ACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;IACrD,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC;IAC3E,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,KAAK,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;IAChC,2IAA2I;IAC3I,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,OAAO,IAAI,IAAI,CAAC;CACjB;AAKD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,SAAS,CAgJjE"}
|
package/dist/host.js
CHANGED
|
@@ -285,6 +285,14 @@ import { buildCoreUrl, buildEmbedSrc, coreSubpath, createRateLimiter, stripSensi
|
|
|
285
285
|
return (_win_singleSpaNavigate = win.singleSpaNavigate) === null || _win_singleSpaNavigate === void 0 ? void 0 : _win_singleSpaNavigate.call(win, spaBase() + t.replace(/^\//, ''));
|
|
286
286
|
})(to);
|
|
287
287
|
},
|
|
288
|
+
notFound: function notFound(path) {
|
|
289
|
+
if (!opts.onNotFound || !allowLocation()) return;
|
|
290
|
+
var normalized = path === undefined ? null : normalizeAppPath(path);
|
|
291
|
+
if (path !== undefined && normalized === null) return;
|
|
292
|
+
opts.onNotFound({
|
|
293
|
+
path: normalized === null ? null : stripSensitive(normalized, nav === null || nav === void 0 ? void 0 : nav.sensitiveParams)
|
|
294
|
+
});
|
|
295
|
+
},
|
|
288
296
|
setTitle: function setTitle(t) {
|
|
289
297
|
return void (iframe.title = String(t).slice(0, 200));
|
|
290
298
|
},
|
package/dist/table.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface HostControls {
|
|
|
8
8
|
title?: string;
|
|
9
9
|
}): void;
|
|
10
10
|
navigate?(to: string): void;
|
|
11
|
+
/** L'app signale une page introuvable (`path` : chemin de l'app, absent = page courante). */
|
|
12
|
+
notFound?(path?: string): void;
|
|
11
13
|
setTitle?(title: string): void;
|
|
12
14
|
resize?(height: number): void;
|
|
13
15
|
onReady?(): void;
|
package/dist/table.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../src/table.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAEjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEnE,+EAA+E;AAC/E,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC1E,QAAQ,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB,6DAA6D;IAC7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,CAAC;IACjB,6DAA6D;IAC7D,OAAO,EAAE,GAAG,CAAC;CACd;AAED,8HAA8H;AAC9H,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,aAAa,GAAG,GAAG,CAAC,YAAY,CAAC,CAczE;AAID,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,SAAS,EAAE,aAAa,CAAC;IACzB,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,YAAY,GAAG;IAAE,KAAK,EAAE,YAAY,CAAC;IAAC,SAAS,EAAE,gBAAgB,CAAA;CAAE,CAgG3G"}
|
package/dist/table.js
CHANGED
|
@@ -411,6 +411,10 @@ var list = function list(cfg, key) {
|
|
|
411
411
|
var _c_navigate;
|
|
412
412
|
return (_c_navigate = c.navigate) === null || _c_navigate === void 0 ? void 0 : _c_navigate.call(c, to);
|
|
413
413
|
},
|
|
414
|
+
notFound: function notFound(path) {
|
|
415
|
+
var _c_notFound;
|
|
416
|
+
return (_c_notFound = c.notFound) === null || _c_notFound === void 0 ? void 0 : _c_notFound.call(c, path);
|
|
417
|
+
},
|
|
414
418
|
setTitle: function setTitle(t) {
|
|
415
419
|
var _c_setTitle;
|
|
416
420
|
return (_c_setTitle = c.setTitle) === null || _c_setTitle === void 0 ? void 0 : _c_setTitle.call(c, t);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egen-civitas/esm-embed-host",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Hôte (côté Shell/Core) des applications embarquées : iframe sécurisée, poignée de main v2, grants, fournisseurs de capacités, navigation partagée, compatibilité du pont 1.1.",
|
|
6
6
|
"type": "module",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@egen-civitas/esm-embed-client": "^0.
|
|
60
|
+
"@egen-civitas/esm-embed-client": "^0.4.0",
|
|
61
61
|
"@swc/cli": "0.8.1",
|
|
62
62
|
"@swc/core": "1.15.21",
|
|
63
63
|
"@types/node": "^20",
|
|
@@ -69,6 +69,6 @@
|
|
|
69
69
|
"vitest": "^4.1.2"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@egen-civitas/esm-embed-protocol": "^0.
|
|
72
|
+
"@egen-civitas/esm-embed-protocol": "^0.6.0"
|
|
73
73
|
}
|
|
74
74
|
}
|
package/src/host.ts
CHANGED
|
@@ -26,6 +26,11 @@ export interface EmbedHostOptions {
|
|
|
26
26
|
navigation?: NavigationOptions;
|
|
27
27
|
/** Navigation demandée par l'app vers le Core (défaut : `singleSpaNavigate`). */
|
|
28
28
|
onNavigate?: (to: string) => void;
|
|
29
|
+
/**
|
|
30
|
+
* L'app signale une page introuvable (`navigation.notFound`) : le Shell affiche SA page 404 à la place de l'app.
|
|
31
|
+
* `path` est le chemin de l'app, normalisé et débarrassé des paramètres sensibles (`null` : la page courante de l'app).
|
|
32
|
+
*/
|
|
33
|
+
onNotFound?: (info: { path: string | null }) => void;
|
|
29
34
|
limits?: Partial<Limits>;
|
|
30
35
|
hostVersion?: string;
|
|
31
36
|
window?: Window;
|
|
@@ -107,6 +112,12 @@ export function createEmbedHost(opts: EmbedHostOptions): EmbedHost {
|
|
|
107
112
|
if (normalizeAppPath(to) === null) return;
|
|
108
113
|
(opts.onNavigate ?? ((t) => (win as any).singleSpaNavigate?.(spaBase() + t.replace(/^\//, ''))))(to);
|
|
109
114
|
},
|
|
115
|
+
notFound: (path) => {
|
|
116
|
+
if (!opts.onNotFound || !allowLocation()) return;
|
|
117
|
+
const normalized = path === undefined ? null : normalizeAppPath(path);
|
|
118
|
+
if (path !== undefined && normalized === null) return;
|
|
119
|
+
opts.onNotFound({ path: normalized === null ? null : stripSensitive(normalized, nav?.sensitiveParams) });
|
|
120
|
+
},
|
|
110
121
|
setTitle: (t) => void (iframe.title = String(t).slice(0, 200)),
|
|
111
122
|
resize: (h) => {
|
|
112
123
|
if (Number.isFinite(h) && h >= 0) iframe.style.height = `${Math.min(Math.ceil(h), 100_000)}px`;
|
package/src/table.ts
CHANGED
|
@@ -18,6 +18,8 @@ import type { CallerContext, HostProviders } from './providers.js';
|
|
|
18
18
|
export interface HostControls {
|
|
19
19
|
report?(path: string, opts?: { replace?: boolean; title?: string }): void;
|
|
20
20
|
navigate?(to: string): void;
|
|
21
|
+
/** L'app signale une page introuvable (`path` : chemin de l'app, absent = page courante). */
|
|
22
|
+
notFound?(path?: string): void;
|
|
21
23
|
setTitle?(title: string): void;
|
|
22
24
|
resize?(height: number): void;
|
|
23
25
|
onReady?(): void;
|
|
@@ -116,6 +118,7 @@ export function createCapabilityTable(o: TableOptions): { table: HandlerTable; s
|
|
|
116
118
|
table.navigation = {
|
|
117
119
|
report: (path: string, opts?: { replace?: boolean; title?: string }) => c.report?.(path, opts),
|
|
118
120
|
navigate: (to: string) => c.navigate?.(to),
|
|
121
|
+
notFound: (path?: string) => c.notFound?.(path),
|
|
119
122
|
setTitle: (t: string) => c.setTitle?.(t),
|
|
120
123
|
resize: (h: number) => c.resize?.(h),
|
|
121
124
|
};
|