@ai4b-team/fsaos-gateway-sdk 5.2.0 → 5.3.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/README.md +33 -13
- package/dist/iife/gateway.js +4 -4
- package/dist/iife/gateway.js.map +4 -4
- package/dist/iife/ui.js +1 -1
- package/dist/index.cjs +213 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +70 -7
- package/dist/index.d.ts +70 -7
- package/dist/index.js +211 -45
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -335,23 +335,43 @@ bootstrap automatically.
|
|
|
335
335
|
|
|
336
336
|
### A host that holds the session
|
|
337
337
|
|
|
338
|
-
A
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
338
|
+
A page can run with no session of its own: the app that frames it makes its
|
|
339
|
+
kernel calls. A RevDev desk preview inside the builder works this way. The
|
|
340
|
+
previewed page holds no credential and nothing secret is in its address; its
|
|
341
|
+
calls go through the same gateway door, as the same person, as the app around
|
|
342
|
+
it.
|
|
343
|
+
|
|
344
|
+
The framed page is started with `hostSession` and meets its host before it
|
|
345
|
+
renders:
|
|
342
346
|
|
|
343
347
|
```ts
|
|
344
|
-
window.__FSAOS_CONFIG__ = {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
};
|
|
348
|
+
window.__FSAOS_CONFIG__ = { hostSession: true };
|
|
349
|
+
|
|
350
|
+
const { connectHostSession } = await import('@ai4b-team/fsaos-gateway-sdk');
|
|
351
|
+
const { item } = await connectHostSession(); // sets the host's anchor; `item` is what the app is handed
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
The host answers one frame, and stops when the frame goes away:
|
|
355
|
+
|
|
356
|
+
```ts
|
|
357
|
+
const stop = serveHostSession({
|
|
358
|
+
frame: () => iframe.contentWindow,
|
|
359
|
+
origin: 'https://desk-1-preview.example',
|
|
360
|
+
item: () => envelope,
|
|
361
|
+
});
|
|
348
362
|
```
|
|
349
363
|
|
|
350
|
-
With `hostSession`
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
364
|
+
With `hostSession` every `gatewayCall` (and so every hook and `callTool`) goes
|
|
365
|
+
to the host, which makes it with its own token and anchor and passes back the
|
|
366
|
+
same response or the same error. The page sends no bearer, does not wait for a
|
|
367
|
+
sign-in, and opens no realtime connection: change events do not arrive, so a
|
|
368
|
+
read made with `useRealtimeQuery` runs once and is not refreshed. Outside its
|
|
369
|
+
host (opened in its own tab) the page has no session, and
|
|
370
|
+
`connectHostSession()` rejects with `HostSessionUnavailableError`.
|
|
371
|
+
|
|
372
|
+
The framed page's code runs as the signed-in person for as long as it is
|
|
373
|
+
served, as a screen opened inside the app does. Serve only a frame the person
|
|
374
|
+
chose to open.
|
|
355
375
|
|
|
356
376
|
## Build
|
|
357
377
|
|