@wssto2/vue-core 0.12.1 → 0.13.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 +33 -0
- package/README.md +4 -2
- package/dist/{AccessGate.vue_vue_type_script_setup_true_lang-CzQbD2Pc.js → AccessGate.vue_vue_type_script_setup_true_lang-DEzXovsY.js} +1 -1
- package/dist/{Activity-CdkJW68R.js → Activity-ChfxdvXf.js} +24 -23
- package/dist/{AdaptivePageShell.vue_vue_type_script_setup_true_lang-D5i77H6S.js → AdaptivePageShell.vue_vue_type_script_setup_true_lang-lPj9hPqV.js} +33 -33
- package/dist/{Changes-DxK_QfiB.js → Changes-BCa43_mO.js} +18 -17
- package/dist/{CollectionPage.vue_vue_type_script_setup_true_lang-x0jyJ01f.js → CollectionPage.vue_vue_type_script_setup_true_lang-C1GCvyZx.js} +6 -6
- package/dist/{DataTable.vue_vue_type_script_setup_true_lang-C_ZytnW-.js → DataTable.vue_vue_type_script_setup_true_lang-B9r9M5Gt.js} +1 -1
- package/dist/{DateField.vue_vue_type_script_setup_true_lang-CeNwBbJT.js → DateField.vue_vue_type_script_setup_true_lang-B5UUY1OO.js} +2 -2
- package/dist/{DeadLetters-DnA7LP1w.js → DeadLetters-wFTqhISU.js} +5 -5
- package/dist/{General-2matxl2Y.js → General-jW7u4MjH.js} +16 -15
- package/dist/{IncidentRecord-Bt3G4HlX.js → IncidentRecord-zTemLz2R.js} +6 -6
- package/dist/{IncidentsList-2iwgqp9J.js → IncidentsList-yu0xSMrH.js} +6 -6
- package/dist/{NewRolePage-DhGFwvk3.js → NewRolePage-CQ5UVaHs.js} +3 -3
- package/dist/{NumberField.vue_vue_type_script_setup_true_lang-B3UrXNqH.js → NumberField.vue_vue_type_script_setup_true_lang-YVgf5CP6.js} +1 -1
- package/dist/{PersonAccess.vue_vue_type_script_setup_true_lang-DbGZSNQc.js → PersonAccess.vue_vue_type_script_setup_true_lang-CWCt9_dM.js} +2 -2
- package/dist/{ProfilePage-CpuyDBAv.js → ProfilePage-Ca3x3UAH.js} +79 -77
- package/dist/{RecordHeader.vue_vue_type_script_setup_true_lang-DqGc3Jyo.js → RecordHeader.vue_vue_type_script_setup_true_lang-Do_ATJwT.js} +1 -1
- package/dist/{ResourcePage.vue_vue_type_script_setup_true_lang-DljhsTU4.js → ResourcePage.vue_vue_type_script_setup_true_lang-Coz91xht.js} +1 -1
- package/dist/{RoleEditor.vue_vue_type_script_setup_true_lang-C0FIotFA.js → RoleEditor.vue_vue_type_script_setup_true_lang-d_aaeXTT.js} +2 -2
- package/dist/{RolePage-DaNv049g.js → RolePage-BUj1w1m1.js} +5 -5
- package/dist/{RolesPage-6hlzJes_.js → RolesPage-NKzBUsrM.js} +3 -3
- package/dist/{SectionNavigator.vue_vue_type_script_setup_true_lang-Dh3sXUt_.js → SectionNavigator.vue_vue_type_script_setup_true_lang-DfKEhTFv.js} +2 -2
- package/dist/{ServiceAccountDialog.vue_vue_type_script_setup_true_lang-FJbWxME_.js → ServiceAccountDialog.vue_vue_type_script_setup_true_lang-4nbhEpv_.js} +10 -9
- package/dist/{ServiceAccountRecord-0-JF5lRx.js → ServiceAccountRecord-ClbyeLhL.js} +8 -8
- package/dist/{ServiceAccountsList-DcsnOcf-.js → ServiceAccountsList-B2VDnYxD.js} +5 -5
- package/dist/{Sessions-DgWhpk-i.js → Sessions-BjkciyHH.js} +23 -21
- package/dist/{SettingsPage-BXPWATYU.js → SettingsPage-Csb14qsx.js} +7 -7
- package/dist/{SignIn-DPoUwHZd.js → SignIn-DPFMv4C7.js} +14 -12
- package/dist/{SignInPage-OyrVemro.js → SignInPage-DukoFqkt.js} +2 -2
- package/dist/{SignIns-BMDrZVVp.js → SignIns-DvdpNkiS.js} +23 -22
- package/dist/{TimeField.vue_vue_type_script_setup_true_lang-D-Em4glH.js → TimeField.vue_vue_type_script_setup_true_lang-DpDXHH7u.js} +2 -2
- package/dist/{Timestamp.vue_vue_type_script_setup_true_lang-ClZAAUMd.js → Timestamp.vue_vue_type_script_setup_true_lang-DlEUKWra.js} +1 -1
- package/dist/{UserRecord-BW-gdCqi.js → UserRecord-B9SeSWQh.js} +57 -55
- package/dist/{UsersList-B3ZF_1Dj.js → UsersList-CREG8q3l.js} +4 -4
- package/dist/access/index.js +4 -4
- package/dist/app/application.d.ts +14 -6
- package/dist/app/current.d.ts +11 -0
- package/dist/app/environment.d.ts +8 -0
- package/dist/app/index.d.ts +1 -0
- package/dist/app/index.js +14 -12
- package/dist/application-DomS6sbx.js +435 -0
- package/dist/collection/http.d.ts +16 -1
- package/dist/collection/index.d.ts +1 -1
- package/dist/collection/index.js +34 -32
- package/dist/content/Money.vue.d.ts +1 -1
- package/dist/content/index.js +151 -158
- package/dist/{contributions-CeG4bszd.js → contributions-obnyn03x.js} +1 -1
- package/dist/current-B0lHKTWr.js +17 -0
- package/dist/form/DateField.vue.d.ts +2 -2
- package/dist/form/DateTimeField.vue.d.ts +2 -2
- package/dist/form/MoneyField.vue.d.ts +1 -1
- package/dist/form/NumberField.vue.d.ts +1 -1
- package/dist/form/date/MonthYearPanel.vue.d.ts +1 -1
- package/dist/form/date/days.d.ts +3 -3
- package/dist/form/index.d.ts +2 -0
- package/dist/form/index.js +1111 -1081
- package/dist/form/zodErrorMap.d.ts +35 -0
- package/dist/format/format.d.ts +51 -6
- package/dist/format/index.d.ts +1 -1
- package/dist/format/index.js +1 -1
- package/dist/format-DoKs29bZ.js +118 -0
- package/dist/{guards-Biv_SlGn.js → guards-DGcSfTEh.js} +1 -1
- package/dist/http-DOEfFCDA.js +107 -0
- package/dist/i18n/index.js +15 -15
- package/dist/identity/index.d.ts +2 -0
- package/dist/identity/index.js +43 -40
- package/dist/identity/usePreferences.d.ts +19 -0
- package/dist/incidents/clientErrorReporter.d.ts +2 -1
- package/dist/incidents/index.js +1 -1
- package/dist/{index-kEHY7hcG.js → index-Be9Q1PB_.js} +78 -76
- package/dist/{index-Cq9TuOqH.js → index-DZikGJ8L.js} +457 -511
- package/dist/{index-ClJeyW3F.js → index-D_yyd4C2.js} +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/intlLocale.d.ts +5 -2
- package/dist/modules/identity/entities.d.ts +4 -0
- package/dist/modules/identity/routes.d.ts +5 -2
- package/dist/modules/identity/schemas.d.ts +6 -2
- package/dist/modules/incident/routes.d.ts +2 -0
- package/dist/modules/incident/schemas.d.ts +2 -0
- package/dist/{navigation-TnVFYRaX.js → navigation-CctcxT51.js} +1 -1
- package/dist/{neighbors-OyvGi233.js → neighbors-Csfan8Ho.js} +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/onboarding/Tip.vue.d.ts +41 -0
- package/dist/onboarding/index.d.ts +1 -0
- package/dist/onboarding/index.js +145 -0
- package/dist/onboarding/tips.d.ts +5 -0
- package/dist/page/index.js +3 -3
- package/dist/phone/index.js +74 -74
- package/dist/phone/phone.d.ts +3 -3
- package/dist/platform/httpSession.d.ts +1 -1
- package/dist/platform/index.d.ts +2 -0
- package/dist/platform/index.js +16 -13
- package/dist/platform/preferences.d.ts +35 -0
- package/dist/platform/session.d.ts +6 -1
- package/dist/platform-DtISOEt7.js +284 -0
- package/dist/playwright/session.d.ts +2 -0
- package/dist/preferences-hYhrw8Uy.js +91 -0
- package/dist/resource/index.d.ts +1 -0
- package/dist/resource/index.js +24 -8
- package/dist/resource/read.d.ts +16 -0
- package/dist/router/index.js +3 -3
- package/dist/{rowLayout-BsKEzEME.js → rowLayout-y1IB_h2r.js} +2 -2
- package/dist/{sections-CvUwZ-S1.js → sections-fkW_IJLc.js} +1 -1
- package/dist/{serverMessages-B6GHgi40.js → serverMessages-Ddghrewh.js} +1 -1
- package/dist/shell/darkMode.d.ts +13 -8
- package/dist/shell/index.js +396 -384
- package/dist/{state-6KSYsVw0.js → state-CXMexi0l.js} +1 -1
- package/dist/styles.css +1 -1
- package/dist/testing/app.d.ts +11 -0
- package/dist/testing/format.d.ts +4 -2
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +96 -89
- package/dist/testing/platform.d.ts +2 -0
- package/dist/usePreferences-B8LIZp_f.js +47 -0
- package/dist/{useTypedEntry-C_Bk4sI0.js → useTypedEntry-DKs8I1yP.js} +279 -280
- package/package.json +6 -2
- package/src/styles/components.css +17 -0
- package/dist/application-CuzT-0vW.js +0 -420
- package/dist/format-D8KUBmbS.js +0 -87
- package/dist/http-Dm0uXY9O.js +0 -95
- package/dist/intlLocale-CeRU44qJ.js +0 -4
- package/dist/platform-BQOX_Ntw.js +0 -283
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wssto2/vue-core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"goCore": "v1.
|
|
3
|
+
"version": "0.13.1",
|
|
4
|
+
"goCore": "v1.18.1",
|
|
5
5
|
"description": "Shared Vue 3 library for go-core applications: app shell, list / record / form pages and their controls.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vue",
|
|
@@ -122,6 +122,10 @@
|
|
|
122
122
|
"types": "./dist/access/index.d.ts",
|
|
123
123
|
"import": "./dist/access/index.js"
|
|
124
124
|
},
|
|
125
|
+
"./onboarding": {
|
|
126
|
+
"types": "./dist/onboarding/index.d.ts",
|
|
127
|
+
"import": "./dist/onboarding/index.js"
|
|
128
|
+
},
|
|
125
129
|
"./notifications": {
|
|
126
130
|
"types": "./dist/notifications/index.d.ts",
|
|
127
131
|
"import": "./dist/notifications/index.js"
|
|
@@ -77,3 +77,20 @@
|
|
|
77
77
|
:where(.skeleton-bar) {
|
|
78
78
|
height: 1rem;
|
|
79
79
|
}
|
|
80
|
+
|
|
81
|
+
/* The element a Tip points at breathes while the tip is open. */
|
|
82
|
+
@keyframes app-tip-glow {
|
|
83
|
+
0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--app-tint) 45%, transparent); }
|
|
84
|
+
50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--app-tint) 0%, transparent); }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
[data-tip-anchor] {
|
|
88
|
+
animation: app-tip-glow 2s ease-in-out infinite;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@media (prefers-reduced-motion: reduce) {
|
|
92
|
+
[data-tip-anchor] {
|
|
93
|
+
animation: none;
|
|
94
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--app-tint) 45%, transparent);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -1,420 +0,0 @@
|
|
|
1
|
-
var Me = Object.defineProperty;
|
|
2
|
-
var Le = (e, n, o) => n in e ? Me(e, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[n] = o;
|
|
3
|
-
var ee = (e, n, o) => Le(e, typeof n != "symbol" ? n + "" : n, o);
|
|
4
|
-
import { effectScope as W, watch as B, defineComponent as me, openBlock as je, createElementBlock as Ae, createVNode as te, unref as K, withCtx as se, createTextVNode as Ne, toDisplayString as Ke, shallowRef as Oe, computed as _e, h as oe, createApp as Ce } from "vue";
|
|
5
|
-
import { useI18n as Fe, createI18n as Ie } from "vue-i18n";
|
|
6
|
-
import { createRouter as Te, isNavigationFailure as qe } from "vue-router";
|
|
7
|
-
import { i as De } from "./leaveGuard-Cc8yeLxM.js";
|
|
8
|
-
import { c as Pe, i as We, f as Be } from "./format-D8KUBmbS.js";
|
|
9
|
-
import { coreMessages as re, createMessageRuntime as He } from "./i18n/index.js";
|
|
10
|
-
import { i as Ve, a as Ge } from "./Icon.vue_vue_type_script_lang-BhhsFYwp.js";
|
|
11
|
-
import { i as Je, b as ze } from "./bottomDock-BZEiOPYZ.js";
|
|
12
|
-
import { i as Qe, p as Ue } from "./chrome-nUcmVu8G.js";
|
|
13
|
-
import { i as Xe, g as Ye } from "./platform-BQOX_Ntw.js";
|
|
14
|
-
import { c as Ze, A as et, r as ae } from "./access-DmAceEo5.js";
|
|
15
|
-
import { c as tt, _ as st } from "./NoAccess.vue_vue_type_script_setup_true_lang-BHzZtZ50.js";
|
|
16
|
-
import { i as ot } from "./guards-Biv_SlGn.js";
|
|
17
|
-
import { b as rt, c as at, n as ne } from "./navigation-TnVFYRaX.js";
|
|
18
|
-
import { c as nt, s as ie } from "./contributions-CeG4bszd.js";
|
|
19
|
-
import { a as ce } from "./environment-Dva-SG8D.js";
|
|
20
|
-
import { b as le, c as ue } from "./describeError-B-NMa--w.js";
|
|
21
|
-
import { _ as it } from "./Button.vue_vue_type_script_setup_true_lang-C74hcb0N.js";
|
|
22
|
-
import { _ as ct } from "./EmptyState.vue_vue_type_script_setup_true_lang-DbZiO2RF.js";
|
|
23
|
-
import { i as lt } from "./feature-DdUAfyi4.js";
|
|
24
|
-
function ut(e) {
|
|
25
|
-
const { platform: n } = e, o = W();
|
|
26
|
-
let c = null, v = null, y = !1;
|
|
27
|
-
function E(l, m) {
|
|
28
|
-
const h = new AbortController(), f = { controller: h, stops: [] };
|
|
29
|
-
for (const k of l)
|
|
30
|
-
try {
|
|
31
|
-
const b = m(k, h.signal);
|
|
32
|
-
typeof b == "function" && f.stops.push({ owned: k, stop: b });
|
|
33
|
-
} catch (b) {
|
|
34
|
-
e.onError(b, k);
|
|
35
|
-
}
|
|
36
|
-
return f;
|
|
37
|
-
}
|
|
38
|
-
function R(l) {
|
|
39
|
-
if (l) {
|
|
40
|
-
l.controller.abort();
|
|
41
|
-
for (const { owned: m, stop: h } of l.stops.reverse())
|
|
42
|
-
try {
|
|
43
|
-
h();
|
|
44
|
-
} catch (f) {
|
|
45
|
-
e.onError(f, m);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const M = (l) => e.effects.filter((m) => m.effect.scope === l), x = (l) => l.status !== "authenticated" ? null : e.sessionKey ? e.sessionKey(l) : String(l.user.id);
|
|
50
|
-
return {
|
|
51
|
-
start() {
|
|
52
|
-
if (y || c) return;
|
|
53
|
-
c = E(
|
|
54
|
-
M("app"),
|
|
55
|
-
(m, h) => m.effect.start({ signal: h, platform: n, report: (f) => e.onError(f, m) })
|
|
56
|
-
);
|
|
57
|
-
const l = M("session");
|
|
58
|
-
o.run(
|
|
59
|
-
() => B(
|
|
60
|
-
() => x(n.session.state.value),
|
|
61
|
-
(m) => {
|
|
62
|
-
R(v), v = null;
|
|
63
|
-
const h = n.session.state.value;
|
|
64
|
-
m === null || h.status !== "authenticated" || (v = E(
|
|
65
|
-
l,
|
|
66
|
-
(f, k) => f.effect.start({ signal: k, platform: n, user: h.user, report: (b) => e.onError(b, f) })
|
|
67
|
-
));
|
|
68
|
-
},
|
|
69
|
-
{ immediate: !0, flush: "sync" }
|
|
70
|
-
)
|
|
71
|
-
);
|
|
72
|
-
},
|
|
73
|
-
dispose() {
|
|
74
|
-
y || (y = !0, o.stop(), R(v), R(c), v = c = null);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
const ft = { class: "mx-auto flex min-h-screen max-w-content items-center justify-center p-screen-padding" }, dt = /* @__PURE__ */ me({
|
|
79
|
-
__name: "StartupFailure",
|
|
80
|
-
props: {
|
|
81
|
-
kind: {}
|
|
82
|
-
},
|
|
83
|
-
emits: ["retry"],
|
|
84
|
-
setup(e) {
|
|
85
|
-
const { t: n } = Fe();
|
|
86
|
-
return (o, c) => (je(), Ae("div", ft, [
|
|
87
|
-
te(K(ct), {
|
|
88
|
-
title: K(n)("core.startup.title"),
|
|
89
|
-
description: K(n)(e.kind === "startup" ? "core.startup.other" : `core.startup.${e.kind}`),
|
|
90
|
-
icon: "errorWarningLine"
|
|
91
|
-
}, {
|
|
92
|
-
actions: se(() => [
|
|
93
|
-
te(K(it), {
|
|
94
|
-
prominence: "primary",
|
|
95
|
-
icon: "refreshLine",
|
|
96
|
-
onClick: c[0] || (c[0] = (v) => o.$emit("retry"))
|
|
97
|
-
}, {
|
|
98
|
-
default: se(() => [
|
|
99
|
-
Ne(Ke(K(n)("core.actions.retry")), 1)
|
|
100
|
-
]),
|
|
101
|
-
_: 1
|
|
102
|
-
})
|
|
103
|
-
]),
|
|
104
|
-
_: 1
|
|
105
|
-
}, 8, ["title", "description"])
|
|
106
|
-
]));
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
class fe extends Error {
|
|
110
|
-
constructor(o) {
|
|
111
|
-
super(`The application composition is invalid:
|
|
112
|
-
${o.map((c) => ` - [${c.owner}] ${c.message}`).join(`
|
|
113
|
-
`)}`);
|
|
114
|
-
ee(this, "issues");
|
|
115
|
-
this.name = "ApplicationError", this.issues = o;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
const de = "application", w = (e) => `feature "${e.id}"`;
|
|
119
|
-
function* H(e, n = "") {
|
|
120
|
-
for (const o of e) {
|
|
121
|
-
const c = o.path.startsWith("/") ? o.path : `${n.replace(/\/$/, "")}/${o.path}`;
|
|
122
|
-
yield { record: o, path: c }, o.children && (yield* H(o.children, c));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
function pt(e) {
|
|
126
|
-
const n = [], o = (s, r) => n.push({ owner: s, message: r }), c = [];
|
|
127
|
-
e.features.forEach((s, r) => {
|
|
128
|
-
lt(s) ? c.push(s) : o(de, `features[${r}] was not created with defineFeature().`);
|
|
129
|
-
});
|
|
130
|
-
const v = /* @__PURE__ */ new Map();
|
|
131
|
-
for (const s of c)
|
|
132
|
-
v.has(s.id) ? o(w(s), `the feature id "${s.id}" is used twice in the features list.`) : v.set(s.id, s);
|
|
133
|
-
for (const s of c)
|
|
134
|
-
for (const r of s.requires)
|
|
135
|
-
v.has(r) || o(w(s), `requires the feature "${r}", which is not in the features list.`);
|
|
136
|
-
const y = [], E = /* @__PURE__ */ new Set(), R = (s) => {
|
|
137
|
-
if (E.has(s.id)) return;
|
|
138
|
-
const r = y.indexOf(s.id);
|
|
139
|
-
if (r !== -1) {
|
|
140
|
-
o(w(s), `requirements form a cycle: ${[...y.slice(r), s.id].join(" -> ")}.`), E.add(s.id);
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
y.push(s.id);
|
|
144
|
-
for (const u of s.requires) {
|
|
145
|
-
const i = v.get(u);
|
|
146
|
-
i && R(i);
|
|
147
|
-
}
|
|
148
|
-
y.pop(), E.add(s.id);
|
|
149
|
-
};
|
|
150
|
-
c.forEach(R);
|
|
151
|
-
const M = new Set(e.platform.config.capabilities);
|
|
152
|
-
for (const s of c)
|
|
153
|
-
for (const r of s.backend)
|
|
154
|
-
M.has(r) || o(w(s), `needs the backend capability "${r}", which the server does not report.`);
|
|
155
|
-
const x = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
156
|
-
for (const s of c) {
|
|
157
|
-
for (const r of s.routes) {
|
|
158
|
-
const u = r.path.length > 1 ? r.path.replace(/\/$/, "") : r.path, i = l.get(u);
|
|
159
|
-
i ? o(w(s), `declares the path "${r.path}", which feature "${i.id}" declares too.`) : l.set(u, s);
|
|
160
|
-
}
|
|
161
|
-
for (const { record: r } of H(s.routes)) {
|
|
162
|
-
if (r.meta && "feature" in r.meta && o(w(s), `the route "${String(r.name ?? r.path)}" sets meta.feature, which the runtime owns.`), typeof r.name != "string") continue;
|
|
163
|
-
const u = x.get(r.name);
|
|
164
|
-
u ? o(w(s), `declares the route name "${r.name}", which feature "${u.id}" declares too.`) : x.set(r.name, s);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
const m = new Set(e.reservedContexts), h = /* @__PURE__ */ new Map();
|
|
168
|
-
for (const s of c)
|
|
169
|
-
for (const { key: r } of s.contexts) {
|
|
170
|
-
const u = r.description ?? "a context";
|
|
171
|
-
m.has(r) && o(w(s), `provides the context "${u}", which the runtime provides itself.`);
|
|
172
|
-
const i = h.get(r);
|
|
173
|
-
i ? o(w(s), `provides the context "${u}", which feature "${i.id}" provides too.`) : h.set(r, s);
|
|
174
|
-
}
|
|
175
|
-
const f = /* @__PURE__ */ new Map(), k = (s, r) => {
|
|
176
|
-
for (const u of r) {
|
|
177
|
-
const i = f.get(u.namespace);
|
|
178
|
-
i ? o(s, `declares the message namespace "${u.namespace}", which ${i} declares too.`) : f.set(u.namespace, s);
|
|
179
|
-
for (const L of Object.keys(u.loaders))
|
|
180
|
-
e.supportedLocales.includes(L) || o(s, `the namespace "${u.namespace}" has a loader for "${L}", which is not a supported locale (${e.supportedLocales.join(", ")}).`);
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
for (const s of c) k(w(s), s.messages);
|
|
184
|
-
k(de, e.messages);
|
|
185
|
-
const b = (s) => f.has(s);
|
|
186
|
-
for (const s of c)
|
|
187
|
-
for (const { record: r } of H(s.routes))
|
|
188
|
-
for (const u of r.meta?.messages ?? [])
|
|
189
|
-
b(u) || o(w(s), `the route "${String(r.name ?? r.path)}" needs the message namespace "${u}", which nobody declares.`);
|
|
190
|
-
const O = /* @__PURE__ */ new Map();
|
|
191
|
-
for (const s of c)
|
|
192
|
-
for (const r of s.contributions) {
|
|
193
|
-
const u = O.get(r.id);
|
|
194
|
-
u ? o(w(s), `declares the shell contribution "${r.id}", which feature "${u.id}" declares too.`) : O.set(r.id, s), e.shellSlots && !r.optional && !e.shellSlots.includes(r.slot) && o(w(s), `contributes "${r.id}" to the slot "${r.slot}", which the shell does not render (it renders ${e.shellSlots.join(", ") || "none"}). Mark it optional to leave it out instead.`);
|
|
195
|
-
for (const i of r.messages ?? [])
|
|
196
|
-
b(i) || o(w(s), `the contribution "${r.id}" needs the message namespace "${i}", which nobody declares.`);
|
|
197
|
-
}
|
|
198
|
-
const _ = /* @__PURE__ */ new Map();
|
|
199
|
-
for (const s of c)
|
|
200
|
-
for (const r of s.effects) {
|
|
201
|
-
const u = _.get(r.id);
|
|
202
|
-
u ? o(w(s), `declares the effect "${r.id}", which feature "${u.id}" declares too.`) : _.set(r.id, s);
|
|
203
|
-
const i = r.scope;
|
|
204
|
-
i !== "app" && i !== "session" && o(w(s), `the effect "${r.id}" has the scope "${i}"; use "app" or "session".`);
|
|
205
|
-
}
|
|
206
|
-
return { features: c, issues: n };
|
|
207
|
-
}
|
|
208
|
-
const mt = (e, n, o) => Ie({
|
|
209
|
-
legacy: !1,
|
|
210
|
-
locale: e,
|
|
211
|
-
fallbackLocale: n,
|
|
212
|
-
pluralRules: o?.pluralRules && { ...o.pluralRules },
|
|
213
|
-
...o?.missingWarn === !1 && { missingWarn: !1, fallbackWarn: !1 },
|
|
214
|
-
messages: {}
|
|
215
|
-
}), ht = (e) => typeof e == "object" && e !== null && "component" in e && "slots" in e;
|
|
216
|
-
function he(e, n) {
|
|
217
|
-
return e.map((o) => ({
|
|
218
|
-
...o,
|
|
219
|
-
meta: { ...o.meta, feature: n },
|
|
220
|
-
...o.children && { children: he(o.children, n) }
|
|
221
|
-
}));
|
|
222
|
-
}
|
|
223
|
-
const pe = (e) => [...new Set(e)];
|
|
224
|
-
function Dt(e) {
|
|
225
|
-
const { platform: n } = e, o = e.locale?.supported ?? Object.keys(re), c = e.locale?.fallback ?? "en", v = e.shell === void 0 ? void 0 : ht(e.shell) ? e.shell : { component: e.shell, slots: void 0, progress: void 0 }, y = [];
|
|
226
|
-
o.includes(c) || y.push({ owner: "application", message: `the fallback locale "${c}" is not among the supported locales (${o.join(", ")}).` });
|
|
227
|
-
for (const t of Object.keys(e.locale?.flags ?? {}))
|
|
228
|
-
o.includes(t) || y.push({ owner: "application", message: `locale.flags names the locale "${t}", which is not among the supported locales (${o.join(", ")}).` });
|
|
229
|
-
const E = e.locale?.initial ?? (o.includes(n.config.locale) ? n.config.locale : c);
|
|
230
|
-
o.includes(E) || y.push({ owner: "application", message: `the initial locale "${E}" is not among the supported locales (${o.join(", ")}).` });
|
|
231
|
-
const R = [Ye, Be, Ue, ze, Ge, ne, ie, ae, ce, le, ue], M = pt({
|
|
232
|
-
features: e.features,
|
|
233
|
-
platform: n,
|
|
234
|
-
messages: e.messages ?? [],
|
|
235
|
-
reservedContexts: R,
|
|
236
|
-
supportedLocales: o,
|
|
237
|
-
shellSlots: v?.slots
|
|
238
|
-
}), x = [...y, ...M.issues], l = M.features, m = rt(
|
|
239
|
-
l.flatMap((t) => t.navigation.map((a) => ({ feature: t.id, binding: a }))),
|
|
240
|
-
e.navigation
|
|
241
|
-
);
|
|
242
|
-
for (const t of m.issues) x.push({ owner: "navigation", message: t });
|
|
243
|
-
if (x.length > 0) throw new fe(x);
|
|
244
|
-
const h = mt(E, c, e.i18n), f = h.global;
|
|
245
|
-
for (const [t, a] of Object.entries(re)) f.mergeLocaleMessage(t, a);
|
|
246
|
-
for (const [t, a] of Object.entries(e.i18n?.messages ?? {})) f.mergeLocaleMessage(t, a);
|
|
247
|
-
const { currencySymbol: k, ...b } = e.formatting ?? {}, O = Pe({ locale: () => f.locale.value, formatters: b, currencySymbol: k }), _ = [...l.flatMap((t) => t.messages), ...e.messages ?? []], s = (t) => (e.onError ?? gt)({ ...t, route: i.currentRoute.value.matched.length > 0 ? i.currentRoute.value.fullPath : null }), r = He({
|
|
248
|
-
target: f,
|
|
249
|
-
namespaces: _,
|
|
250
|
-
fallback: c,
|
|
251
|
-
supported: o,
|
|
252
|
-
onFailure: (t) => s({ source: "messages", error: t.error, detail: `${t.namespace} (${t.locale})`, feature: u.get(t.namespace) })
|
|
253
|
-
}), u = new Map(l.flatMap((t) => t.messages.map((a) => [a.namespace, t.id]))), i = Te({
|
|
254
|
-
history: e.router?.history ?? tt(),
|
|
255
|
-
routes: l.flatMap((t) => he(t.routes, t.id)),
|
|
256
|
-
scrollBehavior: e.router?.scrollBehavior ?? ((t, a) => t.name === a.name ? !1 : { top: 0 })
|
|
257
|
-
}), L = e.router?.login ?? { name: "login" }, ge = e.router?.home ?? { path: "/" }, C = [], V = (t) => {
|
|
258
|
-
try {
|
|
259
|
-
return i.resolve(t).matched.length > 0 ? null : "matches no route";
|
|
260
|
-
} catch (a) {
|
|
261
|
-
const p = a instanceof Error ? a.message : String(a);
|
|
262
|
-
return p.startsWith("No match for") ? "matches no route" : `cannot be resolved (${p})`;
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
if (l.some((t) => t.routes.some((a) => a.meta?.public !== !0))) {
|
|
266
|
-
const t = V(L) ?? (i.resolve(L).meta.public === !0 ? null : "is not public (meta.public: true)");
|
|
267
|
-
t && C.push({ owner: "application", message: `the login route ${JSON.stringify(L)} ${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.` });
|
|
268
|
-
}
|
|
269
|
-
for (const { feature: t, binding: a } of m.destinations.values()) {
|
|
270
|
-
const p = V(a.to);
|
|
271
|
-
p && C.push({ owner: `feature "${t}"`, message: `the destination "${a.destination}" is bound to ${JSON.stringify(a.to)}, which ${p}.` });
|
|
272
|
-
}
|
|
273
|
-
if (C.length > 0) throw new fe(C);
|
|
274
|
-
const j = Oe({ status: "idle" }), F = {
|
|
275
|
-
state: j,
|
|
276
|
-
locale: _e(() => f.locale.value),
|
|
277
|
-
locales: o,
|
|
278
|
-
localeFlags: e.locale?.flags ?? {},
|
|
279
|
-
setLocale: async (t) => {
|
|
280
|
-
const a = f.locale.value, p = await r.setLocale(t);
|
|
281
|
-
if (p && f.locale.value !== a) {
|
|
282
|
-
const g = (N) => s({ source: "locale", error: N, detail: t });
|
|
283
|
-
try {
|
|
284
|
-
Promise.resolve(e.locale?.onChange?.(t)).catch(g);
|
|
285
|
-
} catch (N) {
|
|
286
|
-
g(N);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return p;
|
|
290
|
-
},
|
|
291
|
-
retry: () => P()
|
|
292
|
-
}, T = {
|
|
293
|
-
contributions: l.flatMap((t) => t.contributions.map((a) => ({ feature: t.id, contribution: a }))),
|
|
294
|
-
effects: l.flatMap((t) => t.effects.map((a) => ({ feature: t.id, effect: a })))
|
|
295
|
-
}, G = ut({
|
|
296
|
-
effects: T.effects,
|
|
297
|
-
platform: n,
|
|
298
|
-
sessionKey: e.sessionKey,
|
|
299
|
-
onError: (t, a) => s({ source: "effect", error: t, feature: a.feature, detail: a.effect.id })
|
|
300
|
-
}), we = new Map(l.map((t) => [t.id, t.messages.map((a) => a.namespace)])), J = (t) => pe(T.contributions.filter(({ contribution: a }) => a.scope === t).flatMap(({ contribution: a }) => a.messages ?? [])), ve = J("always"), ye = J("authenticated");
|
|
301
|
-
async function $e(t) {
|
|
302
|
-
const a = t.matched.flatMap((g) => [...we.get(g.meta.feature ?? "") ?? [], ...g.meta.messages ?? []]), p = n.session.state.value.status === "authenticated";
|
|
303
|
-
await r.load(pe([...a, ...ve, ...p ? ye : []]));
|
|
304
|
-
}
|
|
305
|
-
let q = null;
|
|
306
|
-
function D(t) {
|
|
307
|
-
const a = t.meta.titleKey, p = q?.documentTitle.value ?? (a && f.te(a) ? f.t(a) : null), g = (e.router?.documentTitle ?? wt)(p, n.config.appName);
|
|
308
|
-
g !== "" && (document.title = g);
|
|
309
|
-
}
|
|
310
|
-
const be = at({ session: n.session, router: i, i18n: f, destinations: m.destinations }), Ee = nt(T.contributions, n.session), ke = Ze({ router: i, access: n.access, noAccess: e.noAccess ?? st }), Se = me({
|
|
311
|
-
name: "ApplicationRoot",
|
|
312
|
-
setup() {
|
|
313
|
-
return () => {
|
|
314
|
-
const t = j.value;
|
|
315
|
-
return t.status === "failed" ? oe(dt, { kind: t.kind, onRetry: () => void P() }) : t.status !== "ready" ? null : oe(v?.component ?? et);
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
}), d = Ce(Se);
|
|
319
|
-
Xe(d, n), d.use(h), We(d, O), q = Qe(d), Je(d), De(d), e.icons && Ve(d, ...Array.isArray(e.icons) ? e.icons : [e.icons]), d.provide(ce, F), e.describeError && d.provide(le, e.describeError), e.describeFieldError && d.provide(ue, e.describeFieldError), d.provide(ne, be), d.provide(ie, Ee), d.provide(ae, ke);
|
|
320
|
-
for (const t of l) for (const { key: a, value: p } of t.contexts) d.provide(a, p);
|
|
321
|
-
let S = !1, z = !1, Q = !1, U = !1;
|
|
322
|
-
const A = [];
|
|
323
|
-
function Re() {
|
|
324
|
-
const t = d.config.errorHandler;
|
|
325
|
-
d.config.errorHandler = ($, xe, Z) => {
|
|
326
|
-
s({ source: "vue", error: $, detail: Z }), t?.($, xe, Z);
|
|
327
|
-
};
|
|
328
|
-
const a = ($) => s({ source: "unhandledrejection", error: $.reason }), p = ($) => {
|
|
329
|
-
$.error && s({ source: "window", error: $.error });
|
|
330
|
-
};
|
|
331
|
-
window.addEventListener("unhandledrejection", a), window.addEventListener("error", p), A.push(() => {
|
|
332
|
-
window.removeEventListener("unhandledrejection", a), window.removeEventListener("error", p);
|
|
333
|
-
});
|
|
334
|
-
const g = l.some(($) => $.holdsExpiredSession);
|
|
335
|
-
n.session.holdExpired(g), A.push(() => n.session.holdExpired(!1)), A.push(
|
|
336
|
-
ot({
|
|
337
|
-
router: i,
|
|
338
|
-
session: n.session,
|
|
339
|
-
login: L,
|
|
340
|
-
home: ge,
|
|
341
|
-
holdExpired: g,
|
|
342
|
-
prepare: $e,
|
|
343
|
-
afterNavigation: D,
|
|
344
|
-
progress: e.router?.progress ?? v?.progress,
|
|
345
|
-
onError: ($) => s({ source: "router", error: $ })
|
|
346
|
-
})
|
|
347
|
-
);
|
|
348
|
-
const N = W();
|
|
349
|
-
N.run(() => B(() => q?.documentTitle.value, () => D(i.currentRoute.value))), A.push(() => N.stop());
|
|
350
|
-
const Y = W();
|
|
351
|
-
Y.run(
|
|
352
|
-
() => B(
|
|
353
|
-
() => f.locale.value,
|
|
354
|
-
($) => {
|
|
355
|
-
document.documentElement.lang = $, D(i.currentRoute.value);
|
|
356
|
-
},
|
|
357
|
-
{ immediate: !0 }
|
|
358
|
-
)
|
|
359
|
-
), A.push(() => Y.stop());
|
|
360
|
-
}
|
|
361
|
-
const I = (t, a) => {
|
|
362
|
-
j.value = { status: "failed", kind: t, error: a };
|
|
363
|
-
};
|
|
364
|
-
async function X() {
|
|
365
|
-
j.value = { status: "starting" };
|
|
366
|
-
const t = await n.session.restore();
|
|
367
|
-
if (S) return;
|
|
368
|
-
if (t.status === "failed") return I("session", t.error);
|
|
369
|
-
const a = t.status === "authenticated" ? t.user.locale : void 0;
|
|
370
|
-
if (typeof a == "string" && a !== f.locale.value && o.includes(a) && await F.setLocale(a), S) return;
|
|
371
|
-
const p = await r.loadEssential();
|
|
372
|
-
if (!S) {
|
|
373
|
-
if (p.length > 0) return I("messages", p[0].error);
|
|
374
|
-
try {
|
|
375
|
-
const g = await i.replace(i.options.history.location);
|
|
376
|
-
if (S) return;
|
|
377
|
-
if (qe(g)) return I("startup", g);
|
|
378
|
-
} catch (g) {
|
|
379
|
-
S || I("startup", g);
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
|
-
U || (d.use(i), U = !0), j.value = { status: "ready" }, G.start();
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
async function P() {
|
|
386
|
-
S || j.value.status !== "failed" || (await r.retry(), await X());
|
|
387
|
-
}
|
|
388
|
-
return {
|
|
389
|
-
app: d,
|
|
390
|
-
router: i,
|
|
391
|
-
i18n: h,
|
|
392
|
-
state: j,
|
|
393
|
-
locale: F.locale,
|
|
394
|
-
setLocale: F.setLocale,
|
|
395
|
-
async mount(t) {
|
|
396
|
-
if (S) throw new Error("This application was disposed; create a new one with createApplication().");
|
|
397
|
-
if (z) throw new Error("This application is already mounted.");
|
|
398
|
-
z = !0, Re(), await X(), !S && (d.mount(t), Q = !0);
|
|
399
|
-
},
|
|
400
|
-
retry: P,
|
|
401
|
-
dispose() {
|
|
402
|
-
if (!S) {
|
|
403
|
-
S = !0, G.dispose(), r.dispose(), Q && d.unmount();
|
|
404
|
-
for (const t of A.reverse()) t();
|
|
405
|
-
i.options.history.destroy();
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
function gt(e) {
|
|
411
|
-
console.error(`[vue-core] ${e.source}${e.feature ? ` (${e.feature})` : ""}${e.detail ? `: ${e.detail}` : ""}`, e.error);
|
|
412
|
-
}
|
|
413
|
-
function wt(e, n) {
|
|
414
|
-
return [e, n].filter((o) => !!o).join(" · ");
|
|
415
|
-
}
|
|
416
|
-
export {
|
|
417
|
-
fe as A,
|
|
418
|
-
Dt as c,
|
|
419
|
-
gt as d
|
|
420
|
-
};
|
package/dist/format-D8KUBmbS.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { d as F } from "./context-Ch1r4fdN.js";
|
|
2
|
-
import { i as s } from "./intlLocale-CeRU44qJ.js";
|
|
3
|
-
const N = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
4
|
-
function d(r) {
|
|
5
|
-
if (r == null || r === "") return null;
|
|
6
|
-
let n;
|
|
7
|
-
if (r instanceof Date) n = r;
|
|
8
|
-
else if (typeof r == "number") n = new Date(r);
|
|
9
|
-
else {
|
|
10
|
-
const m = N.exec(r);
|
|
11
|
-
n = m ? new Date(Number(m[1]), Number(m[2]) - 1, Number(m[3])) : new Date(r);
|
|
12
|
-
}
|
|
13
|
-
return Number.isNaN(n.getTime()) || n.getTime() <= 0 ? null : n;
|
|
14
|
-
}
|
|
15
|
-
const b = { year: "numeric", month: "2-digit", day: "2-digit" }, y = { hour: "2-digit", minute: "2-digit" }, f = [
|
|
16
|
-
["year", 31536e3],
|
|
17
|
-
["month", 2592e3],
|
|
18
|
-
["week", 604800],
|
|
19
|
-
["day", 86400],
|
|
20
|
-
["hour", 3600],
|
|
21
|
-
["minute", 60],
|
|
22
|
-
["second", 1]
|
|
23
|
-
];
|
|
24
|
-
function T() {
|
|
25
|
-
const r = /* @__PURE__ */ new Map(), n = (e, t) => {
|
|
26
|
-
let i = r.get(e);
|
|
27
|
-
return i || (i = t(), r.set(e, i)), i;
|
|
28
|
-
}, m = (e, t) => n(`d|${e}|${JSON.stringify(t)}`, () => new Intl.DateTimeFormat(s(e), t));
|
|
29
|
-
return {
|
|
30
|
-
date: (e, t) => m(t, b).format(e),
|
|
31
|
-
dateTime: (e, t) => m(t, { ...b, ...y }).format(e),
|
|
32
|
-
time: (e, t) => m(t, y).format(e),
|
|
33
|
-
number: (e, t, i) => n(`n|${t}|${JSON.stringify(i ?? {})}`, () => new Intl.NumberFormat(s(t), i)).format(e),
|
|
34
|
-
money: (e, t, i, a) => n(`m|${i}|${t}|${JSON.stringify(a ?? {})}`, () => new Intl.NumberFormat(s(i), { ...a, style: "currency", currency: t })).format(e),
|
|
35
|
-
relative(e, t, i) {
|
|
36
|
-
const a = Math.trunc((e.getTime() - i.getTime()) / 1e3), [u, c] = f.find(([, o]) => Math.abs(a) >= o) ?? f[f.length - 1];
|
|
37
|
-
return n(`r|${t}`, () => new Intl.RelativeTimeFormat(s(t), { numeric: "auto" })).format(Math.trunc(a / c), u);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function w(r) {
|
|
42
|
-
const n = { ...T(), ...r.formatters }, m = (e) => typeof e == "number" && Number.isFinite(e);
|
|
43
|
-
return {
|
|
44
|
-
get locale() {
|
|
45
|
-
return r.locale();
|
|
46
|
-
},
|
|
47
|
-
date: (e) => {
|
|
48
|
-
const t = d(e);
|
|
49
|
-
return t ? n.date(t, r.locale()) : "";
|
|
50
|
-
},
|
|
51
|
-
dateTime: (e) => {
|
|
52
|
-
const t = d(e);
|
|
53
|
-
return t ? n.dateTime(t, r.locale()) : "";
|
|
54
|
-
},
|
|
55
|
-
time: (e) => {
|
|
56
|
-
const t = d(e);
|
|
57
|
-
return t ? n.time(t, r.locale()) : "";
|
|
58
|
-
},
|
|
59
|
-
number: (e, t) => m(e) ? n.number(e, r.locale(), t) : "",
|
|
60
|
-
get currencySymbol() {
|
|
61
|
-
return r.currencySymbol ?? "";
|
|
62
|
-
},
|
|
63
|
-
money: (e, { currency: t, decimals: i, whole: a, symbol: u = !0 } = {}) => {
|
|
64
|
-
if (!m(e)) return "";
|
|
65
|
-
const c = e, o = a && Number.isInteger(c) ? 0 : i, l = o === void 0 ? void 0 : { minimumFractionDigits: o, maximumFractionDigits: o };
|
|
66
|
-
if (t && u) return n.money(c, t, r.locale(), l);
|
|
67
|
-
const g = n.number(c, r.locale(), l ?? { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
68
|
-
return u && !t && r.currencySymbol ? `${g} ${r.currencySymbol}` : g;
|
|
69
|
-
},
|
|
70
|
-
relative: (e, t = /* @__PURE__ */ new Date()) => {
|
|
71
|
-
const i = d(e);
|
|
72
|
-
return i ? n.relative(i, r.locale(), t) : "";
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
const [D, I] = F("vue-core.formatting");
|
|
77
|
-
function S(r, n) {
|
|
78
|
-
r.provide(D, n);
|
|
79
|
-
}
|
|
80
|
-
export {
|
|
81
|
-
T as a,
|
|
82
|
-
w as c,
|
|
83
|
-
D as f,
|
|
84
|
-
S as i,
|
|
85
|
-
d as t,
|
|
86
|
-
I as u
|
|
87
|
-
};
|
package/dist/http-Dm0uXY9O.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
const p = [5, 8, 10, 15, 25, 50, 100], y = 25;
|
|
2
|
-
function E(e) {
|
|
3
|
-
const t = `defineCollection("${e.id}")`;
|
|
4
|
-
if (typeof e.id != "string" || e.id.trim() === "") throw new Error("defineCollection: `id` must be a non-empty string.");
|
|
5
|
-
if (!Number.isInteger(e.stateVersion) || e.stateVersion < 1) throw new Error(`${t}: \`stateVersion\` must be a positive integer.`);
|
|
6
|
-
if (typeof e.load != "function") throw new Error(`${t}: \`load\` must be a function.`);
|
|
7
|
-
if (typeof e.key != "function") throw new Error(`${t}: \`key\` must be a function.`);
|
|
8
|
-
const r = {
|
|
9
|
-
sorts: e.query?.sorts ? [...e.query.sorts] : null,
|
|
10
|
-
filters: e.query?.filters ? [...e.query.filters] : null,
|
|
11
|
-
views: e.query?.views ? [...e.query.views] : null,
|
|
12
|
-
sensitive: [...e.query?.sensitive ?? []],
|
|
13
|
-
pageSizes: [...e.query?.pageSizes ?? p],
|
|
14
|
-
search: e.query?.search ?? !0
|
|
15
|
-
};
|
|
16
|
-
if (r.pageSizes.length === 0 || r.pageSizes.some((n) => !Number.isInteger(n) || n < 1))
|
|
17
|
-
throw new Error(`${t}: \`query.pageSizes\` must list positive integers.`);
|
|
18
|
-
for (const n of r.sensitive)
|
|
19
|
-
if (r.filters && !r.filters.includes(n)) throw new Error(`${t}: sensitive filter "${n}" is not in \`query.filters\`.`);
|
|
20
|
-
const i = e.defaults ?? {}, a = i.pageSize ?? (r.pageSizes.includes(y) ? y : r.pageSizes[0]);
|
|
21
|
-
if (!r.pageSizes.includes(a)) throw new Error(`${t}: default page size ${a} is not one of ${r.pageSizes.join(", ")}.`);
|
|
22
|
-
const s = i.sort ?? null;
|
|
23
|
-
if (s !== null && r.sorts && !r.sorts.includes(s)) throw new Error(`${t}: default sort "${s}" is not in \`query.sorts\`.`);
|
|
24
|
-
const o = i.view ?? null;
|
|
25
|
-
if (o !== null && r.views && !r.views.includes(o)) throw new Error(`${t}: default view "${o}" is not in \`query.views\`.`);
|
|
26
|
-
const f = Object.fromEntries(Object.entries(i.filters ?? {}).filter(([, n]) => n !== void 0 && n !== ""));
|
|
27
|
-
for (const n of Object.keys(f))
|
|
28
|
-
if (r.filters && !r.filters.includes(n)) throw new Error(`${t}: default filter "${n}" is not in \`query.filters\`.`);
|
|
29
|
-
const c = i.page ?? 1;
|
|
30
|
-
if (!Number.isInteger(c) || c < 1) throw new Error(`${t}: default page must be a positive integer.`);
|
|
31
|
-
const g = i.direction ?? "asc";
|
|
32
|
-
if (g !== "asc" && g !== "desc") throw new Error(`${t}: default direction must be "asc" or "desc".`);
|
|
33
|
-
return Object.freeze({
|
|
34
|
-
id: e.id,
|
|
35
|
-
stateVersion: e.stateVersion,
|
|
36
|
-
load: e.load,
|
|
37
|
-
key: e.key,
|
|
38
|
-
defaults: Object.freeze({
|
|
39
|
-
page: c,
|
|
40
|
-
pageSize: a,
|
|
41
|
-
sort: s,
|
|
42
|
-
direction: g,
|
|
43
|
-
search: i.search ?? "",
|
|
44
|
-
view: o,
|
|
45
|
-
filters: Object.freeze(f)
|
|
46
|
-
}),
|
|
47
|
-
contract: Object.freeze(r),
|
|
48
|
-
migrate: e.migrate
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
const d = (e) => typeof e == "object" && e !== null && !Array.isArray(e), l = (...e) => {
|
|
52
|
-
for (const t of e) if (typeof t == "number" && Number.isFinite(t)) return t;
|
|
53
|
-
return null;
|
|
54
|
-
};
|
|
55
|
-
function v(e) {
|
|
56
|
-
return {
|
|
57
|
-
// Filters first: the reserved names below always win, a filter called "page" cannot break paging.
|
|
58
|
-
...e.filters,
|
|
59
|
-
page: e.page,
|
|
60
|
-
per_page: e.pageSize,
|
|
61
|
-
order_col: e.sort,
|
|
62
|
-
order_dir: e.sort ? e.direction : null,
|
|
63
|
-
search: e.search,
|
|
64
|
-
view: e.view
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function b(e, t) {
|
|
68
|
-
const r = e.data, i = d(r) && Array.isArray(r.data), a = Array.isArray(r) ? r : i ? r.data : [], s = i ? r : {}, o = d(e.meta) ? e.meta : d(s.meta) ? s.meta : {}, f = l(s.per_page, o.per_page) ?? t.pageSize, c = l(s.total, o.total) ?? a.length, g = l(s.current_page, o.page, o.current_page) ?? t.page, n = l(s.last_page, o.last_page) ?? (c === 0 ? 0 : Math.ceil(c / Math.max(1, f))), u = l(s.from, o.from) ?? (a.length === 0 ? 0 : (g - 1) * f + 1), m = l(s.to, o.to) ?? (a.length === 0 ? 0 : u + a.length - 1), h = Array.isArray(o.views) ? o.views : Array.isArray(s.views) ? s.views : void 0;
|
|
69
|
-
return {
|
|
70
|
-
rows: a,
|
|
71
|
-
total: c,
|
|
72
|
-
page: g,
|
|
73
|
-
pageSize: f,
|
|
74
|
-
lastPage: n,
|
|
75
|
-
from: u,
|
|
76
|
-
to: m,
|
|
77
|
-
views: h?.filter(d).flatMap((w) => typeof w.key == "string" ? [{ key: w.key, count: l(w.count) ?? void 0 }] : []),
|
|
78
|
-
// Like `Row`, the shape of `meta` is the caller's word, not checked.
|
|
79
|
-
meta: o,
|
|
80
|
-
requestId: e.requestId
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function z(e, t, r = {}) {
|
|
84
|
-
return async (i, { signal: a }) => {
|
|
85
|
-
const s = await e.get(t, { query: r.params ? r.params(i) : v(i), signal: a });
|
|
86
|
-
return b(s, i);
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
export {
|
|
90
|
-
p as D,
|
|
91
|
-
E as d,
|
|
92
|
-
z as h,
|
|
93
|
-
v as l,
|
|
94
|
-
b as r
|
|
95
|
-
};
|