@egen-civitas/sdk 0.0.0-stage → 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 +39 -0
- package/README.md +33 -2
- package/dist/app.d.ts +56 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +176 -0
- package/dist/connect.d.ts +33 -0
- package/dist/connect.d.ts.map +1 -0
- package/dist/connect.js +394 -0
- package/dist/errors.d.ts +11 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +18 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/standalone.d.ts +41 -0
- package/dist/standalone.d.ts.map +1 -0
- package/dist/standalone.js +523 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +1 -0
- package/package.json +62 -3
- package/src/app.ts +103 -0
- package/src/connect.ts +100 -0
- package/src/errors.ts +14 -0
- package/src/index.ts +8 -0
- package/src/standalone.ts +140 -0
- package/src/version.ts +2 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @egen-civitas/sdk
|
|
2
|
+
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- bd63b5d: Cycle de vie (B5), additif : état commun (`connecting`, `ready`, `active`, `hidden`, `closing`, `closed`, `failed`, `standalone`), `lifecycle.onBeforeLeave` (plusieurs gardes, un garde défaillant ne bloque jamais), `onClosing` (≤ 2 s, au mieux en iframe), `onError`, `onStateChange`, alias `onVisibilityChange`/`onFocusChange` ; nouvelle méthode hôte → app `lifecycle.closing` et `host.close()` (fermeture ordonnée) ; `connect({ onDiagnostic })` et `app.state` dans le SDK ; visibilité locale en mode autonome.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [bd63b5d]
|
|
12
|
+
- @egen-civitas/esm-embed-protocol@0.9.0
|
|
13
|
+
- @egen-civitas/esm-embed-client@0.10.0
|
|
14
|
+
|
|
15
|
+
## 0.3.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 177a545: Navigation étendue (B4), additive : `navigate(to, options)` renvoie `{ status: 'done' | 'blocked' }` (replace, newTab, query, hash, relativeTo), nouvelles méthodes `current`, `exists`, `back`, `canGoBack`, `intent`, `link` ; l'hôte sert `current`/`back`/`canGoBack` par défaut et `exists`/`intent` via `routeExists`/`intents` ; garde de sortie (`canLeave`) avant de quitter l'app ; code `NOT_FOUND` sur route ou intent inconnu. Un Shell plus ancien répond `UNKNOWN_METHOD` pour les nouvelles méthodes.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [177a545]
|
|
24
|
+
- @egen-civitas/esm-embed-protocol@0.8.0
|
|
25
|
+
- @egen-civitas/esm-embed-client@0.9.0
|
|
26
|
+
|
|
27
|
+
## 0.2.0
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- d74087b: Réforme SDK EGEN (lots A/B) : façade `@egen-civitas/sdk` (`connect`, `EgenApp`, `EgenError`, modes embarqué/autonome, `required`, `diagnose`) ;
|
|
32
|
+
manifeste v2 additif et codes d'erreur additionnels (repli `INTERNAL` côté ancien hôte) ; `sdkVersion` dérivé du package.json ;
|
|
33
|
+
référence des capacités générée depuis le catalogue ; transport du client abstrait (`RpcLike`).
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Updated dependencies [d74087b]
|
|
38
|
+
- @egen-civitas/esm-embed-protocol@0.7.0
|
|
39
|
+
- @egen-civitas/esm-embed-client@0.8.0
|
package/README.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @egen-civitas/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Point d'entrée unique pour développer une application intégrée au Shell EGEN.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { connect } from '@egen-civitas/sdk';
|
|
7
|
+
|
|
8
|
+
const egen = await connect({
|
|
9
|
+
moduleName: '@acme/dossier-app',
|
|
10
|
+
hostOrigins: ['https://egen.exemple.org'],
|
|
11
|
+
capabilities: ['navigation', 'notifications', 'tenant'],
|
|
12
|
+
required: ['navigation'], // échoue (EgenError DENIED) si non accordée
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
egen.mode; // 'embedded' | 'standalone'
|
|
16
|
+
await egen.navigation.report('/dossiers/42');
|
|
17
|
+
await egen.notify({ kind: 'success', title: 'Enregistré' }, localToast);
|
|
18
|
+
console.table(egen.diagnose()); // pistes lisibles en cas de refus / d'absence de Shell
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Modes
|
|
22
|
+
|
|
23
|
+
| Mode | Quand | Comportement |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| `embedded` | page dans une iframe du Shell | protocole v2 (MessageChannel, nonce, grants) via `@egen-civitas/esm-embed-client` |
|
|
26
|
+
| `standalone` | hors Shell, ou Shell muet en `auto` | runtime local : navigation → History, événements locaux, `notify` → affichage local, le reste est refusé `UNSUPPORTED_IN_MODE` |
|
|
27
|
+
|
|
28
|
+
`mode: 'auto'` (défaut) choisit seul ; `'embedded'` exige le Shell (`TIMEOUT` sinon) ; `'standalone'` ne tente jamais de connexion.
|
|
29
|
+
|
|
30
|
+
## Compatibilité
|
|
31
|
+
|
|
32
|
+
`connectToEgen` et `EgenClient` restent exportés (aucune app existante à migrer). Les erreurs sont les `EmbedError` du protocole
|
|
33
|
+
(`EgenError` en est l'alias ; `isEgenError(e, code?)`). La référence des capacités est générée :
|
|
34
|
+
`@egen-civitas/esm-embed-protocol/docs/CAPABILITIES.generated.md`.
|
package/dist/app.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { EgenClient } from '@egen-civitas/esm-embed-client';
|
|
2
|
+
import type { CapabilityDenied, CapabilityId, LifecycleState } from '@egen-civitas/esm-embed-protocol';
|
|
3
|
+
export type EgenMode = 'embedded' | 'standalone';
|
|
4
|
+
export interface Diagnosis {
|
|
5
|
+
mode: EgenMode;
|
|
6
|
+
state: LifecycleState;
|
|
7
|
+
/** `true` seulement si une connexion au Shell est établie. */
|
|
8
|
+
connected: boolean;
|
|
9
|
+
moduleName: string;
|
|
10
|
+
sdkVersion: string;
|
|
11
|
+
protocol: number | undefined;
|
|
12
|
+
granted: string[];
|
|
13
|
+
denied: CapabilityDenied[];
|
|
14
|
+
/** Pistes lisibles pour comprendre un comportement inattendu. */
|
|
15
|
+
hints: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Application connectée à EGEN. Même surface quel que soit le mode : le code de l'app ne change pas selon qu'elle tourne
|
|
19
|
+
* dans le Shell (`embedded`) ou seule (`standalone`). `client` donne accès au client embarqué sous-jacent (échappatoire).
|
|
20
|
+
*/
|
|
21
|
+
export declare class EgenApp {
|
|
22
|
+
private readonly note?;
|
|
23
|
+
readonly mode: EgenMode;
|
|
24
|
+
readonly sdkVersion = "0.4.0";
|
|
25
|
+
readonly client: EgenClient;
|
|
26
|
+
readonly tenant: EgenClient['tenant'];
|
|
27
|
+
readonly locale: EgenClient['locale'];
|
|
28
|
+
readonly navigation: EgenClient['navigation'];
|
|
29
|
+
readonly events: EgenClient['events'];
|
|
30
|
+
readonly notifications: EgenClient['notifications'];
|
|
31
|
+
readonly dialogs: EgenClient['dialogs'];
|
|
32
|
+
readonly flags: EgenClient['flags'];
|
|
33
|
+
readonly config: EgenClient['config'];
|
|
34
|
+
readonly telemetry: EgenClient['telemetry'];
|
|
35
|
+
readonly lifecycle: EgenClient['lifecycle'];
|
|
36
|
+
readonly extensions: EgenClient['extensions'];
|
|
37
|
+
constructor(client: EgenClient, mode: EgenMode, note?: string | undefined);
|
|
38
|
+
get moduleName(): string;
|
|
39
|
+
/** Connexion au Shell établie (toujours `false` en mode autonome). */
|
|
40
|
+
get connected(): boolean;
|
|
41
|
+
/** État du cycle de vie (spec §6.1). */
|
|
42
|
+
get state(): LifecycleState;
|
|
43
|
+
get closed(): boolean;
|
|
44
|
+
/** Le Core affiche-t-il seul les notifications de l'app ? (voir `EgenClient.coreDisplaysNotifications`). */
|
|
45
|
+
get coreDisplaysNotifications(): boolean;
|
|
46
|
+
has(id: CapabilityId): boolean;
|
|
47
|
+
get capabilities(): {
|
|
48
|
+
granted: CapabilityId[];
|
|
49
|
+
denied: CapabilityDenied[];
|
|
50
|
+
};
|
|
51
|
+
/** Notification sans doublon : Core si disponible, sinon `local`. */
|
|
52
|
+
notify: EgenClient['notify'];
|
|
53
|
+
diagnose(): Diagnosis;
|
|
54
|
+
close(): void;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGvG,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,YAAY,CAAC;AAEjD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,cAAc,CAAC;IACtB,8DAA8D;IAC9D,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,iEAAiE;IACjE,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;GAGG;AACH,qBAAa,OAAO;IAiB8B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;IAhBtE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,UAAU,WAAe;IAClC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAE5B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IACtC,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;IACpD,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;gBAElC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAmB,IAAI,CAAC,EAAE,MAAM,YAAA;IAgB9E,IAAI,UAAU,IAAI,MAAM,CAEvB;IACD,sEAAsE;IACtE,IAAI,SAAS,IAAI,OAAO,CAEvB;IACD,wCAAwC;IACxC,IAAI,KAAK,IAAI,cAAc,CAE1B;IACD,IAAI,MAAM,IAAI,OAAO,CAEpB;IACD,4GAA4G;IAC5G,IAAI,yBAAyB,IAAI,OAAO,CAEvC;IAED,GAAG,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO;IAG9B,IAAI,YAAY,IAAI;QAAE,OAAO,EAAE,YAAY,EAAE,CAAC;QAAC,MAAM,EAAE,gBAAgB,EAAE,CAAA;KAAE,CAE1E;IAED,qEAAqE;IACrE,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAsD;IAElF,QAAQ,IAAI,SAAS;IAarB,KAAK,IAAI,IAAI;CAGd"}
|
package/dist/app.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
function _class_call_check(instance, Constructor) {
|
|
2
|
+
if (!(instance instanceof Constructor)) {
|
|
3
|
+
throw new TypeError("Cannot call a class as a function");
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
function _defineProperties(target, props) {
|
|
7
|
+
for(var i = 0; i < props.length; i++){
|
|
8
|
+
var descriptor = props[i];
|
|
9
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
10
|
+
descriptor.configurable = true;
|
|
11
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
12
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
16
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
17
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
|
+
return Constructor;
|
|
19
|
+
}
|
|
20
|
+
function _define_property(obj, key, value) {
|
|
21
|
+
if (key in obj) {
|
|
22
|
+
Object.defineProperty(obj, key, {
|
|
23
|
+
value: value,
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
obj[key] = value;
|
|
30
|
+
}
|
|
31
|
+
return obj;
|
|
32
|
+
}
|
|
33
|
+
import { SDK_VERSION } from './version.js';
|
|
34
|
+
/**
|
|
35
|
+
* Application connectée à EGEN. Même surface quel que soit le mode : le code de l'app ne change pas selon qu'elle tourne
|
|
36
|
+
* dans le Shell (`embedded`) ou seule (`standalone`). `client` donne accès au client embarqué sous-jacent (échappatoire).
|
|
37
|
+
*/ export var EgenApp = /*#__PURE__*/ function() {
|
|
38
|
+
"use strict";
|
|
39
|
+
function EgenApp(client, mode, note) {
|
|
40
|
+
var _this = this;
|
|
41
|
+
_class_call_check(this, EgenApp);
|
|
42
|
+
_define_property(this, "note", void 0);
|
|
43
|
+
_define_property(this, "mode", void 0);
|
|
44
|
+
_define_property(this, "sdkVersion", void 0);
|
|
45
|
+
_define_property(this, "client", void 0);
|
|
46
|
+
_define_property(this, "tenant", void 0);
|
|
47
|
+
_define_property(this, "locale", void 0);
|
|
48
|
+
_define_property(this, "navigation", void 0);
|
|
49
|
+
_define_property(this, "events", void 0);
|
|
50
|
+
_define_property(this, "notifications", void 0);
|
|
51
|
+
_define_property(this, "dialogs", void 0);
|
|
52
|
+
_define_property(this, "flags", void 0);
|
|
53
|
+
_define_property(this, "config", void 0);
|
|
54
|
+
_define_property(this, "telemetry", void 0);
|
|
55
|
+
_define_property(this, "lifecycle", void 0);
|
|
56
|
+
_define_property(this, "extensions", void 0);
|
|
57
|
+
/** Notification sans doublon : Core si disponible, sinon `local`. */ _define_property(this, "notify", void 0);
|
|
58
|
+
this.note = note;
|
|
59
|
+
this.sdkVersion = SDK_VERSION;
|
|
60
|
+
this.notify = function(toast, local) {
|
|
61
|
+
return _this.client.notify(toast, local);
|
|
62
|
+
};
|
|
63
|
+
this.client = client;
|
|
64
|
+
this.mode = mode;
|
|
65
|
+
this.tenant = client.tenant;
|
|
66
|
+
this.locale = client.locale;
|
|
67
|
+
this.navigation = client.navigation;
|
|
68
|
+
this.events = client.events;
|
|
69
|
+
this.notifications = client.notifications;
|
|
70
|
+
this.dialogs = client.dialogs;
|
|
71
|
+
this.flags = client.flags;
|
|
72
|
+
this.config = client.config;
|
|
73
|
+
this.telemetry = client.telemetry;
|
|
74
|
+
this.lifecycle = client.lifecycle;
|
|
75
|
+
this.extensions = client.extensions;
|
|
76
|
+
}
|
|
77
|
+
_create_class(EgenApp, [
|
|
78
|
+
{
|
|
79
|
+
key: "moduleName",
|
|
80
|
+
get: function get() {
|
|
81
|
+
return this.client.moduleName;
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
key: "connected",
|
|
86
|
+
get: /** Connexion au Shell établie (toujours `false` en mode autonome). */ function get() {
|
|
87
|
+
return this.client.connected;
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
key: "state",
|
|
92
|
+
get: /** État du cycle de vie (spec §6.1). */ function get() {
|
|
93
|
+
return this.client.lifecycle.state;
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
key: "closed",
|
|
98
|
+
get: function get() {
|
|
99
|
+
return this.client.closed;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
key: "coreDisplaysNotifications",
|
|
104
|
+
get: /** Le Core affiche-t-il seul les notifications de l'app ? (voir `EgenClient.coreDisplaysNotifications`). */ function get() {
|
|
105
|
+
return this.client.coreDisplaysNotifications;
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
key: "has",
|
|
110
|
+
value: function has(id) {
|
|
111
|
+
return this.client.has(id);
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
key: "capabilities",
|
|
116
|
+
get: function get() {
|
|
117
|
+
return {
|
|
118
|
+
granted: this.client.capabilities.map(function(g) {
|
|
119
|
+
return g.id;
|
|
120
|
+
}),
|
|
121
|
+
denied: this.client.denied
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
key: "diagnose",
|
|
127
|
+
value: function diagnose() {
|
|
128
|
+
var _this_note;
|
|
129
|
+
var denied = this.client.denied;
|
|
130
|
+
var hints = [];
|
|
131
|
+
if (this.mode === 'standalone') hints.push((_this_note = this.note) !== null && _this_note !== void 0 ? _this_note : "Mode autonome : l'app n'est pas connectée au Shell EGEN.");
|
|
132
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
133
|
+
try {
|
|
134
|
+
for(var _iterator = denied[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
135
|
+
var d = _step.value;
|
|
136
|
+
if (d.reason === 'NOT_APPROVED') hints.push("\xab ".concat(d.id, " \xbb : non approuv\xe9e par l'op\xe9rateur (external-apps.json)."));
|
|
137
|
+
else if (d.reason === 'UNAVAILABLE') hints.push("\xab ".concat(d.id, " \xbb : le Shell ne sert pas cette capacit\xe9 (h\xf4te plus ancien ?)."));
|
|
138
|
+
else if (d.reason === 'VERSION') hints.push("\xab ".concat(d.id, " \xbb : version de capacit\xe9 non prise en charge par le Shell."));
|
|
139
|
+
else hints.push("\xab ".concat(d.id, " \xbb : inconnue du Shell (SDK plus r\xe9cent que le Shell ?)."));
|
|
140
|
+
}
|
|
141
|
+
} catch (err) {
|
|
142
|
+
_didIteratorError = true;
|
|
143
|
+
_iteratorError = err;
|
|
144
|
+
} finally{
|
|
145
|
+
try {
|
|
146
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
147
|
+
_iterator.return();
|
|
148
|
+
}
|
|
149
|
+
} finally{
|
|
150
|
+
if (_didIteratorError) {
|
|
151
|
+
throw _iteratorError;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
mode: this.mode,
|
|
157
|
+
state: this.state,
|
|
158
|
+
connected: this.connected,
|
|
159
|
+
moduleName: this.moduleName,
|
|
160
|
+
sdkVersion: this.sdkVersion,
|
|
161
|
+
protocol: this.client.protocol,
|
|
162
|
+
granted: this.capabilities.granted,
|
|
163
|
+
denied: denied,
|
|
164
|
+
hints: hints
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
key: "close",
|
|
170
|
+
value: function close() {
|
|
171
|
+
this.client.close();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
]);
|
|
175
|
+
return EgenApp;
|
|
176
|
+
}();
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ConnectOptions as EmbeddedOptions } from '@egen-civitas/esm-embed-client';
|
|
2
|
+
import { EmbedError, type CapabilityId, type LifecycleState } from '@egen-civitas/esm-embed-protocol';
|
|
3
|
+
import { EgenApp, type EgenMode } from './app.js';
|
|
4
|
+
import { type StandaloneOptions } from './standalone.js';
|
|
5
|
+
/** Transitions d'état et erreurs de protocole (spec §6 / §497) : `connecting` et `failed` n'existent qu'ici. */
|
|
6
|
+
export type DiagnosticEvent = {
|
|
7
|
+
type: 'state';
|
|
8
|
+
state: LifecycleState;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'error';
|
|
11
|
+
error: EmbedError;
|
|
12
|
+
};
|
|
13
|
+
export interface ConnectOptions extends Omit<EmbeddedOptions, 'hostOrigins'> {
|
|
14
|
+
/** Origines EXACTES du Shell. Obligatoire pour le mode embarqué ; sans elles, `auto` reste en mode autonome. */
|
|
15
|
+
hostOrigins?: string[];
|
|
16
|
+
/**
|
|
17
|
+
* `auto` (défaut) : embarqué si la page est dans une iframe, autonome sinon ou si le Shell ne répond pas ;
|
|
18
|
+
* `embedded` : exige le Shell (échec explicite sinon) ; `standalone` : n'essaie jamais de se connecter.
|
|
19
|
+
*/
|
|
20
|
+
mode?: 'auto' | EgenMode;
|
|
21
|
+
/** Capacités sans lesquelles l'app ne peut pas fonctionner : `connect()` échoue si l'une manque. */
|
|
22
|
+
required?: CapabilityId[];
|
|
23
|
+
/** Comportement hors Shell. */
|
|
24
|
+
standalone?: StandaloneOptions;
|
|
25
|
+
/** Reçoit les transitions d'état (`connecting` → `ready`/`standalone`/`failed` → …) et les erreurs de protocole. */
|
|
26
|
+
onDiagnostic?: (e: DiagnosticEvent) => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Point d'entrée unique du SDK. Retourne toujours une `EgenApp` utilisable, sauf si `required` n'est pas satisfait
|
|
30
|
+
* ou si `mode: 'embedded'` est exigé sans Shell (erreurs typées `EgenError`).
|
|
31
|
+
*/
|
|
32
|
+
export declare function connect(options: ConnectOptions): Promise<EgenApp>;
|
|
33
|
+
//# sourceMappingURL=connect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,cAAc,IAAI,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACnH,OAAO,EAAE,UAAU,EAAgC,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACpI,OAAO,EAAE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAoD,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE3G,gHAAgH;AAChH,MAAM,MAAM,eAAe,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAAC;AAE9G,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC;IAC1E,gHAAgH;IAChH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACzB,oGAAoG;IACpG,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B,+BAA+B;IAC/B,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,oHAAoH;IACpH,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE,eAAe,KAAK,IAAI,CAAC;CAC7C;AA8BD;;;GAGG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAoBvE"}
|