@wssto2/vue-core 0.4.28 → 0.5.1
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/CHANGELOG.md +77 -0
- package/dist/{AccessGate.vue_vue_type_script_setup_true_lang-J5HoyGNJ.js → AccessGate.vue_vue_type_script_setup_true_lang-DZ9GcLC1.js} +1 -1
- package/dist/{ActionRow.vue_vue_type_script_setup_true_lang-QPvYudWc.js → ActionRow.vue_vue_type_script_setup_true_lang-BCgKzUvG.js} +1 -1
- package/dist/{Activity-BWkVX1Nx.js → Activity-dpY2kIs2.js} +7 -7
- package/dist/{Changes-MG77TDwz.js → Changes-CL8F1w8q.js} +6 -6
- package/dist/{CollectionPage.vue_vue_type_script_setup_true_lang-Bnpv9TEj.js → CollectionPage.vue_vue_type_script_setup_true_lang-l-e-6WeS.js} +4 -4
- package/dist/{DateField.vue_vue_type_script_setup_true_lang-CpuH0WTl.js → DateField.vue_vue_type_script_setup_true_lang-DRuWzSaX.js} +1 -1
- package/dist/{DeadLetters-CkDE71B3.js → DeadLetters-BZLyL5lR.js} +7 -7
- package/dist/{FormErrors.vue_vue_type_script_setup_true_lang-DGOSc-PS.js → FormErrors.vue_vue_type_script_setup_true_lang-D7edzNTL.js} +2 -2
- package/dist/{FormGroup.vue_vue_type_script_setup_true_lang-DSwSRsA5.js → FormGroup.vue_vue_type_script_setup_true_lang-BPchlRCl.js} +2 -2
- package/dist/{FormView.vue_vue_type_script_setup_true_lang-BUrYkjmF.js → FormView.vue_vue_type_script_setup_true_lang-CPSYV7iQ.js} +2 -2
- package/dist/{General-UTBVEXbN.js → General-mrVzi-5R.js} +10 -10
- package/dist/MenuButton.vue_vue_type_script_setup_true_lang-AGbN9r5q.js +28 -0
- package/dist/{NewRolePage-B7DwFWPk.js → NewRolePage-B2DItwvf.js} +3 -3
- package/dist/{NumberField.vue_vue_type_script_setup_true_lang-DaE5BLm4.js → NumberField.vue_vue_type_script_setup_true_lang-ButMV_sf.js} +1 -1
- package/dist/ProfilePage-EiTIYzZ5.js +764 -0
- package/dist/RoleEditor.vue_vue_type_script_setup_true_lang-BqqilJGF.js +325 -0
- package/dist/RolePage-jMHAt9y8.js +314 -0
- package/dist/{RolesPage-B5RwSZ89.js → RolesPage-B9GaVQBx.js} +6 -6
- package/dist/{SectionNavigator.vue_vue_type_script_setup_true_lang-Dmv6TpCi.js → SectionNavigator.vue_vue_type_script_setup_true_lang-Ci04hApd.js} +1 -1
- package/dist/{SegmentedField.vue_vue_type_script_setup_true_lang-Dg-_ZjgR.js → SegmentedField.vue_vue_type_script_setup_true_lang-BwyMvkis.js} +1 -1
- package/dist/{SelectField.vue_vue_type_script_setup_true_lang-C3FbRQW7.js → SelectField.vue_vue_type_script_setup_true_lang-BzQC1qDQ.js} +11 -12
- package/dist/SessionList.vue_vue_type_script_setup_true_lang-DhoTd5D7.js +133 -0
- package/dist/{Sessions-DWj2OGo0.js → Sessions-CHLokZ9e.js} +5 -5
- package/dist/SettingsPage-CudoKdXm.js +632 -0
- package/dist/{SignIn-COThB9XN.js → SignIn-ypRvdmjg.js} +7 -7
- package/dist/{SignInPage-CdzgSvRm.js → SignInPage-CbPeKlAo.js} +4 -4
- package/dist/SignIns-BApzbGq-.js +121 -0
- package/dist/{SwitchField.vue_vue_type_script_setup_true_lang-ALvJisiP.js → SwitchField.vue_vue_type_script_setup_true_lang-D_-HACqT.js} +1 -1
- package/dist/{TextField.vue_vue_type_script_setup_true_lang-CP2WeU36.js → TextField.vue_vue_type_script_setup_true_lang-DTAQPbW0.js} +2 -2
- package/dist/{TextareaField.vue_vue_type_script_setup_true_lang-BJ4__cvJ.js → TextareaField.vue_vue_type_script_setup_true_lang-DsjK2C9T.js} +1 -1
- package/dist/{TimeField.vue_vue_type_script_setup_true_lang-DBxKAWRo.js → TimeField.vue_vue_type_script_setup_true_lang-Cz7KhUqt.js} +1 -1
- package/dist/{UserRecord-BWMnXz4q.js → UserRecord-BCTaBajE.js} +13 -13
- package/dist/{UsersList-Chq8yM5C.js → UsersList-CqSK3cQL.js} +9 -9
- package/dist/access/RoleCompareDialog.vue.d.ts +1 -1
- package/dist/access/RoleEditor.vue.d.ts +2 -0
- package/dist/access/constraints.d.ts +28 -0
- package/dist/access/context.d.ts +5 -0
- package/dist/access/feature.d.ts +17 -0
- package/dist/access/index.d.ts +3 -1
- package/dist/access/index.js +11 -9
- package/dist/access/refusals.d.ts +20 -2
- package/dist/app/index.js +118 -116
- package/dist/app/keepAlive.d.ts +4 -8
- package/dist/client/index.js +19 -11
- package/dist/{client-k9euDWF4.js → client-BHPFfBj3.js} +20 -20
- package/dist/collection/index.js +3 -3
- package/dist/content/index.js +66 -37
- package/dist/{contributions-BVBZP5Jb.js → contributions-fx5q5n1u.js} +1 -1
- package/dist/{describeError-B-NMa--w.js → describeError-BqGAUZgX.js} +1 -1
- package/dist/{error-CD7x0Jrz.js → error-Bb_dr_Ay.js} +2 -2
- package/dist/{fieldMessages-6HVzSDqG.js → fieldMessages-DTXpWnBd.js} +7 -7
- package/dist/form/index.js +1235 -1412
- package/dist/{guards-BJZjc3FZ.js → guards-D4mXf_2X.js} +1 -1
- package/dist/{http-BFfkA7gN.js → http-CdQowFlW.js} +1 -1
- package/dist/i18n/index.d.ts +2 -2
- package/dist/i18n/index.js +30 -30
- package/dist/identity/index.d.ts +3 -1
- package/dist/identity/index.js +7 -6
- package/dist/identity/profile/DetailsFields.vue.d.ts +8 -0
- package/dist/identity/profile/{DetailsPanel.vue.d.ts → DetailsGroup.vue.d.ts} +4 -1
- package/dist/identity/profile/{EmailPanel.vue.d.ts → EmailGroup.vue.d.ts} +1 -1
- package/dist/identity/profile/SignInsGroup.vue.d.ts +2 -0
- package/dist/identity/profile/profileSections.d.ts +37 -0
- package/dist/identity/session.d.ts +10 -7
- package/dist/identity/shared/SignInList.vue.d.ts +22 -0
- package/dist/identity/shared/deviceLabel.d.ts +7 -0
- package/dist/identity/useReturnToOwnAccount.d.ts +10 -0
- package/dist/identity/users/context.d.ts +3 -0
- package/dist/identity/users/feature.d.ts +3 -0
- package/dist/index-BTRv8mcf.js +630 -0
- package/dist/index-VPzJJN6Z.js +745 -0
- package/dist/index-auJqVMWC.js +478 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/keepAlive-z3IRFkQq.js +46 -0
- package/dist/modules/notification/entities.d.ts +19 -0
- package/dist/modules/notification/routes.d.ts +25 -1
- package/dist/modules/notification/schemas.d.ts +24 -0
- package/dist/{navigation-DpcDF0rX.js → navigation-Bc5EQ_Si.js} +1 -1
- package/dist/{neighbors-RVQ4O3Qv.js → neighbors-Bv6vnWlW.js} +22 -22
- package/dist/notifications/context.d.ts +24 -1
- package/dist/notifications/feature.d.ts +10 -1
- package/dist/notifications/index.d.ts +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/notifications/push/DevicesSection.vue.d.ts +12 -0
- package/dist/notifications/push/ThisDeviceSection.vue.d.ts +15 -0
- package/dist/notifications/push/browser.d.ts +40 -0
- package/dist/notifications/push/devices.d.ts +15 -0
- package/dist/notifications/push/thisDevice.d.ts +28 -0
- package/dist/notifications/settings/ChannelsSection.vue.d.ts +16 -0
- package/dist/notifications/settings/{QuietHoursPanel.vue.d.ts → QuietHoursSection.vue.d.ts} +3 -1
- package/dist/notifications/settings/SettingsBody.vue.d.ts +17 -0
- package/dist/notifications/settings/settings.d.ts +4 -3
- package/dist/notifications/settings/state.d.ts +4 -2
- package/dist/options-g8RwEhBk.js +366 -0
- package/dist/overlay/index.js +37 -59
- package/dist/page/index.js +1 -1
- package/dist/phone/index.js +10 -11
- package/dist/platform/index.js +3 -3
- package/dist/platform/platform.d.ts +7 -2
- package/dist/platform/session.d.ts +17 -0
- package/dist/platform-Dx6STiwY.js +283 -0
- package/dist/push-worker/index.d.ts +91 -0
- package/dist/push-worker/index.js +54 -0
- package/dist/resource/index.js +1 -1
- package/dist/{routeResource-DlTsGTg_.js → routeResource-CcYA75T2.js} +2 -2
- package/dist/router/index.js +3 -3
- package/dist/{sections-CeZl-Jxg.js → sections-B0HxIOC2.js} +1 -1
- package/dist/shell/index.js +3 -3
- package/dist/signInEvents-DWShrJox.js +30 -0
- package/dist/state/index.js +1 -1
- package/dist/{status-dGvfh1TP.js → status-BUFELJz2.js} +2 -2
- package/dist/styles.css +1 -1
- package/dist/{suggestions-DHJFKB26.js → suggestions-CfFTHi8y.js} +2 -2
- package/dist/testing/index.js +1 -1
- package/dist/{useCommand-Cj-APj-P.js → useCommand-CtqheKUv.js} +2 -2
- package/dist/useGroupSheet-ATvc0IiM.js +278 -0
- package/dist/{useLoad-M7V-AVwR.js → useLoad-W4tfxmm5.js} +1 -1
- package/dist/{useResourceForm-tGYTfKhH.js → useResourceForm-CJfl8rj_.js} +1 -1
- package/package.json +6 -2
- package/dist/KeyValue.vue_vue_type_script_setup_true_lang-wcZcvnow.js +0 -35
- package/dist/OtpInput.vue_vue_type_script_setup_true_lang-gp4FfWAH.js +0 -95
- package/dist/PanelActions.vue_vue_type_script_setup_true_lang-E9VdIGkf.js +0 -46
- package/dist/ProfilePage-C8VhiKIh.js +0 -654
- package/dist/RoleEditor.vue_vue_type_script_setup_true_lang-DRHmjA9w.js +0 -300
- package/dist/RolePage-ODFu68Ce.js +0 -315
- package/dist/SessionList.vue_vue_type_script_setup_true_lang-D5qm77Zo.js +0 -111
- package/dist/SettingsPage-C3fPSmi7.js +0 -255
- package/dist/SignInTable.vue_vue_type_script_setup_true_lang-Bs0yTi2E.js +0 -79
- package/dist/SignIns-cztICmqt.js +0 -66
- package/dist/control-B4SdblL6.js +0 -350
- package/dist/identity/profile/PanelActions.vue.d.ts +0 -17
- package/dist/index-BhtJR4c_.js +0 -459
- package/dist/index-C3E6DcO0.js +0 -706
- package/dist/index-sTBBHqNG.js +0 -504
- package/dist/keepAlive-CDvMQlcJ.js +0 -49
- package/dist/notifications/settings/EmailPanel.vue.d.ts +0 -14
- package/dist/options-Ba_0uLWN.js +0 -18
- package/dist/platform-PZpUkkMS.js +0 -268
- package/dist/route-goWMxDUN.js +0 -13
- package/dist/transport-BnP7WC0Y.js +0 -4
- /package/dist/identity/{profile/PasswordPanel.vue.d.ts → ReturnMenuItem.vue.d.ts} +0 -0
- /package/dist/identity/profile/{SessionsPanel.vue.d.ts → PasswordGroup.vue.d.ts} +0 -0
- /package/dist/identity/profile/{SignInsPanel.vue.d.ts → SessionsGroup.vue.d.ts} +0 -0
package/dist/app/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Se = Object.defineProperty;
|
|
2
2
|
var Re = (e, n, r) => n in e ? Se(e, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[n] = r;
|
|
3
3
|
var Z = (e, n, r) => Re(e, typeof n != "symbol" ? n + "" : n, r);
|
|
4
|
-
import { effectScope as P, watch as W, defineComponent as pe, openBlock as Me, createElementBlock as Ae, createVNode as ee, unref as C, withCtx as te, createTextVNode as
|
|
4
|
+
import { effectScope as P, watch as W, defineComponent as pe, openBlock as Me, createElementBlock as Ae, createVNode as ee, unref as C, withCtx as te, createTextVNode as Le, toDisplayString as je, shallowRef as Ne, computed as Ke, h as se, createApp as Oe } from "vue";
|
|
5
5
|
import { useI18n as Ce, createI18n as _e } from "vue-i18n";
|
|
6
6
|
import { createRouter as Fe, isNavigationFailure as Ie } from "vue-router";
|
|
7
7
|
import { i as Te } from "../leaveGuard-Cc8yeLxM.js";
|
|
@@ -10,32 +10,32 @@ import { coreMessages as oe, createMessageRuntime as We } from "../i18n/index.js
|
|
|
10
10
|
import { i as Be, a as He } from "../Icon.vue_vue_type_script_lang-D7oC-d-S.js";
|
|
11
11
|
import { i as Ve, b as Ge } from "../bottomDock-BZEiOPYZ.js";
|
|
12
12
|
import { i as Je, p as ze } from "../chrome-nUcmVu8G.js";
|
|
13
|
-
import { i as Qe, g as Ue } from "../platform-
|
|
13
|
+
import { i as Qe, g as Ue } from "../platform-Dx6STiwY.js";
|
|
14
14
|
import { c as Xe, A as Ye, r as re } from "../access-DmAceEo5.js";
|
|
15
15
|
import { c as Ze, _ as et } from "../NoAccess.vue_vue_type_script_setup_true_lang-DWxq-MTM.js";
|
|
16
|
-
import { i as tt } from "../guards-
|
|
17
|
-
import { b as st, c as ot, n as ae } from "../navigation-
|
|
18
|
-
import { c as rt, s as ne } from "../contributions-
|
|
19
|
-
import { S as Pt } from "../contributions-
|
|
16
|
+
import { i as tt } from "../guards-D4mXf_2X.js";
|
|
17
|
+
import { b as st, c as ot, n as ae } from "../navigation-Bc5EQ_Si.js";
|
|
18
|
+
import { c as rt, s as ne } from "../contributions-fx5q5n1u.js";
|
|
19
|
+
import { S as Pt } from "../contributions-fx5q5n1u.js";
|
|
20
20
|
import { a as ie } from "../environment-Dva-SG8D.js";
|
|
21
21
|
import { u as Bt } from "../environment-Dva-SG8D.js";
|
|
22
|
-
import { b as ce, c as le } from "../describeError-
|
|
22
|
+
import { b as ce, c as le } from "../describeError-BqGAUZgX.js";
|
|
23
23
|
import { _ as at } from "../Button.vue_vue_type_script_setup_true_lang-CL9Qh5yq.js";
|
|
24
24
|
import { _ as nt } from "../EmptyState.vue_vue_type_script_setup_true_lang-50p-Mp8I.js";
|
|
25
25
|
import { i as it } from "../feature-DdUAfyi4.js";
|
|
26
26
|
import { d as Vt, p as Gt } from "../feature-DdUAfyi4.js";
|
|
27
|
-
import { k as zt } from "../keepAlive-
|
|
27
|
+
import { k as zt } from "../keepAlive-z3IRFkQq.js";
|
|
28
28
|
function ct(e) {
|
|
29
29
|
const { platform: n } = e, r = P();
|
|
30
|
-
let i = null,
|
|
30
|
+
let i = null, v = null, y = !1;
|
|
31
31
|
function E(l, m) {
|
|
32
32
|
const h = new AbortController(), u = { controller: h, stops: [] };
|
|
33
33
|
for (const k of l)
|
|
34
34
|
try {
|
|
35
|
-
const
|
|
36
|
-
typeof
|
|
37
|
-
} catch (
|
|
38
|
-
e.onError(
|
|
35
|
+
const b = m(k, h.signal);
|
|
36
|
+
typeof b == "function" && u.stops.push({ owned: k, stop: b });
|
|
37
|
+
} catch (b) {
|
|
38
|
+
e.onError(b, k);
|
|
39
39
|
}
|
|
40
40
|
return u;
|
|
41
41
|
}
|
|
@@ -50,24 +50,24 @@ function ct(e) {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
const
|
|
53
|
+
const L = (l) => e.effects.filter((m) => m.effect.scope === l), M = (l) => l.status !== "authenticated" ? null : e.sessionKey ? e.sessionKey(l) : String(l.user.id);
|
|
54
54
|
return {
|
|
55
55
|
start() {
|
|
56
|
-
if (
|
|
56
|
+
if (y || i) return;
|
|
57
57
|
i = E(
|
|
58
|
-
|
|
58
|
+
L("app"),
|
|
59
59
|
(m, h) => m.effect.start({ signal: h, platform: n, report: (u) => e.onError(u, m) })
|
|
60
60
|
);
|
|
61
|
-
const l =
|
|
61
|
+
const l = L("session");
|
|
62
62
|
r.run(
|
|
63
63
|
() => W(
|
|
64
64
|
() => M(n.session.state.value),
|
|
65
65
|
(m) => {
|
|
66
|
-
R(
|
|
66
|
+
R(v), v = null;
|
|
67
67
|
const h = n.session.state.value;
|
|
68
|
-
m === null || h.status !== "authenticated" || (
|
|
68
|
+
m === null || h.status !== "authenticated" || (v = E(
|
|
69
69
|
l,
|
|
70
|
-
(u, k) => u.effect.start({ signal: k, platform: n, user: h.user, report: (
|
|
70
|
+
(u, k) => u.effect.start({ signal: k, platform: n, user: h.user, report: (b) => e.onError(b, u) })
|
|
71
71
|
));
|
|
72
72
|
},
|
|
73
73
|
{ immediate: !0, flush: "sync" }
|
|
@@ -75,7 +75,7 @@ function ct(e) {
|
|
|
75
75
|
);
|
|
76
76
|
},
|
|
77
77
|
dispose() {
|
|
78
|
-
|
|
78
|
+
y || (y = !0, r.stop(), R(v), R(i), v = i = null);
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
81
|
}
|
|
@@ -97,10 +97,10 @@ const lt = { class: "mx-auto flex min-h-screen max-w-content items-center justif
|
|
|
97
97
|
ee(C(at), {
|
|
98
98
|
prominence: "primary",
|
|
99
99
|
icon: "refreshLine",
|
|
100
|
-
onClick: i[0] || (i[0] = (
|
|
100
|
+
onClick: i[0] || (i[0] = (v) => r.$emit("retry"))
|
|
101
101
|
}, {
|
|
102
102
|
default: te(() => [
|
|
103
|
-
je(
|
|
103
|
+
Le(je(C(n)("core.actions.retry")), 1)
|
|
104
104
|
]),
|
|
105
105
|
_: 1
|
|
106
106
|
})
|
|
@@ -119,7 +119,7 @@ ${r.map((i) => ` - [${i.owner}] ${i.message}`).join(`
|
|
|
119
119
|
this.name = "ApplicationError", this.issues = r;
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
const fe = "application",
|
|
122
|
+
const fe = "application", w = (e) => `feature "${e.id}"`;
|
|
123
123
|
function* B(e, n = "") {
|
|
124
124
|
for (const r of e) {
|
|
125
125
|
const i = r.path.startsWith("/") ? r.path : `${n.replace(/\/$/, "")}/${r.path}`;
|
|
@@ -131,81 +131,81 @@ function ft(e) {
|
|
|
131
131
|
e.features.forEach((o, s) => {
|
|
132
132
|
it(o) ? i.push(o) : r(fe, `features[${s}] was not created with defineFeature().`);
|
|
133
133
|
});
|
|
134
|
-
const
|
|
134
|
+
const v = /* @__PURE__ */ new Map();
|
|
135
135
|
for (const o of i)
|
|
136
|
-
|
|
136
|
+
v.has(o.id) ? r(w(o), `the feature id "${o.id}" is used twice in the features list.`) : v.set(o.id, o);
|
|
137
137
|
for (const o of i)
|
|
138
138
|
for (const s of o.requires)
|
|
139
|
-
|
|
140
|
-
const
|
|
139
|
+
v.has(s) || r(w(o), `requires the feature "${s}", which is not in the features list.`);
|
|
140
|
+
const y = [], E = /* @__PURE__ */ new Set(), R = (o) => {
|
|
141
141
|
if (E.has(o.id)) return;
|
|
142
|
-
const s =
|
|
142
|
+
const s = y.indexOf(o.id);
|
|
143
143
|
if (s !== -1) {
|
|
144
|
-
r(
|
|
144
|
+
r(w(o), `requirements form a cycle: ${[...y.slice(s), o.id].join(" -> ")}.`), E.add(o.id);
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
|
-
|
|
147
|
+
y.push(o.id);
|
|
148
148
|
for (const c of o.requires) {
|
|
149
|
-
const
|
|
150
|
-
|
|
149
|
+
const f = v.get(c);
|
|
150
|
+
f && R(f);
|
|
151
151
|
}
|
|
152
|
-
|
|
152
|
+
y.pop(), E.add(o.id);
|
|
153
153
|
};
|
|
154
154
|
i.forEach(R);
|
|
155
|
-
const
|
|
155
|
+
const L = new Set(e.platform.config.capabilities);
|
|
156
156
|
for (const o of i)
|
|
157
157
|
for (const s of o.backend)
|
|
158
|
-
|
|
158
|
+
L.has(s) || r(w(o), `needs the backend capability "${s}", which the server does not report.`);
|
|
159
159
|
const M = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
160
160
|
for (const o of i) {
|
|
161
161
|
for (const s of o.routes) {
|
|
162
|
-
const c = s.path.length > 1 ? s.path.replace(/\/$/, "") : s.path,
|
|
163
|
-
|
|
162
|
+
const c = s.path.length > 1 ? s.path.replace(/\/$/, "") : s.path, f = l.get(c);
|
|
163
|
+
f ? r(w(o), `declares the path "${s.path}", which feature "${f.id}" declares too.`) : l.set(c, o);
|
|
164
164
|
}
|
|
165
165
|
for (const { record: s } of B(o.routes)) {
|
|
166
|
-
if (s.meta && "feature" in s.meta && r(
|
|
166
|
+
if (s.meta && "feature" in s.meta && r(w(o), `the route "${String(s.name ?? s.path)}" sets meta.feature, which the runtime owns.`), typeof s.name != "string") continue;
|
|
167
167
|
const c = M.get(s.name);
|
|
168
|
-
c ? r(
|
|
168
|
+
c ? r(w(o), `declares the route name "${s.name}", which feature "${c.id}" declares too.`) : M.set(s.name, o);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
const m = new Set(e.reservedContexts), h = /* @__PURE__ */ new Map();
|
|
172
172
|
for (const o of i)
|
|
173
173
|
for (const { key: s } of o.contexts) {
|
|
174
174
|
const c = s.description ?? "a context";
|
|
175
|
-
m.has(s) && r(
|
|
176
|
-
const
|
|
177
|
-
|
|
175
|
+
m.has(s) && r(w(o), `provides the context "${c}", which the runtime provides itself.`);
|
|
176
|
+
const f = h.get(s);
|
|
177
|
+
f ? r(w(o), `provides the context "${c}", which feature "${f.id}" provides too.`) : h.set(s, o);
|
|
178
178
|
}
|
|
179
179
|
const u = /* @__PURE__ */ new Map(), k = (o, s) => {
|
|
180
180
|
for (const c of s) {
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
for (const
|
|
184
|
-
e.supportedLocales.includes(
|
|
181
|
+
const f = u.get(c.namespace);
|
|
182
|
+
f ? r(o, `declares the message namespace "${c.namespace}", which ${f} declares too.`) : u.set(c.namespace, o);
|
|
183
|
+
for (const j of Object.keys(c.loaders))
|
|
184
|
+
e.supportedLocales.includes(j) || r(o, `the namespace "${c.namespace}" has a loader for "${j}", which is not a supported locale (${e.supportedLocales.join(", ")}).`);
|
|
185
185
|
}
|
|
186
186
|
};
|
|
187
|
-
for (const o of i) k(
|
|
187
|
+
for (const o of i) k(w(o), o.messages);
|
|
188
188
|
k(fe, e.messages);
|
|
189
|
-
const
|
|
189
|
+
const b = (o) => u.has(o);
|
|
190
190
|
for (const o of i)
|
|
191
191
|
for (const { record: s } of B(o.routes))
|
|
192
192
|
for (const c of s.meta?.messages ?? [])
|
|
193
|
-
|
|
193
|
+
b(c) || r(w(o), `the route "${String(s.name ?? s.path)}" needs the message namespace "${c}", which nobody declares.`);
|
|
194
194
|
const x = /* @__PURE__ */ new Map();
|
|
195
195
|
for (const o of i)
|
|
196
196
|
for (const s of o.contributions) {
|
|
197
197
|
const c = x.get(s.id);
|
|
198
|
-
c ? r(
|
|
199
|
-
for (const
|
|
200
|
-
|
|
198
|
+
c ? r(w(o), `declares the shell contribution "${s.id}", which feature "${c.id}" declares too.`) : x.set(s.id, o), e.shellSlots && !s.optional && !e.shellSlots.includes(s.slot) && r(w(o), `contributes "${s.id}" to the slot "${s.slot}", which the shell does not render (it renders ${e.shellSlots.join(", ") || "none"}). Mark it optional to leave it out instead.`);
|
|
199
|
+
for (const f of s.messages ?? [])
|
|
200
|
+
b(f) || r(w(o), `the contribution "${s.id}" needs the message namespace "${f}", which nobody declares.`);
|
|
201
201
|
}
|
|
202
202
|
const A = /* @__PURE__ */ new Map();
|
|
203
203
|
for (const o of i)
|
|
204
204
|
for (const s of o.effects) {
|
|
205
205
|
const c = A.get(s.id);
|
|
206
|
-
c ? r(
|
|
207
|
-
const
|
|
208
|
-
|
|
206
|
+
c ? r(w(o), `declares the effect "${s.id}", which feature "${c.id}" declares too.`) : A.set(s.id, o);
|
|
207
|
+
const f = s.scope;
|
|
208
|
+
f !== "app" && f !== "session" && r(w(o), `the effect "${s.id}" has the scope "${f}"; use "app" or "session".`);
|
|
209
209
|
}
|
|
210
210
|
return { features: i, issues: n };
|
|
211
211
|
}
|
|
@@ -226,20 +226,20 @@ function me(e, n) {
|
|
|
226
226
|
}
|
|
227
227
|
const de = (e) => [...new Set(e)];
|
|
228
228
|
function Tt(e) {
|
|
229
|
-
const { platform: n } = e, r = e.locale?.supported ?? Object.keys(oe), i = e.locale?.fallback ?? "en",
|
|
230
|
-
r.includes(i) ||
|
|
229
|
+
const { platform: n } = e, r = e.locale?.supported ?? Object.keys(oe), i = e.locale?.fallback ?? "en", v = e.shell === void 0 ? void 0 : pt(e.shell) ? e.shell : { component: e.shell, slots: void 0, progress: void 0 }, y = [];
|
|
230
|
+
r.includes(i) || y.push({ owner: "application", message: `the fallback locale "${i}" is not among the supported locales (${r.join(", ")}).` });
|
|
231
231
|
for (const t of Object.keys(e.locale?.flags ?? {}))
|
|
232
|
-
r.includes(t) ||
|
|
232
|
+
r.includes(t) || y.push({ owner: "application", message: `locale.flags names the locale "${t}", which is not among the supported locales (${r.join(", ")}).` });
|
|
233
233
|
const E = e.locale?.initial ?? (r.includes(n.config.locale) ? n.config.locale : i);
|
|
234
|
-
r.includes(E) ||
|
|
235
|
-
const R = [Ue, Pe, ze, Ge, He, ae, ne, re, ie, ce, le],
|
|
234
|
+
r.includes(E) || y.push({ owner: "application", message: `the initial locale "${E}" is not among the supported locales (${r.join(", ")}).` });
|
|
235
|
+
const R = [Ue, Pe, ze, Ge, He, ae, ne, re, ie, ce, le], L = ft({
|
|
236
236
|
features: e.features,
|
|
237
237
|
platform: n,
|
|
238
238
|
messages: e.messages ?? [],
|
|
239
239
|
reservedContexts: R,
|
|
240
240
|
supportedLocales: r,
|
|
241
|
-
shellSlots:
|
|
242
|
-
}), M = [...
|
|
241
|
+
shellSlots: v?.slots
|
|
242
|
+
}), M = [...y, ...L.issues], l = L.features, m = st(
|
|
243
243
|
l.flatMap((t) => t.navigation.map((a) => ({ feature: t.id, binding: a }))),
|
|
244
244
|
e.navigation
|
|
245
245
|
);
|
|
@@ -248,9 +248,9 @@ function Tt(e) {
|
|
|
248
248
|
const h = dt(E, i, e.i18n), u = h.global;
|
|
249
249
|
for (const [t, a] of Object.entries(oe)) u.mergeLocaleMessage(t, a);
|
|
250
250
|
for (const [t, a] of Object.entries(e.i18n?.messages ?? {})) u.mergeLocaleMessage(t, a);
|
|
251
|
-
const k = qe({ locale: () => u.locale.value, formatters: e.formatting }),
|
|
251
|
+
const k = qe({ locale: () => u.locale.value, formatters: e.formatting }), b = [...l.flatMap((t) => t.messages), ...e.messages ?? []], x = (t) => (e.onError ?? mt)({ ...t, route: s.currentRoute.value.matched.length > 0 ? s.currentRoute.value.fullPath : null }), A = We({
|
|
252
252
|
target: u,
|
|
253
|
-
namespaces:
|
|
253
|
+
namespaces: b,
|
|
254
254
|
fallback: i,
|
|
255
255
|
supported: r,
|
|
256
256
|
onFailure: (t) => x({ source: "messages", error: t.error, detail: `${t.namespace} (${t.locale})`, feature: o.get(t.namespace) })
|
|
@@ -258,39 +258,39 @@ function Tt(e) {
|
|
|
258
258
|
history: e.router?.history ?? Ze(),
|
|
259
259
|
routes: l.flatMap((t) => me(t.routes, t.id)),
|
|
260
260
|
scrollBehavior: e.router?.scrollBehavior ?? ((t, a) => t.name === a.name ? !1 : { top: 0 })
|
|
261
|
-
}), c = e.router?.login ?? { name: "login" },
|
|
261
|
+
}), c = e.router?.login ?? { name: "login" }, f = e.router?.home ?? { path: "/" }, j = [], H = (t) => {
|
|
262
262
|
try {
|
|
263
263
|
return s.resolve(t).matched.length > 0 ? null : "matches no route";
|
|
264
264
|
} catch (a) {
|
|
265
|
-
const
|
|
266
|
-
return
|
|
265
|
+
const p = a instanceof Error ? a.message : String(a);
|
|
266
|
+
return p.startsWith("No match for") ? "matches no route" : `cannot be resolved (${p})`;
|
|
267
267
|
}
|
|
268
268
|
};
|
|
269
269
|
if (l.some((t) => t.routes.some((a) => a.meta?.public !== !0))) {
|
|
270
270
|
const t = H(c) ?? (s.resolve(c).meta.public === !0 ? null : "is not public (meta.public: true)");
|
|
271
|
-
t &&
|
|
271
|
+
t && j.push({ owner: "application", message: `the login route ${JSON.stringify(c)} ${t.replace("matches no route", "does not exist")}, but protected routes are installed: an anonymous visitor would have nowhere to go. Install a feature with the login route or set router.login.` });
|
|
272
272
|
}
|
|
273
273
|
for (const { feature: t, binding: a } of m.destinations.values()) {
|
|
274
|
-
const
|
|
275
|
-
|
|
274
|
+
const p = H(a.to);
|
|
275
|
+
p && j.push({ owner: `feature "${t}"`, message: `the destination "${a.destination}" is bound to ${JSON.stringify(a.to)}, which ${p}.` });
|
|
276
276
|
}
|
|
277
|
-
if (
|
|
278
|
-
const N = Ne({ status: "idle" }),
|
|
277
|
+
if (j.length > 0) throw new ue(j);
|
|
278
|
+
const N = Ne({ status: "idle" }), _ = {
|
|
279
279
|
state: N,
|
|
280
280
|
locale: Ke(() => u.locale.value),
|
|
281
281
|
locales: r,
|
|
282
282
|
localeFlags: e.locale?.flags ?? {},
|
|
283
283
|
setLocale: async (t) => {
|
|
284
|
-
const a = u.locale.value,
|
|
285
|
-
if (
|
|
286
|
-
const
|
|
284
|
+
const a = u.locale.value, p = await A.setLocale(t);
|
|
285
|
+
if (p && u.locale.value !== a) {
|
|
286
|
+
const g = (O) => x({ source: "locale", error: O, detail: t });
|
|
287
287
|
try {
|
|
288
|
-
Promise.resolve(e.locale?.onChange?.(t)).catch(
|
|
288
|
+
Promise.resolve(e.locale?.onChange?.(t)).catch(g);
|
|
289
289
|
} catch (O) {
|
|
290
|
-
|
|
290
|
+
g(O);
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
return
|
|
293
|
+
return p;
|
|
294
294
|
},
|
|
295
295
|
retry: () => D()
|
|
296
296
|
}, I = {
|
|
@@ -303,50 +303,50 @@ function Tt(e) {
|
|
|
303
303
|
onError: (t, a) => x({ source: "effect", error: t, feature: a.feature, detail: a.effect.id })
|
|
304
304
|
}), he = new Map(l.map((t) => [t.id, t.messages.map((a) => a.namespace)])), G = (t) => de(I.contributions.filter(({ contribution: a }) => a.scope === t).flatMap(({ contribution: a }) => a.messages ?? [])), ge = G("always"), we = G("authenticated");
|
|
305
305
|
async function ve(t) {
|
|
306
|
-
const a = t.matched.flatMap((
|
|
307
|
-
await A.load(de([...a, ...ge, ...
|
|
306
|
+
const a = t.matched.flatMap((g) => [...he.get(g.meta.feature ?? "") ?? [], ...g.meta.messages ?? []]), p = n.session.state.value.status === "authenticated";
|
|
307
|
+
await A.load(de([...a, ...ge, ...p ? we : []]));
|
|
308
308
|
}
|
|
309
309
|
let T = null;
|
|
310
310
|
function q(t) {
|
|
311
|
-
const a = t.meta.titleKey,
|
|
312
|
-
|
|
311
|
+
const a = t.meta.titleKey, p = T?.documentTitle.value ?? (a && u.te(a) ? u.t(a) : null), g = (e.router?.documentTitle ?? ht)(p, n.config.appName);
|
|
312
|
+
g !== "" && (document.title = g);
|
|
313
313
|
}
|
|
314
314
|
const ye = ot({ session: n.session, router: s, i18n: u, destinations: m.destinations }), $e = rt(I.contributions, n.session), be = Xe({ router: s, access: n.access, noAccess: e.noAccess ?? et }), Ee = pe({
|
|
315
315
|
name: "ApplicationRoot",
|
|
316
316
|
setup() {
|
|
317
317
|
return () => {
|
|
318
318
|
const t = N.value;
|
|
319
|
-
return t.status === "failed" ? se(ut, { kind: t.kind, onRetry: () => void D() }) : t.status !== "ready" ? null : se(
|
|
319
|
+
return t.status === "failed" ? se(ut, { kind: t.kind, onRetry: () => void D() }) : t.status !== "ready" ? null : se(v?.component ?? Ye);
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
|
-
}),
|
|
323
|
-
Qe(
|
|
324
|
-
for (const t of l) for (const { key: a, value:
|
|
322
|
+
}), d = Oe(Ee);
|
|
323
|
+
Qe(d, n), d.use(h), De(d, k), T = Je(d), Ve(d), Te(d), e.icons && Be(d, ...Array.isArray(e.icons) ? e.icons : [e.icons]), d.provide(ie, _), e.describeError && d.provide(ce, e.describeError), e.describeFieldError && d.provide(le, e.describeFieldError), d.provide(ae, ye), d.provide(ne, $e), d.provide(re, be);
|
|
324
|
+
for (const t of l) for (const { key: a, value: p } of t.contexts) d.provide(a, p);
|
|
325
325
|
let S = !1, J = !1, z = !1, Q = !1;
|
|
326
326
|
const K = [];
|
|
327
327
|
function ke() {
|
|
328
|
-
const t =
|
|
329
|
-
|
|
330
|
-
x({ source: "vue", error:
|
|
328
|
+
const t = d.config.errorHandler;
|
|
329
|
+
d.config.errorHandler = ($, xe, Y) => {
|
|
330
|
+
x({ source: "vue", error: $, detail: Y }), t?.($, xe, Y);
|
|
331
331
|
};
|
|
332
|
-
const a = (
|
|
333
|
-
|
|
332
|
+
const a = ($) => x({ source: "unhandledrejection", error: $.reason }), p = ($) => {
|
|
333
|
+
$.error && x({ source: "window", error: $.error });
|
|
334
334
|
};
|
|
335
|
-
window.addEventListener("unhandledrejection", a), window.addEventListener("error",
|
|
336
|
-
window.removeEventListener("unhandledrejection", a), window.removeEventListener("error",
|
|
335
|
+
window.addEventListener("unhandledrejection", a), window.addEventListener("error", p), K.push(() => {
|
|
336
|
+
window.removeEventListener("unhandledrejection", a), window.removeEventListener("error", p);
|
|
337
337
|
});
|
|
338
|
-
const
|
|
339
|
-
n.session.holdExpired(
|
|
338
|
+
const g = l.some(($) => $.holdsExpiredSession);
|
|
339
|
+
n.session.holdExpired(g), K.push(() => n.session.holdExpired(!1)), K.push(
|
|
340
340
|
tt({
|
|
341
341
|
router: s,
|
|
342
342
|
session: n.session,
|
|
343
343
|
login: c,
|
|
344
|
-
home:
|
|
345
|
-
holdExpired:
|
|
344
|
+
home: f,
|
|
345
|
+
holdExpired: g,
|
|
346
346
|
prepare: ve,
|
|
347
347
|
afterNavigation: q,
|
|
348
|
-
progress: e.router?.progress ??
|
|
349
|
-
onError: (
|
|
348
|
+
progress: e.router?.progress ?? v?.progress,
|
|
349
|
+
onError: ($) => x({ source: "router", error: $ })
|
|
350
350
|
})
|
|
351
351
|
);
|
|
352
352
|
const O = P();
|
|
@@ -355,54 +355,56 @@ function Tt(e) {
|
|
|
355
355
|
X.run(
|
|
356
356
|
() => W(
|
|
357
357
|
() => u.locale.value,
|
|
358
|
-
(
|
|
359
|
-
document.documentElement.lang =
|
|
358
|
+
($) => {
|
|
359
|
+
document.documentElement.lang = $, q(s.currentRoute.value);
|
|
360
360
|
},
|
|
361
361
|
{ immediate: !0 }
|
|
362
362
|
)
|
|
363
363
|
), K.push(() => X.stop());
|
|
364
364
|
}
|
|
365
|
-
const
|
|
365
|
+
const F = (t, a) => {
|
|
366
366
|
N.value = { status: "failed", kind: t, error: a };
|
|
367
367
|
};
|
|
368
368
|
async function U() {
|
|
369
369
|
N.value = { status: "starting" };
|
|
370
370
|
const t = await n.session.restore();
|
|
371
371
|
if (S) return;
|
|
372
|
-
if (t.status === "failed") return
|
|
373
|
-
const a =
|
|
372
|
+
if (t.status === "failed") return F("session", t.error);
|
|
373
|
+
const a = t.status === "authenticated" ? t.user.locale : void 0;
|
|
374
|
+
if (typeof a == "string" && a !== u.locale.value && r.includes(a) && await _.setLocale(a), S) return;
|
|
375
|
+
const p = await A.loadEssential();
|
|
374
376
|
if (!S) {
|
|
375
|
-
if (
|
|
377
|
+
if (p.length > 0) return F("messages", p[0].error);
|
|
376
378
|
try {
|
|
377
|
-
const
|
|
379
|
+
const g = await s.replace(s.options.history.location);
|
|
378
380
|
if (S) return;
|
|
379
|
-
if (Ie(
|
|
380
|
-
} catch (
|
|
381
|
-
S ||
|
|
381
|
+
if (Ie(g)) return F("startup", g);
|
|
382
|
+
} catch (g) {
|
|
383
|
+
S || F("startup", g);
|
|
382
384
|
return;
|
|
383
385
|
}
|
|
384
|
-
Q || (
|
|
386
|
+
Q || (d.use(s), Q = !0), N.value = { status: "ready" }, V.start();
|
|
385
387
|
}
|
|
386
388
|
}
|
|
387
389
|
async function D() {
|
|
388
390
|
S || N.value.status !== "failed" || (await A.retry(), await U());
|
|
389
391
|
}
|
|
390
392
|
return {
|
|
391
|
-
app:
|
|
393
|
+
app: d,
|
|
392
394
|
router: s,
|
|
393
395
|
i18n: h,
|
|
394
396
|
state: N,
|
|
395
|
-
locale:
|
|
396
|
-
setLocale:
|
|
397
|
+
locale: _.locale,
|
|
398
|
+
setLocale: _.setLocale,
|
|
397
399
|
async mount(t) {
|
|
398
400
|
if (S) throw new Error("This application was disposed; create a new one with createApplication().");
|
|
399
401
|
if (J) throw new Error("This application is already mounted.");
|
|
400
|
-
J = !0, ke(), await U(), !S && (
|
|
402
|
+
J = !0, ke(), await U(), !S && (d.mount(t), z = !0);
|
|
401
403
|
},
|
|
402
404
|
retry: D,
|
|
403
405
|
dispose() {
|
|
404
406
|
if (!S) {
|
|
405
|
-
S = !0, V.dispose(), A.dispose(), z &&
|
|
407
|
+
S = !0, V.dispose(), A.dispose(), z && d.unmount();
|
|
406
408
|
for (const t of K.reverse()) t();
|
|
407
409
|
s.options.history.destroy();
|
|
408
410
|
}
|
package/dist/app/keepAlive.d.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import type { Platform } from "../platform/platform";
|
|
2
1
|
import type { SessionEffect } from "./feature";
|
|
3
2
|
export interface KeepSessionAliveOptions {
|
|
4
3
|
/** How long before the session expires it is renewed. Default 60 000 ms. */
|
|
5
4
|
margin?: number;
|
|
6
|
-
/**
|
|
7
|
-
* The server call that renews the session (a refresh-token request). After it the session is read
|
|
8
|
-
* again, which brings the new expiry. Without it the session is only read again.
|
|
9
|
-
*/
|
|
10
|
-
renew?: (platform: Platform) => Promise<void>;
|
|
11
5
|
/** When a renewal did not move the expiry, how long to wait before trying again. Default 30 000 ms. */
|
|
12
6
|
retryAfter?: number;
|
|
13
7
|
}
|
|
@@ -16,8 +10,10 @@ export interface KeepSessionAliveOptions {
|
|
|
16
10
|
* when the app comes back to the foreground or the network returns, since timers do not run while a
|
|
17
11
|
* phone sleeps. Skipped while offline. Opt in by listing it in a feature's `effects`:
|
|
18
12
|
*
|
|
19
|
-
* defineFeature({ id: "session", effects: [keepSessionAlive(
|
|
13
|
+
* defineFeature({ id: "session", effects: [keepSessionAlive()] })
|
|
20
14
|
*
|
|
21
|
-
*
|
|
15
|
+
* It renews through `platform.session.renew()`, the platform's `renewSession`, the same single renewal a 401 uses,
|
|
16
|
+
* so a timer and a failed request never present the refresh token twice. A session with no expiry, or one that is
|
|
17
|
+
* not `renewable` (no `renewSession`, or an embed session), has nothing to renew and the effect stays idle.
|
|
22
18
|
*/
|
|
23
19
|
export declare function keepSessionAlive(options?: KeepSessionAliveOptions): SessionEffect;
|
package/dist/client/index.js
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import { R as
|
|
2
|
-
import { A as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { R as p, c as o, f as u } from "../client-BHPFfBj3.js";
|
|
2
|
+
import { A as n, a as f, i as l } from "../error-Bb_dr_Ay.js";
|
|
3
|
+
function s(e, i, r = {}) {
|
|
4
|
+
return { method: e, path: i, permission: r.permission, public: r.public === !0, raw: !1 };
|
|
5
|
+
}
|
|
6
|
+
s.raw = (e, i, r = {}) => ({
|
|
7
|
+
method: e,
|
|
8
|
+
path: i,
|
|
9
|
+
permission: r.permission,
|
|
10
|
+
public: r.public === !0,
|
|
11
|
+
raw: !0
|
|
12
|
+
});
|
|
5
13
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
n as ApiError,
|
|
15
|
+
p as REQUEST_ID_HEADER,
|
|
16
|
+
o as createHttpClient,
|
|
17
|
+
u as fetchTransport,
|
|
18
|
+
f as isAborted,
|
|
19
|
+
l as isApiError,
|
|
20
|
+
s as route
|
|
13
21
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { A, k as I,
|
|
2
|
-
|
|
3
|
-
function D(t) {
|
|
1
|
+
import { A, k as I, i as S } from "./error-Bb_dr_Ay.js";
|
|
2
|
+
function U(t) {
|
|
4
3
|
if (!t) return "";
|
|
5
4
|
const e = new URLSearchParams();
|
|
6
5
|
for (const [a, r] of Object.entries(t))
|
|
@@ -10,7 +9,7 @@ function D(t) {
|
|
|
10
9
|
return e.toString();
|
|
11
10
|
}
|
|
12
11
|
const g = (t) => typeof Blob < "u" && t instanceof Blob;
|
|
13
|
-
function
|
|
12
|
+
function D(t) {
|
|
14
13
|
const e = new FormData();
|
|
15
14
|
for (const [a, r] of Object.entries(t))
|
|
16
15
|
if (r != null)
|
|
@@ -23,23 +22,23 @@ function z(t) {
|
|
|
23
22
|
function E(t) {
|
|
24
23
|
return g(t) ? t : t instanceof Date ? t.toISOString() : typeof t == "object" && t !== null ? JSON.stringify(t) : String(t);
|
|
25
24
|
}
|
|
26
|
-
function
|
|
25
|
+
function z(t) {
|
|
27
26
|
if (t === void 0) return { body: void 0, contentType: null };
|
|
28
27
|
if (typeof t == "string" || t instanceof FormData || t instanceof URLSearchParams || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || g(t))
|
|
29
28
|
return { body: t, contentType: null };
|
|
30
29
|
if (typeof t == "object" && t !== null && !Array.isArray(t)) {
|
|
31
30
|
const e = t;
|
|
32
31
|
if (Object.values(e).some((a) => g(a) || Array.isArray(a) && a.some(g)))
|
|
33
|
-
return { body:
|
|
32
|
+
return { body: D(e), contentType: null };
|
|
34
33
|
}
|
|
35
34
|
return { body: JSON.stringify(t), contentType: "application/json" };
|
|
36
35
|
}
|
|
37
|
-
function
|
|
36
|
+
function v() {
|
|
38
37
|
const t = new Uint8Array(16);
|
|
39
38
|
return globalThis.crypto.getRandomValues(t), Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
40
39
|
}
|
|
41
40
|
const b = "X-Request-ID", T = (t) => typeof t == "object" && t !== null && !Array.isArray(t), w = (t) => typeof t == "string" && t !== "" ? t : null;
|
|
42
|
-
function
|
|
41
|
+
function B(t) {
|
|
43
42
|
const e = t?.errors ?? t?.fields;
|
|
44
43
|
if (!T(e)) return {};
|
|
45
44
|
const a = {};
|
|
@@ -47,7 +46,7 @@ function O(t) {
|
|
|
47
46
|
Array.isArray(i) ? a[r] = i.map(String) : i != null && (a[r] = [String(i)]);
|
|
48
47
|
return a;
|
|
49
48
|
}
|
|
50
|
-
async function
|
|
49
|
+
async function O(t) {
|
|
51
50
|
const e = await t.text();
|
|
52
51
|
if (e.trim() === "") return { payload: null, readable: !0 };
|
|
53
52
|
try {
|
|
@@ -56,10 +55,10 @@ async function C(t) {
|
|
|
56
55
|
return { payload: null, readable: !1 };
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
|
-
async function
|
|
60
|
-
const a = t.headers.get(b) ?? e, { payload: r, readable: i } = await
|
|
58
|
+
async function C(t, e) {
|
|
59
|
+
const a = t.headers.get(b) ?? e, { payload: r, readable: i } = await O(t), o = T(r) ? r : null;
|
|
61
60
|
if (!t.ok) {
|
|
62
|
-
const m =
|
|
61
|
+
const m = B(o), n = o?.params;
|
|
63
62
|
throw new A({
|
|
64
63
|
kind: I(t.status, Object.keys(m).length > 0),
|
|
65
64
|
message: w(o?.error) ?? w(o?.message) ?? `Request failed with status ${t.status}`,
|
|
@@ -86,25 +85,25 @@ async function F(t, e) {
|
|
|
86
85
|
requestId: a
|
|
87
86
|
} : { data: r, meta: null, message: null, status: t.status, requestId: a };
|
|
88
87
|
}
|
|
89
|
-
const H = (t) => /^[a-z][a-z0-9+.-]*:\/\//i.test(t);
|
|
88
|
+
const F = (t, e) => globalThis.fetch(t, e), H = (t) => /^[a-z][a-z0-9+.-]*:\/\//i.test(t);
|
|
90
89
|
function P(t, e, a) {
|
|
91
90
|
const r = H(e) || t === "" ? e : `${t.replace(/\/+$/, "")}/${e.replace(/^\/+/, "")}`;
|
|
92
91
|
return a === "" ? r : `${r}${r.includes("?") ? "&" : "?"}${a}`;
|
|
93
92
|
}
|
|
94
93
|
const j = (t, e) => new A({ kind: "aborted", message: "The request was cancelled", requestId: t, cause: e });
|
|
95
|
-
function
|
|
96
|
-
const { baseUrl: e = "", transport: a =
|
|
94
|
+
function x(t = {}) {
|
|
95
|
+
const { baseUrl: e = "", transport: a = F, credentials: r = "include" } = t;
|
|
97
96
|
async function i(n, s, c, u) {
|
|
98
|
-
const { signal: f } = u, y = t.requestId === !1 ? null : (t.requestId ??
|
|
97
|
+
const { signal: f } = u, y = t.requestId === !1 ? null : (t.requestId ?? v)();
|
|
99
98
|
if (f?.aborted) throw j(y, f.reason);
|
|
100
|
-
const p =
|
|
99
|
+
const p = z(c), l = new Headers({ Accept: "application/json" }), h = t.headers ? await t.headers() : void 0;
|
|
101
100
|
for (const d of [h, u.headers])
|
|
102
101
|
d && new Headers(d).forEach(($, q) => l.set(q, $));
|
|
103
102
|
y !== null && !l.has(b) && l.set(b, y), p.contentType !== null && !l.has("Content-Type") && l.set("Content-Type", p.contentType);
|
|
104
|
-
const k = { method: n, headers: l, credentials: r, body: p.body, signal: f }, R = P(e, s,
|
|
103
|
+
const k = { method: n, headers: l, credentials: r, body: p.body, signal: f }, R = P(e, s, U(u.query));
|
|
105
104
|
try {
|
|
106
105
|
const d = await a(R, k);
|
|
107
|
-
return await
|
|
106
|
+
return await C(d, y);
|
|
108
107
|
} catch (d) {
|
|
109
108
|
throw S(d) ? d : f?.aborted || d instanceof Error && d.name === "AbortError" ? j(y, d) : new A({
|
|
110
109
|
kind: "network",
|
|
@@ -143,5 +142,6 @@ function J(t = {}) {
|
|
|
143
142
|
}
|
|
144
143
|
export {
|
|
145
144
|
b as R,
|
|
146
|
-
|
|
145
|
+
x as c,
|
|
146
|
+
F as f
|
|
147
147
|
};
|