@egen-civitas/esm-embed-host 0.2.0 → 0.4.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 +33 -0
- package/README.md +6 -7
- package/dist/connection.d.ts +0 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +4 -14
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +27 -84
- package/dist/providers.d.ts +15 -49
- package/dist/providers.d.ts.map +1 -1
- package/dist/providers.js +6 -300
- package/dist/table.d.ts +1 -4
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +38 -251
- package/package.json +3 -3
- package/src/connection.ts +1 -11
- package/src/host.ts +7 -11
- package/src/providers.ts +13 -88
- package/src/table.ts +23 -73
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @egen-civitas/esm-embed-host
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3300bac: Toasts partagés : le Core est l'afficheur, l'app notifie en temps réel sans doublon. Politique d'opérateur dans le grant `notifications` (`exclusive`, défaut vrai ; `rate`, défaut 10 par 10 s), `id` de dédoublonnage, réponse `{ displayed }`, anti-spam `RATE_LIMITED`. Client : `egen.notify(toast, local?)` (point d'entrée unique, repli local si le Core n'affiche pas), `egen.coreDisplaysNotifications`, hook `useEgenNotify`. Hôte : le fournisseur peut répondre `false` (doublon). Testing : hôte de test, conformité et vérificateur couvrent le modèle.
|
|
8
|
+
- b2d283e: Retrait radical de l'ancienne couche d'assistance par agent. Elle était trop rigide et sera reconstruite sur une base saine, selon la nouvelle architecture documentée dans le dépôt Core (dossier de documentation de l'intégration de l'agent).
|
|
9
|
+
|
|
10
|
+
- **Packages supprimés** : les sept packages de l'ancienne couche (configuration, canal, contexte, événements, extensions, outils, façade). Le tag `pre-retrait-assistance-2026-11-25` conserve l'état précédent.
|
|
11
|
+
- `esm-framework` : ne ré-exporte plus la façade de l'ancienne couche. **Rupture** pour tout consommateur qui l'importait via `esm-framework`.
|
|
12
|
+
- `esm-styleguide` : le dossier `assistant/` est supprimé (orbe, robot 3D, scène Spline, saisie de prompt, fond d'érosion, modale « verre d'eau », audio), ainsi que les jetons CSS `--ui-*` dédiés à cette couche et les dépendances `three`, `@react-three/fiber`, `@splinetool/*`.
|
|
13
|
+
- `esm-app-shell` : le pont des variables d'environnement de l'ancienne couche vers `window` est supprimé (configuration, gabarit `index.ejs`, bootstrap natif). Le garde-fou des ponts ne porte plus que sur `EGEN_TENANT_*`.
|
|
14
|
+
- `rspack-config` : le préfixe de variable publique de l'ancienne couche est retiré de `PUBLIC_ENV_PREFIXES`.
|
|
15
|
+
- `esm-embed-*` : la capacité d'outils pilotés par un agent est retirée du catalogue du SDK embed (protocole, hôte, client, simulateur et vérificateur de test).
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [3300bac]
|
|
20
|
+
- Updated dependencies [b2d283e]
|
|
21
|
+
- @egen-civitas/esm-embed-protocol@0.4.0
|
|
22
|
+
|
|
23
|
+
## 0.3.0
|
|
24
|
+
|
|
25
|
+
### Minor Changes
|
|
26
|
+
|
|
27
|
+
- 36eb684: **Changement incompatible : le SDK est recentré sur ce dont le Core est lui-même la source.** Retrait des capacités `session`, `permissions`, `theme` et `api` (identité, droits, thème et appels API viennent de Keycloak, des backends et du service de thèmes ; le Core ne les relaie pas, ce qui supprime une classe entière de failles). Retrait de `pickFields`, des chemins d'API, de `createFetchApiProvider`, des hooks `useEgenSession`/`useEgenTheme`, et de la session dans le pont 1.1. Une demande de capacité retirée est rejetée avec la raison et la voie à suivre (`REMOVED_CAPABILITIES`).
|
|
28
|
+
|
|
29
|
+
Ajout de la capacité `extensions` (découverte des extensions d'un slot, grants `discover`/`contribute` par slot) et des contributions déclaratives `extensions[]` du manifeste (composants d'une app embarquée injectés dans les slots du Core), avec validation (`iconUrl` même origine, 4 Ko de meta) et `allowedContributions`. Hooks React `useEgenLocale`, `useEgenTenant`, `useEgenExtensions`.
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [36eb684]
|
|
34
|
+
- @egen-civitas/esm-embed-protocol@0.3.0
|
|
35
|
+
|
|
3
36
|
## 0.2.0
|
|
4
37
|
|
|
5
38
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -6,9 +6,9 @@ Spécification : `docs/integration-apps/17-sdk-embed-protocole-v2.md` du dépôt
|
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
import { effectiveGrants } from '@egen-civitas/esm-embed-protocol';
|
|
9
|
-
import { createEmbedHost
|
|
9
|
+
import { createEmbedHost } from '@egen-civitas/esm-embed-host';
|
|
10
10
|
|
|
11
|
-
const grants = effectiveGrants(manifest.capabilities, {
|
|
11
|
+
const grants = effectiveGrants(manifest.capabilities, { notifications: {}, events: { publish: ['app.studio.*'] } });
|
|
12
12
|
|
|
13
13
|
const host = createEmbedHost({
|
|
14
14
|
moduleName: manifest.name,
|
|
@@ -16,17 +16,16 @@ const host = createEmbedHost({
|
|
|
16
16
|
grants,
|
|
17
17
|
navigation: { route: manifest.route, mode: manifest.navigation.mode },
|
|
18
18
|
providers: {
|
|
19
|
-
|
|
20
|
-
theme: { get, subscribe },
|
|
19
|
+
locale: { get, subscribe }, // services dont le Core est la source
|
|
21
20
|
notifications: { show: (n, from) => toast(n) },
|
|
22
21
|
events: { publish: bus.publish, subscribe: bus.subscribe },
|
|
23
|
-
|
|
22
|
+
extensions: { list: (slot) => infos(slot), subscribe },
|
|
24
23
|
},
|
|
25
24
|
});
|
|
26
25
|
host.mount(container); // …; host.destroy() au démontage
|
|
27
26
|
```
|
|
28
27
|
|
|
29
28
|
- **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`).
|
|
30
|
-
- **
|
|
31
|
-
- **Pont 1.1** : une app qui ne parle pas le protocole 2 continue de fonctionner (`ready`, `location`, `navigate`, `resize`, `title
|
|
29
|
+
- **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.
|
|
30
|
+
- **Pont 1.1** : une app qui ne parle pas le protocole 2 continue de fonctionner (`ready`, `location`, `navigate`, `resize`, `title`, langue) — sans session. Désactivable : `legacy: false`.
|
|
32
31
|
- `HostConnection` est indépendante du DOM (testable avec le vrai client, voir `src/__tests__/harness.ts`).
|
package/dist/connection.d.ts
CHANGED
|
@@ -23,7 +23,6 @@ export declare class HostConnection {
|
|
|
23
23
|
state: ConnectionState;
|
|
24
24
|
private nonce?;
|
|
25
25
|
private rpc?;
|
|
26
|
-
private cleanup?;
|
|
27
26
|
constructor(o: ConnectionOptions);
|
|
28
27
|
/** Nouvelle poignée de main (à chaque chargement de l'iframe) : ferme toute connexion précédente. */
|
|
29
28
|
hello(): void;
|
package/dist/connection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,MAAM,EACZ,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAgD,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE7F,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,CAAC;AAExE,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,aAAa,CAAC;IACzB,QAAQ,EAAE,YAAY,CAAC;IACvB,gFAAgF;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AAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;;GAGG;AACH,qBAAa,cAAc;IAKb,OAAO,CAAC,QAAQ,CAAC,CAAC;IAJ9B,KAAK,EAAE,eAAe,CAAU;IAChC,OAAO,CAAC,KAAK,CAAC,CAAS;IACvB,OAAO,CAAC,GAAG,CAAC,CAAc;gBAEG,CAAC,EAAE,iBAAiB;IAEjD,qGAAqG;IACrG,KAAK,IAAI,IAAI;IAOb,sGAAsG;IACtG,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAe9B,OAAO,CAAC,IAAI;IAgCZ,oGAAoG;IAC9F,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,OAAO,EAAO,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAIrG,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,oFAAoF;IACpF,KAAK,IAAI,IAAI;IAOb,OAAO,IAAI,IAAI;CAIhB"}
|
package/dist/connection.js
CHANGED
|
@@ -196,7 +196,6 @@ import { availableCapabilities, createCapabilityTable } from './table.js';
|
|
|
196
196
|
_define_property(this, "state", void 0);
|
|
197
197
|
_define_property(this, "nonce", void 0);
|
|
198
198
|
_define_property(this, "rpc", void 0);
|
|
199
|
-
_define_property(this, "cleanup", void 0);
|
|
200
199
|
this.o = o;
|
|
201
200
|
this.state = 'idle';
|
|
202
201
|
}
|
|
@@ -282,14 +281,9 @@ import { availableCapabilities, createCapabilityTable } from './table.js';
|
|
|
282
281
|
moduleName: this.o.moduleName,
|
|
283
282
|
granted: granted,
|
|
284
283
|
providers: this.o.providers,
|
|
285
|
-
controls: this.o.controls
|
|
286
|
-
|
|
287
|
-
if (!_this.rpc) return Promise.reject(new Error('non connecté'));
|
|
288
|
-
return _this.rpc.call(cap, method, args);
|
|
289
|
-
}
|
|
290
|
-
}), table = _createCapabilityTable.table, subscribe = _createCapabilityTable.subscribe, cleanup = _createCapabilityTable.cleanup;
|
|
284
|
+
controls: this.o.controls
|
|
285
|
+
}), table = _createCapabilityTable.table, subscribe = _createCapabilityTable.subscribe;
|
|
291
286
|
var _ref = new MessageChannel(), port1 = _ref.port1, port2 = _ref.port2;
|
|
292
|
-
this.cleanup = cleanup;
|
|
293
287
|
this.rpc = new RpcEndpoint({
|
|
294
288
|
port: port1,
|
|
295
289
|
handlers: table,
|
|
@@ -299,9 +293,7 @@ import { availableCapabilities, createCapabilityTable } from './table.js';
|
|
|
299
293
|
},
|
|
300
294
|
limits: this.o.limits,
|
|
301
295
|
onClose: function onClose(reason) {
|
|
302
|
-
var
|
|
303
|
-
(_this_cleanup = (_this1 = _this).cleanup) === null || _this_cleanup === void 0 ? void 0 : _this_cleanup.call(_this1);
|
|
304
|
-
_this.cleanup = undefined;
|
|
296
|
+
var _this_o_onClose, _this_o;
|
|
305
297
|
if (_this.state !== 'closed') _this.state = 'idle';
|
|
306
298
|
(_this_o_onClose = (_this_o = _this.o).onClose) === null || _this_o_onClose === void 0 ? void 0 : _this_o_onClose.call(_this_o, reason);
|
|
307
299
|
}
|
|
@@ -345,11 +337,9 @@ import { availableCapabilities, createCapabilityTable } from './table.js';
|
|
|
345
337
|
{
|
|
346
338
|
/** Ferme la connexion courante (rechargement de l'iframe) sans détruire l'objet. */ key: "reset",
|
|
347
339
|
value: function reset() {
|
|
348
|
-
var _this_rpc
|
|
340
|
+
var _this_rpc;
|
|
349
341
|
(_this_rpc = this.rpc) === null || _this_rpc === void 0 ? void 0 : _this_rpc.close();
|
|
350
342
|
this.rpc = undefined;
|
|
351
|
-
(_this_cleanup = (_this = this).cleanup) === null || _this_cleanup === void 0 ? void 0 : _this_cleanup.call(_this);
|
|
352
|
-
this.cleanup = undefined;
|
|
353
343
|
this.nonce = undefined;
|
|
354
344
|
if (this.state !== 'closed') this.state = 'idle';
|
|
355
345
|
}
|
package/dist/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,KAAK,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAEpI,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAwH,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC/K,OAAO,KAAK,EAAE,aAAa,EAAS,MAAM,gBAAgB,CAAC;AAG3D,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,iEAAiE;IACjE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,aAAa,CAAC;IACzB,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kGAAkG;IAClG,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,iFAAiF;IACjF,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,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;AAID;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,SAAS,CAgLjE"}
|
package/dist/host.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
function _array_like_to_array(arr, len) {
|
|
2
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
-
return arr2;
|
|
5
|
-
}
|
|
6
|
-
function _array_without_holes(arr) {
|
|
7
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
|
-
}
|
|
9
1
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
10
2
|
try {
|
|
11
3
|
var info = gen[key](arg);
|
|
@@ -48,12 +40,6 @@ function _define_property(obj, key, value) {
|
|
|
48
40
|
}
|
|
49
41
|
return obj;
|
|
50
42
|
}
|
|
51
|
-
function _iterable_to_array(iter) {
|
|
52
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
53
|
-
}
|
|
54
|
-
function _non_iterable_spread() {
|
|
55
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
56
|
-
}
|
|
57
43
|
function _object_spread(target) {
|
|
58
44
|
for(var i = 1; i < arguments.length; i++){
|
|
59
45
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -93,17 +79,6 @@ function _object_spread_props(target, source) {
|
|
|
93
79
|
}
|
|
94
80
|
return target;
|
|
95
81
|
}
|
|
96
|
-
function _to_consumable_array(arr) {
|
|
97
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
98
|
-
}
|
|
99
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
100
|
-
if (!o) return;
|
|
101
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
102
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
103
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
104
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
105
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
106
|
-
}
|
|
107
82
|
function _ts_generator(thisArg, body) {
|
|
108
83
|
var f, y, t, _ = {
|
|
109
84
|
label: 0,
|
|
@@ -203,7 +178,6 @@ function _ts_generator(thisArg, body) {
|
|
|
203
178
|
};
|
|
204
179
|
}
|
|
205
180
|
}
|
|
206
|
-
import { DEFAULT_SESSION_FIELDS, pickFields } from '@egen-civitas/esm-embed-protocol';
|
|
207
181
|
import { createBus } from './bus.js';
|
|
208
182
|
import { HostConnection } from './connection.js';
|
|
209
183
|
import { buildCoreUrl, buildEmbedSrc, coreSubpath, createRateLimiter, stripSensitive, toAppPath, toCorePath, normalizeAppPath } from './navigation.js';
|
|
@@ -305,14 +279,12 @@ var DEFAULT_SANDBOX = 'allow-scripts allow-same-origin allow-forms allow-popups'
|
|
|
305
279
|
onConnect: opts.onConnect,
|
|
306
280
|
onClose: opts.onClose
|
|
307
281
|
});
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
};
|
|
313
|
-
/** Pont 1.1 : mêmes services, ancien format. Inactif dès qu'une connexion v2 est ouverte. */ var handleLegacy = function handleLegacy(data) {
|
|
282
|
+
/**
|
|
283
|
+
* Pont 1.1 : compatibilité des apps qui ne parlent pas encore le protocole 2. La session n'est PLUS transmise (règle d'or,
|
|
284
|
+
* doc 17 §2) : une app obtient son identité auprès de Keycloak. Seuls restent la langue, la navigation, le titre et la hauteur.
|
|
285
|
+
*/ var handleLegacy = function handleLegacy(data) {
|
|
314
286
|
return _async_to_generator(function() {
|
|
315
|
-
var msg, _, _win_i18next,
|
|
287
|
+
var msg, _, _win_i18next, locale, _tmp, _controls_navigate, _controls_resize;
|
|
316
288
|
return _ts_generator(this, function(_state) {
|
|
317
289
|
switch(_state.label){
|
|
318
290
|
case 0:
|
|
@@ -333,79 +305,56 @@ var DEFAULT_SANDBOX = 'allow-scripts allow-same-origin allow-forms allow-popups'
|
|
|
333
305
|
case 'navigate':
|
|
334
306
|
return [
|
|
335
307
|
3,
|
|
336
|
-
|
|
308
|
+
5
|
|
337
309
|
];
|
|
338
310
|
case 'resize':
|
|
339
311
|
return [
|
|
340
312
|
3,
|
|
341
|
-
|
|
313
|
+
6
|
|
342
314
|
];
|
|
343
315
|
case 'title':
|
|
344
316
|
return [
|
|
345
317
|
3,
|
|
346
|
-
|
|
318
|
+
7
|
|
347
319
|
];
|
|
348
320
|
case 'location':
|
|
349
321
|
return [
|
|
350
322
|
3,
|
|
351
|
-
|
|
323
|
+
8
|
|
352
324
|
];
|
|
353
325
|
}
|
|
354
326
|
return [
|
|
355
327
|
3,
|
|
356
|
-
|
|
328
|
+
9
|
|
357
329
|
];
|
|
358
330
|
case 1:
|
|
359
331
|
legacySeen = true;
|
|
360
332
|
legacyReady = true;
|
|
361
|
-
if (!opts.providers.
|
|
333
|
+
if (!opts.providers.locale) return [
|
|
362
334
|
3,
|
|
363
335
|
3
|
|
364
336
|
];
|
|
365
337
|
return [
|
|
366
338
|
4,
|
|
367
|
-
opts.providers.
|
|
339
|
+
opts.providers.locale.get()
|
|
368
340
|
];
|
|
369
341
|
case 2:
|
|
370
|
-
_tmp =
|
|
371
|
-
_state.sent(),
|
|
372
|
-
sessionFields()
|
|
373
|
-
]);
|
|
342
|
+
_tmp = _state.sent();
|
|
374
343
|
return [
|
|
375
344
|
3,
|
|
376
345
|
4
|
|
377
346
|
];
|
|
378
347
|
case 3:
|
|
379
|
-
_tmp =
|
|
348
|
+
_tmp = (_win_i18next = win.i18next) === null || _win_i18next === void 0 ? void 0 : _win_i18next.language;
|
|
380
349
|
_state.label = 4;
|
|
381
350
|
case 4:
|
|
382
|
-
|
|
383
|
-
if (!opts.providers.locale) return [
|
|
384
|
-
3,
|
|
385
|
-
6
|
|
386
|
-
];
|
|
387
|
-
return [
|
|
388
|
-
4,
|
|
389
|
-
opts.providers.locale.get()
|
|
390
|
-
];
|
|
391
|
-
case 5:
|
|
392
|
-
_tmp1 = _state.sent();
|
|
393
|
-
return [
|
|
394
|
-
3,
|
|
395
|
-
7
|
|
396
|
-
];
|
|
397
|
-
case 6:
|
|
398
|
-
_tmp1 = (_win_i18next = win.i18next) === null || _win_i18next === void 0 ? void 0 : _win_i18next.language;
|
|
399
|
-
_state.label = 7;
|
|
400
|
-
case 7:
|
|
401
|
-
locale = _tmp1;
|
|
351
|
+
locale = _tmp;
|
|
402
352
|
legacySend({
|
|
403
353
|
kind: 'init',
|
|
404
354
|
payload: {
|
|
405
355
|
moduleName: opts.moduleName,
|
|
406
356
|
locale: locale,
|
|
407
357
|
spaBase: spaBase(),
|
|
408
|
-
session: session,
|
|
409
358
|
navigation: nav ? {
|
|
410
359
|
mode: nav.mode,
|
|
411
360
|
route: nav.route
|
|
@@ -414,27 +363,27 @@ var DEFAULT_SANDBOX = 'allow-scripts allow-same-origin allow-forms allow-popups'
|
|
|
414
363
|
});
|
|
415
364
|
return [
|
|
416
365
|
3,
|
|
417
|
-
|
|
366
|
+
9
|
|
418
367
|
];
|
|
419
|
-
case
|
|
368
|
+
case 5:
|
|
420
369
|
(_controls_navigate = controls.navigate) === null || _controls_navigate === void 0 ? void 0 : _controls_navigate.call(controls, msg.to);
|
|
421
370
|
return [
|
|
422
371
|
3,
|
|
423
|
-
|
|
372
|
+
9
|
|
424
373
|
];
|
|
425
|
-
case
|
|
374
|
+
case 6:
|
|
426
375
|
(_controls_resize = controls.resize) === null || _controls_resize === void 0 ? void 0 : _controls_resize.call(controls, msg.height);
|
|
427
376
|
return [
|
|
428
377
|
3,
|
|
429
|
-
|
|
378
|
+
9
|
|
430
379
|
];
|
|
431
|
-
case
|
|
380
|
+
case 7:
|
|
432
381
|
if (typeof msg.title === 'string') iframe.title = msg.title.slice(0, 200);
|
|
433
382
|
return [
|
|
434
383
|
3,
|
|
435
|
-
|
|
384
|
+
9
|
|
436
385
|
];
|
|
437
|
-
case
|
|
386
|
+
case 8:
|
|
438
387
|
legacySeen = true;
|
|
439
388
|
reportLocation(msg.path, {
|
|
440
389
|
replace: !!msg.replace,
|
|
@@ -442,9 +391,9 @@ var DEFAULT_SANDBOX = 'allow-scripts allow-same-origin allow-forms allow-popups'
|
|
|
442
391
|
});
|
|
443
392
|
return [
|
|
444
393
|
3,
|
|
445
|
-
|
|
394
|
+
9
|
|
446
395
|
];
|
|
447
|
-
case
|
|
396
|
+
case 9:
|
|
448
397
|
return [
|
|
449
398
|
2
|
|
450
399
|
];
|
|
@@ -460,7 +409,7 @@ var DEFAULT_SANDBOX = 'allow-scripts allow-same-origin allow-forms allow-popups'
|
|
|
460
409
|
iframe: iframe,
|
|
461
410
|
connection: connection,
|
|
462
411
|
mount: function mount(container) {
|
|
463
|
-
var
|
|
412
|
+
var _p_locale;
|
|
464
413
|
win.addEventListener('message', onMessage);
|
|
465
414
|
stop.push(function() {
|
|
466
415
|
return win.removeEventListener('message', onMessage);
|
|
@@ -514,14 +463,8 @@ var DEFAULT_SANDBOX = 'allow-scripts allow-same-origin allow-forms allow-popups'
|
|
|
514
463
|
win.removeEventListener('focus', onFocus);
|
|
515
464
|
win.removeEventListener('blur', onBlur);
|
|
516
465
|
});
|
|
517
|
-
// Pont 1.1 :
|
|
466
|
+
// Pont 1.1 : la langue est poussée après `ready`.
|
|
518
467
|
var p = opts.providers;
|
|
519
|
-
if ((_p_session = p.session) === null || _p_session === void 0 ? void 0 : _p_session.subscribe) stop.push(p.session.subscribe(function(s) {
|
|
520
|
-
return legacyReady && !connection.connected && legacySend({
|
|
521
|
-
kind: 'session',
|
|
522
|
-
session: pickFields(s, sessionFields())
|
|
523
|
-
});
|
|
524
|
-
}));
|
|
525
468
|
if ((_p_locale = p.locale) === null || _p_locale === void 0 ? void 0 : _p_locale.subscribe) stop.push(p.locale.subscribe(function(l) {
|
|
526
469
|
return legacyReady && !connection.connected && l && legacySend({
|
|
527
470
|
kind: 'locale',
|
package/dist/providers.d.ts
CHANGED
|
@@ -8,59 +8,44 @@ export interface CallerContext {
|
|
|
8
8
|
/** Nom du module de l'app appelante (non falsifiable : porté par la connexion, pas par le message). */
|
|
9
9
|
moduleName: string;
|
|
10
10
|
}
|
|
11
|
-
export interface ThemeState {
|
|
12
|
-
mode?: string;
|
|
13
|
-
tokens: Record<string, string>;
|
|
14
|
-
}
|
|
15
11
|
export interface NotificationInput {
|
|
12
|
+
/** Clé de dédoublonnage facultative : un même `id` ne produit pas deux toasts rapprochés. */
|
|
13
|
+
id?: string;
|
|
16
14
|
kind: 'info' | 'success' | 'warning' | 'error';
|
|
17
15
|
title: string;
|
|
18
16
|
subtitle?: string;
|
|
19
17
|
timeoutMs?: number;
|
|
20
18
|
}
|
|
21
|
-
export interface
|
|
22
|
-
path?: string;
|
|
23
|
-
url?: string;
|
|
24
|
-
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
25
|
-
headers?: Record<string, string>;
|
|
26
|
-
body?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface ApiResponse {
|
|
29
|
-
status: number;
|
|
30
|
-
headers: Record<string, string>;
|
|
31
|
-
body: string;
|
|
32
|
-
}
|
|
33
|
-
export interface AiToolDescriptor {
|
|
19
|
+
export interface ExtensionInfo {
|
|
34
20
|
name: string;
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
moduleName: string;
|
|
22
|
+
order?: number;
|
|
23
|
+
meta: Record<string, unknown>;
|
|
37
24
|
}
|
|
38
25
|
/**
|
|
39
26
|
* Services du Core mis à disposition des apps embarquées. Toute capacité sans fournisseur est
|
|
40
27
|
* automatiquement refusée à la négociation (`UNAVAILABLE`) : on ne promet que ce qu'on sait servir.
|
|
28
|
+
*
|
|
29
|
+
* Règle d'or (doc 17 §2) : seulement ce dont le Core est lui-même la source. Pas d'identité/session, de droits, de thème ni d'appels
|
|
30
|
+
* API relayés : l'app les obtient directement auprès de leurs sources (Keycloak, backends, service de thèmes).
|
|
41
31
|
*/
|
|
42
32
|
export interface HostProviders {
|
|
43
|
-
session?: Watchable<Record<string, unknown> | undefined>;
|
|
44
33
|
tenant?: Watchable<{
|
|
45
34
|
id: string | null;
|
|
46
35
|
}>;
|
|
47
36
|
locale?: Watchable<string>;
|
|
48
|
-
theme?: Watchable<ThemeState>;
|
|
49
37
|
config?: Watchable<Record<string, unknown>>;
|
|
50
38
|
flags?: {
|
|
51
39
|
isEnabled(name: string): boolean | Promise<boolean>;
|
|
52
40
|
subscribe?(cb: () => void): Unsub;
|
|
53
41
|
};
|
|
54
|
-
permissions?: {
|
|
55
|
-
can(permission: string): boolean | Promise<boolean>;
|
|
56
|
-
subscribe?(cb: () => void): Unsub;
|
|
57
|
-
};
|
|
58
42
|
events?: {
|
|
59
43
|
publish(topic: string, payload: unknown, ctx: CallerContext): void;
|
|
60
44
|
subscribe(topic: string, cb: (payload: unknown) => void): Unsub;
|
|
61
45
|
};
|
|
46
|
+
/** Affiche le toast dans l'interface du Core ; retourne `false` si non affiché (doublon, etc.). Le Core attribue le toast à son app d'origine. */
|
|
62
47
|
notifications?: {
|
|
63
|
-
show(n: NotificationInput, ctx: CallerContext): void | Promise<void>;
|
|
48
|
+
show(n: NotificationInput, ctx: CallerContext): void | boolean | Promise<void | boolean>;
|
|
64
49
|
};
|
|
65
50
|
dialogs?: {
|
|
66
51
|
confirm(d: {
|
|
@@ -69,33 +54,14 @@ export interface HostProviders {
|
|
|
69
54
|
danger?: boolean;
|
|
70
55
|
}, ctx: CallerContext): boolean | Promise<boolean>;
|
|
71
56
|
};
|
|
72
|
-
|
|
73
|
-
|
|
57
|
+
/** Extensions attachées à un slot du Core (apps internes, framework, autres apps) : métadonnées seulement, jamais le rendu. */
|
|
58
|
+
extensions?: {
|
|
59
|
+
list(slot: string): ExtensionInfo[] | Promise<ExtensionInfo[]>;
|
|
60
|
+
subscribe?(slot: string, cb: (list: ExtensionInfo[]) => void): Unsub;
|
|
74
61
|
};
|
|
75
62
|
telemetry?: {
|
|
76
63
|
log(level: 'debug' | 'info' | 'warn' | 'error', message: string, ctx: Record<string, unknown> | undefined, from: CallerContext): void;
|
|
77
64
|
metric(name: string, value: number, tags: Record<string, unknown> | undefined, from: CallerContext): void;
|
|
78
65
|
};
|
|
79
|
-
aiTools?: {
|
|
80
|
-
register(moduleName: string, tools: AiToolDescriptor[], invoke: (name: string, args: Record<string, unknown>) => Promise<unknown>): void;
|
|
81
|
-
unregister(moduleName: string, names: string[]): void;
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
export interface FetchProviderOptions {
|
|
85
|
-
/** Base de l'API du Core (ex. `https://api.exemple.org/v1`) : résolution des `path`. */
|
|
86
|
-
baseUrl: string;
|
|
87
|
-
/** En-têtes d'authentification/tenant ajoutés aux appels `path` UNIQUEMENT (jamais aux `url` externes). */
|
|
88
|
-
getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;
|
|
89
|
-
fetchImpl?: typeof fetch;
|
|
90
|
-
timeoutMs?: number;
|
|
91
|
-
/** Taille maximale du corps de réponse (octets approximatifs). Défaut 200 000. */
|
|
92
|
-
maxResponseBytes?: number;
|
|
93
|
-
/** En-têtes de réponse exposés à l'app. Défaut : content-type, etag, cache-control, content-language. */
|
|
94
|
-
exposeResponseHeaders?: string[];
|
|
95
66
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Fournisseur `api.fetch` : la requête s'exécute côté Core. Le jeton ne quitte jamais le Core ;
|
|
98
|
-
* `path` → API du Core (cookies + en-têtes d'auth) ; `url` → hôte externe autorisé par le grant, sans cookies ni auth, sans redirection.
|
|
99
|
-
*/
|
|
100
|
-
export declare function createFetchApiProvider(o: FetchProviderOptions): NonNullable<HostProviders['api']>;
|
|
101
67
|
//# sourceMappingURL=providers.d.ts.map
|
package/dist/providers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC;AAE/B,wDAAwD;AACxD,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACtB,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC;CAC3C;AAED,MAAM,WAAW,aAAa;IAC5B,uGAAuG;IACvG,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,6FAA6F;IAC7F,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,I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