screenreader-speech-capture 0.2.0 → 0.4.0-fix-bundle-material-web.12
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/dist/cli.mjs +15 -5
- package/dist/ui/adapter-node.js +4 -4
- package/dist/ui/client/ui/_app/immutable/assets/0.Ck1JiV_4.css +1 -0
- package/dist/ui/client/ui/_app/immutable/assets/0.Ck1JiV_4.css.br +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/0.Ck1JiV_4.css.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/2.CnRjX9ZG.css +1 -0
- package/dist/ui/client/ui/_app/immutable/assets/2.CnRjX9ZG.css.br +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/2.CnRjX9ZG.css.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/material-symbols-outlined-latin-400-normal.BhEvR8fk.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-cyrillic-ext-opsz-normal.nDQikIyu.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-cyrillic-opsz-normal.SjuC5rw5.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-greek-opsz-normal.C14fFRny.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-latin-ext-opsz-normal.xNclTVCo.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-latin-opsz-normal.hy8fyBBC.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-flex-vietnamese-opsz-normal.C-H_yGOU.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-400-normal.B3hIXASd.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-400-normal.C-_K-ZCn.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-500-normal.DGZ7-lUP.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-500-normal.NpUJFYX7.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-ext-400-normal.BHxv52bw.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-ext-400-normal.W26xs1TL.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-ext-500-normal.6xdwlG7p.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-cyrillic-ext-500-normal.DC57U9n8.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-greek-400-normal.CH_u3Aru.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-greek-400-normal.P8xe1gs1.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-greek-500-normal.C2M8jX6G.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-greek-500-normal.DpRFkptA.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-400-normal.DBZPkcnn.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-400-normal.GekRknry.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-500-normal.D6j6AMzd.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-500-normal.pxIOXZmA.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-ext-400-normal.BwLXVYNz.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-ext-400-normal.DLAV9S_w.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-ext-500-normal.B1IjfbhL.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-latin-ext-500-normal.Db3ge6Oe.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-vietnamese-400-normal.CzWHQABp.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-vietnamese-400-normal.yYTFiTTs.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-vietnamese-500-normal.Cq-quQMu.woff2 +0 -0
- package/dist/ui/client/ui/_app/immutable/assets/roboto-mono-vietnamese-500-normal.IxzxMIj7.woff +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BaD2EyfF.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BaD2EyfF.js.br +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/BaD2EyfF.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CcBdu3S8.js +3 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CcBdu3S8.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/CcBdu3S8.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DbiAGPgw.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DbiAGPgw.js.br +2 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DbiAGPgw.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dg9MaatX.js +1 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dg9MaatX.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/Dg9MaatX.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DvmLiMpQ.js +3 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DvmLiMpQ.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/DvmLiMpQ.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/WKeSQOEM.js +37 -0
- package/dist/ui/client/ui/_app/immutable/chunks/WKeSQOEM.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/chunks/WKeSQOEM.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.DWG4jy_K.js +2 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.DWG4jy_K.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/app.DWG4jy_K.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.BHpKgjPx.js +2 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.BHpKgjPx.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/entry/start.BHpKgjPx.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.BHaQjZME.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.BHaQjZME.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/0.BHaQjZME.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.Bd-KoKuj.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.Bd-KoKuj.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/1.Bd-KoKuj.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.DnTpD-Gs.js +224 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.DnTpD-Gs.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/2.DnTpD-Gs.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.CsdEJLWJ.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.CsdEJLWJ.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/3.CsdEJLWJ.js.gz +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.CXVi2Rvi.js +1 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.CXVi2Rvi.js.br +0 -0
- package/dist/ui/client/ui/_app/immutable/nodes/4.CXVi2Rvi.js.gz +0 -0
- package/dist/ui/client/ui/_app/version.json +1 -0
- 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 +269 -4
- package/dist/ui/server/_app/immutable/assets/_layout.Ck1JiV_4.css +1 -0
- package/dist/ui/server/_app/immutable/assets/_page.CnRjX9ZG.css +1 -0
- package/dist/ui/server/_app/immutable/assets/material-symbols-outlined-latin-400-normal.BhEvR8fk.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-flex-cyrillic-ext-opsz-normal.nDQikIyu.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-flex-cyrillic-opsz-normal.SjuC5rw5.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-flex-greek-opsz-normal.C14fFRny.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-flex-latin-ext-opsz-normal.xNclTVCo.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-flex-latin-opsz-normal.hy8fyBBC.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-flex-vietnamese-opsz-normal.C-H_yGOU.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-400-normal.B3hIXASd.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-400-normal.C-_K-ZCn.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-500-normal.DGZ7-lUP.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-500-normal.NpUJFYX7.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-ext-400-normal.BHxv52bw.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-ext-400-normal.W26xs1TL.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-ext-500-normal.6xdwlG7p.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-cyrillic-ext-500-normal.DC57U9n8.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-greek-400-normal.CH_u3Aru.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-greek-400-normal.P8xe1gs1.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-greek-500-normal.C2M8jX6G.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-greek-500-normal.DpRFkptA.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-400-normal.DBZPkcnn.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-400-normal.GekRknry.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-500-normal.D6j6AMzd.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-500-normal.pxIOXZmA.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-ext-400-normal.BwLXVYNz.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-ext-400-normal.DLAV9S_w.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-ext-500-normal.B1IjfbhL.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-latin-ext-500-normal.Db3ge6Oe.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-vietnamese-400-normal.CzWHQABp.woff +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-vietnamese-400-normal.yYTFiTTs.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-vietnamese-500-normal.Cq-quQMu.woff2 +0 -0
- package/dist/ui/server/_app/immutable/assets/roboto-mono-vietnamese-500-normal.IxzxMIj7.woff +0 -0
- package/dist/ui/server/chunks/bridge-api.js +61 -0
- package/dist/ui/server/chunks/bridge-api.js.map +1 -0
- package/dist/ui/server/chunks/composition.js +2916 -0
- package/dist/ui/server/chunks/composition.js.map +1 -0
- package/dist/ui/server/chunks/exports.js +69 -1
- package/dist/ui/server/chunks/exports.js.map +1 -1
- package/dist/ui/server/chunks/instance.js +20 -26
- package/dist/ui/server/chunks/instance.js.map +1 -1
- package/dist/ui/server/chunks/internal.js +102 -7
- package/dist/ui/server/chunks/internal.js.map +1 -1
- package/dist/ui/server/chunks/navigation.js +15 -0
- package/dist/ui/server/chunks/navigation.js.map +1 -0
- package/dist/ui/server/chunks/server2.js +30 -1
- package/dist/ui/server/chunks/server2.js.map +1 -1
- package/dist/ui/server/chunks/src.js +968 -0
- package/dist/ui/server/chunks/src.js.map +1 -0
- package/dist/ui/server/chunks/state.js +38 -0
- package/dist/ui/server/chunks/state.js.map +1 -0
- package/dist/ui/server/entries/endpoints/api/sessions/_server.ts.js +18 -0
- package/dist/ui/server/entries/endpoints/api/sessions/_server.ts.js.map +1 -0
- package/dist/ui/server/entries/endpoints/api/sessions/end/_server.ts.js +10 -0
- package/dist/ui/server/entries/endpoints/api/sessions/end/_server.ts.js.map +1 -0
- package/dist/ui/server/entries/endpoints/api/status/_server.ts.js +10 -0
- package/dist/ui/server/entries/endpoints/api/status/_server.ts.js.map +1 -0
- package/dist/ui/server/entries/fallbacks/error.svelte.js +2 -35
- package/dist/ui/server/entries/fallbacks/error.svelte.js.map +1 -1
- package/dist/ui/server/entries/pages/_layout.server.ts.js +5 -980
- package/dist/ui/server/entries/pages/_layout.server.ts.js.map +1 -1
- package/dist/ui/server/entries/pages/_layout.svelte.js +192 -7
- package/dist/ui/server/entries/pages/_layout.svelte.js.map +1 -1
- package/dist/ui/server/entries/pages/_page.server.ts.js +18 -0
- package/dist/ui/server/entries/pages/_page.server.ts.js.map +1 -0
- package/dist/ui/server/entries/pages/_page.svelte.js +2634 -2
- package/dist/ui/server/entries/pages/_page.svelte.js.map +1 -1
- package/dist/ui/server/entries/pages/settings/_page.svelte.js +8 -0
- package/dist/ui/server/entries/pages/settings/_page.svelte.js.map +1 -0
- package/dist/ui/server/entries/pages/setup/_page.svelte.js +8 -0
- package/dist/ui/server/entries/pages/setup/_page.svelte.js.map +1 -0
- package/dist/ui/server/index.js +2 -2
- package/dist/ui/server/manifest-full.js +40 -3
- package/dist/ui/server/manifest.js +40 -3
- package/dist/ui/server/nodes/0.js +3 -3
- package/dist/ui/server/nodes/1.js +1 -1
- package/dist/ui/server/nodes/2.js +5 -3
- package/dist/ui/server/nodes/3.js +8 -0
- package/dist/ui/server/nodes/4.js +8 -0
- package/dist/ui/server/remote-entry.js +3 -3
- package/dist/ui/server/remote-entry.js.map +1 -1
- package/dist/ui/server/server.js +40 -3
- package/package.json +1 -1
- package/dist/ui/client/_app/immutable/chunks/BMrJcSB7.js +0 -3
- package/dist/ui/client/_app/immutable/chunks/BMrJcSB7.js.br +0 -0
- package/dist/ui/client/_app/immutable/chunks/BMrJcSB7.js.gz +0 -0
- package/dist/ui/client/_app/immutable/chunks/BueZJg5y.js +0 -2
- package/dist/ui/client/_app/immutable/chunks/BueZJg5y.js.br +0 -0
- package/dist/ui/client/_app/immutable/chunks/BueZJg5y.js.gz +0 -0
- package/dist/ui/client/_app/immutable/chunks/ZzrMKdp0.js +0 -1
- package/dist/ui/client/_app/immutable/chunks/ZzrMKdp0.js.br +0 -0
- package/dist/ui/client/_app/immutable/chunks/ZzrMKdp0.js.gz +0 -0
- package/dist/ui/client/_app/immutable/entry/app.BGREpuCm.js +0 -2
- package/dist/ui/client/_app/immutable/entry/app.BGREpuCm.js.br +0 -0
- package/dist/ui/client/_app/immutable/entry/app.BGREpuCm.js.gz +0 -0
- package/dist/ui/client/_app/immutable/entry/start.Bj3y6VYi.js +0 -2
- package/dist/ui/client/_app/immutable/entry/start.Bj3y6VYi.js.br +0 -0
- package/dist/ui/client/_app/immutable/entry/start.Bj3y6VYi.js.gz +0 -0
- package/dist/ui/client/_app/immutable/nodes/0.BdmtdjrF.js +0 -1
- package/dist/ui/client/_app/immutable/nodes/0.BdmtdjrF.js.br +0 -0
- package/dist/ui/client/_app/immutable/nodes/0.BdmtdjrF.js.gz +0 -0
- package/dist/ui/client/_app/immutable/nodes/1.B76I_t5U.js +0 -1
- package/dist/ui/client/_app/immutable/nodes/1.B76I_t5U.js.br +0 -0
- package/dist/ui/client/_app/immutable/nodes/1.B76I_t5U.js.gz +0 -0
- package/dist/ui/client/_app/immutable/nodes/2.CpNTEXmI.js +0 -1
- package/dist/ui/client/_app/immutable/nodes/2.CpNTEXmI.js.br +0 -0
- package/dist/ui/client/_app/immutable/nodes/2.CpNTEXmI.js.gz +0 -0
- package/dist/ui/client/_app/version.json +0 -1
- package/dist/ui/client/_app/version.json.br +0 -0
- package/dist/ui/client/_app/version.json.gz +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/chunks/Bjy-W4x2.js +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/chunks/Bjy-W4x2.js.br +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/chunks/Bjy-W4x2.js.gz +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/chunks/DclECHGd.js +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/chunks/DclECHGd.js.br +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/chunks/DclECHGd.js.gz +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/entry/payload.DSmR2FwN.js +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/entry/payload.DSmR2FwN.js.br +0 -0
- /package/dist/ui/client/{_app → ui/_app}/immutable/entry/payload.DSmR2FwN.js.gz +0 -0
- /package/dist/ui/client/{robots.txt → ui/robots.txt} +0 -0
- /package/dist/ui/client/{robots.txt.br → ui/robots.txt.br} +0 -0
- /package/dist/ui/client/{robots.txt.gz → ui/robots.txt.gz} +0 -0
|
@@ -1,987 +1,12 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
var API_PREFIX = "/api/v1";
|
|
5
|
-
var DEFAULT_CONFIG = {
|
|
6
|
-
lang: void 0,
|
|
7
|
-
message: void 0,
|
|
8
|
-
abortEarly: void 0,
|
|
9
|
-
abortPipeEarly: void 0
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Returns the global configuration.
|
|
13
|
-
*
|
|
14
|
-
* @param config The config to merge.
|
|
15
|
-
*
|
|
16
|
-
* @returns The configuration.
|
|
17
|
-
*/
|
|
18
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
19
|
-
function getGlobalConfig(config$1) {
|
|
20
|
-
if (!config$1 && true) return DEFAULT_CONFIG;
|
|
21
|
-
return {
|
|
22
|
-
lang: config$1?.lang ?? void 0,
|
|
23
|
-
message: config$1?.message,
|
|
24
|
-
abortEarly: config$1?.abortEarly ?? void 0,
|
|
25
|
-
abortPipeEarly: config$1?.abortPipeEarly ?? void 0
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Stringifies an unknown input to a literal or type string.
|
|
30
|
-
*
|
|
31
|
-
* @param input The unknown input.
|
|
32
|
-
*
|
|
33
|
-
* @returns A literal or type string.
|
|
34
|
-
*
|
|
35
|
-
* @internal
|
|
36
|
-
*/
|
|
37
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
38
|
-
function _stringify(input) {
|
|
39
|
-
const type = typeof input;
|
|
40
|
-
if (type === "string") return `"${input}"`;
|
|
41
|
-
if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
|
|
42
|
-
if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
43
|
-
return type;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Adds an issue to the dataset.
|
|
47
|
-
*
|
|
48
|
-
* @param context The issue context.
|
|
49
|
-
* @param label The issue label.
|
|
50
|
-
* @param dataset The input dataset.
|
|
51
|
-
* @param config The configuration.
|
|
52
|
-
* @param other The optional props.
|
|
53
|
-
*
|
|
54
|
-
* @internal
|
|
55
|
-
*/
|
|
56
|
-
function _addIssue(context, label, dataset, config$1, other) {
|
|
57
|
-
const input = other && "input" in other ? other.input : dataset.value;
|
|
58
|
-
const expected = other?.expected ?? context.expects ?? null;
|
|
59
|
-
const received = other?.received ?? /* @__PURE__ */ _stringify(input);
|
|
60
|
-
const issue = {
|
|
61
|
-
kind: context.kind,
|
|
62
|
-
type: context.type,
|
|
63
|
-
input,
|
|
64
|
-
expected,
|
|
65
|
-
received,
|
|
66
|
-
message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
|
|
67
|
-
requirement: context.requirement,
|
|
68
|
-
path: other?.path,
|
|
69
|
-
issues: other?.issues,
|
|
70
|
-
lang: config$1.lang,
|
|
71
|
-
abortEarly: config$1.abortEarly,
|
|
72
|
-
abortPipeEarly: config$1.abortPipeEarly
|
|
73
|
-
};
|
|
74
|
-
const isSchema = context.kind === "schema";
|
|
75
|
-
const message$1 = other?.message ?? context.message ?? (context.reference, issue.lang, void 0) ?? (isSchema ? (issue.lang, void 0) : null) ?? config$1.message ?? (issue.lang, void 0);
|
|
76
|
-
if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;
|
|
77
|
-
if (isSchema) dataset.typed = false;
|
|
78
|
-
if (dataset.issues) dataset.issues.push(issue);
|
|
79
|
-
else dataset.issues = [issue];
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Disallows inherited object properties and prevents object prototype
|
|
83
|
-
* pollution by disallowing certain keys.
|
|
84
|
-
*
|
|
85
|
-
* @param object The object to check.
|
|
86
|
-
* @param key The key to check.
|
|
87
|
-
*
|
|
88
|
-
* @returns Whether the key is allowed.
|
|
89
|
-
*
|
|
90
|
-
* @internal
|
|
91
|
-
*/
|
|
92
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
93
|
-
function _isValidObjectKey(object$1, key) {
|
|
94
|
-
return Object.prototype.hasOwnProperty.call(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Joins multiple `expects` values with the given separator.
|
|
98
|
-
*
|
|
99
|
-
* @param values The `expects` values.
|
|
100
|
-
* @param separator The separator.
|
|
101
|
-
*
|
|
102
|
-
* @returns The joined `expects` property.
|
|
103
|
-
*
|
|
104
|
-
* @internal
|
|
105
|
-
*/
|
|
106
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
107
|
-
function _joinExpects(values$1, separator) {
|
|
108
|
-
const list = [...new Set(values$1)];
|
|
109
|
-
if (list.length > 1) return `(${list.join(` ${separator} `)})`;
|
|
110
|
-
return list[0] ?? "never";
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Eagerly creates and attaches the Standard Schema properties of a schema.
|
|
114
|
-
*
|
|
115
|
-
* Hint: The contextual `this` type includes the standard properties that are
|
|
116
|
-
* attached before the schema is returned.
|
|
117
|
-
*
|
|
118
|
-
* @param schema The schema to attach standard properties to.
|
|
119
|
-
*
|
|
120
|
-
* @returns The schema with standard properties attached.
|
|
121
|
-
*
|
|
122
|
-
* @internal
|
|
123
|
-
*/
|
|
124
|
-
function _standardSchema(schema) {
|
|
125
|
-
schema["~standard"] = {
|
|
126
|
-
version: 1,
|
|
127
|
-
vendor: "valibot",
|
|
128
|
-
validate: (value$1) => schema["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig())
|
|
129
|
-
};
|
|
130
|
-
return schema;
|
|
131
|
-
}
|
|
132
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
133
|
-
function getDotPath(issue) {
|
|
134
|
-
if (issue.path) {
|
|
135
|
-
let key = "";
|
|
136
|
-
for (const item of issue.path) if (typeof item.key === "string" || typeof item.key === "number") if (key) key += `.${item.key}`;
|
|
137
|
-
else key += item.key;
|
|
138
|
-
else return null;
|
|
139
|
-
return key;
|
|
140
|
-
}
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp regex. Allows a
|
|
145
|
-
* space as a date/time separator and an optional space before the UTC offset.
|
|
146
|
-
*/
|
|
147
|
-
var ISO_TIMESTAMP_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])[T ](?:0\d|1\d|2[0-3])(?::[0-5]\d){2}(?:\.\d{1,9})?(?:Z| ?[+-](?:0\d|1\d|2[0-3])(?::?[0-5]\d)?)$/u;
|
|
148
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
149
|
-
function check(requirement, message$1) {
|
|
150
|
-
return {
|
|
151
|
-
kind: "validation",
|
|
152
|
-
type: "check",
|
|
153
|
-
reference: check,
|
|
154
|
-
async: false,
|
|
155
|
-
expects: null,
|
|
156
|
-
requirement,
|
|
157
|
-
message: message$1,
|
|
158
|
-
"~run"(dataset, config$1) {
|
|
159
|
-
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);
|
|
160
|
-
return dataset;
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Creates a description metadata action.
|
|
166
|
-
*
|
|
167
|
-
* @param description_ The description text.
|
|
168
|
-
*
|
|
169
|
-
* @returns A description action.
|
|
170
|
-
*/
|
|
171
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
172
|
-
function description(description_) {
|
|
173
|
-
return {
|
|
174
|
-
kind: "metadata",
|
|
175
|
-
type: "description",
|
|
176
|
-
reference: description,
|
|
177
|
-
description: description_
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Creates an examples metadata action.
|
|
182
|
-
*
|
|
183
|
-
* @param examples_ The examples.
|
|
184
|
-
*
|
|
185
|
-
* @returns An examples action.
|
|
186
|
-
*
|
|
187
|
-
* @beta
|
|
188
|
-
*/
|
|
189
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
190
|
-
function examples(examples_) {
|
|
191
|
-
return {
|
|
192
|
-
kind: "metadata",
|
|
193
|
-
type: "examples",
|
|
194
|
-
reference: examples,
|
|
195
|
-
examples: examples_
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
199
|
-
function integer$3(message$1) {
|
|
200
|
-
return {
|
|
201
|
-
kind: "validation",
|
|
202
|
-
type: "integer",
|
|
203
|
-
reference: integer$3,
|
|
204
|
-
async: false,
|
|
205
|
-
expects: null,
|
|
206
|
-
requirement: Number.isInteger,
|
|
207
|
-
message: message$1,
|
|
208
|
-
"~run"(dataset, config$1) {
|
|
209
|
-
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "integer", dataset, config$1);
|
|
210
|
-
return dataset;
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
215
|
-
function isoTimestamp(message$1) {
|
|
216
|
-
return {
|
|
217
|
-
kind: "validation",
|
|
218
|
-
type: "iso_timestamp",
|
|
219
|
-
reference: isoTimestamp,
|
|
220
|
-
async: false,
|
|
221
|
-
expects: null,
|
|
222
|
-
requirement: ISO_TIMESTAMP_REGEX,
|
|
223
|
-
message: message$1,
|
|
224
|
-
"~run"(dataset, config$1) {
|
|
225
|
-
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "timestamp", dataset, config$1);
|
|
226
|
-
return dataset;
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
231
|
-
function maxValue(requirement, message$1) {
|
|
232
|
-
return {
|
|
233
|
-
kind: "validation",
|
|
234
|
-
type: "max_value",
|
|
235
|
-
reference: maxValue,
|
|
236
|
-
async: false,
|
|
237
|
-
expects: `<=${requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement)}`,
|
|
238
|
-
requirement,
|
|
239
|
-
message: message$1,
|
|
240
|
-
"~run"(dataset, config$1) {
|
|
241
|
-
if (dataset.typed && !(dataset.value <= this.requirement)) _addIssue(this, "value", dataset, config$1, { received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value) });
|
|
242
|
-
return dataset;
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
247
|
-
function minValue(requirement, message$1) {
|
|
248
|
-
return {
|
|
249
|
-
kind: "validation",
|
|
250
|
-
type: "min_value",
|
|
251
|
-
reference: minValue,
|
|
252
|
-
async: false,
|
|
253
|
-
expects: `>=${requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement)}`,
|
|
254
|
-
requirement,
|
|
255
|
-
message: message$1,
|
|
256
|
-
"~run"(dataset, config$1) {
|
|
257
|
-
if (dataset.typed && !(dataset.value >= this.requirement)) _addIssue(this, "value", dataset, config$1, { received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value) });
|
|
258
|
-
return dataset;
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
263
|
-
function regex(requirement, message$1) {
|
|
264
|
-
return {
|
|
265
|
-
kind: "validation",
|
|
266
|
-
type: "regex",
|
|
267
|
-
reference: regex,
|
|
268
|
-
async: false,
|
|
269
|
-
expects: `${requirement}`,
|
|
270
|
-
requirement,
|
|
271
|
-
message: message$1,
|
|
272
|
-
"~run"(dataset, config$1) {
|
|
273
|
-
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "format", dataset, config$1);
|
|
274
|
-
return dataset;
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Returns the fallback value of the schema.
|
|
280
|
-
*
|
|
281
|
-
* @param schema The schema to get it from.
|
|
282
|
-
* @param dataset The output dataset if available.
|
|
283
|
-
* @param config The config if available.
|
|
284
|
-
*
|
|
285
|
-
* @returns The fallback value.
|
|
286
|
-
*/
|
|
287
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
288
|
-
function getFallback(schema, dataset, config$1) {
|
|
289
|
-
return typeof schema.fallback === "function" ? schema.fallback(dataset, config$1) : schema.fallback;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Returns the default value of the schema.
|
|
293
|
-
*
|
|
294
|
-
* @param schema The schema to get it from.
|
|
295
|
-
* @param dataset The input dataset if available.
|
|
296
|
-
* @param config The config if available.
|
|
297
|
-
*
|
|
298
|
-
* @returns The default value.
|
|
299
|
-
*/
|
|
300
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
301
|
-
function getDefault(schema, dataset, config$1) {
|
|
302
|
-
return typeof schema.default === "function" ? schema.default(dataset, config$1) : schema.default;
|
|
303
|
-
}
|
|
304
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
305
|
-
function array(item, message$1) {
|
|
306
|
-
return _standardSchema({
|
|
307
|
-
kind: "schema",
|
|
308
|
-
type: "array",
|
|
309
|
-
reference: array,
|
|
310
|
-
expects: "Array",
|
|
311
|
-
async: false,
|
|
312
|
-
item,
|
|
313
|
-
message: message$1,
|
|
314
|
-
"~run"(dataset, config$1) {
|
|
315
|
-
const input = dataset.value;
|
|
316
|
-
if (Array.isArray(input)) {
|
|
317
|
-
dataset.typed = true;
|
|
318
|
-
dataset.value = [];
|
|
319
|
-
for (let key = 0; key < input.length; key++) {
|
|
320
|
-
const value$1 = input[key];
|
|
321
|
-
const itemDataset = this.item["~run"]({ value: value$1 }, config$1);
|
|
322
|
-
if (itemDataset.issues) {
|
|
323
|
-
const pathItem = {
|
|
324
|
-
type: "array",
|
|
325
|
-
origin: "value",
|
|
326
|
-
input,
|
|
327
|
-
key,
|
|
328
|
-
value: value$1
|
|
329
|
-
};
|
|
330
|
-
for (const issue of itemDataset.issues) {
|
|
331
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
332
|
-
else issue.path = [pathItem];
|
|
333
|
-
dataset.issues?.push(issue);
|
|
334
|
-
}
|
|
335
|
-
if (!dataset.issues) dataset.issues = itemDataset.issues;
|
|
336
|
-
if (config$1.abortEarly) {
|
|
337
|
-
dataset.typed = false;
|
|
338
|
-
break;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
if (!itemDataset.typed) dataset.typed = false;
|
|
342
|
-
dataset.value.push(itemDataset.value);
|
|
343
|
-
}
|
|
344
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
345
|
-
return dataset;
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
350
|
-
function boolean(message$1) {
|
|
351
|
-
return _standardSchema({
|
|
352
|
-
kind: "schema",
|
|
353
|
-
type: "boolean",
|
|
354
|
-
reference: boolean,
|
|
355
|
-
expects: "boolean",
|
|
356
|
-
async: false,
|
|
357
|
-
message: message$1,
|
|
358
|
-
"~run"(dataset, config$1) {
|
|
359
|
-
if (typeof dataset.value === "boolean") dataset.typed = true;
|
|
360
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
361
|
-
return dataset;
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
366
|
-
function nullable(wrapped, default_) {
|
|
367
|
-
return _standardSchema({
|
|
368
|
-
kind: "schema",
|
|
369
|
-
type: "nullable",
|
|
370
|
-
reference: nullable,
|
|
371
|
-
expects: `(${wrapped.expects} | null)`,
|
|
372
|
-
async: false,
|
|
373
|
-
wrapped,
|
|
374
|
-
default: default_,
|
|
375
|
-
"~run"(dataset, config$1) {
|
|
376
|
-
if (dataset.value === null) {
|
|
377
|
-
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
378
|
-
if (dataset.value === null) {
|
|
379
|
-
dataset.typed = true;
|
|
380
|
-
return dataset;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
return this.wrapped["~run"](dataset, config$1);
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
388
|
-
function number(message$1) {
|
|
389
|
-
return _standardSchema({
|
|
390
|
-
kind: "schema",
|
|
391
|
-
type: "number",
|
|
392
|
-
reference: number,
|
|
393
|
-
expects: "number",
|
|
394
|
-
async: false,
|
|
395
|
-
message: message$1,
|
|
396
|
-
"~run"(dataset, config$1) {
|
|
397
|
-
if (typeof dataset.value === "number" && !isNaN(dataset.value)) dataset.typed = true;
|
|
398
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
399
|
-
return dataset;
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
404
|
-
function object(entries$1, message$1) {
|
|
405
|
-
return _standardSchema({
|
|
406
|
-
kind: "schema",
|
|
407
|
-
type: "object",
|
|
408
|
-
reference: object,
|
|
409
|
-
expects: "Object",
|
|
410
|
-
async: false,
|
|
411
|
-
entries: entries$1,
|
|
412
|
-
message: message$1,
|
|
413
|
-
"~run"(dataset, config$1) {
|
|
414
|
-
const input = dataset.value;
|
|
415
|
-
if (input && typeof input === "object") {
|
|
416
|
-
dataset.typed = true;
|
|
417
|
-
dataset.value = {};
|
|
418
|
-
for (const key in this.entries) {
|
|
419
|
-
const valueSchema = this.entries[key];
|
|
420
|
-
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
421
|
-
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
422
|
-
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
423
|
-
if (valueDataset.issues) {
|
|
424
|
-
const pathItem = {
|
|
425
|
-
type: "object",
|
|
426
|
-
origin: "value",
|
|
427
|
-
input,
|
|
428
|
-
key,
|
|
429
|
-
value: value$1
|
|
430
|
-
};
|
|
431
|
-
for (const issue of valueDataset.issues) {
|
|
432
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
433
|
-
else issue.path = [pathItem];
|
|
434
|
-
dataset.issues?.push(issue);
|
|
435
|
-
}
|
|
436
|
-
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
437
|
-
if (config$1.abortEarly) {
|
|
438
|
-
dataset.typed = false;
|
|
439
|
-
break;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
if (!valueDataset.typed) dataset.typed = false;
|
|
443
|
-
dataset.value[key] = valueDataset.value;
|
|
444
|
-
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
445
|
-
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
446
|
-
_addIssue(this, "key", dataset, config$1, {
|
|
447
|
-
input: void 0,
|
|
448
|
-
expected: `"${key}"`,
|
|
449
|
-
path: [{
|
|
450
|
-
type: "object",
|
|
451
|
-
origin: "key",
|
|
452
|
-
input,
|
|
453
|
-
key,
|
|
454
|
-
value: input[key]
|
|
455
|
-
}]
|
|
456
|
-
});
|
|
457
|
-
if (config$1.abortEarly) break;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
461
|
-
return dataset;
|
|
462
|
-
}
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
466
|
-
function optional(wrapped, default_) {
|
|
467
|
-
return _standardSchema({
|
|
468
|
-
kind: "schema",
|
|
469
|
-
type: "optional",
|
|
470
|
-
reference: optional,
|
|
471
|
-
expects: `(${wrapped.expects} | undefined)`,
|
|
472
|
-
async: false,
|
|
473
|
-
wrapped,
|
|
474
|
-
default: default_,
|
|
475
|
-
"~run"(dataset, config$1) {
|
|
476
|
-
if (dataset.value === void 0) {
|
|
477
|
-
if (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);
|
|
478
|
-
if (dataset.value === void 0) {
|
|
479
|
-
dataset.typed = true;
|
|
480
|
-
return dataset;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
return this.wrapped["~run"](dataset, config$1);
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
488
|
-
function picklist(options, message$1) {
|
|
489
|
-
return _standardSchema({
|
|
490
|
-
kind: "schema",
|
|
491
|
-
type: "picklist",
|
|
492
|
-
reference: picklist,
|
|
493
|
-
expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
|
|
494
|
-
async: false,
|
|
495
|
-
options,
|
|
496
|
-
message: message$1,
|
|
497
|
-
"~run"(dataset, config$1) {
|
|
498
|
-
if (this.options.includes(dataset.value)) dataset.typed = true;
|
|
499
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
500
|
-
return dataset;
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
505
|
-
function record(key, value$1, message$1) {
|
|
506
|
-
return _standardSchema({
|
|
507
|
-
kind: "schema",
|
|
508
|
-
type: "record",
|
|
509
|
-
reference: record,
|
|
510
|
-
expects: "Object",
|
|
511
|
-
async: false,
|
|
512
|
-
key,
|
|
513
|
-
value: value$1,
|
|
514
|
-
message: message$1,
|
|
515
|
-
"~run"(dataset, config$1) {
|
|
516
|
-
const input = dataset.value;
|
|
517
|
-
if (input && typeof input === "object") {
|
|
518
|
-
dataset.typed = true;
|
|
519
|
-
dataset.value = {};
|
|
520
|
-
for (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
|
|
521
|
-
const entryValue = input[entryKey];
|
|
522
|
-
const keyDataset = this.key["~run"]({ value: entryKey }, config$1);
|
|
523
|
-
if (keyDataset.issues) {
|
|
524
|
-
const pathItem = {
|
|
525
|
-
type: "object",
|
|
526
|
-
origin: "key",
|
|
527
|
-
input,
|
|
528
|
-
key: entryKey,
|
|
529
|
-
value: entryValue
|
|
530
|
-
};
|
|
531
|
-
for (const issue of keyDataset.issues) {
|
|
532
|
-
issue.path = [pathItem];
|
|
533
|
-
dataset.issues?.push(issue);
|
|
534
|
-
}
|
|
535
|
-
if (!dataset.issues) dataset.issues = keyDataset.issues;
|
|
536
|
-
if (config$1.abortEarly) {
|
|
537
|
-
dataset.typed = false;
|
|
538
|
-
break;
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
const valueDataset = this.value["~run"]({ value: entryValue }, config$1);
|
|
542
|
-
if (valueDataset.issues) {
|
|
543
|
-
const pathItem = {
|
|
544
|
-
type: "object",
|
|
545
|
-
origin: "value",
|
|
546
|
-
input,
|
|
547
|
-
key: entryKey,
|
|
548
|
-
value: entryValue
|
|
549
|
-
};
|
|
550
|
-
for (const issue of valueDataset.issues) {
|
|
551
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
552
|
-
else issue.path = [pathItem];
|
|
553
|
-
dataset.issues?.push(issue);
|
|
554
|
-
}
|
|
555
|
-
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
556
|
-
if (config$1.abortEarly) {
|
|
557
|
-
dataset.typed = false;
|
|
558
|
-
break;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
if (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;
|
|
562
|
-
if (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;
|
|
563
|
-
}
|
|
564
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
565
|
-
return dataset;
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
570
|
-
function strictObject(entries$1, message$1) {
|
|
571
|
-
return _standardSchema({
|
|
572
|
-
kind: "schema",
|
|
573
|
-
type: "strict_object",
|
|
574
|
-
reference: strictObject,
|
|
575
|
-
expects: "Object",
|
|
576
|
-
async: false,
|
|
577
|
-
entries: entries$1,
|
|
578
|
-
message: message$1,
|
|
579
|
-
"~run"(dataset, config$1) {
|
|
580
|
-
const input = dataset.value;
|
|
581
|
-
if (input && typeof input === "object") {
|
|
582
|
-
dataset.typed = true;
|
|
583
|
-
dataset.value = {};
|
|
584
|
-
for (const key in this.entries) {
|
|
585
|
-
const valueSchema = this.entries[key];
|
|
586
|
-
if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
|
|
587
|
-
const value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);
|
|
588
|
-
const valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
|
|
589
|
-
if (valueDataset.issues) {
|
|
590
|
-
const pathItem = {
|
|
591
|
-
type: "object",
|
|
592
|
-
origin: "value",
|
|
593
|
-
input,
|
|
594
|
-
key,
|
|
595
|
-
value: value$1
|
|
596
|
-
};
|
|
597
|
-
for (const issue of valueDataset.issues) {
|
|
598
|
-
if (issue.path) issue.path.unshift(pathItem);
|
|
599
|
-
else issue.path = [pathItem];
|
|
600
|
-
dataset.issues?.push(issue);
|
|
601
|
-
}
|
|
602
|
-
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
603
|
-
if (config$1.abortEarly) {
|
|
604
|
-
dataset.typed = false;
|
|
605
|
-
break;
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
if (!valueDataset.typed) dataset.typed = false;
|
|
609
|
-
dataset.value[key] = valueDataset.value;
|
|
610
|
-
} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
|
|
611
|
-
else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
|
|
612
|
-
_addIssue(this, "key", dataset, config$1, {
|
|
613
|
-
input: void 0,
|
|
614
|
-
expected: `"${key}"`,
|
|
615
|
-
path: [{
|
|
616
|
-
type: "object",
|
|
617
|
-
origin: "key",
|
|
618
|
-
input,
|
|
619
|
-
key,
|
|
620
|
-
value: input[key]
|
|
621
|
-
}]
|
|
622
|
-
});
|
|
623
|
-
if (config$1.abortEarly) break;
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
if (!dataset.issues || !config$1.abortEarly) {
|
|
627
|
-
for (const key in input) if (!Object.prototype.hasOwnProperty.call(this.entries, key)) {
|
|
628
|
-
_addIssue(this, "key", dataset, config$1, {
|
|
629
|
-
input: key,
|
|
630
|
-
expected: "never",
|
|
631
|
-
path: [{
|
|
632
|
-
type: "object",
|
|
633
|
-
origin: "key",
|
|
634
|
-
input,
|
|
635
|
-
key,
|
|
636
|
-
value: input[key]
|
|
637
|
-
}]
|
|
638
|
-
});
|
|
639
|
-
break;
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
} else _addIssue(this, "type", dataset, config$1);
|
|
643
|
-
return dataset;
|
|
644
|
-
}
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
648
|
-
function string(message$1) {
|
|
649
|
-
return _standardSchema({
|
|
650
|
-
kind: "schema",
|
|
651
|
-
type: "string",
|
|
652
|
-
reference: string,
|
|
653
|
-
expects: "string",
|
|
654
|
-
async: false,
|
|
655
|
-
message: message$1,
|
|
656
|
-
"~run"(dataset, config$1) {
|
|
657
|
-
if (typeof dataset.value === "string") dataset.typed = true;
|
|
658
|
-
else _addIssue(this, "type", dataset, config$1);
|
|
659
|
-
return dataset;
|
|
660
|
-
}
|
|
661
|
-
});
|
|
662
|
-
}
|
|
663
|
-
/**
|
|
664
|
-
* Creates a unknown schema.
|
|
665
|
-
*
|
|
666
|
-
* @returns A unknown schema.
|
|
667
|
-
*/
|
|
668
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
669
|
-
function unknown() {
|
|
670
|
-
return _standardSchema({
|
|
671
|
-
kind: "schema",
|
|
672
|
-
type: "unknown",
|
|
673
|
-
reference: unknown,
|
|
674
|
-
expects: "unknown",
|
|
675
|
-
async: false,
|
|
676
|
-
"~run"(dataset) {
|
|
677
|
-
dataset.typed = true;
|
|
678
|
-
return dataset;
|
|
679
|
-
}
|
|
680
|
-
});
|
|
681
|
-
}
|
|
682
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
683
|
-
function pipe(...pipe$1) {
|
|
684
|
-
return _standardSchema({
|
|
685
|
-
...pipe$1[0],
|
|
686
|
-
pipe: pipe$1,
|
|
687
|
-
"~run"(dataset, config$1) {
|
|
688
|
-
for (const item of pipe$1) if (item.kind !== "metadata") {
|
|
689
|
-
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
690
|
-
dataset.typed = false;
|
|
691
|
-
break;
|
|
692
|
-
}
|
|
693
|
-
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
|
|
694
|
-
}
|
|
695
|
-
return dataset;
|
|
696
|
-
}
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
* Parses an unknown input based on a schema.
|
|
701
|
-
*
|
|
702
|
-
* @param schema The schema to be used.
|
|
703
|
-
* @param input The input to be parsed.
|
|
704
|
-
* @param config The parse configuration.
|
|
705
|
-
*
|
|
706
|
-
* @returns The parse result.
|
|
707
|
-
*/
|
|
708
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
709
|
-
function safeParse(schema, input, config$1) {
|
|
710
|
-
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
711
|
-
return {
|
|
712
|
-
typed: dataset.typed,
|
|
713
|
-
success: !dataset.issues,
|
|
714
|
-
output: dataset.value,
|
|
715
|
-
issues: dataset.issues
|
|
716
|
-
};
|
|
717
|
-
}
|
|
718
|
-
// ../shared/src/limits.ts
|
|
719
|
-
/** Ranges of the speech endpoints. */
|
|
720
|
-
var API_LIMITS = {
|
|
721
|
-
/** `GET /speech?limit=`: the default and the most a caller may ask for. */
|
|
722
|
-
list: {
|
|
723
|
-
default: 1e3,
|
|
724
|
-
max: 1e4
|
|
725
|
-
},
|
|
726
|
-
wait: {
|
|
727
|
-
/** `GET /speech/wait?timeoutMs=`. */
|
|
728
|
-
timeoutMs: {
|
|
729
|
-
default: 5e3,
|
|
730
|
-
max: 3e5
|
|
731
|
-
},
|
|
732
|
-
/** Entries the timeout answer holds at most: the last ones seen. */
|
|
733
|
-
seen: 1e3,
|
|
734
|
-
/** Longest `regex`. */
|
|
735
|
-
regexLength: 500
|
|
736
|
-
},
|
|
737
|
-
/** Longest marker label (trimmed). */
|
|
738
|
-
markerLength: 1e3,
|
|
739
|
-
/** Longest session `name`, `run` or client name (trimmed). */
|
|
740
|
-
sessionLabelLength: 1e3,
|
|
741
|
-
/** `POST /input/click` and `POST /input/keys`. */
|
|
742
|
-
input: {
|
|
743
|
-
/** Largest absolute screen coordinate (physical pixels). */
|
|
744
|
-
coordinate: 1e5,
|
|
745
|
-
/** Pause between the chords of a sequence. */
|
|
746
|
-
delayMs: {
|
|
747
|
-
default: 50,
|
|
748
|
-
max: 1e4
|
|
749
|
-
},
|
|
750
|
-
/** Most chords in one request. */
|
|
751
|
-
maxKeys: 100
|
|
752
|
-
}
|
|
753
|
-
};
|
|
754
|
-
/** Ranges of the settings (`GET` / `PUT /config`). */
|
|
755
|
-
var CONFIG_LIMITS = {
|
|
756
|
-
port: {
|
|
757
|
-
min: 0,
|
|
758
|
-
max: 65535
|
|
759
|
-
},
|
|
760
|
-
maxLineBytes: {
|
|
761
|
-
min: 1024,
|
|
762
|
-
max: 16777216
|
|
763
|
-
},
|
|
764
|
-
maxEntries: {
|
|
765
|
-
min: 1,
|
|
766
|
-
max: 1e6
|
|
767
|
-
}
|
|
768
|
-
};
|
|
769
|
-
/**
|
|
770
|
-
* An exact npm version (`1.56.1`, `1.57.0-beta-1`): `playwright.version` ends up on an
|
|
771
|
-
* `npm install` command line, so nothing else may get through.
|
|
772
|
-
*/
|
|
773
|
-
var EXACT_VERSION_PATTERN = /^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/;
|
|
774
|
-
/** A host name without port or scheme, or `*` (`http.allowedHosts`). */
|
|
775
|
-
var HOST_NAME_PATTERN = /^(\*|[A-Za-z0-9]([A-Za-z0-9.-]*[A-Za-z0-9])?)$/;
|
|
776
|
-
/** Whether `text` is a usable label: not empty after trimming, at most `max` characters trimmed. */
|
|
777
|
-
var isTrimmedLabel = (text, max) => {
|
|
778
|
-
const trimmed = text.trim();
|
|
779
|
-
return trimmed !== "" && trimmed.length <= max;
|
|
780
|
-
};
|
|
781
|
-
// ../shared/src/config.ts
|
|
782
|
-
/** A `TextDecoder` label other than UTF-16 (the framing splits the bytes on 0x0A first). */
|
|
783
|
-
function isSupportedEncoding(label) {
|
|
1
|
+
import { t as bridgeApiFromEnv } from "../../chunks/bridge-api.js";
|
|
2
|
+
// src/routes/+layout.server.ts
|
|
3
|
+
var load = async ({ fetch }) => {
|
|
784
4
|
try {
|
|
785
|
-
return
|
|
5
|
+
return { status: await bridgeApiFromEnv(fetch).status() };
|
|
786
6
|
} catch {
|
|
787
|
-
return
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
var LOG_LEVELS = [
|
|
791
|
-
"error",
|
|
792
|
-
"warn",
|
|
793
|
-
"info",
|
|
794
|
-
"debug"
|
|
795
|
-
];
|
|
796
|
-
var range = ({ min, max }) => /* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ integer$3(), /* @__PURE__ */ minValue(min), /* @__PURE__ */ maxValue(max));
|
|
797
|
-
var port = range(CONFIG_LIMITS.port);
|
|
798
|
-
/** Port of a child service: `0` ("any free port") would leave the bridge no port to proxy to. */
|
|
799
|
-
var childPort = range({
|
|
800
|
-
min: 1,
|
|
801
|
-
max: CONFIG_LIMITS.port.max
|
|
802
|
-
});
|
|
803
|
-
var nonBlank = /* @__PURE__ */ pipe(/* @__PURE__ */ string(), /* @__PURE__ */ regex(/\S/), /* @__PURE__ */ description("Not empty or blank."));
|
|
804
|
-
var AllowedHostsSchema = /* @__PURE__ */ pipe(/* @__PURE__ */ array(/* @__PURE__ */ pipe(/* @__PURE__ */ string(), /* @__PURE__ */ regex(HOST_NAME_PATTERN))), /* @__PURE__ */ description("Host names the API answers to besides IP addresses, `localhost` and the machine's name. Without port or scheme. `[\"*\"]` accepts any name. Added in API 1.5."));
|
|
805
|
-
var ServiceConfigSchema = /* @__PURE__ */ object({
|
|
806
|
-
enabled: /* @__PURE__ */ boolean(),
|
|
807
|
-
port: childPort,
|
|
808
|
-
version: /* @__PURE__ */ pipe(/* @__PURE__ */ nullable(/* @__PURE__ */ pipe(/* @__PURE__ */ string(), /* @__PURE__ */ regex(EXACT_VERSION_PATTERN))), /* @__PURE__ */ description("`null` = bundled version. Otherwise an exact version like `1.65.0`."))
|
|
809
|
-
});
|
|
810
|
-
var sections = {
|
|
811
|
-
tcp: {
|
|
812
|
-
host: nonBlank,
|
|
813
|
-
port,
|
|
814
|
-
encoding: /* @__PURE__ */ pipe(/* @__PURE__ */ string(), /* @__PURE__ */ check(isSupportedEncoding), /* @__PURE__ */ description("TextDecoder label of the socket voice's code page. Not `utf-16*`: lines are split on bytes.")),
|
|
815
|
-
maxLineBytes: range(CONFIG_LIMITS.maxLineBytes)
|
|
816
|
-
},
|
|
817
|
-
http: {
|
|
818
|
-
host: nonBlank,
|
|
819
|
-
port,
|
|
820
|
-
allowedHosts: AllowedHostsSchema
|
|
821
|
-
},
|
|
822
|
-
buffer: { maxEntries: range(CONFIG_LIMITS.maxEntries) },
|
|
823
|
-
log: {
|
|
824
|
-
level: /* @__PURE__ */ picklist(LOG_LEVELS),
|
|
825
|
-
file: /* @__PURE__ */ pipe(/* @__PURE__ */ nullable(nonBlank), /* @__PURE__ */ description("Bridge log file, `null` = default path.")),
|
|
826
|
-
consoleSpeech: /* @__PURE__ */ pipe(/* @__PURE__ */ boolean(), /* @__PURE__ */ description("Also write the speech text to the console."))
|
|
7
|
+
return { status: null };
|
|
827
8
|
}
|
|
828
9
|
};
|
|
829
|
-
sections.tcp, sections.http, sections.buffer, sections.log;
|
|
830
|
-
/** A section with every setting optional and no others allowed. */
|
|
831
|
-
var patchOf = (entries) => /* @__PURE__ */ strictObject(Object.fromEntries(Object.entries(entries).map(([key, schema]) => [key, /* @__PURE__ */ optional(schema)])));
|
|
832
|
-
patchOf(ServiceConfigSchema.entries);
|
|
833
|
-
patchOf({
|
|
834
|
-
enabled: /* @__PURE__ */ boolean(),
|
|
835
|
-
port: childPort
|
|
836
|
-
});
|
|
837
|
-
patchOf(sections.tcp), patchOf(sections.http), patchOf(sections.buffer), patchOf(sections.log);
|
|
838
|
-
// ../shared/src/input.ts
|
|
839
|
-
var { coordinate, delayMs, maxKeys } = API_LIMITS.input;
|
|
840
|
-
-coordinate, -coordinate;
|
|
841
|
-
`${maxKeys}`, delayMs.max, `${delayMs.default}`;
|
|
842
|
-
// ../shared/src/session.ts
|
|
843
|
-
var integer$2 = (min) => /* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ integer$3(), /* @__PURE__ */ minValue(min));
|
|
844
|
-
var timestamp$2 = /* @__PURE__ */ pipe(/* @__PURE__ */ string(), /* @__PURE__ */ isoTimestamp());
|
|
845
|
-
var label = (text) => /* @__PURE__ */ pipe(/* @__PURE__ */ string(), /* @__PURE__ */ check((text) => isTrimmedLabel(text, API_LIMITS.sessionLabelLength)), /* @__PURE__ */ description(`${text} Trimmed, must not be empty, at most ${API_LIMITS.sessionLabelLength} characters.`));
|
|
846
|
-
var sessionEntries = {
|
|
847
|
-
id: /* @__PURE__ */ pipe(integer$2(1), /* @__PURE__ */ description("Increasing, restarts at 1 with the bridge.")),
|
|
848
|
-
name: /* @__PURE__ */ string(),
|
|
849
|
-
run: /* @__PURE__ */ pipe(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), /* @__PURE__ */ description("Optional label that groups sessions.")),
|
|
850
|
-
client: /* @__PURE__ */ pipe(/* @__PURE__ */ nullable(/* @__PURE__ */ string()), /* @__PURE__ */ description("Who started it: the `X-SR-Speech-Client` header, `null` if it wasn't sent. Added in API 1.10.")),
|
|
851
|
-
startedAt: timestamp$2,
|
|
852
|
-
endedAt: /* @__PURE__ */ pipe(/* @__PURE__ */ nullable(timestamp$2), /* @__PURE__ */ description("`null` while the session is current.")),
|
|
853
|
-
startSeq: /* @__PURE__ */ pipe(integer$2(0), /* @__PURE__ */ description("The last `seq` given out before the session started: `since=startSeq` reads the session from its start. Added in API 1.9.")),
|
|
854
|
-
firstSeq: /* @__PURE__ */ pipe(/* @__PURE__ */ nullable(integer$2(1)), /* @__PURE__ */ description("First entry still in the buffer, `null` if none.")),
|
|
855
|
-
lastSeq: /* @__PURE__ */ pipe(/* @__PURE__ */ nullable(integer$2(1)), /* @__PURE__ */ description("Last entry still in the buffer, `null` if none.")),
|
|
856
|
-
entries: /* @__PURE__ */ pipe(integer$2(0), /* @__PURE__ */ description("Entries of this session still in the buffer."))
|
|
857
|
-
};
|
|
858
|
-
var SessionSchema = /* @__PURE__ */ pipe(/* @__PURE__ */ object(sessionEntries), /* @__PURE__ */ description("A session (docs/usage/speech-capture.md#sessions). Added in API 1.3."), /* @__PURE__ */ examples([{
|
|
859
|
-
id: 7,
|
|
860
|
-
name: "form › submit button is announced",
|
|
861
|
-
run: "nightly-42",
|
|
862
|
-
client: "ci-runner pid 4242",
|
|
863
|
-
startedAt: "2026-11-12T09:31:04.120Z",
|
|
864
|
-
endedAt: null,
|
|
865
|
-
startSeq: 339,
|
|
866
|
-
firstSeq: 340,
|
|
867
|
-
lastSeq: 342,
|
|
868
|
-
entries: 3
|
|
869
|
-
}]));
|
|
870
|
-
label("For example the test title."), label("Optional label that groups sessions, for example one per test run.");
|
|
871
|
-
({ ...sessionEntries });
|
|
872
|
-
API_LIMITS.wait.seen, `${API_LIMITS.wait.seen}`;
|
|
873
|
-
`${API_LIMITS.markerLength}`;
|
|
874
|
-
// ../shared/src/status.ts
|
|
875
|
-
var integer = (min) => /* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ integer$3(), /* @__PURE__ */ minValue(min));
|
|
876
|
-
var timestamp = /* @__PURE__ */ pipe(/* @__PURE__ */ string(), /* @__PURE__ */ isoTimestamp());
|
|
877
|
-
var BRIDGE_STATES = [
|
|
878
|
-
"starting",
|
|
879
|
-
"ready",
|
|
880
|
-
"stopping"
|
|
881
|
-
];
|
|
882
|
-
var ServiceStatusSchema = /* @__PURE__ */ pipe(/* @__PURE__ */ object({
|
|
883
|
-
state: /* @__PURE__ */ pipe(/* @__PURE__ */ picklist([
|
|
884
|
-
"stopped",
|
|
885
|
-
"starting",
|
|
886
|
-
"running",
|
|
887
|
-
"crashed",
|
|
888
|
-
"failed"
|
|
889
|
-
]), /* @__PURE__ */ description("`starting` includes the install. `crashed`: it exited and restarts after a delay. `failed`: 5 crashes in a row; restart the bridge (or change the service's settings).")),
|
|
890
|
-
version: /* @__PURE__ */ pipe(/* @__PURE__ */ string(), /* @__PURE__ */ description("The version that runs (configured or bundled)."), /* @__PURE__ */ examples(["1.65.0"])),
|
|
891
|
-
port: integer(0),
|
|
892
|
-
restarts: /* @__PURE__ */ pipe(integer(0), /* @__PURE__ */ description("Restarts after crashes since the service was last started (bridge start or config change).")),
|
|
893
|
-
exitCode: /* @__PURE__ */ pipe(/* @__PURE__ */ nullable(/* @__PURE__ */ pipe(/* @__PURE__ */ number(), /* @__PURE__ */ integer$3())), /* @__PURE__ */ description("Exit code of the last unexpected exit. `null` if none, or killed by a signal."))
|
|
894
|
-
}), /* @__PURE__ */ description("A child service (docs/usage/operations.md#child-service-crashes)."));
|
|
895
|
-
var ConnectionSchema = /* @__PURE__ */ object({
|
|
896
|
-
id: integer(1),
|
|
897
|
-
voice: /* @__PURE__ */ nullable(/* @__PURE__ */ string()),
|
|
898
|
-
connectedAt: timestamp
|
|
899
|
-
});
|
|
900
|
-
var StatusSchema = /* @__PURE__ */ pipe(/* @__PURE__ */ object({
|
|
901
|
-
bridge: /* @__PURE__ */ object({
|
|
902
|
-
version: /* @__PURE__ */ pipe(/* @__PURE__ */ string(), /* @__PURE__ */ description("Package version of the bridge."), /* @__PURE__ */ examples(["0.3.0"])),
|
|
903
|
-
apiVersion: /* @__PURE__ */ pipe(/* @__PURE__ */ string(), /* @__PURE__ */ description("`<major>.<minor>` of this API."), /* @__PURE__ */ examples(["1.13"])),
|
|
904
|
-
state: /* @__PURE__ */ picklist(BRIDGE_STATES),
|
|
905
|
-
startedAt: /* @__PURE__ */ pipe(timestamp, /* @__PURE__ */ description("When this bridge run started. Added in API 1.4."))
|
|
906
|
-
}),
|
|
907
|
-
tcp: /* @__PURE__ */ object({
|
|
908
|
-
listening: /* @__PURE__ */ boolean(),
|
|
909
|
-
host: /* @__PURE__ */ string(),
|
|
910
|
-
port: integer(0),
|
|
911
|
-
encoding: /* @__PURE__ */ pipe(/* @__PURE__ */ string(), /* @__PURE__ */ description("Code page used to decode the socket voice.")),
|
|
912
|
-
connections: /* @__PURE__ */ pipe(/* @__PURE__ */ array(ConnectionSchema), /* @__PURE__ */ description("Open connections, oldest first."))
|
|
913
|
-
}),
|
|
914
|
-
buffer: /* @__PURE__ */ object({
|
|
915
|
-
size: integer(0),
|
|
916
|
-
maxEntries: integer(1),
|
|
917
|
-
firstSeq: /* @__PURE__ */ nullable(integer(1)),
|
|
918
|
-
lastSeq: /* @__PURE__ */ nullable(integer(1))
|
|
919
|
-
}),
|
|
920
|
-
playwright: ServiceStatusSchema,
|
|
921
|
-
mcp: ServiceStatusSchema,
|
|
922
|
-
session: /* @__PURE__ */ pipe(/* @__PURE__ */ object({
|
|
923
|
-
current: /* @__PURE__ */ nullable(SessionSchema),
|
|
924
|
-
count: /* @__PURE__ */ pipe(integer(0), /* @__PURE__ */ description("Number of sessions `GET /sessions` lists."))
|
|
925
|
-
}), /* @__PURE__ */ description("Added in API 1.3."))
|
|
926
|
-
}), /* @__PURE__ */ description("`GET /status`. `playwright` since API 1.1, `mcp` since 1.2, `session` since 1.3."));
|
|
927
|
-
// ../shared/src/validate.ts
|
|
928
|
-
/**
|
|
929
|
-
* Checks `value` against `schema`. Unknown keys don't fail it and are left out of the result: a
|
|
930
|
-
* newer bridge of the same major version may add fields.
|
|
931
|
-
*/
|
|
932
|
-
function checkDto(schema, value) {
|
|
933
|
-
const result = /* @__PURE__ */ safeParse(schema, value);
|
|
934
|
-
if (result.success) return {
|
|
935
|
-
ok: true,
|
|
936
|
-
value: result.output
|
|
937
|
-
};
|
|
938
|
-
const [issue] = result.issues;
|
|
939
|
-
return {
|
|
940
|
-
ok: false,
|
|
941
|
-
field: /* @__PURE__ */ getDotPath(issue) ?? "(body)",
|
|
942
|
-
message: issue.message
|
|
943
|
-
};
|
|
944
|
-
}
|
|
945
|
-
/**
|
|
946
|
-
* An error body as a client must accept it: like `ErrorBodySchema`, but with any `code`, since
|
|
947
|
-
* new codes may come in minor versions.
|
|
948
|
-
*/
|
|
949
|
-
var AnyErrorBodySchema = /* @__PURE__ */ object({ error: /* @__PURE__ */ object({
|
|
950
|
-
code: /* @__PURE__ */ string(),
|
|
951
|
-
message: /* @__PURE__ */ string(),
|
|
952
|
-
details: /* @__PURE__ */ optional(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ unknown()))
|
|
953
|
-
}) });
|
|
954
|
-
/**
|
|
955
|
-
* `baseUrl` is the bridge's origin (no path). `fetchFn` is SvelteKit's `event.fetch` in
|
|
956
|
-
* routes and a fake in tests.
|
|
957
|
-
*/
|
|
958
|
-
function createBridgeApi(baseUrl, fetchFn) {
|
|
959
|
-
const root = baseUrl.replace(/\/+$/, "") + API_PREFIX;
|
|
960
|
-
async function get(path, schema) {
|
|
961
|
-
let response;
|
|
962
|
-
try {
|
|
963
|
-
response = await fetchFn(`${root}${path}`, { headers: { accept: "application/json" } });
|
|
964
|
-
} catch (cause) {
|
|
965
|
-
error(502, `The bridge is not reachable: ${describe(cause)}`);
|
|
966
|
-
}
|
|
967
|
-
const body = await response.json().catch(() => void 0);
|
|
968
|
-
if (!response.ok) {
|
|
969
|
-
const apiError = checkDto(AnyErrorBodySchema, body);
|
|
970
|
-
error(response.status, apiError.ok ? apiError.value.error.message : `The bridge answered ${response.status}`);
|
|
971
|
-
}
|
|
972
|
-
const checked = checkDto(schema, body);
|
|
973
|
-
if (!checked.ok) error(502, `Unexpected answer from the bridge at ${checked.field}: ${checked.message}`);
|
|
974
|
-
return checked.value;
|
|
975
|
-
}
|
|
976
|
-
return { status: () => get("/status", StatusSchema) };
|
|
977
|
-
}
|
|
978
|
-
function describe(cause) {
|
|
979
|
-
return cause instanceof Error ? cause.message : String(cause);
|
|
980
|
-
}
|
|
981
|
-
// src/routes/+layout.server.ts
|
|
982
|
-
var load = async ({ fetch }) => {
|
|
983
|
-
return { status: await createBridgeApi(process.env.SR_BRIDGE_API_URL ?? "http://127.0.0.1:5151", fetch).status() };
|
|
984
|
-
};
|
|
985
10
|
export { load };
|
|
986
11
|
|
|
987
12
|
//# sourceMappingURL=_layout.server.ts.js.map
|