@egen-civitas/esm-embed-testing 0.8.0 → 0.9.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 +6 -0
- package/dist/test-host.d.ts +11 -1
- package/dist/test-host.d.ts.map +1 -1
- package/dist/test-host.js +5 -0
- package/package.json +1 -1
- package/src/test-host.ts +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @egen-civitas/esm-embed-testing
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 94ab5bd: B12 — `createTestShell` (sous-chemin `@egen-civitas/sdk/testing`) : Shell simulé pour tester une app EGEN dans le mode `embedded` (vrai `HostConnection` en mémoire) ou `standalone`, sans navigateur ni Core. Expose `app`, `calls`, `notifications`, `published`, `provide`, `emit.*`, `hostDown`, `advance`, `destroy` ; valide le manifeste comme le Shell. `createTestHost` gagne l'option `providers`, `providers` (fournisseurs vivants) et `hostDown()`. `@egen-civitas/esm-embed-testing` devient pair facultatif du SDK.
|
|
8
|
+
|
|
3
9
|
## 0.8.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/test-host.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ApprovedGrants, type CapabilityId, type EffectiveIframeRights, type GrantConfig, type IframeRights } from '@egen-civitas/esm-embed-protocol';
|
|
2
2
|
import type { ConnectOptions } from '@egen-civitas/esm-embed-client';
|
|
3
|
-
import { HostConnection, type ExtensionInfo } from '@egen-civitas/esm-embed-host';
|
|
3
|
+
import { HostConnection, type ExtensionInfo, type HostProviders } from '@egen-civitas/esm-embed-host';
|
|
4
4
|
export interface TestHostOptions {
|
|
5
5
|
moduleName?: string;
|
|
6
6
|
/** Origine simulée du Shell (à mettre dans `hostOrigins` de l'app). */
|
|
@@ -24,6 +24,12 @@ export interface TestHostOptions {
|
|
|
24
24
|
message: string;
|
|
25
25
|
danger?: boolean;
|
|
26
26
|
}) => boolean);
|
|
27
|
+
/**
|
|
28
|
+
* Fournisseurs du Shell qui remplacent ceux du simulateur (par capacité), y compris les facultatifs que le simulateur ne sert pas
|
|
29
|
+
* (`environment`, `locale.set`, `dialogs.alert`, `routeExists`, `intents`…). Les facultatifs doivent être fournis AVANT la connexion :
|
|
30
|
+
* la table des capacités est construite à la poignée de main.
|
|
31
|
+
*/
|
|
32
|
+
providers?: Partial<HostProviders>;
|
|
27
33
|
}
|
|
28
34
|
export interface CallRecord {
|
|
29
35
|
cap: string;
|
|
@@ -34,6 +40,8 @@ export interface TestHost {
|
|
|
34
40
|
/** À passer à `connectToEgen({ ...host.connectOptions, capabilities: [...] })`. */
|
|
35
41
|
connectOptions: Pick<ConnectOptions, 'moduleName' | 'hostOrigins' | 'window' | 'host' | 'timeoutMs'>;
|
|
36
42
|
connection: HostConnection;
|
|
43
|
+
/** Fournisseurs vivants du Shell : `Object.assign(host.providers, …)` remplace le comportement d'une capacité déjà servie, à chaud. */
|
|
44
|
+
providers: HostProviders;
|
|
37
45
|
/** Droits d'iframe que le Core appliquerait (`demande ∩ plafond`) : de quoi vérifier ce que l'app obtient réellement. */
|
|
38
46
|
iframe: EffectiveIframeRights;
|
|
39
47
|
/** Journal des services du Core sollicités par l'app. */
|
|
@@ -61,6 +69,8 @@ export interface TestHost {
|
|
|
61
69
|
goto(path: string): void;
|
|
62
70
|
visibility(visible: boolean): void;
|
|
63
71
|
};
|
|
72
|
+
/** Coupe la liaison côté Shell (comme un Shell qui disparaît) : les appels suivants de l'app sont rejetés. */
|
|
73
|
+
hostDown(): void;
|
|
64
74
|
destroy(): void;
|
|
65
75
|
}
|
|
66
76
|
/**
|
package/dist/test-host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-host.d.ts","sourceRoot":"","sources":["../src/test-host.ts"],"names":[],"mappings":"AAAA,OAAO,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AI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;QACtD,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;QACzC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;QAC9C,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;KACpC,CAAC;IACF,8GAA8G;IAC9G,QAAQ,IAAI,IAAI,CAAC;IACjB,OAAO,IAAI,IAAI,CAAC;CACjB;AAeD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC,GAAE,eAAoB,GAAG,QAAQ,CAmIhE"}
|
package/dist/test-host.js
CHANGED
|
@@ -142,6 +142,7 @@ function watchable(initial) {
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
};
|
|
145
|
+
if (o.providers) Object.assign(providers, o.providers);
|
|
145
146
|
var appWindow = new EventTarget();
|
|
146
147
|
var hostWindow = {
|
|
147
148
|
postMessage: function postMessage(message) {
|
|
@@ -200,6 +201,7 @@ function watchable(initial) {
|
|
|
200
201
|
timeoutMs: 500
|
|
201
202
|
},
|
|
202
203
|
connection: connection,
|
|
204
|
+
providers: providers,
|
|
203
205
|
iframe: effectiveIframe(o.manifestIframe, (_o_approved1 = o.approved) === null || _o_approved1 === void 0 ? void 0 : _o_approved1.iframe),
|
|
204
206
|
calls: calls,
|
|
205
207
|
notifications: notifications,
|
|
@@ -237,6 +239,9 @@ function watchable(initial) {
|
|
|
237
239
|
return channel.emit('visibility', v);
|
|
238
240
|
}
|
|
239
241
|
},
|
|
242
|
+
hostDown: function hostDown() {
|
|
243
|
+
return connection.reset();
|
|
244
|
+
},
|
|
240
245
|
destroy: function destroy() {
|
|
241
246
|
return connection.destroy();
|
|
242
247
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egen-civitas/esm-embed-testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Développer et tester une app embarquée sans le Core : hôte de test en mémoire, suite de conformité du protocole v2, simulateur de Shell (egen-embed-sim).",
|
|
6
6
|
"type": "module",
|
package/src/test-host.ts
CHANGED
|
@@ -19,6 +19,12 @@ export interface TestHostOptions {
|
|
|
19
19
|
/** Extensions attachées à chaque slot (`{ 'topbar-nav-slot': [...] }`). */
|
|
20
20
|
extensions?: Record<string, ExtensionInfo[]>;
|
|
21
21
|
confirm?: boolean | ((d: { title: string; message: string; danger?: boolean }) => boolean);
|
|
22
|
+
/**
|
|
23
|
+
* Fournisseurs du Shell qui remplacent ceux du simulateur (par capacité), y compris les facultatifs que le simulateur ne sert pas
|
|
24
|
+
* (`environment`, `locale.set`, `dialogs.alert`, `routeExists`, `intents`…). Les facultatifs doivent être fournis AVANT la connexion :
|
|
25
|
+
* la table des capacités est construite à la poignée de main.
|
|
26
|
+
*/
|
|
27
|
+
providers?: Partial<HostProviders>;
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
export interface CallRecord {
|
|
@@ -31,6 +37,8 @@ export interface TestHost {
|
|
|
31
37
|
/** À passer à `connectToEgen({ ...host.connectOptions, capabilities: [...] })`. */
|
|
32
38
|
connectOptions: Pick<ConnectOptions, 'moduleName' | 'hostOrigins' | 'window' | 'host' | 'timeoutMs'>;
|
|
33
39
|
connection: HostConnection;
|
|
40
|
+
/** Fournisseurs vivants du Shell : `Object.assign(host.providers, …)` remplace le comportement d'une capacité déjà servie, à chaud. */
|
|
41
|
+
providers: HostProviders;
|
|
34
42
|
/** Droits d'iframe que le Core appliquerait (`demande ∩ plafond`) : de quoi vérifier ce que l'app obtient réellement. */
|
|
35
43
|
iframe: EffectiveIframeRights;
|
|
36
44
|
/** Journal des services du Core sollicités par l'app. */
|
|
@@ -47,6 +55,8 @@ export interface TestHost {
|
|
|
47
55
|
goto(path: string): void;
|
|
48
56
|
visibility(visible: boolean): void;
|
|
49
57
|
};
|
|
58
|
+
/** Coupe la liaison côté Shell (comme un Shell qui disparaît) : les appels suivants de l'app sont rejetés. */
|
|
59
|
+
hostDown(): void;
|
|
50
60
|
destroy(): void;
|
|
51
61
|
}
|
|
52
62
|
|
|
@@ -150,6 +160,8 @@ export function createTestHost(o: TestHostOptions = {}): TestHost {
|
|
|
150
160
|
telemetry: { log: (l, m, c) => log('telemetry', 'log', l, m, c), metric: (n, v, t) => log('telemetry', 'metric', n, v, t) },
|
|
151
161
|
};
|
|
152
162
|
|
|
163
|
+
if (o.providers) Object.assign(providers, o.providers);
|
|
164
|
+
|
|
153
165
|
const appWindow = new EventTarget();
|
|
154
166
|
const hostWindow: { postMessage(message: unknown, targetOrigin: string): void } = {
|
|
155
167
|
postMessage: (message) => void queueMicrotask(() => connection.handle(message)),
|
|
@@ -181,6 +193,7 @@ export function createTestHost(o: TestHostOptions = {}): TestHost {
|
|
|
181
193
|
return {
|
|
182
194
|
connectOptions: { moduleName, hostOrigins: [origin], window: appWindow as any, host: hostWindow as any, timeoutMs: 500 },
|
|
183
195
|
connection,
|
|
196
|
+
providers,
|
|
184
197
|
iframe: effectiveIframe(o.manifestIframe, o.approved?.iframe),
|
|
185
198
|
calls,
|
|
186
199
|
notifications,
|
|
@@ -197,6 +210,7 @@ export function createTestHost(o: TestHostOptions = {}): TestHost {
|
|
|
197
210
|
goto: (path) => channel.emit('goto', { path, seq: Date.now() }),
|
|
198
211
|
visibility: (v) => channel.emit('visibility', v),
|
|
199
212
|
},
|
|
213
|
+
hostDown: () => connection.reset(),
|
|
200
214
|
destroy: () => connection.destroy(),
|
|
201
215
|
};
|
|
202
216
|
}
|