@egen-civitas/esm-embed-testing 0.9.0 → 0.10.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 CHANGED
@@ -1,11 +1,30 @@
1
1
  # @egen-civitas/esm-embed-testing
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 772b92a: Intents (lot C4) — briques communes. `esm-embed-protocol` : `expandIntentPath(gabarit, params)` remplace les paramètres `:nom` du chemin d'un intent (`provides[].path`) par des valeurs encodées ; paramètre manquant ou de type refusé ⇒ échec explicite, aucune valeur ne sort de son segment. `esm-embed-testing` : option `intents` de `createTestHost` (`navigation.intent` servie, `NOT_FOUND` si inconnu). `sdk` : `createTestShell` sert par défaut les intents déclarés dans `provides` du manifeste (sous `/<route>`), ou une table fournie, ou `intents: false`.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [772b92a]
12
+ - @egen-civitas/esm-embed-protocol@0.13.0
13
+ - @egen-civitas/esm-embed-client@0.13.1
14
+ - @egen-civitas/esm-embed-host@0.12.2
15
+
3
16
  ## 0.9.0
4
17
 
5
18
  ### Minor Changes
6
19
 
7
20
  - 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
21
 
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [6e10d7e]
25
+ - Updated dependencies [1e5122b]
26
+ - @egen-civitas/esm-embed-host@0.12.1
27
+
9
28
  ## 0.8.0
10
29
 
11
30
  ### Minor Changes
@@ -30,6 +30,11 @@ export interface TestHostOptions {
30
30
  * la table des capacités est construite à la poignée de main.
31
31
  */
32
32
  providers?: Partial<HostProviders>;
33
+ /**
34
+ * Table d'intents du Shell simulé : `objet-action` → chemin du Shell, ou `null` (intent inconnu : `NOT_FOUND`).
35
+ * Absente : `navigation.intent` n'est pas servie (`UNKNOWN_METHOD`), comme sur un Shell sans table d'intents.
36
+ */
37
+ intents?: (slug: string, params: Record<string, unknown>) => string | null | Promise<string | null>;
33
38
  }
