@declarion/react 0.106.0 → 0.110.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/agents.js +9 -7
- package/dist-lib/api/audience.js +12 -0
- package/dist-lib/api/auth.js +1 -1
- package/dist-lib/api/client.js +101 -93
- package/dist-lib/api/schema.js +31 -31
- package/dist-lib/components/agents/AgentChatPanel.impl.js +362 -301
- package/dist-lib/components/agents/ChatAttachments.js +154 -0
- package/dist-lib/components/agents/transcript-runs.js +1 -1
- package/dist-lib/components/chrome/AssociationTabs.js +89 -75
- package/dist-lib/components/detail-layout/AssociatedBlock.js +243 -235
- package/dist-lib/components/detail-layout/ChildrenCards.js +57 -55
- package/dist-lib/components/detail-layout/ChildrenList.js +45 -43
- package/dist-lib/components/detail-layout/ChildrenTable.js +93 -91
- package/dist-lib/components/detail-layout/ChildrenTimeline.js +160 -155
- package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +127 -121
- package/dist-lib/components/fields/RefCombobox.js +53 -48
- package/dist-lib/components/fields/index.js +1 -0
- package/dist-lib/components/file-widgets/DocumentCard.js +1 -1
- package/dist-lib/components/file-widgets/FileList.js +1 -1
- package/dist-lib/components/file-widgets/Grid.js +1 -1
- package/dist-lib/components/file-widgets/upload.js +64 -61
- package/dist-lib/components/file-widgets/useFileSelection.js +152 -0
- package/dist-lib/components/pages/SmartDetailPage.impl.js +506 -482
- package/dist-lib/components/pages/SmartRecordListPage.impl.js +335 -300
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +112 -109
- package/dist-lib/components/params/ParamsBlock.js +18 -15
- package/dist-lib/components/params/param-editors.js +60 -54
- package/dist-lib/components/primitives/RetryButton.js +14 -0
- package/dist-lib/components/primitives/StatTile.js +42 -34
- package/dist-lib/hooks/useAgentConversation.js +122 -109
- package/dist-lib/hooks/useAuth.js +4 -1
- package/dist-lib/hooks/useParams.js +54 -52
- package/dist-lib/hooks/useSchema.js +25 -30
- package/dist-lib/hooks/useTimelineData.js +26 -24
- package/dist-lib/index.d.ts +90 -6
- package/dist-lib/index.js +95 -93
- package/dist-lib/lib/read-display-state.js +19 -0
- package/dist-lib/stores/auth.js +35 -34
- package/dist-lib/test/seed-schema.js +4 -3
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/types/fieldType.js +1 -1
- package/dist-lib/{useResponsiveMode-ECv1AEhv.d.ts → useResponsiveMode-C4MeAgoS.d.ts} +3 -1
- package/package.json +1 -1
package/dist-lib/api/agents.js
CHANGED
|
@@ -6,15 +6,17 @@ async function n() {
|
|
|
6
6
|
}
|
|
7
7
|
async function r(t) {
|
|
8
8
|
return {
|
|
9
|
-
id: (await e("
|
|
9
|
+
id: (await e("agents.start_conversation", { ...t.agent_id ? { agent_id: t.agent_id } : {} })).conversation_id,
|
|
10
10
|
status: "active"
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
async function i(t, n, r) {
|
|
13
|
+
async function i(t, n, r, i, a) {
|
|
14
14
|
return {
|
|
15
|
-
id: (await e("
|
|
15
|
+
id: (await e("agents.send_message", {
|
|
16
16
|
conversation_id: n,
|
|
17
|
-
|
|
17
|
+
idempotency_key: a,
|
|
18
|
+
...t ? { text: t } : {},
|
|
19
|
+
...i?.length ? { attachments: i } : {},
|
|
18
20
|
...r ? { context: r } : {}
|
|
19
21
|
})).message_id,
|
|
20
22
|
conversation_id: n,
|
|
@@ -22,7 +24,7 @@ async function i(t, n, r) {
|
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
26
|
async function a(t, n) {
|
|
25
|
-
await e("
|
|
27
|
+
await e("agents.answer_question", {
|
|
26
28
|
invocation_id: t,
|
|
27
29
|
answer: n
|
|
28
30
|
});
|
|
@@ -43,10 +45,10 @@ async function c(e, t) {
|
|
|
43
45
|
});
|
|
44
46
|
}
|
|
45
47
|
async function l(t) {
|
|
46
|
-
await e("
|
|
48
|
+
await e("agents.cancel_question", { invocation_id: t });
|
|
47
49
|
}
|
|
48
50
|
async function u(t) {
|
|
49
|
-
await e("
|
|
51
|
+
await e("agents.cancel_conversation", { conversation_id: t });
|
|
50
52
|
}
|
|
51
53
|
async function d() {
|
|
52
54
|
let e = await t("agent_conversation", {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/api/audience.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
if (!e.isLoading) return !e.isAuthenticated || !e.user ? null : {
|
|
4
|
+
user_id: e.user.id,
|
|
5
|
+
tenant_id: e.activeTenant?.id ?? ""
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
function t(e, t) {
|
|
9
|
+
return e === t || e !== null && t !== null && e.user_id === t.user_id && e.tenant_id === t.tenant_id;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { t as sameAudience, e as sessionCaller };
|
package/dist-lib/api/auth.js
CHANGED
|
@@ -43,7 +43,7 @@ async function u(n) {
|
|
|
43
43
|
return t(r.expires_at), r;
|
|
44
44
|
}
|
|
45
45
|
async function d() {
|
|
46
|
-
await e("auth.logout");
|
|
46
|
+
await e("auth.logout", {}, { keepalive: !0 });
|
|
47
47
|
}
|
|
48
48
|
async function f(t) {
|
|
49
49
|
return (await e("auth.list_identity_providers", t ? { tenant_code: t } : {})).providers;
|
package/dist-lib/api/client.js
CHANGED
|
@@ -4,9 +4,10 @@ import { awaitEmbedToken as a, clearEmbedToken as o, getEmbedToken as s, isEmbed
|
|
|
4
4
|
import { observe as l } from "../lib/versionTracker.js";
|
|
5
5
|
import { REFRESH_TIMEOUT_MS as u, requestTimeoutMs as d } from "./request-bounds.js";
|
|
6
6
|
import { clearAccessExpiry as f, recordAccessExpiry as p } from "./access-expiry.js";
|
|
7
|
+
import { sameAudience as m } from "./audience.js";
|
|
7
8
|
//#region src/api/client.ts
|
|
8
|
-
var
|
|
9
|
-
function
|
|
9
|
+
var h = (e) => JSON.stringify(e ?? {}), g = null, _ = "declarion.auth.refresh.result", v = "declarion.auth.refresh";
|
|
10
|
+
function y(e = () => window.localStorage.getItem(_)) {
|
|
10
11
|
try {
|
|
11
12
|
let t = JSON.parse(e() ?? "null");
|
|
12
13
|
return typeof t?.ok == "boolean" && typeof t.updated_at == "number" ? t : null;
|
|
@@ -14,9 +15,9 @@ function v(e = () => window.localStorage.getItem(g)) {
|
|
|
14
15
|
return null;
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
+
function b(e) {
|
|
18
19
|
try {
|
|
19
|
-
window.localStorage.setItem(
|
|
20
|
+
window.localStorage.setItem(_, JSON.stringify({
|
|
20
21
|
updated_at: Date.now(),
|
|
21
22
|
...e
|
|
22
23
|
}));
|
|
@@ -24,57 +25,57 @@ function y(e) {
|
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
-
return e.ok ? (e.access_expires_at &&
|
|
28
|
+
function x(e) {
|
|
29
|
+
return e.ok ? (e.access_expires_at && E(e.access_expires_at), null) : new C(e.status ?? 401);
|
|
29
30
|
}
|
|
30
|
-
async function
|
|
31
|
+
async function S() {
|
|
31
32
|
let e = navigator.locks;
|
|
32
33
|
if (!e) {
|
|
33
|
-
await
|
|
34
|
+
await j();
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
37
|
let t = Date.now();
|
|
37
|
-
await e.request(
|
|
38
|
-
let e =
|
|
38
|
+
await e.request(v, { mode: "exclusive" }, async () => {
|
|
39
|
+
let e = y();
|
|
39
40
|
if (e && e.updated_at >= t) {
|
|
40
|
-
let t =
|
|
41
|
+
let t = x(e);
|
|
41
42
|
if (t) throw t;
|
|
42
43
|
} else try {
|
|
43
|
-
|
|
44
|
+
b({
|
|
44
45
|
ok: !0,
|
|
45
|
-
access_expires_at: await
|
|
46
|
+
access_expires_at: await j()
|
|
46
47
|
});
|
|
47
48
|
} catch (e) {
|
|
48
|
-
throw e instanceof
|
|
49
|
+
throw e instanceof C && b({
|
|
49
50
|
ok: !1,
|
|
50
51
|
status: e.status
|
|
51
52
|
}), e;
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
|
-
var
|
|
56
|
+
var C = class extends Error {
|
|
56
57
|
status;
|
|
57
58
|
constructor(e) {
|
|
58
59
|
super(`refresh failed terminally (${e})`), this.status = e, this.name = "RefreshDeadError";
|
|
59
60
|
}
|
|
60
|
-
},
|
|
61
|
-
function
|
|
62
|
-
return
|
|
63
|
-
throw
|
|
64
|
-
}),
|
|
61
|
+
}, w = null;
|
|
62
|
+
function T() {
|
|
63
|
+
return w ??= import("./session-renewal.js").catch((e) => {
|
|
64
|
+
throw w = null, e;
|
|
65
|
+
}), w;
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
67
|
+
function E(e) {
|
|
68
|
+
return M = null, c() || p(e), typeof window > "u" ? Promise.resolve() : T().then((t) => t.scheduleRenewal(e), () => void 0);
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
-
f(),
|
|
70
|
+
function D() {
|
|
71
|
+
f(), w?.then((e) => e.cancelRenewal());
|
|
71
72
|
}
|
|
72
73
|
typeof window < "u" && window.addEventListener("storage", (e) => {
|
|
73
|
-
if (e.key !==
|
|
74
|
-
let t =
|
|
75
|
-
t?.ok && t.access_expires_at &&
|
|
74
|
+
if (e.key !== _ || c()) return;
|
|
75
|
+
let t = y(() => e.newValue);
|
|
76
|
+
t?.ok && t.access_expires_at && E(t.access_expires_at);
|
|
76
77
|
});
|
|
77
|
-
async function
|
|
78
|
+
async function O(e, n, r) {
|
|
78
79
|
let i = new AbortController(), a = setTimeout(() => i.abort(), r);
|
|
79
80
|
try {
|
|
80
81
|
return await fetch(e, {
|
|
@@ -87,108 +88,114 @@ async function D(e, n, r) {
|
|
|
87
88
|
clearTimeout(a);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
async function
|
|
91
|
+
async function k(e) {
|
|
91
92
|
try {
|
|
92
93
|
return (await e.json())?.result?.expires_at;
|
|
93
94
|
} catch {
|
|
94
95
|
return;
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
-
return
|
|
98
|
+
function A() {
|
|
99
|
+
return O("/api/actions/auth.refresh", {
|
|
99
100
|
method: "POST",
|
|
100
101
|
credentials: "include",
|
|
101
102
|
headers: { "Content-Type": "application/json" },
|
|
102
|
-
body:
|
|
103
|
+
body: h({})
|
|
103
104
|
}, u);
|
|
104
105
|
}
|
|
105
|
-
async function
|
|
106
|
-
let t = await
|
|
106
|
+
async function j() {
|
|
107
|
+
let t = await A();
|
|
107
108
|
if (t.status === 429) {
|
|
108
109
|
let e = parseInt(t.headers.get("Retry-After") || "1", 10);
|
|
109
|
-
await r(t), await new Promise((t) => setTimeout(t, e * 1e3)), t = await
|
|
110
|
+
await r(t), await new Promise((t) => setTimeout(t, e * 1e3)), t = await A();
|
|
110
111
|
}
|
|
111
112
|
if (t.status >= 500) {
|
|
112
113
|
let n = await r(t);
|
|
113
114
|
throw new e(t.status, n.body, n.raw);
|
|
114
115
|
}
|
|
115
|
-
if (!t.ok) throw await r(t), new
|
|
116
|
-
let n = await
|
|
117
|
-
return
|
|
116
|
+
if (!t.ok) throw await r(t), new C(t.status);
|
|
117
|
+
let n = await k(t);
|
|
118
|
+
return E(n), n;
|
|
118
119
|
}
|
|
119
|
-
var
|
|
120
|
-
function
|
|
120
|
+
var M = null, N = /* @__PURE__ */ new Set(["auth.token_refresh_needed", "auth.unauthorized"]);
|
|
121
|
+
function P(n) {
|
|
121
122
|
return n instanceof t || n instanceof e;
|
|
122
123
|
}
|
|
123
|
-
async function
|
|
124
|
-
if (
|
|
125
|
-
return
|
|
126
|
-
throw e instanceof
|
|
124
|
+
async function F() {
|
|
125
|
+
if (M !== null) throw new C(M);
|
|
126
|
+
return g || (g = S().catch((e) => {
|
|
127
|
+
throw e instanceof C && (M = e.status), e;
|
|
127
128
|
}).finally(() => {
|
|
128
|
-
|
|
129
|
-
}),
|
|
129
|
+
g = null;
|
|
130
|
+
}), g);
|
|
130
131
|
}
|
|
131
|
-
var
|
|
132
|
+
var I = () => {
|
|
132
133
|
if (typeof window > "u") return;
|
|
133
134
|
let { pathname: e } = window.location;
|
|
134
135
|
e.startsWith("/login") || e.startsWith("/signup") || e === "/reset" || e === "/forgot" || e === "/2fa" || (window.location.href = i());
|
|
135
136
|
};
|
|
136
|
-
function
|
|
137
|
-
let t =
|
|
138
|
-
return
|
|
137
|
+
function L(e) {
|
|
138
|
+
let t = I;
|
|
139
|
+
return I = e, t;
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
-
return
|
|
141
|
+
function R() {
|
|
142
|
+
return I;
|
|
142
143
|
}
|
|
143
|
-
var
|
|
144
|
+
var z = ({ status: e, code: t, message: n }) => {
|
|
144
145
|
console.error(`[API ${e}] ${t}: ${n}`);
|
|
145
146
|
};
|
|
146
|
-
function
|
|
147
|
+
function B(e, t, n, r) {
|
|
147
148
|
let i = new Headers(e);
|
|
148
149
|
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;
|
|
149
150
|
}
|
|
150
|
-
var
|
|
151
|
-
function
|
|
152
|
-
e
|
|
151
|
+
var V = null, H;
|
|
152
|
+
function U(e) {
|
|
153
|
+
H = e, V && e !== void 0 && !m(V.reader, e) && (V = null);
|
|
153
154
|
}
|
|
154
|
-
function
|
|
155
|
-
|
|
155
|
+
function W(e, t) {
|
|
156
|
+
(H === void 0 || m(e, H)) && (V = t ? {
|
|
157
|
+
language: t,
|
|
158
|
+
reader: e
|
|
159
|
+
} : null);
|
|
156
160
|
}
|
|
157
|
-
function
|
|
158
|
-
|
|
161
|
+
function G(e) {
|
|
162
|
+
V = e ? {
|
|
163
|
+
language: e,
|
|
164
|
+
reader: H ?? null
|
|
165
|
+
} : null;
|
|
159
166
|
}
|
|
160
|
-
function
|
|
161
|
-
return
|
|
167
|
+
function K() {
|
|
168
|
+
return V?.language ?? null;
|
|
162
169
|
}
|
|
163
|
-
function
|
|
164
|
-
|
|
170
|
+
function q(e) {
|
|
171
|
+
let t = K();
|
|
172
|
+
return !t || !e.startsWith("/api/") || /[?&]language=/.test(e) ? e : `${e}${e.includes("?") ? "&" : "?"}language=${encodeURIComponent(t)}`;
|
|
165
173
|
}
|
|
166
|
-
async function
|
|
167
|
-
let p =
|
|
174
|
+
async function J(t, i, u, f) {
|
|
175
|
+
let p = q(t), m = c(), h = m ? "omit" : "include", g = B(i.headers, !!i.body, u, m ? s() : null), _ = d(t, i), v = await O(p, {
|
|
168
176
|
...i,
|
|
169
177
|
headers: g,
|
|
170
178
|
credentials: h
|
|
171
179
|
}, _);
|
|
172
180
|
if (l(v.headers), !v.ok) {
|
|
173
181
|
let { raw: t, body: s } = await r(v), c = n(s.type), l = s.title ?? "";
|
|
174
|
-
if (v.status === 401 && (c
|
|
182
|
+
if (v.status === 401 && N.has(c)) try {
|
|
175
183
|
let t = null;
|
|
176
|
-
m ? (o(), t = await a()) : await
|
|
177
|
-
let
|
|
184
|
+
m ? (o(), t = await a()) : await F();
|
|
185
|
+
let s = B(i.headers, !!i.body, u, t), c = await O(p, {
|
|
178
186
|
...i,
|
|
179
|
-
headers:
|
|
187
|
+
headers: s,
|
|
180
188
|
credentials: h
|
|
181
189
|
}, _);
|
|
182
|
-
if (!
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
throw new e(s.status, t.body, t.raw);
|
|
190
|
+
if (!c.ok) {
|
|
191
|
+
let t = await r(c);
|
|
192
|
+
throw !m && c.status === 401 && N.has(n(t.body.type)) && (M = 401), c.status === 401 && !u.isSessionProbe && I(), new e(c.status, t.body, t.raw);
|
|
186
193
|
}
|
|
187
|
-
return f(
|
|
194
|
+
return f(c);
|
|
188
195
|
} catch (n) {
|
|
189
|
-
throw
|
|
196
|
+
throw P(n) ? n : (u.isSessionProbe || I(), new e(401, s, t));
|
|
190
197
|
}
|
|
191
|
-
throw v.status === 401 && !u.isSessionProbe &&
|
|
198
|
+
throw v.status === 401 && !u.isSessionProbe && I(), z({
|
|
192
199
|
status: v.status,
|
|
193
200
|
code: c,
|
|
194
201
|
message: l
|
|
@@ -196,29 +203,29 @@ async function K(t, i, u, f) {
|
|
|
196
203
|
}
|
|
197
204
|
return f(v);
|
|
198
205
|
}
|
|
199
|
-
function
|
|
206
|
+
function Y(e) {
|
|
200
207
|
return e.status === 204 ? Promise.resolve(void 0) : e.json();
|
|
201
208
|
}
|
|
202
|
-
async function
|
|
203
|
-
return
|
|
209
|
+
async function X(e, t = {}, { isSessionProbe: n = !1 } = {}) {
|
|
210
|
+
return J(e, t, {
|
|
204
211
|
setAccept: !1,
|
|
205
212
|
isSessionProbe: n
|
|
206
|
-
},
|
|
213
|
+
}, Y);
|
|
207
214
|
}
|
|
208
|
-
async function
|
|
215
|
+
async function Z(e) {
|
|
209
216
|
return {
|
|
210
217
|
blob: await e.blob(),
|
|
211
|
-
filename:
|
|
218
|
+
filename: $(e.headers),
|
|
212
219
|
headers: e.headers
|
|
213
220
|
};
|
|
214
221
|
}
|
|
215
|
-
async function
|
|
216
|
-
return
|
|
222
|
+
async function Q(e, t = {}) {
|
|
223
|
+
return J(e, t, {
|
|
217
224
|
setAccept: !0,
|
|
218
225
|
isSessionProbe: !1
|
|
219
|
-
},
|
|
226
|
+
}, Z);
|
|
220
227
|
}
|
|
221
|
-
function
|
|
228
|
+
function $(e) {
|
|
222
229
|
let t = e.get("Content-Disposition");
|
|
223
230
|
if (!t) return "";
|
|
224
231
|
let n = t.match(/filename\*\s*=\s*([^']*)'([^']*)'([^;]+)/i);
|
|
@@ -228,14 +235,15 @@ function Z(e) {
|
|
|
228
235
|
let r = t.match(/filename\s*=\s*("([^"]+)"|([^;]+))/i);
|
|
229
236
|
return r ? (r[2] ?? r[3] ?? "").trim() : "";
|
|
230
237
|
}
|
|
231
|
-
async function
|
|
232
|
-
return (await
|
|
238
|
+
async function ee(e, t = {}, { isSessionProbe: n = !1, keepalive: r = !1 } = {}) {
|
|
239
|
+
return (await J(`/api/actions/${encodeURIComponent(e)}`, {
|
|
233
240
|
method: "POST",
|
|
234
|
-
body:
|
|
241
|
+
body: h(t),
|
|
242
|
+
keepalive: r
|
|
235
243
|
}, {
|
|
236
244
|
setAccept: !1,
|
|
237
245
|
isSessionProbe: n
|
|
238
|
-
},
|
|
246
|
+
}, Y)).result;
|
|
239
247
|
}
|
|
240
248
|
//#endregion
|
|
241
|
-
export {
|
|
249
|
+
export { C as RefreshDeadError, X as apiFetch, Q as apiFetchBlob, ee as callHandler, D as cancelProactiveRefresh, K as currentPublishedLanguage, F as ensureRefresh, R as getPersistentAuthFailureHandler, P as isTransientFailure, $ as parseContentDispositionFilename, G as publishLanguage, W as publishLanguageFor, E as scheduleProactiveRefresh, U as setLanguageReader, L as setPersistentAuthFailureHandler, q as withPublishedLanguage };
|
package/dist-lib/api/schema.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
import { recordActionTimeouts as e } from "./request-bounds.js";
|
|
2
|
-
import { apiFetch as t,
|
|
3
|
-
import { OrderedMap as
|
|
2
|
+
import { apiFetch as t, publishLanguageFor as n } from "./client.js";
|
|
3
|
+
import { OrderedMap as r } from "../types/ordmap.js";
|
|
4
4
|
//#region src/api/schema.ts
|
|
5
|
-
function
|
|
5
|
+
function i(e) {
|
|
6
6
|
return {
|
|
7
7
|
...e,
|
|
8
|
-
params: e.params ?
|
|
8
|
+
params: e.params ? r.fromWire(e.params) : void 0
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function a(e) {
|
|
12
12
|
return {
|
|
13
13
|
...e,
|
|
14
|
-
resolved_params: e.resolved_params ?
|
|
14
|
+
resolved_params: e.resolved_params ? r.fromWire(e.resolved_params) : void 0
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function o(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] = i(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] = a(r);
|
|
22
22
|
return {
|
|
23
23
|
...e,
|
|
24
|
-
fields:
|
|
25
|
-
files: e.files ?
|
|
26
|
-
variants: e.variants ?
|
|
24
|
+
fields: r.fromWire(e.fields),
|
|
25
|
+
files: e.files ? r.fromWire(e.files) : void 0,
|
|
26
|
+
variants: e.variants ? r.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 s(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] = o(r);
|
|
34
34
|
let n = {};
|
|
35
|
-
if (e.structures) for (let [t,
|
|
36
|
-
...
|
|
37
|
-
fields:
|
|
35
|
+
if (e.structures) for (let [t, i] of Object.entries(e.structures)) n[t] = {
|
|
36
|
+
...i,
|
|
37
|
+
fields: r.fromWire(i.fields)
|
|
38
38
|
};
|
|
39
|
-
let
|
|
40
|
-
if (e.handlers) for (let [t, n] of Object.entries(e.handlers))
|
|
39
|
+
let s = {};
|
|
40
|
+
if (e.handlers) for (let [t, n] of Object.entries(e.handlers)) s[t] = i(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] = a(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 ? r.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: s,
|
|
56
56
|
actions: c,
|
|
57
57
|
screens: l
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
async function
|
|
61
|
-
let
|
|
62
|
-
if (
|
|
63
|
-
let
|
|
64
|
-
return
|
|
65
|
-
schema:
|
|
66
|
-
audience:
|
|
67
|
-
requestedAt:
|
|
60
|
+
async function c() {
|
|
61
|
+
let r = performance.now(), { audience: i, ...a } = await t("/api/schema", { cache: "no-cache" });
|
|
62
|
+
if (i === void 0) throw Error("/api/schema answered without its audience");
|
|
63
|
+
let o = s(a);
|
|
64
|
+
return n(i, o.language), e(o), {
|
|
65
|
+
schema: o,
|
|
66
|
+
audience: i,
|
|
67
|
+
requestedAt: r
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
//#endregion
|
|
71
|
-
export {
|
|
71
|
+
export { c as fetchSchema };
|