@declarion/react 0.154.0 → 0.162.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/dist-lib/api/access-expiry.js +6 -5
- package/dist-lib/api/auth.js +37 -28
- package/dist-lib/api/client.js +54 -53
- package/dist-lib/api/oauth.js +12 -0
- package/dist-lib/api/schema.js +35 -32
- package/dist-lib/app.js +160 -144
- package/dist-lib/components/layout/Layout.impl.js +666 -0
- package/dist-lib/components/layout/Layout.js +19 -690
- package/dist-lib/components/pages/SSOCallbackPage.js +9 -7
- package/dist-lib/components/pages/auth/OAuthConsent.impl.js +168 -0
- package/dist-lib/components/pages/auth/OAuthConsent.js +11 -0
- package/dist-lib/components/pages/auth/SignIn.js +91 -85
- package/dist-lib/components/pages/auth/SignUp.impl.js +2 -5
- package/dist-lib/components/params/param-editors.js +2 -1
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/hooks/useFollowAgentOpen.js +1 -1
- package/dist-lib/hooks/useSignInData.js +20 -0
- package/dist-lib/index.d.ts +2 -2
- package/dist-lib/lib/capabilityPrefetch.js +19 -18
- package/dist-lib/lib/schema-routing.js +5 -1
- package/dist-lib/stores/auth.js +1 -1
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/{useResponsiveMode-BElw02Gh.d.ts → useResponsiveMode-BGMnPC4S.d.ts} +1 -0
- package/package.json +1 -1
- package/dist-lib/components/pages/SSOCallbackPage.impl.js +0 -27
|
@@ -22,10 +22,11 @@ function r() {
|
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
var i = "/login/sso-callback";
|
|
26
|
+
function a(e, t, n = !1) {
|
|
27
|
+
return n ? "first-wave" : e === null ? "probe-first" : e > t ? "first-wave" : "refresh-first";
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
29
|
+
function o() {
|
|
30
|
+
return a(r(), Date.now(), window.location.pathname === i);
|
|
30
31
|
}
|
|
31
|
-
export { n as clearAccessExpiry, t as recordAccessExpiry,
|
|
32
|
+
export { i as SSO_RETURN_PATH, n as clearAccessExpiry, t as recordAccessExpiry, a as startOrder, o as startOrderNow };
|
package/dist-lib/api/auth.js
CHANGED
|
@@ -1,76 +1,85 @@
|
|
|
1
1
|
import { beginSessionInPage as e, callHandler as t, scheduleProactiveRefresh as n } from "./client.js";
|
|
2
2
|
// src/api/auth.ts
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var r;
|
|
4
|
+
async function i() {
|
|
5
|
+
await r?.catch(() => void 0);
|
|
5
6
|
}
|
|
6
|
-
async function
|
|
7
|
-
|
|
7
|
+
async function a() {
|
|
8
|
+
return t("auth.check_setup", {}, { credentials: "omit" });
|
|
9
|
+
}
|
|
10
|
+
async function o(n, r, a = !0) {
|
|
11
|
+
await i();
|
|
12
|
+
let o = await t("auth.login", {
|
|
8
13
|
email: n,
|
|
9
14
|
password: r,
|
|
10
|
-
remember:
|
|
15
|
+
remember: a
|
|
11
16
|
});
|
|
12
|
-
return e(
|
|
17
|
+
return e(o.expires_at), o;
|
|
13
18
|
}
|
|
14
|
-
async function
|
|
15
|
-
|
|
19
|
+
async function s(n, r, a) {
|
|
20
|
+
await i();
|
|
21
|
+
let o = await t("auth.signup", {
|
|
16
22
|
email: n,
|
|
17
23
|
password: r,
|
|
18
|
-
display_name:
|
|
24
|
+
display_name: a
|
|
19
25
|
});
|
|
20
|
-
return
|
|
26
|
+
return o.verification_required || e(o.expires_at), o;
|
|
21
27
|
}
|
|
22
|
-
async function
|
|
23
|
-
|
|
28
|
+
async function c(n, r) {
|
|
29
|
+
await i();
|
|
30
|
+
let a = await t("auth.confirm_signup", {
|
|
24
31
|
email: n,
|
|
25
32
|
code: r
|
|
26
33
|
});
|
|
27
|
-
return e(
|
|
34
|
+
return e(a.expires_at), a;
|
|
28
35
|
}
|
|
29
|
-
async function
|
|
36
|
+
async function l(e) {
|
|
30
37
|
return t("auth.resend_signup_code", { email: e });
|
|
31
38
|
}
|
|
32
|
-
async function
|
|
39
|
+
async function u() {
|
|
33
40
|
return t("auth.me");
|
|
34
41
|
}
|
|
35
|
-
async function
|
|
42
|
+
async function d() {
|
|
36
43
|
return t("auth.me", {}, { isSessionProbe: !0 });
|
|
37
44
|
}
|
|
38
|
-
async function
|
|
45
|
+
async function f() {
|
|
39
46
|
return (await t("auth.list_tenants")).tenants;
|
|
40
47
|
}
|
|
41
|
-
async function
|
|
48
|
+
async function p(e) {
|
|
42
49
|
let r = await t("auth.switch_tenant", { tenant_id: e });
|
|
43
50
|
return n(r.expires_at), r;
|
|
44
51
|
}
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
function m() {
|
|
53
|
+
return r ??= t("auth.logout", {}, { keepalive: !0 }).then(() => void 0).finally(() => {
|
|
54
|
+
r = void 0;
|
|
55
|
+
}), r;
|
|
47
56
|
}
|
|
48
|
-
async function
|
|
49
|
-
return (await t("auth.list_identity_providers", e ? { tenant_code: e } : {})).providers;
|
|
57
|
+
async function h(e) {
|
|
58
|
+
return (await t("auth.list_identity_providers", e ? { tenant_code: e } : {}, { credentials: "omit" })).providers;
|
|
50
59
|
}
|
|
51
|
-
function
|
|
60
|
+
function g(e, t, n) {
|
|
52
61
|
let r = new URLSearchParams();
|
|
53
62
|
t && r.set("tenant", t), n && r.set("redirect", n);
|
|
54
63
|
let i = r.toString();
|
|
55
64
|
return `/api/auth/sso/authorize/${encodeURIComponent(e)}${i ? `?${i}` : ""}`;
|
|
56
65
|
}
|
|
57
|
-
async function
|
|
66
|
+
async function _(e, n, r) {
|
|
58
67
|
let i = {
|
|
59
68
|
target_user_id: e,
|
|
60
69
|
reason: n
|
|
61
70
|
};
|
|
62
71
|
return r != null && (i.duration_minutes = r), t("impersonation.start", i);
|
|
63
72
|
}
|
|
64
|
-
async function
|
|
73
|
+
async function v() {
|
|
65
74
|
return t("impersonation.stop");
|
|
66
75
|
}
|
|
67
|
-
async function
|
|
76
|
+
async function y(e) {
|
|
68
77
|
await t("impersonation.revoke", { session_id: e });
|
|
69
78
|
}
|
|
70
|
-
async function
|
|
79
|
+
async function b(e, n) {
|
|
71
80
|
await t("auth.change_password", {
|
|
72
81
|
current_password: e,
|
|
73
82
|
new_password: n
|
|
74
83
|
});
|
|
75
84
|
}
|
|
76
|
-
export {
|
|
85
|
+
export { b as changePassword, a as checkSetup, c as confirmSignup, u as getMe, y as impersonationRevoke, _ as impersonationStart, v as impersonationStop, h as listIdentityProviders, f as listTenants, o as login, m as logout, d as probeSession, l as resendSignupCode, s as signup, g as ssoAuthorizeUrl, p as switchTenant, i as waitForLogout };
|
package/dist-lib/api/client.js
CHANGED
|
@@ -31,7 +31,7 @@ function x(e) {
|
|
|
31
31
|
async function S() {
|
|
32
32
|
let e = navigator.locks;
|
|
33
33
|
if (!e) {
|
|
34
|
-
await
|
|
34
|
+
await F();
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
let t = Date.now();
|
|
@@ -43,7 +43,7 @@ async function S() {
|
|
|
43
43
|
} else try {
|
|
44
44
|
b({
|
|
45
45
|
ok: !0,
|
|
46
|
-
access_expires_at: await
|
|
46
|
+
access_expires_at: await F()
|
|
47
47
|
});
|
|
48
48
|
} catch (e) {
|
|
49
49
|
throw e instanceof C && b({
|
|
@@ -65,7 +65,7 @@ function T() {
|
|
|
65
65
|
}), w;
|
|
66
66
|
}
|
|
67
67
|
function E(e) {
|
|
68
|
-
return O || (
|
|
68
|
+
return O || (I = null, l() || p(e), typeof window > "u") ? Promise.resolve() : T().then((t) => t.scheduleRenewal(e), () => void 0);
|
|
69
69
|
}
|
|
70
70
|
function D() {
|
|
71
71
|
f(), w?.then((e) => e.cancelRenewal());
|
|
@@ -74,10 +74,10 @@ var O = !1;
|
|
|
74
74
|
function k() {
|
|
75
75
|
O = !0, D();
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function A() {
|
|
78
78
|
return O;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function j(e) {
|
|
81
81
|
return O = !1, E(e);
|
|
82
82
|
}
|
|
83
83
|
typeof window < "u" && window.addEventListener("storage", (e) => {
|
|
@@ -85,7 +85,7 @@ typeof window < "u" && window.addEventListener("storage", (e) => {
|
|
|
85
85
|
let t = y(() => e.newValue);
|
|
86
86
|
t?.ok && t.access_expires_at && E(t.access_expires_at);
|
|
87
87
|
});
|
|
88
|
-
async function
|
|
88
|
+
async function M(e, n, r) {
|
|
89
89
|
let i = new AbortController(), a = setTimeout(() => i.abort(), r);
|
|
90
90
|
try {
|
|
91
91
|
return await fetch(e, {
|
|
@@ -98,121 +98,121 @@ async function j(e, n, r) {
|
|
|
98
98
|
clearTimeout(a);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
async function
|
|
101
|
+
async function N(e) {
|
|
102
102
|
try {
|
|
103
103
|
return (await e.json())?.result?.expires_at;
|
|
104
104
|
} catch {
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
return
|
|
108
|
+
function P() {
|
|
109
|
+
return M("/api/actions/auth.refresh", {
|
|
110
110
|
method: "POST",
|
|
111
111
|
credentials: "include",
|
|
112
112
|
headers: { "Content-Type": "application/json" },
|
|
113
113
|
body: h({})
|
|
114
114
|
}, u);
|
|
115
115
|
}
|
|
116
|
-
async function
|
|
117
|
-
let t = await
|
|
116
|
+
async function F() {
|
|
117
|
+
let t = await P();
|
|
118
118
|
if (t.status === 429) {
|
|
119
119
|
let e = parseInt(t.headers.get("Retry-After") || "1", 10);
|
|
120
|
-
await r(t), await new Promise((t) => setTimeout(t, e * 1e3)), t = await
|
|
120
|
+
await r(t), await new Promise((t) => setTimeout(t, e * 1e3)), t = await P();
|
|
121
121
|
}
|
|
122
122
|
if (t.status >= 500) {
|
|
123
123
|
let n = await r(t);
|
|
124
124
|
throw new e(t.status, n.body, n.raw);
|
|
125
125
|
}
|
|
126
126
|
if (!t.ok) throw await r(t), new C(t.status);
|
|
127
|
-
let n = await
|
|
127
|
+
let n = await N(t);
|
|
128
128
|
return E(n), n;
|
|
129
129
|
}
|
|
130
|
-
var
|
|
131
|
-
function
|
|
130
|
+
var I = null, L = /* @__PURE__ */ new Set(["auth.token_refresh_needed", "auth.unauthorized"]);
|
|
131
|
+
function R(n) {
|
|
132
132
|
return n instanceof t || n instanceof e;
|
|
133
133
|
}
|
|
134
|
-
async function
|
|
134
|
+
async function z() {
|
|
135
135
|
if (O) throw new C(401);
|
|
136
|
-
if (
|
|
136
|
+
if (I !== null) throw new C(I);
|
|
137
137
|
return g || (g = S().catch((e) => {
|
|
138
|
-
throw e instanceof C && (
|
|
138
|
+
throw e instanceof C && (I = e.status), e;
|
|
139
139
|
}).finally(() => {
|
|
140
140
|
g = null;
|
|
141
141
|
}), g);
|
|
142
142
|
}
|
|
143
|
-
var
|
|
143
|
+
var B = () => {
|
|
144
144
|
if (typeof window > "u") return;
|
|
145
145
|
let { pathname: e } = window.location;
|
|
146
146
|
e.startsWith("/login") || e.startsWith("/signup") || e === "/reset" || e === "/forgot" || e === "/2fa" || (window.location.href = i());
|
|
147
147
|
};
|
|
148
|
-
function
|
|
149
|
-
let t =
|
|
150
|
-
return
|
|
148
|
+
function V(e) {
|
|
149
|
+
let t = B;
|
|
150
|
+
return B = e, t;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
return
|
|
152
|
+
function H() {
|
|
153
|
+
return B;
|
|
154
154
|
}
|
|
155
|
-
var
|
|
155
|
+
var U = ({ status: e, code: t, message: n }) => {
|
|
156
156
|
console.error(`[API ${e}] ${t}: ${n}`);
|
|
157
157
|
};
|
|
158
|
-
function
|
|
158
|
+
function W(e, t, n, r) {
|
|
159
159
|
let i = new Headers(e);
|
|
160
160
|
return !i.has("Content-Type") && t && i.set("Content-Type", "application/json"), n.setAccept && !i.has("Accept") && i.set("Accept", "*/*"), r && i.set("Authorization", `Bearer ${r}`), i;
|
|
161
161
|
}
|
|
162
|
-
var
|
|
163
|
-
function
|
|
164
|
-
|
|
162
|
+
var G = null, K;
|
|
163
|
+
function q(e) {
|
|
164
|
+
K = e, G && e !== void 0 && !m(G.reader, e) && (G = null);
|
|
165
165
|
}
|
|
166
|
-
function
|
|
167
|
-
(
|
|
166
|
+
function J(e, t) {
|
|
167
|
+
(K === void 0 || m(e, K)) && (G = t ? {
|
|
168
168
|
language: t,
|
|
169
169
|
reader: e
|
|
170
170
|
} : null);
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
|
|
172
|
+
function ee(e) {
|
|
173
|
+
G = e ? {
|
|
174
174
|
language: e,
|
|
175
|
-
reader:
|
|
175
|
+
reader: K ?? null
|
|
176
176
|
} : null;
|
|
177
177
|
}
|
|
178
178
|
function Y() {
|
|
179
|
-
return
|
|
179
|
+
return G?.language ?? null;
|
|
180
180
|
}
|
|
181
181
|
function X(e) {
|
|
182
182
|
let t = Y();
|
|
183
183
|
return !t || !e.startsWith("/api/") || /[?&]language=/.test(e) ? e : `${e}${e.includes("?") ? "&" : "?"}language=${encodeURIComponent(t)}`;
|
|
184
184
|
}
|
|
185
185
|
async function Z(t, i, u, f) {
|
|
186
|
-
let p = X(t), m = l(), h = m ? "omit" : "include", g =
|
|
186
|
+
let p = X(t), m = l(), h = m ? "omit" : i.credentials ?? "include", g = m || h !== "omit", _ = W(i.headers, !!i.body, u, m ? c() : null), v = d(t, i), y = await M(p, {
|
|
187
187
|
...i,
|
|
188
|
-
headers:
|
|
188
|
+
headers: _,
|
|
189
189
|
credentials: h
|
|
190
|
-
},
|
|
191
|
-
if (a(
|
|
192
|
-
let { raw: t, body: a } = await r(
|
|
193
|
-
if (
|
|
190
|
+
}, v);
|
|
191
|
+
if (a(y.headers), !y.ok) {
|
|
192
|
+
let { raw: t, body: a } = await r(y), c = n(a.type), l = a.title ?? "";
|
|
193
|
+
if (g && y.status === 401 && L.has(c)) try {
|
|
194
194
|
let t = null;
|
|
195
|
-
m ? (s(), t = await o()) : await
|
|
196
|
-
let a =
|
|
195
|
+
m ? (s(), t = await o()) : await z();
|
|
196
|
+
let a = W(i.headers, !!i.body, u, t), c = await M(p, {
|
|
197
197
|
...i,
|
|
198
198
|
headers: a,
|
|
199
199
|
credentials: h
|
|
200
|
-
},
|
|
200
|
+
}, v);
|
|
201
201
|
if (!c.ok) {
|
|
202
202
|
let t = await r(c);
|
|
203
|
-
throw !m && c.status === 401 &&
|
|
203
|
+
throw !m && c.status === 401 && L.has(n(t.body.type)) && (I = 401), c.status === 401 && !u.isSessionProbe && B(), new e(c.status, t.body, t.raw);
|
|
204
204
|
}
|
|
205
205
|
return f(c);
|
|
206
206
|
} catch (n) {
|
|
207
|
-
throw
|
|
207
|
+
throw R(n) ? n : (u.isSessionProbe || B(), new e(401, a, t));
|
|
208
208
|
}
|
|
209
|
-
throw
|
|
210
|
-
status:
|
|
209
|
+
throw g && y.status === 401 && !u.isSessionProbe && B(), U({
|
|
210
|
+
status: y.status,
|
|
211
211
|
code: c,
|
|
212
212
|
message: l
|
|
213
|
-
}), new e(
|
|
213
|
+
}), new e(y.status, a, t);
|
|
214
214
|
}
|
|
215
|
-
return f(
|
|
215
|
+
return f(y);
|
|
216
216
|
}
|
|
217
217
|
function Q(e) {
|
|
218
218
|
return e.status === 204 ? Promise.resolve(void 0) : e.json();
|
|
@@ -246,14 +246,15 @@ function $(e) {
|
|
|
246
246
|
let r = t.match(/filename\s*=\s*("([^"]+)"|([^;]+))/i);
|
|
247
247
|
return r ? (r[2] ?? r[3] ?? "").trim() : "";
|
|
248
248
|
}
|
|
249
|
-
async function ie(e, t = {}, { isSessionProbe: n = !1, keepalive: r = !1 } = {}) {
|
|
249
|
+
async function ie(e, t = {}, { isSessionProbe: n = !1, keepalive: r = !1, credentials: i } = {}) {
|
|
250
250
|
return (await Z(`/api/actions/${encodeURIComponent(e)}`, {
|
|
251
251
|
method: "POST",
|
|
252
252
|
body: h(t),
|
|
253
|
-
keepalive: r
|
|
253
|
+
keepalive: r,
|
|
254
|
+
credentials: i
|
|
254
255
|
}, {
|
|
255
256
|
setAccept: !1,
|
|
256
257
|
isSessionProbe: n
|
|
257
258
|
}, Q)).result;
|
|
258
259
|
}
|
|
259
|
-
export { C as RefreshDeadError, te as apiFetch, re as apiFetchBlob,
|
|
260
|
+
export { C as RefreshDeadError, te as apiFetch, re as apiFetchBlob, j as beginSessionInPage, ie as callHandler, D as cancelProactiveRefresh, Y as currentPublishedLanguage, k as endSessionInPage, z as ensureRefresh, H as getPersistentAuthFailureHandler, A as isSignedOutInPage, R as isTransientFailure, $ as parseContentDispositionFilename, ee as publishLanguage, J as publishLanguageFor, E as scheduleProactiveRefresh, q as setLanguageReader, V as setPersistentAuthFailureHandler, X as withPublishedLanguage };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { callHandler as e } from "./client.js";
|
|
2
|
+
// src/api/oauth.ts
|
|
3
|
+
async function t(t) {
|
|
4
|
+
return e("oauth.authorization_continue", { transaction_id: t });
|
|
5
|
+
}
|
|
6
|
+
async function n(t, n) {
|
|
7
|
+
return e("oauth.authorization_decide", {
|
|
8
|
+
transaction_id: t,
|
|
9
|
+
decision: n
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export { t as continueAuthorization, n as decideAuthorization };
|
package/dist-lib/api/schema.js
CHANGED
|
@@ -1,70 +1,73 @@
|
|
|
1
|
-
import { apiFetch as e,
|
|
2
|
-
import { recordActionTimeouts as
|
|
3
|
-
import { OrderedMap as
|
|
1
|
+
import { apiFetch as e, isSignedOutInPage as t, publishLanguageFor as n } from "./client.js";
|
|
2
|
+
import { recordActionTimeouts as r } from "./request-bounds.js";
|
|
3
|
+
import { OrderedMap as i } from "../types/ordmap.js";
|
|
4
4
|
// src/api/schema.ts
|
|
5
|
-
function
|
|
5
|
+
function a(e) {
|
|
6
6
|
return {
|
|
7
7
|
...e,
|
|
8
|
-
params: e.params ?
|
|
8
|
+
params: e.params ? i.fromWire(e.params) : void 0
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function o(e) {
|
|
12
12
|
return {
|
|
13
13
|
...e,
|
|
14
|
-
resolved_params: e.resolved_params ?
|
|
14
|
+
resolved_params: e.resolved_params ? i.fromWire(e.resolved_params) : void 0
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function s(e) {
|
|
18
18
|
let t = {};
|
|
19
|
-
if (e.handlers) for (let [n, r] of Object.entries(e.handlers)) t[n] =
|
|
19
|
+
if (e.handlers) for (let [n, r] of Object.entries(e.handlers)) t[n] = a(r);
|
|
20
20
|
let n = {};
|
|
21
|
-
if (e.actions) for (let [t, r] of Object.entries(e.actions)) n[t] =
|
|
21
|
+
if (e.actions) for (let [t, r] of Object.entries(e.actions)) n[t] = o(r);
|
|
22
22
|
return {
|
|
23
23
|
...e,
|
|
24
|
-
fields:
|
|
25
|
-
files: e.files ?
|
|
26
|
-
variants: e.variants ?
|
|
24
|
+
fields: i.fromWire(e.fields),
|
|
25
|
+
files: e.files ? i.fromWire(e.files) : void 0,
|
|
26
|
+
variants: e.variants ? i.fromWire(e.variants) : void 0,
|
|
27
27
|
handlers: e.handlers ? t : void 0,
|
|
28
28
|
actions: e.actions ? n : void 0
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function c(e) {
|
|
32
32
|
let t = {};
|
|
33
|
-
if (e.entities) for (let [n, r] of Object.entries(e.entities)) t[n] =
|
|
33
|
+
if (e.entities) for (let [n, r] of Object.entries(e.entities)) t[n] = s(r);
|
|
34
34
|
let n = {};
|
|
35
|
-
if (e.structures) for (let [t,
|
|
36
|
-
...
|
|
37
|
-
fields:
|
|
35
|
+
if (e.structures) for (let [t, r] of Object.entries(e.structures)) n[t] = {
|
|
36
|
+
...r,
|
|
37
|
+
fields: i.fromWire(r.fields)
|
|
38
38
|
};
|
|
39
|
-
let
|
|
40
|
-
if (e.handlers) for (let [t, n] of Object.entries(e.handlers))
|
|
39
|
+
let r = {};
|
|
40
|
+
if (e.handlers) for (let [t, n] of Object.entries(e.handlers)) r[t] = a(n);
|
|
41
41
|
let c = {};
|
|
42
|
-
if (e.actions) for (let [t, n] of Object.entries(e.actions)) c[t] =
|
|
42
|
+
if (e.actions) for (let [t, n] of Object.entries(e.actions)) c[t] = o(n);
|
|
43
43
|
let l = { ...e.screens };
|
|
44
44
|
for (let [e, t] of Object.entries(l)) {
|
|
45
45
|
let n = t;
|
|
46
46
|
l[e] = {
|
|
47
47
|
...t,
|
|
48
|
-
variants: n.variants ?
|
|
48
|
+
variants: n.variants ? i.fromWire(n.variants) : void 0
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
return {
|
|
52
52
|
...e,
|
|
53
53
|
entities: t,
|
|
54
54
|
structures: n,
|
|
55
|
-
handlers:
|
|
55
|
+
handlers: r,
|
|
56
56
|
actions: c,
|
|
57
57
|
screens: l
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
async function
|
|
61
|
-
let
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
async function l() {
|
|
61
|
+
let i = performance.now(), { audience: a, ...o } = await e("/api/schema", {
|
|
62
|
+
cache: "no-cache",
|
|
63
|
+
credentials: t() ? "omit" : void 0
|
|
64
|
+
});
|
|
65
|
+
if (a === void 0) throw Error("/api/schema answered without its audience");
|
|
66
|
+
let s = c(o);
|
|
67
|
+
return n(a, s.language), r(s), {
|
|
68
|
+
schema: s,
|
|
69
|
+
audience: a,
|
|
70
|
+
requestedAt: i
|
|
68
71
|
};
|
|
69
72
|
}
|
|
70
|
-
export {
|
|
73
|
+
export { l as fetchSchema };
|