34
39
  export interface CallRecord {
35
40
  cap: string;
@@ -1 +1 @@
1
- {"version":3,"file":"test-host.d.ts","sourceRoot":"","sources":["../src/test-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,qBAAqB,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC7L,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAa,cAAc,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAEjH,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oHAAoH;IACpH,oBAAoB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;IAClE,2EAA2E;IAC3E,cAAc,CAAC,EAAE,YAAY,CAAC;IAC9B,sIAAsI;IACtI,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,MAAM,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,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C;IAC9B,yDAAyD;IACzD,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,aAAa,EAAE,KAAK,CAAC;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtF,SAAS,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpE,iEAAiE;IACjE,IAAI,EAAE;QACJ,MAAM,CAAC,CAAC,EAAE;YAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,GAAG,IAAI,CAAC;QACvC,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,UAAU,CAAC,IAAI,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,CA8IhE"}
package/dist/test-host.js CHANGED
@@ -1,4 +1,184 @@
1
- import { effectiveGrants, effectiveIframe } from '@egen-civitas/esm-embed-protocol';
1
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
+ try {
3
+ var info = gen[key](arg);
4
+ var value = info.value;
5
+ } catch (error) {
6
+ reject(error);
7
+ return;
8
+ }
9
+ if (info.done) {
10
+ resolve(value);
11
+ } else {
12
+ Promise.resolve(value).then(_next, _throw);
13
+ }
14
+ }
15
+ function _async_to_generator(fn) {
16
+ return function() {
17
+ var self = this, args = arguments;
18
+ return new Promise(function(resolve, reject) {
19
+ var gen = fn.apply(self, args);
20
+ function _next(value) {
21
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
+ }
23
+ function _throw(err) {
24
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
+ }
26
+ _next(undefined);
27
+ });
28
+ };
29
+ }
30
+ function _define_property(obj, key, value) {
31
+ if (key in obj) {
32
+ Object.defineProperty(obj, key, {
33
+ value: value,
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true
37
+ });
38
+ } else {
39
+ obj[key] = value;
40
+ }
41
+ return obj;
42
+ }
43
+ function _object_spread(target) {
44
+ for(var i = 1; i < arguments.length; i++){
45
+ var source = arguments[i] != null ? arguments[i] : {};
46
+ var ownKeys = Object.keys(source);
47
+ if (typeof Object.getOwnPropertySymbols === "function") {
48
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
49
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
50
+ }));
51
+ }
52
+ ownKeys.forEach(function(key) {
53
+ _define_property(target, key, source[key]);
54
+ });
55
+ }
56
+ return target;
57
+ }
58
+ function ownKeys(object, enumerableOnly) {
59
+ var keys = Object.keys(object);
60
+ if (Object.getOwnPropertySymbols) {
61
+ var symbols = Object.getOwnPropertySymbols(object);
62
+ if (enumerableOnly) {
63
+ symbols = symbols.filter(function(sym) {
64
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
65
+ });
66
+ }
67
+ keys.push.apply(keys, symbols);
68
+ }
69
+ return keys;
70
+ }
71
+ function _object_spread_props(target, source) {
72
+ source = source != null ? source : {};
73
+ if (Object.getOwnPropertyDescriptors) {
74
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
75
+ } else {
76
+ ownKeys(Object(source)).forEach(function(key) {
77
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
78
+ });
79
+ }
80
+ return target;
81
+ }
82
+ function _ts_generator(thisArg, body) {
83
+ var f, y, t, _ = {
84
+ label: 0,
85
+ sent: function() {
86
+ if (t[0] & 1) throw t[1];
87
+ return t[1];
88
+ },
89
+ trys: [],
90
+ ops: []
91
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
92
+ return d(g, "next", {
93
+ value: verb(0)
94
+ }), d(g, "throw", {
95
+ value: verb(1)
96
+ }), d(g, "return", {
97
+ value: verb(2)
98
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
99
+ value: function() {
100
+ return this;
101
+ }
102
+ }), g;
103
+ function verb(n) {
104
+ return function(v) {
105
+ return step([
106
+ n,
107
+ v
108
+ ]);
109
+ };
110
+ }
111
+ function step(op) {
112
+ if (f) throw new TypeError("Generator is already executing.");
113
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
114
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
115
+ if (y = 0, t) op = [
116
+ op[0] & 2,
117
+ t.value
118
+ ];
119
+ switch(op[0]){
120
+ case 0:
121
+ case 1:
122
+ t = op;
123
+ break;
124
+ case 4:
125
+ _.label++;
126
+ return {
127
+ value: op[1],
128
+ done: false
129
+ };
130
+ case 5:
131
+ _.label++;
132
+ y = op[1];
133
+ op = [
134
+ 0
135
+ ];
136
+ continue;
137
+ case 7:
138
+ op = _.ops.pop();
139
+ _.trys.pop();
140
+ continue;
141
+ default:
142
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
143
+ _ = 0;
144
+ continue;
145
+ }
146
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
147
+ _.label = op[1];
148
+ break;
149
+ }
150
+ if (op[0] === 6 && _.label < t[1]) {
151
+ _.label = t[1];
152
+ t = op;
153
+ break;
154
+ }
155
+ if (t && _.label < t[2]) {
156
+ _.label = t[2];
157
+ _.ops.push(op);
158
+ break;
159
+ }
160
+ if (t[2]) _.ops.pop();
161
+ _.trys.pop();
162
+ continue;
163
+ }
164
+ op = body.call(thisArg, _);
165
+ } catch (e) {
166
+ op = [
167
+ 6,
168
+ e
169
+ ];
170
+ y = 0;
171
+ } finally{
172
+ f = t = 0;
173
+ }
174
+ if (op[0] & 5) throw op[1];
175
+ return {
176
+ value: op[0] ? op[1] : void 0,
177
+ done: true
178
+ };
179
+ }
180
+ }
181
+ import { effectiveGrants, effectiveIframe, EmbedError } from '@egen-civitas/esm-embed-protocol';
2
182
  import { createBus, HostConnection } from '@egen-civitas/esm-embed-host';
