@egen-civitas/esm-embed-host 0.10.0 → 0.11.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 +11 -0
- package/dist/host.d.ts +4 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +4 -0
- package/dist/providers.d.ts +7 -2
- package/dist/providers.d.ts.map +1 -1
- package/dist/table.d.ts +5 -0
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +107 -25
- package/package.json +3 -3
- package/src/host.ts +5 -0
- package/src/providers.ts +5 -2
- package/src/table.ts +36 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @egen-civitas/esm-embed-host
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 37a82ef: Locale et configuration étendues (B8), additives : `locale.set` (demande, grant `write` approuvé par l'opérateur), `locale.fallbackChain` (restreinte aux `locales` du manifeste), `locale.format.date/number/relativeTime` (local, dans la langue du Shell) ; `config.getValue(path, fallback)` (chemins protégés) et `config.environment()` (clés fermées `{ name, appBaseUrl }`, fournisseur optionnel `environment`). Helpers `buildFallbackChain` et `isLocaleTag`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [37a82ef]
|
|
12
|
+
- @egen-civitas/esm-embed-protocol@0.11.0
|
|
13
|
+
|
|
3
14
|
## 0.10.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/dist/host.d.ts
CHANGED
|
@@ -23,6 +23,10 @@ export interface EmbedHostOptions {
|
|
|
23
23
|
navigation?: NavigationOptions;
|
|
24
24
|
/** Navigation demandée par l'app vers le Core (défaut : `singleSpaNavigate`, ou `replaceState` si `options.replace`). */
|
|
25
25
|
onNavigate?: (to: string, options?: NavigateOptions) => void;
|
|
26
|
+
/** Langues gérées par l'app (`manifest.locales`) : restreignent `locale.fallbackChain`. */
|
|
27
|
+
locales?: string[];
|
|
28
|
+
/** Langue de repli du Shell (défaut : `en`). */
|
|
29
|
+
defaultLocale?: string;
|
|
26
30
|
/** Table des routes du Shell : `navigation.exists` et `NOT_FOUND` sur `navigate`. Absente : `exists` non servie. */
|
|
27
31
|
routeExists?: (path: string) => boolean | Promise<boolean>;
|
|
28
32
|
/** Correspondance d'intents (`objet-action`) → chemin du Shell, gouvernée par l'opérateur. `null` : intent inconnu (`NOT_FOUND`). */
|
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,EAA2F,KAAK,gBAAgB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,KAAK,MAAM,EAAE,KAAK,eAAe,EAAyC,MAAM,kCAAkC,CAAC;AAE7S,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,sDAAsD;IACtD,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;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kGAAkG;IAClG,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,yHAAyH;IACzH,UAAU,CAAC,EAAE,CAAC,E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EmbedSrc, coreSubpath, createRateLimiter, stripSensi
|
|
|
368
368
|
})();
|
|
369
369
|
};
|
|
370
370
|
var controls = _object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
371
|
+
locales: {
|
|
372
|
+
supported: opts.locales,
|
|
373
|
+
default: opts.defaultLocale
|
|
374
|
+
},
|
|
371
375
|
channel: channel,
|
|
372
376
|
report: function report(path, o) {
|
|
373
377
|
return reportLocation(path, o);
|
package/dist/providers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NotificationCloseReason, PublishOptions } from '@egen-civitas/esm-embed-protocol';
|
|
1
|
+
import type { EnvironmentInfo, NotificationCloseReason, PublishOptions } from '@egen-civitas/esm-embed-protocol';
|
|
2
2
|
export type Unsub = () => void;
|
|
3
3
|
/** Valeur lisible et observable fournie par le Core. */
|
|
4
4
|
export interface Watchable<T> {
|
|
@@ -56,8 +56,13 @@ export interface HostProviders {
|
|
|
56
56
|
tenant?: Watchable<{
|
|
57
57
|
id: string | null;
|
|
58
58
|
}>;
|
|
59
|
-
locale
|
|
59
|
+
/** `set` (optionnel) : demande de changement de langue d'une app ayant `write` dans son grant `locale` ; le Core reste la source. */
|
|
60
|
+
locale?: Watchable<string> & {
|
|
61
|
+
set?(tag: string, ctx: CallerContext): void | Promise<void>;
|
|
62
|
+
};
|
|
60
63
|
config?: Watchable<Record<string, unknown>>;
|
|
64
|
+
/** Environnement du Shell pour `config.environment()` : clés FERMÉES (D-09). Absent : non servi (`UNKNOWN_METHOD`). */
|
|
65
|
+
environment?: () => EnvironmentInfo | Promise<EnvironmentInfo>;
|
|
61
66
|
flags?: {
|
|
62
67
|
isEnabled(name: string): boolean | Promise<boolean>;
|
|
63
68
|
subscribe?(cb: () => void): Unsub;
|
package/dist/providers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK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AC,GAAG,SAAS,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;QACtI,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;KAC3G,CAAC;CACH"}
|
package/dist/table.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ export interface HostControls {
|
|
|
14
14
|
exists?(path: string): boolean | Promise<boolean>;
|
|
15
15
|
back?(result?: unknown): void | Promise<void>;
|
|
16
16
|
canGoBack?(): boolean | Promise<boolean>;
|
|
17
|
+
/** Langues gérées par l'app (`manifest.locales`) et langue par défaut du Shell : alimentent `locale.fallbackChain`. */
|
|
18
|
+
locales?: {
|
|
19
|
+
supported?: string[];
|
|
20
|
+
default?: string;
|
|
21
|
+
};
|
|
17
22
|
intent?(slug: string, params?: Record<string, unknown>, options?: NavigateOptions): NavigationResult | Promise<NavigationResult>;
|
|
18
23
|
/** L'app signale une page introuvable (`path` : chemin de l'app, absent = page courante). */
|
|
19
24
|
notFound?(path?: string): 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,
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../src/table.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAEjB,KAAK,YAAY,EAEjB,KAAK,eAAe,EAGpB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,EAAiB,aAAa,EAAqB,MAAM,gBAAgB,CAAC;AAEtF,+EAA+E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C,IAAI,IAAI,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,CA+K3G"}
|
package/dist/table.js
CHANGED
|
@@ -228,7 +228,7 @@ function _ts_generator(thisArg, body) {
|
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
import { CAPABILITIES, createSlidingLimiter, notificationPolicy, EmbedError, slotAllowed, topicAllowed } from '@egen-civitas/esm-embed-protocol';
|
|
231
|
+
import { buildFallbackChain, CAPABILITIES, createSlidingLimiter, notificationPolicy, EmbedError, slotAllowed, topicAllowed } from '@egen-civitas/esm-embed-protocol';
|
|
232
232
|
/** Capacités que l'hôte sait servir avec ces fournisseurs. `navigation`, `lifecycle` et `telemetry` sont toujours servies. */ export function availableCapabilities(p) {
|
|
233
233
|
var s = new Set([
|
|
234
234
|
'navigation',
|
|
@@ -324,30 +324,107 @@ var list = function list(cfg, key) {
|
|
|
324
324
|
})();
|
|
325
325
|
}
|
|
326
326
|
};
|
|
327
|
-
if (cfgOf.has('locale') && p.locale)
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
return
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
327
|
+
if (cfgOf.has('locale') && p.locale) {
|
|
328
|
+
var _cfgOf_get;
|
|
329
|
+
var canWrite = ((_cfgOf_get = cfgOf.get('locale')) === null || _cfgOf_get === void 0 ? void 0 : _cfgOf_get.write) === true;
|
|
330
|
+
table.locale = _object_spread({
|
|
331
|
+
get: function get() {
|
|
332
|
+
return _async_to_generator(function() {
|
|
333
|
+
return _ts_generator(this, function(_state) {
|
|
334
|
+
return [
|
|
335
|
+
2,
|
|
336
|
+
p.locale.get()
|
|
337
|
+
];
|
|
338
|
+
});
|
|
339
|
+
})();
|
|
340
|
+
},
|
|
341
|
+
fallbackChain: function fallbackChain() {
|
|
342
|
+
return _async_to_generator(function() {
|
|
343
|
+
var _c_locales, _c_locales1;
|
|
344
|
+
return _ts_generator(this, function(_state) {
|
|
345
|
+
switch(_state.label){
|
|
346
|
+
case 0:
|
|
347
|
+
return [
|
|
348
|
+
4,
|
|
349
|
+
p.locale.get()
|
|
350
|
+
];
|
|
351
|
+
case 1:
|
|
352
|
+
return [
|
|
353
|
+
2,
|
|
354
|
+
buildFallbackChain.apply(void 0, [
|
|
355
|
+
_state.sent(),
|
|
356
|
+
{
|
|
357
|
+
supported: (_c_locales = c.locales) === null || _c_locales === void 0 ? void 0 : _c_locales.supported,
|
|
358
|
+
default: (_c_locales1 = c.locales) === null || _c_locales1 === void 0 ? void 0 : _c_locales1.default
|
|
359
|
+
}
|
|
360
|
+
])
|
|
361
|
+
];
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
})();
|
|
365
|
+
}
|
|
366
|
+
}, p.locale.set ? {
|
|
367
|
+
set: function set(tag) {
|
|
368
|
+
return _async_to_generator(function() {
|
|
369
|
+
return _ts_generator(this, function(_state) {
|
|
370
|
+
switch(_state.label){
|
|
371
|
+
case 0:
|
|
372
|
+
if (!canWrite) throw denied('Changement de langue non autorisé (grant locale : write)');
|
|
373
|
+
return [
|
|
374
|
+
4,
|
|
375
|
+
p.locale.set(tag, ctx)
|
|
376
|
+
];
|
|
377
|
+
case 1:
|
|
378
|
+
_state.sent();
|
|
379
|
+
return [
|
|
380
|
+
2
|
|
381
|
+
];
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
})();
|
|
385
|
+
}
|
|
386
|
+
} : {});
|
|
387
|
+
}
|
|
388
|
+
if (cfgOf.has('config') && p.config) {
|
|
389
|
+
table.config = _object_spread({
|
|
390
|
+
get: function get() {
|
|
391
|
+
return _async_to_generator(function() {
|
|
392
|
+
return _ts_generator(this, function(_state) {
|
|
393
|
+
return [
|
|
394
|
+
2,
|
|
395
|
+
p.config.get()
|
|
396
|
+
];
|
|
397
|
+
});
|
|
398
|
+
})();
|
|
399
|
+
}
|
|
400
|
+
}, p.environment ? {
|
|
401
|
+
environment: function environment() {
|
|
402
|
+
return _async_to_generator(function() {
|
|
403
|
+
var e, ok;
|
|
404
|
+
return _ts_generator(this, function(_state) {
|
|
405
|
+
switch(_state.label){
|
|
406
|
+
case 0:
|
|
407
|
+
return [
|
|
408
|
+
4,
|
|
409
|
+
p.environment()
|
|
410
|
+
];
|
|
411
|
+
case 1:
|
|
412
|
+
e = _state.sent();
|
|
413
|
+
ok = e && ENVIRONMENTS.includes(e.name) && typeof e.appBaseUrl === 'string' && e.appBaseUrl.length <= 500 && /^https?:\/\//.test(e.appBaseUrl);
|
|
414
|
+
if (!ok) throw new EmbedError('INTERNAL', 'Environnement du Shell invalide');
|
|
415
|
+
return [
|
|
416
|
+
2,
|
|
417
|
+
{
|
|
418
|
+
name: e.name,
|
|
419
|
+
appBaseUrl: e.appBaseUrl
|
|
420
|
+
}
|
|
421
|
+
]; // clés fermées : rien d'autre ne sort
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
})();
|
|
425
|
+
}
|
|
426
|
+
} : {});
|
|
427
|
+
}
|
|
351
428
|
if (cfgOf.has('flags') && p.flags) {
|
|
352
429
|
var names = list(cfgOf.get('flags'), 'names');
|
|
353
430
|
table.flags = {
|
|
@@ -654,6 +731,11 @@ var list = function list(cfg, key) {
|
|
|
654
731
|
subscribe: subscribe
|
|
655
732
|
};
|
|
656
733
|
}
|
|
734
|
+
var ENVIRONMENTS = [
|
|
735
|
+
'production',
|
|
736
|
+
'staging',
|
|
737
|
+
'development'
|
|
738
|
+
];
|
|
657
739
|
var toastSeq = 0;
|
|
658
740
|
var DEFAULT_TOAST_MS = 6000;
|
|
659
741
|
var idSeq = 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egen-civitas/esm-embed-host",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.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.12.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.11.0"
|
|
73
73
|
}
|
|
74
74
|
}
|
package/src/host.ts
CHANGED
|
@@ -26,6 +26,10 @@ export interface EmbedHostOptions {
|
|
|
26
26
|
navigation?: NavigationOptions;
|
|
27
27
|
/** Navigation demandée par l'app vers le Core (défaut : `singleSpaNavigate`, ou `replaceState` si `options.replace`). */
|
|
28
28
|
onNavigate?: (to: string, options?: NavigateOptions) => void;
|
|
29
|
+
/** Langues gérées par l'app (`manifest.locales`) : restreignent `locale.fallbackChain`. */
|
|
30
|
+
locales?: string[];
|
|
31
|
+
/** Langue de repli du Shell (défaut : `en`). */
|
|
32
|
+
defaultLocale?: string;
|
|
29
33
|
/** Table des routes du Shell : `navigation.exists` et `NOT_FOUND` sur `navigate`. Absente : `exists` non servie. */
|
|
30
34
|
routeExists?: (path: string) => boolean | Promise<boolean>;
|
|
31
35
|
/** Correspondance d'intents (`objet-action`) → chemin du Shell, gouvernée par l'opérateur. `null` : intent inconnu (`NOT_FOUND`). */
|
|
@@ -148,6 +152,7 @@ export function createEmbedHost(opts: EmbedHostOptions): EmbedHost {
|
|
|
148
152
|
};
|
|
149
153
|
|
|
150
154
|
const controls: HostControls = {
|
|
155
|
+
locales: { supported: opts.locales, default: opts.defaultLocale },
|
|
151
156
|
channel,
|
|
152
157
|
report: (path, o) => reportLocation(path, o),
|
|
153
158
|
navigate: (to, options) => performNavigate(to, options),
|
package/src/providers.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NotificationCloseReason, PublishOptions } from '@egen-civitas/esm-embed-protocol';
|
|
1
|
+
import type { EnvironmentInfo, NotificationCloseReason, PublishOptions } from '@egen-civitas/esm-embed-protocol';
|
|
2
2
|
export type Unsub = () => void;
|
|
3
3
|
|
|
4
4
|
/** Valeur lisible et observable fournie par le Core. */
|
|
@@ -58,8 +58,11 @@ export interface ExtensionInfo {
|
|
|
58
58
|
*/
|
|
59
59
|
export interface HostProviders {
|
|
60
60
|
tenant?: Watchable<{ id: string | null }>;
|
|
61
|
-
locale
|
|
61
|
+
/** `set` (optionnel) : demande de changement de langue d'une app ayant `write` dans son grant `locale` ; le Core reste la source. */
|
|
62
|
+
locale?: Watchable<string> & { set?(tag: string, ctx: CallerContext): void | Promise<void> };
|
|
62
63
|
config?: Watchable<Record<string, unknown>>;
|
|
64
|
+
/** Environnement du Shell pour `config.environment()` : clés FERMÉES (D-09). Absent : non servi (`UNKNOWN_METHOD`). */
|
|
65
|
+
environment?: () => EnvironmentInfo | Promise<EnvironmentInfo>;
|
|
63
66
|
flags?: { isEnabled(name: string): boolean | Promise<boolean>; subscribe?(cb: () => void): Unsub };
|
|
64
67
|
/**
|
|
65
68
|
* Bus d'événements du Shell. `publish`/`subscribe` historiques inchangés ; les paramètres ajoutés sont optionnels (un fournisseur
|
package/src/table.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
buildFallbackChain,
|
|
2
3
|
CAPABILITIES,
|
|
3
4
|
createSlidingLimiter,
|
|
4
5
|
notificationPolicy,
|
|
@@ -9,6 +10,7 @@ import {
|
|
|
9
10
|
type CapabilityId,
|
|
10
11
|
type GrantConfig,
|
|
11
12
|
type HandlerTable,
|
|
13
|
+
type EnvironmentInfo,
|
|
12
14
|
type NavigateOptions,
|
|
13
15
|
type NotificationCloseReason,
|
|
14
16
|
type PublishOptions,
|
|
@@ -29,6 +31,8 @@ export interface HostControls {
|
|
|
29
31
|
exists?(path: string): boolean | Promise<boolean>;
|
|
30
32
|
back?(result?: unknown): void | Promise<void>;
|
|
31
33
|
canGoBack?(): boolean | Promise<boolean>;
|
|
34
|
+
/** Langues gérées par l'app (`manifest.locales`) et langue par défaut du Shell : alimentent `locale.fallbackChain`. */
|
|
35
|
+
locales?: { supported?: string[]; default?: string };
|
|
32
36
|
intent?(slug: string, params?: Record<string, unknown>, options?: NavigateOptions): NavigationResult | Promise<NavigationResult>;
|
|
33
37
|
/** L'app signale une page introuvable (`path` : chemin de l'app, absent = page courante). */
|
|
34
38
|
notFound?(path?: string): void;
|
|
@@ -78,8 +82,37 @@ export function createCapabilityTable(o: TableOptions): { table: HandlerTable; s
|
|
|
78
82
|
const denied = (msg: string) => new EmbedError('DENIED', msg);
|
|
79
83
|
|
|
80
84
|
if (cfgOf.has('tenant') && p.tenant) table.tenant = { get: async () => p.tenant!.get() };
|
|
81
|
-
if (cfgOf.has('locale') && p.locale)
|
|
82
|
-
|
|
85
|
+
if (cfgOf.has('locale') && p.locale) {
|
|
86
|
+
const canWrite = (cfgOf.get('locale') as { write?: unknown } | undefined)?.write === true;
|
|
87
|
+
table.locale = {
|
|
88
|
+
get: async () => p.locale!.get(),
|
|
89
|
+
fallbackChain: async () => buildFallbackChain(await p.locale!.get(), { supported: c.locales?.supported, default: c.locales?.default }),
|
|
90
|
+
// `set` n'est servie que si le Core sait changer la langue ; sans `write` approuvé, la demande est refusée.
|
|
91
|
+
...(p.locale.set
|
|
92
|
+
? {
|
|
93
|
+
set: async (tag: string) => {
|
|
94
|
+
if (!canWrite) throw denied('Changement de langue non autorisé (grant locale : write)');
|
|
95
|
+
await p.locale!.set!(tag, ctx);
|
|
96
|
+
},
|
|
97
|
+
}
|
|
98
|
+
: {}),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (cfgOf.has('config') && p.config) {
|
|
102
|
+
table.config = {
|
|
103
|
+
get: async () => p.config!.get(),
|
|
104
|
+
...(p.environment
|
|
105
|
+
? {
|
|
106
|
+
environment: async (): Promise<EnvironmentInfo> => {
|
|
107
|
+
const e = await p.environment!();
|
|
108
|
+
const ok = e && ENVIRONMENTS.includes(e.name) && typeof e.appBaseUrl === 'string' && e.appBaseUrl.length <= 500 && /^https?:\/\//.test(e.appBaseUrl);
|
|
109
|
+
if (!ok) throw new EmbedError('INTERNAL', 'Environnement du Shell invalide');
|
|
110
|
+
return { name: e.name, appBaseUrl: e.appBaseUrl }; // clés fermées : rien d'autre ne sort
|
|
111
|
+
},
|
|
112
|
+
}
|
|
113
|
+
: {}),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
83
116
|
|
|
84
117
|
if (cfgOf.has('flags') && p.flags) {
|
|
85
118
|
const names = list(cfgOf.get('flags'), 'names');
|
|
@@ -217,6 +250,7 @@ export function createCapabilityTable(o: TableOptions): { table: HandlerTable; s
|
|
|
217
250
|
};
|
|
218
251
|
}
|
|
219
252
|
|
|
253
|
+
const ENVIRONMENTS = ['production', 'staging', 'development'];
|
|
220
254
|
let toastSeq = 0;
|
|
221
255
|
const DEFAULT_TOAST_MS = 6000;
|
|
222
256
|
let idSeq = 0;
|