screenreader-speech-capture 0.8.2 → 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/README.md +8 -2
- package/dist/cli.mjs +984 -278
- package/dist/ui/adapter-node.js +1 -1
- package/dist/ui/client/ui/_app/immutable/chunks/{CM9WugkD.js → 0YgL1EU2.js} +36 -36
- package/dist/ui/client/ui/_app/immutable/chunks/0YgL1EU2.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/0YgL1EU2.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BYvlzyV8.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BYvlzyV8.js.br +2 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BYvlzyV8.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BfvDkxmG.js +3 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BfvDkxmG.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BfvDkxmG.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CSCPyqWx.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CSCPyqWx.js.br +3 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CSCPyqWx.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/{Fimt9aTv.js → Cba3ZwaX.js} +11 -11
- package/dist/ui/client/ui/_app/immutable/chunks/Cba3ZwaX.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Cba3ZwaX.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DErxe_FC.js +3 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DErxe_FC.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DErxe_FC.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dqufijaz.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dqufijaz.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dqufijaz.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/WpCriteK.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/WpCriteK.js.br +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/WpCriteK.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/wbLSPbHY.js +4 -0
- package/dist/ui/client/ui/_app/immutable/chunks/wbLSPbHY.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/wbLSPbHY.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.B6hhDf4F.js +2 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.B6hhDf4F.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.B6hhDf4F.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/{start.uodUAHNT.js → start.Dluk7nQO.js} +2 -2
- package/dist/ui/client/ui/_app/immutable/entry/start.Dluk7nQO.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.Dluk7nQO.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.D-lhv0Us.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.D-lhv0Us.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.D-lhv0Us.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.Cs4GAsCO.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.Cs4GAsCO.js.br +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.Cs4GAsCO.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.CmuzlN_T.js +52 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.CmuzlN_T.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.CmuzlN_T.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.DMXXeBbC.js +5 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.DMXXeBbC.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.DMXXeBbC.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/{4.DY8qq4Io.js → 4.CMHCNMDn.js} +1 -1
- package/dist/ui/client/ui/_app/immutable/nodes/4.CMHCNMDn.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.CMHCNMDn.js.gz +0 -0
- package/dist/ui/client/ui/_app/version.json +1 -1
- package/dist/ui/client/ui/_app/version.json.br +0 -0
- package/dist/ui/client/ui/_app/version.json.gz +0 -0
- package/dist/ui/server/.vite/manifest.json +97 -54
- package/dist/ui/server/chunks/composition.js +112 -118
- package/dist/ui/server/chunks/composition.js.map +1 -1
- package/dist/ui/server/chunks/config.js +139 -3
- package/dist/ui/server/chunks/config.js.map +1 -1
- package/dist/ui/server/chunks/exports.js +19 -204
- package/dist/ui/server/chunks/exports.js.map +1 -1
- package/dist/ui/server/chunks/functions.js +1 -1
- package/dist/ui/server/chunks/icon-button.js +1 -1
- package/dist/ui/server/chunks/instance.js +9 -56
- package/dist/ui/server/chunks/instance.js.map +1 -1
- package/dist/ui/server/chunks/internal.js +55 -4
- package/dist/ui/server/chunks/internal.js.map +1 -1
- package/dist/ui/server/chunks/outlined-text-field.js +1 -1
- package/dist/ui/server/chunks/remote-1j2tn2d.js +4 -0
- package/dist/ui/server/chunks/remote.js +1565 -0
- package/dist/ui/server/chunks/remote.js.map +1 -0
- package/dist/ui/server/chunks/scope.js +13 -0
- package/dist/ui/server/chunks/scope.js.map +1 -0
- package/dist/ui/server/chunks/server-errors.js +48 -1
- package/dist/ui/server/chunks/server-errors.js.map +1 -1
- package/dist/ui/server/chunks/server2.js +24 -1
- package/dist/ui/server/chunks/server2.js.map +1 -1
- package/dist/ui/server/chunks/sessions.js +65 -0
- package/dist/ui/server/chunks/sessions.js.map +1 -0
- package/dist/ui/server/chunks/sessions.remote.js +56 -0
- package/dist/ui/server/chunks/sessions.remote.js.map +1 -0
- package/dist/ui/server/chunks/shared-errors.js +214 -0
- package/dist/ui/server/chunks/shared-errors.js.map +1 -0
- package/dist/ui/server/chunks/src.js +123 -44
- package/dist/ui/server/chunks/src.js.map +1 -1
- package/dist/ui/server/entries/endpoints/api/config/_server.ts.js +3 -5
- package/dist/ui/server/entries/endpoints/api/config/_server.ts.js.map +1 -1
- package/dist/ui/server/entries/endpoints/api/markers/_server.ts.js +3 -4
- package/dist/ui/server/entries/endpoints/api/markers/_server.ts.js.map +1 -1
- package/dist/ui/server/entries/endpoints/api/sessions/_id_id_/_server.ts.js +12 -0
- package/dist/ui/server/entries/endpoints/api/sessions/_id_id_/_server.ts.js.map +1 -0
- package/dist/ui/server/entries/endpoints/api/sessions/_server.ts.js +4 -9
- package/dist/ui/server/entries/endpoints/api/sessions/_server.ts.js.map +1 -1
- package/dist/ui/server/entries/endpoints/api/sessions/end/_server.ts.js +2 -3
- package/dist/ui/server/entries/endpoints/api/sessions/end/_server.ts.js.map +1 -1
- package/dist/ui/server/entries/endpoints/api/speech/_server.ts.js +6 -9
- package/dist/ui/server/entries/endpoints/api/speech/_server.ts.js.map +1 -1
- package/dist/ui/server/entries/endpoints/api/speech/stream/_server.ts.js +3 -3
- package/dist/ui/server/entries/endpoints/api/speech/stream/_server.ts.js.map +1 -1
- package/dist/ui/server/entries/endpoints/api/status/_server.ts.js +2 -3
- package/dist/ui/server/entries/endpoints/api/status/_server.ts.js.map +1 -1
- package/dist/ui/server/entries/fallbacks/error.svelte.js +1 -1
- package/dist/ui/server/entries/hooks.server.js +145 -1
- package/dist/ui/server/entries/hooks.server.js.map +1 -1
- package/dist/ui/server/entries/pages/_layout.server.ts.js +2 -3
- package/dist/ui/server/entries/pages/_layout.server.ts.js.map +1 -1
- package/dist/ui/server/entries/pages/_layout.svelte.js +4 -2
- package/dist/ui/server/entries/pages/_layout.svelte.js.map +1 -1
- package/dist/ui/server/entries/pages/_page.server.ts.js +3 -3
- package/dist/ui/server/entries/pages/_page.server.ts.js.map +1 -1
- package/dist/ui/server/entries/pages/_page.svelte.js +8 -62
- package/dist/ui/server/entries/pages/_page.svelte.js.map +1 -1
- package/dist/ui/server/entries/pages/settings/_page.svelte.js +3 -2
- package/dist/ui/server/entries/pages/settings/_page.svelte.js.map +1 -1
- package/dist/ui/server/entries/params.js +60 -0
- package/dist/ui/server/entries/params.js.map +1 -0
- package/dist/ui/server/env.js +1 -1
- package/dist/ui/server/index.js +2 -2
- package/dist/ui/server/manifest-full.js +7 -6
- package/dist/ui/server/manifest.js +7 -6
- package/dist/ui/server/nodes/0.js +1 -1
- package/dist/ui/server/nodes/1.js +1 -1
- package/dist/ui/server/nodes/2.js +1 -1
- package/dist/ui/server/nodes/3.js +1 -1
- package/dist/ui/server/nodes/4.js +1 -1
- package/dist/ui/server/remote-entry.js +1 -1565
- package/dist/ui/server/server.js +7 -6
- package/package.json +3 -2
- package/dist/ui/client/ui/_app/immutable/chunks/C67ohLw_.js +0 -1
- package/dist/ui/client/ui/_app/immutable/chunks/C67ohLw_.js.br +0 -3
- package/dist/ui/client/ui/_app/immutable/chunks/C67ohLw_.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CKeiBgOI.js +0 -1
- package/dist/ui/client/ui/_app/immutable/chunks/CKeiBgOI.js.br +0 -1
- package/dist/ui/client/ui/_app/immutable/chunks/CKeiBgOI.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CM9WugkD.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CM9WugkD.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CVUOwNb5.js +0 -3
- package/dist/ui/client/ui/_app/immutable/chunks/CVUOwNb5.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CVUOwNb5.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CXrPUR7p.js +0 -4
- package/dist/ui/client/ui/_app/immutable/chunks/CXrPUR7p.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CXrPUR7p.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dksil5Gu.js +0 -1
- package/dist/ui/client/ui/_app/immutable/chunks/Dksil5Gu.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dksil5Gu.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DnL0kOQY.js +0 -1
- package/dist/ui/client/ui/_app/immutable/chunks/DnL0kOQY.js.br +0 -2
- package/dist/ui/client/ui/_app/immutable/chunks/DnL0kOQY.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Fimt9aTv.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Fimt9aTv.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/h7UQ89-l.js +0 -3
- package/dist/ui/client/ui/_app/immutable/chunks/h7UQ89-l.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/h7UQ89-l.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.BQe0vf14.js +0 -2
- package/dist/ui/client/ui/_app/immutable/entry/app.BQe0vf14.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.BQe0vf14.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.uodUAHNT.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.uodUAHNT.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.kO9a4iA1.js +0 -1
- package/dist/ui/client/ui/_app/immutable/nodes/0.kO9a4iA1.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.kO9a4iA1.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.jZ-iBVjE.js +0 -1
- package/dist/ui/client/ui/_app/immutable/nodes/1.jZ-iBVjE.js.br +0 -2
- package/dist/ui/client/ui/_app/immutable/nodes/1.jZ-iBVjE.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.CWoJ2uhd.js +0 -52
- package/dist/ui/client/ui/_app/immutable/nodes/2.CWoJ2uhd.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.CWoJ2uhd.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.DcigOv3T.js +0 -5
- package/dist/ui/client/ui/_app/immutable/nodes/3.DcigOv3T.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.DcigOv3T.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.DY8qq4Io.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.DY8qq4Io.js.gz +0 -0
- package/dist/ui/server/chunks/bridge-api.js +0 -105
- package/dist/ui/server/chunks/bridge-api.js.map +0 -1
- package/dist/ui/server/entries/endpoints/api/sessions/_id_/_server.ts.js +0 -13
- package/dist/ui/server/entries/endpoints/api/sessions/_id_/_server.ts.js.map +0 -1
- package/dist/ui/server/remote-entry.js.map +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { t as getSessions } from "./sessions.remote.js";
|
|
1
2
|
import { mt as resolve } from "./internal.js";
|
|
2
|
-
import {
|
|
3
|
-
import "./server2.js";
|
|
3
|
+
import { l as SpeechEntrySchema, n as checkDto } from "./src.js";
|
|
4
|
+
import { c as getContext, l as setContext } from "./server2.js";
|
|
5
|
+
import "./index-server.js";
|
|
4
6
|
// ../../node_modules/.pnpm/tslib@2.9.1/node_modules/tslib/tslib.es6.mjs
|
|
5
7
|
function __decorate(decorators, target, key, desc) {
|
|
6
8
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -2562,52 +2564,61 @@ function pendingFields(active, saved) {
|
|
|
2562
2564
|
const running = flatten(active, "", /* @__PURE__ */ new Map());
|
|
2563
2565
|
return [...flatten(saved, "", /* @__PURE__ */ new Map())].filter(([path, value]) => running.get(path) !== value).map(([path]) => path);
|
|
2564
2566
|
}
|
|
2567
|
+
// src/lib/adapters/route-request.ts
|
|
2568
|
+
var defaultRejection = (error, status) => new Error(error?.message ?? `The request answered ${status}`);
|
|
2569
|
+
/** Calls one of the UI's own routes (`url` includes the base path) and rejects unless it is ok. */
|
|
2570
|
+
async function routeRequest(url, { method = "GET", body, signal, rejection = defaultRejection } = {}) {
|
|
2571
|
+
const response = await fetch(url, {
|
|
2572
|
+
method,
|
|
2573
|
+
headers: {
|
|
2574
|
+
accept: "application/json",
|
|
2575
|
+
...body === void 0 ? {} : { "content-type": "application/json" }
|
|
2576
|
+
},
|
|
2577
|
+
body: body === void 0 ? void 0 : JSON.stringify(body),
|
|
2578
|
+
signal
|
|
2579
|
+
});
|
|
2580
|
+
if (!response.ok) throw rejection(await readRouteError(response), response.status);
|
|
2581
|
+
return response;
|
|
2582
|
+
}
|
|
2583
|
+
/**
|
|
2584
|
+
* {@link routeRequest} for a JSON answer. It is not checked again: the BFF already checked the
|
|
2585
|
+
* bridge's answer against the contract (`lib/server/bridge-api.ts`), and only the UI calls its
|
|
2586
|
+
* routes. `T` is what the route answers.
|
|
2587
|
+
*/
|
|
2588
|
+
async function routeJson(url, request) {
|
|
2589
|
+
return await (await routeRequest(url, request)).json();
|
|
2590
|
+
}
|
|
2591
|
+
async function readRouteError(response) {
|
|
2592
|
+
const body = await response.json().catch(() => void 0);
|
|
2593
|
+
if (typeof body !== "object" || body === null || !("message" in body)) return null;
|
|
2594
|
+
const { message } = body;
|
|
2595
|
+
if (typeof message !== "string") return null;
|
|
2596
|
+
return {
|
|
2597
|
+
message,
|
|
2598
|
+
field: "field" in body && typeof body.field === "string" ? body.field : void 0
|
|
2599
|
+
};
|
|
2600
|
+
}
|
|
2565
2601
|
// src/lib/adapters/http-config-api.ts
|
|
2602
|
+
/** A refused save names the bridge's reason (and the setting, when it names one). */
|
|
2603
|
+
var rejection = (error, status) => error === null ? /* @__PURE__ */ new Error(`The request answered ${status}`) : new SettingRejected(error.message, error.field);
|
|
2566
2604
|
/** Reads and saves the configuration through the UI's own config route (`url` includes the base path). */
|
|
2567
2605
|
var HttpConfigApi = class {
|
|
2568
2606
|
url;
|
|
2569
2607
|
constructor(url) {
|
|
2570
2608
|
this.url = url;
|
|
2571
2609
|
}
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
const body = await response.json();
|
|
2576
|
-
const active = checkDto(ConfigSchema, body.active);
|
|
2577
|
-
const saved = checkDto(ConfigSchema, body.saved);
|
|
2578
|
-
const overrides = checkDto(ConfigOverridesSchema, { overrides: body.overrides });
|
|
2579
|
-
if (!active.ok || !saved.ok || !overrides.ok) throw new Error("Unexpected configuration answer from the bridge");
|
|
2580
|
-
return {
|
|
2581
|
-
active: active.value,
|
|
2582
|
-
saved: saved.value,
|
|
2583
|
-
overrides: overrides.value.overrides
|
|
2584
|
-
};
|
|
2610
|
+
/** `GET /ui/api/config` answers `{ active, saved, overrides }` in one go. */
|
|
2611
|
+
fetch() {
|
|
2612
|
+
return routeJson(this.url, { rejection });
|
|
2585
2613
|
}
|
|
2586
|
-
|
|
2587
|
-
|
|
2614
|
+
update(patch) {
|
|
2615
|
+
return routeJson(this.url, {
|
|
2588
2616
|
method: "PUT",
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
"content-type": "application/json"
|
|
2592
|
-
},
|
|
2593
|
-
body: JSON.stringify(patch)
|
|
2617
|
+
body: patch,
|
|
2618
|
+
rejection
|
|
2594
2619
|
});
|
|
2595
|
-
if (!response.ok) throw await rejection(response);
|
|
2596
|
-
const checked = checkDto(ConfigSchema, await response.json());
|
|
2597
|
-
if (!checked.ok) throw new Error(`Unexpected answer at ${checked.field}: ${checked.message}`);
|
|
2598
|
-
return checked.value;
|
|
2599
2620
|
}
|
|
2600
2621
|
};
|
|
2601
|
-
/** SvelteKit's `error()` answers `{ message, field? }`; fall back to the status. */
|
|
2602
|
-
async function rejection(response) {
|
|
2603
|
-
const body = await response.json().catch(() => void 0);
|
|
2604
|
-
if (typeof body === "object" && body !== null && "message" in body) {
|
|
2605
|
-
const { message } = body;
|
|
2606
|
-
const field = "field" in body && typeof body.field === "string" ? body.field : void 0;
|
|
2607
|
-
if (typeof message === "string") return new SettingRejected(message, field);
|
|
2608
|
-
}
|
|
2609
|
-
return /* @__PURE__ */ new Error(`The request answered ${response.status}`);
|
|
2610
|
-
}
|
|
2611
2622
|
// src/lib/adapters/http-speech-api.ts
|
|
2612
2623
|
/** Changes the speech through the UI's own markers and speech routes (the urls include the base path). */
|
|
2613
2624
|
var HttpSpeechApi = class {
|
|
@@ -2618,80 +2629,47 @@ var HttpSpeechApi = class {
|
|
|
2618
2629
|
this.speechUrl = speechUrl;
|
|
2619
2630
|
}
|
|
2620
2631
|
async addMarker(label) {
|
|
2621
|
-
|
|
2632
|
+
await routeRequest(this.markersUrl, {
|
|
2622
2633
|
method: "POST",
|
|
2623
|
-
|
|
2624
|
-
accept: "application/json",
|
|
2625
|
-
"content-type": "application/json"
|
|
2626
|
-
},
|
|
2627
|
-
body: JSON.stringify({ label })
|
|
2634
|
+
body: { label }
|
|
2628
2635
|
});
|
|
2629
|
-
if (!response.ok) throw new Error(await errorMessage$1(response));
|
|
2630
2636
|
}
|
|
2631
2637
|
async clear(scope) {
|
|
2632
|
-
|
|
2633
|
-
method: "DELETE",
|
|
2634
|
-
headers: { accept: "application/json" }
|
|
2635
|
-
});
|
|
2636
|
-
if (!response.ok) throw new Error(await errorMessage$1(response));
|
|
2638
|
+
await routeRequest(`${this.speechUrl}?session=${scope}`, { method: "DELETE" });
|
|
2637
2639
|
}
|
|
2638
2640
|
};
|
|
2639
|
-
/** SvelteKit's `error()` answers `{ message }`; fall back to the status. */
|
|
2640
|
-
async function errorMessage$1(response) {
|
|
2641
|
-
const body = await response.json().catch(() => void 0);
|
|
2642
|
-
if (typeof body === "object" && body !== null && "message" in body) {
|
|
2643
|
-
const { message } = body;
|
|
2644
|
-
if (typeof message === "string") return message;
|
|
2645
|
-
}
|
|
2646
|
-
return `The request answered ${response.status}`;
|
|
2647
|
-
}
|
|
2648
2641
|
// src/lib/adapters/http-sessions-api.ts
|
|
2649
|
-
/**
|
|
2642
|
+
/**
|
|
2643
|
+
* Reads the sessions with the `getSessions` remote query and changes them through the UI's own
|
|
2644
|
+
* sessions routes (`url` includes the base path).
|
|
2645
|
+
*/
|
|
2650
2646
|
var HttpSessionsApi = class {
|
|
2651
2647
|
url;
|
|
2652
2648
|
constructor(url) {
|
|
2653
2649
|
this.url = url;
|
|
2654
2650
|
}
|
|
2655
|
-
|
|
2656
|
-
|
|
2651
|
+
/** Always asks the server again: a query keeps its last answer while anything still uses it. */
|
|
2652
|
+
async list() {
|
|
2653
|
+
const sessions = getSessions();
|
|
2654
|
+
await sessions.refresh();
|
|
2655
|
+
return sessions.current;
|
|
2657
2656
|
}
|
|
2658
2657
|
start(name, run) {
|
|
2659
|
-
return
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2658
|
+
return routeJson(this.url, {
|
|
2659
|
+
method: "POST",
|
|
2660
|
+
body: {
|
|
2661
|
+
name,
|
|
2662
|
+
run
|
|
2663
|
+
}
|
|
2664
|
+
});
|
|
2663
2665
|
}
|
|
2664
2666
|
async end() {
|
|
2665
|
-
await
|
|
2667
|
+
await routeRequest(`${this.url}/end`, { method: "POST" });
|
|
2666
2668
|
}
|
|
2667
2669
|
async delete(id) {
|
|
2668
|
-
await
|
|
2669
|
-
}
|
|
2670
|
-
async send(method, url, body, schema) {
|
|
2671
|
-
const response = await fetch(url, {
|
|
2672
|
-
method,
|
|
2673
|
-
headers: {
|
|
2674
|
-
accept: "application/json",
|
|
2675
|
-
...body === void 0 ? {} : { "content-type": "application/json" }
|
|
2676
|
-
},
|
|
2677
|
-
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
2678
|
-
});
|
|
2679
|
-
if (!response.ok) throw new Error(await errorMessage(response));
|
|
2680
|
-
if (schema === void 0) return void 0;
|
|
2681
|
-
const checked = checkDto(schema, await response.json());
|
|
2682
|
-
if (!checked.ok) throw new Error(`Unexpected answer at ${checked.field}: ${checked.message}`);
|
|
2683
|
-
return checked.value;
|
|
2670
|
+
await routeRequest(`${this.url}/${id}`, { method: "DELETE" });
|
|
2684
2671
|
}
|
|
2685
2672
|
};
|
|
2686
|
-
/** SvelteKit's `error()` answers `{ message }`; fall back to the status. */
|
|
2687
|
-
async function errorMessage(response) {
|
|
2688
|
-
const body = await response.json().catch(() => void 0);
|
|
2689
|
-
if (typeof body === "object" && body !== null && "message" in body) {
|
|
2690
|
-
const { message } = body;
|
|
2691
|
-
if (typeof message === "string") return message;
|
|
2692
|
-
}
|
|
2693
|
-
return `The request answered ${response.status}`;
|
|
2694
|
-
}
|
|
2695
2673
|
// src/lib/adapters/sse-speech-feed.ts
|
|
2696
2674
|
/** Entries read per request when an ended session is read page by page. */
|
|
2697
2675
|
var PAGE_SIZE = 1e3;
|
|
@@ -2740,14 +2718,7 @@ var SseSpeechFeed = class {
|
|
|
2740
2718
|
since: String(since),
|
|
2741
2719
|
limit: String(PAGE_SIZE)
|
|
2742
2720
|
});
|
|
2743
|
-
const
|
|
2744
|
-
headers: { accept: "application/json" },
|
|
2745
|
-
signal: abort.signal
|
|
2746
|
-
});
|
|
2747
|
-
if (!response.ok) throw new Error(`The request answered ${response.status}`);
|
|
2748
|
-
const checked = checkDto(SpeechListSchema, await response.json());
|
|
2749
|
-
if (!checked.ok) throw new Error(`Unexpected answer at ${checked.field}`);
|
|
2750
|
-
const { entries, hasMore } = checked.value;
|
|
2721
|
+
const { entries, hasMore } = await routeJson(`${this.speechUrl}?${query}`, { signal: abort.signal });
|
|
2751
2722
|
handlers.onEntries(entries);
|
|
2752
2723
|
const last = entries.at(-1);
|
|
2753
2724
|
if (!hasMore || last === void 0) return;
|
|
@@ -2767,12 +2738,8 @@ var HttpStatusApi = class {
|
|
|
2767
2738
|
constructor(url) {
|
|
2768
2739
|
this.url = url;
|
|
2769
2740
|
}
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
if (!response.ok) throw new Error(`The status request answered ${response.status}`);
|
|
2773
|
-
const checked = checkDto(StatusSchema, await response.json());
|
|
2774
|
-
if (!checked.ok) throw new Error(`Unexpected status at ${checked.field}: ${checked.message}`);
|
|
2775
|
-
return checked.value;
|
|
2741
|
+
fetch() {
|
|
2742
|
+
return routeJson(this.url);
|
|
2776
2743
|
}
|
|
2777
2744
|
};
|
|
2778
2745
|
// src/lib/core/sessions-pane.ts
|
|
@@ -2880,11 +2847,11 @@ function createSessionsStore(api) {
|
|
|
2880
2847
|
let loaded = false;
|
|
2881
2848
|
let now = Date.now();
|
|
2882
2849
|
let inFlight = null;
|
|
2883
|
-
function apply(list) {
|
|
2850
|
+
function apply(list, at = Date.now()) {
|
|
2884
2851
|
sessions = list.sessions;
|
|
2885
2852
|
currentId = list.currentId;
|
|
2886
2853
|
outsideEntries = list.outsideEntries;
|
|
2887
|
-
now =
|
|
2854
|
+
now = at;
|
|
2888
2855
|
loaded = true;
|
|
2889
2856
|
}
|
|
2890
2857
|
function read() {
|
|
@@ -2915,7 +2882,7 @@ function createSessionsStore(api) {
|
|
|
2915
2882
|
get outsideEntries() {
|
|
2916
2883
|
return outsideEntries;
|
|
2917
2884
|
},
|
|
2918
|
-
/** Whether a list has been applied yet
|
|
2885
|
+
/** Whether a list has been applied yet (the seed or a read). */
|
|
2919
2886
|
get loaded() {
|
|
2920
2887
|
return loaded;
|
|
2921
2888
|
},
|
|
@@ -2927,11 +2894,18 @@ function createSessionsStore(api) {
|
|
|
2927
2894
|
return now;
|
|
2928
2895
|
},
|
|
2929
2896
|
/**
|
|
2930
|
-
*
|
|
2931
|
-
*
|
|
2897
|
+
* Shows the list the page's load read (`now`: when it was read), before any request of its
|
|
2898
|
+
* own. Call it while the page renders, on the server too: the stores are per request, so the
|
|
2899
|
+
* server's HTML and the first browser render agree. Does nothing once a list is shown.
|
|
2932
2900
|
*/
|
|
2933
|
-
|
|
2934
|
-
if (
|
|
2901
|
+
seed(list, at) {
|
|
2902
|
+
if (list !== null && !loaded) apply(list, at);
|
|
2903
|
+
},
|
|
2904
|
+
/**
|
|
2905
|
+
* Reads the list and keeps it fresh. Call it in the browser only. Returns the function that
|
|
2906
|
+
* stops the timers (call it when the page goes away).
|
|
2907
|
+
*/
|
|
2908
|
+
init() {
|
|
2935
2909
|
read();
|
|
2936
2910
|
const tick = setInterval(() => {
|
|
2937
2911
|
if (currentId !== null) now = Date.now();
|
|
@@ -3123,12 +3097,32 @@ function createThemeStore(storage) {
|
|
|
3123
3097
|
}
|
|
3124
3098
|
// src/lib/composition.ts
|
|
3125
3099
|
/** Wires the adapters into the stores; components get the stores, never the adapters. */
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3100
|
+
function createAppStores() {
|
|
3101
|
+
return {
|
|
3102
|
+
theme: createThemeStore(new BrowserThemeStorage()),
|
|
3103
|
+
status: createStatusStore(new HttpStatusApi(resolve("/api/status"))),
|
|
3104
|
+
config: createConfigStore(new HttpConfigApi(resolve("/api/config"))),
|
|
3105
|
+
sessions: createSessionsStore(new HttpSessionsApi(resolve("/api/sessions"))),
|
|
3106
|
+
speech: createSpeechStore(new SseSpeechFeed(resolve("/api/speech/stream"), resolve("/api/speech")), new HttpSpeechApi(resolve("/api/markers"), resolve("/api/speech"))),
|
|
3107
|
+
sessionsPane: createSessionsPaneStore(new BrowserSessionsPaneStorage())
|
|
3108
|
+
};
|
|
3109
|
+
}
|
|
3110
|
+
/** The context key of the stores (component tests pass their own stores under it). */
|
|
3111
|
+
var APP_STORES = Symbol("app-stores");
|
|
3112
|
+
/**
|
|
3113
|
+
* Creates the stores of one app and hands them to the components below (the root layout calls it).
|
|
3114
|
+
* Not a module-level singleton: on the server every request renders its own app, and a store
|
|
3115
|
+
* shared by all of them would show one viewer's state to another.
|
|
3116
|
+
*/
|
|
3117
|
+
function provideAppStores() {
|
|
3118
|
+
return setContext(APP_STORES, createAppStores());
|
|
3119
|
+
}
|
|
3120
|
+
/** The stores {@link provideAppStores} created. Call it while a component initialises. */
|
|
3121
|
+
function appStores() {
|
|
3122
|
+
const stores = getContext(APP_STORES);
|
|
3123
|
+
if (stores === void 0) throw new Error("appStores() needs provideAppStores() in a parent");
|
|
3124
|
+
return stores;
|
|
3125
|
+
}
|
|
3126
|
+
export { e$3 as A, t as C, E as D, B as E, t$3 as F, __decorate as I, r$1 as M, n$2 as N, T as O, i$4 as P, i$1 as S, A as T, i as _, canDeleteSession as a, e as b, THEMES as c, mixinFormAssociated as d, internals as f, mixinDelegatesAria as g, setupDispatchHooks as h, canClearSpeech as i, e$4 as j, Z as k, mixinFormSubmitter as l, afterDispatch as m, provideAppStores as n, formatReceivedTime as o, mixinElementInternals as p, canAddMarker as r, logHeading as s, appStores as t, getFormValue as u, u as v, i$2 as w, e$1 as x, EASING as y };
|
|
3133
3127
|
|
|
3134
3128
|
//# sourceMappingURL=composition.js.map
|