3
183
  function watchable(initial) {
4
184
  var value = initial;
@@ -155,14 +335,45 @@ function watchable(initial) {
155
335
  moduleName: moduleName,
156
336
  grants: effectiveGrants(o.manifestCapabilities, (_o_approved = o.approved) !== null && _o_approved !== void 0 ? _o_approved : {}),
157
337
  providers: providers,
158
- controls: {
338
+ controls: _object_spread_props(_object_spread({
159
339
  channel: channel,
160
340
  report: function report(p) {
161
341
  return log('navigation', 'report', p);
162
342
  },
163
343
  navigate: function navigate(t) {
164
344
  return log('navigation', 'navigate', t);
165
- },
345
+ }
346
+ }, o.intents ? {
347
+ intent: function intent(slug, params) {
348
+ return _async_to_generator(function() {
349
+ var target;
350
+ return _ts_generator(this, function(_state) {
351
+ switch(_state.label){
352
+ case 0:
353
+ log('navigation', 'intent', {
354
+ slug: slug,
355
+ params: params !== null && params !== void 0 ? params : {}
356
+ });
357
+ return [
358
+ 4,
359
+ o.intents(slug, params !== null && params !== void 0 ? params : {})
360
+ ];
361
+ case 1:
362
+ target = _state.sent();
363
+ if (target === null) throw new EmbedError('NOT_FOUND', "Intent inconnu : ".concat(slug));
364
+ log('navigation', 'navigate', target);
365
+ return [
366
+ 2,
367
+ {
368
+ status: 'done',
369
+ path: target
370
+ }
371
+ ];
372
+ }
373
+ });
374
+ })();
375
+ }
376
+ } : {}), {
166
377
  notFound: function notFound(p) {
167
378
  return log('navigation', 'notFound', p !== null && p !== void 0 ? p : null);
168
379
  },
@@ -175,7 +386,7 @@ function watchable(initial) {
175
386
  onReady: function onReady() {
176
387
  return log('lifecycle', 'ready');
177
388
  }
178
- },
389
+ }),
179
390
  limits: {
180
391
  pingIntervalMs: 0
181
392
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@egen-civitas/esm-embed-testing",
3
- "version": "0.9.0",
3
+ "version": "0.10.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",
@@ -76,9 +76,9 @@
76
76
  "vitest": "^4.1.2"
77
77
  },
78
78
  "dependencies": {
79
- "@egen-civitas/esm-embed-client": "^0.13.0",
80
- "@egen-civitas/esm-embed-host": "^0.12.0",
81
- "@egen-civitas/esm-embed-protocol": "^0.12.0"
79
+ "@egen-civitas/esm-embed-client": "^0.13.1",
80
+ "@egen-civitas/esm-embed-host": "^0.12.2",
81
+ "@egen-civitas/esm-embed-protocol": "^0.13.0"
82
82
  },
83
83
  "bin": {
84
84
  "egen-embed-check": "bin/egen-embed-check.mjs",
package/src/test-host.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { effectiveGrants, effectiveIframe, type ApprovedGrants, type CapabilityId, type EffectiveIframeRights, type GrantConfig, type IframeRights } from '@egen-civitas/esm-embed-protocol';
1
+ import { effectiveGrants, effectiveIframe, EmbedError, 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
3
  import { createBus, HostConnection, type ExtensionInfo, type HostProviders } from '@egen-civitas/esm-embed-host';
4
4
 
@@ -25,6 +25,11 @@ export interface TestHostOptions {
25
25
  * la table des capacités est construite à la poignée de main.
26
26
  */
27
27
  providers?: Partial<HostProviders>;
28
+ /**
29
+ * Table d'intents du Shell simulé : `objet-action` → chemin du Shell, ou `null` (intent inconnu : `NOT_FOUND`).
30
+ * Absente : `navigation.intent` n'est pas servie (`UNKNOWN_METHOD`), comme sur un Shell sans table d'intents.
31
+ */
32
+ intents?: (slug: string, params: Record<string, unknown>) => string | null | Promise<string | null>;
28
33
  }
29
34
 
30
35
  export interface CallRecord {
@@ -174,6 +179,17 @@ export function createTestHost(o: TestHostOptions = {}): TestHost {
174
179
  channel,
175
180
  report: (p) => log('navigation', 'report', p),
176
181
  navigate: (t) => log('navigation', 'navigate', t),
182
+ ...(o.intents
183
+ ? {
184
+ intent: async (slug: string, params?: Record<string, unknown>) => {
185
+ log('navigation', 'intent', { slug, params: params ?? {} });
186
+ const target = await o.intents!(slug, params ?? {});
187
+ if (target === null) throw new EmbedError('NOT_FOUND', `Intent inconnu : ${slug}`);
188
+ log('navigation', 'navigate', target);
189
+ return { status: 'done' as const, path: target };
190
+ },
191
+ }
192
+ : {}),
177
193
  notFound: (p) => log('navigation', 'notFound', p ?? null),
178
194
  setTitle: (t) => log('navigation', 'setTitle', t),
179
195
  resize: (h) => log('navigation', 'resize', h),